Files
hyperframes/docs/public/catalog/blocks/frost-sequence-camera-orbit.json
Miguel Ángel f835f83164 fix(catalog): 3D previews load their scripts under the docs host's script policy (#5090)
* fix(catalog): 3D previews load their scripts under the docs host's script policy

* fix(catalog): preserve script text through HTML parsing

* docs(catalog): describe the shared script bundle
2026-10-05 15:52:51 -07:00

1 line
1.8 MiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"html":"<!doctype html>\n<html lang=\"en\">\n <head><base href=\"/public/catalog/items/frost-sequence-camera-orbit/\">\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=1920, height=1080\" />\n <title>Frost Sequence Rig</title>\n <script>(function(){\nconst vendor=(url)=>fetch(url).then((r)=>r.json()).then((j)=>j.text);\nconst run=(code,name)=>{const s=document.createElement(\"script\");s.text=code+\"\\n//# sourceURL=hyperframes-catalog://frost-sequence-camera-orbit/\"+name;document.head.append(s);};\n(async()=>{\nrun(await vendor(\"/public/catalog/vendor/gsap-3.14.2.min.json\"),\"gsap-3.14.2.min.js\");\nrun(\"/* Frost: three@0.185.1 (MIT) + three-mesh-bvh@0.9.14 (MIT). Generated by build.mjs; edit src/ and rebuild. */\\nvar Frost=(()=>{var cD=Object.create,Nf=Object.defineProperty,pD=Object.getOwnPropertyDescriptor,mD=Object.getOwnPropertyNames,fD=Object.getPrototypeOf,gD=Object.prototype.hasOwnProperty,pM=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),mM=(e,t)=>{for(var r in t)Nf(e,r,{get:t[r],enumerable:!0})},fM=(e,t,r,i)=>{if(t&&typeof t==\\\"object\\\"||typeof t==\\\"function\\\")for(let s of mD(t))!gD.call(e,s)&&s!==r&&Nf(e,s,{get:()=>t[s],enumerable:!(i=pD(t,s))||i.enumerable});return e},yD=(e,t,r)=>(r=e!=null?cD(fD(e)):{},fM(t||!e||!e.__esModule?Nf(r,\\\"default\\\",{value:e,enumerable:!0}):r,e)),xD=e=>fM(Nf({},\\\"__esModule\\\",{value:!0}),e),vD=pM((e,t)=>{(function(){\\\"use strict\\\";var r={};r.version=\\\"6.4.2.2\\\",r.use_lines=!0,r.use_xyz=!1;var i=!1;typeof t\\u003c\\\"u\\\"&&t.exports?(t.exports=r,i=!0):(typeof define==\\\"function\\\"&&define.amd&&define(r),typeof document\\u003c\\\"u\\\"?window.ClipperLib=r:self.ClipperLib=r);var s;if(i){var a=\\\"chrome\\\";s=\\\"Netscape\\\"}else{var a=navigator.userAgent.toString().toLowerCase();s=navigator.appName}var n={};a.indexOf(\\\"chrome\\\")!=-1&&a.indexOf(\\\"chromium\\\")==-1?n.chrome=1:n.chrome=0,a.indexOf(\\\"chromium\\\")!=-1?n.chromium=1:n.chromium=0,a.indexOf(\\\"safari\\\")!=-1&&a.indexOf(\\\"chrome\\\")==-1&&a.indexOf(\\\"chromium\\\")==-1?n.safari=1:n.safari=0,a.indexOf(\\\"firefox\\\")!=-1?n.firefox=1:n.firefox=0,a.indexOf(\\\"firefox/17\\\")!=-1?n.firefox17=1:n.firefox17=0,a.indexOf(\\\"firefox/15\\\")!=-1?n.firefox15=1:n.firefox15=0,a.indexOf(\\\"firefox/3\\\")!=-1?n.firefox3=1:n.firefox3=0,a.indexOf(\\\"opera\\\")!=-1?n.opera=1:n.opera=0,a.indexOf(\\\"msie 10\\\")!=-1?n.msie10=1:n.msie10=0,a.indexOf(\\\"msie 9\\\")!=-1?n.msie9=1:n.msie9=0,a.indexOf(\\\"msie 8\\\")!=-1?n.msie8=1:n.msie8=0,a.indexOf(\\\"msie 7\\\")!=-1?n.msie7=1:n.msie7=0,a.indexOf(\\\"msie \\\")!=-1?n.msie=1:n.msie=0,r.biginteger_used=null;var o,l=0xdeadbeefcafe,u=(l&16777215)==15715070;function h(p,f,x){r.biginteger_used=1,p!=null&&(typeof p==\\\"number\\\"&&typeof f>\\\"u\\\"?this.fromInt(p):typeof p==\\\"number\\\"?this.fromNumber(p,f,x):f==null&&typeof p!=\\\"string\\\"?this.fromString(p,256):this.fromString(p,f))}function d(){return new h(null,void 0,void 0)}function c(p,f,x,_,A,B){for(;--B>=0;){var k=f*this[p++]+x[_]+A;A=Math.floor(k/67108864),x[_++]=k&67108863}return A}function m(p,f,x,_,A,B){for(var k=f&32767,ee=f>>15;--B>=0;){var te=this[p]&32767,me=this[p++]>>15,Le=ee*te+me*k;te=k*te+((Le&32767)\\u003c\\u003c15)+x[_]+(A&1073741823),A=(te>>>30)+(Le>>>15)+ee*me+(A>>>30),x[_++]=te&1073741823}return A}function g(p,f,x,_,A,B){for(var k=f&16383,ee=f>>14;--B>=0;){var te=this[p]&16383,me=this[p++]>>14,Le=ee*te+me*k;te=k*te+((Le&16383)\\u003c\\u003c14)+x[_]+A,A=(te>>28)+(Le>>14)+ee*me,x[_++]=te&268435455}return A}u&&s==\\\"Microsoft Internet Explorer\\\"?(h.prototype.am=m,o=30):u&&s!=\\\"Netscape\\\"?(h.prototype.am=c,o=26):(h.prototype.am=g,o=28),h.prototype.DB=o,h.prototype.DM=(1\\u003c\\u003co)-1,h.prototype.DV=1\\u003c\\u003co;var y=52;h.prototype.FV=Math.pow(2,y),h.prototype.F1=y-o,h.prototype.F2=2*o-y;var b=\\\"0123456789abcdefghijklmnopqrstuvwxyz\\\",v=new Array,S,T;for(S=48,T=0;T\\u003c=9;++T)v[S++]=T;for(S=97,T=10;T\\u003c36;++T)v[S++]=T;for(S=65,T=10;T\\u003c36;++T)v[S++]=T;function w(p){return b.charAt(p)}function N(p,f){var x=v[p.charCodeAt(f)];return x??-1}function C(p){for(var f=this.t-1;f>=0;--f)p[f]=this[f];p.t=this.t,p.s=this.s}function R(p){this.t=1,this.s=p\\u003c0?-1:0,p>0?this[0]=p:p\\u003c-1?this[0]=p+this.DV:this.t=0}function E(p){var f=d();return f.fromInt(p),f}function P(p,f){var x;if(f==16)x=4;else if(f==8)x=3;else if(f==256)x=8;else if(f==2)x=1;else if(f==32)x=5;else if(f==4)x=2;else{this.fromRadix(p,f);return}this.t=0,this.s=0;for(var _=p.length,A=!1,B=0;--_>=0;){var k=x==8?p[_]&255:N(p,_);if(k\\u003c0){p.charAt(_)==\\\"-\\\"&&(A=!0);continue}A=!1,B==0?this[this.t++]=k:B+x>this.DB?(this[this.t-1]|=(k&(1\\u003c\\u003cthis.DB-B)-1)\\u003c\\u003cB,this[this.t++]=k>>this.DB-B):this[this.t-1]|=k\\u003c\\u003cB,B+=x,B>=this.DB&&(B-=this.DB)}x==8&&(p[0]&128)!=0&&(this.s=-1,B>0&&(this[this.t-1]|=(1\\u003c\\u003cthis.DB-B)-1\\u003c\\u003cB)),this.clamp(),A&&h.ZERO.subTo(this,this)}function I(){for(var p=this.s&this.DM;this.t>0&&this[this.t-1]==p;)--this.t}function O(p){if(this.s\\u003c0)return\\\"-\\\"+this.negate().toString(p);var f;if(p==16)f=4;else if(p==8)f=3;else if(p==2)f=1;else if(p==32)f=5;else if(p==4)f=2;else return this.toRadix(p);var x=(1\\u003c\\u003cf)-1,_,A=!1,B=\\\"\\\",k=this.t,ee=this.DB-k*this.DB%f;if(k-- >0)for(ee\\u003cthis.DB&&(_=this[k]>>ee)>0&&(A=!0,B=w(_));k>=0;)ee\\u003cf?(_=(this[k]&(1\\u003c\\u003cee)-1)\\u003c\\u003cf-ee,_|=this[--k]>>(ee+=this.DB-f)):(_=this[k]>>(ee-=f)&x,ee\\u003c=0&&(ee+=this.DB,--k)),_>0&&(A=!0),A&&(B+=w(_));return A?B:\\\"0\\\"}function L(){var p=d();return h.ZERO.subTo(this,p),p}function X(){return this.s\\u003c0?this.negate():this}function z(p){var f=this.s-p.s;if(f!=0)return f;var x=this.t;if(f=x-p.t,f!=0)return this.s\\u003c0?-f:f;for(;--x>=0;)if((f=this[x]-p[x])!=0)return f;return 0}function H(p){var f=1,x;return(x=p>>>16)!=0&&(p=x,f+=16),(x=p>>8)!=0&&(p=x,f+=8),(x=p>>4)!=0&&(p=x,f+=4),(x=p>>2)!=0&&(p=x,f+=2),(x=p>>1)!=0&&(p=x,f+=1),f}function ue(){return this.t\\u003c=0?0:this.DB*(this.t-1)+H(this[this.t-1]^this.s&this.DM)}function ne(p,f){var x;for(x=this.t-1;x>=0;--x)f[x+p]=this[x];for(x=p-1;x>=0;--x)f[x]=0;f.t=this.t+p,f.s=this.s}function re(p,f){for(var x=p;x\\u003cthis.t;++x)f[x-p]=this[x];f.t=Math.max(this.t-p,0),f.s=this.s}function ce(p,f){var x=p%this.DB,_=this.DB-x,A=(1\\u003c\\u003c_)-1,B=Math.floor(p/this.DB),k=this.s\\u003c\\u003cx&this.DM,ee;for(ee=this.t-1;ee>=0;--ee)f[ee+B+1]=this[ee]>>_|k,k=(this[ee]&A)\\u003c\\u003cx;for(ee=B-1;ee>=0;--ee)f[ee]=0;f[B]=k,f.t=this.t+B+1,f.s=this.s,f.clamp()}function ge(p,f){f.s=this.s;var x=Math.floor(p/this.DB);if(x>=this.t){f.t=0;return}var _=p%this.DB,A=this.DB-_,B=(1\\u003c\\u003c_)-1;f[0]=this[x]>>_;for(var k=x+1;k\\u003cthis.t;++k)f[k-x-1]|=(this[k]&B)\\u003c\\u003cA,f[k-x]=this[k]>>_;_>0&&(f[this.t-x-1]|=(this.s&B)\\u003c\\u003cA),f.t=this.t-x,f.clamp()}function ye(p,f){for(var x=0,_=0,A=Math.min(p.t,this.t);x\\u003cA;)_+=this[x]-p[x],f[x++]=_&this.DM,_>>=this.DB;if(p.t\\u003cthis.t){for(_-=p.s;x\\u003cthis.t;)_+=this[x],f[x++]=_&this.DM,_>>=this.DB;_+=this.s}else{for(_+=this.s;x\\u003cp.t;)_-=p[x],f[x++]=_&this.DM,_>>=this.DB;_-=p.s}f.s=_\\u003c0?-1:0,_\\u003c-1?f[x++]=this.DV+_:_>0&&(f[x++]=_),f.t=x,f.clamp()}function oe(p,f){var x=this.abs(),_=p.abs(),A=x.t;for(f.t=A+_.t;--A>=0;)f[A]=0;for(A=0;A\\u003c_.t;++A)f[A+x.t]=x.am(0,_[A],f,A,0,x.t);f.s=0,f.clamp(),this.s!=p.s&&h.ZERO.subTo(f,f)}function Ae(p){for(var f=this.abs(),x=p.t=2*f.t;--x>=0;)p[x]=0;for(x=0;x\\u003cf.t-1;++x){var _=f.am(x,f[x],p,2*x,0,1);(p[x+f.t]+=f.am(x+1,2*f[x],p,2*x+1,_,f.t-x-1))>=f.DV&&(p[x+f.t]-=f.DV,p[x+f.t+1]=1)}p.t>0&&(p[p.t-1]+=f.am(x,f[x],p,2*x,0,1)),p.s=0,p.clamp()}function Ie(p,f,x){var _=p.abs();if(!(_.t\\u003c=0)){var A=this.abs();if(A.t\\u003c_.t){f?.fromInt(0),x!=null&&this.copyTo(x);return}x==null&&(x=d());var B=d(),k=this.s,ee=p.s,te=this.DB-H(_[_.t-1]);te>0?(_.lShiftTo(te,B),A.lShiftTo(te,x)):(_.copyTo(B),A.copyTo(x));var me=B.t,Le=B[me-1];if(Le!=0){var Me=Le*(1\\u003c\\u003cthis.F1)+(me>1?B[me-2]>>this.F2:0),Ge=this.FV/Me,xt=(1\\u003c\\u003cthis.F1)/Me,kt=1\\u003c\\u003cthis.F2,Vt=x.t,fr=Vt-me,ks=f??d();for(B.dlShiftTo(fr,ks),x.compareTo(ks)>=0&&(x[x.t++]=1,x.subTo(ks,x)),h.ONE.dlShiftTo(me,ks),ks.subTo(B,B);B.t\\u003cme;)B[B.t++]=0;for(;--fr>=0;){var Qn=x[--Vt]==Le?this.DM:Math.floor(x[Vt]*Ge+(x[Vt-1]+kt)*xt);if((x[Vt]+=B.am(0,Qn,x,fr,0,me))\\u003cQn)for(B.dlShiftTo(fr,ks),x.subTo(ks,x);x[Vt]\\u003c--Qn;)x.subTo(ks,x)}f!=null&&(x.drShiftTo(me,f),k!=ee&&h.ZERO.subTo(f,f)),x.t=me,x.clamp(),te>0&&x.rShiftTo(te,x),k\\u003c0&&h.ZERO.subTo(x,x)}}}function Xe(p){var f=d();return this.abs().divRemTo(p,null,f),this.s\\u003c0&&f.compareTo(h.ZERO)>0&&p.subTo(f,f),f}function at(p){this.m=p}function W(p){return p.s\\u003c0||p.compareTo(this.m)>=0?p.mod(this.m):p}function j(p){return p}function G(p){p.divRemTo(this.m,null,p)}function ae(p,f,x){p.multiplyTo(f,x),this.reduce(x)}function be(p,f){p.squareTo(f),this.reduce(f)}at.prototype.convert=W,at.prototype.revert=j,at.prototype.reduce=G,at.prototype.mulTo=ae,at.prototype.sqrTo=be;function Be(){if(this.t\\u003c1)return 0;var p=this[0];if((p&1)==0)return 0;var f=p&3;return f=f*(2-(p&15)*f)&15,f=f*(2-(p&255)*f)&255,f=f*(2-((p&65535)*f&65535))&65535,f=f*(2-p*f%this.DV)%this.DV,f>0?this.DV-f:-f}function $(p){this.m=p,this.mp=p.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1\\u003c\\u003cp.DB-15)-1,this.mt2=2*p.t}function U(p){var f=d();return p.abs().dlShiftTo(this.m.t,f),f.divRemTo(this.m,null,f),p.s\\u003c0&&f.compareTo(h.ZERO)>0&&this.m.subTo(f,f),f}function J(p){var f=d();return p.copyTo(f),this.reduce(f),f}function q(p){for(;p.t\\u003c=this.mt2;)p[p.t++]=0;for(var f=0;f\\u003cthis.m.t;++f){var x=p[f]&32767,_=x*this.mpl+((x*this.mph+(p[f]>>15)*this.mpl&this.um)\\u003c\\u003c15)&p.DM;for(x=f+this.m.t,p[x]+=this.m.am(0,_,p,f,0,this.m.t);p[x]>=p.DV;)p[x]-=p.DV,p[++x]++}p.clamp(),p.drShiftTo(this.m.t,p),p.compareTo(this.m)>=0&&p.subTo(this.m,p)}function se(p,f){p.squareTo(f),this.reduce(f)}function pe(p,f,x){p.multiplyTo(f,x),this.reduce(x)}$.prototype.convert=U,$.prototype.revert=J,$.prototype.reduce=q,$.prototype.mulTo=pe,$.prototype.sqrTo=se;function Te(){return(this.t>0?this[0]&1:this.s)==0}function we(p,f){if(p>4294967295||p\\u003c1)return h.ONE;var x=d(),_=d(),A=f.convert(this),B=H(p)-1;for(A.copyTo(x);--B>=0;)if(f.sqrTo(x,_),(p&1\\u003c\\u003cB)>0)f.mulTo(_,A,x);else{var k=x;x=_,_=k}return f.revert(x)}function ie(p,f){var x;return p\\u003c256||f.isEven()?x=new at(f):x=new $(f),this.exp(p,x)}h.prototype.copyTo=C,h.prototype.fromInt=R,h.prototype.fromString=P,h.prototype.clamp=I,h.prototype.dlShiftTo=ne,h.prototype.drShiftTo=re,h.prototype.lShiftTo=ce,h.prototype.rShiftTo=ge,h.prototype.subTo=ye,h.prototype.multiplyTo=oe,h.prototype.squareTo=Ae,h.prototype.divRemTo=Ie,h.prototype.invDigit=Be,h.prototype.isEven=Te,h.prototype.exp=we,h.prototype.toString=O,h.prototype.negate=L,h.prototype.abs=X,h.prototype.compareTo=z,h.prototype.bitLength=ue,h.prototype.mod=Xe,h.prototype.modPowInt=ie,h.ZERO=E(0),h.ONE=E(1);function V(){var p=d();return this.copyTo(p),p}function Oe(){if(this.s\\u003c0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1\\u003c\\u003c32-this.DB)-1)\\u003c\\u003cthis.DB|this[0]}function tt(){return this.t==0?this.s:this[0]\\u003c\\u003c24>>24}function Je(){return this.t==0?this.s:this[0]\\u003c\\u003c16>>16}function ct(p){return Math.floor(Math.LN2*this.DB/Math.log(p))}function _e(){return this.s\\u003c0?-1:this.t\\u003c=0||this.t==1&&this[0]\\u003c=0?0:1}function nt(p){if(p==null&&(p=10),this.signum()==0||p\\u003c2||p>36)return\\\"0\\\";var f=this.chunkSize(p),x=Math.pow(p,f),_=E(x),A=d(),B=d(),k=\\\"\\\";for(this.divRemTo(_,A,B);A.signum()>0;)k=(x+B.intValue()).toString(p).substr(1)+k,A.divRemTo(_,A,B);return B.intValue().toString(p)+k}function dt(p,f){this.fromInt(0),f==null&&(f=10);for(var x=this.chunkSize(f),_=Math.pow(f,x),A=!1,B=0,k=0,ee=0;ee\\u003cp.length;++ee){var te=N(p,ee);if(te\\u003c0){p.charAt(ee)==\\\"-\\\"&&this.signum()==0&&(A=!0);continue}k=f*k+te,++B>=x&&(this.dMultiply(_),this.dAddOffset(k,0),B=0,k=0)}B>0&&(this.dMultiply(Math.pow(f,B)),this.dAddOffset(k,0)),A&&h.ZERO.subTo(this,this)}function ft(p,f,x){if(typeof f==\\\"number\\\")if(p\\u003c2)this.fromInt(1);else for(this.fromNumber(p,x),this.testBit(p-1)||this.bitwiseTo(h.ONE.shiftLeft(p-1),Tr,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(f);)this.dAddOffset(2,0),this.bitLength()>p&&this.subTo(h.ONE.shiftLeft(p-1),this);else{var _=new Array,A=p&7;_.length=(p>>3)+1,f.nextBytes(_),A>0?_[0]&=(1\\u003c\\u003cA)-1:_[0]=0,this.fromString(_,256)}}function Fe(){var p=this.t,f=new Array;f[0]=this.s;var x=this.DB-p*this.DB%8,_,A=0;if(p-- >0)for(x\\u003cthis.DB&&(_=this[p]>>x)!=(this.s&this.DM)>>x&&(f[A++]=_|this.s\\u003c\\u003cthis.DB-x);p>=0;)x\\u003c8?(_=(this[p]&(1\\u003c\\u003cx)-1)\\u003c\\u003c8-x,_|=this[--p]>>(x+=this.DB-8)):(_=this[p]>>(x-=8)&255,x\\u003c=0&&(x+=this.DB,--p)),(_&128)!=0&&(_|=-256),A==0&&(this.s&128)!=(_&128)&&++A,(A>0||_!=this.s)&&(f[A++]=_);return f}function it(p){return this.compareTo(p)==0}function Rt(p){return this.compareTo(p)\\u003c0?this:p}function Ft(p){return this.compareTo(p)>0?this:p}function Ze(p,f,x){var _,A,B=Math.min(p.t,this.t);for(_=0;_\\u003cB;++_)x[_]=f(this[_],p[_]);if(p.t\\u003cthis.t){for(A=p.s&this.DM,_=B;_\\u003cthis.t;++_)x[_]=f(this[_],A);x.t=this.t}else{for(A=this.s&this.DM,_=B;_\\u003cp.t;++_)x[_]=f(A,p[_]);x.t=p.t}x.s=f(this.s,p.s),x.clamp()}function ht(p,f){return p&f}function Yt(p){var f=d();return this.bitwiseTo(p,ht,f),f}function Tr(p,f){return p|f}function Gi(p){var f=d();return this.bitwiseTo(p,Tr,f),f}function na(p,f){return p^f}function lu(p){var f=d();return this.bitwiseTo(p,na,f),f}function uu(p,f){return p&~f}function Ch(p){var f=d();return this.bitwiseTo(p,uu,f),f}function Fc(){for(var p=d(),f=0;f\\u003cthis.t;++f)p[f]=this.DM&~this[f];return p.t=this.t,p.s=~this.s,p}function Lc(p){var f=d();return p\\u003c0?this.rShiftTo(-p,f):this.lShiftTo(p,f),f}function Rh(p){var f=d();return p\\u003c0?this.lShiftTo(-p,f):this.rShiftTo(p,f),f}function kc(p){if(p==0)return-1;var f=0;return(p&65535)==0&&(p>>=16,f+=16),(p&255)==0&&(p>>=8,f+=8),(p&15)==0&&(p>>=4,f+=4),(p&3)==0&&(p>>=2,f+=2),(p&1)==0&&++f,f}function xf(){for(var p=0;p\\u003cthis.t;++p)if(this[p]!=0)return p*this.DB+kc(this[p]);return this.s\\u003c0?this.t*this.DB:-1}function Eh(p){for(var f=0;p!=0;)p&=p-1,++f;return f}function Ph(){for(var p=0,f=this.s&this.DM,x=0;x\\u003cthis.t;++x)p+=Eh(this[x]^f);return p}function Dc(p){var f=Math.floor(p/this.DB);return f>=this.t?this.s!=0:(this[f]&1\\u003c\\u003cp%this.DB)!=0}function Oc(p,f){var x=h.ONE.shiftLeft(p);return this.bitwiseTo(x,f,x),x}function Uc(p){return this.changeBit(p,Tr)}function vf(p){return this.changeBit(p,uu)}function bf(p){return this.changeBit(p,na)}function Y2(p,f){for(var x=0,_=0,A=Math.min(p.t,this.t);x\\u003cA;)_+=this[x]+p[x],f[x++]=_&this.DM,_>>=this.DB;if(p.t\\u003cthis.t){for(_+=p.s;x\\u003cthis.t;)_+=this[x],f[x++]=_&this.DM,_>>=this.DB;_+=this.s}else{for(_+=this.s;x\\u003cp.t;)_+=p[x],f[x++]=_&this.DM,_>>=this.DB;_+=p.s}f.s=_\\u003c0?-1:0,_>0?f[x++]=_:_\\u003c-1&&(f[x++]=this.DV+_),f.t=x,f.clamp()}function Wx(p){var f=d();return this.addTo(p,f),f}function Z2(p){var f=d();return this.subTo(p,f),f}function zc(p){var f=d();return this.multiplyTo(p,f),f}function jx(){var p=d();return this.squareTo(p),p}function Tf(p){var f=d();return this.divRemTo(p,f,null),f}function Hx(p){var f=d();return this.divRemTo(p,null,f),f}function J2(p){var f=d(),x=d();return this.divRemTo(p,f,x),new Array(f,x)}function Xx(p){this[this.t]=this.am(0,p-1,this,0,0,this.t),++this.t,this.clamp()}function $x(p,f){if(p!=0){for(;this.t\\u003c=f;)this[this.t++]=0;for(this[f]+=p;this[f]>=this.DV;)this[f]-=this.DV,++f>=this.t&&(this[this.t++]=0),++this[f]}}function hu(){}function Bh(p){return p}function Q2(p,f,x){p.multiplyTo(f,x)}function K2(p,f){p.squareTo(f)}hu.prototype.convert=Bh,hu.prototype.revert=Bh,hu.prototype.mulTo=Q2,hu.prototype.sqrTo=K2;function eM(p){return this.exp(p,new hu)}function Vc(p,f,x){var _=Math.min(this.t+p.t,f);for(x.s=0,x.t=_;_>0;)x[--_]=0;var A;for(A=x.t-this.t;_\\u003cA;++_)x[_+this.t]=this.am(0,p[_],x,_,0,this.t);for(A=Math.min(p.t,f);_\\u003cA;++_)this.am(0,p[_],x,_,0,f-_);x.clamp()}function tM(p,f,x){--f;var _=x.t=this.t+p.t-f;for(x.s=0;--_>=0;)x[_]=0;for(_=Math.max(f-this.t,0);_\\u003cp.t;++_)x[this.t+_-f]=this.am(f-_,p[_],x,0,0,this.t+_-f);x.clamp(),x.drShiftTo(1,x)}function du(p){this.r2=d(),this.q3=d(),h.ONE.dlShiftTo(2*p.t,this.r2),this.mu=this.r2.divide(p),this.m=p}function Sf(p){if(p.s\\u003c0||p.t>2*this.m.t)return p.mod(this.m);if(p.compareTo(this.m)\\u003c0)return p;var f=d();return p.copyTo(f),this.reduce(f),f}function rM(p){return p}function iM(p){for(p.drShiftTo(this.m.t-1,this.r2),p.t>this.m.t+1&&(p.t=this.m.t+1,p.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);p.compareTo(this.r2)\\u003c0;)p.dAddOffset(1,this.m.t+1);for(p.subTo(this.r2,p);p.compareTo(this.m)>=0;)p.subTo(this.m,p)}function qx(p,f){p.squareTo(f),this.reduce(f)}function sM(p,f,x){p.multiplyTo(f,x),this.reduce(x)}du.prototype.convert=Sf,du.prototype.revert=rM,du.prototype.reduce=iM,du.prototype.mulTo=sM,du.prototype.sqrTo=qx;function _f(p,f){var x=p.bitLength(),_,A=E(1),B;if(x\\u003c=0)return A;x\\u003c18?_=1:x\\u003c48?_=3:x\\u003c144?_=4:x\\u003c768?_=5:_=6,x\\u003c8?B=new at(f):f.isEven()?B=new du(f):B=new $(f);var k=new Array,ee=3,te=_-1,me=(1\\u003c\\u003c_)-1;if(k[1]=B.convert(this),_>1){var Le=d();for(B.sqrTo(k[1],Le);ee\\u003c=me;)k[ee]=d(),B.mulTo(Le,k[ee-2],k[ee]),ee+=2}var Me=p.t-1,Ge,xt=!0,kt=d(),Vt;for(x=H(p[Me])-1;Me>=0;){for(x>=te?Ge=p[Me]>>x-te&me:(Ge=(p[Me]&(1\\u003c\\u003cx+1)-1)\\u003c\\u003cte-x,Me>0&&(Ge|=p[Me-1]>>this.DB+x-te)),ee=_;(Ge&1)==0;)Ge>>=1,--ee;if((x-=ee)\\u003c0&&(x+=this.DB,--Me),xt)k[Ge].copyTo(A),xt=!1;else{for(;ee>1;)B.sqrTo(A,kt),B.sqrTo(kt,A),ee-=2;ee>0?B.sqrTo(A,kt):(Vt=A,A=kt,kt=Vt),B.mulTo(kt,k[Ge],A)}for(;Me>=0&&(p[Me]&1\\u003c\\u003cx)==0;)B.sqrTo(A,kt),Vt=A,A=kt,kt=Vt,--x\\u003c0&&(x=this.DB-1,--Me)}return B.revert(A)}function Gc(p){var f=this.s\\u003c0?this.negate():this.clone(),x=p.s\\u003c0?p.negate():p.clone();if(f.compareTo(x)\\u003c0){var _=f;f=x,x=_}var A=f.getLowestSetBit(),B=x.getLowestSetBit();if(B\\u003c0)return f;for(A\\u003cB&&(B=A),B>0&&(f.rShiftTo(B,f),x.rShiftTo(B,x));f.signum()>0;)(A=f.getLowestSetBit())>0&&f.rShiftTo(A,f),(A=x.getLowestSetBit())>0&&x.rShiftTo(A,x),f.compareTo(x)>=0?(f.subTo(x,f),f.rShiftTo(1,f)):(x.subTo(f,x),x.rShiftTo(1,x));return B>0&&x.lShiftTo(B,x),x}function aM(p){if(p\\u003c=0)return 0;var f=this.DV%p,x=this.s\\u003c0?p-1:0;if(this.t>0)if(f==0)x=this[0]%p;else for(var _=this.t-1;_>=0;--_)x=(f*x+this[_])%p;return x}function wf(p){var f=p.isEven();if(this.isEven()&&f||p.signum()==0)return h.ZERO;for(var x=p.clone(),_=this.clone(),A=E(1),B=E(0),k=E(0),ee=E(1);x.signum()!=0;){for(;x.isEven();)x.rShiftTo(1,x),f?((!A.isEven()||!B.isEven())&&(A.addTo(this,A),B.subTo(p,B)),A.rShiftTo(1,A)):B.isEven()||B.subTo(p,B),B.rShiftTo(1,B);for(;_.isEven();)_.rShiftTo(1,_),f?((!k.isEven()||!ee.isEven())&&(k.addTo(this,k),ee.subTo(p,ee)),k.rShiftTo(1,k)):ee.isEven()||ee.subTo(p,ee),ee.rShiftTo(1,ee);x.compareTo(_)>=0?(x.subTo(_,x),f&&A.subTo(k,A),B.subTo(ee,B)):(_.subTo(x,_),f&&k.subTo(A,k),ee.subTo(B,ee))}if(_.compareTo(h.ONE)!=0)return h.ZERO;if(ee.compareTo(p)>=0)return ee.subtract(p);if(ee.signum()\\u003c0)ee.addTo(p,ee);else return ee;return ee.signum()\\u003c0?ee.add(p):ee}var vi=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],nM=(1\\u003c\\u003c26)/vi[vi.length-1];function f0e(p){var f,x=this.abs();if(x.t==1&&x[0]\\u003c=vi[vi.length-1]){for(f=0;f\\u003cvi.length;++f)if(x[0]==vi[f])return!0;return!1}if(x.isEven())return!1;for(f=1;f\\u003cvi.length;){for(var _=vi[f],A=f+1;A\\u003cvi.length&&_\\u003cnM;)_*=vi[A++];for(_=x.modInt(_);f\\u003cA;)if(_%vi[f++]==0)return!1}return x.millerRabin(p)}function g0e(p){var f=this.subtract(h.ONE),x=f.getLowestSetBit();if(x\\u003c=0)return!1;var _=f.shiftRight(x);p=p+1>>1,p>vi.length&&(p=vi.length);for(var A=d(),B=0;B\\u003cp;++B){A.fromInt(vi[Math.floor(Math.random()*vi.length)]);var k=A.modPow(_,this);if(k.compareTo(h.ONE)!=0&&k.compareTo(f)!=0){for(var ee=1;ee++\\u003cx&&k.compareTo(f)!=0;)if(k=k.modPowInt(2,this),k.compareTo(h.ONE)==0)return!1;if(k.compareTo(f)!=0)return!1}}return!0}h.prototype.chunkSize=ct,h.prototype.toRadix=nt,h.prototype.fromRadix=dt,h.prototype.fromNumber=ft,h.prototype.bitwiseTo=Ze,h.prototype.changeBit=Oc,h.prototype.addTo=Y2,h.prototype.dMultiply=Xx,h.prototype.dAddOffset=$x,h.prototype.multiplyLowerTo=Vc,h.prototype.multiplyUpperTo=tM,h.prototype.modInt=aM,h.prototype.millerRabin=g0e,h.prototype.clone=V,h.prototype.intValue=Oe,h.prototype.byteValue=tt,h.prototype.shortValue=Je,h.prototype.signum=_e,h.prototype.toByteArray=Fe,h.prototype.equals=it,h.prototype.min=Rt,h.prototype.max=Ft,h.prototype.and=Yt,h.prototype.or=Gi,h.prototype.xor=lu,h.prototype.andNot=Ch,h.prototype.not=Fc,h.prototype.shiftLeft=Lc,h.prototype.shiftRight=Rh,h.prototype.getLowestSetBit=xf,h.prototype.bitCount=Ph,h.prototype.testBit=Dc,h.prototype.setBit=Uc,h.prototype.clearBit=vf,h.prototype.flipBit=bf,h.prototype.add=Wx,h.prototype.subtract=Z2,h.prototype.multiply=zc,h.prototype.divide=Tf,h.prototype.remainder=Hx,h.prototype.divideAndRemainder=J2,h.prototype.modPow=_f,h.prototype.modInverse=wf,h.prototype.pow=eM,h.prototype.gcd=Gc,h.prototype.isProbablePrime=f0e,h.prototype.square=jx;var Lt=h;Lt.prototype.IsNegative=function(){return this.compareTo(Lt.ZERO)==-1},Lt.op_Equality=function(p,f){return p.compareTo(f)==0},Lt.op_Inequality=function(p,f){return p.compareTo(f)!=0},Lt.op_GreaterThan=function(p,f){return p.compareTo(f)>0},Lt.op_LessThan=function(p,f){return p.compareTo(f)\\u003c0},Lt.op_Addition=function(p,f){return new Lt(p,void 0,void 0).add(new Lt(f,void 0,void 0))},Lt.op_Subtraction=function(p,f){return new Lt(p,void 0,void 0).subtract(new Lt(f,void 0,void 0))},Lt.Int128Mul=function(p,f){return new Lt(p,void 0,void 0).multiply(new Lt(f,void 0,void 0))},Lt.op_Division=function(p,f){return p.divide(f)},Lt.prototype.ToDouble=function(){return parseFloat(this.toString())};var Lk=function(p,f){var x;if(typeof Object.getOwnPropertyNames>\\\"u\\\"){for(x in f.prototype)(typeof p.prototype[x]>\\\"u\\\"||p.prototype[x]===Object.prototype[x])&&(p.prototype[x]=f.prototype[x]);for(x in f)typeof p[x]>\\\"u\\\"&&(p[x]=f[x]);p.$baseCtor=f}else{for(var _=Object.getOwnPropertyNames(f.prototype),A=0;A\\u003c_.length;A++)typeof Object.getOwnPropertyDescriptor(p.prototype,_[A])>\\\"u\\\"&&Object.defineProperty(p.prototype,_[A],Object.getOwnPropertyDescriptor(f.prototype,_[A]));for(x in f)typeof p[x]>\\\"u\\\"&&(p[x]=f[x]);p.$baseCtor=f}};r.Path=function(){return[]},r.Path.prototype.push=Array.prototype.push,r.Paths=function(){return[]},r.Paths.prototype.push=Array.prototype.push,r.DoublePoint=function(){var p=arguments;this.X=0,this.Y=0,p.length===1?(this.X=p[0].X,this.Y=p[0].Y):p.length===2&&(this.X=p[0],this.Y=p[1])},r.DoublePoint0=function(){this.X=0,this.Y=0},r.DoublePoint0.prototype=r.DoublePoint.prototype,r.DoublePoint1=function(p){this.X=p.X,this.Y=p.Y},r.DoublePoint1.prototype=r.DoublePoint.prototype,r.DoublePoint2=function(p,f){this.X=p,this.Y=f},r.DoublePoint2.prototype=r.DoublePoint.prototype,r.PolyNode=function(){this.m_Parent=null,this.m_polygon=new r.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1},r.PolyNode.prototype.IsHoleNode=function(){for(var p=!0,f=this.m_Parent;f!==null;)p=!p,f=f.m_Parent;return p},r.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length},r.PolyNode.prototype.Contour=function(){return this.m_polygon},r.PolyNode.prototype.AddChild=function(p){var f=this.m_Childs.length;this.m_Childs.push(p),p.m_Parent=this,p.m_Index=f},r.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()},r.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index===this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]},r.PolyNode.prototype.Childs=function(){return this.m_Childs},r.PolyNode.prototype.Parent=function(){return this.m_Parent},r.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()},r.PolyTree=function(){this.m_AllPolys=[],r.PolyNode.call(this)},r.PolyTree.prototype.Clear=function(){for(var p=0,f=this.m_AllPolys.length;p\\u003cf;p++)this.m_AllPolys[p]=null;this.m_AllPolys.length=0,this.m_Childs.length=0},r.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null},r.PolyTree.prototype.Total=function(){var p=this.m_AllPolys.length;return p>0&&this.m_Childs[0]!==this.m_AllPolys[0]&&p--,p},Lk(r.PolyTree,r.PolyNode),r.Math_Abs_Int64=r.Math_Abs_Int32=r.Math_Abs_Double=function(p){return Math.abs(p)},r.Math_Max_Int32_Int32=function(p,f){return Math.max(p,f)},n.msie||n.opera||n.safari?r.Cast_Int32=function(p){return p|0}:r.Cast_Int32=function(p){return~~p},typeof Number.toInteger>\\\"u\\\"&&(Number.toInteger=null),n.chrome?r.Cast_Int64=function(p){return p\\u003c-2147483648||p>2147483647?p\\u003c0?Math.ceil(p):Math.floor(p):~~p}:n.firefox&&typeof Number.toInteger==\\\"function\\\"?r.Cast_Int64=function(p){return Number.toInteger(p)}:n.msie7||n.msie8?r.Cast_Int64=function(p){return parseInt(p,10)}:n.msie?r.Cast_Int64=function(p){return p\\u003c-2147483648||p>2147483647?p\\u003c0?Math.ceil(p):Math.floor(p):p|0}:r.Cast_Int64=function(p){return p\\u003c0?Math.ceil(p):Math.floor(p)},r.Clear=function(p){p.length=0},r.PI=3.141592653589793,r.PI2=2*3.141592653589793,r.IntPoint=function(){var p=arguments,f=p.length;if(this.X=0,this.Y=0,r.use_xyz)if(this.Z=0,f===3)this.X=p[0],this.Y=p[1],this.Z=p[2];else if(f===2)this.X=p[0],this.Y=p[1],this.Z=0;else if(f===1)if(p[0]instanceof r.DoublePoint){var x=p[0];this.X=r.Clipper.Round(x.X),this.Y=r.Clipper.Round(x.Y),this.Z=0}else{var _=p[0];typeof _.Z>\\\"u\\\"&&(_.Z=0),this.X=_.X,this.Y=_.Y,this.Z=_.Z}else this.X=0,this.Y=0,this.Z=0;else if(f===2)this.X=p[0],this.Y=p[1];else if(f===1)if(p[0]instanceof r.DoublePoint){var x=p[0];this.X=r.Clipper.Round(x.X),this.Y=r.Clipper.Round(x.Y)}else{var _=p[0];this.X=_.X,this.Y=_.Y}else this.X=0,this.Y=0},r.IntPoint.op_Equality=function(p,f){return p.X===f.X&&p.Y===f.Y},r.IntPoint.op_Inequality=function(p,f){return p.X!==f.X||p.Y!==f.Y},r.IntPoint0=function(){this.X=0,this.Y=0,r.use_xyz&&(this.Z=0)},r.IntPoint0.prototype=r.IntPoint.prototype,r.IntPoint1=function(p){this.X=p.X,this.Y=p.Y,r.use_xyz&&(typeof p.Z>\\\"u\\\"?this.Z=0:this.Z=p.Z)},r.IntPoint1.prototype=r.IntPoint.prototype,r.IntPoint1dp=function(p){this.X=r.Clipper.Round(p.X),this.Y=r.Clipper.Round(p.Y),r.use_xyz&&(this.Z=0)},r.IntPoint1dp.prototype=r.IntPoint.prototype,r.IntPoint2=function(p,f,x){this.X=p,this.Y=f,r.use_xyz&&(typeof x>\\\"u\\\"?this.Z=0:this.Z=x)},r.IntPoint2.prototype=r.IntPoint.prototype,r.IntRect=function(){var p=arguments,f=p.length;if(f===4)this.left=p[0],this.top=p[1],this.right=p[2],this.bottom=p[3];else if(f===1){var x=p[0];this.left=x.left,this.top=x.top,this.right=x.right,this.bottom=x.bottom}else this.left=0,this.top=0,this.right=0,this.bottom=0},r.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0},r.IntRect0.prototype=r.IntRect.prototype,r.IntRect1=function(p){this.left=p.left,this.top=p.top,this.right=p.right,this.bottom=p.bottom},r.IntRect1.prototype=r.IntRect.prototype,r.IntRect4=function(p,f,x,_){this.left=p,this.top=f,this.right=x,this.bottom=_},r.IntRect4.prototype=r.IntRect.prototype,r.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3},r.PolyType={ptSubject:0,ptClip:1},r.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3},r.JoinType={jtSquare:0,jtRound:1,jtMiter:2},r.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4},r.EdgeSide={esLeft:0,esRight:1},r.Direction={dRightToLeft:0,dLeftToRight:1},r.TEdge=function(){this.Bot=new r.IntPoint0,this.Curr=new r.IntPoint0,this.Top=new r.IntPoint0,this.Delta=new r.IntPoint0,this.Dx=0,this.PolyTyp=r.PolyType.ptSubject,this.Side=r.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null},r.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new r.IntPoint0},r.MyIntersectNodeSort=function(){},r.MyIntersectNodeSort.Compare=function(p,f){var x=f.Pt.Y-p.Pt.Y;return x>0?1:x\\u003c0?-1:0},r.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null},r.Scanbeam=function(){this.Y=0,this.Next=null},r.Maxima=function(){this.X=0,this.Next=null,this.Prev=null},r.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null},r.OutPt=function(){this.Idx=0,this.Pt=new r.IntPoint0,this.Next=null,this.Prev=null},r.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new r.IntPoint0},r.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_Scanbeam=null,this.m_PolyOuts=null,this.m_ActiveEdges=null},r.ClipperBase.horizontal=-9007199254740992,r.ClipperBase.Skip=-2,r.ClipperBase.Unassigned=-1,r.ClipperBase.tolerance=1e-20,r.ClipperBase.loRange=47453132,r.ClipperBase.hiRange=0xfffffffffffff,r.ClipperBase.near_zero=function(p){return p>-r.ClipperBase.tolerance&&p\\u003cr.ClipperBase.tolerance},r.ClipperBase.IsHorizontal=function(p){return p.Delta.Y===0},r.ClipperBase.prototype.PointIsVertex=function(p,f){var x=f;do{if(r.IntPoint.op_Equality(x.Pt,p))return!0;x=x.Next}while(x!==f);return!1},r.ClipperBase.prototype.PointOnLineSegment=function(p,f,x,_){return _?p.X===f.X&&p.Y===f.Y||p.X===x.X&&p.Y===x.Y||p.X>f.X==p.X\\u003cx.X&&p.Y>f.Y==p.Y\\u003cx.Y&&Lt.op_Equality(Lt.Int128Mul(p.X-f.X,x.Y-f.Y),Lt.Int128Mul(x.X-f.X,p.Y-f.Y)):p.X===f.X&&p.Y===f.Y||p.X===x.X&&p.Y===x.Y||p.X>f.X==p.X\\u003cx.X&&p.Y>f.Y==p.Y\\u003cx.Y&&(p.X-f.X)*(x.Y-f.Y)===(x.X-f.X)*(p.Y-f.Y)},r.ClipperBase.prototype.PointOnPolygon=function(p,f,x){for(var _=f;;){if(this.PointOnLineSegment(p,_.Pt,_.Next.Pt,x))return!0;if(_=_.Next,_===f)break}return!1},r.ClipperBase.prototype.SlopesEqual=r.ClipperBase.SlopesEqual=function(){var p=arguments,f=p.length,x,_,A,B,k,ee,te;return f===3?(x=p[0],_=p[1],te=p[2],te?Lt.op_Equality(Lt.Int128Mul(x.Delta.Y,_.Delta.X),Lt.Int128Mul(x.Delta.X,_.Delta.Y)):r.Cast_Int64(x.Delta.Y*_.Delta.X)===r.Cast_Int64(x.Delta.X*_.Delta.Y)):f===4?(A=p[0],B=p[1],k=p[2],te=p[3],te?Lt.op_Equality(Lt.Int128Mul(A.Y-B.Y,B.X-k.X),Lt.Int128Mul(A.X-B.X,B.Y-k.Y)):r.Cast_Int64((A.Y-B.Y)*(B.X-k.X))-r.Cast_Int64((A.X-B.X)*(B.Y-k.Y))===0):(A=p[0],B=p[1],k=p[2],ee=p[3],te=p[4],te?Lt.op_Equality(Lt.Int128Mul(A.Y-B.Y,k.X-ee.X),Lt.Int128Mul(A.X-B.X,k.Y-ee.Y)):r.Cast_Int64((A.Y-B.Y)*(k.X-ee.X))-r.Cast_Int64((A.X-B.X)*(k.Y-ee.Y))===0)},r.ClipperBase.SlopesEqual3=function(p,f,x){return x?Lt.op_Equality(Lt.Int128Mul(p.Delta.Y,f.Delta.X),Lt.Int128Mul(p.Delta.X,f.Delta.Y)):r.Cast_Int64(p.Delta.Y*f.Delta.X)===r.Cast_Int64(p.Delta.X*f.Delta.Y)},r.ClipperBase.SlopesEqual4=function(p,f,x,_){return _?Lt.op_Equality(Lt.Int128Mul(p.Y-f.Y,f.X-x.X),Lt.Int128Mul(p.X-f.X,f.Y-x.Y)):r.Cast_Int64((p.Y-f.Y)*(f.X-x.X))-r.Cast_Int64((p.X-f.X)*(f.Y-x.Y))===0},r.ClipperBase.SlopesEqual5=function(p,f,x,_,A){return A?Lt.op_Equality(Lt.Int128Mul(p.Y-f.Y,x.X-_.X),Lt.Int128Mul(p.X-f.X,x.Y-_.Y)):r.Cast_Int64((p.Y-f.Y)*(x.X-_.X))-r.Cast_Int64((p.X-f.X)*(x.Y-_.Y))===0},r.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var p=0,f=this.m_edges.length;p\\u003cf;++p){for(var x=0,_=this.m_edges[p].length;x\\u003c_;++x)this.m_edges[p][x]=null;r.Clear(this.m_edges[p])}r.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1},r.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var p=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=p}this.m_CurrentLM=null},r.ClipperBase.prototype.RangeTest=function(p,f){f.Value?(p.X>r.ClipperBase.hiRange||p.Y>r.ClipperBase.hiRange||-p.X>r.ClipperBase.hiRange||-p.Y>r.ClipperBase.hiRange)&&r.Error(\\\"Coordinate outside allowed range in RangeTest().\\\"):(p.X>r.ClipperBase.loRange||p.Y>r.ClipperBase.loRange||-p.X>r.ClipperBase.loRange||-p.Y>r.ClipperBase.loRange)&&(f.Value=!0,this.RangeTest(p,f))},r.ClipperBase.prototype.InitEdge=function(p,f,x,_){p.Next=f,p.Prev=x,p.Curr.X=_.X,p.Curr.Y=_.Y,r.use_xyz&&(p.Curr.Z=_.Z),p.OutIdx=-1},r.ClipperBase.prototype.InitEdge2=function(p,f){p.Curr.Y>=p.Next.Curr.Y?(p.Bot.X=p.Curr.X,p.Bot.Y=p.Curr.Y,r.use_xyz&&(p.Bot.Z=p.Curr.Z),p.Top.X=p.Next.Curr.X,p.Top.Y=p.Next.Curr.Y,r.use_xyz&&(p.Top.Z=p.Next.Curr.Z)):(p.Top.X=p.Curr.X,p.Top.Y=p.Curr.Y,r.use_xyz&&(p.Top.Z=p.Curr.Z),p.Bot.X=p.Next.Curr.X,p.Bot.Y=p.Next.Curr.Y,r.use_xyz&&(p.Bot.Z=p.Next.Curr.Z)),this.SetDx(p),p.PolyTyp=f},r.ClipperBase.prototype.FindNextLocMin=function(p){for(var f;;){for(;r.IntPoint.op_Inequality(p.Bot,p.Prev.Bot)||r.IntPoint.op_Equality(p.Curr,p.Top);)p=p.Next;if(p.Dx!==r.ClipperBase.horizontal&&p.Prev.Dx!==r.ClipperBase.horizontal)break;for(;p.Prev.Dx===r.ClipperBase.horizontal;)p=p.Prev;for(f=p;p.Dx===r.ClipperBase.horizontal;)p=p.Next;if(p.Top.Y!==p.Prev.Bot.Y){f.Prev.Bot.X\\u003cp.Bot.X&&(p=f);break}}return p},r.ClipperBase.prototype.ProcessBound=function(p,f){var x,_=p,A;if(_.OutIdx===r.ClipperBase.Skip){if(p=_,f){for(;p.Top.Y===p.Next.Bot.Y;)p=p.Next;for(;p!==_&&p.Dx===r.ClipperBase.horizontal;)p=p.Prev}else{for(;p.Top.Y===p.Prev.Bot.Y;)p=p.Prev;for(;p!==_&&p.Dx===r.ClipperBase.horizontal;)p=p.Next}if(p===_)f?_=p.Next:_=p.Prev;else{f?p=_.Next:p=_.Prev;var B=new r.LocalMinima;B.Next=null,B.Y=p.Bot.Y,B.LeftBound=null,B.RightBound=p,p.WindDelta=0,_=this.ProcessBound(p,f),this.InsertLocalMinima(B)}return _}if(p.Dx===r.ClipperBase.horizontal&&(f?x=p.Prev:x=p.Next,x.Dx===r.ClipperBase.horizontal?x.Bot.X!==p.Bot.X&&x.Top.X!==p.Bot.X&&this.ReverseHorizontal(p):x.Bot.X!==p.Bot.X&&this.ReverseHorizontal(p)),x=p,f){for(;_.Top.Y===_.Next.Bot.Y&&_.Next.OutIdx!==r.ClipperBase.Skip;)_=_.Next;if(_.Dx===r.ClipperBase.horizontal&&_.Next.OutIdx!==r.ClipperBase.Skip){for(A=_;A.Prev.Dx===r.ClipperBase.horizontal;)A=A.Prev;A.Prev.Top.X>_.Next.Top.X&&(_=A.Prev)}for(;p!==_;)p.NextInLML=p.Next,p.Dx===r.ClipperBase.horizontal&&p!==x&&p.Bot.X!==p.Prev.Top.X&&this.ReverseHorizontal(p),p=p.Next;p.Dx===r.ClipperBase.horizontal&&p!==x&&p.Bot.X!==p.Prev.Top.X&&this.ReverseHorizontal(p),_=_.Next}else{for(;_.Top.Y===_.Prev.Bot.Y&&_.Prev.OutIdx!==r.ClipperBase.Skip;)_=_.Prev;if(_.Dx===r.ClipperBase.horizontal&&_.Prev.OutIdx!==r.ClipperBase.Skip){for(A=_;A.Next.Dx===r.ClipperBase.horizontal;)A=A.Next;(A.Next.Top.X===_.Prev.Top.X||A.Next.Top.X>_.Prev.Top.X)&&(_=A.Next)}for(;p!==_;)p.NextInLML=p.Prev,p.Dx===r.ClipperBase.horizontal&&p!==x&&p.Bot.X!==p.Next.Top.X&&this.ReverseHorizontal(p),p=p.Prev;p.Dx===r.ClipperBase.horizontal&&p!==x&&p.Bot.X!==p.Next.Top.X&&this.ReverseHorizontal(p),_=_.Prev}return _},r.ClipperBase.prototype.AddPath=function(p,f,x){r.use_lines?!x&&f===r.PolyType.ptClip&&r.Error(\\\"AddPath: Open paths must be subject.\\\"):x||r.Error(\\\"AddPath: Open paths have been disabled.\\\");var _=p.length-1;if(x)for(;_>0&&r.IntPoint.op_Equality(p[_],p[0]);)--_;for(;_>0&&r.IntPoint.op_Equality(p[_],p[_-1]);)--_;if(x&&_\\u003c2||!x&&_\\u003c1)return!1;for(var A=new Array,B=0;B\\u003c=_;B++)A.push(new r.TEdge);var k=!0;A[1].Curr.X=p[1].X,A[1].Curr.Y=p[1].Y,r.use_xyz&&(A[1].Curr.Z=p[1].Z);var ee={Value:this.m_UseFullRange};this.RangeTest(p[0],ee),this.m_UseFullRange=ee.Value,ee.Value=this.m_UseFullRange,this.RangeTest(p[_],ee),this.m_UseFullRange=ee.Value,this.InitEdge(A[0],A[1],A[_],p[0]),this.InitEdge(A[_],A[0],A[_-1],p[_]);for(var B=_-1;B>=1;--B)ee.Value=this.m_UseFullRange,this.RangeTest(p[B],ee),this.m_UseFullRange=ee.Value,this.InitEdge(A[B],A[B+1],A[B-1],p[B]);for(var te=A[0],me=te,Le=te;;){if(me.Curr===me.Next.Curr&&(x||me.Next!==te)){if(me===me.Next)break;me===te&&(te=me.Next),me=this.RemoveEdge(me),Le=me;continue}if(me.Prev===me.Next)break;if(x&&r.ClipperBase.SlopesEqual4(me.Prev.Curr,me.Curr,me.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(me.Prev.Curr,me.Curr,me.Next.Curr))){me===te&&(te=me.Next),me=this.RemoveEdge(me),me=me.Prev,Le=me;continue}if(me=me.Next,me===Le||!x&&me.Next===te)break}if(!x&&me===me.Next||x&&me.Prev===me.Next)return!1;x||(this.m_HasOpenPaths=!0,te.Prev.OutIdx=r.ClipperBase.Skip),me=te;do this.InitEdge2(me,f),me=me.Next,k&&me.Curr.Y!==te.Curr.Y&&(k=!1);while(me!==te);if(k){if(x)return!1;me.Prev.OutIdx=r.ClipperBase.Skip;var Me=new r.LocalMinima;for(Me.Next=null,Me.Y=me.Bot.Y,Me.LeftBound=null,Me.RightBound=me,Me.RightBound.Side=r.EdgeSide.esRight,Me.RightBound.WindDelta=0;me.Bot.X!==me.Prev.Top.X&&this.ReverseHorizontal(me),me.Next.OutIdx!==r.ClipperBase.Skip;)me.NextInLML=me.Next,me=me.Next;return this.InsertLocalMinima(Me),this.m_edges.push(A),!0}this.m_edges.push(A);var Ge,xt=null;for(r.IntPoint.op_Equality(me.Prev.Bot,me.Prev.Top)&&(me=me.Next);me=this.FindNextLocMin(me),me!==xt;){xt===null&&(xt=me);var Me=new r.LocalMinima;Me.Next=null,Me.Y=me.Bot.Y,me.Dx\\u003cme.Prev.Dx?(Me.LeftBound=me.Prev,Me.RightBound=me,Ge=!1):(Me.LeftBound=me,Me.RightBound=me.Prev,Ge=!0),Me.LeftBound.Side=r.EdgeSide.esLeft,Me.RightBound.Side=r.EdgeSide.esRight,x?Me.LeftBound.Next===Me.RightBound?Me.LeftBound.WindDelta=-1:Me.LeftBound.WindDelta=1:Me.LeftBound.WindDelta=0,Me.RightBound.WindDelta=-Me.LeftBound.WindDelta,me=this.ProcessBound(Me.LeftBound,Ge),me.OutIdx===r.ClipperBase.Skip&&(me=this.ProcessBound(me,Ge));var kt=this.ProcessBound(Me.RightBound,!Ge);kt.OutIdx===r.ClipperBase.Skip&&(kt=this.ProcessBound(kt,!Ge)),Me.LeftBound.OutIdx===r.ClipperBase.Skip?Me.LeftBound=null:Me.RightBound.OutIdx===r.ClipperBase.Skip&&(Me.RightBound=null),this.InsertLocalMinima(Me),Ge||(me=kt)}return!0},r.ClipperBase.prototype.AddPaths=function(p,f,x){for(var _=!1,A=0,B=p.length;A\\u003cB;++A)this.AddPath(p[A],f,x)&&(_=!0);return _},r.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(p,f,x){return r.IntPoint.op_Equality(p,x)||r.IntPoint.op_Equality(p,f)||r.IntPoint.op_Equality(x,f)?!1:p.X!==x.X?f.X>p.X==f.X\\u003cx.X:f.Y>p.Y==f.Y\\u003cx.Y},r.ClipperBase.prototype.RemoveEdge=function(p){p.Prev.Next=p.Next,p.Next.Prev=p.Prev;var f=p.Next;return p.Prev=null,f},r.ClipperBase.prototype.SetDx=function(p){p.Delta.X=p.Top.X-p.Bot.X,p.Delta.Y=p.Top.Y-p.Bot.Y,p.Delta.Y===0?p.Dx=r.ClipperBase.horizontal:p.Dx=p.Delta.X/p.Delta.Y},r.ClipperBase.prototype.InsertLocalMinima=function(p){if(this.m_MinimaList===null)this.m_MinimaList=p;else if(p.Y>=this.m_MinimaList.Y)p.Next=this.m_MinimaList,this.m_MinimaList=p;else{for(var f=this.m_MinimaList;f.Next!==null&&p.Y\\u003cf.Next.Y;)f=f.Next;p.Next=f.Next,f.Next=p}},r.ClipperBase.prototype.PopLocalMinima=function(p,f){return f.v=this.m_CurrentLM,this.m_CurrentLM!==null&&this.m_CurrentLM.Y===p?(this.m_CurrentLM=this.m_CurrentLM.Next,!0):!1},r.ClipperBase.prototype.ReverseHorizontal=function(p){var f=p.Top.X;p.Top.X=p.Bot.X,p.Bot.X=f,r.use_xyz&&(f=p.Top.Z,p.Top.Z=p.Bot.Z,p.Bot.Z=f)},r.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!==null){this.m_Scanbeam=null;for(var p=this.m_MinimaList;p!==null;){this.InsertScanbeam(p.Y);var f=p.LeftBound;f!==null&&(f.Curr.X=f.Bot.X,f.Curr.Y=f.Bot.Y,r.use_xyz&&(f.Curr.Z=f.Bot.Z),f.OutIdx=r.ClipperBase.Unassigned),f=p.RightBound,f!==null&&(f.Curr.X=f.Bot.X,f.Curr.Y=f.Bot.Y,r.use_xyz&&(f.Curr.Z=f.Bot.Z),f.OutIdx=r.ClipperBase.Unassigned),p=p.Next}this.m_ActiveEdges=null}},r.ClipperBase.prototype.InsertScanbeam=function(p){if(this.m_Scanbeam===null)this.m_Scanbeam=new r.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=p;else if(p>this.m_Scanbeam.Y){var f=new r.Scanbeam;f.Y=p,f.Next=this.m_Scanbeam,this.m_Scanbeam=f}else{for(var x=this.m_Scanbeam;x.Next!==null&&p\\u003c=x.Next.Y;)x=x.Next;if(p===x.Y)return;var _=new r.Scanbeam;_.Y=p,_.Next=x.Next,x.Next=_}},r.ClipperBase.prototype.PopScanbeam=function(p){return this.m_Scanbeam===null?(p.v=0,!1):(p.v=this.m_Scanbeam.Y,this.m_Scanbeam=this.m_Scanbeam.Next,!0)},r.ClipperBase.prototype.LocalMinimaPending=function(){return this.m_CurrentLM!==null},r.ClipperBase.prototype.CreateOutRec=function(){var p=new r.OutRec;return p.Idx=r.ClipperBase.Unassigned,p.IsHole=!1,p.IsOpen=!1,p.FirstLeft=null,p.Pts=null,p.BottomPt=null,p.PolyNode=null,this.m_PolyOuts.push(p),p.Idx=this.m_PolyOuts.length-1,p},r.ClipperBase.prototype.DisposeOutRec=function(p){var f=this.m_PolyOuts[p];f.Pts=null,f=null,this.m_PolyOuts[p]=null},r.ClipperBase.prototype.UpdateEdgeIntoAEL=function(p){p.NextInLML===null&&r.Error(\\\"UpdateEdgeIntoAEL: invalid call\\\");var f=p.PrevInAEL,x=p.NextInAEL;return p.NextInLML.OutIdx=p.OutIdx,f!==null?f.NextInAEL=p.NextInLML:this.m_ActiveEdges=p.NextInLML,x!==null&&(x.PrevInAEL=p.NextInLML),p.NextInLML.Side=p.Side,p.NextInLML.WindDelta=p.WindDelta,p.NextInLML.WindCnt=p.WindCnt,p.NextInLML.WindCnt2=p.WindCnt2,p=p.NextInLML,p.Curr.X=p.Bot.X,p.Curr.Y=p.Bot.Y,p.PrevInAEL=f,p.NextInAEL=x,r.ClipperBase.IsHorizontal(p)||this.InsertScanbeam(p.Top.Y),p},r.ClipperBase.prototype.SwapPositionsInAEL=function(p,f){if(!(p.NextInAEL===p.PrevInAEL||f.NextInAEL===f.PrevInAEL)){if(p.NextInAEL===f){var x=f.NextInAEL;x!==null&&(x.PrevInAEL=p);var _=p.PrevInAEL;_!==null&&(_.NextInAEL=f),f.PrevInAEL=_,f.NextInAEL=p,p.PrevInAEL=f,p.NextInAEL=x}else if(f.NextInAEL===p){var A=p.NextInAEL;A!==null&&(A.PrevInAEL=f);var B=f.PrevInAEL;B!==null&&(B.NextInAEL=p),p.PrevInAEL=B,p.NextInAEL=f,f.PrevInAEL=p,f.NextInAEL=A}else{var k=p.NextInAEL,ee=p.PrevInAEL;p.NextInAEL=f.NextInAEL,p.NextInAEL!==null&&(p.NextInAEL.PrevInAEL=p),p.PrevInAEL=f.PrevInAEL,p.PrevInAEL!==null&&(p.PrevInAEL.NextInAEL=p),f.NextInAEL=k,f.NextInAEL!==null&&(f.NextInAEL.PrevInAEL=f),f.PrevInAEL=ee,f.PrevInAEL!==null&&(f.PrevInAEL.NextInAEL=f)}p.PrevInAEL===null?this.m_ActiveEdges=p:f.PrevInAEL===null&&(this.m_ActiveEdges=f)}},r.ClipperBase.prototype.DeleteFromAEL=function(p){var f=p.PrevInAEL,x=p.NextInAEL;f===null&&x===null&&p!==this.m_ActiveEdges||(f!==null?f.NextInAEL=x:this.m_ActiveEdges=x,x!==null&&(x.PrevInAEL=f),p.NextInAEL=null,p.PrevInAEL=null)},r.Clipper=function(p){typeof p>\\\"u\\\"&&(p=0),this.m_PolyOuts=null,this.m_ClipType=r.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=r.PolyFillType.pftEvenOdd,this.m_SubjFillType=r.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,r.ClipperBase.call(this),this.m_Scanbeam=null,this.m_Maxima=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=r.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&p)!==0,this.StrictlySimple=(2&p)!==0,this.PreserveCollinear=(4&p)!==0,r.use_xyz&&(this.ZFillFunction=null)},r.Clipper.ioReverseSolution=1,r.Clipper.ioStrictlySimple=2,r.Clipper.ioPreserveCollinear=4,r.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),r.ClipperBase.prototype.Clear.call(this))},r.Clipper.prototype.InsertMaxima=function(p){var f=new r.Maxima;if(f.X=p,this.m_Maxima===null)this.m_Maxima=f,this.m_Maxima.Next=null,this.m_Maxima.Prev=null;else if(p\\u003cthis.m_Maxima.X)f.Next=this.m_Maxima,f.Prev=null,this.m_Maxima=f;else{for(var x=this.m_Maxima;x.Next!==null&&p>=x.Next.X;)x=x.Next;if(p===x.X)return;f.Next=x.Next,f.Prev=x,x.Next!==null&&(x.Next.Prev=f),x.Next=f}},r.Clipper.prototype.Execute=function(){var p=arguments,f=p.length,x=p[1]instanceof r.PolyTree;if(f===4&&!x){var _=p[0],A=p[1],B=p[2],k=p[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&r.Error(\\\"Error: PolyTree struct is needed for open path clipping.\\\"),this.m_ExecuteLocked=!0,r.Clear(A),this.m_SubjFillType=B,this.m_ClipFillType=k,this.m_ClipType=_,this.m_UsingPolyTree=!1;try{var ee=this.ExecuteInternal();ee&&this.BuildResult(A)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return ee}else if(f===4&&x){var _=p[0],te=p[1],B=p[2],k=p[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=B,this.m_ClipFillType=k,this.m_ClipType=_,this.m_UsingPolyTree=!0;try{var ee=this.ExecuteInternal();ee&&this.BuildResult2(te)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return ee}else if(f===2&&!x){var _=p[0],A=p[1];return this.Execute(_,A,r.PolyFillType.pftEvenOdd,r.PolyFillType.pftEvenOdd)}else if(f===2&&x){var _=p[0],te=p[1];return this.Execute(_,te,r.PolyFillType.pftEvenOdd,r.PolyFillType.pftEvenOdd)}},r.Clipper.prototype.FixHoleLinkage=function(p){if(!(p.FirstLeft===null||p.IsHole!==p.FirstLeft.IsHole&&p.FirstLeft.Pts!==null)){for(var f=p.FirstLeft;f!==null&&(f.IsHole===p.IsHole||f.Pts===null);)f=f.FirstLeft;p.FirstLeft=f}},r.Clipper.prototype.ExecuteInternal=function(){try{this.Reset(),this.m_SortedEdges=null,this.m_Maxima=null;var p={},f={};if(!this.PopScanbeam(p))return!1;for(this.InsertLocalMinimaIntoAEL(p.v);this.PopScanbeam(f)||this.LocalMinimaPending();){if(this.ProcessHorizontals(),this.m_GhostJoins.length=0,!this.ProcessIntersections(f.v))return!1;this.ProcessEdgesAtTopOfScanbeam(f.v),p.v=f.v,this.InsertLocalMinimaIntoAEL(p.v)}var x,_,A;for(_=0,A=this.m_PolyOuts.length;_\\u003cA;_++)x=this.m_PolyOuts[_],!(x.Pts===null||x.IsOpen)&&(x.IsHole^this.ReverseSolution)==this.Area$1(x)>0&&this.ReversePolyPtLinks(x.Pts);for(this.JoinCommonEdges(),_=0,A=this.m_PolyOuts.length;_\\u003cA;_++)x=this.m_PolyOuts[_],x.Pts!==null&&(x.IsOpen?this.FixupOutPolyline(x):this.FixupOutPolygon(x));return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{this.m_Joins.length=0,this.m_GhostJoins.length=0}},r.Clipper.prototype.DisposeAllPolyPts=function(){for(var p=0,f=this.m_PolyOuts.length;p\\u003cf;++p)this.DisposeOutRec(p);r.Clear(this.m_PolyOuts)},r.Clipper.prototype.AddJoin=function(p,f,x){var _=new r.Join;_.OutPt1=p,_.OutPt2=f,_.OffPt.X=x.X,_.OffPt.Y=x.Y,r.use_xyz&&(_.OffPt.Z=x.Z),this.m_Joins.push(_)},r.Clipper.prototype.AddGhostJoin=function(p,f){var x=new r.Join;x.OutPt1=p,x.OffPt.X=f.X,x.OffPt.Y=f.Y,r.use_xyz&&(x.OffPt.Z=f.Z),this.m_GhostJoins.push(x)},r.Clipper.prototype.SetZ=function(p,f,x){if(this.ZFillFunction!==null){if(p.Z!==0||this.ZFillFunction===null)return;r.IntPoint.op_Equality(p,f.Bot)?p.Z=f.Bot.Z:r.IntPoint.op_Equality(p,f.Top)?p.Z=f.Top.Z:r.IntPoint.op_Equality(p,x.Bot)?p.Z=x.Bot.Z:r.IntPoint.op_Equality(p,x.Top)?p.Z=x.Top.Z:this.ZFillFunction(f.Bot,f.Top,x.Bot,x.Top,p)}},r.Clipper.prototype.InsertLocalMinimaIntoAEL=function(p){for(var f={},x,_;this.PopLocalMinima(p,f);){x=f.v.LeftBound,_=f.v.RightBound;var A=null;if(x===null?(this.InsertEdgeIntoAEL(_,null),this.SetWindingCount(_),this.IsContributing(_)&&(A=this.AddOutPt(_,_.Bot))):_===null?(this.InsertEdgeIntoAEL(x,null),this.SetWindingCount(x),this.IsContributing(x)&&(A=this.AddOutPt(x,x.Bot)),this.InsertScanbeam(x.Top.Y)):(this.InsertEdgeIntoAEL(x,null),this.InsertEdgeIntoAEL(_,x),this.SetWindingCount(x),_.WindCnt=x.WindCnt,_.WindCnt2=x.WindCnt2,this.IsContributing(x)&&(A=this.AddLocalMinPoly(x,_,x.Bot)),this.InsertScanbeam(x.Top.Y)),_!==null&&(r.ClipperBase.IsHorizontal(_)?(_.NextInLML!==null&&this.InsertScanbeam(_.NextInLML.Top.Y),this.AddEdgeToSEL(_)):this.InsertScanbeam(_.Top.Y)),!(x===null||_===null)){if(A!==null&&r.ClipperBase.IsHorizontal(_)&&this.m_GhostJoins.length>0&&_.WindDelta!==0)for(var B=0,k=this.m_GhostJoins.length;B\\u003ck;B++){var ee=this.m_GhostJoins[B];this.HorzSegmentsOverlap(ee.OutPt1.Pt.X,ee.OffPt.X,_.Bot.X,_.Top.X)&&this.AddJoin(ee.OutPt1,A,ee.OffPt)}if(x.OutIdx>=0&&x.PrevInAEL!==null&&x.PrevInAEL.Curr.X===x.Bot.X&&x.PrevInAEL.OutIdx>=0&&r.ClipperBase.SlopesEqual5(x.PrevInAEL.Curr,x.PrevInAEL.Top,x.Curr,x.Top,this.m_UseFullRange)&&x.WindDelta!==0&&x.PrevInAEL.WindDelta!==0){var te=this.AddOutPt(x.PrevInAEL,x.Bot);this.AddJoin(A,te,x.Top)}if(x.NextInAEL!==_){if(_.OutIdx>=0&&_.PrevInAEL.OutIdx>=0&&r.ClipperBase.SlopesEqual5(_.PrevInAEL.Curr,_.PrevInAEL.Top,_.Curr,_.Top,this.m_UseFullRange)&&_.WindDelta!==0&&_.PrevInAEL.WindDelta!==0){var te=this.AddOutPt(_.PrevInAEL,_.Bot);this.AddJoin(A,te,_.Top)}var me=x.NextInAEL;if(me!==null)for(;me!==_;)this.IntersectEdges(_,me,x.Curr),me=me.NextInAEL}}}},r.Clipper.prototype.InsertEdgeIntoAEL=function(p,f){if(this.m_ActiveEdges===null)p.PrevInAEL=null,p.NextInAEL=null,this.m_ActiveEdges=p;else if(f===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,p))p.PrevInAEL=null,p.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=p,this.m_ActiveEdges=p;else{for(f===null&&(f=this.m_ActiveEdges);f.NextInAEL!==null&&!this.E2InsertsBeforeE1(f.NextInAEL,p);)f=f.NextInAEL;p.NextInAEL=f.NextInAEL,f.NextInAEL!==null&&(f.NextInAEL.PrevInAEL=p),p.PrevInAEL=f,f.NextInAEL=p}},r.Clipper.prototype.E2InsertsBeforeE1=function(p,f){return f.Curr.X===p.Curr.X?f.Top.Y>p.Top.Y?f.Top.X\\u003cr.Clipper.TopX(p,f.Top.Y):p.Top.X>r.Clipper.TopX(f,p.Top.Y):f.Curr.X\\u003cp.Curr.X},r.Clipper.prototype.IsEvenOddFillType=function(p){return p.PolyTyp===r.PolyType.ptSubject?this.m_SubjFillType===r.PolyFillType.pftEvenOdd:this.m_ClipFillType===r.PolyFillType.pftEvenOdd},r.Clipper.prototype.IsEvenOddAltFillType=function(p){return p.PolyTyp===r.PolyType.ptSubject?this.m_ClipFillType===r.PolyFillType.pftEvenOdd:this.m_SubjFillType===r.PolyFillType.pftEvenOdd},r.Clipper.prototype.IsContributing=function(p){var f,x;switch(p.PolyTyp===r.PolyType.ptSubject?(f=this.m_SubjFillType,x=this.m_ClipFillType):(f=this.m_ClipFillType,x=this.m_SubjFillType),f){case r.PolyFillType.pftEvenOdd:if(p.WindDelta===0&&p.WindCnt!==1)return!1;break;case r.PolyFillType.pftNonZero:if(Math.abs(p.WindCnt)!==1)return!1;break;case r.PolyFillType.pftPositive:if(p.WindCnt!==1)return!1;break;default:if(p.WindCnt!==-1)return!1;break}switch(this.m_ClipType){case r.ClipType.ctIntersection:switch(x){case r.PolyFillType.pftEvenOdd:case r.PolyFillType.pftNonZero:return p.WindCnt2!==0;case r.PolyFillType.pftPositive:return p.WindCnt2>0;default:return p.WindCnt2\\u003c0}case r.ClipType.ctUnion:switch(x){case r.PolyFillType.pftEvenOdd:case r.PolyFillType.pftNonZero:return p.WindCnt2===0;case r.PolyFillType.pftPositive:return p.WindCnt2\\u003c=0;default:return p.WindCnt2>=0}case r.ClipType.ctDifference:if(p.PolyTyp===r.PolyType.ptSubject)switch(x){case r.PolyFillType.pftEvenOdd:case r.PolyFillType.pftNonZero:return p.WindCnt2===0;case r.PolyFillType.pftPositive:return p.WindCnt2\\u003c=0;default:return p.WindCnt2>=0}else switch(x){case r.PolyFillType.pftEvenOdd:case r.PolyFillType.pftNonZero:return p.WindCnt2!==0;case r.PolyFillType.pftPositive:return p.WindCnt2>0;default:return p.WindCnt2\\u003c0}case r.ClipType.ctXor:if(p.WindDelta===0)switch(x){case r.PolyFillType.pftEvenOdd:case r.PolyFillType.pftNonZero:return p.WindCnt2===0;case r.PolyFillType.pftPositive:return p.WindCnt2\\u003c=0;default:return p.WindCnt2>=0}else return!0}return!0},r.Clipper.prototype.SetWindingCount=function(p){for(var f=p.PrevInAEL;f!==null&&(f.PolyTyp!==p.PolyTyp||f.WindDelta===0);)f=f.PrevInAEL;if(f===null){var x=p.PolyTyp===r.PolyType.ptSubject?this.m_SubjFillType:this.m_ClipFillType;p.WindDelta===0?p.WindCnt=x===r.PolyFillType.pftNegative?-1:1:p.WindCnt=p.WindDelta,p.WindCnt2=0,f=this.m_ActiveEdges}else if(p.WindDelta===0&&this.m_ClipType!==r.ClipType.ctUnion)p.WindCnt=1,p.WindCnt2=f.WindCnt2,f=f.NextInAEL;else if(this.IsEvenOddFillType(p)){if(p.WindDelta===0){for(var _=!0,A=f.PrevInAEL;A!==null;)A.PolyTyp===f.PolyTyp&&A.WindDelta!==0&&(_=!_),A=A.PrevInAEL;p.WindCnt=_?0:1}else p.WindCnt=p.WindDelta;p.WindCnt2=f.WindCnt2,f=f.NextInAEL}else f.WindCnt*f.WindDelta\\u003c0?Math.abs(f.WindCnt)>1?f.WindDelta*p.WindDelta\\u003c0?p.WindCnt=f.WindCnt:p.WindCnt=f.WindCnt+p.WindDelta:p.WindCnt=p.WindDelta===0?1:p.WindDelta:p.WindDelta===0?p.WindCnt=f.WindCnt\\u003c0?f.WindCnt-1:f.WindCnt+1:f.WindDelta*p.WindDelta\\u003c0?p.WindCnt=f.WindCnt:p.WindCnt=f.WindCnt+p.WindDelta,p.WindCnt2=f.WindCnt2,f=f.NextInAEL;if(this.IsEvenOddAltFillType(p))for(;f!==p;)f.WindDelta!==0&&(p.WindCnt2=p.WindCnt2===0?1:0),f=f.NextInAEL;else for(;f!==p;)p.WindCnt2+=f.WindDelta,f=f.NextInAEL},r.Clipper.prototype.AddEdgeToSEL=function(p){this.m_SortedEdges===null?(this.m_SortedEdges=p,p.PrevInSEL=null,p.NextInSEL=null):(p.NextInSEL=this.m_SortedEdges,p.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=p,this.m_SortedEdges=p)},r.Clipper.prototype.PopEdgeFromSEL=function(p){if(p.v=this.m_SortedEdges,p.v===null)return!1;var f=p.v;return this.m_SortedEdges=p.v.NextInSEL,this.m_SortedEdges!==null&&(this.m_SortedEdges.PrevInSEL=null),f.NextInSEL=null,f.PrevInSEL=null,!0},r.Clipper.prototype.CopyAELToSEL=function(){var p=this.m_ActiveEdges;for(this.m_SortedEdges=p;p!==null;)p.PrevInSEL=p.PrevInAEL,p.NextInSEL=p.NextInAEL,p=p.NextInAEL},r.Clipper.prototype.SwapPositionsInSEL=function(p,f){if(!(p.NextInSEL===null&&p.PrevInSEL===null)&&!(f.NextInSEL===null&&f.PrevInSEL===null)){if(p.NextInSEL===f){var x=f.NextInSEL;x!==null&&(x.PrevInSEL=p);var _=p.PrevInSEL;_!==null&&(_.NextInSEL=f),f.PrevInSEL=_,f.NextInSEL=p,p.PrevInSEL=f,p.NextInSEL=x}else if(f.NextInSEL===p){var x=p.NextInSEL;x!==null&&(x.PrevInSEL=f);var _=f.PrevInSEL;_!==null&&(_.NextInSEL=p),p.PrevInSEL=_,p.NextInSEL=f,f.PrevInSEL=p,f.NextInSEL=x}else{var x=p.NextInSEL,_=p.PrevInSEL;p.NextInSEL=f.NextInSEL,p.NextInSEL!==null&&(p.NextInSEL.PrevInSEL=p),p.PrevInSEL=f.PrevInSEL,p.PrevInSEL!==null&&(p.PrevInSEL.NextInSEL=p),f.NextInSEL=x,f.NextInSEL!==null&&(f.NextInSEL.PrevInSEL=f),f.PrevInSEL=_,f.PrevInSEL!==null&&(f.PrevInSEL.NextInSEL=f)}p.PrevInSEL===null?this.m_SortedEdges=p:f.PrevInSEL===null&&(this.m_SortedEdges=f)}},r.Clipper.prototype.AddLocalMaxPoly=function(p,f,x){this.AddOutPt(p,x),f.WindDelta===0&&this.AddOutPt(f,x),p.OutIdx===f.OutIdx?(p.OutIdx=-1,f.OutIdx=-1):p.OutIdx\\u003cf.OutIdx?this.AppendPolygon(p,f):this.AppendPolygon(f,p)},r.Clipper.prototype.AddLocalMinPoly=function(p,f,x){var _,A,B;if(r.ClipperBase.IsHorizontal(f)||p.Dx>f.Dx?(_=this.AddOutPt(p,x),f.OutIdx=p.OutIdx,p.Side=r.EdgeSide.esLeft,f.Side=r.EdgeSide.esRight,A=p,A.PrevInAEL===f?B=f.PrevInAEL:B=A.PrevInAEL):(_=this.AddOutPt(f,x),p.OutIdx=f.OutIdx,p.Side=r.EdgeSide.esRight,f.Side=r.EdgeSide.esLeft,A=f,A.PrevInAEL===p?B=p.PrevInAEL:B=A.PrevInAEL),B!==null&&B.OutIdx>=0&&B.Top.Y\\u003cx.Y&&A.Top.Y\\u003cx.Y){var k=r.Clipper.TopX(B,x.Y),ee=r.Clipper.TopX(A,x.Y);if(k===ee&&A.WindDelta!==0&&B.WindDelta!==0&&r.ClipperBase.SlopesEqual5(new r.IntPoint2(k,x.Y),B.Top,new r.IntPoint2(ee,x.Y),A.Top,this.m_UseFullRange)){var te=this.AddOutPt(B,x);this.AddJoin(_,te,A.Top)}}return _},r.Clipper.prototype.AddOutPt=function(p,f){if(p.OutIdx\\u003c0){var x=this.CreateOutRec();x.IsOpen=p.WindDelta===0;var _=new r.OutPt;return x.Pts=_,_.Idx=x.Idx,_.Pt.X=f.X,_.Pt.Y=f.Y,r.use_xyz&&(_.Pt.Z=f.Z),_.Next=_,_.Prev=_,x.IsOpen||this.SetHoleState(p,x),p.OutIdx=x.Idx,_}else{var x=this.m_PolyOuts[p.OutIdx],A=x.Pts,B=p.Side===r.EdgeSide.esLeft;if(B&&r.IntPoint.op_Equality(f,A.Pt))return A;if(!B&&r.IntPoint.op_Equality(f,A.Prev.Pt))return A.Prev;var _=new r.OutPt;return _.Idx=x.Idx,_.Pt.X=f.X,_.Pt.Y=f.Y,r.use_xyz&&(_.Pt.Z=f.Z),_.Next=A,_.Prev=A.Prev,_.Prev.Next=_,A.Prev=_,B&&(x.Pts=_),_}},r.Clipper.prototype.GetLastOutPt=function(p){var f=this.m_PolyOuts[p.OutIdx];return p.Side===r.EdgeSide.esLeft?f.Pts:f.Pts.Prev},r.Clipper.prototype.SwapPoints=function(p,f){var x=new r.IntPoint1(p.Value);p.Value.X=f.Value.X,p.Value.Y=f.Value.Y,r.use_xyz&&(p.Value.Z=f.Value.Z),f.Value.X=x.X,f.Value.Y=x.Y,r.use_xyz&&(f.Value.Z=x.Z)},r.Clipper.prototype.HorzSegmentsOverlap=function(p,f,x,_){var A;return p>f&&(A=p,p=f,f=A),x>_&&(A=x,x=_,_=A),p\\u003c_&&x\\u003cf},r.Clipper.prototype.SetHoleState=function(p,f){for(var x=p.PrevInAEL,_=null;x!==null;)x.OutIdx>=0&&x.WindDelta!==0&&(_===null?_=x:_.OutIdx===x.OutIdx&&(_=null)),x=x.PrevInAEL;_===null?(f.FirstLeft=null,f.IsHole=!1):(f.FirstLeft=this.m_PolyOuts[_.OutIdx],f.IsHole=!f.FirstLeft.IsHole)},r.Clipper.prototype.GetDx=function(p,f){return p.Y===f.Y?r.ClipperBase.horizontal:(f.X-p.X)/(f.Y-p.Y)},r.Clipper.prototype.FirstIsBottomPt=function(p,f){for(var x=p.Prev;r.IntPoint.op_Equality(x.Pt,p.Pt)&&x!==p;)x=x.Prev;var _=Math.abs(this.GetDx(p.Pt,x.Pt));for(x=p.Next;r.IntPoint.op_Equality(x.Pt,p.Pt)&&x!==p;)x=x.Next;var A=Math.abs(this.GetDx(p.Pt,x.Pt));for(x=f.Prev;r.IntPoint.op_Equality(x.Pt,f.Pt)&&x!==f;)x=x.Prev;var B=Math.abs(this.GetDx(f.Pt,x.Pt));for(x=f.Next;r.IntPoint.op_Equality(x.Pt,f.Pt)&&x!==f;)x=x.Next;var k=Math.abs(this.GetDx(f.Pt,x.Pt));return Math.max(_,A)===Math.max(B,k)&&Math.min(_,A)===Math.min(B,k)?this.Area(p)>0:_>=B&&_>=k||A>=B&&A>=k},r.Clipper.prototype.GetBottomPt=function(p){for(var f=null,x=p.Next;x!==p;)x.Pt.Y>p.Pt.Y?(p=x,f=null):x.Pt.Y===p.Pt.Y&&x.Pt.X\\u003c=p.Pt.X&&(x.Pt.X\\u003cp.Pt.X?(f=null,p=x):x.Next!==p&&x.Prev!==p&&(f=x)),x=x.Next;if(f!==null)for(;f!==x;)for(this.FirstIsBottomPt(x,f)||(p=f),f=f.Next;r.IntPoint.op_Inequality(f.Pt,p.Pt);)f=f.Next;return p},r.Clipper.prototype.GetLowermostRec=function(p,f){p.BottomPt===null&&(p.BottomPt=this.GetBottomPt(p.Pts)),f.BottomPt===null&&(f.BottomPt=this.GetBottomPt(f.Pts));var x=p.BottomPt,_=f.BottomPt;return x.Pt.Y>_.Pt.Y?p:x.Pt.Y\\u003c_.Pt.Y?f:x.Pt.X\\u003c_.Pt.X?p:x.Pt.X>_.Pt.X||x.Next===x?f:_.Next===_||this.FirstIsBottomPt(x,_)?p:f},r.Clipper.prototype.OutRec1RightOfOutRec2=function(p,f){do if(p=p.FirstLeft,p===f)return!0;while(p!==null);return!1},r.Clipper.prototype.GetOutRec=function(p){for(var f=this.m_PolyOuts[p];f!==this.m_PolyOuts[f.Idx];)f=this.m_PolyOuts[f.Idx];return f},r.Clipper.prototype.AppendPolygon=function(p,f){var x=this.m_PolyOuts[p.OutIdx],_=this.m_PolyOuts[f.OutIdx],A;this.OutRec1RightOfOutRec2(x,_)?A=_:this.OutRec1RightOfOutRec2(_,x)?A=x:A=this.GetLowermostRec(x,_);var B=x.Pts,k=B.Prev,ee=_.Pts,te=ee.Prev;p.Side===r.EdgeSide.esLeft?f.Side===r.EdgeSide.esLeft?(this.ReversePolyPtLinks(ee),ee.Next=B,B.Prev=ee,k.Next=te,te.Prev=k,x.Pts=te):(te.Next=B,B.Prev=te,ee.Prev=k,k.Next=ee,x.Pts=ee):f.Side===r.EdgeSide.esRight?(this.ReversePolyPtLinks(ee),k.Next=te,te.Prev=k,ee.Next=B,B.Prev=ee):(k.Next=ee,ee.Prev=k,B.Prev=te,te.Next=B),x.BottomPt=null,A===_&&(_.FirstLeft!==x&&(x.FirstLeft=_.FirstLeft),x.IsHole=_.IsHole),_.Pts=null,_.BottomPt=null,_.FirstLeft=x;var me=p.OutIdx,Le=f.OutIdx;p.OutIdx=-1,f.OutIdx=-1;for(var Me=this.m_ActiveEdges;Me!==null;){if(Me.OutIdx===Le){Me.OutIdx=me,Me.Side=p.Side;break}Me=Me.NextInAEL}_.Idx=x.Idx},r.Clipper.prototype.ReversePolyPtLinks=function(p){if(p!==null){var f,x;f=p;do x=f.Next,f.Next=f.Prev,f.Prev=x,f=x;while(f!==p)}},r.Clipper.SwapSides=function(p,f){var x=p.Side;p.Side=f.Side,f.Side=x},r.Clipper.SwapPolyIndexes=function(p,f){var x=p.OutIdx;p.OutIdx=f.OutIdx,f.OutIdx=x},r.Clipper.prototype.IntersectEdges=function(p,f,x){var _=p.OutIdx>=0,A=f.OutIdx>=0;if(r.use_xyz&&this.SetZ(x,p,f),r.use_lines&&(p.WindDelta===0||f.WindDelta===0)){if(p.WindDelta===0&&f.WindDelta===0)return;p.PolyTyp===f.PolyTyp&&p.WindDelta!==f.WindDelta&&this.m_ClipType===r.ClipType.ctUnion?p.WindDelta===0?A&&(this.AddOutPt(p,x),_&&(p.OutIdx=-1)):_&&(this.AddOutPt(f,x),A&&(f.OutIdx=-1)):p.PolyTyp!==f.PolyTyp&&(p.WindDelta===0&&Math.abs(f.WindCnt)===1&&(this.m_ClipType!==r.ClipType.ctUnion||f.WindCnt2===0)?(this.AddOutPt(p,x),_&&(p.OutIdx=-1)):f.WindDelta===0&&Math.abs(p.WindCnt)===1&&(this.m_ClipType!==r.ClipType.ctUnion||p.WindCnt2===0)&&(this.AddOutPt(f,x),A&&(f.OutIdx=-1)));return}if(p.PolyTyp===f.PolyTyp)if(this.IsEvenOddFillType(p)){var B=p.WindCnt;p.WindCnt=f.WindCnt,f.WindCnt=B}else p.WindCnt+f.WindDelta===0?p.WindCnt=-p.WindCnt:p.WindCnt+=f.WindDelta,f.WindCnt-p.WindDelta===0?f.WindCnt=-f.WindCnt:f.WindCnt-=p.WindDelta;else this.IsEvenOddFillType(f)?p.WindCnt2=p.WindCnt2===0?1:0:p.WindCnt2+=f.WindDelta,this.IsEvenOddFillType(p)?f.WindCnt2=f.WindCnt2===0?1:0:f.WindCnt2-=p.WindDelta;var k,ee,te,me;p.PolyTyp===r.PolyType.ptSubject?(k=this.m_SubjFillType,te=this.m_ClipFillType):(k=this.m_ClipFillType,te=this.m_SubjFillType),f.PolyTyp===r.PolyType.ptSubject?(ee=this.m_SubjFillType,me=this.m_ClipFillType):(ee=this.m_ClipFillType,me=this.m_SubjFillType);var Le,Me;switch(k){case r.PolyFillType.pftPositive:Le=p.WindCnt;break;case r.PolyFillType.pftNegative:Le=-p.WindCnt;break;default:Le=Math.abs(p.WindCnt);break}switch(ee){case r.PolyFillType.pftPositive:Me=f.WindCnt;break;case r.PolyFillType.pftNegative:Me=-f.WindCnt;break;default:Me=Math.abs(f.WindCnt);break}if(_&&A)Le!==0&&Le!==1||Me!==0&&Me!==1||p.PolyTyp!==f.PolyTyp&&this.m_ClipType!==r.ClipType.ctXor?this.AddLocalMaxPoly(p,f,x):(this.AddOutPt(p,x),this.AddOutPt(f,x),r.Clipper.SwapSides(p,f),r.Clipper.SwapPolyIndexes(p,f));else if(_)(Me===0||Me===1)&&(this.AddOutPt(p,x),r.Clipper.SwapSides(p,f),r.Clipper.SwapPolyIndexes(p,f));else if(A)(Le===0||Le===1)&&(this.AddOutPt(f,x),r.Clipper.SwapSides(p,f),r.Clipper.SwapPolyIndexes(p,f));else if((Le===0||Le===1)&&(Me===0||Me===1)){var Ge,xt;switch(te){case r.PolyFillType.pftPositive:Ge=p.WindCnt2;break;case r.PolyFillType.pftNegative:Ge=-p.WindCnt2;break;default:Ge=Math.abs(p.WindCnt2);break}switch(me){case r.PolyFillType.pftPositive:xt=f.WindCnt2;break;case r.PolyFillType.pftNegative:xt=-f.WindCnt2;break;default:xt=Math.abs(f.WindCnt2);break}if(p.PolyTyp!==f.PolyTyp)this.AddLocalMinPoly(p,f,x);else if(Le===1&&Me===1)switch(this.m_ClipType){case r.ClipType.ctIntersection:Ge>0&&xt>0&&this.AddLocalMinPoly(p,f,x);break;case r.ClipType.ctUnion:Ge\\u003c=0&&xt\\u003c=0&&this.AddLocalMinPoly(p,f,x);break;case r.ClipType.ctDifference:(p.PolyTyp===r.PolyType.ptClip&&Ge>0&&xt>0||p.PolyTyp===r.PolyType.ptSubject&&Ge\\u003c=0&&xt\\u003c=0)&&this.AddLocalMinPoly(p,f,x);break;case r.ClipType.ctXor:this.AddLocalMinPoly(p,f,x);break}else r.Clipper.SwapSides(p,f)}},r.Clipper.prototype.DeleteFromSEL=function(p){var f=p.PrevInSEL,x=p.NextInSEL;f===null&&x===null&&p!==this.m_SortedEdges||(f!==null?f.NextInSEL=x:this.m_SortedEdges=x,x!==null&&(x.PrevInSEL=f),p.NextInSEL=null,p.PrevInSEL=null)},r.Clipper.prototype.ProcessHorizontals=function(){for(var p={};this.PopEdgeFromSEL(p);)this.ProcessHorizontal(p.v)},r.Clipper.prototype.GetHorzDirection=function(p,f){p.Bot.X\\u003cp.Top.X?(f.Left=p.Bot.X,f.Right=p.Top.X,f.Dir=r.Direction.dLeftToRight):(f.Left=p.Top.X,f.Right=p.Bot.X,f.Dir=r.Direction.dRightToLeft)},r.Clipper.prototype.ProcessHorizontal=function(p){var f={Dir:null,Left:null,Right:null};this.GetHorzDirection(p,f);for(var x=f.Dir,_=f.Left,A=f.Right,B=p.WindDelta===0,k=p,ee=null;k.NextInLML!==null&&r.ClipperBase.IsHorizontal(k.NextInLML);)k=k.NextInLML;k.NextInLML===null&&(ee=this.GetMaximaPair(k));var te=this.m_Maxima;if(te!==null)if(x===r.Direction.dLeftToRight){for(;te!==null&&te.X\\u003c=p.Bot.X;)te=te.Next;te!==null&&te.X>=k.Top.X&&(te=null)}else{for(;te.Next!==null&&te.Next.X\\u003cp.Bot.X;)te=te.Next;te.X\\u003c=k.Top.X&&(te=null)}for(var me=null;;){for(var Le=p===k,Me=this.GetNextInAEL(p,x);Me!==null;){if(te!==null)if(x===r.Direction.dLeftToRight)for(;te!==null&&te.X\\u003cMe.Curr.X;)p.OutIdx>=0&&!B&&this.AddOutPt(p,new r.IntPoint2(te.X,p.Bot.Y)),te=te.Next;else for(;te!==null&&te.X>Me.Curr.X;)p.OutIdx>=0&&!B&&this.AddOutPt(p,new r.IntPoint2(te.X,p.Bot.Y)),te=te.Prev;if(x===r.Direction.dLeftToRight&&Me.Curr.X>A||x===r.Direction.dRightToLeft&&Me.Curr.X\\u003c_||Me.Curr.X===p.Top.X&&p.NextInLML!==null&&Me.Dx\\u003cp.NextInLML.Dx)break;if(p.OutIdx>=0&&!B){r.use_xyz&&(x===r.Direction.dLeftToRight?this.SetZ(Me.Curr,p,Me):this.SetZ(Me.Curr,Me,p)),me=this.AddOutPt(p,Me.Curr);for(var Ge=this.m_SortedEdges;Ge!==null;){if(Ge.OutIdx>=0&&this.HorzSegmentsOverlap(p.Bot.X,p.Top.X,Ge.Bot.X,Ge.Top.X)){var xt=this.GetLastOutPt(Ge);this.AddJoin(xt,me,Ge.Top)}Ge=Ge.NextInSEL}this.AddGhostJoin(me,p.Bot)}if(Me===ee&&Le){p.OutIdx>=0&&this.AddLocalMaxPoly(p,ee,p.Top),this.DeleteFromAEL(p),this.DeleteFromAEL(ee);return}if(x===r.Direction.dLeftToRight){var kt=new r.IntPoint2(Me.Curr.X,p.Curr.Y);this.IntersectEdges(p,Me,kt)}else{var kt=new r.IntPoint2(Me.Curr.X,p.Curr.Y);this.IntersectEdges(Me,p,kt)}var Vt=this.GetNextInAEL(Me,x);this.SwapPositionsInAEL(p,Me),Me=Vt}if(p.NextInLML===null||!r.ClipperBase.IsHorizontal(p.NextInLML))break;p=this.UpdateEdgeIntoAEL(p),p.OutIdx>=0&&this.AddOutPt(p,p.Bot),f={Dir:x,Left:_,Right:A},this.GetHorzDirection(p,f),x=f.Dir,_=f.Left,A=f.Right}if(p.OutIdx>=0&&me===null){me=this.GetLastOutPt(p);for(var Ge=this.m_SortedEdges;Ge!==null;){if(Ge.OutIdx>=0&&this.HorzSegmentsOverlap(p.Bot.X,p.Top.X,Ge.Bot.X,Ge.Top.X)){var xt=this.GetLastOutPt(Ge);this.AddJoin(xt,me,Ge.Top)}Ge=Ge.NextInSEL}this.AddGhostJoin(me,p.Top)}if(p.NextInLML!==null)if(p.OutIdx>=0){if(me=this.AddOutPt(p,p.Top),p=this.UpdateEdgeIntoAEL(p),p.WindDelta===0)return;var fr=p.PrevInAEL,Vt=p.NextInAEL;if(fr!==null&&fr.Curr.X===p.Bot.X&&fr.Curr.Y===p.Bot.Y&&fr.WindDelta===0&&fr.OutIdx>=0&&fr.Curr.Y>fr.Top.Y&&r.ClipperBase.SlopesEqual3(p,fr,this.m_UseFullRange)){var xt=this.AddOutPt(fr,p.Bot);this.AddJoin(me,xt,p.Top)}else if(Vt!==null&&Vt.Curr.X===p.Bot.X&&Vt.Curr.Y===p.Bot.Y&&Vt.WindDelta!==0&&Vt.OutIdx>=0&&Vt.Curr.Y>Vt.Top.Y&&r.ClipperBase.SlopesEqual3(p,Vt,this.m_UseFullRange)){var xt=this.AddOutPt(Vt,p.Bot);this.AddJoin(me,xt,p.Top)}}else p=this.UpdateEdgeIntoAEL(p);else p.OutIdx>=0&&this.AddOutPt(p,p.Top),this.DeleteFromAEL(p)},r.Clipper.prototype.GetNextInAEL=function(p,f){return f===r.Direction.dLeftToRight?p.NextInAEL:p.PrevInAEL},r.Clipper.prototype.IsMinima=function(p){return p!==null&&p.Prev.NextInLML!==p&&p.Next.NextInLML!==p},r.Clipper.prototype.IsMaxima=function(p,f){return p!==null&&p.Top.Y===f&&p.NextInLML===null},r.Clipper.prototype.IsIntermediate=function(p,f){return p.Top.Y===f&&p.NextInLML!==null},r.Clipper.prototype.GetMaximaPair=function(p){return r.IntPoint.op_Equality(p.Next.Top,p.Top)&&p.Next.NextInLML===null?p.Next:r.IntPoint.op_Equality(p.Prev.Top,p.Top)&&p.Prev.NextInLML===null?p.Prev:null},r.Clipper.prototype.GetMaximaPairEx=function(p){var f=this.GetMaximaPair(p);return f===null||f.OutIdx===r.ClipperBase.Skip||f.NextInAEL===f.PrevInAEL&&!r.ClipperBase.IsHorizontal(f)?null:f},r.Clipper.prototype.ProcessIntersections=function(p){if(this.m_ActiveEdges===null)return!0;try{if(this.BuildIntersectList(p),this.m_IntersectList.length===0)return!0;if(this.m_IntersectList.length===1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,r.Error(\\\"ProcessIntersections error\\\")}return this.m_SortedEdges=null,!0},r.Clipper.prototype.BuildIntersectList=function(p){if(this.m_ActiveEdges!==null){var f=this.m_ActiveEdges;for(this.m_SortedEdges=f;f!==null;)f.PrevInSEL=f.PrevInAEL,f.NextInSEL=f.NextInAEL,f.Curr.X=r.Clipper.TopX(f,p),f=f.NextInAEL;for(var x=!0;x&&this.m_SortedEdges!==null;){for(x=!1,f=this.m_SortedEdges;f.NextInSEL!==null;){var _=f.NextInSEL,A=new r.IntPoint0;if(f.Curr.X>_.Curr.X){this.IntersectPoint(f,_,A),A.Y\\u003cp&&(A=new r.IntPoint2(r.Clipper.TopX(f,p),p));var B=new r.IntersectNode;B.Edge1=f,B.Edge2=_,B.Pt.X=A.X,B.Pt.Y=A.Y,r.use_xyz&&(B.Pt.Z=A.Z),this.m_IntersectList.push(B),this.SwapPositionsInSEL(f,_),x=!0}else f=_}if(f.PrevInSEL!==null)f.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}},r.Clipper.prototype.EdgesAdjacent=function(p){return p.Edge1.NextInSEL===p.Edge2||p.Edge1.PrevInSEL===p.Edge2},r.Clipper.IntersectNodeSort=function(p,f){return f.Pt.Y-p.Pt.Y},r.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var p=this.m_IntersectList.length,f=0;f\\u003cp;f++){if(!this.EdgesAdjacent(this.m_IntersectList[f])){for(var x=f+1;x\\u003cp&&!this.EdgesAdjacent(this.m_IntersectList[x]);)x++;if(x===p)return!1;var _=this.m_IntersectList[f];this.m_IntersectList[f]=this.m_IntersectList[x],this.m_IntersectList[x]=_}this.SwapPositionsInSEL(this.m_IntersectList[f].Edge1,this.m_IntersectList[f].Edge2)}return!0},r.Clipper.prototype.ProcessIntersectList=function(){for(var p=0,f=this.m_IntersectList.length;p\\u003cf;p++){var x=this.m_IntersectList[p];this.IntersectEdges(x.Edge1,x.Edge2,x.Pt),this.SwapPositionsInAEL(x.Edge1,x.Edge2)}this.m_IntersectList.length=0};var y0e=function(p){return p\\u003c0?Math.ceil(p-.5):Math.round(p)},x0e=function(p){return p\\u003c0?Math.ceil(p-.5):Math.floor(p+.5)},v0e=function(p){return p\\u003c0?-Math.round(Math.abs(p)):Math.round(p)},b0e=function(p){return p\\u003c0?(p-=.5,p\\u003c-2147483648?Math.ceil(p):p|0):(p+=.5,p>2147483647?Math.floor(p):p|0)};n.msie?r.Clipper.Round=y0e:n.chromium?r.Clipper.Round=v0e:n.safari?r.Clipper.Round=b0e:r.Clipper.Round=x0e,r.Clipper.TopX=function(p,f){return f===p.Top.Y?p.Top.X:p.Bot.X+r.Clipper.Round(p.Dx*(f-p.Bot.Y))},r.Clipper.prototype.IntersectPoint=function(p,f,x){x.X=0,x.Y=0;var _,A;if(p.Dx===f.Dx){x.Y=p.Curr.Y,x.X=r.Clipper.TopX(p,x.Y);return}if(p.Delta.X===0)x.X=p.Bot.X,r.ClipperBase.IsHorizontal(f)?x.Y=f.Bot.Y:(A=f.Bot.Y-f.Bot.X/f.Dx,x.Y=r.Clipper.Round(x.X/f.Dx+A));else if(f.Delta.X===0)x.X=f.Bot.X,r.ClipperBase.IsHorizontal(p)?x.Y=p.Bot.Y:(_=p.Bot.Y-p.Bot.X/p.Dx,x.Y=r.Clipper.Round(x.X/p.Dx+_));else{_=p.Bot.X-p.Bot.Y*p.Dx,A=f.Bot.X-f.Bot.Y*f.Dx;var B=(A-_)/(p.Dx-f.Dx);x.Y=r.Clipper.Round(B),Math.abs(p.Dx)\\u003cMath.abs(f.Dx)?x.X=r.Clipper.Round(p.Dx*B+_):x.X=r.Clipper.Round(f.Dx*B+A)}if(x.Y\\u003cp.Top.Y||x.Y\\u003cf.Top.Y){if(p.Top.Y>f.Top.Y)return x.Y=p.Top.Y,x.X=r.Clipper.TopX(f,p.Top.Y),x.X\\u003cp.Top.X;x.Y=f.Top.Y,Math.abs(p.Dx)\\u003cMath.abs(f.Dx)?x.X=r.Clipper.TopX(p,x.Y):x.X=r.Clipper.TopX(f,x.Y)}x.Y>p.Curr.Y&&(x.Y=p.Curr.Y,Math.abs(p.Dx)>Math.abs(f.Dx)?x.X=r.Clipper.TopX(f,x.Y):x.X=r.Clipper.TopX(p,x.Y))},r.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(p){for(var f=this.m_ActiveEdges;f!==null;){var x=this.IsMaxima(f,p);if(x){var _=this.GetMaximaPairEx(f);x=_===null||!r.ClipperBase.IsHorizontal(_)}if(x){this.StrictlySimple&&this.InsertMaxima(f.Top.X);var A=f.PrevInAEL;this.DoMaxima(f),A===null?f=this.m_ActiveEdges:f=A.NextInAEL}else{if(this.IsIntermediate(f,p)&&r.ClipperBase.IsHorizontal(f.NextInLML)?(f=this.UpdateEdgeIntoAEL(f),f.OutIdx>=0&&this.AddOutPt(f,f.Bot),this.AddEdgeToSEL(f)):(f.Curr.X=r.Clipper.TopX(f,p),f.Curr.Y=p),r.use_xyz&&(f.Top.Y===p?f.Curr.Z=f.Top.Z:f.Bot.Y===p?f.Curr.Z=f.Bot.Z:f.Curr.Z=0),this.StrictlySimple){var A=f.PrevInAEL;if(f.OutIdx>=0&&f.WindDelta!==0&&A!==null&&A.OutIdx>=0&&A.Curr.X===f.Curr.X&&A.WindDelta!==0){var B=new r.IntPoint1(f.Curr);r.use_xyz&&this.SetZ(B,A,f);var k=this.AddOutPt(A,B),ee=this.AddOutPt(f,B);this.AddJoin(k,ee,B)}}f=f.NextInAEL}}for(this.ProcessHorizontals(),this.m_Maxima=null,f=this.m_ActiveEdges;f!==null;){if(this.IsIntermediate(f,p)){var k=null;f.OutIdx>=0&&(k=this.AddOutPt(f,f.Top)),f=this.UpdateEdgeIntoAEL(f);var A=f.PrevInAEL,te=f.NextInAEL;if(A!==null&&A.Curr.X===f.Bot.X&&A.Curr.Y===f.Bot.Y&&k!==null&&A.OutIdx>=0&&A.Curr.Y===A.Top.Y&&r.ClipperBase.SlopesEqual5(f.Curr,f.Top,A.Curr,A.Top,this.m_UseFullRange)&&f.WindDelta!==0&&A.WindDelta!==0){var ee=this.AddOutPt(ePrev2,f.Bot);this.AddJoin(k,ee,f.Top)}else if(te!==null&&te.Curr.X===f.Bot.X&&te.Curr.Y===f.Bot.Y&&k!==null&&te.OutIdx>=0&&te.Curr.Y===te.Top.Y&&r.ClipperBase.SlopesEqual5(f.Curr,f.Top,te.Curr,te.Top,this.m_UseFullRange)&&f.WindDelta!==0&&te.WindDelta!==0){var ee=this.AddOutPt(te,f.Bot);this.AddJoin(k,ee,f.Top)}}f=f.NextInAEL}},r.Clipper.prototype.DoMaxima=function(p){var f=this.GetMaximaPairEx(p);if(f===null){p.OutIdx>=0&&this.AddOutPt(p,p.Top),this.DeleteFromAEL(p);return}for(var x=p.NextInAEL;x!==null&&x!==f;)this.IntersectEdges(p,x,p.Top),this.SwapPositionsInAEL(p,x),x=p.NextInAEL;p.OutIdx===-1&&f.OutIdx===-1?(this.DeleteFromAEL(p),this.DeleteFromAEL(f)):p.OutIdx>=0&&f.OutIdx>=0?(p.OutIdx>=0&&this.AddLocalMaxPoly(p,f,p.Top),this.DeleteFromAEL(p),this.DeleteFromAEL(f)):r.use_lines&&p.WindDelta===0?(p.OutIdx>=0&&(this.AddOutPt(p,p.Top),p.OutIdx=r.ClipperBase.Unassigned),this.DeleteFromAEL(p),f.OutIdx>=0&&(this.AddOutPt(f,p.Top),f.OutIdx=r.ClipperBase.Unassigned),this.DeleteFromAEL(f)):r.Error(\\\"DoMaxima error\\\")},r.Clipper.ReversePaths=function(p){for(var f=0,x=p.length;f\\u003cx;f++)p[f].reverse()},r.Clipper.Orientation=function(p){return r.Clipper.Area(p)>=0},r.Clipper.prototype.PointCount=function(p){if(p===null)return 0;var f=0,x=p;do f++,x=x.Next;while(x!==p);return f},r.Clipper.prototype.BuildResult=function(p){r.Clear(p);for(var f=0,x=this.m_PolyOuts.length;f\\u003cx;f++){var _=this.m_PolyOuts[f];if(_.Pts!==null){var A=_.Pts.Prev,B=this.PointCount(A);if(!(B\\u003c2)){for(var k=new Array(B),ee=0;ee\\u003cB;ee++)k[ee]=A.Pt,A=A.Prev;p.push(k)}}}},r.Clipper.prototype.BuildResult2=function(p){p.Clear();for(var f=0,x=this.m_PolyOuts.length;f\\u003cx;f++){var _=this.m_PolyOuts[f],A=this.PointCount(_.Pts);if(!(_.IsOpen&&A\\u003c2||!_.IsOpen&&A\\u003c3)){this.FixHoleLinkage(_);var B=new r.PolyNode;p.m_AllPolys.push(B),_.PolyNode=B,B.m_polygon.length=A;for(var k=_.Pts.Prev,ee=0;ee\\u003cA;ee++)B.m_polygon[ee]=k.Pt,k=k.Prev}}for(var f=0,x=this.m_PolyOuts.length;f\\u003cx;f++){var _=this.m_PolyOuts[f];_.PolyNode!==null&&(_.IsOpen?(_.PolyNode.IsOpen=!0,p.AddChild(_.PolyNode)):_.FirstLeft!==null&&_.FirstLeft.PolyNode!==null?_.FirstLeft.PolyNode.AddChild(_.PolyNode):p.AddChild(_.PolyNode))}},r.Clipper.prototype.FixupOutPolyline=function(p){for(var f=p.Pts,x=f.Prev;f!==x;)if(f=f.Next,r.IntPoint.op_Equality(f.Pt,f.Prev.Pt)){f===x&&(x=f.Prev);var _=f.Prev;_.Next=f.Next,f.Next.Prev=_,f=_}f===f.Prev&&(p.Pts=null)},r.Clipper.prototype.FixupOutPolygon=function(p){var f=null;p.BottomPt=null;for(var x=p.Pts,_=this.PreserveCollinear||this.StrictlySimple;;){if(x.Prev===x||x.Prev===x.Next){p.Pts=null;return}if(r.IntPoint.op_Equality(x.Pt,x.Next.Pt)||r.IntPoint.op_Equality(x.Pt,x.Prev.Pt)||r.ClipperBase.SlopesEqual4(x.Prev.Pt,x.Pt,x.Next.Pt,this.m_UseFullRange)&&(!_||!this.Pt2IsBetweenPt1AndPt3(x.Prev.Pt,x.Pt,x.Next.Pt)))f=null,x.Prev.Next=x.Next,x.Next.Prev=x.Prev,x=x.Prev;else{if(x===f)break;f===null&&(f=x),x=x.Next}}p.Pts=x},r.Clipper.prototype.DupOutPt=function(p,f){var x=new r.OutPt;return x.Pt.X=p.Pt.X,x.Pt.Y=p.Pt.Y,r.use_xyz&&(x.Pt.Z=p.Pt.Z),x.Idx=p.Idx,f?(x.Next=p.Next,x.Prev=p,p.Next.Prev=x,p.Next=x):(x.Prev=p.Prev,x.Next=p,p.Prev.Next=x,p.Prev=x),x},r.Clipper.prototype.GetOverlap=function(p,f,x,_,A){return p\\u003cf?x\\u003c_?(A.Left=Math.max(p,x),A.Right=Math.min(f,_)):(A.Left=Math.max(p,_),A.Right=Math.min(f,x)):x\\u003c_?(A.Left=Math.max(f,x),A.Right=Math.min(p,_)):(A.Left=Math.max(f,_),A.Right=Math.min(p,x)),A.Left\\u003cA.Right},r.Clipper.prototype.JoinHorz=function(p,f,x,_,A,B){var k=p.Pt.X>f.Pt.X?r.Direction.dRightToLeft:r.Direction.dLeftToRight,ee=x.Pt.X>_.Pt.X?r.Direction.dRightToLeft:r.Direction.dLeftToRight;if(k===ee)return!1;if(k===r.Direction.dLeftToRight){for(;p.Next.Pt.X\\u003c=A.X&&p.Next.Pt.X>=p.Pt.X&&p.Next.Pt.Y===A.Y;)p=p.Next;B&&p.Pt.X!==A.X&&(p=p.Next),f=this.DupOutPt(p,!B),r.IntPoint.op_Inequality(f.Pt,A)&&(p=f,p.Pt.X=A.X,p.Pt.Y=A.Y,r.use_xyz&&(p.Pt.Z=A.Z),f=this.DupOutPt(p,!B))}else{for(;p.Next.Pt.X>=A.X&&p.Next.Pt.X\\u003c=p.Pt.X&&p.Next.Pt.Y===A.Y;)p=p.Next;!B&&p.Pt.X!==A.X&&(p=p.Next),f=this.DupOutPt(p,B),r.IntPoint.op_Inequality(f.Pt,A)&&(p=f,p.Pt.X=A.X,p.Pt.Y=A.Y,r.use_xyz&&(p.Pt.Z=A.Z),f=this.DupOutPt(p,B))}if(ee===r.Direction.dLeftToRight){for(;x.Next.Pt.X\\u003c=A.X&&x.Next.Pt.X>=x.Pt.X&&x.Next.Pt.Y===A.Y;)x=x.Next;B&&x.Pt.X!==A.X&&(x=x.Next),_=this.DupOutPt(x,!B),r.IntPoint.op_Inequality(_.Pt,A)&&(x=_,x.Pt.X=A.X,x.Pt.Y=A.Y,r.use_xyz&&(x.Pt.Z=A.Z),_=this.DupOutPt(x,!B))}else{for(;x.Next.Pt.X>=A.X&&x.Next.Pt.X\\u003c=x.Pt.X&&x.Next.Pt.Y===A.Y;)x=x.Next;!B&&x.Pt.X!==A.X&&(x=x.Next),_=this.DupOutPt(x,B),r.IntPoint.op_Inequality(_.Pt,A)&&(x=_,x.Pt.X=A.X,x.Pt.Y=A.Y,r.use_xyz&&(x.Pt.Z=A.Z),_=this.DupOutPt(x,B))}return k===r.Direction.dLeftToRight===B?(p.Prev=x,x.Next=p,f.Next=_,_.Prev=f):(p.Next=x,x.Prev=p,f.Prev=_,_.Next=f),!0},r.Clipper.prototype.JoinPoints=function(p,f,x){var _=p.OutPt1,A=new r.OutPt,B=p.OutPt2,k=new r.OutPt,ee=p.OutPt1.Pt.Y===p.OffPt.Y;if(ee&&r.IntPoint.op_Equality(p.OffPt,p.OutPt1.Pt)&&r.IntPoint.op_Equality(p.OffPt,p.OutPt2.Pt)){if(f!==x)return!1;for(A=p.OutPt1.Next;A!==_&&r.IntPoint.op_Equality(A.Pt,p.OffPt);)A=A.Next;var te=A.Pt.Y>p.OffPt.Y;for(k=p.OutPt2.Next;k!==B&&r.IntPoint.op_Equality(k.Pt,p.OffPt);)k=k.Next;var me=k.Pt.Y>p.OffPt.Y;return te===me?!1:te?(A=this.DupOutPt(_,!1),k=this.DupOutPt(B,!0),_.Prev=B,B.Next=_,A.Next=k,k.Prev=A,p.OutPt1=_,p.OutPt2=A,!0):(A=this.DupOutPt(_,!0),k=this.DupOutPt(B,!1),_.Next=B,B.Prev=_,A.Prev=k,k.Next=A,p.OutPt1=_,p.OutPt2=A,!0)}else if(ee){for(A=_;_.Prev.Pt.Y===_.Pt.Y&&_.Prev!==A&&_.Prev!==B;)_=_.Prev;for(;A.Next.Pt.Y===A.Pt.Y&&A.Next!==_&&A.Next!==B;)A=A.Next;if(A.Next===_||A.Next===B)return!1;for(k=B;B.Prev.Pt.Y===B.Pt.Y&&B.Prev!==k&&B.Prev!==A;)B=B.Prev;for(;k.Next.Pt.Y===k.Pt.Y&&k.Next!==B&&k.Next!==_;)k=k.Next;if(k.Next===B||k.Next===_)return!1;var Le={Left:null,Right:null};if(!this.GetOverlap(_.Pt.X,A.Pt.X,B.Pt.X,k.Pt.X,Le))return!1;var Me=Le.Left,Ge=Le.Right,xt=new r.IntPoint0,kt;return _.Pt.X>=Me&&_.Pt.X\\u003c=Ge?(xt.X=_.Pt.X,xt.Y=_.Pt.Y,r.use_xyz&&(xt.Z=_.Pt.Z),kt=_.Pt.X>A.Pt.X):B.Pt.X>=Me&&B.Pt.X\\u003c=Ge?(xt.X=B.Pt.X,xt.Y=B.Pt.Y,r.use_xyz&&(xt.Z=B.Pt.Z),kt=B.Pt.X>k.Pt.X):A.Pt.X>=Me&&A.Pt.X\\u003c=Ge?(xt.X=A.Pt.X,xt.Y=A.Pt.Y,r.use_xyz&&(xt.Z=A.Pt.Z),kt=A.Pt.X>_.Pt.X):(xt.X=k.Pt.X,xt.Y=k.Pt.Y,r.use_xyz&&(xt.Z=k.Pt.Z),kt=k.Pt.X>B.Pt.X),p.OutPt1=_,p.OutPt2=B,this.JoinHorz(_,A,B,k,xt,kt)}else{for(A=_.Next;r.IntPoint.op_Equality(A.Pt,_.Pt)&&A!==_;)A=A.Next;var Vt=A.Pt.Y>_.Pt.Y||!r.ClipperBase.SlopesEqual4(_.Pt,A.Pt,p.OffPt,this.m_UseFullRange);if(Vt){for(A=_.Prev;r.IntPoint.op_Equality(A.Pt,_.Pt)&&A!==_;)A=A.Prev;if(A.Pt.Y>_.Pt.Y||!r.ClipperBase.SlopesEqual4(_.Pt,A.Pt,p.OffPt,this.m_UseFullRange))return!1}for(k=B.Next;r.IntPoint.op_Equality(k.Pt,B.Pt)&&k!==B;)k=k.Next;var fr=k.Pt.Y>B.Pt.Y||!r.ClipperBase.SlopesEqual4(B.Pt,k.Pt,p.OffPt,this.m_UseFullRange);if(fr){for(k=B.Prev;r.IntPoint.op_Equality(k.Pt,B.Pt)&&k!==B;)k=k.Prev;if(k.Pt.Y>B.Pt.Y||!r.ClipperBase.SlopesEqual4(B.Pt,k.Pt,p.OffPt,this.m_UseFullRange))return!1}return A===_||k===B||A===k||f===x&&Vt===fr?!1:Vt?(A=this.DupOutPt(_,!1),k=this.DupOutPt(B,!0),_.Prev=B,B.Next=_,A.Next=k,k.Prev=A,p.OutPt1=_,p.OutPt2=A,!0):(A=this.DupOutPt(_,!0),k=this.DupOutPt(B,!1),_.Next=B,B.Prev=_,A.Prev=k,k.Next=A,p.OutPt1=_,p.OutPt2=A,!0)}},r.Clipper.GetBounds=function(p){for(var f=0,x=p.length;f\\u003cx&&p[f].length===0;)f++;if(f===x)return new r.IntRect(0,0,0,0);var _=new r.IntRect;for(_.left=p[f][0].X,_.right=_.left,_.top=p[f][0].Y,_.bottom=_.top;f\\u003cx;f++)for(var A=0,B=p[f].length;A\\u003cB;A++)p[f][A].X\\u003c_.left?_.left=p[f][A].X:p[f][A].X>_.right&&(_.right=p[f][A].X),p[f][A].Y\\u003c_.top?_.top=p[f][A].Y:p[f][A].Y>_.bottom&&(_.bottom=p[f][A].Y);return _},r.Clipper.prototype.GetBounds2=function(p){var f=p,x=new r.IntRect;for(x.left=p.Pt.X,x.right=p.Pt.X,x.top=p.Pt.Y,x.bottom=p.Pt.Y,p=p.Next;p!==f;)p.Pt.X\\u003cx.left&&(x.left=p.Pt.X),p.Pt.X>x.right&&(x.right=p.Pt.X),p.Pt.Y\\u003cx.top&&(x.top=p.Pt.Y),p.Pt.Y>x.bottom&&(x.bottom=p.Pt.Y),p=p.Next;return x},r.Clipper.PointInPolygon=function(p,f){var x=0,_=f.length;if(_\\u003c3)return 0;for(var A=f[0],B=1;B\\u003c=_;++B){var k=B===_?f[0]:f[B];if(k.Y===p.Y&&(k.X===p.X||A.Y===p.Y&&k.X>p.X==A.X\\u003cp.X))return-1;if(A.Y\\u003cp.Y!=k.Y\\u003cp.Y){if(A.X>=p.X)if(k.X>p.X)x=1-x;else{var ee=(A.X-p.X)*(k.Y-p.Y)-(k.X-p.X)*(A.Y-p.Y);if(ee===0)return-1;ee>0==k.Y>A.Y&&(x=1-x)}else if(k.X>p.X){var ee=(A.X-p.X)*(k.Y-p.Y)-(k.X-p.X)*(A.Y-p.Y);if(ee===0)return-1;ee>0==k.Y>A.Y&&(x=1-x)}}A=k}return x},r.Clipper.prototype.PointInPolygon=function(p,f){var x=0,_=f,A=p.X,B=p.Y,k=f.Pt.X,ee=f.Pt.Y;do{f=f.Next;var te=f.Pt.X,me=f.Pt.Y;if(me===B&&(te===A||ee===B&&te>A==k\\u003cA))return-1;if(ee\\u003cB!=me\\u003cB){if(k>=A)if(te>A)x=1-x;else{var Le=(k-A)*(me-B)-(te-A)*(ee-B);if(Le===0)return-1;Le>0==me>ee&&(x=1-x)}else if(te>A){var Le=(k-A)*(me-B)-(te-A)*(ee-B);if(Le===0)return-1;Le>0==me>ee&&(x=1-x)}}k=te,ee=me}while(_!==f);return x},r.Clipper.prototype.Poly2ContainsPoly1=function(p,f){var x=p;do{var _=this.PointInPolygon(x.Pt,f);if(_>=0)return _>0;x=x.Next}while(x!==p);return!0},r.Clipper.prototype.FixupFirstLefts1=function(p,f){for(var x,_,A=0,B=this.m_PolyOuts.length;A\\u003cB;A++)x=this.m_PolyOuts[A],_=r.Clipper.ParseFirstLeft(x.FirstLeft),x.Pts!==null&&_===p&&this.Poly2ContainsPoly1(x.Pts,f.Pts)&&(x.FirstLeft=f)},r.Clipper.prototype.FixupFirstLefts2=function(p,f){for(var x=f.FirstLeft,_,A,B=0,k=this.m_PolyOuts.length;B\\u003ck;B++)_=this.m_PolyOuts[B],!(_.Pts===null||_===f||_===p)&&(A=r.Clipper.ParseFirstLeft(_.FirstLeft),!(A!==x&&A!==p&&A!==f)&&(this.Poly2ContainsPoly1(_.Pts,p.Pts)?_.FirstLeft=p:this.Poly2ContainsPoly1(_.Pts,f.Pts)?_.FirstLeft=f:(_.FirstLeft===p||_.FirstLeft===f)&&(_.FirstLeft=x)))},r.Clipper.prototype.FixupFirstLefts3=function(p,f){for(var x,_,A=0,B=this.m_PolyOuts.length;A\\u003cB;A++)x=this.m_PolyOuts[A],_=r.Clipper.ParseFirstLeft(x.FirstLeft),x.Pts!==null&&_===p&&(x.FirstLeft=f)},r.Clipper.ParseFirstLeft=function(p){for(;p!==null&&p.Pts===null;)p=p.FirstLeft;return p},r.Clipper.prototype.JoinCommonEdges=function(){for(var p=0,f=this.m_Joins.length;p\\u003cf;p++){var x=this.m_Joins[p],_=this.GetOutRec(x.OutPt1.Idx),A=this.GetOutRec(x.OutPt2.Idx);if(!(_.Pts===null||A.Pts===null)&&!(_.IsOpen||A.IsOpen)){var B;_===A?B=_:this.OutRec1RightOfOutRec2(_,A)?B=A:this.OutRec1RightOfOutRec2(A,_)?B=_:B=this.GetLowermostRec(_,A),this.JoinPoints(x,_,A)&&(_===A?(_.Pts=x.OutPt1,_.BottomPt=null,A=this.CreateOutRec(),A.Pts=x.OutPt2,this.UpdateOutPtIdxs(A),this.Poly2ContainsPoly1(A.Pts,_.Pts)?(A.IsHole=!_.IsHole,A.FirstLeft=_,this.m_UsingPolyTree&&this.FixupFirstLefts2(A,_),(A.IsHole^this.ReverseSolution)==this.Area$1(A)>0&&this.ReversePolyPtLinks(A.Pts)):this.Poly2ContainsPoly1(_.Pts,A.Pts)?(A.IsHole=_.IsHole,_.IsHole=!A.IsHole,A.FirstLeft=_.FirstLeft,_.FirstLeft=A,this.m_UsingPolyTree&&this.FixupFirstLefts2(_,A),(_.IsHole^this.ReverseSolution)==this.Area$1(_)>0&&this.ReversePolyPtLinks(_.Pts)):(A.IsHole=_.IsHole,A.FirstLeft=_.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(_,A))):(A.Pts=null,A.BottomPt=null,A.Idx=_.Idx,_.IsHole=B.IsHole,B===A&&(_.FirstLeft=A.FirstLeft),A.FirstLeft=_,this.m_UsingPolyTree&&this.FixupFirstLefts3(A,_)))}}},r.Clipper.prototype.UpdateOutPtIdxs=function(p){var f=p.Pts;do f.Idx=p.Idx,f=f.Prev;while(f!==p.Pts)},r.Clipper.prototype.DoSimplePolygons=function(){for(var p=0;p\\u003cthis.m_PolyOuts.length;){var f=this.m_PolyOuts[p++],x=f.Pts;if(!(x===null||f.IsOpen))do{for(var _=x.Next;_!==f.Pts;){if(r.IntPoint.op_Equality(x.Pt,_.Pt)&&_.Next!==x&&_.Prev!==x){var A=x.Prev,B=_.Prev;x.Prev=B,B.Next=x,_.Prev=A,A.Next=_,f.Pts=x;var k=this.CreateOutRec();k.Pts=_,this.UpdateOutPtIdxs(k),this.Poly2ContainsPoly1(k.Pts,f.Pts)?(k.IsHole=!f.IsHole,k.FirstLeft=f,this.m_UsingPolyTree&&this.FixupFirstLefts2(k,f)):this.Poly2ContainsPoly1(f.Pts,k.Pts)?(k.IsHole=f.IsHole,f.IsHole=!k.IsHole,k.FirstLeft=f.FirstLeft,f.FirstLeft=k,this.m_UsingPolyTree&&this.FixupFirstLefts2(f,k)):(k.IsHole=f.IsHole,k.FirstLeft=f.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(f,k)),_=x}_=_.Next}x=x.Next}while(x!==f.Pts)}},r.Clipper.Area=function(p){if(!Array.isArray(p))return 0;var f=p.length;if(f\\u003c3)return 0;for(var x=0,_=0,A=f-1;_\\u003cf;++_)x+=(p[A].X+p[_].X)*(p[A].Y-p[_].Y),A=_;return-x*.5},r.Clipper.prototype.Area=function(p){var f=p;if(p===null)return 0;var x=0;do x=x+(p.Prev.Pt.X+p.Pt.X)*(p.Prev.Pt.Y-p.Pt.Y),p=p.Next;while(p!==f);return x*.5},r.Clipper.prototype.Area$1=function(p){return this.Area(p.Pts)},r.Clipper.SimplifyPolygon=function(p,f){var x=new Array,_=new r.Clipper(0);return _.StrictlySimple=!0,_.AddPath(p,r.PolyType.ptSubject,!0),_.Execute(r.ClipType.ctUnion,x,f,f),x},r.Clipper.SimplifyPolygons=function(p,f){typeof f>\\\"u\\\"&&(f=r.PolyFillType.pftEvenOdd);var x=new Array,_=new r.Clipper(0);return _.StrictlySimple=!0,_.AddPaths(p,r.PolyType.ptSubject,!0),_.Execute(r.ClipType.ctUnion,x,f,f),x},r.Clipper.DistanceSqrd=function(p,f){var x=p.X-f.X,_=p.Y-f.Y;return x*x+_*_},r.Clipper.DistanceFromLineSqrd=function(p,f,x){var _=f.Y-x.Y,A=x.X-f.X,B=_*f.X+A*f.Y;return B=_*p.X+A*p.Y-B,B*B/(_*_+A*A)},r.Clipper.SlopesNearCollinear=function(p,f,x,_){return Math.abs(p.X-f.X)>Math.abs(p.Y-f.Y)?p.X>f.X==p.X\\u003cx.X?r.Clipper.DistanceFromLineSqrd(p,f,x)\\u003c_:f.X>p.X==f.X\\u003cx.X?r.Clipper.DistanceFromLineSqrd(f,p,x)\\u003c_:r.Clipper.DistanceFromLineSqrd(x,p,f)\\u003c_:p.Y>f.Y==p.Y\\u003cx.Y?r.Clipper.DistanceFromLineSqrd(p,f,x)\\u003c_:f.Y>p.Y==f.Y\\u003cx.Y?r.Clipper.DistanceFromLineSqrd(f,p,x)\\u003c_:r.Clipper.DistanceFromLineSqrd(x,p,f)\\u003c_},r.Clipper.PointsAreClose=function(p,f,x){var _=p.X-f.X,A=p.Y-f.Y;return _*_+A*A\\u003c=x},r.Clipper.ExcludeOp=function(p){var f=p.Prev;return f.Next=p.Next,p.Next.Prev=f,f.Idx=0,f},r.Clipper.CleanPolygon=function(p,f){typeof f>\\\"u\\\"&&(f=1.415);var x=p.length;if(x===0)return new Array;for(var _=new Array(x),A=0;A\\u003cx;++A)_[A]=new r.OutPt;for(var A=0;A\\u003cx;++A)_[A].Pt=p[A],_[A].Next=_[(A+1)%x],_[A].Next.Prev=_[A],_[A].Idx=0;for(var B=f*f,k=_[0];k.Idx===0&&k.Next!==k.Prev;)r.Clipper.PointsAreClose(k.Pt,k.Prev.Pt,B)?(k=r.Clipper.ExcludeOp(k),x--):r.Clipper.PointsAreClose(k.Prev.Pt,k.Next.Pt,B)?(r.Clipper.ExcludeOp(k.Next),k=r.Clipper.ExcludeOp(k),x-=2):r.Clipper.SlopesNearCollinear(k.Prev.Pt,k.Pt,k.Next.Pt,B)?(k=r.Clipper.ExcludeOp(k),x--):(k.Idx=1,k=k.Next);x\\u003c3&&(x=0);for(var ee=new Array(x),A=0;A\\u003cx;++A)ee[A]=new r.IntPoint1(k.Pt),k=k.Next;return _=null,ee},r.Clipper.CleanPolygons=function(p,f){for(var x=new Array(p.length),_=0,A=p.length;_\\u003cA;_++)x[_]=r.Clipper.CleanPolygon(p[_],f);return x},r.Clipper.Minkowski=function(p,f,x,_){var A=_?1:0,B=p.length,k=f.length,ee=new Array;if(x)for(var te=0;te\\u003ck;te++){for(var me=new Array(B),Le=0,Me=p.length,Ge=p[Le];Le\\u003cMe;Le++,Ge=p[Le])me[Le]=new r.IntPoint2(f[te].X+Ge.X,f[te].Y+Ge.Y);ee.push(me)}else for(var te=0;te\\u003ck;te++){for(var me=new Array(B),Le=0,Me=p.length,Ge=p[Le];Le\\u003cMe;Le++,Ge=p[Le])me[Le]=new r.IntPoint2(f[te].X-Ge.X,f[te].Y-Ge.Y);ee.push(me)}for(var xt=new Array,te=0;te\\u003ck-1+A;te++)for(var Le=0;Le\\u003cB;Le++){var kt=new Array;kt.push(ee[te%k][Le%B]),kt.push(ee[(te+1)%k][Le%B]),kt.push(ee[(te+1)%k][(Le+1)%B]),kt.push(ee[te%k][(Le+1)%B]),r.Clipper.Orientation(kt)||kt.reverse(),xt.push(kt)}return xt},r.Clipper.MinkowskiSum=function(p,f,x){if(f[0]instanceof Array){for(var _=f,A=new r.Paths,B=new r.Clipper,k=0;k\\u003c_.length;++k){var ee=r.Clipper.Minkowski(p,_[k],!0,x);if(B.AddPaths(ee,r.PolyType.ptSubject,!0),x){var te=r.Clipper.TranslatePath(_[k],p[0]);B.AddPath(te,r.PolyType.ptClip,!0)}}return B.Execute(r.ClipType.ctUnion,A,r.PolyFillType.pftNonZero,r.PolyFillType.pftNonZero),A}else{var te=f,_=r.Clipper.Minkowski(p,te,!0,x),B=new r.Clipper;return B.AddPaths(_,r.PolyType.ptSubject,!0),B.Execute(r.ClipType.ctUnion,_,r.PolyFillType.pftNonZero,r.PolyFillType.pftNonZero),_}},r.Clipper.TranslatePath=function(p,f){for(var x=new r.Path,_=0;_\\u003cp.length;_++)x.push(new r.IntPoint2(p[_].X+f.X,p[_].Y+f.Y));return x},r.Clipper.MinkowskiDiff=function(p,f){var x=r.Clipper.Minkowski(p,f,!1,!0),_=new r.Clipper;return _.AddPaths(x,r.PolyType.ptSubject,!0),_.Execute(r.ClipType.ctUnion,x,r.PolyFillType.pftNonZero,r.PolyFillType.pftNonZero),x},r.Clipper.PolyTreeToPaths=function(p){var f=new Array;return r.Clipper.AddPolyNodeToPaths(p,r.Clipper.NodeType.ntAny,f),f},r.Clipper.AddPolyNodeToPaths=function(p,f,x){var _=!0;switch(f){case r.Clipper.NodeType.ntOpen:return;case r.Clipper.NodeType.ntClosed:_=!p.IsOpen;break;default:break}p.m_polygon.length>0&&_&&x.push(p.m_polygon);for(var A=0,B=p.Childs(),k=B.length,ee=B[A];A\\u003ck;A++,ee=B[A])r.Clipper.AddPolyNodeToPaths(ee,f,x)},r.Clipper.OpenPathsFromPolyTree=function(p){for(var f=new r.Paths,x=0,_=p.ChildCount();x\\u003c_;x++)p.Childs()[x].IsOpen&&f.push(p.Childs()[x].m_polygon);return f},r.Clipper.ClosedPathsFromPolyTree=function(p){var f=new r.Paths;return r.Clipper.AddPolyNodeToPaths(p,r.Clipper.NodeType.ntClosed,f),f},Lk(r.Clipper,r.ClipperBase),r.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2},r.ClipperOffset=function(p,f){typeof p>\\\"u\\\"&&(p=2),typeof f>\\\"u\\\"&&(f=r.ClipperOffset.def_arc_tolerance),this.m_destPolys=new r.Paths,this.m_srcPoly=new r.Path,this.m_destPoly=new r.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new r.IntPoint0,this.m_polyNodes=new r.PolyNode,this.MiterLimit=p,this.ArcTolerance=f,this.m_lowest.X=-1},r.ClipperOffset.two_pi=6.28318530717959,r.ClipperOffset.def_arc_tolerance=.25,r.ClipperOffset.prototype.Clear=function(){r.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1},r.ClipperOffset.Round=r.Clipper.Round,r.ClipperOffset.prototype.AddPath=function(p,f,x){var _=p.length-1;if(!(_\\u003c0)){var A=new r.PolyNode;if(A.m_jointype=f,A.m_endtype=x,x===r.EndType.etClosedLine||x===r.EndType.etClosedPolygon)for(;_>0&&r.IntPoint.op_Equality(p[0],p[_]);)_--;A.m_polygon.push(p[0]);for(var B=0,k=0,ee=1;ee\\u003c=_;ee++)r.IntPoint.op_Inequality(A.m_polygon[B],p[ee])&&(B++,A.m_polygon.push(p[ee]),(p[ee].Y>A.m_polygon[k].Y||p[ee].Y===A.m_polygon[k].Y&&p[ee].X\\u003cA.m_polygon[k].X)&&(k=B));if(!(x===r.EndType.etClosedPolygon&&B\\u003c2)&&(this.m_polyNodes.AddChild(A),x===r.EndType.etClosedPolygon))if(this.m_lowest.X\\u003c0)this.m_lowest=new r.IntPoint2(this.m_polyNodes.ChildCount()-1,k);else{var te=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(A.m_polygon[k].Y>te.Y||A.m_polygon[k].Y===te.Y&&A.m_polygon[k].X\\u003cte.X)&&(this.m_lowest=new r.IntPoint2(this.m_polyNodes.ChildCount()-1,k))}}},r.ClipperOffset.prototype.AddPaths=function(p,f,x){for(var _=0,A=p.length;_\\u003cA;_++)this.AddPath(p[_],f,x)},r.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!r.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var p=0;p\\u003cthis.m_polyNodes.ChildCount();p++){var f=this.m_polyNodes.Childs()[p];(f.m_endtype===r.EndType.etClosedPolygon||f.m_endtype===r.EndType.etClosedLine&&r.Clipper.Orientation(f.m_polygon))&&f.m_polygon.reverse()}else for(var p=0;p\\u003cthis.m_polyNodes.ChildCount();p++){var f=this.m_polyNodes.Childs()[p];f.m_endtype===r.EndType.etClosedLine&&!r.Clipper.Orientation(f.m_polygon)&&f.m_polygon.reverse()}},r.ClipperOffset.GetUnitNormal=function(p,f){var x=f.X-p.X,_=f.Y-p.Y;if(x===0&&_===0)return new r.DoublePoint2(0,0);var A=1/Math.sqrt(x*x+_*_);return x*=A,_*=A,new r.DoublePoint2(_,-x)},r.ClipperOffset.prototype.DoOffset=function(p){if(this.m_destPolys=new Array,this.m_delta=p,r.ClipperBase.near_zero(p)){for(var f=0;f\\u003cthis.m_polyNodes.ChildCount();f++){var x=this.m_polyNodes.Childs()[f];x.m_endtype===r.EndType.etClosedPolygon&&this.m_destPolys.push(x.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var _;this.ArcTolerance\\u003c=0?_=r.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(p)*r.ClipperOffset.def_arc_tolerance?_=Math.abs(p)*r.ClipperOffset.def_arc_tolerance:_=this.ArcTolerance;var A=3.14159265358979/Math.acos(1-_/Math.abs(p));this.m_sin=Math.sin(r.ClipperOffset.two_pi/A),this.m_cos=Math.cos(r.ClipperOffset.two_pi/A),this.m_StepsPerRad=A/r.ClipperOffset.two_pi,p\\u003c0&&(this.m_sin=-this.m_sin);for(var f=0;f\\u003cthis.m_polyNodes.ChildCount();f++){var x=this.m_polyNodes.Childs()[f];this.m_srcPoly=x.m_polygon;var B=this.m_srcPoly.length;if(!(B===0||p\\u003c=0&&(B\\u003c3||x.m_endtype!==r.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,B===1){if(x.m_jointype===r.JoinType.jtRound)for(var k=1,ee=0,te=1;te\\u003c=A;te++){this.m_destPoly.push(new r.IntPoint2(r.ClipperOffset.Round(this.m_srcPoly[0].X+k*p),r.ClipperOffset.Round(this.m_srcPoly[0].Y+ee*p)));var me=k;k=k*this.m_cos-this.m_sin*ee,ee=me*this.m_sin+ee*this.m_cos}else for(var k=-1,ee=-1,te=0;te\\u003c4;++te)this.m_destPoly.push(new r.IntPoint2(r.ClipperOffset.Round(this.m_srcPoly[0].X+k*p),r.ClipperOffset.Round(this.m_srcPoly[0].Y+ee*p))),k\\u003c0?k=1:ee\\u003c0?ee=1:k=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var te=0;te\\u003cB-1;te++)this.m_normals.push(r.ClipperOffset.GetUnitNormal(this.m_srcPoly[te],this.m_srcPoly[te+1]));if(x.m_endtype===r.EndType.etClosedLine||x.m_endtype===r.EndType.etClosedPolygon?this.m_normals.push(r.ClipperOffset.GetUnitNormal(this.m_srcPoly[B-1],this.m_srcPoly[0])):this.m_normals.push(new r.DoublePoint1(this.m_normals[B-2])),x.m_endtype===r.EndType.etClosedPolygon){for(var Le=B-1,te=0;te\\u003cB;te++)Le=this.OffsetPoint(te,Le,x.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(x.m_endtype===r.EndType.etClosedLine){for(var Le=B-1,te=0;te\\u003cB;te++)Le=this.OffsetPoint(te,Le,x.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var Me=this.m_normals[B-1],te=B-1;te>0;te--)this.m_normals[te]=new r.DoublePoint2(-this.m_normals[te-1].X,-this.m_normals[te-1].Y);this.m_normals[0]=new r.DoublePoint2(-Me.X,-Me.Y),Le=0;for(var te=B-1;te>=0;te--)Le=this.OffsetPoint(te,Le,x.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var Le=0,te=1;te\\u003cB-1;++te)Le=this.OffsetPoint(te,Le,x.m_jointype);var Ge;if(x.m_endtype===r.EndType.etOpenButt){var te=B-1;Ge=new r.IntPoint2(r.ClipperOffset.Round(this.m_srcPoly[te].X+this.m_normals[te].X*p),r.ClipperOffset.Round(this.m_srcPoly[te].Y+this.m_normals[te].Y*p)),this.m_destPoly.push(Ge),Ge=new r.IntPoint2(r.ClipperOffset.Round(this.m_srcPoly[te].X-this.m_normals[te].X*p),r.ClipperOffset.Round(this.m_srcPoly[te].Y-this.m_normals[te].Y*p)),this.m_destPoly.push(Ge)}else{var te=B-1;Le=B-2,this.m_sinA=0,this.m_normals[te]=new r.DoublePoint2(-this.m_normals[te].X,-this.m_normals[te].Y),x.m_endtype===r.EndType.etOpenSquare?this.DoSquare(te,Le):this.DoRound(te,Le)}for(var te=B-1;te>0;te--)this.m_normals[te]=new r.DoublePoint2(-this.m_normals[te-1].X,-this.m_normals[te-1].Y);this.m_normals[0]=new r.DoublePoint2(-this.m_normals[1].X,-this.m_normals[1].Y),Le=B-1;for(var te=Le-1;te>0;--te)Le=this.OffsetPoint(te,Le,x.m_jointype);x.m_endtype===r.EndType.etOpenButt?(Ge=new r.IntPoint2(r.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*p),r.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*p)),this.m_destPoly.push(Ge),Ge=new r.IntPoint2(r.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*p),r.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*p)),this.m_destPoly.push(Ge)):(Le=1,this.m_sinA=0,x.m_endtype===r.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}},r.ClipperOffset.prototype.Execute=function(){var p=arguments,f=p[0]instanceof r.PolyTree;if(f){var x=p[0],_=p[1];x.Clear(),this.FixOrientations(),this.DoOffset(_);var A=new r.Clipper(0);if(A.AddPaths(this.m_destPolys,r.PolyType.ptSubject,!0),_>0)A.Execute(r.ClipType.ctUnion,x,r.PolyFillType.pftPositive,r.PolyFillType.pftPositive);else{var B=r.Clipper.GetBounds(this.m_destPolys),k=new r.Path;if(k.push(new r.IntPoint2(B.left-10,B.bottom+10)),k.push(new r.IntPoint2(B.right+10,B.bottom+10)),k.push(new r.IntPoint2(B.right+10,B.top-10)),k.push(new r.IntPoint2(B.left-10,B.top-10)),A.AddPath(k,r.PolyType.ptSubject,!0),A.ReverseSolution=!0,A.Execute(r.ClipType.ctUnion,x,r.PolyFillType.pftNegative,r.PolyFillType.pftNegative),x.ChildCount()===1&&x.Childs()[0].ChildCount()>0){var ee=x.Childs()[0];x.Childs()[0]=ee.Childs()[0],x.Childs()[0].m_Parent=x;for(var te=1;te\\u003cee.ChildCount();te++)x.AddChild(ee.Childs()[te])}else x.Clear()}}else{var x=p[0],_=p[1];r.Clear(x),this.FixOrientations(),this.DoOffset(_);var A=new r.Clipper(0);if(A.AddPaths(this.m_destPolys,r.PolyType.ptSubject,!0),_>0)A.Execute(r.ClipType.ctUnion,x,r.PolyFillType.pftPositive,r.PolyFillType.pftPositive);else{var B=r.Clipper.GetBounds(this.m_destPolys),k=new r.Path;k.push(new r.IntPoint2(B.left-10,B.bottom+10)),k.push(new r.IntPoint2(B.right+10,B.bottom+10)),k.push(new r.IntPoint2(B.right+10,B.top-10)),k.push(new r.IntPoint2(B.left-10,B.top-10)),A.AddPath(k,r.PolyType.ptSubject,!0),A.ReverseSolution=!0,A.Execute(r.ClipType.ctUnion,x,r.PolyFillType.pftNegative,r.PolyFillType.pftNegative),x.length>0&&x.splice(0,1)}}},r.ClipperOffset.prototype.OffsetPoint=function(p,f,x){if(this.m_sinA=this.m_normals[f].X*this.m_normals[p].Y-this.m_normals[p].X*this.m_normals[f].Y,Math.abs(this.m_sinA*this.m_delta)\\u003c1){var _=this.m_normals[f].X*this.m_normals[p].X+this.m_normals[p].Y*this.m_normals[f].Y;if(_>0)return this.m_destPoly.push(new r.IntPoint2(r.ClipperOffset.Round(this.m_srcPoly[p].X+this.m_normals[f].X*this.m_delta),r.ClipperOffset.Round(this.m_srcPoly[p].Y+this.m_normals[f].Y*this.m_delta))),f}else this.m_sinA>1?this.m_sinA=1:this.m_sinA\\u003c-1&&(this.m_sinA=-1);if(this.m_sinA*this.m_delta\\u003c0)this.m_destPoly.push(new r.IntPoint2(r.ClipperOffset.Round(this.m_srcPoly[p].X+this.m_normals[f].X*this.m_delta),r.ClipperOffset.Round(this.m_srcPoly[p].Y+this.m_normals[f].Y*this.m_delta))),this.m_destPoly.push(new r.IntPoint1(this.m_srcPoly[p])),this.m_destPoly.push(new r.IntPoint2(r.ClipperOffset.Round(this.m_srcPoly[p].X+this.m_normals[p].X*this.m_delta),r.ClipperOffset.Round(this.m_srcPoly[p].Y+this.m_normals[p].Y*this.m_delta)));else switch(x){case r.JoinType.jtMiter:{var A=1+(this.m_normals[p].X*this.m_normals[f].X+this.m_normals[p].Y*this.m_normals[f].Y);A>=this.m_miterLim?this.DoMiter(p,f,A):this.DoSquare(p,f);break}case r.JoinType.jtSquare:this.DoSquare(p,f);break;case r.JoinType.jtRound:this.DoRound(p,f);break}return f=p,f},r.ClipperOffset.prototype.DoSquare=function(p,f){var x=Math.tan(Math.atan2(this.m_sinA,this.m_normals[f].X*this.m_normals[p].X+this.m_normals[f].Y*this.m_normals[p].Y)/4);this.m_destPoly.push(new r.IntPoint2(r.ClipperOffset.Round(this.m_srcPoly[p].X+this.m_delta*(this.m_normals[f].X-this.m_normals[f].Y*x)),r.ClipperOffset.Round(this.m_srcPoly[p].Y+this.m_delta*(this.m_normals[f].Y+this.m_normals[f].X*x)))),this.m_destPoly.push(new r.IntPoint2(r.ClipperOffset.Round(this.m_srcPoly[p].X+this.m_delta*(this.m_normals[p].X+this.m_normals[p].Y*x)),r.ClipperOffset.Round(this.m_srcPoly[p].Y+this.m_delta*(this.m_normals[p].Y-this.m_normals[p].X*x))))},r.ClipperOffset.prototype.DoMiter=function(p,f,x){var _=this.m_delta/x;this.m_destPoly.push(new r.IntPoint2(r.ClipperOffset.Round(this.m_srcPoly[p].X+(this.m_normals[f].X+this.m_normals[p].X)*_),r.ClipperOffset.Round(this.m_srcPoly[p].Y+(this.m_normals[f].Y+this.m_normals[p].Y)*_)))},r.ClipperOffset.prototype.DoRound=function(p,f){for(var x=Math.atan2(this.m_sinA,this.m_normals[f].X*this.m_normals[p].X+this.m_normals[f].Y*this.m_normals[p].Y),_=Math.max(r.Cast_Int32(r.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(x))),1),A=this.m_normals[f].X,B=this.m_normals[f].Y,k,ee=0;ee\\u003c_;++ee)this.m_destPoly.push(new r.IntPoint2(r.ClipperOffset.Round(this.m_srcPoly[p].X+A*this.m_delta),r.ClipperOffset.Round(this.m_srcPoly[p].Y+B*this.m_delta))),k=A,A=A*this.m_cos-this.m_sin*B,B=k*this.m_sin+B*this.m_cos;this.m_destPoly.push(new r.IntPoint2(r.ClipperOffset.Round(this.m_srcPoly[p].X+this.m_normals[p].X*this.m_delta),r.ClipperOffset.Round(this.m_srcPoly[p].Y+this.m_normals[p].Y*this.m_delta)))},r.Error=function(p){try{throw new Error(p)}catch(f){alert(f.message)}},r.JS={},r.JS.AreaOfPolygon=function(p,f){return f||(f=1),r.Clipper.Area(p)/(f*f)},r.JS.AreaOfPolygons=function(p,f){f||(f=1);for(var x=0,_=0;_\\u003cp.length;_++)x+=r.Clipper.Area(p[_]);return x/(f*f)},r.JS.BoundsOfPath=function(p,f){return r.JS.BoundsOfPaths([p],f)},r.JS.BoundsOfPaths=function(p,f){f||(f=1);var x=r.Clipper.GetBounds(p);return x.left/=f,x.bottom/=f,x.right/=f,x.top/=f,x},r.JS.Clean=function(_,f){if(!(_ instanceof Array))return[];var x=_[0]instanceof Array,_=r.JS.Clone(_);if(typeof f!=\\\"number\\\"||f===null)return r.Error(\\\"Delta is not a number in Clean().\\\"),_;if(_.length===0||_.length===1&&_[0].length===0||f\\u003c0)return _;x||(_=[_]);for(var A=_.length,B,k,ee,te,me,Le,Me,Ge=[],xt=0;xt\\u003cA;xt++)if(k=_[xt],B=k.length,B!==0){if(B\\u003c3){ee=k,Ge.push(ee);continue}for(ee=k,te=f*f,me=k[0],Le=1,Me=1;Me\\u003cB;Me++)(k[Me].X-me.X)*(k[Me].X-me.X)+(k[Me].Y-me.Y)*(k[Me].Y-me.Y)\\u003c=te||(ee[Le]=k[Me],me=k[Me],Le++);me=k[Le-1],(k[0].X-me.X)*(k[0].X-me.X)+(k[0].Y-me.Y)*(k[0].Y-me.Y)\\u003c=te&&Le--,Le\\u003cB&&ee.splice(Le,B-Le),ee.length&&Ge.push(ee)}return!x&&Ge.length?Ge=Ge[0]:!x&&Ge.length===0?Ge=[]:x&&Ge.length===0&&(Ge=[[]]),Ge},r.JS.Clone=function(p){if(!(p instanceof Array))return[];if(p.length===0)return[];if(p.length===1&&p[0].length===0)return[[]];var f=p[0]instanceof Array;f||(p=[p]);var x=p.length,_,A,B,k,ee=new Array(x);for(A=0;A\\u003cx;A++){for(_=p[A].length,k=new Array(_),B=0;B\\u003c_;B++)k[B]={X:p[A][B].X,Y:p[A][B].Y};ee[A]=k}return f||(ee=ee[0]),ee},r.JS.Lighten=function(p,f){if(!(p instanceof Array))return[];if(typeof f!=\\\"number\\\"||f===null)return r.Error(\\\"Tolerance is not a number in Lighten().\\\"),r.JS.Clone(p);if(p.length===0||p.length===1&&p[0].length===0||f\\u003c0)return r.JS.Clone(p);var x=p[0]instanceof Array;x||(p=[p]);var _,A,B,k,ee,te,me,Le,Me,Ge,xt,kt,Vt,fr,ks,Qn,Wc,T0e=p.length,S0e=f*f,jc=[];for(_=0;_\\u003cT0e;_++)if(B=p[_],te=B.length,te!==0){for(k=0;k\\u003c1e6;k++){for(ee=[],te=B.length,B[te-1].X!==B[0].X||B[te-1].Y!==B[0].Y?(kt=1,B.push({X:B[0].X,Y:B[0].Y}),te=B.length):kt=0,xt=[],A=0;A\\u003cte-2;A++)me=B[A],Me=B[A+1],Le=B[A+2],Qn=me.X,Wc=me.Y,Vt=Le.X-Qn,fr=Le.Y-Wc,(Vt!==0||fr!==0)&&(ks=((Me.X-Qn)*Vt+(Me.Y-Wc)*fr)/(Vt*Vt+fr*fr),ks>1?(Qn=Le.X,Wc=Le.Y):ks>0&&(Qn+=Vt*ks,Wc+=fr*ks)),Vt=Me.X-Qn,fr=Me.Y-Wc,Ge=Vt*Vt+fr*fr,Ge\\u003c=S0e&&(xt[A+1]=1,A++);for(ee.push({X:B[0].X,Y:B[0].Y}),A=1;A\\u003cte-1;A++)xt[A]||ee.push({X:B[A].X,Y:B[A].Y});if(ee.push({X:B[te-1].X,Y:B[te-1].Y}),kt&&B.pop(),xt.length)B=ee;else break}te=ee.length,ee[te-1].X===ee[0].X&&ee[te-1].Y===ee[0].Y&&ee.pop(),ee.length>2&&jc.push(ee)}return x||(jc=jc[0]),typeof jc>\\\"u\\\"&&(jc=[]),jc},r.JS.PerimeterOfPath=function(p,f,x){if(typeof p>\\\"u\\\")return 0;var _=Math.sqrt,A=0,B,k,ee=0,te=0,me=0,Le=0,Me=p.length;if(Me\\u003c2)return 0;for(f&&(p[Me]=p[0],Me++);--Me;)B=p[Me],ee=B.X,te=B.Y,k=p[Me-1],me=k.X,Le=k.Y,A+=_((ee-me)*(ee-me)+(te-Le)*(te-Le));return f&&p.pop(),A/x},r.JS.PerimeterOfPaths=function(p,f,x){x||(x=1);for(var _=0,A=0;A\\u003cp.length;A++)_+=r.JS.PerimeterOfPath(p[A],f,x);return _},r.JS.ScaleDownPath=function(p,f){var x,_;for(f||(f=1),x=p.length;x--;)_=p[x],_.X=_.X/f,_.Y=_.Y/f},r.JS.ScaleDownPaths=function(p,f){var x,_,A;for(f||(f=1),x=p.length;x--;)for(_=p[x].length;_--;)A=p[x][_],A.X=A.X/f,A.Y=A.Y/f},r.JS.ScaleUpPath=function(p,f){var x,_,A=Math.round;for(f||(f=1),x=p.length;x--;)_=p[x],_.X=A(_.X*f),_.Y=A(_.Y*f)},r.JS.ScaleUpPaths=function(p,f){var x,_,A,B=Math.round;for(f||(f=1),x=p.length;x--;)for(_=p[x].length;_--;)A=p[x][_],A.X=B(A.X*f),A.Y=B(A.Y*f)},r.ExPolygons=function(){return[]},r.ExPolygon=function(){this.outer=null,this.holes=null},r.JS.AddOuterPolyNodeToExPolygons=function(p,f){var x=new r.ExPolygon;x.outer=p.Contour();var _=p.Childs(),A=_.length;x.holes=new Array(A);var B,k,ee,te,me,Le;for(ee=0;ee\\u003cA;ee++)for(B=_[ee],x.holes[ee]=B.Contour(),te=0,me=B.Childs(),Le=me.length;te\\u003cLe;te++)k=me[te],r.JS.AddOuterPolyNodeToExPolygons(k,f);f.push(x)},r.JS.ExPolygonsToPaths=function(p){var f,x,_,A,B=new r.Paths;for(f=0,_=p.length;f\\u003c_;f++)for(B.push(p[f].outer),x=0,A=p[f].holes.length;x\\u003cA;x++)B.push(p[f].holes[x]);return B},r.JS.PolyTreeToExPolygons=function(p){var f=new r.ExPolygons,x,_,A,B;for(_=0,A=p.Childs(),B=A.length;_\\u003cB;_++)x=A[_],r.JS.AddOuterPolyNodeToExPolygons(x,f);return f}})()}),ev=pM(()=>{}),gM={};mM(gM,{APPEARANCE_DEFAULTS:()=>q2,DURATION:()=>c0e,REVIEW_BUILD:()=>p0e,SIM_STEP:()=>Ah,TUNABLES:()=>Gx,cameraAt:()=>YF,create:()=>m0e,durationOf:()=>y2,parseTrack:()=>c2,resolveSchedule:()=>Fce,setRendererProfile:()=>Sse,structuralKeyOf:()=>Fk,validateDeformationScale:()=>JF});var yM={};mM(yM,{BRDF_GGX:()=>ZX,BRDF_Lambert:()=>JX,BasicPointShadowFilter:()=>QX,BasicShadowFilter:()=>KX,Break:()=>e$,Const:()=>t$,Continue:()=>r$,DFGLUT:()=>i$,D_GGX:()=>s$,Discard:()=>a$,EPSILON:()=>n$,F_Schlick:()=>o$,Fn:()=>Ir,HALF_PI:()=>x$,INFINITY:()=>l$,If:()=>pm,Loop:()=>Gy,NodeAccess:()=>u$,NodeShaderStage:()=>h$,NodeType:()=>d$,NodeUpdateType:()=>c$,OnBeforeMaterialUpdate:()=>iee,OnBeforeObjectUpdate:()=>ree,OnMaterialUpdate:()=>aee,OnObjectUpdate:()=>see,PCFShadowFilter:()=>p$,PCFSoftShadowFilter:()=>m$,PI:()=>f$,PI2:()=>g$,PointShadowFilter:()=>v$,Return:()=>b$,Schlick_to_F0:()=>T$,ShaderNode:()=>S$,Stack:()=>_$,Switch:()=>w$,TBNViewMatrix:()=>M$,TWO_PI:()=>y$,VSMShadowFilter:()=>N$,V_GGX_SmithCorrelated:()=>A$,Var:()=>C$,VarIntent:()=>R$,abs:()=>$a,acesFilmicToneMapping:()=>E$,acos:()=>P$,acosh:()=>B$,add:()=>Wy,addMethodChaining:()=>I$,addNodeElement:()=>F$,agxToneMapping:()=>L$,all:()=>k$,alphaT:()=>D$,ambientOcclusion:()=>O$,and:()=>U$,anisotropy:()=>z$,anisotropyB:()=>V$,anisotropyT:()=>G$,any:()=>W$,append:()=>j$,array:()=>H$,asin:()=>X$,asinh:()=>$$,assign:()=>q$,atan:()=>Y$,atanh:()=>Z$,atomicAdd:()=>J$,atomicAnd:()=>Q$,atomicFunc:()=>K$,atomicLoad:()=>eq,atomicMax:()=>tq,atomicMin:()=>rq,atomicOr:()=>iq,atomicStore:()=>sq,atomicSub:()=>aq,atomicXor:()=>nq,attenuationColor:()=>oq,attenuationDistance:()=>lq,attribute:()=>uq,attributeArray:()=>hq,backgroundBlurriness:()=>dq,backgroundIntensity:()=>cq,backgroundRotation:()=>pq,batch:()=>mq,bentNormalView:()=>fq,billboarding:()=>gq,bitAnd:()=>yq,bitNot:()=>xq,bitOr:()=>vq,bitXor:()=>bq,bitangentGeometry:()=>Tq,bitangentLocal:()=>Sq,bitangentView:()=>_q,bitangentWorld:()=>wq,bitcast:()=>Mq,blendBurn:()=>Nq,blendColor:()=>Aq,blendDodge:()=>Cq,blendOverlay:()=>Rq,blendScreen:()=>Eq,blur:()=>Pq,bool:()=>Bq,buffer:()=>Iq,bufferAttribute:()=>Fq,builtin:()=>kq,builtinAOContext:()=>Dq,builtinShadowContext:()=>Oq,bumpMap:()=>Lq,bvec2:()=>Uq,bvec3:()=>zq,bvec4:()=>Vq,bypass:()=>Gq,cache:()=>Wq,call:()=>jq,cameraFar:()=>Hq,cameraIndex:()=>Xq,cameraNear:()=>$q,cameraNormalMatrix:()=>qq,cameraPosition:()=>Yq,cameraProjectionMatrix:()=>Zq,cameraProjectionMatrixInverse:()=>Jq,cameraViewMatrix:()=>Qq,cameraViewport:()=>Kq,cameraWorldMatrix:()=>eY,cbrt:()=>tY,cdl:()=>rY,ceil:()=>iY,checker:()=>sY,cineonToneMapping:()=>aY,clamp:()=>SB,clearcoat:()=>nY,clearcoatNormalView:()=>oY,clearcoatRoughness:()=>lY,clipSpace:()=>uY,code:()=>hY,color:()=>dY,colorSpaceToWorking:()=>cY,colorToDirection:()=>pY,compute:()=>mY,computeKernel:()=>fY,computeSkinning:()=>gY,context:()=>yY,convert:()=>xY,convertColorSpace:()=>vY,convertToTexture:()=>Ju,cos:()=>_Y,cosh:()=>wY,countLeadingZeros:()=>bY,countOneBits:()=>TY,countTrailingZeros:()=>SY,cross:()=>MY,cubeTexture:()=>NY,cubeTextureBase:()=>AY,dFdx:()=>CY,dFdy:()=>RY,dashSize:()=>EY,debug:()=>PY,decrement:()=>BY,decrementBefore:()=>IY,defaultBuildStages:()=>FY,defaultShaderStages:()=>LY,defined:()=>kY,degrees:()=>DY,deltaTime:()=>OY,densityFog:()=>UY,densityFogFactor:()=>zY,depth:()=>VY,depthPass:()=>GY,determinant:()=>WY,difference:()=>jY,diffuseColor:()=>HY,directPointLight:()=>XY,directionToColor:()=>$Y,directionToFaceDirection:()=>qY,dispersion:()=>YY,distance:()=>ZY,div:()=>JY,dot:()=>QY,drawIndex:()=>KY,dynamicBufferAttribute:()=>eZ,element:()=>tZ,emissive:()=>rZ,equal:()=>iZ,equirectDirection:()=>sZ,equirectUV:()=>aZ,exp:()=>_B,exp2:()=>c_,exponentialHeightFogFactor:()=>nZ,expression:()=>oZ,faceDirection:()=>lZ,faceForward:()=>uZ,faceforward:()=>hZ,float:()=>yt,floatBitsToInt:()=>dZ,floatBitsToUint:()=>cZ,floor:()=>Zd,fog:()=>pZ,fract:()=>wB,frameGroup:()=>mZ,frameId:()=>fZ,frontFacing:()=>gZ,fwidth:()=>yZ,gain:()=>xZ,gapSize:()=>vZ,getConstNodeType:()=>bZ,getCurrentStack:()=>TZ,getDirection:()=>SZ,getDistanceAttenuation:()=>_Z,getGeometryRoughness:()=>wZ,getNormalFromDepth:()=>MZ,getParallaxCorrectNormal:()=>CZ,getRoughness:()=>RZ,getScreenPosition:()=>EZ,getShIrradianceAt:()=>PZ,getShadowMaterial:()=>BZ,getShadowRenderObjectFunction:()=>IZ,getTextureIndex:()=>FZ,getViewPosition:()=>p_,globalId:()=>LZ,glsl:()=>kZ,glslFn:()=>DZ,grayscale:()=>OZ,greaterThan:()=>UZ,greaterThanEqual:()=>zZ,hash:()=>VZ,highpModelNormalViewMatrix:()=>GZ,highpModelViewMatrix:()=>WZ,hue:()=>jZ,increment:()=>HZ,incrementBefore:()=>XZ,instance:()=>$Z,instanceIndex:()=>qZ,instancedArray:()=>YZ,instancedBufferAttribute:()=>ZZ,instancedDynamicBufferAttribute:()=>JZ,instancedMesh:()=>QZ,int:()=>Eo,intBitsToFloat:()=>KZ,interleavedGradientNoise:()=>NZ,inverse:()=>eJ,inverseSqrt:()=>tJ,inversesqrt:()=>rJ,invocationLocalIndex:()=>iJ,invocationSubgroupIndex:()=>sJ,ior:()=>aJ,iridescence:()=>nJ,iridescenceIOR:()=>oJ,iridescenceThickness:()=>lJ,ivec2:()=>ss,ivec3:()=>uJ,ivec4:()=>hJ,js:()=>dJ,label:()=>cJ,length:()=>pJ,lengthSq:()=>mJ,lessThan:()=>fJ,lessThanEqual:()=>gJ,lightPosition:()=>yJ,lightProjectionUV:()=>xJ,lightShadowMatrix:()=>vJ,lightTargetDirection:()=>bJ,lightTargetPosition:()=>TJ,lightViewPosition:()=>SJ,lightingContext:()=>_J,lights:()=>wJ,linearDepth:()=>MJ,linearToneMapping:()=>NJ,localId:()=>AJ,log:()=>CJ,log2:()=>RJ,logarithmicDepthToViewZ:()=>MB,luminance:()=>kl,mat2:()=>EJ,mat3:()=>PJ,mat4:()=>NB,matcapUV:()=>BJ,materialAO:()=>IJ,materialAlphaTest:()=>FJ,materialAnisotropy:()=>LJ,materialAnisotropyVector:()=>kJ,materialAttenuationColor:()=>DJ,materialAttenuationDistance:()=>OJ,materialClearcoat:()=>UJ,materialClearcoatNormal:()=>zJ,materialClearcoatRoughness:()=>VJ,materialColor:()=>GJ,materialDispersion:()=>WJ,materialEmissive:()=>jJ,materialEnvIntensity:()=>HJ,materialEnvRotation:()=>XJ,materialIOR:()=>$J,materialIridescence:()=>qJ,materialIridescenceIOR:()=>YJ,materialIridescenceThickness:()=>ZJ,materialLightMap:()=>JJ,materialLineDashOffset:()=>QJ,materialLineDashSize:()=>KJ,materialLineGapSize:()=>eQ,materialLineScale:()=>tQ,materialLineWidth:()=>rQ,materialMetalness:()=>iQ,materialNormal:()=>sQ,materialOpacity:()=>aQ,materialPointSize:()=>nQ,materialReference:()=>oQ,materialReflectivity:()=>lQ,materialRefractionRatio:()=>uQ,materialRotation:()=>hQ,materialRoughness:()=>dQ,materialSheen:()=>cQ,materialSheenRoughness:()=>pQ,materialShininess:()=>mQ,materialSpecular:()=>fQ,materialSpecularColor:()=>gQ,materialSpecularIntensity:()=>yQ,materialSpecularStrength:()=>xQ,materialThickness:()=>vQ,materialTransmission:()=>bQ,max:()=>_t,maxMipLevel:()=>TQ,mediumpModelViewMatrix:()=>SQ,metalness:()=>_Q,min:()=>Ar,mix:()=>Dl,mixElement:()=>wQ,mod:()=>MQ,modelDirection:()=>NQ,modelNormalMatrix:()=>AQ,modelPosition:()=>CQ,modelRadius:()=>RQ,modelScale:()=>EQ,modelViewMatrix:()=>PQ,modelViewPosition:()=>BQ,modelViewProjection:()=>IQ,modelWorldMatrix:()=>FQ,modelWorldMatrixInverse:()=>LQ,morphReference:()=>kQ,mrt:()=>DQ,mul:()=>OQ,mx_aastep:()=>UQ,mx_add:()=>zQ,mx_atan2:()=>VQ,mx_cell_noise_float:()=>GQ,mx_contrast:()=>WQ,mx_divide:()=>jQ,mx_fractal_noise_float:()=>HQ,mx_fractal_noise_vec2:()=>XQ,mx_fractal_noise_vec3:()=>$Q,mx_fractal_noise_vec4:()=>qQ,mx_frame:()=>YQ,mx_heighttonormal:()=>ZQ,mx_hsvtorgb:()=>JQ,mx_ifequal:()=>QQ,mx_ifgreater:()=>KQ,mx_ifgreatereq:()=>eK,mx_invert:()=>tK,mx_modulo:()=>rK,mx_multiply:()=>iK,mx_noise_float:()=>sK,mx_noise_vec3:()=>aK,mx_noise_vec4:()=>nK,mx_place2d:()=>oK,mx_power:()=>lK,mx_ramp4:()=>uK,mx_ramplr:()=>hK,mx_ramptb:()=>dK,mx_rgbtohsv:()=>cK,mx_rotate2d:()=>pK,mx_rotate3d:()=>mK,mx_safepower:()=>fK,mx_separate:()=>gK,mx_splitlr:()=>yK,mx_splittb:()=>xK,mx_srgb_texture_to_lin_rec709:()=>vK,mx_subtract:()=>bK,mx_timer:()=>TK,mx_transform_uv:()=>SK,mx_unifiednoise2d:()=>_K,mx_unifiednoise3d:()=>wK,mx_worley_noise_float:()=>MK,mx_worley_noise_vec2:()=>NK,mx_worley_noise_vec3:()=>AK,negate:()=>CK,negateOnBackSide:()=>RK,neutralToneMapping:()=>EK,nodeArray:()=>PK,nodeImmutable:()=>BK,nodeObject:()=>Un,nodeObjectIntent:()=>IK,nodeObjects:()=>FK,nodeProxy:()=>LK,nodeProxyIntent:()=>kK,normalFlat:()=>DK,normalGeometry:()=>OK,normalLocal:()=>UK,normalMap:()=>zK,normalView:()=>VK,normalViewGeometry:()=>GK,normalWorld:()=>WK,normalWorldGeometry:()=>jK,normalize:()=>HK,not:()=>XK,notEqual:()=>$K,numWorkgroups:()=>qK,objectDirection:()=>YK,objectGroup:()=>ZK,objectPosition:()=>JK,objectRadius:()=>QK,objectScale:()=>KK,objectViewPosition:()=>eee,objectWorldMatrix:()=>tee,oneMinus:()=>nee,or:()=>oee,orthographicDepthToViewZ:()=>lee,oscSawtooth:()=>uee,oscSine:()=>hee,oscSquare:()=>dee,oscTriangle:()=>cee,output:()=>pee,outputStruct:()=>m_,overloadingFn:()=>mee,overrideNode:()=>fee,overrideNodes:()=>gee,packHalf2x16:()=>yee,packNormalToRGB:()=>bee,packSnorm2x16:()=>xee,packUnorm2x16:()=>vee,parabola:()=>Tee,parallaxDirection:()=>See,parallaxUV:()=>_ee,parameter:()=>wee,pass:()=>Mee,passTexture:()=>Qu,pcurve:()=>Nee,perspectiveDepthToViewZ:()=>Aee,pmremTexture:()=>Cee,pointShadow:()=>Ree,pointUV:()=>Eee,pointWidth:()=>Pee,positionGeometry:()=>Bee,positionLocal:()=>Iee,positionPrevious:()=>Fee,positionView:()=>Lee,positionViewDirection:()=>kee,positionWorld:()=>Dee,positionWorldDirection:()=>Oee,posterize:()=>Uee,pow:()=>zee,pow2:()=>Vee,pow3:()=>Gee,pow4:()=>Wee,premultiplyAlpha:()=>AB,property:()=>mm,radians:()=>jee,rand:()=>Hee,range:()=>Xee,rangeFog:()=>$ee,rangeFogFactor:()=>qee,reciprocal:()=>Yee,reference:()=>Zee,referenceBuffer:()=>Jee,reflect:()=>Qee,reflectVector:()=>Kee,reflectView:()=>ete,reflector:()=>tte,refract:()=>rte,refractVector:()=>ite,refractView:()=>ste,reinhardToneMapping:()=>ate,remap:()=>nte,remapClamp:()=>ote,renderGroup:()=>lte,renderOutput:()=>ute,rendererReference:()=>hte,replaceDefaultUV:()=>dte,rotate:()=>cte,rotateUV:()=>pte,roughness:()=>mte,round:()=>fte,rtt:()=>gte,sRGBTransferEOTF:()=>yte,sRGBTransferOETF:()=>xte,sample:()=>vte,sampler:()=>bte,samplerComparison:()=>Tte,saturate:()=>f_,saturation:()=>Ste,screen:()=>_te,screenCoordinate:()=>wte,screenDPR:()=>Mte,screenSize:()=>Nte,screenUV:()=>Ate,select:()=>g_,setCurrentStack:()=>Cte,setName:()=>Rte,shaderStages:()=>Ete,shadow:()=>Pte,shadowPositionWorld:()=>Bte,shapeCircle:()=>Ite,sharedUniformGroup:()=>Fte,sheen:()=>Lte,sheenRoughness:()=>kte,shiftLeft:()=>Dte,shiftRight:()=>Ote,shininess:()=>Ute,sign:()=>zte,sin:()=>Vte,sinc:()=>Wte,sinh:()=>Gte,skinning:()=>jte,smoothstep:()=>y_,smoothstepElement:()=>Hte,specularColor:()=>Xte,specularF90:()=>$te,spherizeUV:()=>qte,split:()=>Yte,spritesheetUV:()=>Zte,sqrt:()=>CB,stack:()=>Jte,step:()=>x_,stepElement:()=>Qte,storage:()=>fm,storageBarrier:()=>Kte,storageTexture:()=>ere,storageTexture3D:()=>tre,struct:()=>v_,sub:()=>rre,subBuild:()=>hre,subgroupAdd:()=>ire,subgroupAll:()=>sre,subgroupAnd:()=>are,subgroupAny:()=>nre,subgroupBallot:()=>ore,subgroupBroadcast:()=>lre,subgroupBroadcastFirst:()=>ure,subgroupElect:()=>dre,subgroupExclusiveAdd:()=>cre,subgroupExclusiveMul:()=>pre,subgroupInclusiveAdd:()=>mre,subgroupInclusiveMul:()=>fre,subgroupIndex:()=>gre,subgroupMax:()=>yre,subgroupMin:()=>xre,subgroupMul:()=>vre,subgroupOr:()=>bre,subgroupShuffle:()=>Tre,subgroupShuffleDown:()=>Sre,subgroupShuffleUp:()=>_re,subgroupShuffleXor:()=>wre,subgroupSize:()=>Mre,subgroupXor:()=>Nre,tan:()=>Are,tangentGeometry:()=>Rre,tangentLocal:()=>Ere,tangentView:()=>Pre,tangentWorld:()=>Bre,tanh:()=>Cre,texture:()=>Ri,texture3D:()=>Ire,textureBarrier:()=>Fre,textureBicubic:()=>Lre,textureBicubicLevel:()=>kre,textureCubeUV:()=>Dre,textureLevel:()=>Ore,textureLoad:()=>Ps,textureSize:()=>jy,textureStore:()=>Ure,thickness:()=>zre,time:()=>Vre,toneMapping:()=>Gre,toneMappingExposure:()=>Wre,toonOutlinePass:()=>jre,transformDirection:()=>Hre,transformNormal:()=>Xre,transformNormalByInverseViewMatrix:()=>$re,transformNormalByViewMatrix:()=>qre,transformNormalToView:()=>Yre,transformedClearcoatNormalView:()=>Zre,transformedNormalView:()=>Jre,transformedNormalWorld:()=>Qre,transmission:()=>Kre,transpose:()=>eie,triNoise3D:()=>tie,triplanarTexture:()=>rie,triplanarTextures:()=>iie,trunc:()=>sie,uint:()=>RB,uintBitsToFloat:()=>aie,uniform:()=>Fr,uniformArray:()=>Jd,uniformCubeTexture:()=>nie,uniformFlow:()=>lie,uniformGroup:()=>oie,uniformTexture:()=>uie,unpackHalf2x16:()=>hie,unpackRGBToNormal:()=>pie,unpackSnorm2x16:()=>die,unpackUnorm2x16:()=>cie,unpremultiplyAlpha:()=>EB,userData:()=>mie,uv:()=>_a,uvec2:()=>fie,uvec3:()=>gie,uvec4:()=>yie,varying:()=>xie,varyingProperty:()=>vie,vec2:()=>nr,vec3:()=>Hy,vec4:()=>hr,vectorComponents:()=>bie,velocity:()=>Xy,vertexColor:()=>Tie,vertexIndex:()=>Sie,vertexStage:()=>_ie,vibrance:()=>wie,viewZToLogarithmicDepth:()=>Mie,viewZToOrthographicDepth:()=>PB,viewZToPerspectiveDepth:()=>$y,viewZToReversedOrthographicDepth:()=>Nie,viewZToReversedPerspectiveDepth:()=>Aie,viewport:()=>Cie,viewportCoordinate:()=>Rie,viewportDepthTexture:()=>Eie,viewportLinearDepth:()=>Pie,viewportMipTexture:()=>Bie,viewportOpaqueMipTexture:()=>Iie,viewportResolution:()=>Fie,viewportSafeUV:()=>Lie,viewportSharedTexture:()=>kie,viewportSize:()=>Die,viewportTexture:()=>Oie,viewportUV:()=>Uie,vogelDiskSample:()=>AZ,wgsl:()=>zie,wgslFn:()=>Vie,workgroupArray:()=>Gie,workgroupBarrier:()=>Wie,workgroupId:()=>jie,workingToColorSpace:()=>Hie,xor:()=>Xie});var bD=0,TD=1,SD=2,_D=0,xM=1,wD=2,Lh=3,Cs=0,ii=1,hs=2,Kn=0,oa=1,kh=2,Dh=3,Oh=4,Uh=5,tv=6,la=100,vM=101,bM=102,MD=103,ND=104,Jo=200,TM=201,SM=202,_M=203,$c=204,qc=205,wM=206,MM=207,NM=208,AM=209,CM=210,Af=0,Cf=1,Rf=2,zh=3,Ef=4,Pf=5,Bf=6,If=7,Ff=0,AD=1,CD=2,eo=0,RD=1,ED=2,PD=3,BD=4,ID=6,FD=7,rv=300,Vh=301,Lf=302,kf=303,iv=304,Df=306,to=1e3,Ti=1001,Qo=1002,or=1003,RM=1004,Gh=1005,lr=1006,sv=1007,Ia=1008,LD=1008,Si=1009,cu=1010,pu=1011,Ko=1012,ci=1013,gr=1014,Er=1015,Dt=1016,av=1017,nv=1018,ro=1020,Of=35902,Uf=35899,ov=1021,Wh=1022,pi=1023,ua=1026,ln=1027,io=1028,jh=1029,ha=1030,Hh=1031,lv=1032,zf=1033,Yc=33776,Zc=33777,Jc=33778,Qc=33779,uv=35840,hv=35841,dv=35842,cv=35843,Vf=36196,Gf=37492,Wf=37496,jf=37488,Hf=37489,Kc=37490,Xf=37491,$f=37808,qf=37809,Yf=37810,Zf=37811,Jf=37812,Qf=37813,Kf=37814,eg=37815,tg=37816,rg=37817,ig=37818,sg=37819,ag=37820,ng=37821,og=36492,lg=36494,ug=36495,hg=36283,dg=36284,ep=36285,cg=36286,pg=2300,pv=2301,mv=2302,EM=2303,PM=2400,BM=2401,IM=2402,so=0,kD=1,Fa=\\\"\\\",ds=\\\"srgb\\\",Xh=\\\"srgb-linear\\\",mg=\\\"linear\\\",Tt=\\\"srgb\\\",fv=\\\"\\\",FM=\\\"rg\\\",DD=\\\"ga\\\",OD=0,mu=7680,UD=7681,zD=7682,VD=7683,GD=34055,WD=34056,jD=5386,HD=512,XD=513,$D=514,qD=515,YD=516,ZD=517,JD=518,gv=519,LM=512,yv=513,kM=514,tp=515,fg=516,DM=517,$h=518,OM=519,qh=35044,rp=35048,Ds=2e3,da=2001,un={COMPUTE:\\\"compute\\\",RENDER:\\\"render\\\"},fu={TEXTURE_COMPARE:\\\"depthTextureCompare\\\"};function QD(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function ip(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function gg(e){return document.createElementNS(\\\"http://www.w3.org/1999/xhtml\\\",e)}function KD(){let e=gg(\\\"canvas\\\");return e.style.display=\\\"block\\\",e}var UM={},Yh=null;function xv(...e){let t=\\\"THREE.\\\"+e.shift();Yh?Yh(\\\"log\\\",t,...e):console.log(t,...e)}function zM(e){let t=e[0];if(typeof t==\\\"string\\\"&&t.startsWith(\\\"TSL:\\\")){let r=e[1];r&&r.isStackTrace?e[0]+=\\\" \\\"+r.getLocation():e[1]='Stack trace not available. Enable \\\"THREE.Node.captureStackTrace\\\" to capture stack traces.'}return e}function Ue(...e){e=zM(e);let t=\\\"THREE.\\\"+e.shift();if(Yh)Yh(\\\"warn\\\",t,...e);else{let r=e[0];r&&r.isStackTrace?console.warn(r.getError(t)):console.warn(t,...e)}}function Ce(...e){e=zM(e);let t=\\\"THREE.\\\"+e.shift();if(Yh)Yh(\\\"error\\\",t,...e);else{let r=e[0];r&&r.isStackTrace?console.error(r.getError(t)):console.error(t,...e)}}function Et(...e){let t=e.join(\\\" \\\");t in UM||(UM[t]=!0,Ue(...e))}function VM(){return typeof self\\u003c\\\"u\\\"&&typeof self.scheduler\\u003c\\\"u\\\"&&typeof self.scheduler.yield\\u003c\\\"u\\\"?self.scheduler.yield():new Promise(e=>{requestAnimationFrame(e)})}var GM={[Af]:Cf,[Rf]:Bf,[Ef]:If,[zh]:Pf,[Cf]:Af,[Bf]:Rf,[If]:Ef,[Pf]:zh},hn=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){let r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){let r=this._listeners;if(r===void 0)return;let i=r[e];if(i!==void 0){let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let r=t[e.type];if(r!==void 0){e.target=this;let i=r.slice(0);for(let s=0,a=i.length;s\\u003ca;s++)i[s].call(this,e);e.target=null}}},Wi=[\\\"00\\\",\\\"01\\\",\\\"02\\\",\\\"03\\\",\\\"04\\\",\\\"05\\\",\\\"06\\\",\\\"07\\\",\\\"08\\\",\\\"09\\\",\\\"0a\\\",\\\"0b\\\",\\\"0c\\\",\\\"0d\\\",\\\"0e\\\",\\\"0f\\\",\\\"10\\\",\\\"11\\\",\\\"12\\\",\\\"13\\\",\\\"14\\\",\\\"15\\\",\\\"16\\\",\\\"17\\\",\\\"18\\\",\\\"19\\\",\\\"1a\\\",\\\"1b\\\",\\\"1c\\\",\\\"1d\\\",\\\"1e\\\",\\\"1f\\\",\\\"20\\\",\\\"21\\\",\\\"22\\\",\\\"23\\\",\\\"24\\\",\\\"25\\\",\\\"26\\\",\\\"27\\\",\\\"28\\\",\\\"29\\\",\\\"2a\\\",\\\"2b\\\",\\\"2c\\\",\\\"2d\\\",\\\"2e\\\",\\\"2f\\\",\\\"30\\\",\\\"31\\\",\\\"32\\\",\\\"33\\\",\\\"34\\\",\\\"35\\\",\\\"36\\\",\\\"37\\\",\\\"38\\\",\\\"39\\\",\\\"3a\\\",\\\"3b\\\",\\\"3c\\\",\\\"3d\\\",\\\"3e\\\",\\\"3f\\\",\\\"40\\\",\\\"41\\\",\\\"42\\\",\\\"43\\\",\\\"44\\\",\\\"45\\\",\\\"46\\\",\\\"47\\\",\\\"48\\\",\\\"49\\\",\\\"4a\\\",\\\"4b\\\",\\\"4c\\\",\\\"4d\\\",\\\"4e\\\",\\\"4f\\\",\\\"50\\\",\\\"51\\\",\\\"52\\\",\\\"53\\\",\\\"54\\\",\\\"55\\\",\\\"56\\\",\\\"57\\\",\\\"58\\\",\\\"59\\\",\\\"5a\\\",\\\"5b\\\",\\\"5c\\\",\\\"5d\\\",\\\"5e\\\",\\\"5f\\\",\\\"60\\\",\\\"61\\\",\\\"62\\\",\\\"63\\\",\\\"64\\\",\\\"65\\\",\\\"66\\\",\\\"67\\\",\\\"68\\\",\\\"69\\\",\\\"6a\\\",\\\"6b\\\",\\\"6c\\\",\\\"6d\\\",\\\"6e\\\",\\\"6f\\\",\\\"70\\\",\\\"71\\\",\\\"72\\\",\\\"73\\\",\\\"74\\\",\\\"75\\\",\\\"76\\\",\\\"77\\\",\\\"78\\\",\\\"79\\\",\\\"7a\\\",\\\"7b\\\",\\\"7c\\\",\\\"7d\\\",\\\"7e\\\",\\\"7f\\\",\\\"80\\\",\\\"81\\\",\\\"82\\\",\\\"83\\\",\\\"84\\\",\\\"85\\\",\\\"86\\\",\\\"87\\\",\\\"88\\\",\\\"89\\\",\\\"8a\\\",\\\"8b\\\",\\\"8c\\\",\\\"8d\\\",\\\"8e\\\",\\\"8f\\\",\\\"90\\\",\\\"91\\\",\\\"92\\\",\\\"93\\\",\\\"94\\\",\\\"95\\\",\\\"96\\\",\\\"97\\\",\\\"98\\\",\\\"99\\\",\\\"9a\\\",\\\"9b\\\",\\\"9c\\\",\\\"9d\\\",\\\"9e\\\",\\\"9f\\\",\\\"a0\\\",\\\"a1\\\",\\\"a2\\\",\\\"a3\\\",\\\"a4\\\",\\\"a5\\\",\\\"a6\\\",\\\"a7\\\",\\\"a8\\\",\\\"a9\\\",\\\"aa\\\",\\\"ab\\\",\\\"ac\\\",\\\"ad\\\",\\\"ae\\\",\\\"af\\\",\\\"b0\\\",\\\"b1\\\",\\\"b2\\\",\\\"b3\\\",\\\"b4\\\",\\\"b5\\\",\\\"b6\\\",\\\"b7\\\",\\\"b8\\\",\\\"b9\\\",\\\"ba\\\",\\\"bb\\\",\\\"bc\\\",\\\"bd\\\",\\\"be\\\",\\\"bf\\\",\\\"c0\\\",\\\"c1\\\",\\\"c2\\\",\\\"c3\\\",\\\"c4\\\",\\\"c5\\\",\\\"c6\\\",\\\"c7\\\",\\\"c8\\\",\\\"c9\\\",\\\"ca\\\",\\\"cb\\\",\\\"cc\\\",\\\"cd\\\",\\\"ce\\\",\\\"cf\\\",\\\"d0\\\",\\\"d1\\\",\\\"d2\\\",\\\"d3\\\",\\\"d4\\\",\\\"d5\\\",\\\"d6\\\",\\\"d7\\\",\\\"d8\\\",\\\"d9\\\",\\\"da\\\",\\\"db\\\",\\\"dc\\\",\\\"dd\\\",\\\"de\\\",\\\"df\\\",\\\"e0\\\",\\\"e1\\\",\\\"e2\\\",\\\"e3\\\",\\\"e4\\\",\\\"e5\\\",\\\"e6\\\",\\\"e7\\\",\\\"e8\\\",\\\"e9\\\",\\\"ea\\\",\\\"eb\\\",\\\"ec\\\",\\\"ed\\\",\\\"ee\\\",\\\"ef\\\",\\\"f0\\\",\\\"f1\\\",\\\"f2\\\",\\\"f3\\\",\\\"f4\\\",\\\"f5\\\",\\\"f6\\\",\\\"f7\\\",\\\"f8\\\",\\\"f9\\\",\\\"fa\\\",\\\"fb\\\",\\\"fc\\\",\\\"fd\\\",\\\"fe\\\",\\\"ff\\\"],WM=1234567,sp=Math.PI/180,Zh=180/Math.PI;function dn(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Wi[e&255]+Wi[e>>8&255]+Wi[e>>16&255]+Wi[e>>24&255]+\\\"-\\\"+Wi[t&255]+Wi[t>>8&255]+\\\"-\\\"+Wi[t>>16&15|64]+Wi[t>>24&255]+\\\"-\\\"+Wi[r&63|128]+Wi[r>>8&255]+\\\"-\\\"+Wi[r>>16&255]+Wi[r>>24&255]+Wi[i&255]+Wi[i>>8&255]+Wi[i>>16&255]+Wi[i>>24&255]).toLowerCase()}function St(e,t,r){return Math.max(t,Math.min(r,e))}function vv(e,t){return(e%t+t)%t}function e4(e,t,r,i,s){return i+(e-t)*(s-i)/(r-t)}function t4(e,t,r){return e!==t?(r-e)/(t-e):0}function ap(e,t,r){return(1-r)*e+r*t}function r4(e,t,r,i){return ap(e,t,1-Math.exp(-r*i))}function i4(e,t=1){return t-Math.abs(vv(e,t*2)-t)}function s4(e,t,r){return e\\u003c=t?0:e>=r?1:(e=(e-t)/(r-t),e*e*(3-2*e))}function a4(e,t,r){return e\\u003c=t?0:e>=r?1:(e=(e-t)/(r-t),e*e*e*(e*(e*6-15)+10))}function n4(e,t){return e+Math.floor(Math.random()*(t-e+1))}function o4(e,t){return e+Math.random()*(t-e)}function l4(e){return e*(.5-Math.random())}function u4(e){e!==void 0&&(WM=e);let t=WM+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function h4(e){return e*sp}function d4(e){return e*Zh}function c4(e){return(e&e-1)===0&&e!==0}function p4(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function m4(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function f4(e,t,r,i,s){let a=Math.cos,n=Math.sin,o=a(r/2),l=n(r/2),u=a((t+i)/2),h=n((t+i)/2),d=a((t-i)/2),c=n((t-i)/2),m=a((i-t)/2),g=n((i-t)/2);switch(s){case\\\"XYX\\\":e.set(o*h,l*d,l*c,o*u);break;case\\\"YZY\\\":e.set(l*c,o*h,l*d,o*u);break;case\\\"ZXZ\\\":e.set(l*d,l*c,o*h,o*u);break;case\\\"XZX\\\":e.set(o*h,l*g,l*m,o*u);break;case\\\"YXY\\\":e.set(l*m,o*h,l*g,o*u);break;case\\\"ZYZ\\\":e.set(l*g,l*m,o*h,o*u);break;default:Ue(\\\"MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: \\\"+s)}}function cs(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error(\\\"THREE.MathUtils: Invalid component type.\\\")}}function At(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw new Error(\\\"THREE.MathUtils: Invalid component type.\\\")}}var Bt={DEG2RAD:sp,RAD2DEG:Zh,generateUUID:dn,clamp:St,euclideanModulo:vv,mapLinear:e4,inverseLerp:t4,lerp:ap,damp:r4,pingpong:i4,smoothstep:s4,smootherstep:a4,randInt:n4,randFloat:o4,randFloatSpread:l4,seededRandom:u4,degToRad:h4,radToDeg:d4,isPowerOfTwo:c4,ceilPowerOfTwo:p4,floorPowerOfTwo:m4,setQuaternionFromProperEuler:f4,normalize:At,denormalize:cs},fe=class kk{static{kk.prototype.isVector2=!0}constructor(t=0,r=0){this.x=t,this.y=r}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,r){return this.x=t,this.y=r,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;default:throw new Error(\\\"THREE.Vector2: index is out of range: \\\"+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error(\\\"THREE.Vector2: index is out of range: \\\"+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let r=this.x,i=this.y,s=t.elements;return this.x=s[0]*r+s[3]*i+s[6],this.y=s[1]*r+s[4]*i+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,r){return this.x=St(this.x,t.x,r.x),this.y=St(this.y,t.y,r.y),this}clampScalar(t,r){return this.x=St(this.x,t,r),this.y=St(this.y,t,r),this}clampLength(t,r){let i=this.length();return this.divideScalar(i||1).multiplyScalar(St(i,t,r))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let r=Math.sqrt(this.lengthSq()*t.lengthSq());if(r===0)return Math.PI/2;let i=this.dot(t)/r;return Math.acos(St(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let r=this.x-t.x,i=this.y-t.y;return r*r+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this}lerpVectors(t,r,i){return this.x=t.x+(r.x-t.x)*i,this.y=t.y+(r.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this}rotateAround(t,r){let i=Math.cos(r),s=Math.sin(r),a=this.x-t.x,n=this.y-t.y;return this.x=a*i-n*s+t.x,this.y=a*s+n*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},si=class{constructor(e=0,t=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=i}static slerpFlat(e,t,r,i,s,a,n){let o=r[i+0],l=r[i+1],u=r[i+2],h=r[i+3],d=s[a+0],c=s[a+1],m=s[a+2],g=s[a+3];if(h!==g||o!==d||l!==c||u!==m){let y=o*d+l*c+u*m+h*g;y\\u003c0&&(d=-d,c=-c,m=-m,g=-g,y=-y);let b=1-n;if(y\\u003c.9995){let v=Math.acos(y),S=Math.sin(v);b=Math.sin(b*v)/S,n=Math.sin(n*v)/S,o=o*b+d*n,l=l*b+c*n,u=u*b+m*n,h=h*b+g*n}else{o=o*b+d*n,l=l*b+c*n,u=u*b+m*n,h=h*b+g*n;let v=1/Math.sqrt(o*o+l*l+u*u+h*h);o*=v,l*=v,u*=v,h*=v}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,r,i,s,a){let n=r[i],o=r[i+1],l=r[i+2],u=r[i+3],h=s[a],d=s[a+1],c=s[a+2],m=s[a+3];return e[t]=n*m+u*h+o*c-l*d,e[t+1]=o*m+u*d+l*h-n*c,e[t+2]=l*m+u*c+n*d-o*h,e[t+3]=u*m-n*h-o*d-l*c,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let r=e._x,i=e._y,s=e._z,a=e._order,n=Math.cos,o=Math.sin,l=n(r/2),u=n(i/2),h=n(s/2),d=o(r/2),c=o(i/2),m=o(s/2);switch(a){case\\\"XYZ\\\":this._x=d*u*h+l*c*m,this._y=l*c*h-d*u*m,this._z=l*u*m+d*c*h,this._w=l*u*h-d*c*m;break;case\\\"YXZ\\\":this._x=d*u*h+l*c*m,this._y=l*c*h-d*u*m,this._z=l*u*m-d*c*h,this._w=l*u*h+d*c*m;break;case\\\"ZXY\\\":this._x=d*u*h-l*c*m,this._y=l*c*h+d*u*m,this._z=l*u*m+d*c*h,this._w=l*u*h-d*c*m;break;case\\\"ZYX\\\":this._x=d*u*h-l*c*m,this._y=l*c*h+d*u*m,this._z=l*u*m-d*c*h,this._w=l*u*h+d*c*m;break;case\\\"YZX\\\":this._x=d*u*h+l*c*m,this._y=l*c*h+d*u*m,this._z=l*u*m-d*c*h,this._w=l*u*h-d*c*m;break;case\\\"XZY\\\":this._x=d*u*h-l*c*m,this._y=l*c*h-d*u*m,this._z=l*u*m+d*c*h,this._w=l*u*h+d*c*m;break;default:Ue(\\\"Quaternion: .setFromEuler() encountered an unknown order: \\\"+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,r=t[0],i=t[4],s=t[8],a=t[1],n=t[5],o=t[9],l=t[2],u=t[6],h=t[10],d=r+n+h;if(d>0){let c=.5/Math.sqrt(d+1);this._w=.25/c,this._x=(u-o)*c,this._y=(s-l)*c,this._z=(a-i)*c}else if(r>n&&r>h){let c=2*Math.sqrt(1+r-n-h);this._w=(u-o)/c,this._x=.25*c,this._y=(i+a)/c,this._z=(s+l)/c}else if(n>h){let c=2*Math.sqrt(1+n-r-h);this._w=(s-l)/c,this._x=(i+a)/c,this._y=.25*c,this._z=(o+u)/c}else{let c=2*Math.sqrt(1+h-r-n);this._w=(a-i)/c,this._x=(s+l)/c,this._y=(o+u)/c,this._z=.25*c}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r\\u003c1e-8?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(St(this.dot(e),-1,1)))}rotateTowards(e,t){let r=this.angleTo(e);if(r===0)return this;let i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let r=e._x,i=e._y,s=e._z,a=e._w,n=t._x,o=t._y,l=t._z,u=t._w;return this._x=r*u+a*n+i*l-s*o,this._y=i*u+a*o+s*n-r*l,this._z=s*u+a*l+r*o-i*n,this._w=a*u-r*n-i*o-s*l,this._onChangeCallback(),this}slerp(e,t){let r=e._x,i=e._y,s=e._z,a=e._w,n=this.dot(e);n\\u003c0&&(r=-r,i=-i,s=-s,a=-a,n=-n);let o=1-t;if(n\\u003c.9995){let l=Math.acos(n),u=Math.sin(l);o=Math.sin(o*l)/u,t=Math.sin(t*l)/u,this._x=this._x*o+r*t,this._y=this._y*o+i*t,this._z=this._z*o+s*t,this._w=this._w*o+a*t,this._onChangeCallback()}else this._x=this._x*o+r*t,this._y=this._y*o+i*t,this._z=this._z*o+s*t,this._w=this._w*o+a*t,this.normalize();return this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},F=class Dk{static{Dk.prototype.isVector3=!0}constructor(t=0,r=0,i=0){this.x=t,this.y=r,this.z=i}set(t,r,i){return i===void 0&&(i=this.z),this.x=t,this.y=r,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;break;default:throw new Error(\\\"THREE.Vector3: index is out of range: \\\"+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error(\\\"THREE.Vector3: index is out of range: \\\"+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this.z=t.z+r.z,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this.z+=t.z*r,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this.z=t.z-r.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,r){return this.x=t.x*r.x,this.y=t.y*r.y,this.z=t.z*r.z,this}applyEuler(t){return this.applyQuaternion(jM.setFromEuler(t))}applyAxisAngle(t,r){return this.applyQuaternion(jM.setFromAxisAngle(t,r))}applyMatrix3(t){let r=this.x,i=this.y,s=this.z,a=t.elements;return this.x=a[0]*r+a[3]*i+a[6]*s,this.y=a[1]*r+a[4]*i+a[7]*s,this.z=a[2]*r+a[5]*i+a[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let r=this.x,i=this.y,s=this.z,a=t.elements,n=1/(a[3]*r+a[7]*i+a[11]*s+a[15]);return this.x=(a[0]*r+a[4]*i+a[8]*s+a[12])*n,this.y=(a[1]*r+a[5]*i+a[9]*s+a[13])*n,this.z=(a[2]*r+a[6]*i+a[10]*s+a[14])*n,this}applyQuaternion(t){let r=this.x,i=this.y,s=this.z,a=t.x,n=t.y,o=t.z,l=t.w,u=2*(n*s-o*i),h=2*(o*r-a*s),d=2*(a*i-n*r);return this.x=r+l*u+n*d-o*h,this.y=i+l*h+o*u-a*d,this.z=s+l*d+a*h-n*u,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let r=this.x,i=this.y,s=this.z,a=t.elements;return this.x=a[0]*r+a[4]*i+a[8]*s,this.y=a[1]*r+a[5]*i+a[9]*s,this.z=a[2]*r+a[6]*i+a[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,r){return this.x=St(this.x,t.x,r.x),this.y=St(this.y,t.y,r.y),this.z=St(this.z,t.z,r.z),this}clampScalar(t,r){return this.x=St(this.x,t,r),this.y=St(this.y,t,r),this.z=St(this.z,t,r),this}clampLength(t,r){let i=this.length();return this.divideScalar(i||1).multiplyScalar(St(i,t,r))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this.z+=(t.z-this.z)*r,this}lerpVectors(t,r,i){return this.x=t.x+(r.x-t.x)*i,this.y=t.y+(r.y-t.y)*i,this.z=t.z+(r.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,r){let i=t.x,s=t.y,a=t.z,n=r.x,o=r.y,l=r.z;return this.x=s*l-a*o,this.y=a*n-i*l,this.z=i*o-s*n,this}projectOnVector(t){let r=t.lengthSq();if(r===0)return this.set(0,0,0);let i=t.dot(this)/r;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return bv.copy(this).projectOnVector(t),this.sub(bv)}reflect(t){return this.sub(bv.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let r=Math.sqrt(this.lengthSq()*t.lengthSq());if(r===0)return Math.PI/2;let i=this.dot(t)/r;return Math.acos(St(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let r=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return r*r+i*i+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,r,i){let s=Math.sin(r)*t;return this.x=s*Math.sin(i),this.y=Math.cos(r)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,r,i){return this.x=t*Math.sin(r),this.y=i,this.z=t*Math.cos(r),this}setFromMatrixPosition(t){let r=t.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this}setFromMatrixScale(t){let r=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=r,this.y=i,this.z=s,this}setFromMatrixColumn(t,r){return this.fromArray(t.elements,r*4)}setFromMatrix3Column(t,r){return this.fromArray(t.elements,r*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this.z=t[r+2],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t[r+2]=this.z,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this.z=t.getZ(r),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,r=Math.random()*2-1,i=Math.sqrt(1-r*r);return this.x=i*Math.cos(t),this.y=r,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},bv=new F,jM=new si,Dr=class Ok{static{Ok.prototype.isMatrix3=!0}constructor(t,r,i,s,a,n,o,l,u){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,r,i,s,a,n,o,l,u)}set(t,r,i,s,a,n,o,l,u){let h=this.elements;return h[0]=t,h[1]=s,h[2]=o,h[3]=r,h[4]=a,h[5]=l,h[6]=i,h[7]=n,h[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let r=this.elements,i=t.elements;return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],this}extractBasis(t,r,i){return t.setFromMatrix3Column(this,0),r.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let r=t.elements;return this.set(r[0],r[4],r[8],r[1],r[5],r[9],r[2],r[6],r[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,r){let i=t.elements,s=r.elements,a=this.elements,n=i[0],o=i[3],l=i[6],u=i[1],h=i[4],d=i[7],c=i[2],m=i[5],g=i[8],y=s[0],b=s[3],v=s[6],S=s[1],T=s[4],w=s[7],N=s[2],C=s[5],R=s[8];return a[0]=n*y+o*S+l*N,a[3]=n*b+o*T+l*C,a[6]=n*v+o*w+l*R,a[1]=u*y+h*S+d*N,a[4]=u*b+h*T+d*C,a[7]=u*v+h*w+d*R,a[2]=c*y+m*S+g*N,a[5]=c*b+m*T+g*C,a[8]=c*v+m*w+g*R,this}multiplyScalar(t){let r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=t,r[4]*=t,r[7]*=t,r[2]*=t,r[5]*=t,r[8]*=t,this}determinant(){let t=this.elements,r=t[0],i=t[1],s=t[2],a=t[3],n=t[4],o=t[5],l=t[6],u=t[7],h=t[8];return r*n*h-r*o*u-i*a*h+i*o*l+s*a*u-s*n*l}invert(){let t=this.elements,r=t[0],i=t[1],s=t[2],a=t[3],n=t[4],o=t[5],l=t[6],u=t[7],h=t[8],d=h*n-o*u,c=o*l-h*a,m=u*a-n*l,g=r*d+i*c+s*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);let y=1/g;return t[0]=d*y,t[1]=(s*u-h*i)*y,t[2]=(o*i-s*n)*y,t[3]=c*y,t[4]=(h*r-s*l)*y,t[5]=(s*a-o*r)*y,t[6]=m*y,t[7]=(i*l-u*r)*y,t[8]=(n*r-i*a)*y,this}transpose(){let t,r=this.elements;return t=r[1],r[1]=r[3],r[3]=t,t=r[2],r[2]=r[6],r[6]=t,t=r[5],r[5]=r[7],r[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let r=this.elements;return t[0]=r[0],t[1]=r[3],t[2]=r[6],t[3]=r[1],t[4]=r[4],t[5]=r[7],t[6]=r[2],t[7]=r[5],t[8]=r[8],this}setUvTransform(t,r,i,s,a,n,o){let l=Math.cos(a),u=Math.sin(a);return this.set(i*l,i*u,-i*(l*n+u*o)+n+t,-s*u,s*l,-s*(-u*n+l*o)+o+r,0,0,1),this}scale(t,r){return Et(\\\"Matrix3: .scale() is deprecated. Use .makeScale() instead.\\\"),this.premultiply(Tv.makeScale(t,r)),this}rotate(t){return Et(\\\"Matrix3: .rotate() is deprecated. Use .makeRotation() instead.\\\"),this.premultiply(Tv.makeRotation(-t)),this}translate(t,r){return Et(\\\"Matrix3: .translate() is deprecated. Use .makeTranslation() instead.\\\"),this.premultiply(Tv.makeTranslation(t,r)),this}makeTranslation(t,r){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,r,0,0,1),this}makeRotation(t){let r=Math.cos(t),i=Math.sin(t);return this.set(r,-i,0,i,r,0,0,0,1),this}makeScale(t,r){return this.set(t,0,0,0,r,0,0,0,1),this}equals(t){let r=this.elements,i=t.elements;for(let s=0;s\\u003c9;s++)if(r[s]!==i[s])return!1;return!0}fromArray(t,r=0){for(let i=0;i\\u003c9;i++)this.elements[i]=t[i+r];return this}toArray(t=[],r=0){let i=this.elements;return t[r]=i[0],t[r+1]=i[1],t[r+2]=i[2],t[r+3]=i[3],t[r+4]=i[4],t[r+5]=i[5],t[r+6]=i[6],t[r+7]=i[7],t[r+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}},Tv=new Dr,HM=new Dr().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),XM=new Dr().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function g4(){let e={enabled:!0,workingColorSpace:Xh,spaces:{},convert:function(s,a,n){return this.enabled===!1||a===n||!a||!n||(this.spaces[a].transfer===Tt&&(s.r=ao(s.r),s.g=ao(s.g),s.b=ao(s.b)),this.spaces[a].primaries!==this.spaces[n].primaries&&(s.applyMatrix3(this.spaces[a].toXYZ),s.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===Tt&&(s.r=Jh(s.r),s.g=Jh(s.g),s.b=Jh(s.b))),s},workingToColorSpace:function(s,a){return this.convert(s,this.workingColorSpace,a)},colorSpaceToWorking:function(s,a){return this.convert(s,a,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===Fa?mg:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||\\\"standard\\\"},getLuminanceCoefficients:function(s,a=this.workingColorSpace){return s.fromArray(this.spaces[a].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,a,n){return s.copy(this.spaces[a].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,a){return Et(\\\"ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().\\\"),e.workingToColorSpace(s,a)},toWorkingColorSpace:function(s,a){return Et(\\\"ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().\\\"),e.colorSpaceToWorking(s,a)}},t=[.64,.33,.3,.6,.15,.06],r=[.2126,.7152,.0722],i=[.3127,.329];return e.define({[Xh]:{primaries:t,whitePoint:i,transfer:mg,toXYZ:HM,fromXYZ:XM,luminanceCoefficients:r,workingColorSpaceConfig:{unpackColorSpace:ds},outputColorSpaceConfig:{drawingBufferColorSpace:ds}},[ds]:{primaries:t,whitePoint:i,transfer:Tt,toXYZ:HM,fromXYZ:XM,luminanceCoefficients:r,outputColorSpaceConfig:{drawingBufferColorSpace:ds}}}),e}var Gt=g4();function ao(e){return e\\u003c.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}function Jh(e){return e\\u003c.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}var Qh,y4=class{static getDataURL(e,t=\\\"image/png\\\"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>\\\"u\\\")return e.src;let r;if(e instanceof HTMLCanvasElement)r=e;else{Qh===void 0&&(Qh=gg(\\\"canvas\\\")),Qh.width=e.width,Qh.height=e.height;let i=Qh.getContext(\\\"2d\\\");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),r=Qh}return r.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement\\u003c\\\"u\\\"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement\\u003c\\\"u\\\"&&e instanceof HTMLCanvasElement||typeof ImageBitmap\\u003c\\\"u\\\"&&e instanceof ImageBitmap){let t=gg(\\\"canvas\\\");t.width=e.width,t.height=e.height;let r=t.getContext(\\\"2d\\\");r.drawImage(e,0,0,e.width,e.height);let i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a\\u003cs.length;a++)s[a]=ao(s[a]/255)*255;return r.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let r=0;r\\u003ct.length;r++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[r]=Math.floor(ao(t[r]/255)*255):t[r]=ao(t[r]);return{data:t,width:e.width,height:e.height}}else return Ue(\\\"ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied.\\\"),e}},x4=0,Sv=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,\\\"id\\\",{value:x4++}),this.uuid=dn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement\\u003c\\\"u\\\"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame\\u003c\\\"u\\\"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e==\\\"string\\\";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let r={uuid:this.uuid,url:\\\"\\\"},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,n=i.length;a\\u003cn;a++)i[a].isDataTexture?s.push(_v(i[a].image)):s.push(_v(i[a]))}else s=_v(i);r.url=s}return t||(e.images[this.uuid]=r),r}};function _v(e){return typeof HTMLImageElement\\u003c\\\"u\\\"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement\\u003c\\\"u\\\"&&e instanceof HTMLCanvasElement||typeof ImageBitmap\\u003c\\\"u\\\"&&e instanceof ImageBitmap?y4.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(Ue(\\\"Texture: Unable to serialize Texture.\\\"),{})}var v4=0,wv=new F,ji=class Yx extends hn{constructor(t=Yx.DEFAULT_IMAGE,r=Yx.DEFAULT_MAPPING,i=Ti,s=Ti,a=lr,n=Ia,o=pi,l=Si,u=Yx.DEFAULT_ANISOTROPY,h=Fa){super(),this.isTexture=!0,Object.defineProperty(this,\\\"id\\\",{value:v4++}),this.uuid=dn(),this.name=\\\"\\\",this.source=new Sv(t),this.mipmaps=[],this.mapping=r,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=a,this.minFilter=n,this.anisotropy=u,this.format=o,this.internalFormat=null,this.type=l,this.offset=new fe(0,0),this.repeat=new fe(1,1),this.center=new fe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Dr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(wv).x}get height(){return this.source.getSize(wv).y}get depth(){return this.source.getSize(wv).z}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,r){this.updateRanges.push({start:t,count:r})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let r in t){let i=t[r];if(i===void 0){Ue(`Texture.setValues(): parameter '${r}' has value of undefined.`);continue}let s=this[r];if(s===void 0){Ue(`Texture.setValues(): property '${r}' does not exist.`);continue}s&&i&&s.isVector2&&i.isVector2||s&&i&&s.isVector3&&i.isVector3||s&&i&&s.isMatrix3&&i.isMatrix3?s.copy(i):this[r]=i}}toJSON(t){let r=t===void 0||typeof t==\\\"string\\\";if(!r&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let i={metadata:{version:4.7,type:\\\"Texture\\\",generator:\\\"Texture.toJSON\\\"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),r||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:\\\"dispose\\\"})}transformUv(t){if(this.mapping!==rv)return t;if(t.applyMatrix3(this.matrix),t.x\\u003c0||t.x>1)switch(this.wrapS){case to:t.x=t.x-Math.floor(t.x);break;case Ti:t.x=t.x\\u003c0?0:1;break;case Qo:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y\\u003c0||t.y>1)switch(this.wrapT){case to:t.y=t.y-Math.floor(t.y);break;case Ti:t.y=t.y\\u003c0?0:1;break;case Qo:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};ji.DEFAULT_IMAGE=null,ji.DEFAULT_MAPPING=rv,ji.DEFAULT_ANISOTROPY=1;var Wt=class Uk{static{Uk.prototype.isVector4=!0}constructor(t=0,r=0,i=0,s=1){this.x=t,this.y=r,this.z=i,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,r,i,s){return this.x=t,this.y=r,this.z=i,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;break;case 3:this.w=r;break;default:throw new Error(\\\"THREE.Vector4: index is out of range: \\\"+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error(\\\"THREE.Vector4: index is out of range: \\\"+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this.z=t.z+r.z,this.w=t.w+r.w,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this.z+=t.z*r,this.w+=t.w*r,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this.z=t.z-r.z,this.w=t.w-r.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let r=this.x,i=this.y,s=this.z,a=this.w,n=t.elements;return this.x=n[0]*r+n[4]*i+n[8]*s+n[12]*a,this.y=n[1]*r+n[5]*i+n[9]*s+n[13]*a,this.z=n[2]*r+n[6]*i+n[10]*s+n[14]*a,this.w=n[3]*r+n[7]*i+n[11]*s+n[15]*a,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let r=Math.sqrt(1-t.w*t.w);return r\\u003c1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/r,this.y=t.y/r,this.z=t.z/r),this}setAxisAngleFromRotationMatrix(t){let r,i,s,a,n=t.elements,o=n[0],l=n[4],u=n[8],h=n[1],d=n[5],c=n[9],m=n[2],g=n[6],y=n[10];if(Math.abs(l-h)\\u003c.01&&Math.abs(u-m)\\u003c.01&&Math.abs(c-g)\\u003c.01){if(Math.abs(l+h)\\u003c.1&&Math.abs(u+m)\\u003c.1&&Math.abs(c+g)\\u003c.1&&Math.abs(o+d+y-3)\\u003c.1)return this.set(1,0,0,0),this;r=Math.PI;let v=(o+1)/2,S=(d+1)/2,T=(y+1)/2,w=(l+h)/4,N=(u+m)/4,C=(c+g)/4;return v>S&&v>T?v\\u003c.01?(i=0,s=.707106781,a=.707106781):(i=Math.sqrt(v),s=w/i,a=N/i):S>T?S\\u003c.01?(i=.707106781,s=0,a=.707106781):(s=Math.sqrt(S),i=w/s,a=C/s):T\\u003c.01?(i=.707106781,s=.707106781,a=0):(a=Math.sqrt(T),i=N/a,s=C/a),this.set(i,s,a,r),this}let b=Math.sqrt((g-c)*(g-c)+(u-m)*(u-m)+(h-l)*(h-l));return Math.abs(b)\\u003c.001&&(b=1),this.x=(g-c)/b,this.y=(u-m)/b,this.z=(h-l)/b,this.w=Math.acos((o+d+y-1)/2),this}setFromMatrixPosition(t){let r=t.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this.w=r[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,r){return this.x=St(this.x,t.x,r.x),this.y=St(this.y,t.y,r.y),this.z=St(this.z,t.z,r.z),this.w=St(this.w,t.w,r.w),this}clampScalar(t,r){return this.x=St(this.x,t,r),this.y=St(this.y,t,r),this.z=St(this.z,t,r),this.w=St(this.w,t,r),this}clampLength(t,r){let i=this.length();return this.divideScalar(i||1).multiplyScalar(St(i,t,r))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this.z+=(t.z-this.z)*r,this.w+=(t.w-this.w)*r,this}lerpVectors(t,r,i){return this.x=t.x+(r.x-t.x)*i,this.y=t.y+(r.y-t.y)*i,this.z=t.z+(r.z-t.z)*i,this.w=t.w+(r.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this.z=t[r+2],this.w=t[r+3],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t[r+2]=this.z,t[r+3]=this.w,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this.z=t.getZ(r),this.w=t.getW(r),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},er=class extends hn{constructor(e=1,t=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:lr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},r),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=r.depth,this.scissor=new Wt(0,0,e,t),this.scissorTest=!1,this.viewport=new Wt(0,0,e,t),this.textures=[];let i={width:e,height:t,depth:r.depth},s=new ji(i),a=r.count;for(let n=0;n\\u003ca;n++)this.textures[n]=s.clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;this._setTextureOptions(r),this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=r.depthTexture,this.samples=r.samples,this.multiview=r.multiview,this.useArrayDepthTexture=r.useArrayDepthTexture}_setTextureOptions(e={}){let t={minFilter:lr,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let r=0;r\\u003cthis.textures.length;r++)this.textures[r].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,r=1){if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(let i=0,s=this.textures.length;i\\u003cs;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=r,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,r=e.textures.length;t\\u003cr;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;let i=Object.assign({},e.textures[t].image);this.textures[t].source=new Sv(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:\\\"dispose\\\"})}},b4=class extends ji{constructor(e=null,t=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=or,this.minFilter=or,this.wrapR=Ti,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}},T4=class extends ji{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=or,this.minFilter=or,this.wrapR=Ti,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},We=class oM{static{oM.prototype.isMatrix4=!0}constructor(t,r,i,s,a,n,o,l,u,h,d,c,m,g,y,b){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,r,i,s,a,n,o,l,u,h,d,c,m,g,y,b)}set(t,r,i,s,a,n,o,l,u,h,d,c,m,g,y,b){let v=this.elements;return v[0]=t,v[4]=r,v[8]=i,v[12]=s,v[1]=a,v[5]=n,v[9]=o,v[13]=l,v[2]=u,v[6]=h,v[10]=d,v[14]=c,v[3]=m,v[7]=g,v[11]=y,v[15]=b,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new oM().fromArray(this.elements)}copy(t){let r=this.elements,i=t.elements;return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],this}copyPosition(t){let r=this.elements,i=t.elements;return r[12]=i[12],r[13]=i[13],r[14]=i[14],this}setFromMatrix3(t){let r=t.elements;return this.set(r[0],r[3],r[6],0,r[1],r[4],r[7],0,r[2],r[5],r[8],0,0,0,0,1),this}extractBasis(t,r,i){return this.determinantAffine()===0?(t.set(1,0,0),r.set(0,1,0),i.set(0,0,1),this):(t.setFromMatrixColumn(this,0),r.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(t,r,i){return this.set(t.x,r.x,i.x,0,t.y,r.y,i.y,0,t.z,r.z,i.z,0,0,0,0,1),this}extractRotation(t){if(t.determinantAffine()===0)return this.identity();let r=this.elements,i=t.elements,s=1/Kh.setFromMatrixColumn(t,0).length(),a=1/Kh.setFromMatrixColumn(t,1).length(),n=1/Kh.setFromMatrixColumn(t,2).length();return r[0]=i[0]*s,r[1]=i[1]*s,r[2]=i[2]*s,r[3]=0,r[4]=i[4]*a,r[5]=i[5]*a,r[6]=i[6]*a,r[7]=0,r[8]=i[8]*n,r[9]=i[9]*n,r[10]=i[10]*n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromEuler(t){let r=this.elements,i=t.x,s=t.y,a=t.z,n=Math.cos(i),o=Math.sin(i),l=Math.cos(s),u=Math.sin(s),h=Math.cos(a),d=Math.sin(a);if(t.order===\\\"XYZ\\\"){let c=n*h,m=n*d,g=o*h,y=o*d;r[0]=l*h,r[4]=-l*d,r[8]=u,r[1]=m+g*u,r[5]=c-y*u,r[9]=-o*l,r[2]=y-c*u,r[6]=g+m*u,r[10]=n*l}else if(t.order===\\\"YXZ\\\"){let c=l*h,m=l*d,g=u*h,y=u*d;r[0]=c+y*o,r[4]=g*o-m,r[8]=n*u,r[1]=n*d,r[5]=n*h,r[9]=-o,r[2]=m*o-g,r[6]=y+c*o,r[10]=n*l}else if(t.order===\\\"ZXY\\\"){let c=l*h,m=l*d,g=u*h,y=u*d;r[0]=c-y*o,r[4]=-n*d,r[8]=g+m*o,r[1]=m+g*o,r[5]=n*h,r[9]=y-c*o,r[2]=-n*u,r[6]=o,r[10]=n*l}else if(t.order===\\\"ZYX\\\"){let c=n*h,m=n*d,g=o*h,y=o*d;r[0]=l*h,r[4]=g*u-m,r[8]=c*u+y,r[1]=l*d,r[5]=y*u+c,r[9]=m*u-g,r[2]=-u,r[6]=o*l,r[10]=n*l}else if(t.order===\\\"YZX\\\"){let c=n*l,m=n*u,g=o*l,y=o*u;r[0]=l*h,r[4]=y-c*d,r[8]=g*d+m,r[1]=d,r[5]=n*h,r[9]=-o*h,r[2]=-u*h,r[6]=m*d+g,r[10]=c-y*d}else if(t.order===\\\"XZY\\\"){let c=n*l,m=n*u,g=o*l,y=o*u;r[0]=l*h,r[4]=-d,r[8]=u*h,r[1]=c*d+y,r[5]=n*h,r[9]=m*d-g,r[2]=g*d-m,r[6]=o*h,r[10]=y*d+c}return r[3]=0,r[7]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromQuaternion(t){return this.compose(S4,t,_4)}lookAt(t,r,i){let s=this.elements;return Os.subVectors(t,r),Os.lengthSq()===0&&(Os.z=1),Os.normalize(),el.crossVectors(i,Os),el.lengthSq()===0&&(Math.abs(i.z)===1?Os.x+=1e-4:Os.z+=1e-4,Os.normalize(),el.crossVectors(i,Os)),el.normalize(),yg.crossVectors(Os,el),s[0]=el.x,s[4]=yg.x,s[8]=Os.x,s[1]=el.y,s[5]=yg.y,s[9]=Os.y,s[2]=el.z,s[6]=yg.z,s[10]=Os.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,r){let i=t.elements,s=r.elements,a=this.elements,n=i[0],o=i[4],l=i[8],u=i[12],h=i[1],d=i[5],c=i[9],m=i[13],g=i[2],y=i[6],b=i[10],v=i[14],S=i[3],T=i[7],w=i[11],N=i[15],C=s[0],R=s[4],E=s[8],P=s[12],I=s[1],O=s[5],L=s[9],X=s[13],z=s[2],H=s[6],ue=s[10],ne=s[14],re=s[3],ce=s[7],ge=s[11],ye=s[15];return a[0]=n*C+o*I+l*z+u*re,a[4]=n*R+o*O+l*H+u*ce,a[8]=n*E+o*L+l*ue+u*ge,a[12]=n*P+o*X+l*ne+u*ye,a[1]=h*C+d*I+c*z+m*re,a[5]=h*R+d*O+c*H+m*ce,a[9]=h*E+d*L+c*ue+m*ge,a[13]=h*P+d*X+c*ne+m*ye,a[2]=g*C+y*I+b*z+v*re,a[6]=g*R+y*O+b*H+v*ce,a[10]=g*E+y*L+b*ue+v*ge,a[14]=g*P+y*X+b*ne+v*ye,a[3]=S*C+T*I+w*z+N*re,a[7]=S*R+T*O+w*H+N*ce,a[11]=S*E+T*L+w*ue+N*ge,a[15]=S*P+T*X+w*ne+N*ye,this}multiplyScalar(t){let r=this.elements;return r[0]*=t,r[4]*=t,r[8]*=t,r[12]*=t,r[1]*=t,r[5]*=t,r[9]*=t,r[13]*=t,r[2]*=t,r[6]*=t,r[10]*=t,r[14]*=t,r[3]*=t,r[7]*=t,r[11]*=t,r[15]*=t,this}determinant(){let t=this.elements,r=t[0],i=t[4],s=t[8],a=t[12],n=t[1],o=t[5],l=t[9],u=t[13],h=t[2],d=t[6],c=t[10],m=t[14],g=t[3],y=t[7],b=t[11],v=t[15],S=l*m-u*c,T=o*m-u*d,w=o*c-l*d,N=n*m-u*h,C=n*c-l*h,R=n*d-o*h;return r*(y*S-b*T+v*w)-i*(g*S-b*N+v*C)+s*(g*T-y*N+v*R)-a*(g*w-y*C+b*R)}determinantAffine(){let t=this.elements,r=t[0],i=t[4],s=t[8],a=t[1],n=t[5],o=t[9],l=t[2],u=t[6],h=t[10];return r*(n*h-o*u)-i*(a*h-o*l)+s*(a*u-n*l)}transpose(){let t=this.elements,r;return r=t[1],t[1]=t[4],t[4]=r,r=t[2],t[2]=t[8],t[8]=r,r=t[6],t[6]=t[9],t[9]=r,r=t[3],t[3]=t[12],t[12]=r,r=t[7],t[7]=t[13],t[13]=r,r=t[11],t[11]=t[14],t[14]=r,this}setPosition(t,r,i){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=r,s[14]=i),this}invert(){let t=this.elements,r=t[0],i=t[1],s=t[2],a=t[3],n=t[4],o=t[5],l=t[6],u=t[7],h=t[8],d=t[9],c=t[10],m=t[11],g=t[12],y=t[13],b=t[14],v=t[15],S=r*o-i*n,T=r*l-s*n,w=r*u-a*n,N=i*l-s*o,C=i*u-a*o,R=s*u-a*l,E=h*y-d*g,P=h*b-c*g,I=h*v-m*g,O=d*b-c*y,L=d*v-m*y,X=c*v-m*b,z=S*X-T*L+w*O+N*I-C*P+R*E;if(z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let H=1/z;return t[0]=(o*X-l*L+u*O)*H,t[1]=(s*L-i*X-a*O)*H,t[2]=(y*R-b*C+v*N)*H,t[3]=(c*C-d*R-m*N)*H,t[4]=(l*I-n*X-u*P)*H,t[5]=(r*X-s*I+a*P)*H,t[6]=(b*w-g*R-v*T)*H,t[7]=(h*R-c*w+m*T)*H,t[8]=(n*L-o*I+u*E)*H,t[9]=(i*I-r*L-a*E)*H,t[10]=(g*C-y*w+v*S)*H,t[11]=(d*w-h*C-m*S)*H,t[12]=(o*P-n*O-l*E)*H,t[13]=(r*O-i*P+s*E)*H,t[14]=(y*T-g*N-b*S)*H,t[15]=(h*N-d*T+c*S)*H,this}scale(t){let r=this.elements,i=t.x,s=t.y,a=t.z;return r[0]*=i,r[4]*=s,r[8]*=a,r[1]*=i,r[5]*=s,r[9]*=a,r[2]*=i,r[6]*=s,r[10]*=a,r[3]*=i,r[7]*=s,r[11]*=a,this}getMaxScaleOnAxis(){let t=this.elements,r=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(r,i,s))}makeTranslation(t,r,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,r,0,0,1,i,0,0,0,1),this}makeRotationX(t){let r=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,r,-i,0,0,i,r,0,0,0,0,1),this}makeRotationY(t){let r=Math.cos(t),i=Math.sin(t);return this.set(r,0,i,0,0,1,0,0,-i,0,r,0,0,0,0,1),this}makeRotationZ(t){let r=Math.cos(t),i=Math.sin(t);return this.set(r,-i,0,0,i,r,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,r){let i=Math.cos(r),s=Math.sin(r),a=1-i,n=t.x,o=t.y,l=t.z,u=a*n,h=a*o;return this.set(u*n+i,u*o-s*l,u*l+s*o,0,u*o+s*l,h*o+i,h*l-s*n,0,u*l-s*o,h*l+s*n,a*l*l+i,0,0,0,0,1),this}makeScale(t,r,i){return this.set(t,0,0,0,0,r,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,r,i,s,a,n){return this.set(1,i,a,0,t,1,n,0,r,s,1,0,0,0,0,1),this}compose(t,r,i){let s=this.elements,a=r._x,n=r._y,o=r._z,l=r._w,u=a+a,h=n+n,d=o+o,c=a*u,m=a*h,g=a*d,y=n*h,b=n*d,v=o*d,S=l*u,T=l*h,w=l*d,N=i.x,C=i.y,R=i.z;return s[0]=(1-(y+v))*N,s[1]=(m+w)*N,s[2]=(g-T)*N,s[3]=0,s[4]=(m-w)*C,s[5]=(1-(c+v))*C,s[6]=(b+S)*C,s[7]=0,s[8]=(g+T)*R,s[9]=(b-S)*R,s[10]=(1-(c+y))*R,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,r,i){let s=this.elements;t.x=s[12],t.y=s[13],t.z=s[14];let a=this.determinantAffine();if(a===0)return i.set(1,1,1),r.identity(),this;let n=Kh.set(s[0],s[1],s[2]).length(),o=Kh.set(s[4],s[5],s[6]).length(),l=Kh.set(s[8],s[9],s[10]).length();a\\u003c0&&(n=-n),La.copy(this);let u=1/n,h=1/o,d=1/l;return La.elements[0]*=u,La.elements[1]*=u,La.elements[2]*=u,La.elements[4]*=h,La.elements[5]*=h,La.elements[6]*=h,La.elements[8]*=d,La.elements[9]*=d,La.elements[10]*=d,r.setFromRotationMatrix(La),i.x=n,i.y=o,i.z=l,this}makePerspective(t,r,i,s,a,n,o=Ds,l=!1){let u=this.elements,h=2*a/(r-t),d=2*a/(i-s),c=(r+t)/(r-t),m=(i+s)/(i-s),g,y;if(l)g=a/(n-a),y=n*a/(n-a);else if(o===Ds)g=-(n+a)/(n-a),y=-2*n*a/(n-a);else if(o===da)g=-n/(n-a),y=-n*a/(n-a);else throw new Error(\\\"THREE.Matrix4.makePerspective(): Invalid coordinate system: \\\"+o);return u[0]=h,u[4]=0,u[8]=c,u[12]=0,u[1]=0,u[5]=d,u[9]=m,u[13]=0,u[2]=0,u[6]=0,u[10]=g,u[14]=y,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(t,r,i,s,a,n,o=Ds,l=!1){let u=this.elements,h=2/(r-t),d=2/(i-s),c=-(r+t)/(r-t),m=-(i+s)/(i-s),g,y;if(l)g=1/(n-a),y=n/(n-a);else if(o===Ds)g=-2/(n-a),y=-(n+a)/(n-a);else if(o===da)g=-1/(n-a),y=-a/(n-a);else throw new Error(\\\"THREE.Matrix4.makeOrthographic(): Invalid coordinate system: \\\"+o);return u[0]=h,u[4]=0,u[8]=0,u[12]=c,u[1]=0,u[5]=d,u[9]=0,u[13]=m,u[2]=0,u[6]=0,u[10]=g,u[14]=y,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(t){let r=this.elements,i=t.elements;for(let s=0;s\\u003c16;s++)if(r[s]!==i[s])return!1;return!0}fromArray(t,r=0){for(let i=0;i\\u003c16;i++)this.elements[i]=t[i+r];return this}toArray(t=[],r=0){let i=this.elements;return t[r]=i[0],t[r+1]=i[1],t[r+2]=i[2],t[r+3]=i[3],t[r+4]=i[4],t[r+5]=i[5],t[r+6]=i[6],t[r+7]=i[7],t[r+8]=i[8],t[r+9]=i[9],t[r+10]=i[10],t[r+11]=i[11],t[r+12]=i[12],t[r+13]=i[13],t[r+14]=i[14],t[r+15]=i[15],t}},Kh=new F,La=new We,S4=new F(0,0,0),_4=new F(1,1,1),el=new F,yg=new F,Os=new F,$M=new We,qM=new si,cn=class zk{constructor(t=0,r=0,i=0,s=zk.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=r,this._z=i,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,r,i,s=this._order){return this._x=t,this._y=r,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,r=this._order,i=!0){let s=t.elements,a=s[0],n=s[4],o=s[8],l=s[1],u=s[5],h=s[9],d=s[2],c=s[6],m=s[10];switch(r){case\\\"XYZ\\\":this._y=Math.asin(St(o,-1,1)),Math.abs(o)\\u003c.9999999?(this._x=Math.atan2(-h,m),this._z=Math.atan2(-n,a)):(this._x=Math.atan2(c,u),this._z=0);break;case\\\"YXZ\\\":this._x=Math.asin(-St(h,-1,1)),Math.abs(h)\\u003c.9999999?(this._y=Math.atan2(o,m),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-d,a),this._z=0);break;case\\\"ZXY\\\":this._x=Math.asin(St(c,-1,1)),Math.abs(c)\\u003c.9999999?(this._y=Math.atan2(-d,m),this._z=Math.atan2(-n,u)):(this._y=0,this._z=Math.atan2(l,a));break;case\\\"ZYX\\\":this._y=Math.asin(-St(d,-1,1)),Math.abs(d)\\u003c.9999999?(this._x=Math.atan2(c,m),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-n,u));break;case\\\"YZX\\\":this._z=Math.asin(St(l,-1,1)),Math.abs(l)\\u003c.9999999?(this._x=Math.atan2(-h,u),this._y=Math.atan2(-d,a)):(this._x=0,this._y=Math.atan2(o,m));break;case\\\"XZY\\\":this._z=Math.asin(-St(n,-1,1)),Math.abs(n)\\u003c.9999999?(this._x=Math.atan2(c,u),this._y=Math.atan2(o,a)):(this._x=Math.atan2(-h,m),this._y=0);break;default:Ue(\\\"Euler: .setFromRotationMatrix() encountered an unknown order: \\\"+r)}return this._order=r,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,r,i){return $M.makeRotationFromQuaternion(t),this.setFromRotationMatrix($M,r,i)}setFromVector3(t,r=this._order){return this.set(t.x,t.y,t.z,r)}reorder(t){return qM.setFromEuler(this),this.setFromQuaternion(qM,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],r=0){return t[r]=this._x,t[r+1]=this._y,t[r+2]=this._z,t[r+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};cn.DEFAULT_ORDER=\\\"XYZ\\\";var w4=class{constructor(){this.mask=1}set(e){this.mask=(1\\u003c\\u003ce|0)>>>0}enable(e){this.mask|=1\\u003c\\u003ce|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1\\u003c\\u003ce|0}disable(e){this.mask&=~(1\\u003c\\u003ce|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1\\u003c\\u003ce|0))!==0}},M4=0,YM=new F,ed=new si,no=new We,xg=new F,np=new F,N4=new F,A4=new si,ZM=new F(1,0,0),JM=new F(0,1,0),QM=new F(0,0,1),KM={type:\\\"added\\\"},C4={type:\\\"removed\\\"},td={type:\\\"childadded\\\",child:null},Mv={type:\\\"childremoved\\\",child:null},Hi=class Zx extends hn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,\\\"id\\\",{value:M4++}),this.uuid=dn(),this.name=\\\"\\\",this.type=\\\"Object3D\\\",this.parent=null,this.children=[],this.up=Zx.DEFAULT_UP.clone();let t=new F,r=new cn,i=new si,s=new F(1,1,1);function a(){i.setFromEuler(r,!1)}function n(){r.setFromQuaternion(i,void 0,!1)}r._onChange(a),i._onChange(n),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:r},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new We},normalMatrix:{value:new Dr}}),this.matrix=new We,this.matrixWorld=new We,this.matrixAutoUpdate=Zx.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Zx.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new w4,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,r){this.quaternion.setFromAxisAngle(t,r)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,r){return ed.setFromAxisAngle(t,r),this.quaternion.multiply(ed),this}rotateOnWorldAxis(t,r){return ed.setFromAxisAngle(t,r),this.quaternion.premultiply(ed),this}rotateX(t){return this.rotateOnAxis(ZM,t)}rotateY(t){return this.rotateOnAxis(JM,t)}rotateZ(t){return this.rotateOnAxis(QM,t)}translateOnAxis(t,r){return YM.copy(t).applyQuaternion(this.quaternion),this.position.add(YM.multiplyScalar(r)),this}translateX(t){return this.translateOnAxis(ZM,t)}translateY(t){return this.translateOnAxis(JM,t)}translateZ(t){return this.translateOnAxis(QM,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(no.copy(this.matrixWorld).invert())}lookAt(t,r,i){t.isVector3?xg.copy(t):xg.set(t,r,i);let s=this.parent;this.updateWorldMatrix(!0,!1),np.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?no.lookAt(np,xg,this.up):no.lookAt(xg,np,this.up),this.quaternion.setFromRotationMatrix(no),s&&(no.extractRotation(s.matrixWorld),ed.setFromRotationMatrix(no),this.quaternion.premultiply(ed.invert()))}add(t){if(arguments.length>1){for(let r=0;r\\u003carguments.length;r++)this.add(arguments[r]);return this}return t===this?(Ce(\\\"Object3D.add: object can't be added as a child of itself.\\\",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(KM),td.child=t,this.dispatchEvent(td),td.child=null):Ce(\\\"Object3D.add: object not an instance of THREE.Object3D.\\\",t),this)}remove(t){if(arguments.length>1){for(let i=0;i\\u003carguments.length;i++)this.remove(arguments[i]);return this}let r=this.children.indexOf(t);return r!==-1&&(t.parent=null,this.children.splice(r,1),t.dispatchEvent(C4),Mv.child=t,this.dispatchEvent(Mv),Mv.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),no.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),no.multiply(t.parent.matrixWorld)),t.applyMatrix4(no),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(KM),td.child=t,this.dispatchEvent(td),td.child=null,this}getObjectById(t){return this.getObjectByProperty(\\\"id\\\",t)}getObjectByName(t){return this.getObjectByProperty(\\\"name\\\",t)}getObjectByProperty(t,r){if(this[t]===r)return this;for(let i=0,s=this.children.length;i\\u003cs;i++){let a=this.children[i].getObjectByProperty(t,r);if(a!==void 0)return a}}getObjectsByProperty(t,r,i=[]){this[t]===r&&i.push(this);let s=this.children;for(let a=0,n=s.length;a\\u003cn;a++)s[a].getObjectsByProperty(t,r,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(np,t,N4),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(np,A4,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let r=this.matrixWorld.elements;return t.set(r[8],r[9],r[10]).normalize()}raycast(){}traverse(t){t(this);let r=this.children;for(let i=0,s=r.length;i\\u003cs;i++)r[i].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let r=this.children;for(let i=0,s=r.length;i\\u003cs;i++)r[i].traverseVisible(t)}traverseAncestors(t){let r=this.parent;r!==null&&(t(r),r.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let t=this.pivot;if(t!==null){let r=t.x,i=t.y,s=t.z,a=this.matrix.elements;a[12]+=r-a[0]*r-a[4]*i-a[8]*s,a[13]+=i-a[1]*r-a[5]*i-a[9]*s,a[14]+=s-a[2]*r-a[6]*i-a[10]*s}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let r=this.children;for(let i=0,s=r.length;i\\u003cs;i++)r[i].updateMatrixWorld(t)}updateWorldMatrix(t,r,i=!1){let s=this.parent;if(t===!0&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||i)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,i=!0),r===!0){let a=this.children;for(let n=0,o=a.length;n\\u003co;n++)a[n].updateWorldMatrix(!1,!0,i)}}toJSON(t){let r=t===void 0||typeof t==\\\"string\\\",i={};r&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:\\\"Object\\\",generator:\\\"Object3D.toJSON\\\"});let s={};s.uuid=this.uuid,s.type=this.type,this.name!==\\\"\\\"&&(s.name=this.name),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),this.static!==!1&&(s.static=this.static),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.pivot!==null&&(s.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(s.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(s.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(s.type=\\\"InstancedMesh\\\",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type=\\\"BatchedMesh\\\",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(o=>({...o})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(t),s.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function a(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(t)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=a(t.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let l=o.shapes;if(Array.isArray(l))for(let u=0,h=l.length;u\\u003ch;u++){let d=l[u];a(t.shapes,d)}else a(t.shapes,l)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(a(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let l=0,u=this.material.length;l\\u003cu;l++)o.push(a(t.materials,this.material[l]));s.material=o}else s.material=a(t.materials,this.material);if(this.children.length>0){s.children=[];for(let o=0;o\\u003cthis.children.length;o++)s.children.push(this.children[o].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let o=0;o\\u003cthis.animations.length;o++){let l=this.animations[o];s.animations.push(a(t.animations,l))}}if(r){let o=n(t.geometries),l=n(t.materials),u=n(t.textures),h=n(t.images),d=n(t.shapes),c=n(t.skeletons),m=n(t.animations),g=n(t.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),u.length>0&&(i.textures=u),h.length>0&&(i.images=h),d.length>0&&(i.shapes=d),c.length>0&&(i.skeletons=c),m.length>0&&(i.animations=m),g.length>0&&(i.nodes=g)}return i.object=s,i;function n(o){let l=[];for(let u in o){let h=o[u];delete h.metadata,l.push(h)}return l}}clone(t){return new this.constructor().copy(this,t)}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.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,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.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),r===!0)for(let i=0;i\\u003ct.children.length;i++){let s=t.children[i];this.add(s.clone())}return this}};Hi.DEFAULT_UP=new F(0,1,0),Hi.DEFAULT_MATRIX_AUTO_UPDATE=!0,Hi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var pn=class extends Hi{constructor(){super(),this.isGroup=!0,this.type=\\\"Group\\\"}},R4={type:\\\"move\\\"},E4=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new pn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new pn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new pn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:\\\"connected\\\",data:e}),this}disconnect(e){return this.dispatchEvent({type:\\\"disconnected\\\",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let i=null,s=null,a=null,n=this._targetRay,o=this._grip,l=this._hand;if(e&&t.session.visibilityState!==\\\"visible-blurred\\\"){if(l&&e.hand){a=!0;for(let g of e.hand.values()){let y=t.getJointPose(g,r),b=this._getHandJoint(l,g);y!==null&&(b.matrix.fromArray(y.transform.matrix),b.matrix.decompose(b.position,b.rotation,b.scale),b.matrixWorldNeedsUpdate=!0,b.jointRadius=y.radius),b.visible=y!==null}let u=l.joints[\\\"index-finger-tip\\\"],h=l.joints[\\\"thumb-tip\\\"],d=u.position.distanceTo(h.position),c=.02,m=.005;l.inputState.pinching&&d>c+m?(l.inputState.pinching=!1,this.dispatchEvent({type:\\\"pinchend\\\",handedness:e.handedness,target:this})):!l.inputState.pinching&&d\\u003c=c-m&&(l.inputState.pinching=!0,this.dispatchEvent({type:\\\"pinchstart\\\",handedness:e.handedness,target:this}))}else o!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),s!==null&&(o.matrix.fromArray(s.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,s.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(s.linearVelocity)):o.hasLinearVelocity=!1,s.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(s.angularVelocity)):o.hasAngularVelocity=!1,o.eventsEnabled&&o.dispatchEvent({type:\\\"gripUpdated\\\",data:e,target:this})));n!==null&&(i=t.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(n.matrix.fromArray(i.transform.matrix),n.matrix.decompose(n.position,n.rotation,n.scale),n.matrixWorldNeedsUpdate=!0,i.linearVelocity?(n.hasLinearVelocity=!0,n.linearVelocity.copy(i.linearVelocity)):n.hasLinearVelocity=!1,i.angularVelocity?(n.hasAngularVelocity=!0,n.angularVelocity.copy(i.angularVelocity)):n.hasAngularVelocity=!1,this.dispatchEvent(R4)))}return n!==null&&(n.visible=i!==null),o!==null&&(o.visible=s!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let r=new pn;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}},eN={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},tl={h:0,s:0,l:0},vg={h:0,s:0,l:0};function Nv(e,t,r){return r\\u003c0&&(r+=1),r>1&&(r-=1),r\\u003c.16666666666666666?e+(t-e)*6*r:r\\u003c.5?t:r\\u003c.6666666666666666?e+(t-e)*6*(.6666666666666666-r):e}var gt=class{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){let i=e;i&&i.isColor?this.copy(i):typeof i==\\\"number\\\"?this.setHex(i):typeof i==\\\"string\\\"&&this.setStyle(i)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ds){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Gt.colorSpaceToWorking(this,t),this}setRGB(e,t,r,i=Gt.workingColorSpace){return this.r=e,this.g=t,this.b=r,Gt.colorSpaceToWorking(this,i),this}setHSL(e,t,r,i=Gt.workingColorSpace){if(e=vv(e,1),t=St(t,0,1),r=St(r,0,1),t===0)this.r=this.g=this.b=r;else{let s=r\\u003c=.5?r*(1+t):r+t-r*t,a=2*r-s;this.r=Nv(a,s,e+1/3),this.g=Nv(a,s,e),this.b=Nv(a,s,e-1/3)}return Gt.colorSpaceToWorking(this,i),this}setStyle(e,t=ds){function r(s){s!==void 0&&parseFloat(s)\\u003c1&&Ue(\\\"Color: Alpha component of \\\"+e+\\\" will be ignored.\\\")}let i;if(i=/^(\\\\w+)\\\\(([^\\\\)]*)\\\\)/.exec(e)){let s,a=i[1],n=i[2];switch(a){case\\\"rgb\\\":case\\\"rgba\\\":if(s=/^\\\\s*(\\\\d+)\\\\s*,\\\\s*(\\\\d+)\\\\s*,\\\\s*(\\\\d+)\\\\s*(?:,\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\s*)?$/.exec(n))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\\\\s*(\\\\d+)\\\\%\\\\s*,\\\\s*(\\\\d+)\\\\%\\\\s*,\\\\s*(\\\\d+)\\\\%\\\\s*(?:,\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\s*)?$/.exec(n))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case\\\"hsl\\\":case\\\"hsla\\\":if(s=/^\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\s*,\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\%\\\\s*,\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\%\\\\s*(?:,\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\s*)?$/.exec(n))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Ue(\\\"Color: Unknown color model \\\"+e)}}else if(i=/^\\\\#([A-Fa-f\\\\d]+)$/.exec(e)){let s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);Ue(\\\"Color: Invalid hex color \\\"+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=ds){let r=eN[e.toLowerCase()];return r!==void 0?this.setHex(r,t):Ue(\\\"Color: Unknown color \\\"+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ao(e.r),this.g=ao(e.g),this.b=ao(e.b),this}copyLinearToSRGB(e){return this.r=Jh(e.r),this.g=Jh(e.g),this.b=Jh(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ds){return Gt.workingToColorSpace(Xi.copy(this),e),Math.round(St(Xi.r*255,0,255))*65536+Math.round(St(Xi.g*255,0,255))*256+Math.round(St(Xi.b*255,0,255))}getHexString(e=ds){return(\\\"000000\\\"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Gt.workingColorSpace){Gt.workingToColorSpace(Xi.copy(this),t);let r=Xi.r,i=Xi.g,s=Xi.b,a=Math.max(r,i,s),n=Math.min(r,i,s),o,l,u=(n+a)/2;if(n===a)o=0,l=0;else{let h=a-n;switch(l=u\\u003c=.5?h/(a+n):h/(2-a-n),a){case r:o=(i-s)/h+(i\\u003cs?6:0);break;case i:o=(s-r)/h+2;break;case s:o=(r-i)/h+4;break}o/=6}return e.h=o,e.s=l,e.l=u,e}getRGB(e,t=Gt.workingColorSpace){return Gt.workingToColorSpace(Xi.copy(this),t),e.r=Xi.r,e.g=Xi.g,e.b=Xi.b,e}getStyle(e=ds){Gt.workingToColorSpace(Xi.copy(this),e);let t=Xi.r,r=Xi.g,i=Xi.b;return e!==ds?`color(${e} ${t.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,t,r){return this.getHSL(tl),this.setHSL(tl.h+e,tl.s+t,tl.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(tl),e.getHSL(vg);let r=ap(tl.h,vg.h,t),i=ap(tl.s,vg.s,t),s=ap(tl.l,vg.l,t);return this.setHSL(r,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,r=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*r+s[6]*i,this.g=s[1]*t+s[4]*r+s[7]*i,this.b=s[2]*t+s[5]*r+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},Xi=new gt;gt.NAMES=eN;var bg=class extends Hi{constructor(){super(),this.isScene=!0,this.type=\\\"Scene\\\",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new cn,this.environmentIntensity=1,this.environmentRotation=new cn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__\\u003c\\\"u\\\"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\\\"observe\\\",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},ka=new F,oo=new F,Av=new F,lo=new F,rd=new F,id=new F,tN=new F,Cv=new F,Rv=new F,Ev=new F,Pv=new Wt,Bv=new Wt,Iv=new Wt,$i=class Hc{constructor(t=new F,r=new F,i=new F){this.a=t,this.b=r,this.c=i}static getNormal(t,r,i,s){s.subVectors(i,r),ka.subVectors(t,r),s.cross(ka);let a=s.lengthSq();return a>0?s.multiplyScalar(1/Math.sqrt(a)):s.set(0,0,0)}static getBarycoord(t,r,i,s,a){ka.subVectors(s,r),oo.subVectors(i,r),Av.subVectors(t,r);let n=ka.dot(ka),o=ka.dot(oo),l=ka.dot(Av),u=oo.dot(oo),h=oo.dot(Av),d=n*u-o*o;if(d===0)return a.set(0,0,0),null;let c=1/d,m=(u*l-o*h)*c,g=(n*h-o*l)*c;return a.set(1-m-g,g,m)}static containsPoint(t,r,i,s){return this.getBarycoord(t,r,i,s,lo)===null?!1:lo.x>=0&&lo.y>=0&&lo.x+lo.y\\u003c=1}static getInterpolation(t,r,i,s,a,n,o,l){return this.getBarycoord(t,r,i,s,lo)===null?(l.x=0,l.y=0,\\\"z\\\"in l&&(l.z=0),\\\"w\\\"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(a,lo.x),l.addScaledVector(n,lo.y),l.addScaledVector(o,lo.z),l)}static getInterpolatedAttribute(t,r,i,s,a,n){return Pv.setScalar(0),Bv.setScalar(0),Iv.setScalar(0),Pv.fromBufferAttribute(t,r),Bv.fromBufferAttribute(t,i),Iv.fromBufferAttribute(t,s),n.setScalar(0),n.addScaledVector(Pv,a.x),n.addScaledVector(Bv,a.y),n.addScaledVector(Iv,a.z),n}static isFrontFacing(t,r,i,s){return ka.subVectors(i,r),oo.subVectors(t,r),ka.cross(oo).dot(s)\\u003c0}set(t,r,i){return this.a.copy(t),this.b.copy(r),this.c.copy(i),this}setFromPointsAndIndices(t,r,i,s){return this.a.copy(t[r]),this.b.copy(t[i]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,r,i,s){return this.a.fromBufferAttribute(t,r),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ka.subVectors(this.c,this.b),oo.subVectors(this.a,this.b),ka.cross(oo).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Hc.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,r){return Hc.getBarycoord(t,this.a,this.b,this.c,r)}getInterpolation(t,r,i,s,a){return Hc.getInterpolation(t,this.a,this.b,this.c,r,i,s,a)}containsPoint(t){return Hc.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Hc.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,r){let i=this.a,s=this.b,a=this.c,n,o;rd.subVectors(s,i),id.subVectors(a,i),Cv.subVectors(t,i);let l=rd.dot(Cv),u=id.dot(Cv);if(l\\u003c=0&&u\\u003c=0)return r.copy(i);Rv.subVectors(t,s);let h=rd.dot(Rv),d=id.dot(Rv);if(h>=0&&d\\u003c=h)return r.copy(s);let c=l*d-h*u;if(c\\u003c=0&&l>=0&&h\\u003c=0)return n=l/(l-h),r.copy(i).addScaledVector(rd,n);Ev.subVectors(t,a);let m=rd.dot(Ev),g=id.dot(Ev);if(g>=0&&m\\u003c=g)return r.copy(a);let y=m*u-l*g;if(y\\u003c=0&&u>=0&&g\\u003c=0)return o=u/(u-g),r.copy(i).addScaledVector(id,o);let b=h*g-m*d;if(b\\u003c=0&&d-h>=0&&m-g>=0)return tN.subVectors(a,s),o=(d-h)/(d-h+(m-g)),r.copy(s).addScaledVector(tN,o);let v=1/(b+y+c);return n=y*v,o=c*v,r.copy(i).addScaledVector(rd,n).addScaledVector(id,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},qi=class{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,r=e.length;t\\u003cr;t+=3)this.expandByPoint(Da.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,r=e.count;t\\u003cr;t++)this.expandByPoint(Da.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t\\u003cr;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=Da.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x\\u003cthis.min.x||this.max.y\\u003cthis.min.y||this.max.z\\u003cthis.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let r=e.geometry;if(r!==void 0){let s=r.getAttribute(\\\"position\\\");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,n=s.count;a\\u003cn;a++)e.isMesh===!0?e.getVertexPosition(a,Da):Da.fromBufferAttribute(s,a),Da.applyMatrix4(e.matrixWorld),this.expandByPoint(Da);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Tg.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),Tg.copy(r.boundingBox)),Tg.applyMatrix4(e.matrixWorld),this.union(Tg)}let i=e.children;for(let s=0,a=i.length;s\\u003ca;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x\\u003c=this.max.x&&e.y>=this.min.y&&e.y\\u003c=this.max.y&&e.z>=this.min.z&&e.z\\u003c=this.max.z}containsBox(e){return this.min.x\\u003c=e.min.x&&e.max.x\\u003c=this.max.x&&this.min.y\\u003c=e.min.y&&e.max.y\\u003c=this.max.y&&this.min.z\\u003c=e.min.z&&e.max.z\\u003c=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x\\u003c=this.max.x&&e.max.y>=this.min.y&&e.min.y\\u003c=this.max.y&&e.max.z>=this.min.z&&e.min.z\\u003c=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Da),Da.distanceToSquared(e.center)\\u003c=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t\\u003c=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(op),Sg.subVectors(this.max,op),sd.subVectors(e.a,op),ad.subVectors(e.b,op),nd.subVectors(e.c,op),rl.subVectors(ad,sd),il.subVectors(nd,ad),gu.subVectors(sd,nd);let t=[0,-rl.z,rl.y,0,-il.z,il.y,0,-gu.z,gu.y,rl.z,0,-rl.x,il.z,0,-il.x,gu.z,0,-gu.x,-rl.y,rl.x,0,-il.y,il.x,0,-gu.y,gu.x,0];return!Fv(t,sd,ad,nd,Sg)||(t=[1,0,0,0,1,0,0,0,1],!Fv(t,sd,ad,nd,Sg))?!1:(_g.crossVectors(rl,il),t=[_g.x,_g.y,_g.z],Fv(t,sd,ad,nd,Sg))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Da).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Da).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(uo[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),uo[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),uo[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),uo[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),uo[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),uo[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),uo[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),uo[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(uo),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},uo=[new F,new F,new F,new F,new F,new F,new F,new F],Da=new F,Tg=new qi,sd=new F,ad=new F,nd=new F,rl=new F,il=new F,gu=new F,op=new F,Sg=new F,_g=new F,yu=new F;function Fv(e,t,r,i,s){for(let a=0,n=e.length-3;a\\u003c=n;a+=3){yu.fromArray(e,a);let o=s.x*Math.abs(yu.x)+s.y*Math.abs(yu.y)+s.z*Math.abs(yu.z),l=t.dot(yu),u=r.dot(yu),h=i.dot(yu);if(Math.max(-Math.max(l,u,h),Math.min(l,u,h))>o)return!1}return!0}var ho=P4();function P4(){let e=new ArrayBuffer(4),t=new Float32Array(e),r=new Uint32Array(e),i=new Uint32Array(512),s=new Uint32Array(512);for(let l=0;l\\u003c256;++l){let u=l-127;u\\u003c-27?(i[l]=0,i[l|256]=32768,s[l]=24,s[l|256]=24):u\\u003c-14?(i[l]=1024>>-u-14,i[l|256]=1024>>-u-14|32768,s[l]=-u-1,s[l|256]=-u-1):u\\u003c=15?(i[l]=u+15\\u003c\\u003c10,i[l|256]=u+15\\u003c\\u003c10|32768,s[l]=13,s[l|256]=13):u\\u003c128?(i[l]=31744,i[l|256]=64512,s[l]=24,s[l|256]=24):(i[l]=31744,i[l|256]=64512,s[l]=13,s[l|256]=13)}let a=new Uint32Array(2048),n=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l\\u003c1024;++l){let u=l\\u003c\\u003c13,h=0;for(;(u&8388608)===0;)u\\u003c\\u003c=1,h-=8388608;u&=-8388609,h+=947912704,a[l]=u|h}for(let l=1024;l\\u003c2048;++l)a[l]=939524096+(l-1024\\u003c\\u003c13);for(let l=1;l\\u003c31;++l)n[l]=l\\u003c\\u003c23;n[31]=1199570944,n[32]=2147483648;for(let l=33;l\\u003c63;++l)n[l]=2147483648+(l-32\\u003c\\u003c23);n[63]=3347054592;for(let l=1;l\\u003c64;++l)l!==32&&(o[l]=1024);return{floatView:t,uint32View:r,baseTable:i,shiftTable:s,mantissaTable:a,exponentTable:n,offsetTable:o}}function Us(e){Math.abs(e)>65504&&Ue(\\\"DataUtils.toHalfFloat(): Value out of range.\\\"),e=St(e,-65504,65504),ho.floatView[0]=e;let t=ho.uint32View[0],r=t>>23&511;return ho.baseTable[r]+((t&8388607)>>ho.shiftTable[r])}function wg(e){let t=e>>10;return ho.uint32View[0]=ho.mantissaTable[ho.offsetTable[t]+(e&1023)]+ho.exponentTable[t],ho.floatView[0]}var ai=new F,Mg=new fe,B4=0,_i=class extends hn{constructor(e,t,r=!1){if(super(),Array.isArray(e))throw new TypeError(\\\"THREE.BufferAttribute: array should be a Typed Array.\\\");this.isBufferAttribute=!0,Object.defineProperty(this,\\\"id\\\",{value:B4++}),this.name=\\\"\\\",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=qh,this.updateRanges=[],this.gpuType=Er,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let i=0,s=this.itemSize;i\\u003cs;i++)this.array[e+i]=t.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,r=this.count;t\\u003cr;t++)Mg.fromBufferAttribute(this,t),Mg.applyMatrix3(e),this.setXY(t,Mg.x,Mg.y);else if(this.itemSize===3)for(let t=0,r=this.count;t\\u003cr;t++)ai.fromBufferAttribute(this,t),ai.applyMatrix3(e),this.setXYZ(t,ai.x,ai.y,ai.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t\\u003cr;t++)ai.fromBufferAttribute(this,t),ai.applyMatrix4(e),this.setXYZ(t,ai.x,ai.y,ai.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t\\u003cr;t++)ai.fromBufferAttribute(this,t),ai.applyNormalMatrix(e),this.setXYZ(t,ai.x,ai.y,ai.z);return this}transformDirection(e){for(let t=0,r=this.count;t\\u003cr;t++)ai.fromBufferAttribute(this,t),ai.transformDirection(e),this.setXYZ(t,ai.x,ai.y,ai.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let r=this.array[e*this.itemSize+t];return this.normalized&&(r=cs(r,this.array)),r}setComponent(e,t,r){return this.normalized&&(r=At(r,this.array)),this.array[e*this.itemSize+t]=r,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=cs(t,this.array)),t}setX(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=cs(t,this.array)),t}setY(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=cs(t,this.array)),t}setZ(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=cs(t,this.array)),t}setW(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=At(t,this.array),r=At(r,this.array)),this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,i){return e*=this.itemSize,this.normalized&&(t=At(t,this.array),r=At(r,this.array),i=At(i,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,t,r,i,s){return e*=this.itemSize,this.normalized&&(t=At(t,this.array),r=At(r,this.array),i=At(i,this.array),s=At(s,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==\\\"\\\"&&(e.name=this.name),this.usage!==qh&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:\\\"dispose\\\"})}},rN=class extends _i{constructor(e,t,r){super(new Uint16Array(e),t,r)}},iN=class extends _i{constructor(e,t,r){super(new Uint32Array(e),t,r)}},sN=class extends _i{constructor(e,t,r){super(new Uint16Array(e),t,r),this.isFloat16BufferAttribute=!0}getX(e){let t=wg(this.array[e*this.itemSize]);return this.normalized&&(t=cs(t,this.array)),t}setX(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize]=Us(t),this}getY(e){let t=wg(this.array[e*this.itemSize+1]);return this.normalized&&(t=cs(t,this.array)),t}setY(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize+1]=Us(t),this}getZ(e){let t=wg(this.array[e*this.itemSize+2]);return this.normalized&&(t=cs(t,this.array)),t}setZ(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize+2]=Us(t),this}getW(e){let t=wg(this.array[e*this.itemSize+3]);return this.normalized&&(t=cs(t,this.array)),t}setW(e,t){return this.normalized&&(t=At(t,this.array)),this.array[e*this.itemSize+3]=Us(t),this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=At(t,this.array),r=At(r,this.array)),this.array[e+0]=Us(t),this.array[e+1]=Us(r),this}setXYZ(e,t,r,i){return e*=this.itemSize,this.normalized&&(t=At(t,this.array),r=At(r,this.array),i=At(i,this.array)),this.array[e+0]=Us(t),this.array[e+1]=Us(r),this.array[e+2]=Us(i),this}setXYZW(e,t,r,i,s){return e*=this.itemSize,this.normalized&&(t=At(t,this.array),r=At(r,this.array),i=At(i,this.array),s=At(s,this.array)),this.array[e+0]=Us(t),this.array[e+1]=Us(r),this.array[e+2]=Us(i),this.array[e+3]=Us(s),this}},tr=class extends _i{constructor(e,t,r){super(new Float32Array(e),t,r)}},I4=new qi,lp=new F,Lv=new F,Ng=class{constructor(e=new F,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let r=this.center;t!==void 0?r.copy(t):I4.setFromPoints(e).getCenter(r);let i=0;for(let s=0,a=e.length;s\\u003ca;s++)i=Math.max(i,r.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius\\u003c0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)\\u003c=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)\\u003c=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))\\u003c=this.radius}clampPoint(e,t){let r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;lp.subVectors(e,this.center);let t=lp.lengthSq();if(t>this.radius*this.radius){let r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(lp,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Lv.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(lp.copy(e.center).add(Lv)),this.expandByPoint(lp.copy(e.center).sub(Lv))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},F4=0,ca=new We,kv=new Hi,od=new F,zs=new qi,up=new qi,wi=new F,ps=class Vk extends hn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,\\\"id\\\",{value:F4++}),this.uuid=dn(),this.name=\\\"\\\",this.type=\\\"BufferGeometry\\\",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(QD(t)?iN:rN)(t,1):this.index=t,this}setIndirect(t,r=0){return this.indirect=t,this.indirectOffset=r,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,r){return this.attributes[t]=r,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,r,i=0){this.groups.push({start:t,count:r,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,r){this.drawRange.start=t,this.drawRange.count=r}applyMatrix4(t){let r=this.attributes.position;r!==void 0&&(r.applyMatrix4(t),r.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let a=new Dr().getNormalMatrix(t);i.applyNormalMatrix(a),i.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(t),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(t){return ca.makeRotationFromQuaternion(t),this.applyMatrix4(ca),this}rotateX(t){return ca.makeRotationX(t),this.applyMatrix4(ca),this}rotateY(t){return ca.makeRotationY(t),this.applyMatrix4(ca),this}rotateZ(t){return ca.makeRotationZ(t),this.applyMatrix4(ca),this}translate(t,r,i){return ca.makeTranslation(t,r,i),this.applyMatrix4(ca),this}scale(t,r,i){return ca.makeScale(t,r,i),this.applyMatrix4(ca),this}lookAt(t){return kv.lookAt(t),kv.updateMatrix(),this.applyMatrix4(kv.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(od).negate(),this.translate(od.x,od.y,od.z),this}setFromPoints(t){let r=this.getAttribute(\\\"position\\\");if(r===void 0){let i=[];for(let s=0,a=t.length;s\\u003ca;s++){let n=t[s];i.push(n.x,n.y,n.z||0)}this.setAttribute(\\\"position\\\",new tr(i,3))}else{let i=Math.min(t.length,r.count);for(let s=0;s\\u003ci;s++){let a=t[s];r.setXYZ(s,a.x,a.y,a.z||0)}t.length>r.count&&Ue(\\\"BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.\\\"),r.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new qi);let t=this.attributes.position,r=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Ce(\\\"BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.\\\",this),this.boundingBox.set(new F(-1/0,-1/0,-1/0),new F(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),r)for(let i=0,s=r.length;i\\u003cs;i++){let a=r[i];zs.setFromBufferAttribute(a),this.morphTargetsRelative?(wi.addVectors(this.boundingBox.min,zs.min),this.boundingBox.expandByPoint(wi),wi.addVectors(this.boundingBox.max,zs.max),this.boundingBox.expandByPoint(wi)):(this.boundingBox.expandByPoint(zs.min),this.boundingBox.expandByPoint(zs.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ce('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The \\\"position\\\" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Ng);let t=this.attributes.position,r=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Ce(\\\"BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.\\\",this),this.boundingSphere.set(new F,1/0);return}if(t){let i=this.boundingSphere.center;if(zs.setFromBufferAttribute(t),r)for(let a=0,n=r.length;a\\u003cn;a++){let o=r[a];up.setFromBufferAttribute(o),this.morphTargetsRelative?(wi.addVectors(zs.min,up.min),zs.expandByPoint(wi),wi.addVectors(zs.max,up.max),zs.expandByPoint(wi)):(zs.expandByPoint(up.min),zs.expandByPoint(up.max))}zs.getCenter(i);let s=0;for(let a=0,n=t.count;a\\u003cn;a++)wi.fromBufferAttribute(t,a),s=Math.max(s,i.distanceToSquared(wi));if(r)for(let a=0,n=r.length;a\\u003cn;a++){let o=r[a],l=this.morphTargetsRelative;for(let u=0,h=o.count;u\\u003ch;u++)wi.fromBufferAttribute(o,u),l&&(od.fromBufferAttribute(t,u),wi.add(od)),s=Math.max(s,i.distanceToSquared(wi))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&Ce('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The \\\"position\\\" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,r=this.attributes;if(t===null||r.position===void 0||r.normal===void 0||r.uv===void 0){Ce(\\\"BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)\\\");return}let i=r.position,s=r.normal,a=r.uv,n=this.getAttribute(\\\"tangent\\\");(n===void 0||n.count!==i.count)&&(n=new _i(new Float32Array(4*i.count),4),this.setAttribute(\\\"tangent\\\",n));let o=[],l=[];for(let E=0;E\\u003ci.count;E++)o[E]=new F,l[E]=new F;let u=new F,h=new F,d=new F,c=new fe,m=new fe,g=new fe,y=new F,b=new F;function v(E,P,I){u.fromBufferAttribute(i,E),h.fromBufferAttribute(i,P),d.fromBufferAttribute(i,I),c.fromBufferAttribute(a,E),m.fromBufferAttribute(a,P),g.fromBufferAttribute(a,I),h.sub(u),d.sub(u),m.sub(c),g.sub(c);let O=1/(m.x*g.y-g.x*m.y);isFinite(O)&&(y.copy(h).multiplyScalar(g.y).addScaledVector(d,-m.y).multiplyScalar(O),b.copy(d).multiplyScalar(m.x).addScaledVector(h,-g.x).multiplyScalar(O),o[E].add(y),o[P].add(y),o[I].add(y),l[E].add(b),l[P].add(b),l[I].add(b))}let S=this.groups;S.length===0&&(S=[{start:0,count:t.count}]);for(let E=0,P=S.length;E\\u003cP;++E){let I=S[E],O=I.start,L=I.count;for(let X=O,z=O+L;X\\u003cz;X+=3)v(t.getX(X+0),t.getX(X+1),t.getX(X+2))}let T=new F,w=new F,N=new F,C=new F;function R(E){N.fromBufferAttribute(s,E),C.copy(N);let P=o[E];T.copy(P),T.sub(N.multiplyScalar(N.dot(P))).normalize(),w.crossVectors(C,P);let I=w.dot(l[E])\\u003c0?-1:1;n.setXYZW(E,T.x,T.y,T.z,I)}for(let E=0,P=S.length;E\\u003cP;++E){let I=S[E],O=I.start,L=I.count;for(let X=O,z=O+L;X\\u003cz;X+=3)R(t.getX(X+0)),R(t.getX(X+1)),R(t.getX(X+2))}this._transformed=!0}computeVertexNormals(){let t=this.index,r=this.getAttribute(\\\"position\\\");if(r!==void 0){let i=this.getAttribute(\\\"normal\\\");if(i===void 0||i.count!==r.count)i=new _i(new Float32Array(r.count*3),3),this.setAttribute(\\\"normal\\\",i);else for(let c=0,m=i.count;c\\u003cm;c++)i.setXYZ(c,0,0,0);let s=new F,a=new F,n=new F,o=new F,l=new F,u=new F,h=new F,d=new F;if(t)for(let c=0,m=t.count;c\\u003cm;c+=3){let g=t.getX(c+0),y=t.getX(c+1),b=t.getX(c+2);s.fromBufferAttribute(r,g),a.fromBufferAttribute(r,y),n.fromBufferAttribute(r,b),h.subVectors(n,a),d.subVectors(s,a),h.cross(d),o.fromBufferAttribute(i,g),l.fromBufferAttribute(i,y),u.fromBufferAttribute(i,b),o.add(h),l.add(h),u.add(h),i.setXYZ(g,o.x,o.y,o.z),i.setXYZ(y,l.x,l.y,l.z),i.setXYZ(b,u.x,u.y,u.z)}else for(let c=0,m=r.count;c\\u003cm;c+=3)s.fromBufferAttribute(r,c+0),a.fromBufferAttribute(r,c+1),n.fromBufferAttribute(r,c+2),h.subVectors(n,a),d.subVectors(s,a),h.cross(d),i.setXYZ(c+0,h.x,h.y,h.z),i.setXYZ(c+1,h.x,h.y,h.z),i.setXYZ(c+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let r=0,i=t.count;r\\u003ci;r++)wi.fromBufferAttribute(t,r),wi.normalize(),t.setXYZ(r,wi.x,wi.y,wi.z)}toNonIndexed(){function t(o,l){let u=o.array,h=o.itemSize,d=o.normalized,c=new u.constructor(l.length*h),m=0,g=0;for(let y=0,b=l.length;y\\u003cb;y++){o.isInterleavedBufferAttribute?m=l[y]*o.data.stride+o.offset:m=l[y]*h;for(let v=0;v\\u003ch;v++)c[g++]=u[m++]}return new _i(c,h,d)}if(this.index===null)return Ue(\\\"BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed.\\\"),this;let r=new Vk,i=this.index.array,s=this.attributes;for(let o in s){let l=s[o],u=t(l,i);r.setAttribute(o,u)}let a=this.morphAttributes;for(let o in a){let l=[],u=a[o];for(let h=0,d=u.length;h\\u003cd;h++){let c=u[h],m=t(c,i);l.push(m)}r.morphAttributes[o]=l}r.morphTargetsRelative=this.morphTargetsRelative;let n=this.groups;for(let o=0,l=n.length;o\\u003cl;o++){let u=n[o];r.addGroup(u.start,u.count,u.materialIndex)}return r}toJSON(){let t={metadata:{version:4.7,type:\\\"BufferGeometry\\\",generator:\\\"BufferGeometry.toJSON\\\"}};if(t.uuid=this.uuid,t.type=this.parameters!==void 0&&this._transformed===!0?\\\"BufferGeometry\\\":this.type,this.name!==\\\"\\\"&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){let l=this.parameters;for(let u in l)l[u]!==void 0&&(t[u]=l[u]);return t}t.data={attributes:{}};let r=this.index;r!==null&&(t.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});let i=this.attributes;for(let l in i){let u=i[l];t.data.attributes[l]=u.toJSON(t.data)}let s={},a=!1;for(let l in this.morphAttributes){let u=this.morphAttributes[l],h=[];for(let d=0,c=u.length;d\\u003cc;d++){let m=u[d];h.push(m.toJSON(t.data))}h.length>0&&(s[l]=h,a=!0)}a&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);let n=this.groups;n.length>0&&(t.data.groups=JSON.parse(JSON.stringify(n)));let o=this.boundingSphere;return o!==null&&(t.data.boundingSphere=o.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let r={};this.name=t.name;let i=t.index;i!==null&&this.setIndex(i.clone());let s=t.attributes;for(let u in s){let h=s[u];this.setAttribute(u,h.clone(r))}let a=t.morphAttributes;for(let u in a){let h=[],d=a[u];for(let c=0,m=d.length;c\\u003cm;c++)h.push(d[c].clone(r));this.morphAttributes[u]=h}this.morphTargetsRelative=t.morphTargetsRelative;let n=t.groups;for(let u=0,h=n.length;u\\u003ch;u++){let d=n[u];this.addGroup(d.start,d.count,d.materialIndex)}let o=t.boundingBox;o!==null&&(this.boundingBox=o.clone());let l=t.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this._transformed=t._transformed,this}dispose(){this.dispatchEvent({type:\\\"dispose\\\"})}},aN=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=qh,this.updateRanges=[],this.version=0,this.uuid=dn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let i=0,s=this.stride;i\\u003cs;i++)this.array[e+i]=t.array[r+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=dn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(t,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=dn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},ms=new F,L4=class Gk{constructor(t,r,i,s=!1){this.isInterleavedBufferAttribute=!0,this.name=\\\"\\\",this.data=t,this.itemSize=r,this.offset=i,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let r=0,i=this.data.count;r\\u003ci;r++)ms.fromBufferAttribute(this,r),ms.applyMatrix4(t),this.setXYZ(r,ms.x,ms.y,ms.z);return this}applyNormalMatrix(t){for(let r=0,i=this.count;r\\u003ci;r++)ms.fromBufferAttribute(this,r),ms.applyNormalMatrix(t),this.setXYZ(r,ms.x,ms.y,ms.z);return this}transformDirection(t){for(let r=0,i=this.count;r\\u003ci;r++)ms.fromBufferAttribute(this,r),ms.transformDirection(t),this.setXYZ(r,ms.x,ms.y,ms.z);return this}getComponent(t,r){let i=this.array[t*this.data.stride+this.offset+r];return this.normalized&&(i=cs(i,this.array)),i}setComponent(t,r,i){return this.normalized&&(i=At(i,this.array)),this.data.array[t*this.data.stride+this.offset+r]=i,this}setX(t,r){return this.normalized&&(r=At(r,this.array)),this.data.array[t*this.data.stride+this.offset]=r,this}setY(t,r){return this.normalized&&(r=At(r,this.array)),this.data.array[t*this.data.stride+this.offset+1]=r,this}setZ(t,r){return this.normalized&&(r=At(r,this.array)),this.data.array[t*this.data.stride+this.offset+2]=r,this}setW(t,r){return this.normalized&&(r=At(r,this.array)),this.data.array[t*this.data.stride+this.offset+3]=r,this}getX(t){let r=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(r=cs(r,this.array)),r}getY(t){let r=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(r=cs(r,this.array)),r}getZ(t){let r=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(r=cs(r,this.array)),r}getW(t){let r=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(r=cs(r,this.array)),r}setXY(t,r,i){return t=t*this.data.stride+this.offset,this.normalized&&(r=At(r,this.array),i=At(i,this.array)),this.data.array[t+0]=r,this.data.array[t+1]=i,this}setXYZ(t,r,i,s){return t=t*this.data.stride+this.offset,this.normalized&&(r=At(r,this.array),i=At(i,this.array),s=At(s,this.array)),this.data.array[t+0]=r,this.data.array[t+1]=i,this.data.array[t+2]=s,this}setXYZW(t,r,i,s,a){return t=t*this.data.stride+this.offset,this.normalized&&(r=At(r,this.array),i=At(i,this.array),s=At(s,this.array),a=At(a,this.array)),this.data.array[t+0]=r,this.data.array[t+1]=i,this.data.array[t+2]=s,this.data.array[t+3]=a,this}clone(t){if(t===void 0){xv(\\\"InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.\\\");let r=[];for(let i=0;i\\u003cthis.count;i++){let s=i*this.data.stride+this.offset;for(let a=0;a\\u003cthis.itemSize;a++)r.push(this.data.array[s+a])}return new _i(new this.array.constructor(r),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Gk(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){xv(\\\"InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.\\\");let r=[];for(let i=0;i\\u003cthis.count;i++){let s=i*this.data.stride+this.offset;for(let a=0;a\\u003cthis.itemSize;a++)r.push(this.data.array[s+a])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:r,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},k4=0,Vs=class extends hn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,\\\"id\\\",{value:k4++}),this.uuid=dn(),this.name=\\\"\\\",this.type=\\\"Material\\\",this.blending=oa,this.side=Cs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=$c,this.blendDst=qc,this.blendEquation=la,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new gt(0,0,0),this.blendAlpha=0,this.depthFunc=zh,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=gv,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=mu,this.stencilZFail=mu,this.stencilZPass=mu,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let r=e[t];if(r===void 0){Ue(`Material: parameter '${t}' has value of undefined.`);continue}let i=this[t];if(i===void 0){Ue(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector2&&r&&r.isVector2||i&&i.isEuler&&r&&r.isEuler||i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){let t=e===void 0||typeof e==\\\"string\\\";t&&(e={textures:{},images:{}});let r={metadata:{version:4.7,type:\\\"Material\\\",generator:\\\"Material.toJSON\\\"}};r.uuid=this.uuid,r.type=this.type,this.name!==\\\"\\\"&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(r.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(r.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==oa&&(r.blending=this.blending),this.side!==Cs&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity\\u003c1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==$c&&(r.blendSrc=this.blendSrc),this.blendDst!==qc&&(r.blendDst=this.blendDst),this.blendEquation!==la&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==zh&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==gv&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==mu&&(r.stencilFail=this.stencilFail),this.stencilZFail!==mu&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==mu&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.allowOverride===!1&&(r.allowOverride=!1),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==\\\"round\\\"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==\\\"round\\\"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){let a=[];for(let n in s){let o=s[n];delete o.metadata,a.push(o)}return a}if(t){let s=i(e.textures),a=i(e.images);s.length>0&&(r.textures=s),a.length>0&&(r.images=a)}return r}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new gt().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors==\\\"number\\\"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),this.normalScale=new fe().fromArray(r)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new fe().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,r=null;if(t!==null){let i=t.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=t[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:\\\"dispose\\\"})}set needsUpdate(e){e===!0&&this.version++}},D4=class extends Vs{constructor(e){super(),this.isSpriteMaterial=!0,this.type=\\\"SpriteMaterial\\\",this.color=new gt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},co=new F,Dv=new F,Ag=new F,sl=new F,Ov=new F,Cg=new F,Uv=new F,ld=class{constructor(e=new F,t=new F(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,co)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let r=t.dot(this.direction);return r\\u003c0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=co.subVectors(e,this.origin).dot(this.direction);return t\\u003c0?this.origin.distanceToSquared(e):(co.copy(this.origin).addScaledVector(this.direction,t),co.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){Dv.copy(e).add(t).multiplyScalar(.5),Ag.copy(t).sub(e).normalize(),sl.copy(this.origin).sub(Dv);let s=e.distanceTo(t)*.5,a=-this.direction.dot(Ag),n=sl.dot(this.direction),o=-sl.dot(Ag),l=sl.lengthSq(),u=Math.abs(1-a*a),h,d,c,m;if(u>0)if(h=a*o-n,d=a*n-o,m=s*u,h>=0)if(d>=-m)if(d\\u003c=m){let g=1/u;h*=g,d*=g,c=h*(h+a*d+2*n)+d*(a*h+d+2*o)+l}else d=s,h=Math.max(0,-(a*d+n)),c=-h*h+d*(d+2*o)+l;else d=-s,h=Math.max(0,-(a*d+n)),c=-h*h+d*(d+2*o)+l;else d\\u003c=-m?(h=Math.max(0,-(-a*s+n)),d=h>0?-s:Math.min(Math.max(-s,-o),s),c=-h*h+d*(d+2*o)+l):d\\u003c=m?(h=0,d=Math.min(Math.max(-s,-o),s),c=d*(d+2*o)+l):(h=Math.max(0,-(a*s+n)),d=h>0?s:Math.min(Math.max(-s,-o),s),c=-h*h+d*(d+2*o)+l);else d=a>0?-s:s,h=Math.max(0,-(a*d+n)),c=-h*h+d*(d+2*o)+l;return r&&r.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(Dv).addScaledVector(Ag,d),c}intersectSphere(e,t){co.subVectors(e.center,this.origin);let r=co.dot(this.direction),i=co.dot(co)-r*r,s=e.radius*e.radius;if(i>s)return null;let a=Math.sqrt(s-i),n=r-a,o=r+a;return o\\u003c0?null:n\\u003c0?this.at(o,t):this.at(n,t)}intersectsSphere(e){return e.radius\\u003c0?!1:this.distanceSqToPoint(e.center)\\u003c=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){let r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t\\u003c0}intersectBox(e,t){let r,i,s,a,n,o,l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(r=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(r=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),u>=0?(s=(e.min.y-d.y)*u,a=(e.max.y-d.y)*u):(s=(e.max.y-d.y)*u,a=(e.min.y-d.y)*u),r>a||s>i||((s>r||isNaN(r))&&(r=s),(a\\u003ci||isNaN(i))&&(i=a),h>=0?(n=(e.min.z-d.z)*h,o=(e.max.z-d.z)*h):(n=(e.max.z-d.z)*h,o=(e.min.z-d.z)*h),r>o||n>i)||((n>r||r!==r)&&(r=n),(o\\u003ci||i!==i)&&(i=o),i\\u003c0)?null:this.at(r>=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,co)!==null}intersectTriangle(e,t,r,i,s){Ov.subVectors(t,e),Cg.subVectors(r,e),Uv.crossVectors(Ov,Cg);let a=this.direction.dot(Uv),n;if(a>0){if(i)return null;n=1}else if(a\\u003c0)n=-1,a=-a;else return null;sl.subVectors(this.origin,e);let o=n*this.direction.dot(Cg.crossVectors(sl,Cg));if(o\\u003c0)return null;let l=n*this.direction.dot(Ov.cross(sl));if(l\\u003c0||o+l>a)return null;let u=-n*sl.dot(Uv);return u\\u003c0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},mn=class extends Vs{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=\\\"MeshBasicMaterial\\\",this.color=new gt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new cn,this.combine=Ff,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\\\"round\\\",this.wireframeLinejoin=\\\"round\\\",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},nN=new We,xu=new ld,Rg=new Ng,oN=new F,Eg=new F,Pg=new F,Bg=new F,zv=new F,Ig=new F,lN=new F,Fg=new F,Mi=class extends Hi{constructor(e=new ps,t=new mn){super(),this.isMesh=!0,this.type=\\\"Mesh\\\",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let r=e[t[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let i=0,s=r.length;i\\u003cs;i++){let a=r[i].name||String(i);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=i}}}}getVertexPosition(e,t){let r=this.geometry,i=r.attributes.position,s=r.morphAttributes.position,a=r.morphTargetsRelative;t.fromBufferAttribute(i,e);let n=this.morphTargetInfluences;if(s&&n){Ig.set(0,0,0);for(let o=0,l=s.length;o\\u003cl;o++){let u=n[o],h=s[o];u!==0&&(zv.fromBufferAttribute(h,e),a?Ig.addScaledVector(zv,u):Ig.addScaledVector(zv.sub(t),u))}t.add(Ig)}return t}raycast(e,t){let r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),Rg.copy(r.boundingSphere),Rg.applyMatrix4(s),xu.copy(e.ray).recast(e.near),!(Rg.containsPoint(xu.origin)===!1&&(xu.intersectSphere(Rg,oN)===null||xu.origin.distanceToSquared(oN)>(e.far-e.near)**2))&&(nN.copy(s).invert(),xu.copy(e.ray).applyMatrix4(nN),!(r.boundingBox!==null&&xu.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,t,xu)))}_computeIntersections(e,t,r){let i,s=this.geometry,a=this.material,n=s.index,o=s.attributes.position,l=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,d=s.groups,c=s.drawRange;if(n!==null)if(Array.isArray(a))for(let m=0,g=d.length;m\\u003cg;m++){let y=d[m],b=a[y.materialIndex],v=Math.max(y.start,c.start),S=Math.min(n.count,Math.min(y.start+y.count,c.start+c.count));for(let T=v,w=S;T\\u003cw;T+=3){let N=n.getX(T),C=n.getX(T+1),R=n.getX(T+2);i=Lg(this,b,e,r,l,u,h,N,C,R),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=y.materialIndex,t.push(i))}}else{let m=Math.max(0,c.start),g=Math.min(n.count,c.start+c.count);for(let y=m,b=g;y\\u003cb;y+=3){let v=n.getX(y),S=n.getX(y+1),T=n.getX(y+2);i=Lg(this,a,e,r,l,u,h,v,S,T),i&&(i.faceIndex=Math.floor(y/3),t.push(i))}}else if(o!==void 0)if(Array.isArray(a))for(let m=0,g=d.length;m\\u003cg;m++){let y=d[m],b=a[y.materialIndex],v=Math.max(y.start,c.start),S=Math.min(o.count,Math.min(y.start+y.count,c.start+c.count));for(let T=v,w=S;T\\u003cw;T+=3){let N=T,C=T+1,R=T+2;i=Lg(this,b,e,r,l,u,h,N,C,R),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=y.materialIndex,t.push(i))}}else{let m=Math.max(0,c.start),g=Math.min(o.count,c.start+c.count);for(let y=m,b=g;y\\u003cb;y+=3){let v=y,S=y+1,T=y+2;i=Lg(this,a,e,r,l,u,h,v,S,T),i&&(i.faceIndex=Math.floor(y/3),t.push(i))}}}};function O4(e,t,r,i,s,a,n,o){let l;if(t.side===ii?l=i.intersectTriangle(n,a,s,!0,o):l=i.intersectTriangle(s,a,n,t.side===Cs,o),l===null)return null;Fg.copy(o),Fg.applyMatrix4(e.matrixWorld);let u=r.ray.origin.distanceTo(Fg);return u\\u003cr.near||u>r.far?null:{distance:u,point:Fg.clone(),object:e}}function Lg(e,t,r,i,s,a,n,o,l,u){e.getVertexPosition(o,Eg),e.getVertexPosition(l,Pg),e.getVertexPosition(u,Bg);let h=O4(e,t,r,i,Eg,Pg,Bg,lN);if(h){let d=new F;$i.getBarycoord(lN,Eg,Pg,Bg,d),s&&(h.uv=$i.getInterpolatedAttribute(s,o,l,u,d,new fe)),a&&(h.uv1=$i.getInterpolatedAttribute(a,o,l,u,d,new fe)),n&&(h.normal=$i.getInterpolatedAttribute(n,o,l,u,d,new F),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));let c={a:o,b:l,c:u,normal:new F,materialIndex:0};$i.getNormal(Eg,Pg,Bg,c.normal),h.face=c,h.barycoord=d}return h}var kg=class extends ji{constructor(e=null,t=1,r=1,i,s,a,n,o,l=or,u=or,h,d){super(null,a,n,o,l,u,i,s,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},ud=class extends _i{constructor(e,t,r,i=1){super(e,t,r),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}},Vv=new F,U4=new F,z4=new Dr,fn=class{constructor(e=new F(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){let i=Vv.subVectors(r,t).cross(U4.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,r=!0){let i=e.delta(Vv),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/s;return r===!0&&(a\\u003c0||a>1)?null:t.copy(e.start).addScaledVector(i,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t\\u003c0&&r>0||r\\u003c0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let r=t||z4.getNormalMatrix(e),i=this.coplanarPoint(Vv).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},vu=new Ng,V4=new fe(.5,.5),Dg=new F,Og=class{constructor(e=new fn,t=new fn,r=new fn,i=new fn,s=new fn,a=new fn){this.planes=[e,t,r,i,s,a]}set(e,t,r,i,s,a){let n=this.planes;return n[0].copy(e),n[1].copy(t),n[2].copy(r),n[3].copy(i),n[4].copy(s),n[5].copy(a),this}copy(e){let t=this.planes;for(let r=0;r\\u003c6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,t=Ds,r=!1){let i=this.planes,s=e.elements,a=s[0],n=s[1],o=s[2],l=s[3],u=s[4],h=s[5],d=s[6],c=s[7],m=s[8],g=s[9],y=s[10],b=s[11],v=s[12],S=s[13],T=s[14],w=s[15];if(i[0].setComponents(l-a,c-u,b-m,w-v).normalize(),i[1].setComponents(l+a,c+u,b+m,w+v).normalize(),i[2].setComponents(l+n,c+h,b+g,w+S).normalize(),i[3].setComponents(l-n,c-h,b-g,w-S).normalize(),r)i[4].setComponents(o,d,y,T).normalize(),i[5].setComponents(l-o,c-d,b-y,w-T).normalize();else if(i[4].setComponents(l-o,c-d,b-y,w-T).normalize(),t===Ds)i[5].setComponents(l+o,c+d,b+y,w+T).normalize();else if(t===da)i[5].setComponents(o,d,y,T).normalize();else throw new Error(\\\"THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: \\\"+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),vu.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),vu.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(vu)}intersectsSprite(e){vu.center.set(0,0,0);let t=V4.distanceTo(e.center);return vu.radius=.7071067811865476+t,vu.applyMatrix4(e.matrixWorld),this.intersectsSphere(vu)}intersectsSphere(e){let t=this.planes,r=e.center,i=-e.radius;for(let s=0;s\\u003c6;s++)if(t[s].distanceToPoint(r)\\u003ci)return!1;return!0}intersectsBox(e){let t=this.planes;for(let r=0;r\\u003c6;r++){let i=t[r];if(Dg.x=i.normal.x>0?e.max.x:e.min.x,Dg.y=i.normal.y>0?e.max.y:e.min.y,Dg.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Dg)\\u003c0)return!1}return!0}containsPoint(e){let t=this.planes;for(let r=0;r\\u003c6;r++)if(t[r].distanceToPoint(e)\\u003c0)return!1;return!0}clone(){return new this.constructor().copy(this)}},uN=new We,G4=class Wk{constructor(){this.coordinateSystem=Ds,this._frustums=[],this._count=0}setFromArrayCamera(t){let r=t.cameras,i=this._frustums;for(let s=0;s\\u003cr.length;s++){let a=r[s];uN.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),i[s]===void 0&&(i[s]=new Og),i[s].setFromProjectionMatrix(uN,a.coordinateSystem,a.reversedDepth)}return this._count=r.length,this}intersectsObject(t){let r=this._frustums;for(let i=0;i\\u003cthis._count;i++)if(r[i].intersectsObject(t))return!0;return!1}intersectsSprite(t){let r=this._frustums;for(let i=0;i\\u003cthis._count;i++)if(r[i].intersectsSprite(t))return!0;return!1}intersectsSphere(t){let r=this._frustums;for(let i=0;i\\u003cthis._count;i++)if(r[i].intersectsSphere(t))return!0;return!1}intersectsBox(t){let r=this._frustums;for(let i=0;i\\u003cthis._count;i++)if(r[i].intersectsBox(t))return!0;return!1}containsPoint(t){let r=this._frustums;for(let i=0;i\\u003cthis._count;i++)if(r[i].containsPoint(t))return!0;return!1}copy(t){this.coordinateSystem=t.coordinateSystem;let r=this._frustums,i=t._frustums;for(let s=0;s\\u003ct._count;s++)r[s]===void 0&&(r[s]=new Og),r[s].copy(i[s]);return this._count=t._count,this}clone(){return new Wk().copy(this)}},hN=class extends Vs{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=\\\"LineBasicMaterial\\\",this.color=new gt(16777215),this.map=null,this.linewidth=1,this.linecap=\\\"round\\\",this.linejoin=\\\"round\\\",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},W4=class extends Vs{constructor(e){super(),this.isPointsMaterial=!0,this.type=\\\"PointsMaterial\\\",this.color=new gt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Gv=class extends ji{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=or,this.minFilter=or,this.generateMipmaps=!1,this.needsUpdate=!0}},Ug=class extends ji{constructor(e=[],t=Vh,r,i,s,a,n,o,l,u){super(e,t,r,i,s,a,n,o,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},j4=class extends ji{constructor(e,t,r,i,s,a,n,o,l){super(e,t,r,i,s,a,n,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},fs=class extends ji{constructor(e,t,r=gr,i,s,a,n=or,o=or,l,u=ua,h=1){if(u!==ua&&u!==ln)throw new Error(\\\"THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat\\\");let d={width:e,height:t,depth:h};super(d,i,s,a,n,o,u,r,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Sv(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},H4=class extends fs{constructor(e,t=gr,r=Vh,i,s,a=or,n=or,o,l=ua){let u={width:e,height:e,depth:1},h=[u,u,u,u,u,u];super(e,e,t,r,i,s,a,n,o,l),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}},Wv=class jk extends ps{constructor(t=1,r=1,i=1,s=1,a=1,n=1){super(),this.type=\\\"BoxGeometry\\\",this.parameters={width:t,height:r,depth:i,widthSegments:s,heightSegments:a,depthSegments:n};let o=this;s=Math.floor(s),a=Math.floor(a),n=Math.floor(n);let l=[],u=[],h=[],d=[],c=0,m=0;g(\\\"z\\\",\\\"y\\\",\\\"x\\\",-1,-1,i,r,t,n,a,0),g(\\\"z\\\",\\\"y\\\",\\\"x\\\",1,-1,i,r,-t,n,a,1),g(\\\"x\\\",\\\"z\\\",\\\"y\\\",1,1,t,i,r,s,n,2),g(\\\"x\\\",\\\"z\\\",\\\"y\\\",1,-1,t,i,-r,s,n,3),g(\\\"x\\\",\\\"y\\\",\\\"z\\\",1,-1,t,r,i,s,a,4),g(\\\"x\\\",\\\"y\\\",\\\"z\\\",-1,-1,t,r,-i,s,a,5),this.setIndex(l),this.setAttribute(\\\"position\\\",new tr(u,3)),this.setAttribute(\\\"normal\\\",new tr(h,3)),this.setAttribute(\\\"uv\\\",new tr(d,2));function g(y,b,v,S,T,w,N,C,R,E,P){let I=w/R,O=N/E,L=w/2,X=N/2,z=C/2,H=R+1,ue=E+1,ne=0,re=0,ce=new F;for(let ge=0;ge\\u003cue;ge++){let ye=ge*O-X;for(let oe=0;oe\\u003cH;oe++){let Ae=oe*I-L;ce[y]=Ae*S,ce[b]=ye*T,ce[v]=z,u.push(ce.x,ce.y,ce.z),ce[y]=0,ce[b]=0,ce[v]=C>0?1:-1,h.push(ce.x,ce.y,ce.z),d.push(oe/R),d.push(1-ge/E),ne+=1}}for(let ge=0;ge\\u003cE;ge++)for(let ye=0;ye\\u003cR;ye++){let oe=c+ye+H*ge,Ae=c+ye+H*(ge+1),Ie=c+(ye+1)+H*(ge+1),Xe=c+(ye+1)+H*ge;l.push(oe,Ae,Xe),l.push(Ae,Ie,Xe),re+=6}o.addGroup(m,re,P),m+=re,c+=ne}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new jk(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}},X4=class Hk extends ps{constructor(t=1,r=1,i=1,s=32,a=1,n=!1,o=0,l=Math.PI*2){super(),this.type=\\\"CylinderGeometry\\\",this.parameters={radiusTop:t,radiusBottom:r,height:i,radialSegments:s,heightSegments:a,openEnded:n,thetaStart:o,thetaLength:l};let u=this;s=Math.floor(s),a=Math.floor(a);let h=[],d=[],c=[],m=[],g=0,y=[],b=i/2,v=0;S(),n===!1&&(t>0&&T(!0),r>0&&T(!1)),this.setIndex(h),this.setAttribute(\\\"position\\\",new tr(d,3)),this.setAttribute(\\\"normal\\\",new tr(c,3)),this.setAttribute(\\\"uv\\\",new tr(m,2));function S(){let w=new F,N=new F,C=0,R=(r-t)/i;for(let E=0;E\\u003c=a;E++){let P=[],I=E/a,O=I*(r-t)+t;for(let L=0;L\\u003c=s;L++){let X=L/s,z=X*l+o,H=Math.sin(z),ue=Math.cos(z);N.x=O*H,N.y=-I*i+b,N.z=O*ue,d.push(N.x,N.y,N.z),w.set(H,R,ue).normalize(),c.push(w.x,w.y,w.z),m.push(X,1-I),P.push(g++)}y.push(P)}for(let E=0;E\\u003cs;E++)for(let P=0;P\\u003ca;P++){let I=y[P][E],O=y[P+1][E],L=y[P+1][E+1],X=y[P][E+1];(t>0||P!==0)&&(h.push(I,O,X),C+=3),(r>0||P!==a-1)&&(h.push(O,L,X),C+=3)}u.addGroup(v,C,0),v+=C}function T(w){let N=g,C=new fe,R=new F,E=0,P=w===!0?t:r,I=w===!0?1:-1;for(let L=1;L\\u003c=s;L++)d.push(0,b*I,0),c.push(0,I,0),m.push(.5,.5),g++;let O=g;for(let L=0;L\\u003c=s;L++){let X=L/s*l+o,z=Math.cos(X),H=Math.sin(X);R.x=P*H,R.y=b*I,R.z=P*z,d.push(R.x,R.y,R.z),c.push(0,I,0),C.x=z*.5+.5,C.y=H*.5*I+.5,m.push(C.x,C.y),g++}for(let L=0;L\\u003cs;L++){let X=N+L,z=O+L;w===!0?h.push(z,z+1,X):h.push(z+1,z,X),E+=3}u.addGroup(v,E,w===!0?1:2),v+=E}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Hk(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}},jv=class Xk extends ps{constructor(t=[],r=[],i=1,s=0){super(),this.type=\\\"PolyhedronGeometry\\\",this.parameters={vertices:t,indices:r,radius:i,detail:s};let a=[],n=[];o(s),u(i),h(),this.setAttribute(\\\"position\\\",new tr(a,3)),this.setAttribute(\\\"normal\\\",new tr(a.slice(),3)),this.setAttribute(\\\"uv\\\",new tr(n,2)),s===0?this.computeVertexNormals():this.normalizeNormals();function o(S){let T=new F,w=new F,N=new F;for(let C=0;C\\u003cr.length;C+=3)m(r[C+0],T),m(r[C+1],w),m(r[C+2],N),l(T,w,N,S)}function l(S,T,w,N){let C=N+1,R=[];for(let E=0;E\\u003c=C;E++){R[E]=[];let P=S.clone().lerp(w,E/C),I=T.clone().lerp(w,E/C),O=C-E;for(let L=0;L\\u003c=O;L++)L===0&&E===C?R[E][L]=P:R[E][L]=P.clone().lerp(I,L/O)}for(let E=0;E\\u003cC;E++)for(let P=0;P\\u003c2*(C-E)-1;P++){let I=Math.floor(P/2);P%2===0?(c(R[E][I+1]),c(R[E+1][I]),c(R[E][I])):(c(R[E][I+1]),c(R[E+1][I+1]),c(R[E+1][I]))}}function u(S){let T=new F;for(let w=0;w\\u003ca.length;w+=3)T.x=a[w+0],T.y=a[w+1],T.z=a[w+2],T.normalize().multiplyScalar(S),a[w+0]=T.x,a[w+1]=T.y,a[w+2]=T.z}function h(){let S=new F;for(let T=0;T\\u003ca.length;T+=3){S.x=a[T+0],S.y=a[T+1],S.z=a[T+2];let w=b(S)/2/Math.PI+.5,N=v(S)/Math.PI+.5;n.push(w,1-N)}g(),d()}function d(){for(let S=0;S\\u003cn.length;S+=6){let T=n[S+0],w=n[S+2],N=n[S+4],C=Math.max(T,w,N),R=Math.min(T,w,N);C>.9&&R\\u003c.1&&(T\\u003c.2&&(n[S+0]+=1),w\\u003c.2&&(n[S+2]+=1),N\\u003c.2&&(n[S+4]+=1))}}function c(S){a.push(S.x,S.y,S.z)}function m(S,T){let w=S*3;T.x=t[w+0],T.y=t[w+1],T.z=t[w+2]}function g(){let S=new F,T=new F,w=new F,N=new F,C=new fe,R=new fe,E=new fe;for(let P=0,I=0;P\\u003ca.length;P+=9,I+=6){S.set(a[P+0],a[P+1],a[P+2]),T.set(a[P+3],a[P+4],a[P+5]),w.set(a[P+6],a[P+7],a[P+8]),C.set(n[I+0],n[I+1]),R.set(n[I+2],n[I+3]),E.set(n[I+4],n[I+5]),N.copy(S).add(T).add(w).divideScalar(3);let O=b(N);y(C,I+0,S,O),y(R,I+2,T,O),y(E,I+4,w,O)}}function y(S,T,w,N){N\\u003c0&&S.x===1&&(n[T]=S.x-1),w.x===0&&w.z===0&&(n[T]=N/2/Math.PI+.5)}function b(S){return Math.atan2(S.z,-S.x)}function v(S){return Math.atan2(-S.y,Math.sqrt(S.x*S.x+S.z*S.z))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Xk(t.vertices,t.indices,t.radius,t.detail)}},gn=class{constructor(){this.type=\\\"Curve\\\",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Ue(\\\"Curve: .getPoint() not implemented.\\\")}getPointAt(e,t){let r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){let t=[];for(let r=0;r\\u003c=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){let t=[];for(let r=0;r\\u003c=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],r,i=this.getPoint(0),s=0;t.push(0);for(let a=1;a\\u003c=e;a++)r=this.getPoint(a/e),s+=r.distanceTo(i),t.push(s),i=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let r=this.getLengths(),i=0,s=r.length,a;t?a=t:a=e*r[s-1];let n=0,o=s-1,l;for(;n\\u003c=o;)if(i=Math.floor(n+(o-n)/2),l=r[i]-a,l\\u003c0)n=i+1;else if(l>0)o=i-1;else{o=i;break}if(i=o,r[i]===a)return i/(s-1);let u=r[i],h=r[i+1]-u,d=(a-u)/h;return(i+d)/(s-1)}getTangent(e,t){let r=e-1e-4,i=e+1e-4;r\\u003c0&&(r=0),i>1&&(i=1);let s=this.getPoint(r),a=this.getPoint(i),n=t||(s.isVector2?new fe:new F);return n.copy(a).sub(s).normalize(),n}getTangentAt(e,t){let r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t=!1){let r=new F,i=[],s=[],a=[],n=new F,o=new We;for(let c=0;c\\u003c=e;c++){let m=c/e;i[c]=this.getTangentAt(m,new F)}s[0]=new F,a[0]=new F;let l=Number.MAX_VALUE,u=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);u\\u003c=l&&(l=u,r.set(1,0,0)),h\\u003c=l&&(l=h,r.set(0,1,0)),d\\u003c=l&&r.set(0,0,1),n.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],n),a[0].crossVectors(i[0],s[0]);for(let c=1;c\\u003c=e;c++){if(s[c]=s[c-1].clone(),a[c]=a[c-1].clone(),n.crossVectors(i[c-1],i[c]),n.length()>Number.EPSILON){n.normalize();let m=Math.acos(St(i[c-1].dot(i[c]),-1,1));s[c].applyMatrix4(o.makeRotationAxis(n,m))}a[c].crossVectors(i[c],s[c])}if(t===!0){let c=Math.acos(St(s[0].dot(s[e]),-1,1));c/=e,i[0].dot(n.crossVectors(s[0],s[e]))>0&&(c=-c);for(let m=1;m\\u003c=e;m++)s[m].applyMatrix4(o.makeRotationAxis(i[m],c*m)),a[m].crossVectors(i[m],s[m])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:\\\"Curve\\\",generator:\\\"Curve.toJSON\\\"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},Hv=class extends gn{constructor(e=0,t=0,r=1,i=1,s=0,a=Math.PI*2,n=!1,o=0){super(),this.isEllipseCurve=!0,this.type=\\\"EllipseCurve\\\",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=n,this.aRotation=o}getPoint(e,t=new fe){let r=t,i=Math.PI*2,s=this.aEndAngle-this.aStartAngle,a=Math.abs(s)\\u003cNumber.EPSILON;for(;s\\u003c0;)s+=i;for(;s>i;)s-=i;s\\u003cNumber.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);let n=this.aStartAngle+e*s,o=this.aX+this.xRadius*Math.cos(n),l=this.aY+this.yRadius*Math.sin(n);if(this.aRotation!==0){let u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=o-this.aX,c=l-this.aY;o=d*u-c*h+this.aX,l=d*h+c*u+this.aY}return r.set(o,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},$4=class extends Hv{constructor(e,t,r,i,s,a){super(e,t,r,r,i,s,a),this.isArcCurve=!0,this.type=\\\"ArcCurve\\\"}};function Xv(){let e=0,t=0,r=0,i=0;function s(a,n,o,l){e=a,t=o,r=-3*a+3*n-2*o-l,i=2*a-2*n+o+l}return{initCatmullRom:function(a,n,o,l,u){s(n,o,u*(o-a),u*(l-n))},initNonuniformCatmullRom:function(a,n,o,l,u,h,d){let c=(n-a)/u-(o-a)/(u+h)+(o-n)/h,m=(o-n)/h-(l-n)/(h+d)+(l-o)/d;c*=h,m*=h,s(n,o,c,m)},calc:function(a){let n=a*a,o=n*a;return e+t*a+r*n+i*o}}}var dN=new F,cN=new F,$v=new Xv,qv=new Xv,Yv=new Xv,q4=class extends gn{constructor(e=[],t=!1,r=\\\"centripetal\\\",i=.5){super(),this.isCatmullRomCurve3=!0,this.type=\\\"CatmullRomCurve3\\\",this.points=e,this.closed=t,this.curveType=r,this.tension=i}getPoint(e,t=new F){let r=t,i=this.points,s=i.length,a=(s-(this.closed?0:1))*e,n=Math.floor(a),o=a-n;this.closed?n+=n>0?0:(Math.floor(Math.abs(n)/s)+1)*s:o===0&&n===s-1&&(n=s-2,o=1);let l,u;this.closed||n>0?l=i[(n-1)%s]:(cN.subVectors(i[0],i[1]).add(i[0]),l=cN);let h=i[n%s],d=i[(n+1)%s];if(this.closed||n+2\\u003cs?u=i[(n+2)%s]:(dN.subVectors(i[s-1],i[s-2]).add(i[s-1]),u=dN),this.curveType===\\\"centripetal\\\"||this.curveType===\\\"chordal\\\"){let c=this.curveType===\\\"chordal\\\"?.5:.25,m=Math.pow(l.distanceToSquared(h),c),g=Math.pow(h.distanceToSquared(d),c),y=Math.pow(d.distanceToSquared(u),c);g\\u003c1e-4&&(g=1),m\\u003c1e-4&&(m=g),y\\u003c1e-4&&(y=g),$v.initNonuniformCatmullRom(l.x,h.x,d.x,u.x,m,g,y),qv.initNonuniformCatmullRom(l.y,h.y,d.y,u.y,m,g,y),Yv.initNonuniformCatmullRom(l.z,h.z,d.z,u.z,m,g,y)}else this.curveType===\\\"catmullrom\\\"&&($v.initCatmullRom(l.x,h.x,d.x,u.x,this.tension),qv.initCatmullRom(l.y,h.y,d.y,u.y,this.tension),Yv.initCatmullRom(l.z,h.z,d.z,u.z,this.tension));return r.set($v.calc(o),qv.calc(o),Yv.calc(o)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t\\u003cr;t++){let i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t\\u003cr;t++){let i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t\\u003cr;t++){let i=e.points[t];this.points.push(new F().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function pN(e,t,r,i,s){let a=(i-t)*.5,n=(s-r)*.5,o=e*e,l=e*o;return(2*r-2*i+a+n)*l+(-3*r+3*i-2*a-n)*o+a*e+r}function Y4(e,t){let r=1-e;return r*r*t}function Z4(e,t){return 2*(1-e)*e*t}function J4(e,t){return e*e*t}function hp(e,t,r,i){return Y4(e,t)+Z4(e,r)+J4(e,i)}function Q4(e,t){let r=1-e;return r*r*r*t}function K4(e,t){let r=1-e;return 3*r*r*e*t}function eO(e,t){return 3*(1-e)*e*e*t}function tO(e,t){return e*e*e*t}function dp(e,t,r,i,s){return Q4(e,t)+K4(e,r)+eO(e,i)+tO(e,s)}var mN=class extends gn{constructor(e=new fe,t=new fe,r=new fe,i=new fe){super(),this.isCubicBezierCurve=!0,this.type=\\\"CubicBezierCurve\\\",this.v0=e,this.v1=t,this.v2=r,this.v3=i}getPoint(e,t=new fe){let r=t,i=this.v0,s=this.v1,a=this.v2,n=this.v3;return r.set(dp(e,i.x,s.x,a.x,n.x),dp(e,i.y,s.y,a.y,n.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},rO=class extends gn{constructor(e=new F,t=new F,r=new F,i=new F){super(),this.isCubicBezierCurve3=!0,this.type=\\\"CubicBezierCurve3\\\",this.v0=e,this.v1=t,this.v2=r,this.v3=i}getPoint(e,t=new F){let r=t,i=this.v0,s=this.v1,a=this.v2,n=this.v3;return r.set(dp(e,i.x,s.x,a.x,n.x),dp(e,i.y,s.y,a.y,n.y),dp(e,i.z,s.z,a.z,n.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},fN=class extends gn{constructor(e=new fe,t=new fe){super(),this.isLineCurve=!0,this.type=\\\"LineCurve\\\",this.v1=e,this.v2=t}getPoint(e,t=new fe){let r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new fe){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},iO=class extends gn{constructor(e=new F,t=new F){super(),this.isLineCurve3=!0,this.type=\\\"LineCurve3\\\",this.v1=e,this.v2=t}getPoint(e,t=new F){let r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new F){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},gN=class extends gn{constructor(e=new fe,t=new fe,r=new fe){super(),this.isQuadraticBezierCurve=!0,this.type=\\\"QuadraticBezierCurve\\\",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new fe){let r=t,i=this.v0,s=this.v1,a=this.v2;return r.set(hp(e,i.x,s.x,a.x),hp(e,i.y,s.y,a.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},sO=class extends gn{constructor(e=new F,t=new F,r=new F){super(),this.isQuadraticBezierCurve3=!0,this.type=\\\"QuadraticBezierCurve3\\\",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new F){let r=t,i=this.v0,s=this.v1,a=this.v2;return r.set(hp(e,i.x,s.x,a.x),hp(e,i.y,s.y,a.y),hp(e,i.z,s.z,a.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},yN=class extends gn{constructor(e=[]){super(),this.isSplineCurve=!0,this.type=\\\"SplineCurve\\\",this.points=e}getPoint(e,t=new fe){let r=t,i=this.points,s=(i.length-1)*e,a=Math.floor(s),n=s-a,o=i[a===0?a:a-1],l=i[a],u=i[a>i.length-2?i.length-1:a+1],h=i[a>i.length-3?i.length-1:a+2];return r.set(pN(n,o.x,l.x,u.x,h.x),pN(n,o.y,l.y,u.y,h.y)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t\\u003cr;t++){let i=e.points[t];this.points.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t\\u003cr;t++){let i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t\\u003cr;t++){let i=e.points[t];this.points.push(new fe().fromArray(i))}return this}},Zv=Object.freeze({__proto__:null,ArcCurve:$4,CatmullRomCurve3:q4,CubicBezierCurve:mN,CubicBezierCurve3:rO,EllipseCurve:Hv,LineCurve:fN,LineCurve3:iO,QuadraticBezierCurve:gN,QuadraticBezierCurve3:sO,SplineCurve:yN}),aO=class extends gn{constructor(){super(),this.type=\\\"CurvePath\\\",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let r=e.isVector2===!0?\\\"LineCurve\\\":\\\"LineCurve3\\\";this.curves.push(new Zv[r](t,e))}return this}getPoint(e,t){let r=e*this.getLength(),i=this.getCurveLengths(),s=0;for(;s\\u003ci.length;){if(i[s]>=r){let a=i[s]-r,n=this.curves[s],o=n.getLength(),l=o===0?0:1-a/o;return n.getPointAt(l,t)}s++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let r=0,i=this.curves.length;r\\u003ci;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let r=0;r\\u003c=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],r;for(let i=0,s=this.curves;i\\u003cs.length;i++){let a=s[i],n=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,o=a.getPoints(n);for(let l=0;l\\u003co.length;l++){let u=o[l];r&&r.equals(u)||(t.push(u),r=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,r=e.curves.length;t\\u003cr;t++){let i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,r=this.curves.length;t\\u003cr;t++){let i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,r=e.curves.length;t\\u003cr;t++){let i=e.curves[t];this.curves.push(new Zv[i.type]().fromJSON(i))}return this}},po=class extends aO{constructor(e){super(),this.type=\\\"Path\\\",this.currentPoint=new fe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,r=e.length;t\\u003cr;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let r=new fN(this.currentPoint.clone(),new fe(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,i){let s=new gN(this.currentPoint.clone(),new fe(e,t),new fe(r,i));return this.curves.push(s),this.currentPoint.set(r,i),this}bezierCurveTo(e,t,r,i,s,a){let n=new mN(this.currentPoint.clone(),new fe(e,t),new fe(r,i),new fe(s,a));return this.curves.push(n),this.currentPoint.set(s,a),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),r=new yN(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,i,s,a){let n=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+n,t+o,r,i,s,a),this}absarc(e,t,r,i,s,a){return this.absellipse(e,t,r,r,i,s,a),this}ellipse(e,t,r,i,s,a,n,o){let l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,r,i,s,a,n,o),this}absellipse(e,t,r,i,s,a,n,o){let l=new Hv(e,t,r,i,s,a,n,o);if(this.curves.length>0){let h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);let u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},cp=class extends po{constructor(e){super(e),this.uuid=dn(),this.type=\\\"Shape\\\",this.holes=[]}getPointsHoles(e){let t=[];for(let r=0,i=this.holes.length;r\\u003ci;r++)t[r]=this.holes[r].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,r=e.holes.length;t\\u003cr;t++){let i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,r=this.holes.length;t\\u003cr;t++){let i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,r=e.holes.length;t\\u003cr;t++){let i=e.holes[t];this.holes.push(new po().fromJSON(i))}return this}};function nO(e,t,r=2){let i=t&&t.length,s=i?t[0]*r:e.length,a=xN(e,0,s,r,!0),n=[];if(!a||a.next===a.prev)return n;let o,l,u;if(i&&(a=dO(e,t,a,r)),e.length>80*r){o=e[0],l=e[1];let h=o,d=l;for(let c=r;c\\u003cs;c+=r){let m=e[c],g=e[c+1];m\\u003co&&(o=m),g\\u003cl&&(l=g),m>h&&(h=m),g>d&&(d=g)}u=Math.max(h-o,d-l),u=u!==0?32767/u:0}return pp(a,n,r,o,l,u,0),n}function xN(e,t,r,i,s){let a;if(s===SO(e,t,r,i)>0)for(let n=t;n\\u003cr;n+=i)a=SN(n/i|0,e[n],e[n+1],a);else for(let n=r-i;n>=t;n-=i)a=SN(n/i|0,e[n],e[n+1],a);return a&&hd(a,a.next)&&(gp(a),a=a.next),a}function bu(e,t){if(!e)return e;t||(t=e);let r=e,i;do if(i=!1,!r.steiner&&(hd(r,r.next)||Or(r.prev,r,r.next)===0)){if(gp(r),r=t=r.prev,r===r.next)break;i=!0}else r=r.next;while(i||r!==t);return t}function pp(e,t,r,i,s,a,n){if(!e)return;!n&&a&&gO(e,i,s,a);let o=e;for(;e.prev!==e.next;){let l=e.prev,u=e.next;if(a?lO(e,i,s,a):oO(e)){t.push(l.i,e.i,u.i),gp(e),e=u.next,o=u.next;continue}if(e=u,e===o){n?n===1?(e=uO(bu(e),t),pp(e,t,r,i,s,a,2)):n===2&&hO(e,t,r,i,s,a):pp(bu(e),t,r,i,s,a,1);break}}}function oO(e){let t=e.prev,r=e,i=e.next;if(Or(t,r,i)>=0)return!1;let s=t.x,a=r.x,n=i.x,o=t.y,l=r.y,u=i.y,h=Math.min(s,a,n),d=Math.min(o,l,u),c=Math.max(s,a,n),m=Math.max(o,l,u),g=i.next;for(;g!==t;){if(g.x>=h&&g.x\\u003c=c&&g.y>=d&&g.y\\u003c=m&&mp(s,o,a,l,n,u,g.x,g.y)&&Or(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function lO(e,t,r,i){let s=e.prev,a=e,n=e.next;if(Or(s,a,n)>=0)return!1;let o=s.x,l=a.x,u=n.x,h=s.y,d=a.y,c=n.y,m=Math.min(o,l,u),g=Math.min(h,d,c),y=Math.max(o,l,u),b=Math.max(h,d,c),v=Jv(m,g,t,r,i),S=Jv(y,b,t,r,i),T=e.prevZ,w=e.nextZ;for(;T&&T.z>=v&&w&&w.z\\u003c=S;){if(T.x>=m&&T.x\\u003c=y&&T.y>=g&&T.y\\u003c=b&&T!==s&&T!==n&&mp(o,h,l,d,u,c,T.x,T.y)&&Or(T.prev,T,T.next)>=0||(T=T.prevZ,w.x>=m&&w.x\\u003c=y&&w.y>=g&&w.y\\u003c=b&&w!==s&&w!==n&&mp(o,h,l,d,u,c,w.x,w.y)&&Or(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;T&&T.z>=v;){if(T.x>=m&&T.x\\u003c=y&&T.y>=g&&T.y\\u003c=b&&T!==s&&T!==n&&mp(o,h,l,d,u,c,T.x,T.y)&&Or(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;w&&w.z\\u003c=S;){if(w.x>=m&&w.x\\u003c=y&&w.y>=g&&w.y\\u003c=b&&w!==s&&w!==n&&mp(o,h,l,d,u,c,w.x,w.y)&&Or(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function uO(e,t){let r=e;do{let i=r.prev,s=r.next.next;!hd(i,s)&&bN(i,r,r.next,s)&&fp(i,s)&&fp(s,i)&&(t.push(i.i,r.i,s.i),gp(r),gp(r.next),r=e=s),r=r.next}while(r!==e);return bu(r)}function hO(e,t,r,i,s,a){let n=e;do{let o=n.next.next;for(;o!==n.prev;){if(n.i!==o.i&&vO(n,o)){let l=TN(n,o);n=bu(n,n.next),l=bu(l,l.next),pp(n,t,r,i,s,a,0),pp(l,t,r,i,s,a,0);return}o=o.next}n=n.next}while(n!==e)}function dO(e,t,r,i){let s=[];for(let a=0,n=t.length;a\\u003cn;a++){let o=t[a]*i,l=a\\u003cn-1?t[a+1]*i:e.length,u=xN(e,o,l,i,!1);u===u.next&&(u.steiner=!0),s.push(xO(u))}s.sort(cO);for(let a=0;a\\u003cs.length;a++)r=pO(s[a],r);return r}function cO(e,t){let r=e.x-t.x;if(r===0&&(r=e.y-t.y,r===0)){let i=(e.next.y-e.y)/(e.next.x-e.x),s=(t.next.y-t.y)/(t.next.x-t.x);r=i-s}return r}function pO(e,t){let r=mO(e,t);if(!r)return t;let i=TN(r,e);return bu(i,i.next),bu(r,r.next)}function mO(e,t){let r=t,i=e.x,s=e.y,a=-1/0,n;if(hd(e,r))return r;do{if(hd(e,r.next))return r.next;if(s\\u003c=r.y&&s>=r.next.y&&r.next.y!==r.y){let d=r.x+(s-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(d\\u003c=i&&d>a&&(a=d,n=r.x\\u003cr.next.x?r:r.next,d===i))return n}r=r.next}while(r!==t);if(!n)return null;let o=n,l=n.x,u=n.y,h=1/0;r=n;do{if(i>=r.x&&r.x>=l&&i!==r.x&&vN(s\\u003cu?i:a,s,l,u,s\\u003cu?a:i,s,r.x,r.y)){let d=Math.abs(s-r.y)/(i-r.x);fp(r,e)&&(d\\u003ch||d===h&&(r.x>n.x||r.x===n.x&&fO(n,r)))&&(n=r,h=d)}r=r.next}while(r!==o);return n}function fO(e,t){return Or(e.prev,e,t.prev)\\u003c0&&Or(t.next,e,e.next)\\u003c0}function gO(e,t,r,i){let s=e;do s.z===0&&(s.z=Jv(s.x,s.y,t,r,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,yO(s)}function yO(e){let t,r=1;do{let i=e,s;e=null;let a=null;for(t=0;i;){t++;let n=i,o=0;for(let u=0;u\\u003cr&&(o++,n=n.nextZ,!!n);u++);let l=r;for(;o>0||l>0&&n;)o!==0&&(l===0||!n||i.z\\u003c=n.z)?(s=i,i=i.nextZ,o--):(s=n,n=n.nextZ,l--),a?a.nextZ=s:e=s,s.prevZ=a,a=s;i=n}a.nextZ=null,r*=2}while(t>1);return e}function Jv(e,t,r,i,s){return e=(e-r)*s|0,t=(t-i)*s|0,e=(e|e\\u003c\\u003c8)&16711935,e=(e|e\\u003c\\u003c4)&252645135,e=(e|e\\u003c\\u003c2)&858993459,e=(e|e\\u003c\\u003c1)&1431655765,t=(t|t\\u003c\\u003c8)&16711935,t=(t|t\\u003c\\u003c4)&252645135,t=(t|t\\u003c\\u003c2)&858993459,t=(t|t\\u003c\\u003c1)&1431655765,e|t\\u003c\\u003c1}function xO(e){let t=e,r=e;do(t.x\\u003cr.x||t.x===r.x&&t.y\\u003cr.y)&&(r=t),t=t.next;while(t!==e);return r}function vN(e,t,r,i,s,a,n,o){return(s-n)*(t-o)>=(e-n)*(a-o)&&(e-n)*(i-o)>=(r-n)*(t-o)&&(r-n)*(a-o)>=(s-n)*(i-o)}function mp(e,t,r,i,s,a,n,o){return!(e===n&&t===o)&&vN(e,t,r,i,s,a,n,o)}function vO(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!bO(e,t)&&(fp(e,t)&&fp(t,e)&&TO(e,t)&&(Or(e.prev,e,t.prev)||Or(e,t.prev,t))||hd(e,t)&&Or(e.prev,e,e.next)>0&&Or(t.prev,t,t.next)>0)}function Or(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function hd(e,t){return e.x===t.x&&e.y===t.y}function bN(e,t,r,i){let s=Vg(Or(e,t,r)),a=Vg(Or(e,t,i)),n=Vg(Or(r,i,e)),o=Vg(Or(r,i,t));return!!(s!==a&&n!==o||s===0&&zg(e,r,t)||a===0&&zg(e,i,t)||n===0&&zg(r,e,i)||o===0&&zg(r,t,i))}function zg(e,t,r){return t.x\\u003c=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y\\u003c=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Vg(e){return e>0?1:e\\u003c0?-1:0}function bO(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&bN(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function fp(e,t){return Or(e.prev,e,e.next)\\u003c0?Or(e,t,e.next)>=0&&Or(e,e.prev,t)>=0:Or(e,t,e.prev)\\u003c0||Or(e,e.next,t)\\u003c0}function TO(e,t){let r=e,i=!1,s=(e.x+t.x)/2,a=(e.y+t.y)/2;do r.y>a!=r.next.y>a&&r.next.y!==r.y&&s\\u003c(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==e);return i}function TN(e,t){let r=Qv(e.i,e.x,e.y),i=Qv(t.i,t.x,t.y),s=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=s,s.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function SN(e,t,r,i){let s=Qv(e,t,r);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function gp(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Qv(e,t,r){return{i:e,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function SO(e,t,r,i){let s=0;for(let a=t,n=r-i;a\\u003cr;a+=i)s+=(e[n]-e[a])*(e[a+1]+e[n+1]),n=a;return s}var _O=class{static triangulate(e,t,r=2){return nO(e,t,r)}},dd=class $k{static area(t){let r=t.length,i=0;for(let s=r-1,a=0;a\\u003cr;s=a++)i+=t[s].x*t[a].y-t[a].x*t[s].y;return i*.5}static isClockWise(t){return $k.area(t)\\u003c0}static triangulateShape(t,r){let i=[],s=[],a=[];_N(t),wN(i,t);let n=t.length;r.forEach(_N);for(let l=0;l\\u003cr.length;l++)s.push(n),n+=r[l].length,wN(i,r[l]);let o=_O.triangulate(i,s);for(let l=0;l\\u003co.length;l+=3)a.push(o.slice(l,l+3));return a}};function _N(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function wN(e,t){for(let r=0;r\\u003ct.length;r++)e.push(t[r].x),e.push(t[r].y)}var wO=class qk extends ps{constructor(t=new cp([new fe(.5,.5),new fe(-.5,.5),new fe(-.5,-.5),new fe(.5,-.5)]),r={}){super(),this.type=\\\"ExtrudeGeometry\\\",this.parameters={shapes:t,options:r},t=Array.isArray(t)?t:[t];let i=this,s=[],a=[];for(let o=0,l=t.length;o\\u003cl;o++){let u=t[o];n(u)}this.setAttribute(\\\"position\\\",new tr(s,3)),this.setAttribute(\\\"uv\\\",new tr(a,2)),this.computeVertexNormals();function n(o){let l=[],u=r.curveSegments!==void 0?r.curveSegments:12,h=r.steps!==void 0?r.steps:1,d=r.depth!==void 0?r.depth:1,c=r.bevelEnabled!==void 0?r.bevelEnabled:!0,m=r.bevelThickness!==void 0?r.bevelThickness:.2,g=r.bevelSize!==void 0?r.bevelSize:m-.1,y=r.bevelOffset!==void 0?r.bevelOffset:0,b=r.bevelSegments!==void 0?r.bevelSegments:3,v=r.extrudePath,S=r.UVGenerator!==void 0?r.UVGenerator:MO,T,w=!1,N,C,R,E;if(v){T=v.getSpacedPoints(h),w=!0,c=!1;let $=v.isCatmullRomCurve3?v.closed:!1;N=v.computeFrenetFrames(h,$),C=new F,R=new F,E=new F}c||(b=0,m=0,g=0,y=0);let P=o.extractPoints(u),I=P.shape,O=P.holes;if(!dd.isClockWise(I)){I=I.reverse();for(let $=0,U=O.length;$\\u003cU;$++){let J=O[$];dd.isClockWise(J)&&(O[$]=J.reverse())}}function L($){let U=10000000000000001e-36,J=$[0];for(let q=1;q\\u003c=$.length;q++){let se=q%$.length,pe=$[se],Te=pe.x-J.x,we=pe.y-J.y,ie=Te*Te+we*we,V=Math.max(Math.abs(pe.x),Math.abs(pe.y),Math.abs(J.x),Math.abs(J.y)),Oe=U*V*V;if(ie\\u003c=Oe){$.splice(se,1),q--;continue}J=pe}}L(I),O.forEach(L);let X=O.length,z=I;for(let $=0;$\\u003cX;$++){let U=O[$];I=I.concat(U)}function H($,U,J){return U||Ce(\\\"ExtrudeGeometry: vec does not exist\\\"),$.clone().addScaledVector(U,J)}let ue=I.length;function ne($,U,J){let q,se,pe,Te=$.x-U.x,we=$.y-U.y,ie=J.x-$.x,V=J.y-$.y,Oe=Te*Te+we*we,tt=Te*V-we*ie;if(Math.abs(tt)>Number.EPSILON){let Je=Math.sqrt(Oe),ct=Math.sqrt(ie*ie+V*V),_e=U.x-we/Je,nt=U.y+Te/Je,dt=J.x-V/ct,ft=J.y+ie/ct,Fe=((dt-_e)*V-(ft-nt)*ie)/(Te*V-we*ie);q=_e+Te*Fe-$.x,se=nt+we*Fe-$.y;let it=q*q+se*se;if(it\\u003c=2)return new fe(q,se);pe=Math.sqrt(it/2)}else{let Je=!1;Te>Number.EPSILON?ie>Number.EPSILON&&(Je=!0):Te\\u003c-Number.EPSILON?ie\\u003c-Number.EPSILON&&(Je=!0):Math.sign(we)===Math.sign(V)&&(Je=!0),Je?(q=-we,se=Te,pe=Math.sqrt(Oe)):(q=Te,se=we,pe=Math.sqrt(Oe/2))}return new fe(q/pe,se/pe)}let re=[];for(let $=0,U=z.length,J=U-1,q=$+1;$\\u003cU;$++,J++,q++)J===U&&(J=0),q===U&&(q=0),re[$]=ne(z[$],z[J],z[q]);let ce=[],ge,ye=re.concat();for(let $=0,U=X;$\\u003cU;$++){let J=O[$];ge=[];for(let q=0,se=J.length,pe=se-1,Te=q+1;q\\u003cse;q++,pe++,Te++)pe===se&&(pe=0),Te===se&&(Te=0),ge[q]=ne(J[q],J[pe],J[Te]);ce.push(ge),ye=ye.concat(ge)}let oe;if(b===0)oe=dd.triangulateShape(z,O);else{let $=[],U=[];for(let J=0;J\\u003cb;J++){let q=J/b,se=m*Math.cos(q*Math.PI/2),pe=g*Math.sin(q*Math.PI/2)+y;for(let Te=0,we=z.length;Te\\u003cwe;Te++){let ie=H(z[Te],re[Te],pe);j(ie.x,ie.y,-se),q===0&&$.push(ie)}for(let Te=0,we=X;Te\\u003cwe;Te++){let ie=O[Te];ge=ce[Te];let V=[];for(let Oe=0,tt=ie.length;Oe\\u003ctt;Oe++){let Je=H(ie[Oe],ge[Oe],pe);j(Je.x,Je.y,-se),q===0&&V.push(Je)}q===0&&U.push(V)}}oe=dd.triangulateShape($,U)}let Ae=oe.length,Ie=g+y;for(let $=0;$\\u003cue;$++){let U=c?H(I[$],ye[$],Ie):I[$];w?(R.copy(N.normals[0]).multiplyScalar(U.x),C.copy(N.binormals[0]).multiplyScalar(U.y),E.copy(T[0]).add(R).add(C),j(E.x,E.y,E.z)):j(U.x,U.y,0)}for(let $=1;$\\u003c=h;$++)for(let U=0;U\\u003cue;U++){let J=c?H(I[U],ye[U],Ie):I[U];w?(R.copy(N.normals[$]).multiplyScalar(J.x),C.copy(N.binormals[$]).multiplyScalar(J.y),E.copy(T[$]).add(R).add(C),j(E.x,E.y,E.z)):j(J.x,J.y,d/h*$)}for(let $=b-1;$>=0;$--){let U=$/b,J=m*Math.cos(U*Math.PI/2),q=g*Math.sin(U*Math.PI/2)+y;for(let se=0,pe=z.length;se\\u003cpe;se++){let Te=H(z[se],re[se],q);j(Te.x,Te.y,d+J)}for(let se=0,pe=O.length;se\\u003cpe;se++){let Te=O[se];ge=ce[se];for(let we=0,ie=Te.length;we\\u003cie;we++){let V=H(Te[we],ge[we],q);w?j(V.x,V.y+T[h-1].y,T[h-1].x+J):j(V.x,V.y,d+J)}}}Xe(),at();function Xe(){let $=s.length/3;if(c){let U=0,J=ue*U;for(let q=0;q\\u003cAe;q++){let se=oe[q];G(se[2]+J,se[1]+J,se[0]+J)}U=h+b*2,J=ue*U;for(let q=0;q\\u003cAe;q++){let se=oe[q];G(se[0]+J,se[1]+J,se[2]+J)}}else{for(let U=0;U\\u003cAe;U++){let J=oe[U];G(J[2],J[1],J[0])}for(let U=0;U\\u003cAe;U++){let J=oe[U];G(J[0]+ue*h,J[1]+ue*h,J[2]+ue*h)}}i.addGroup($,s.length/3-$,0)}function at(){let $=s.length/3,U=0;W(z,U),U+=z.length;for(let J=0,q=O.length;J\\u003cq;J++){let se=O[J];W(se,U),U+=se.length}i.addGroup($,s.length/3-$,1)}function W($,U){let J=$.length;for(;--J>=0;){let q=J,se=J-1;se\\u003c0&&(se=$.length-1);for(let pe=0,Te=h+b*2;pe\\u003cTe;pe++){let we=ue*pe,ie=ue*(pe+1),V=U+q+we,Oe=U+se+we,tt=U+se+ie,Je=U+q+ie;ae(V,Oe,tt,Je)}}}function j($,U,J){l.push($),l.push(U),l.push(J)}function G($,U,J){be($),be(U),be(J);let q=s.length/3,se=S.generateTopUV(i,s,q-3,q-2,q-1);Be(se[0]),Be(se[1]),Be(se[2])}function ae($,U,J,q){be($),be(U),be(q),be(U),be(J),be(q);let se=s.length/3,pe=S.generateSideWallUV(i,s,se-6,se-3,se-2,se-1);Be(pe[0]),Be(pe[1]),Be(pe[3]),Be(pe[1]),Be(pe[2]),Be(pe[3])}function be($){s.push(l[$*3+0]),s.push(l[$*3+1]),s.push(l[$*3+2])}function Be($){a.push($.x),a.push($.y)}}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){let t=super.toJSON(),r=this.parameters.shapes,i=this.parameters.options;return NO(r,i,t)}static fromJSON(t,r){let i=[];for(let a=0,n=t.shapes.length;a\\u003cn;a++){let o=r[t.shapes[a]];i.push(o)}let s=t.options.extrudePath;return s!==void 0&&(t.options.extrudePath=new Zv[s.type]().fromJSON(s)),new qk(i,t.options)}},MO={generateTopUV:function(e,t,r,i,s){let a=t[r*3],n=t[r*3+1],o=t[i*3],l=t[i*3+1],u=t[s*3],h=t[s*3+1];return[new fe(a,n),new fe(o,l),new fe(u,h)]},generateSideWallUV:function(e,t,r,i,s,a){let n=t[r*3],o=t[r*3+1],l=t[r*3+2],u=t[i*3],h=t[i*3+1],d=t[i*3+2],c=t[s*3],m=t[s*3+1],g=t[s*3+2],y=t[a*3],b=t[a*3+1],v=t[a*3+2];return Math.abs(o-h)\\u003cMath.abs(n-u)?[new fe(n,1-l),new fe(u,1-d),new fe(c,1-g),new fe(y,1-v)]:[new fe(o,1-l),new fe(h,1-d),new fe(m,1-g),new fe(b,1-v)]}};function NO(e,t,r){if(r.shapes=[],Array.isArray(e))for(let i=0,s=e.length;i\\u003cs;i++){let a=e[i];r.shapes.push(a.uuid)}else r.shapes.push(e.uuid);return r.options=Object.assign({},t),t.extrudePath!==void 0&&(r.options.extrudePath=t.extrudePath.toJSON()),r}var Gg=class Yk extends jv{constructor(t=1,r=0){let i=(1+Math.sqrt(5))/2,s=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],a=[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];super(s,a,t,r),this.type=\\\"IcosahedronGeometry\\\",this.parameters={radius:t,detail:r}}static fromJSON(t){return new Yk(t.radius,t.detail)}},AO=class Zk extends jv{constructor(t=1,r=0){let i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],s=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,s,t,r),this.type=\\\"OctahedronGeometry\\\",this.parameters={radius:t,detail:r}}static fromJSON(t){return new Zk(t.radius,t.detail)}},Kv=class Jk extends ps{constructor(t=1,r=1,i=1,s=1){super(),this.type=\\\"PlaneGeometry\\\",this.parameters={width:t,height:r,widthSegments:i,heightSegments:s};let a=t/2,n=r/2,o=Math.floor(i),l=Math.floor(s),u=o+1,h=l+1,d=t/o,c=r/l,m=[],g=[],y=[],b=[];for(let v=0;v\\u003ch;v++){let S=v*c-n;for(let T=0;T\\u003cu;T++){let w=T*d-a;g.push(w,-S,0),y.push(0,0,1),b.push(T/o),b.push(1-v/l)}}for(let v=0;v\\u003cl;v++)for(let S=0;S\\u003co;S++){let T=S+u*v,w=S+u*(v+1),N=S+1+u*(v+1),C=S+1+u*v;m.push(T,w,C),m.push(w,N,C)}this.setIndex(m),this.setAttribute(\\\"position\\\",new tr(g,3)),this.setAttribute(\\\"normal\\\",new tr(y,3)),this.setAttribute(\\\"uv\\\",new tr(b,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Jk(t.width,t.height,t.widthSegments,t.heightSegments)}},eb=class Qk extends ps{constructor(t=1,r=32,i=16,s=0,a=Math.PI*2,n=0,o=Math.PI){super(),this.type=\\\"SphereGeometry\\\",this.parameters={radius:t,widthSegments:r,heightSegments:i,phiStart:s,phiLength:a,thetaStart:n,thetaLength:o},r=Math.max(3,Math.floor(r)),i=Math.max(2,Math.floor(i));let l=Math.min(n+o,Math.PI),u=0,h=[],d=new F,c=new F,m=[],g=[],y=[],b=[];for(let v=0;v\\u003c=i;v++){let S=[],T=v/i,w=n+T*o,N=t*Math.cos(w),C=Math.sqrt(t*t-N*N),R=0;v===0&&n===0?R=.5/r:v===i&&l===Math.PI&&(R=-.5/r);for(let E=0;E\\u003c=r;E++){let P=E/r,I=s+P*a;d.x=-C*Math.cos(I),d.y=N,d.z=C*Math.sin(I),g.push(d.x,d.y,d.z),c.copy(d).normalize(),y.push(c.x,c.y,c.z),b.push(P+R,1-T),S.push(u++)}h.push(S)}for(let v=0;v\\u003ci;v++)for(let S=0;S\\u003cr;S++){let T=h[v][S+1],w=h[v][S],N=h[v+1][S],C=h[v+1][S+1];(v!==0||n>0)&&m.push(T,w,C),(v!==i-1||l\\u003cMath.PI)&&m.push(w,N,C)}this.setIndex(m),this.setAttribute(\\\"position\\\",new tr(g,3)),this.setAttribute(\\\"normal\\\",new tr(y,3)),this.setAttribute(\\\"uv\\\",new tr(b,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Qk(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},MN=class Kk extends jv{constructor(t=1,r=0){let i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],s=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,s,t,r),this.type=\\\"TetrahedronGeometry\\\",this.parameters={radius:t,detail:r}}static fromJSON(t){return new Kk(t.radius,t.detail)}},NN=class eD extends ps{constructor(t=1,r=.4,i=12,s=48,a=Math.PI*2,n=0,o=Math.PI*2){super(),this.type=\\\"TorusGeometry\\\",this.parameters={radius:t,tube:r,radialSegments:i,tubularSegments:s,arc:a,thetaStart:n,thetaLength:o},i=Math.floor(i),s=Math.floor(s);let l=[],u=[],h=[],d=[],c=new F,m=new F,g=new F;for(let y=0;y\\u003c=i;y++){let b=n+y/i*o;for(let v=0;v\\u003c=s;v++){let S=v/s*a;m.x=(t+r*Math.cos(b))*Math.cos(S),m.y=(t+r*Math.cos(b))*Math.sin(S),m.z=r*Math.sin(b),u.push(m.x,m.y,m.z),c.x=t*Math.cos(S),c.y=t*Math.sin(S),g.subVectors(m,c).normalize(),h.push(g.x,g.y,g.z),d.push(v/s),d.push(y/i)}}for(let y=1;y\\u003c=i;y++)for(let b=1;b\\u003c=s;b++){let v=(s+1)*y+b-1,S=(s+1)*(y-1)+b-1,T=(s+1)*(y-1)+b,w=(s+1)*y+b;l.push(v,S,w),l.push(S,T,w)}this.setIndex(l),this.setAttribute(\\\"position\\\",new tr(u,3)),this.setAttribute(\\\"normal\\\",new tr(h,3)),this.setAttribute(\\\"uv\\\",new tr(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new eD(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},CO=class extends Vs{constructor(e){super(),this.isShadowMaterial=!0,this.type=\\\"ShadowMaterial\\\",this.color=new gt(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}},AN=class extends Vs{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type=\\\"MeshStandardMaterial\\\",this.defines={STANDARD:\\\"\\\"},this.color=new gt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=so,this.normalScale=new fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new cn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\\\"round\\\",this.wireframeLinejoin=\\\"round\\\",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:\\\"\\\"},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},RO=class extends AN{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:\\\"\\\",PHYSICAL:\\\"\\\"},this.type=\\\"MeshPhysicalMaterial\\\",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new fe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,\\\"reflectivity\\\",{get:function(){return St(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new gt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new gt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new gt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:\\\"\\\",PHYSICAL:\\\"\\\"},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},EO=class extends Vs{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type=\\\"MeshPhongMaterial\\\",this.color=new gt(16777215),this.specular=new gt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=so,this.normalScale=new fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new cn,this.combine=Ff,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\\\"round\\\",this.wireframeLinejoin=\\\"round\\\",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},PO=class extends Vs{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:\\\"\\\"},this.type=\\\"MeshToonMaterial\\\",this.color=new gt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=so,this.normalScale=new fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\\\"round\\\",this.wireframeLinejoin=\\\"round\\\",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},BO=class extends Vs{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type=\\\"MeshNormalMaterial\\\",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=so,this.normalScale=new fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}},IO=class extends Vs{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type=\\\"MeshLambertMaterial\\\",this.color=new gt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new gt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=so,this.normalScale=new fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new cn,this.combine=Ff,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=\\\"round\\\",this.wireframeLinejoin=\\\"round\\\",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},FO=class extends Vs{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:\\\"\\\"},this.type=\\\"MeshMatcapMaterial\\\",this.color=new gt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=so,this.normalScale=new fe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:\\\"\\\"},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}},LO=class extends hN{constructor(e){super(),this.isLineDashedMaterial=!0,this.type=\\\"LineDashedMaterial\\\",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};function Wg(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==\\\"number\\\"?new t(e):Array.prototype.slice.call(e)}var yp=class{constructor(e,t,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,r=this._cachedIndex,i=t[r],s=t[r-1];e:{t:{let a;r:{i:if(!(e\\u003ci)){for(let n=r+2;;){if(i===void 0){if(e\\u003cs)break i;return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===n)break;if(s=i,i=t[++r],e\\u003ci)break t}a=t.length;break r}if(!(e>=s)){let n=t[1];e\\u003cn&&(r=2,s=n);for(let o=r-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===o)break;if(i=s,s=t[--r-1],e>=s)break t}a=r,r=0;break r}break e}for(;r\\u003ca;){let n=r+a>>>1;e\\u003ct[n]?a=n:r=n+1}if(i=t[r],s=t[r-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return r=t.length,this._cachedIndex=r,this.copySampleValue_(r-1)}this._cachedIndex=r,this.intervalChanged_(r,s,i)}return this.interpolate_(r,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)t[a]=r[s+a];return t}interpolate_(){throw new Error(\\\"THREE.Interpolant: Call to abstract method.\\\")}intervalChanged_(){}},kO=class extends yp{constructor(e,t,r,i){super(e,t,r,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:PM,endingEnd:PM}}intervalChanged_(e,t,r){let i=this.parameterPositions,s=e-2,a=e+1,n=i[s],o=i[a];if(n===void 0)switch(this.getSettings_().endingStart){case BM:s=e,n=2*t-r;break;case IM:s=i.length-2,n=t+i[s]-i[s+1];break;default:s=e,n=r}if(o===void 0)switch(this.getSettings_().endingEnd){case BM:a=e,o=2*r-t;break;case IM:a=1,o=r+i[1]-i[0];break;default:a=e-1,o=t}let l=(r-t)*.5,u=this.valueSize;this._weightPrev=l/(t-n),this._weightNext=l/(o-r),this._offsetPrev=s*u,this._offsetNext=a*u}interpolate_(e,t,r,i){let s=this.resultBuffer,a=this.sampleValues,n=this.valueSize,o=e*n,l=o-n,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,c=this._weightNext,m=(r-t)/(i-t),g=m*m,y=g*m,b=-d*y+2*d*g-d*m,v=(1+d)*y+(-1.5-2*d)*g+(-.5+d)*m+1,S=(-1-c)*y+(1.5+c)*g+.5*m,T=c*y-c*g;for(let w=0;w!==n;++w)s[w]=b*a[u+w]+v*a[l+w]+S*a[o+w]+T*a[h+w];return s}},DO=class extends yp{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){let s=this.resultBuffer,a=this.sampleValues,n=this.valueSize,o=e*n,l=o-n,u=(r-t)/(i-t),h=1-u;for(let d=0;d!==n;++d)s[d]=a[l+d]*h+a[o+d]*u;return s}},OO=class extends yp{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e){return this.copySampleValue_(e-1)}},UO=class extends yp{interpolate_(e,t,r,i){let s=this.resultBuffer,a=this.sampleValues,n=this.valueSize,o=e*n,l=o-n,u=this.inTangents,h=this.outTangents;if(!u||!h){let m=(r-t)/(i-t),g=1-m;for(let y=0;y!==n;++y)s[y]=a[l+y]*g+a[o+y]*m;return s}let d=n*2,c=e-1;for(let m=0;m!==n;++m){let g=a[l+m],y=a[o+m],b=c*d+m*2,v=h[b],S=h[b+1],T=e*d+m*2,w=u[T],N=u[T+1],C=(r-t)/(i-t),R,E,P,I,O;for(let L=0;L\\u003c8;L++){R=C*C,E=R*C,P=1-C,I=P*P,O=I*P;let X=O*t+3*I*C*v+3*P*R*w+E*i-r;if(Math.abs(X)\\u003c1e-10)break;let z=3*I*(v-t)+6*P*C*(w-v)+3*R*(i-w);if(Math.abs(z)\\u003c1e-10)break;C=C-X/z,C=Math.max(0,Math.min(1,C))}s[m]=O*g+3*I*C*S+3*P*R*N+E*y}return s}},yn=class{constructor(e,t,r,i){if(e===void 0)throw new Error(\\\"THREE.KeyframeTrack: track name is undefined\\\");if(t===void 0||t.length===0)throw new Error(\\\"THREE.KeyframeTrack: no keyframes in track named \\\"+e);this.name=e,this.times=Wg(t,this.TimeBufferType),this.values=Wg(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,r;if(t.toJSON!==this.toJSON)r=t.toJSON(e);else{r={name:e.name,times:Wg(e.times,Array),values:Wg(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(r.interpolation=i)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new OO(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new DO(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new kO(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new UO(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case pg:t=this.InterpolantFactoryMethodDiscrete;break;case pv:t=this.InterpolantFactoryMethodLinear;break;case mv:t=this.InterpolantFactoryMethodSmooth;break;case EM:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let r=\\\"unsupported interpolation for \\\"+this.ValueTypeName+\\\" keyframe track named \\\"+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(r);return Ue(\\\"KeyframeTrack:\\\",r),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return pg;case this.InterpolantFactoryMethodLinear:return pv;case this.InterpolantFactoryMethodSmooth:return mv;case this.InterpolantFactoryMethodBezier:return EM}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let r=0,i=t.length;r!==i;++r)t[r]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let r=0,i=t.length;r!==i;++r)t[r]*=e}return this}trim(e,t){let r=this.times,i=r.length,s=0,a=i-1;for(;s!==i&&r[s]\\u003ce;)++s;for(;a!==-1&&r[a]>t;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);let n=this.getValueSize();this.times=r.slice(s,a),this.values=this.values.slice(s*n,a*n)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(Ce(\\\"KeyframeTrack: Invalid value size in track.\\\",this),e=!1);let r=this.times,i=this.values,s=r.length;s===0&&(Ce(\\\"KeyframeTrack: Track is empty.\\\",this),e=!1);let a=null;for(let n=0;n!==s;n++){let o=r[n];if(typeof o==\\\"number\\\"&&isNaN(o)){Ce(\\\"KeyframeTrack: Time is not a valid number.\\\",this,n,o),e=!1;break}if(a!==null&&a>o){Ce(\\\"KeyframeTrack: Out of order keys.\\\",this,n,o,a),e=!1;break}a=o}if(i!==void 0&&ip(i))for(let n=0,o=i.length;n!==o;++n){let l=i[n];if(isNaN(l)){Ce(\\\"KeyframeTrack: Value is not a valid number.\\\",this,n,l),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===mv,s=e.length-1,a=1;for(let n=1;n\\u003cs;++n){let o=!1,l=e[n],u=e[n+1];if(l!==u&&(n!==1||l!==e[0]))if(i)o=!0;else{let h=n*r,d=h-r,c=h+r;for(let m=0;m!==r;++m){let g=t[h+m];if(g!==t[d+m]||g!==t[c+m]){o=!0;break}}}if(o){if(n!==a){e[a]=e[n];let h=n*r,d=a*r;for(let c=0;c!==r;++c)t[d+c]=t[h+c]}++a}}if(s>0){e[a]=e[s];for(let n=s*r,o=a*r,l=0;l!==r;++l)t[o+l]=t[n+l];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*r)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};yn.prototype.ValueTypeName=\\\"\\\",yn.prototype.TimeBufferType=Float32Array,yn.prototype.ValueBufferType=Float32Array,yn.prototype.DefaultInterpolation=pv;var xp=class extends yn{constructor(e,t,r){super(e,t,r)}};xp.prototype.ValueTypeName=\\\"bool\\\",xp.prototype.ValueBufferType=Array,xp.prototype.DefaultInterpolation=pg,xp.prototype.InterpolantFactoryMethodLinear=void 0,xp.prototype.InterpolantFactoryMethodSmooth=void 0;var zO=class extends yn{constructor(e,t,r,i){super(e,t,r,i)}};zO.prototype.ValueTypeName=\\\"color\\\";var VO=class extends yn{constructor(e,t,r,i){super(e,t,r,i)}};VO.prototype.ValueTypeName=\\\"number\\\";var GO=class extends yp{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){let s=this.resultBuffer,a=this.sampleValues,n=this.valueSize,o=(r-t)/(i-t),l=e*n;for(let u=l+n;l!==u;l+=4)si.slerpFlat(s,0,a,l-n,a,l,o);return s}},CN=class extends yn{constructor(e,t,r,i){super(e,t,r,i)}InterpolantFactoryMethodLinear(e){return new GO(this.times,this.values,this.getValueSize(),e)}};CN.prototype.ValueTypeName=\\\"quaternion\\\",CN.prototype.InterpolantFactoryMethodSmooth=void 0;var vp=class extends yn{constructor(e,t,r){super(e,t,r)}};vp.prototype.ValueTypeName=\\\"string\\\",vp.prototype.ValueBufferType=Array,vp.prototype.DefaultInterpolation=pg,vp.prototype.InterpolantFactoryMethodLinear=void 0,vp.prototype.InterpolantFactoryMethodSmooth=void 0;var WO=class extends yn{constructor(e,t,r,i){super(e,t,r,i)}};WO.prototype.ValueTypeName=\\\"vector\\\";var bp={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(RN(e)||(this.files[e]=t))},get:function(e){if(this.enabled!==!1&&!RN(e))return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function RN(e){try{let t=e.slice(e.indexOf(\\\":\\\")+1);return new URL(t).protocol===\\\"blob:\\\"}catch{return!1}}var jO=class{constructor(e,t,r){let i=this,s=!1,a=0,n=0,o,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this._abortController=null,this.itemStart=function(u){n++,s===!1&&i.onStart!==void 0&&i.onStart(u,a,n),s=!0},this.itemEnd=function(u){a++,i.onProgress!==void 0&&i.onProgress(u,a,n),a===n&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return u=u.normalize(\\\"NFC\\\"),o?o(u):u},this.setURLModifier=function(u){return o=u,this},this.addHandler=function(u,h){return l.push(u,h),this},this.removeHandler=function(u){let h=l.indexOf(u);return h!==-1&&l.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=l.length;h\\u003cd;h+=2){let c=l[h],m=l[h+1];if(c.global&&(c.lastIndex=0),c.test(u))return m}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},HO=new jO,Tp=class{constructor(e){this.manager=e!==void 0?e:HO,this.crossOrigin=\\\"anonymous\\\",this.withCredentials=!1,this.path=\\\"\\\",this.resourcePath=\\\"\\\",this.requestHeader={},typeof __THREE_DEVTOOLS__\\u003c\\\"u\\\"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\\\"observe\\\",{detail:this}))}load(){}loadAsync(e,t){let r=this;return new Promise(function(i,s){r.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};Tp.DEFAULT_MATERIAL_NAME=\\\"__DEFAULT\\\";var mo={},XO=class extends Error{constructor(e,t){super(e),this.response=t}},$O=class extends Tp{constructor(e){super(e),this.mimeType=\\\"\\\",this.responseType=\\\"\\\",this._abortController=new AbortController}load(e,t,r,i){e===void 0&&(e=\\\"\\\"),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=bp.get(`file:${e}`);if(s!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0);return}if(mo[e]!==void 0){mo[e].push({onLoad:t,onProgress:r,onError:i});return}mo[e]=[],mo[e].push({onLoad:t,onProgress:r,onError:i});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?\\\"include\\\":\\\"same-origin\\\",signal:typeof AbortSignal.any==\\\"function\\\"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),n=this.mimeType,o=this.responseType;fetch(a).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&Ue(\\\"FileLoader: HTTP Status 0 received.\\\"),typeof ReadableStream>\\\"u\\\"||l.body===void 0||l.body.getReader===void 0)return l;let u=mo[e],h=l.body.getReader(),d=l.headers.get(\\\"X-File-Size\\\")||l.headers.get(\\\"Content-Length\\\"),c=d?parseInt(d):0,m=c!==0,g=0,y=new ReadableStream({start(b){v();function v(){h.read().then(({done:S,value:T})=>{if(S)b.close();else{g+=T.byteLength;let w=new ProgressEvent(\\\"progress\\\",{lengthComputable:m,loaded:g,total:c});for(let N=0,C=u.length;N\\u003cC;N++){let R=u[N];R.onProgress&&R.onProgress(w)}b.enqueue(T),v()}},S=>{b.error(S)})}}});return new Response(y)}else throw new XO(`fetch for \\\"${l.url}\\\" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(o){case\\\"arraybuffer\\\":return l.arrayBuffer();case\\\"blob\\\":return l.blob();case\\\"document\\\":return l.text().then(u=>new DOMParser().parseFromString(u,n));case\\\"json\\\":return l.json();default:if(n===\\\"\\\")return l.text();{let u=/charset=\\\"?([^;\\\"\\\\s]*)\\\"?/i.exec(n),h=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(h);return l.arrayBuffer().then(c=>d.decode(c))}}}).then(l=>{bp.add(`file:${e}`,l);let u=mo[e];delete mo[e];for(let h=0,d=u.length;h\\u003cd;h++){let c=u[h];c.onLoad&&c.onLoad(l)}}).catch(l=>{let u=mo[e];if(u===void 0)throw this.manager.itemError(e),l;delete mo[e];for(let h=0,d=u.length;h\\u003cd;h++){let c=u[h];c.onError&&c.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}},cd=new WeakMap,qO=class extends Tp{constructor(e){super(e)}load(e,t,r,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,a=bp.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0);else{let h=cd.get(a);h===void 0&&(h=[],cd.set(a,h)),h.push({onLoad:t,onError:i})}return a}let n=gg(\\\"img\\\");function o(){u(),t&&t(this);let h=cd.get(this)||[];for(let d=0;d\\u003ch.length;d++){let c=h[d];c.onLoad&&c.onLoad(this)}cd.delete(this),s.manager.itemEnd(e)}function l(h){u(),i&&i(h),bp.remove(`image:${e}`);let d=cd.get(this)||[];for(let c=0;c\\u003cd.length;c++){let m=d[c];m.onError&&m.onError(h)}cd.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){n.removeEventListener(\\\"load\\\",o,!1),n.removeEventListener(\\\"error\\\",l,!1)}return n.addEventListener(\\\"load\\\",o,!1),n.addEventListener(\\\"error\\\",l,!1),e.slice(0,5)!==\\\"data:\\\"&&this.crossOrigin!==void 0&&(n.crossOrigin=this.crossOrigin),bp.add(`image:${e}`,n),s.manager.itemStart(e),n.src=e,n}},tb=class extends Tp{constructor(e){super(e)}load(e,t,r,i){let s=new ji,a=new qO(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(n){s.image=n,s.needsUpdate=!0,t!==void 0&&t(s)},r,i),s}},Tu=class extends Hi{constructor(e,t=1){super(),this.isLight=!0,this.type=\\\"Light\\\",this.color=new gt(e),this.intensity=t}dispose(){this.dispatchEvent({type:\\\"dispose\\\"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},EN=class extends Tu{constructor(e,t,r){super(e,r),this.isHemisphereLight=!0,this.type=\\\"HemisphereLight\\\",this.position.copy(Hi.DEFAULT_UP),this.updateMatrix(),this.groundColor=new gt(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},rb=new We,PN=new F,BN=new F,ib=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new fe(512,512),this.mapType=Si,this.map=null,this.mapPass=null,this.matrix=new We,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Og,this._frameExtents=new fe(1,1),this._viewportCount=1,this._viewports=[new Wt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,r=this.matrix;PN.setFromMatrixPosition(e.matrixWorld),t.position.copy(PN),BN.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(BN),t.updateMatrixWorld(),rb.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(rb,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===da||t.reversedDepth?r.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(rb)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},jg=new F,Hg=new si,xn=new F,IN=class extends Hi{constructor(){super(),this.isCamera=!0,this.type=\\\"Camera\\\",this.matrixWorldInverse=new We,this.projectionMatrix=new We,this.projectionMatrixInverse=new We,this.coordinateSystem=Ds,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(jg,Hg,xn),xn.x===1&&xn.y===1&&xn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(jg,Hg,xn.set(1,1,1)).invert()}updateWorldMatrix(e,t,r=!1){super.updateWorldMatrix(e,t,r),this.matrixWorld.decompose(jg,Hg,xn),xn.x===1&&xn.y===1&&xn.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(jg,Hg,xn.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}},al=new F,FN=new fe,LN=new fe,gs=class extends IN{constructor(e=50,t=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type=\\\"PerspectiveCamera\\\",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Zh*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(sp*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Zh*2*Math.atan(Math.tan(sp*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,r){al.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(al.x,al.y).multiplyScalar(-e/al.z),al.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(al.x,al.y).multiplyScalar(-e/al.z)}getViewSize(e,t){return this.getViewBounds(e,FN,LN),t.subVectors(LN,FN)}setViewOffset(e,t,r,i,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(sp*.5*this.fov)/this.zoom,r=2*t,i=this.aspect*r,s=-.5*i,a=this.view;if(this.view!==null&&this.view.enabled){let o=a.fullWidth,l=a.fullHeight;s+=a.offsetX*i/o,t-=a.offsetY*r/l,i*=a.width/o,r*=a.height/l}let n=this.filmOffset;n!==0&&(s+=e*n/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-r,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},YO=class extends ib{constructor(){super(new gs(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,r=Zh*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(r!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=r,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},Xg=class extends Tu{constructor(e,t,r=0,i=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type=\\\"SpotLight\\\",this.position.copy(Hi.DEFAULT_UP),this.updateMatrix(),this.target=new Hi,this.distance=r,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new YO}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}},ZO=class extends ib{constructor(){super(new gs(90,1,.5,500)),this.isPointLightShadow=!0}},JO=class extends Tu{constructor(e,t,r=0,i=2){super(e,t),this.isPointLight=!0,this.type=\\\"PointLight\\\",this.distance=r,this.decay=i,this.shadow=new ZO}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},sb=class extends IN{constructor(e=-1,t=1,r=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type=\\\"OrthographicCamera\\\",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,r,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2,s=r-e,a=r+e,n=i+t,o=i-t;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,a=s+l*this.view.width,n-=u*this.view.offsetY,o=n-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,n,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},QO=class extends ib{constructor(){super(new sb(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},$g=class extends Tu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=\\\"DirectionalLight\\\",this.position.copy(Hi.DEFAULT_UP),this.updateMatrix(),this.target=new Hi,this.shadow=new QO}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},KO=class extends Tu{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type=\\\"AmbientLight\\\"}},eU=class extends Tu{constructor(e,t,r=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type=\\\"RectAreaLight\\\",this.width=r,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}},tU=class{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e\\u003c9;e++)this.coefficients.push(new F)}set(e){for(let t=0;t\\u003c9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e\\u003c9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let r=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*r),t.addScaledVector(a[4],1.092548*(r*i)),t.addScaledVector(a[5],1.092548*(i*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(r*s)),t.addScaledVector(a[8],.546274*(r*r-i*i)),t}getIrradianceAt(e,t){let r=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*i),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*r),t.addScaledVector(a[4],2*.429043*r*i),t.addScaledVector(a[5],2*.429043*i*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*r*s),t.addScaledVector(a[8],.429043*(r*r-i*i)),t}add(e){for(let t=0;t\\u003c9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let r=0;r\\u003c9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(let t=0;t\\u003c9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let r=0;r\\u003c9;r++)this.coefficients[r].lerp(e.coefficients[r],t);return this}equals(e){for(let t=0;t\\u003c9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let r=this.coefficients;for(let i=0;i\\u003c9;i++)r[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){let r=this.coefficients;for(let i=0;i\\u003c9;i++)r[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){let r=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*r,t[4]=1.092548*r*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*r*s,t[8]=.546274*(r*r-i*i)}},rU=class extends Tu{constructor(e=new tU,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}},iU=class extends ps{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type=\\\"InstancedBufferGeometry\\\",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){let e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}},pd=-90,md=1,sU=class extends Hi{constructor(e,t,r){super(),this.type=\\\"CubeCamera\\\",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;let i=new gs(pd,md,e,t);i.layers=this.layers,this.add(i);let s=new gs(pd,md,e,t);s.layers=this.layers,this.add(s);let a=new gs(pd,md,e,t);a.layers=this.layers,this.add(a);let n=new gs(pd,md,e,t);n.layers=this.layers,this.add(n);let o=new gs(pd,md,e,t);o.layers=this.layers,this.add(o);let l=new gs(pd,md,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[r,i,s,a,n,o]=t;for(let l of t)this.remove(l);if(e===Ds)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),n.up.set(0,1,0),n.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(e===da)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),n.up.set(0,-1,0),n.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw new Error(\\\"THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: \\\"+e);for(let l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[s,a,n,o,l,u]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),c=e.getActiveMipmapLevel(),m=e.xr.enabled;e.xr.enabled=!1;let g=r.texture.generateMipmaps;r.texture.generateMipmaps=!1;let y=!1;e.isWebGLRenderer===!0?y=e.state.buffers.depth.getReversed():y=e.reversedDepthBuffer,e.setRenderTarget(r,0,i),y&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(r,1,i),y&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(r,2,i),y&&e.autoClear===!1&&e.clearDepth(),e.render(t,n),e.setRenderTarget(r,3,i),y&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(r,4,i),y&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),r.texture.generateMipmaps=g,e.setRenderTarget(r,5,i),y&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(h,d,c),e.xr.enabled=m,r.texture.needsPMREMUpdate=!0}},aU=class extends gs{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},ab=\\\"\\\\\\\\[\\\\\\\\]\\\\\\\\.:\\\\\\\\/\\\",nU=new RegExp(\\\"[\\\"+ab+\\\"]\\\",\\\"g\\\"),nb=\\\"[^\\\"+ab+\\\"]\\\",oU=\\\"[^\\\"+ab.replace(\\\"\\\\\\\\.\\\",\\\"\\\")+\\\"]\\\",lU=/((?:WC+[\\\\/:])*)/.source.replace(\\\"WC\\\",nb),uU=/(WCOD+)?/.source.replace(\\\"WCOD\\\",oU),hU=/(?:\\\\.(WC+)(?:\\\\[(.+)\\\\])?)?/.source.replace(\\\"WC\\\",nb),dU=/\\\\.(WC+)(?:\\\\[(.+)\\\\])?/.source.replace(\\\"WC\\\",nb),cU=new RegExp(\\\"^\\\"+lU+uU+hU+dU+\\\"$\\\"),pU=[\\\"material\\\",\\\"materials\\\",\\\"bones\\\",\\\"map\\\"],mU=class{constructor(e,t,r){let i=r||Vr.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,t)}setValue(e,t){let r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},Vr=class Xc{constructor(t,r,i){this.path=r,this.parsedPath=i||Xc.parseTrackName(r),this.node=Xc.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,r,i){return t&&t.isAnimationObjectGroup?new Xc.Composite(t,r,i):new Xc(t,r,i)}static sanitizeNodeName(t){return t.replace(/\\\\s/g,\\\"_\\\").replace(nU,\\\"\\\")}static parseTrackName(t){let r=cU.exec(t);if(r===null)throw new Error(\\\"THREE.PropertyBinding: Cannot parse trackName: \\\"+t);let i={nodeName:r[2],objectName:r[3],objectIndex:r[4],propertyName:r[5],propertyIndex:r[6]},s=i.nodeName&&i.nodeName.lastIndexOf(\\\".\\\");if(s!==void 0&&s!==-1){let a=i.nodeName.substring(s+1);pU.indexOf(a)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=a)}if(i.propertyName===null||i.propertyName.length===0)throw new Error(\\\"THREE.PropertyBinding: can not parse propertyName from trackName: \\\"+t);return i}static findNode(t,r){if(r===void 0||r===\\\"\\\"||r===\\\".\\\"||r===-1||r===t.name||r===t.uuid)return t;if(t.skeleton){let i=t.skeleton.getBoneByName(r);if(i!==void 0)return i}if(t.children){let i=function(a){for(let n=0;n\\u003ca.length;n++){let o=a[n];if(o.name===r||o.uuid===r)return o;let l=i(o.children);if(l)return l}return null},s=i(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,r){t[r]=this.targetObject[this.propertyName]}_getValue_array(t,r){let i=this.resolvedProperty;for(let s=0,a=i.length;s!==a;++s)t[r++]=i[s]}_getValue_arrayElement(t,r){t[r]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,r){this.resolvedProperty.toArray(t,r)}_setValue_direct(t,r){this.targetObject[this.propertyName]=t[r]}_setValue_direct_setNeedsUpdate(t,r){this.targetObject[this.propertyName]=t[r],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,r){this.targetObject[this.propertyName]=t[r],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,r){let i=this.resolvedProperty;for(let s=0,a=i.length;s!==a;++s)i[s]=t[r++]}_setValue_array_setNeedsUpdate(t,r){let i=this.resolvedProperty;for(let s=0,a=i.length;s!==a;++s)i[s]=t[r++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,r){let i=this.resolvedProperty;for(let s=0,a=i.length;s!==a;++s)i[s]=t[r++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,r){this.resolvedProperty[this.propertyIndex]=t[r]}_setValue_arrayElement_setNeedsUpdate(t,r){this.resolvedProperty[this.propertyIndex]=t[r],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,r){this.resolvedProperty[this.propertyIndex]=t[r],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,r){this.resolvedProperty.fromArray(t,r)}_setValue_fromArray_setNeedsUpdate(t,r){this.resolvedProperty.fromArray(t,r),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,r){this.resolvedProperty.fromArray(t,r),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,r){this.bind(),this.getValue(t,r)}_setValue_unbound(t,r){this.bind(),this.setValue(t,r)}bind(){let t=this.node,r=this.parsedPath,i=r.objectName,s=r.propertyName,a=r.propertyIndex;if(t||(t=Xc.findNode(this.rootNode,r.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){Ue(\\\"PropertyBinding: No target node found for track: \\\"+this.path+\\\".\\\");return}if(i){let u=r.objectIndex;switch(i){case\\\"materials\\\":if(!t.material){Ce(\\\"PropertyBinding: Can not bind to material as node does not have a material.\\\",this);return}if(!t.material.materials){Ce(\\\"PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.\\\",this);return}t=t.material.materials;break;case\\\"bones\\\":if(!t.skeleton){Ce(\\\"PropertyBinding: Can not bind to bones as node does not have a skeleton.\\\",this);return}t=t.skeleton.bones;for(let h=0;h\\u003ct.length;h++)if(t[h].name===u){u=h;break}break;case\\\"map\\\":if(\\\"map\\\"in t){t=t.map;break}if(!t.material){Ce(\\\"PropertyBinding: Can not bind to material as node does not have a material.\\\",this);return}if(!t.material.map){Ce(\\\"PropertyBinding: Can not bind to material.map as node.material does not have a map.\\\",this);return}t=t.material.map;break;default:if(t[i]===void 0){Ce(\\\"PropertyBinding: Can not bind to objectName of node undefined.\\\",this);return}t=t[i]}if(u!==void 0){if(t[u]===void 0){Ce(\\\"PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.\\\",this,t);return}t=t[u]}}let n=t[s];if(n===void 0){let u=r.nodeName;Ce(\\\"PropertyBinding: Trying to update property for track: \\\"+u+\\\".\\\"+s+\\\" but it wasn't found.\\\",t);return}let o=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?o=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(a!==void 0){if(s===\\\"morphTargetInfluences\\\"){if(!t.geometry){Ce(\\\"PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.\\\",this);return}if(!t.geometry.morphAttributes){Ce(\\\"PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.\\\",this);return}t.morphTargetDictionary[a]!==void 0&&(a=t.morphTargetDictionary[a])}l=this.BindingType.ArrayElement,this.resolvedProperty=n,this.propertyIndex=a}else n.fromArray!==void 0&&n.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=n):Array.isArray(n)?(l=this.BindingType.EntireArray,this.resolvedProperty=n):this.propertyName=s;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Vr.Composite=mU,Vr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Vr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Vr.prototype.GetterByBindingType=[Vr.prototype._getValue_direct,Vr.prototype._getValue_array,Vr.prototype._getValue_arrayElement,Vr.prototype._getValue_toArray],Vr.prototype.SetterByBindingTypeAndVersioning=[[Vr.prototype._setValue_direct,Vr.prototype._setValue_direct_setNeedsUpdate,Vr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Vr.prototype._setValue_array,Vr.prototype._setValue_array_setNeedsUpdate,Vr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Vr.prototype._setValue_arrayElement,Vr.prototype._setValue_arrayElement_setNeedsUpdate,Vr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Vr.prototype._setValue_fromArray,Vr.prototype._setValue_fromArray_setNeedsUpdate,Vr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var _0e=new Float32Array(1),fU=class extends aN{constructor(e,t,r=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}},gU=class{constructor(e=1,t=0,r=0){this.radius=e,this.phi=t,this.theta=r}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=St(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(St(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}},kN=class tD{static{tD.prototype.isMatrix2=!0}constructor(t,r,i,s){this.elements=[1,0,0,1],t!==void 0&&this.set(t,r,i,s)}identity(){return this.set(1,0,0,1),this}fromArray(t,r=0){for(let i=0;i\\u003c4;i++)this.elements[i]=t[i+r];return this}set(t,r,i,s){let a=this.elements;return a[0]=t,a[2]=r,a[1]=i,a[3]=s,this}},DN=new fe,ob=class{constructor(e=new fe(1/0,1/0),t=new fe(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t\\u003cr;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=DN.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x\\u003cthis.min.x||this.max.y\\u003cthis.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x\\u003c=this.max.x&&e.y>=this.min.y&&e.y\\u003c=this.max.y}containsBox(e){return this.min.x\\u003c=e.min.x&&e.max.x\\u003c=this.max.x&&this.min.y\\u003c=e.min.y&&e.max.y\\u003c=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x\\u003c=this.max.x&&e.max.y>=this.min.y&&e.min.y\\u003c=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,DN).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},ON=new F,qg=new F,fd=new F,gd=new F,lb=new F,yU=new F,xU=new F,fo=class{constructor(e=new F,t=new F){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){ON.subVectors(e,this.start),qg.subVectors(this.end,this.start);let r=qg.dot(qg);if(r===0)return 0;let i=qg.dot(ON)/r;return t&&(i=St(i,0,1)),i}closestPointToPoint(e,t,r){let i=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,t=yU,r=xU){let i=10000000000000001e-32,s,a,n=this.start,o=e.start,l=this.end,u=e.end;fd.subVectors(l,n),gd.subVectors(u,o),lb.subVectors(n,o);let h=fd.dot(fd),d=gd.dot(gd),c=gd.dot(lb);if(h\\u003c=i&&d\\u003c=i)return t.copy(n),r.copy(o),t.sub(r),t.dot(t);if(h\\u003c=i)s=0,a=c/d,a=St(a,0,1);else{let m=fd.dot(lb);if(d\\u003c=i)a=0,s=St(-m/h,0,1);else{let g=fd.dot(gd),y=h*d-g*g;y!==0?s=St((g*c-m*d)/y,0,1):s=0,a=(g*s+c)/d,a\\u003c0?(a=0,s=St(-m/h,0,1)):a>1&&(a=1,s=St((g-m)/h,0,1))}}return t.copy(n).addScaledVector(fd,s),r.copy(o).addScaledVector(gd,a),t.distanceToSquared(r)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}},nl=class{constructor(){this.type=\\\"ShapePath\\\",this.color=new gt,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new po,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,i){return this.currentPath.quadraticCurveTo(e,t,r,i),this}bezierCurveTo(e,t,r,i,s,a){return this.currentPath.bezierCurveTo(e,t,r,i,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(o,l){let u=!1,h=l.length;for(let d=0,c=h-1;d\\u003ch;c=d++){let m=l[d],g=l[c];m.y>o.y!=g.y>o.y&&o.x\\u003c(g.x-m.x)*(o.y-m.y)/(g.y-m.y)+m.x&&(u=!u)}return u}function t(o,l){let u=l.getCenter(new fe);if(e(u,o))return u;let h=u.y,d=[],c=o.length;for(let m=0;m\\u003cc;m++){let g=o[m],y=o[(m+1)%c];if(g.y>h!=y.y>h){let b=g.x+(h-g.y)*(y.x-g.x)/(y.y-g.y);d.push(b)}}return d.length>1&&(d.sort((m,g)=>m-g),u.x=(d[0]+d[1])/2),u}let r=this.userData.style&&this.userData.style.fillRule||\\\"nonzero\\\";r!==\\\"nonzero\\\"&&r!==\\\"evenodd\\\"&&(Ue('Fill-rule \\\"'+r+'\\\" is not supported, falling back to \\\"nonzero\\\".'),r=\\\"nonzero\\\");let i=r===\\\"nonzero\\\"?o=>o!==0:o=>(o&1)!==0,s=[];for(let o of this.subPaths){let l=o.getPoints();if(l.length\\u003c3)continue;let u=dd.area(l);if(u===0)continue;let h=new ob;for(let d=0;d\\u003cl.length;d++)h.expandByPoint(l[d]);s.push({subPath:o,points:l,boundingBox:h,interiorPoint:t(l,h),absArea:Math.abs(u),winding:u\\u003c0?-1:1,container:null,exclude:!1,role:null})}s.sort((o,l)=>l.absArea-o.absArea);for(let o=0;o\\u003cs.length;o++){let l=s[o],u=0;for(let h=o-1;h>=0;h--){let d=s[h];if(d.boundingBox.containsBox(l.boundingBox)&&e(l.interiorPoint,d.points)){l.container=d.exclude?d.container:d,u=d.winding,l.winding+=u;break}}i(l.winding)===i(u)&&(l.exclude=!0)}for(let o of s)o.exclude||(o.role=o.container===null||o.container.role===\\\"hole\\\"?\\\"outer\\\":\\\"hole\\\");let a=[],n=new Map;for(let o of s){if(o.exclude||o.role!==\\\"outer\\\")continue;let l=new cp;l.curves=o.subPath.curves,a.push(l),n.set(o,l)}for(let o of s){if(o.exclude||o.role!==\\\"hole\\\")continue;let l=n.get(o.container);if(!l)continue;let u=new po;u.curves=o.subPath.curves,l.holes.push(u)}return a}};function vU(e,t,r,i){let s=bU(i);switch(r){case ov:return e*t;case io:return e*t/s.components*s.byteLength;case jh:return e*t/s.components*s.byteLength;case ha:return e*t*2/s.components*s.byteLength;case Hh:return e*t*2/s.components*s.byteLength;case Wh:return e*t*3/s.components*s.byteLength;case pi:return e*t*4/s.components*s.byteLength;case zf:return e*t*4/s.components*s.byteLength;case Yc:case Zc:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Jc:case Qc:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case hv:case cv:return Math.max(e,16)*Math.max(t,8)/4;case uv:case dv:return Math.max(e,8)*Math.max(t,8)/2;case Vf:case Gf:case jf:case Hf:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Wf:case Kc:case Xf:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case $f:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case qf:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case Yf:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case Zf:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case Jf:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case Qf:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case Kf:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case eg:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case tg:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case rg:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case ig:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case sg:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case ag:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case ng:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case og:case lg:case ug:return Math.ceil(e/4)*Math.ceil(t/4)*16;case hg:case dg:return Math.ceil(e/4)*Math.ceil(t/4)*8;case ep:case cg:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${r} format.`)}function bU(e){switch(e){case Si:case cu:return{byteLength:1,components:1};case Ko:case pu:case Dt:return{byteLength:2,components:1};case av:case nv:return{byteLength:2,components:4};case gr:case ci:case Er:return{byteLength:4,components:1};case Of:case Uf:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${e}.`)}typeof __THREE_DEVTOOLS__\\u003c\\\"u\\\"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\\\"register\\\",{detail:{revision:\\\"185\\\"}})),typeof window\\u003c\\\"u\\\"&&(window.__THREE__?Ue(\\\"WARNING: Multiple instances of Three.js being imported.\\\"):window.__THREE__=\\\"185\\\");var TU=[\\\"alphaMap\\\",\\\"alphaTest\\\",\\\"anisotropy\\\",\\\"anisotropyMap\\\",\\\"anisotropyRotation\\\",\\\"aoMap\\\",\\\"aoMapIntensity\\\",\\\"attenuationColor\\\",\\\"attenuationDistance\\\",\\\"bumpMap\\\",\\\"clearcoat\\\",\\\"clearcoatMap\\\",\\\"clearcoatNormalMap\\\",\\\"clearcoatNormalScale\\\",\\\"clearcoatRoughness\\\",\\\"color\\\",\\\"dispersion\\\",\\\"displacementMap\\\",\\\"emissive\\\",\\\"emissiveIntensity\\\",\\\"emissiveMap\\\",\\\"envMap\\\",\\\"envMapIntensity\\\",\\\"envMapRotation\\\",\\\"gradientMap\\\",\\\"ior\\\",\\\"iridescence\\\",\\\"iridescenceIOR\\\",\\\"iridescenceMap\\\",\\\"iridescenceThicknessMap\\\",\\\"lightMap\\\",\\\"lightMapIntensity\\\",\\\"map\\\",\\\"matcap\\\",\\\"metalness\\\",\\\"metalnessMap\\\",\\\"normalMap\\\",\\\"normalScale\\\",\\\"opacity\\\",\\\"roughness\\\",\\\"roughnessMap\\\",\\\"sheen\\\",\\\"sheenColor\\\",\\\"sheenColorMap\\\",\\\"sheenRoughnessMap\\\",\\\"shininess\\\",\\\"specular\\\",\\\"specularColor\\\",\\\"specularColorMap\\\",\\\"specularIntensity\\\",\\\"specularIntensityMap\\\",\\\"specularMap\\\",\\\"thickness\\\",\\\"transmission\\\",\\\"transmissionMap\\\"],UN=new WeakMap,zN=new WeakMap,VN=new WeakMap,SU=class{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=TU,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}needsVelocity(e){let t=e.getMRT();return t!==null&&t.has(\\\"velocity\\\")}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){let{geometry:r,object:i}=e;if(t={geometryId:r.id,worldMatrix:i.matrixWorld.clone()},i.center&&(t.center=i.center.clone()),i.morphTargetInfluences&&(t.morphTargetInfluences=i.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),e.material.transmission>0){let{width:n,height:o}=e.context;t.bufferWidth=n,t.bufferHeight=o}let{environmentIntensity:s,environmentRotation:a}=e.scene;t.environmentIntensity=s,t.environmentRotation=a.clone(),t.lights=this.getLightsData(e.lightsNode.getLights(),[]),this.renderObjects.set(e,t)}return t}getAttributesData(e){let t={};for(let r in e){let i=e[r];t[r]={id:i.isInterleavedBufferAttribute?i.data.uuid:i.id,version:i.isInterleavedBufferAttribute?i.data.version:i.version}}return t}containsNode(e){let t=e.material;for(let r in t)if(t[r]&&t[r].isNode)return!0;return!!(e.context.modelViewMatrix||e.context.modelNormalViewMatrix||e.context.getAO||e.context.getShadow)}getGeometryData(e){let t=VN.get(e);return t===void 0&&(t={_renderId:-1,_equal:!1,attributes:this.getAttributesData(e.attributes),indexId:e.index?e.index.id:null,indexVersion:e.index?e.index.version:null,drawRange:{start:e.drawRange.start,count:e.drawRange.count}},VN.set(e,t)),t}getMaterialData(e){let t=zN.get(e);if(t===void 0){t={_renderId:-1,_equal:!1};for(let r of this.refreshUniforms){let i=e[r];i!=null&&(typeof i==\\\"object\\\"&&i.clone!==void 0?i.isTexture===!0?t[r]={id:i.id,version:0}:t[r]=i.clone():t[r]=i)}zN.set(e,t)}return t}equals(e,t,r){let{object:i,material:s,geometry:a}=e,n=this.getRenderObjectData(e);if(n.worldMatrix.equals(i.matrixWorld)!==!0)return n.worldMatrix.copy(i.matrixWorld),!1;let o=this.getMaterialData(e.material);if(o._renderId!==r){o._renderId=r;for(let h in o){let d=o[h],c=s[h];if(h!==\\\"_renderId\\\"&&h!==\\\"_equal\\\"){if(d.equals!==void 0){if(d.equals(c)===!1)return d.copy(c),o._equal=!1,!1}else if(c.isTexture===!0){if(d.id!==c.id||d.version!==c.version)return d.id=c.id,d.version=c.version,o._equal=!1,!1}else if(d!==c)return o[h]=c,o._equal=!1,!1}}if(o.transmission>0){let{width:h,height:d}=e.context;if(n.bufferWidth!==h||n.bufferHeight!==d)return n.bufferWidth=h,n.bufferHeight=d,o._equal=!1,!1}o._equal=!0}else if(o._equal===!1)return!1;if(n.geometryId!==a.id)return n.geometryId=a.id,!1;let l=this.getGeometryData(e.geometry);if(l._renderId!==r){l._renderId=r;let h=a.attributes,d=l.attributes,c=0,m=0;for(let T in h)c++;for(let T in d){m++;let w=d[T],N=h[T];if(N===void 0)return delete d[T],l._equal=!1,!1;let C=N.isInterleavedBufferAttribute?N.data.uuid:N.id,R=N.isInterleavedBufferAttribute?N.data.version:N.version;if(w.id!==C||w.version!==R)return w.id=C,w.version=R,l._equal=!1,!1}if(m!==c)return l.attributes=this.getAttributesData(h),l._equal=!1,!1;let g=a.index,y=l.indexId,b=l.indexVersion,v=g?g.id:null,S=g?g.version:null;if(y!==v||b!==S)return l.indexId=v,l.indexVersion=S,l._equal=!1,!1;if(l.drawRange.start!==a.drawRange.start||l.drawRange.count!==a.drawRange.count)return l.drawRange.start=a.drawRange.start,l.drawRange.count=a.drawRange.count,l._equal=!1,!1;l._equal=!0}else if(l._equal===!1)return!1;if(n.morphTargetInfluences){let h=!1;for(let d=0;d\\u003cn.morphTargetInfluences.length;d++)n.morphTargetInfluences[d]!==i.morphTargetInfluences[d]&&(n.morphTargetInfluences[d]=i.morphTargetInfluences[d],h=!0);if(h)return!1}if(n.lights){for(let h=0;h\\u003ct.length;h++)if(n.lights[h].map!==t[h].map)return!1}let u=e.scene;return u.environment!==null&&s.envMap===null&&(n.environmentIntensity!==u.environmentIntensity||n.environmentRotation.equals(u.environmentRotation)===!1)?(n.environmentIntensity=u.environmentIntensity,n.environmentRotation.copy(u.environmentRotation),!1):n.center&&n.center.equals(i.center)===!1?(n.center.copy(i.center),!1):(e.bundle!==null&&(n.version=e.bundle.version),!0)}getLightsData(e,t){t.length=0;for(let r of e)r.isSpotLight===!0&&r.map!==null&&t.push({map:r.map.version});return t}getLights(e,t){let r=UN.get(e);return r===void 0&&(r={renderId:-1,lightsData:[]},UN.set(e,r)),r.renderId===t||(r.renderId=t,this.getLightsData(e.getLights(),r.lightsData)),r.lightsData}needsRefresh(e,t){if(this.hasNode||this.hasAnimation||this.firstInitialization(e)||this.needsVelocity(t.renderer))return!0;let{renderId:r}=t;if(this.renderId!==r)return this.renderId=r,!0;let i=e.object.static===!0,s=e.bundle!==null&&e.bundle.static===!0&&this.getRenderObjectData(e).version===e.bundle.version;if(i||s)return!1;let a=this.getLights(e.lightsNode,r);return this.equals(e,a,r)!==!0}},_U=[/^StackTrace\\\\.js$/,/^TSLCore\\\\.js$/,/^.*Node\\\\.js$/,/^three\\\\.webgpu.*\\\\.js$/];function wU(e){let t=/(?:at\\\\s+(.+?)\\\\s+\\\\()?(?:(.+?)@)?([^@\\\\s()]+):(\\\\d+):(\\\\d+)/;return e.split(`\\n`).map(r=>{let i=r.match(t);if(!i)return null;let s=i[1]||i[2]||\\\"\\\",a=i[3].split(\\\"?\\\")[0],n=parseInt(i[4],10),o=parseInt(i[5],10),l=a.split(\\\"/\\\").pop();return{fn:s,file:l,line:n,column:o}}).filter(r=>r&&!_U.some(i=>i.test(r.file)))}var $r=class{constructor(e=null){this.isStackTrace=!0,this.stack=wU(e||new Error().stack)}getLocation(){if(this.stack.length===0)return\\\"[Unknown location]\\\";let e=this.stack[0],t=e.fn;return`${t?`\\\"${t}()\\\" at `:\\\"\\\"}\\\"${e.file}:${e.line}\\\"`}getError(e){if(this.stack.length===0)return e;let t=this.stack.map(r=>{let i=`${r.file}:${r.line}:${r.column}`;return r.fn?` at ${r.fn} (${i})`:` at ${i}`}).join(`\\n`);return`${e}\\n${t}`}};function ub(e,t=0){let r=3735928559^t,i=1103547991^t;if(Array.isArray(e))for(let s=0,a;s\\u003ce.length;s++)a=e[s],r=Math.imul(r^a,2654435761),i=Math.imul(i^a,1597334677);else for(let s=0,a;s\\u003ce.length;s++)a=e.charCodeAt(s),r=Math.imul(r^a,2654435761),i=Math.imul(i^a,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&i)+(r>>>0)}var yd=e=>ub(e),Sp=e=>ub(e),_p=(...e)=>ub(e),MU=new Map([[1,\\\"float\\\"],[2,\\\"vec2\\\"],[3,\\\"vec3\\\"],[4,\\\"vec4\\\"],[9,\\\"mat3\\\"],[16,\\\"mat4\\\"]]),GN=new WeakMap;function WN(e){return MU.get(e)}function Yg(e){if(/[iu]?vec\\\\d/.test(e))return e.startsWith(\\\"ivec\\\")?Int32Array:e.startsWith(\\\"uvec\\\")?Uint32Array:Float32Array;if(/mat\\\\d/.test(e)||/float/.test(e))return Float32Array;if(/uint/.test(e))return Uint32Array;if(/int/.test(e))return Int32Array;throw new Error(`THREE.NodeUtils: Unsupported type: ${e}`)}function jN(e){if(/float|int|uint|bool/.test(e))return 1;if(/vec2/.test(e))return 2;if(/vec3/.test(e))return 3;if(/vec4/.test(e)||/mat2/.test(e))return 4;if(/mat3/.test(e))return 9;if(/mat4/.test(e))return 16;Ce(`TSL: Unsupported type: ${e}`,new $r)}function NU(e){if(/float|int|uint|bool/.test(e))return 1;if(/vec2/.test(e))return 2;if(/vec3/.test(e))return 3;if(/vec4/.test(e)||/mat2/.test(e))return 4;if(/mat3/.test(e))return 12;if(/mat4/.test(e))return 16;Ce(`TSL: Unsupported type: ${e}`,new $r)}function AU(e){if(/float|int|uint|bool/.test(e))return 1;if(/vec2/.test(e))return 2;if(/vec3/.test(e)||/vec4/.test(e))return 4;if(/mat2/.test(e))return 2;if(/mat3/.test(e)||/mat4/.test(e))return 4;Ce(`TSL: Unsupported type: ${e}`,new $r)}function ol(e){if(e==null)return null;let t=typeof e;return e.isNode===!0?\\\"node\\\":t===\\\"number\\\"?\\\"float\\\":t===\\\"boolean\\\"?\\\"bool\\\":t===\\\"string\\\"?\\\"string\\\":t===\\\"function\\\"?\\\"shader\\\":e.isVector2===!0?\\\"vec2\\\":e.isVector3===!0?\\\"vec3\\\":e.isVector4===!0?\\\"vec4\\\":e.isMatrix2===!0?\\\"mat2\\\":e.isMatrix3===!0?\\\"mat3\\\":e.isMatrix4===!0?\\\"mat4\\\":e.isColor===!0?\\\"color\\\":e instanceof ArrayBuffer?\\\"ArrayBuffer\\\":null}function hb(e,...t){let r=e?e.slice(-4):void 0;return t.length===1&&(r===\\\"vec2\\\"?t=[t[0],t[0]]:r===\\\"vec3\\\"?t=[t[0],t[0],t[0]]:r===\\\"vec4\\\"&&(t=[t[0],t[0],t[0],t[0]])),e===\\\"color\\\"?new gt(...t):r===\\\"vec2\\\"?new fe(...t):r===\\\"vec3\\\"?new F(...t):r===\\\"vec4\\\"?new Wt(...t):r===\\\"mat2\\\"?new kN(...t):r===\\\"mat3\\\"?new Dr(...t):r===\\\"mat4\\\"?new We(...t):e===\\\"bool\\\"?t[0]||!1:e===\\\"float\\\"||e===\\\"int\\\"||e===\\\"uint\\\"?t[0]||0:e===\\\"string\\\"?t[0]||\\\"\\\":e===\\\"ArrayBuffer\\\"?RU(t[0]):null}function HN(e){let t=GN.get(e);return t===void 0&&(t={},GN.set(e,t)),t}function CU(e){let t=\\\"\\\",r=new Uint8Array(e);for(let i=0;i\\u003cr.length;i++)t+=String.fromCharCode(r[i]);return btoa(t)}function RU(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0)).buffer}var xd={VERTEX:\\\"vertex\\\",FRAGMENT:\\\"fragment\\\"},ut={NONE:\\\"none\\\",FRAME:\\\"frame\\\",RENDER:\\\"render\\\",OBJECT:\\\"object\\\"},EU={BOOLEAN:\\\"bool\\\",INTEGER:\\\"int\\\",FLOAT:\\\"float\\\",VECTOR2:\\\"vec2\\\",VECTOR3:\\\"vec3\\\",VECTOR4:\\\"vec4\\\",MATRIX2:\\\"mat2\\\",MATRIX3:\\\"mat3\\\",MATRIX4:\\\"mat4\\\"},Fi={READ_ONLY:\\\"readOnly\\\",WRITE_ONLY:\\\"writeOnly\\\",READ_WRITE:\\\"readWrite\\\"},XN=[\\\"fragment\\\",\\\"vertex\\\"],Zg=[\\\"setup\\\",\\\"analyze\\\",\\\"generate\\\"],Jg=[...XN,\\\"compute\\\"],Su=[\\\"x\\\",\\\"y\\\",\\\"z\\\",\\\"w\\\"],PU={analyze:\\\"setup\\\",generate:\\\"analyze\\\"},BU=0,Ke=class rD extends hn{static get type(){return\\\"Node\\\"}constructor(t=null){super(),this.nodeType=t,this.updateType=ut.NONE,this.updateBeforeType=ut.NONE,this.updateAfterType=ut.NONE,this.version=0,this.name=\\\"\\\",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=BU++,this.stackTrace=null,rD.captureStackTrace===!0&&(this.stackTrace=new $r)}set needsUpdate(t){t===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Bt.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(t,r){return this.updateType=r,this.update=t.bind(this),this}onFrameUpdate(t){return this.onUpdate(t,ut.FRAME)}onRenderUpdate(t){return this.onUpdate(t,ut.RENDER)}onObjectUpdate(t){return this.onUpdate(t,ut.OBJECT)}onReference(t){return this.updateReference=t.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:t}of this._getChildren())yield t}dispose(){this.dispatchEvent({type:\\\"dispose\\\"})}traverse(t){t(this);for(let r of this.getChildren())r.traverse(t)}_getChildren(t=new Set){let r=[];t.add(this);for(let i of Object.getOwnPropertyNames(this)){let s=this[i];if(!(i.startsWith(\\\"_\\\")===!0||t.has(s))){if(Array.isArray(s)===!0)for(let a=0;a\\u003cs.length;a++){let n=s[a];n&&n.isNode===!0&&r.push({property:i,index:a,childNode:n})}else if(s&&s.isNode===!0)r.push({property:i,childNode:s});else if(s&&Object.getPrototypeOf(s)===Object.prototype)for(let a in s){if(a.startsWith(\\\"_\\\")===!0)continue;let n=s[a];n&&n.isNode===!0&&r.push({property:i,index:a,childNode:n})}}}return r}getCacheKey(t=!1,r=null){if(t=t||this.version!==this._cacheKeyVersion,t===!0||this._cacheKey===null){r===null&&(r=new Set);let i=[];for(let{property:s,childNode:a}of this._getChildren(r))i.push(yd(s.slice(0,-4)),a.getCacheKey(t,r));this._cacheKey=_p(Sp(i),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}getHash(){return String(this.id)}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(t){let r=this.getNodeType(t);return t.getElementType(r)}getMemberType(){return\\\"void\\\"}getNodeType(t,r=null){let i=t.getDataFromNode(this),s;return r!==null?(i.typeFromOutput=i.typeFromOutput||{},s=i.typeFromOutput[r],s===void 0&&(s=this.generateNodeType(t,r),i.typeFromOutput[r]=s)):(s=i.type,s===void 0&&(s=this.generateNodeType(t),i.type=s)),s}generateNodeType(t,r=null){let i=t.getNodeProperties(this);return i.outputNode?i.outputNode.getNodeType(t,r):this.nodeType}getShared(t){let r=this.getHash(t),i=t.getNodeFromHash(r),s=null;if(i&&i!==this)s=i;else if(t.context.overrideNodes){let a=t.context.overrideNodes.get(this);if(a){let n=t.getDataFromNode(this);n.isOverwritten!==!0?(n.isOverwritten=!0,s=a(t).overrideNode(this,null),n.sharedNode=s):s=n.sharedNode}}return s||this}getArrayCount(){return null}setup(t){let r=t.getNodeProperties(this),i=0;for(let s of this.getChildren())r[\\\"node\\\"+i++]=s;return r.outputNode||null}analyze(t,r=null){let i=t.increaseUsage(this);if(this.parents===!0){let s=t.getDataFromNode(this,\\\"any\\\");s.stages=s.stages||{},s.stages[t.shaderStage]=s.stages[t.shaderStage]||[],s.stages[t.shaderStage].push(r)}if(i===1){let s=t.getNodeProperties(this);for(let a of Object.values(s))a&&a.isNode===!0&&a.build(t,this)}}generate(t,r){let{outputNode:i}=t.getNodeProperties(this);if(i&&i.isNode===!0)return i.build(t,r)}updateBefore(){Ue(\\\"Abstract function.\\\")}updateAfter(){Ue(\\\"Abstract function.\\\")}update(){Ue(\\\"Abstract function.\\\")}before(t){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(t),this}build(t,r=null){let i=this.getShared(t);if(this!==i)return i.build(t,r);if(this._beforeNodes!==null){let l=this._beforeNodes;this._beforeNodes=null;for(let u of l)u.build(t,r);this._beforeNodes=l}let s=t.getDataFromNode(this);s.buildStages=s.buildStages||{},s.buildStages[t.buildStage]=!0;let a=PU[t.buildStage];if(a&&s.buildStages[a]!==!0){let l=t.getBuildStage();t.setBuildStage(a),this.build(t),t.setBuildStage(l)}t.addChain(this);let n=null,o=t.getBuildStage();if(o===\\\"setup\\\"){t.addNode(this),this.updateReference(t);let l=t.getNodeProperties(this);if(l.initialized!==!0){l.initialized=!0,l.outputNode=this.setup(t)||l.outputNode||null;for(let u of Object.values(l))if(u&&u.isNode===!0){if(u.parents===!0){let h=t.getNodeProperties(u);h.parents=h.parents||[],h.parents.push(this)}u.build(t)}t.addSequentialNode(this)}n=l.outputNode}else if(o===\\\"analyze\\\")this.analyze(t,r);else if(o===\\\"generate\\\"){if(this.generate.length\\u003c2){let l=this.getNodeType(t),u=t.getDataFromNode(this);n=u.snippet,n===void 0?u.generated===void 0?(u.generated=!0,n=this.generate(t)||\\\"\\\",u.snippet=n):(Ue(\\\"Node: Recursion detected.\\\",this),n=\\\"/* Recursion detected. */\\\"):u.flowCodes!==void 0&&t.context.nodeBlock!==void 0&&t.addFlowCodeHierarchy(this,t.context.nodeBlock),n=t.format(n,l,r)}else n=this.generate(t,r)||\\\"\\\";n===\\\"\\\"&&r!==null&&r!==\\\"void\\\"&&r!==\\\"OutputType\\\"&&(Ce(`TSL: Invalid generated code, expected a \\\"${r}\\\".`),n=t.generateConst(r))}return t.removeChain(this),n}getSerializeChildren(){return this._getChildren()}serialize(t){let r=this.getSerializeChildren(),i={};for(let{property:s,index:a,childNode:n}of r)a!==void 0?(i[s]===void 0&&(i[s]=Number.isInteger(a)?[]:{}),i[s][a]=n.toJSON(t.meta).uuid):i[s]=n.toJSON(t.meta).uuid;Object.keys(i).length>0&&(t.inputNodes=i)}deserialize(t){if(t.inputNodes!==void 0){let r=t.meta.nodes;for(let i in t.inputNodes)if(Array.isArray(t.inputNodes[i])){let s=[];for(let a of t.inputNodes[i])s.push(r[a]);this[i]=s}else if(typeof t.inputNodes[i]==\\\"object\\\"){let s={};for(let a in t.inputNodes[i]){let n=t.inputNodes[i][a];s[a]=r[n]}this[i]=s}else{let s=t.inputNodes[i];this[i]=r[s]}}}toJSON(t){let{uuid:r,type:i}=this,s=t===void 0||typeof t==\\\"string\\\";s&&(t={textures:{},images:{},nodes:{}});let a=t.nodes[r];a===void 0&&(a={uuid:r,type:i,meta:t,metadata:{version:4.7,type:\\\"Node\\\",generator:\\\"Node.toJSON\\\"}},s!==!0&&(t.nodes[a.uuid]=a),this.serialize(a),delete a.meta);function n(o){let l=[];for(let u in o){let h=o[u];delete h.metadata,l.push(h)}return l}if(s){let o=n(t.textures),l=n(t.images),u=n(t.nodes);o.length>0&&(a.textures=o),l.length>0&&(a.images=l),u.length>0&&(a.nodes=u)}return a}};Ke.captureStackTrace=!1;var _u=class extends Ke{static get type(){return\\\"ArrayElementNode\\\"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){let t=this.indexNode.getNodeType(e),r=this.node.build(e),i=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:\\\"uint\\\");return`${r}[ ${i} ]`}},$N=class extends Ke{static get type(){return\\\"ConvertNode\\\"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){let t=this.node.getNodeType(e),r=null;for(let i of this.convertTo.split(\\\"|\\\"))(r===null||e.getTypeLength(t)===e.getTypeLength(i))&&(r=i);return r}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let r=this.node,i=this.getNodeType(e),s=r.build(e,i);return e.format(s,i,t)}},rr=class extends Ke{static get type(){return\\\"TempNode\\\"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()===\\\"generate\\\"){let r=e.getVectorType(this.getNodeType(e,t)),i=e.getDataFromNode(this);if(i.propertyName!==void 0)return e.format(i.propertyName,r,t);if(r!==\\\"void\\\"&&t!==\\\"void\\\"&&this.hasDependencies(e)){let s=super.build(e,r),a=e.getVarFromNode(this,null,r),n=e.getPropertyName(a);return e.addLineFlowCode(`${n} = ${s}`,this),i.snippet=s,i.propertyName=n,e.format(i.propertyName,r,t)}}return super.build(e,t)}},IU=class extends rr{static get type(){return\\\"JoinNode\\\"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,r)=>t+e.getTypeLength(r.getNodeType(e)),0))}generate(e,t){let r=this.getNodeType(e),i=e.getTypeLength(r),s=this.nodes,a=e.getComponentType(r),n=[],o=0;for(let u of s){if(o>=i){Ce(`TSL: Length of parameters exceeds maximum length of function '${r}()' type.`,this.stackTrace);break}let h=u.getNodeType(e),d=e.getTypeLength(h),c;if(o+d>i&&(Ce(`TSL: Length of '${r}()' data exceeds maximum length of output type.`,this.stackTrace),d=i-o,h=e.getTypeFromLength(d)),o+=d,c=u.build(e,h),e.getComponentType(h)!==a){let m=e.getTypeFromLength(d,a);c=e.format(c,h,m)}n.push(c)}let l=`${e.getType(r)}( ${n.join(\\\", \\\")} )`;return e.format(l,r,t)}},FU=Su.join(\\\"\\\"),qN=class extends Ke{static get type(){return\\\"SplitNode\\\"}constructor(e,t=\\\"x\\\"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(Su.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){let r=this.node,i=e.getTypeLength(r.getNodeType(e)),s=null;if(i>1){let a=null;this.getVectorLength()>=i&&(a=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let n=r.build(e,a);this.components.length===i&&this.components===FU.slice(0,this.components.length)?s=e.format(n,a,t):s=e.format(`${n}.${this.components}`,this.getNodeType(e),t)}else s=r.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},LU=class extends rr{static get type(){return\\\"SetNode\\\"}constructor(e,t,r){super(),this.sourceNode=e,this.components=t,this.targetNode=r}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:r,targetNode:i}=this,s=this.getNodeType(e),a=e.getComponentType(i.getNodeType(e)),n=e.getTypeFromLength(r.length,a),o=i.build(e,n),l=t.build(e,s),u=e.getTypeLength(s),h=[];for(let d=0;d\\u003cu;d++){let c=Su[d];c===r[0]?(h.push(o),d+=r.length-1):h.push(l+\\\".\\\"+c)}return`${e.getType(s)}( ${h.join(\\\", \\\")} )`}},kU=class extends rr{static get type(){return\\\"FlipNode\\\"}constructor(e,t){super(),this.sourceNode=e,this.components=t}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:r}=this,i=this.getNodeType(e),s=r.build(e),a=e.getVarFromNode(this),n=e.getPropertyName(a);e.addLineFlowCode(n+\\\" = \\\"+s,this);let o=e.getTypeLength(i),l=[],u=0;for(let h=0;h\\u003co;h++){let d=Su[h];d===t[u]?(l.push(\\\"1.0 - \\\"+(n+\\\".\\\"+d)),u++):l.push(n+\\\".\\\"+d)}return`${e.getType(i)}( ${l.join(\\\", \\\")} )`}},db=class extends Ke{static get type(){return\\\"InputNode\\\"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}generateNodeType(){return this.nodeType===null?ol(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=ol(this.value),e.nodeType=this.nodeType,e.valueType===\\\"ArrayBuffer\\\"&&(e.value=CU(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?hb(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){Ue(\\\"Abstract function.\\\")}},YN=/float|u?int/,vn=class extends db{static get type(){return\\\"ConstNode\\\"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let r=this.getNodeType(e);return YN.test(r)&&YN.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),r,t)}},DU=class extends Ke{static get type(){return\\\"MemberNode\\\"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!==\\\"void\\\"}generateNodeType(e){return this.hasMember(e)===!1?\\\"float\\\":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return\\\"float\\\";let r=this.getNodeType(e);return e.getStructTypeNode(r).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){Ue(`TSL: Member \\\"${this.property}\\\" does not exist in struct.`,this.stackTrace);let t=this.getNodeType(e);return e.generateConst(t)}return this.structNode.build(e)+\\\".\\\"+this.property}},ll=null,cb=new Map;function xe(e,t){if(cb.has(e)){Ue(`TSL: Redefinition of method chaining '${e}'.`);return}if(typeof t!=\\\"function\\\")throw new Error(`THREE.TSL: Node element ${e} is not a function`);cb.set(e,t),e!==\\\"assign\\\"&&(Ke.prototype[e]=function(...r){return this.isStackNode?this.addToStack(t(...r)):t(this,...r)},Ke.prototype[e+\\\"Assign\\\"]=function(...r){return this.isStackNode?this.assign(r[0],t(...r)):this.assign(t(this,...r))})}var OU=e=>e.replace(/r|s/g,\\\"x\\\").replace(/g|t/g,\\\"y\\\").replace(/b|p/g,\\\"z\\\").replace(/a|q/g,\\\"w\\\"),ZN=e=>OU(e).split(\\\"\\\").sort().join(\\\"\\\");Ke.prototype.assign=function(...e){if(this.isStackNode!==!0)return ll!==null?ll.assign(this,...e):Ce(\\\"TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().\\\",new $r),this;{let t=cb.get(\\\"assign\\\");return this.addToStack(t(...e))}},Ke.prototype.toVarIntent=function(){return this},Ke.prototype.get=function(e){return new DU(this,e)};var wp={};function Qg(e,t,r){wp[e]=wp[t]=wp[r]={get(){this._cache=this._cache||{};let n=this._cache[e];return n===void 0&&(n=new qN(this,e),this._cache[e]=n),n},set(n){this[e].assign(Ye(n))}};let i=e.toUpperCase(),s=t.toUpperCase(),a=r.toUpperCase();Ke.prototype[\\\"set\\\"+i]=Ke.prototype[\\\"set\\\"+s]=Ke.prototype[\\\"set\\\"+a]=function(n){let o=ZN(e);return new LU(this,o,Ye(n))},Ke.prototype[\\\"flip\\\"+i]=Ke.prototype[\\\"flip\\\"+s]=Ke.prototype[\\\"flip\\\"+a]=function(){let n=ZN(e);return new kU(this,n)}}var bn=[\\\"x\\\",\\\"y\\\",\\\"z\\\",\\\"w\\\"],Tn=[\\\"r\\\",\\\"g\\\",\\\"b\\\",\\\"a\\\"],Sn=[\\\"s\\\",\\\"t\\\",\\\"p\\\",\\\"q\\\"];for(let e=0;e\\u003c4;e++){let t=bn[e],r=Tn[e],i=Sn[e];Qg(t,r,i);for(let s=0;s\\u003c4;s++){t=bn[e]+bn[s],r=Tn[e]+Tn[s],i=Sn[e]+Sn[s],Qg(t,r,i);for(let a=0;a\\u003c4;a++){t=bn[e]+bn[s]+bn[a],r=Tn[e]+Tn[s]+Tn[a],i=Sn[e]+Sn[s]+Sn[a],Qg(t,r,i);for(let n=0;n\\u003c4;n++)t=bn[e]+bn[s]+bn[a]+bn[n],r=Tn[e]+Tn[s]+Tn[a]+Tn[n],i=Sn[e]+Sn[s]+Sn[a]+Sn[n],Qg(t,r,i)}}}for(let e=0;e\\u003c32;e++)wp[e]={get(){this._cache=this._cache||{};let t=this._cache[e];return t===void 0&&(t=new _u(this,new vn(e,\\\"uint\\\")),this._cache[e]=t),t},set(t){this[e].assign(Ye(t))}};Object.defineProperties(Ke.prototype,wp);var UU=function(e,t=null){let r=ol(e);return r===\\\"node\\\"?e:t===null&&(r===\\\"float\\\"||r===\\\"boolean\\\")||r&&r!==\\\"shader\\\"&&r!==\\\"string\\\"?Ye(gb(e,t)):r===\\\"shader\\\"?e.isFn?e:Q(e):e},zU=function(e,t=null){for(let r in e)e[r]=Ye(e[r],t);return e},VU=function(e,t=null){let r=e.length;for(let i=0;i\\u003cr;i++)e[i]=Ye(e[i],t);return e},JN=function(e,t=null,r=null,i=null){function s(h){return i!==null?(h=Ye(Object.assign(h,i)),i.intent===!0&&(h=h.toVarIntent())):h=Ye(h),h}let a,n=t,o,l;function u(h){let d;return n?d=/[a-z]/i.test(n)?n+\\\"()\\\":n:d=e.type,o!==void 0&&h.length\\u003co?(Ce(`TSL: \\\"${d}\\\" parameter length is less than minimum required.`,new $r),h.concat(new Array(o-h.length).fill(0))):l!==void 0&&h.length>l?(Ce(`TSL: \\\"${d}\\\" parameter length exceeds limit.`,new $r),h.slice(0,l)):h}return t===null?a=(...h)=>s(new e(...wu(u(h)))):r!==null?(r=Ye(r),a=(...h)=>s(new e(t,...wu(u(h)),r))):a=(...h)=>s(new e(t,...wu(u(h)))),a.setParameterLength=(...h)=>(h.length===1?o=l=h[0]:h.length===2&&([o,l]=h),a),a.setName=h=>(n=h,a),a},GU=function(e,...t){return new e(...wu(t))},WU=class extends Ke{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,rawInputs:r}=this,i=e.getNodeProperties(t),s=e.getClosestSubBuild(t.subBuilds)||\\\"\\\",a=s||\\\"default\\\";if(i[a])return i[a];let n=e.subBuildFn,o=e.fnCall;e.subBuildFn=s,e.fnCall=this;let l=null;if(t.layout){if(r){let d=t.layout.inputs;if(QN(r)){let c=r;for(let m=0;m\\u003cd.length;m++){let g=c[m];g&&g.isNode&&g.build(e)}}else{let c=r[0];for(let m of d){let g=c[m.name];g&&g.isNode&&g.build(e)}}}let u=e.buildFunctionNode(t);e.addInclude(u);let h=r?jU(r):null;l=u.call(h)}else{let u=new Proxy(e,{get:(g,y,b)=>{let v;return Symbol.iterator===y?v=function*(){yield void 0}:v=Reflect.get(g,y,b),v}}),h=r?HU(r):null,d=Array.isArray(r)?r.length>0:r!==null,c=t.jsFunc,m=d||c.length>1?c(h,u):c(u);l=Ye(m)}return e.subBuildFn=n,e.fnCall=o,t.once&&(i[a]=l),l}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),r=e.getSubBuildOutput(this);return t[r]=t[r]||this.setupOutput(e),t[r].subBuild=e.getClosestSubBuild(this),t[r]}build(e,t=null){let r=null,i=e.getBuildStage(),s=e.getNodeProperties(this),a=e.getSubBuildOutput(this),n=this.getOutputNode(e),o=e.fnCall;if(e.fnCall=this,i===\\\"setup\\\"){let l=e.getSubBuildProperty(\\\"initialized\\\",this);if(s[l]!==!0&&(s[l]=!0,s[a]=this.getOutputNode(e),s[a].build(e),this.shaderNode.subBuilds))for(let u of e.chaining){let h=e.getDataFromNode(u,\\\"any\\\");h.subBuilds=h.subBuilds||new Set;for(let d of this.shaderNode.subBuilds)h.subBuilds.add(d)}r=s[a]}else i===\\\"analyze\\\"?n.build(e,t):i===\\\"generate\\\"&&(r=n.build(e,t)||\\\"\\\");return e.fnCall=o,r}};function QN(e){return e[0]&&(e[0].isNode||Object.getPrototypeOf(e[0])!==Object.prototype)}function jU(e){let t;return t0(e),QN(e)?t=[...e]:t=e[0],t}function HU(e){let t=0;return t0(e),new Proxy(e,{get:(r,i,s)=>{let a;if(i===\\\"length\\\")return a=e.length,a;if(Symbol.iterator===i)a=function*(){for(let n of e)yield Ye(n)};else{if(e.length>0)if(Object.getPrototypeOf(e[0])===Object.prototype){let n=e[0];n[i]===void 0?a=n[t++]:a=Reflect.get(n,i,s)}else e[0]instanceof Ke&&(e[i]===void 0?a=e[t++]:a=Reflect.get(e,i,s));else a=Reflect.get(r,i,s);a=Ye(a)}return a}})}var XU=class extends Ke{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new WU(this,e)}setup(){return this.call()}},$U=[!1,!0],qU=[0,1,2,3],YU=[-1,-2],KN=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],pb=new Map;for(let e of $U)pb.set(e,new vn(e));var mb=new Map;for(let e of qU)mb.set(e,new vn(e,\\\"uint\\\"));var fb=new Map([...mb].map(e=>new vn(e.value,\\\"int\\\")));for(let e of YU)fb.set(e,new vn(e,\\\"int\\\"));var Kg=new Map([...fb].map(e=>new vn(e.value)));for(let e of KN)Kg.set(e,new vn(e));for(let e of KN)Kg.set(-e,new vn(-e));var e0={bool:pb,uint:mb,ints:fb,float:Kg},eA=new Map([...pb,...Kg]),gb=(e,t)=>eA.has(e)?eA.get(e):e.isNode===!0?e:new vn(e,t),ni=function(e,t=null){return(...r)=>{for(let s of r)if(s===void 0)return Ce(`TSL: Invalid parameter for the type \\\"${e}\\\".`,new $r),new vn(0,e);if((r.length===0||![\\\"bool\\\",\\\"float\\\",\\\"int\\\",\\\"uint\\\"].includes(e)&&r.every(s=>{let a=typeof s;return a!==\\\"object\\\"&&a!==\\\"function\\\"}))&&(r=[hb(e,...r)]),r.length===1&&t!==null&&t.has(r[0]))return Mp(t.get(r[0]));if(r.length===1){let s=gb(r[0],e);return s.nodeType===e?Mp(s):Mp(new $N(s,e))}let i=r.map(s=>gb(s));return Mp(new IU(i,e))}};function vd(e){return e&&e.isNode&&e.traverse(t=>{t.isConstNode&&(e=t.value)}),!!e}var tA=e=>e!=null?e.nodeType||e.convertTo||(typeof e==\\\"string\\\"?e:null):null;function bd(e,t){return new XU(e,t)}var Ye=(e,t=null)=>UU(e,t),Mp=(e,t=null)=>Ye(e,t).toVarIntent(),t0=(e,t=null)=>new zU(e,t),wu=(e,t=null)=>new VU(e,t),Mt=(e,t=null,r=null,i=null)=>new JN(e,t,r,i),ze=(e,...t)=>new GU(e,...t),Ee=(e,t=null,r=null,i={})=>new JN(e,t,r,{...i,intent:!0}),yb=(e,t)=>new Proxy(e,{get(r,i,s){return Reflect.get(t,i,s)},set(r,i,s){return Reflect.set(t,i,s)}}),ZU=0,JU=class extends Ke{constructor(e,t=null){super();let r=null;t!==null&&(typeof t==\\\"object\\\"?r=t.return:(typeof t==\\\"string\\\"?r=t:Ce(\\\"TSL: Invalid layout type.\\\",new $r),t=null)),this.shaderNode=new bd(e,r),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){let t=this.shaderNode.nodeType;if(typeof e.inputs!=\\\"object\\\"){let r={name:\\\"fn\\\"+ZU++,type:t,inputs:[]};for(let i in e)i!==\\\"return\\\"&&r.inputs.push({name:i,type:e[i]});e=r}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||\\\"float\\\"}call(...e){let t=this.shaderNode.call(e);return this.shaderNode.nodeType===\\\"void\\\"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){let t=this.getNodeType(e);return Ce('TSL: \\\"Fn()\\\" was declared but not invoked. Try calling it like \\\"Fn()( ...params )\\\".',this.stackTrace),e.generateConst(t)}};function Q(e,t=null){let r=new JU(e,t);return new Proxy(()=>{},{apply(i,s,a){return r.call(...a)},get(i,s,a){return Reflect.get(r,s,a)},set(i,s,a,n){return Reflect.set(r,s,a,n)}})}var Np=e=>{ll=e},xb=()=>ll,et=(...e)=>ll.If(...e),QU=(...e)=>ll.Switch(...e);function r0(e){return ll&&ll.addToStack(e),e}xe(\\\"toStack\\\",r0);var rA=new ni(\\\"color\\\"),D=new ni(\\\"float\\\",e0.float),Y=new ni(\\\"int\\\",e0.ints),Ne=new ni(\\\"uint\\\",e0.uint),Gs=new ni(\\\"bool\\\",e0.bool),ke=new ni(\\\"vec2\\\"),Pr=new ni(\\\"ivec2\\\"),vb=new ni(\\\"uvec2\\\"),iA=new ni(\\\"bvec2\\\"),K=new ni(\\\"vec3\\\"),bb=new ni(\\\"ivec3\\\"),Mu=new ni(\\\"uvec3\\\"),Tb=new ni(\\\"bvec3\\\"),Ve=new ni(\\\"vec4\\\"),Sb=new ni(\\\"ivec4\\\"),_b=new ni(\\\"uvec4\\\"),sA=new ni(\\\"bvec4\\\"),i0=new ni(\\\"mat2\\\"),Ni=new ni(\\\"mat3\\\"),ul=new ni(\\\"mat4\\\");xe(\\\"toColor\\\",rA),xe(\\\"toFloat\\\",D),xe(\\\"toInt\\\",Y),xe(\\\"toUint\\\",Ne),xe(\\\"toBool\\\",Gs),xe(\\\"toVec2\\\",ke),xe(\\\"toIVec2\\\",Pr),xe(\\\"toUVec2\\\",vb),xe(\\\"toBVec2\\\",iA),xe(\\\"toVec3\\\",K),xe(\\\"toIVec3\\\",bb),xe(\\\"toUVec3\\\",Mu),xe(\\\"toBVec3\\\",Tb),xe(\\\"toVec4\\\",Ve),xe(\\\"toIVec4\\\",Sb),xe(\\\"toUVec4\\\",_b),xe(\\\"toBVec4\\\",sA),xe(\\\"toMat2\\\",i0),xe(\\\"toMat3\\\",Ni),xe(\\\"toMat4\\\",ul);var aA=Mt(_u).setParameterLength(2),nA=(e,t)=>new $N(Ye(e),t),KU=(e,t)=>new qN(Ye(e),t);xe(\\\"element\\\",aA),xe(\\\"convert\\\",nA);var e6=e=>(Ue(\\\"TSL: append() has been renamed to Stack().\\\",new $r),r0(e));xe(\\\"append\\\",e=>(Ue(\\\"TSL: .append() has been renamed to .toStack().\\\",new $r),r0(e)));var jt=class extends Ke{static get type(){return\\\"PropertyNode\\\"}constructor(e,t=null,r=!1,i=null){super(e),this.name=t,this.varying=r,this.placeholderNode=Ye(i),this.isPropertyNode=!0,this.global=!0}getNodeType(e){let t=super.getNodeType(e);return t===\\\"output\\\"?e.getOutputType():t}customCacheKey(){return yd(this.type+\\\":\\\"+(this.name||\\\"\\\")+\\\":\\\"+(this.varying?\\\"1\\\":\\\"0\\\"))}getHash(e){return this.name||super.getHash(e)}generate(e){let t;if(this.varying===!0)t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0;else if(t=e.getVarFromNode(this,this.name),this.placeholderNode!==null&&e.hasWriteUsage(this)===!1){let r=this.placeholderNode.build(e,this.getNodeType(e));e.addLineFlowCode(`${e.getPropertyName(t)} = ${r}`,this)}return e.getPropertyName(t)}},go=(e,t,r=null)=>new jt(e,t,!1,r),Nu=(e,t,r=null)=>new jt(e,t,!0,r),Zt=ze(jt,\\\"vec4\\\",\\\"DiffuseColor\\\"),Au=ze(jt,\\\"vec3\\\",\\\"DiffuseContribution\\\"),wb=ze(jt,\\\"vec3\\\",\\\"EmissiveColor\\\"),_n=ze(jt,\\\"float\\\",\\\"Roughness\\\"),yo=ze(jt,\\\"float\\\",\\\"Metalness\\\"),s0=ze(jt,\\\"float\\\",\\\"Clearcoat\\\"),Td=ze(jt,\\\"float\\\",\\\"ClearcoatRoughness\\\"),Ws=ze(jt,\\\"vec3\\\",\\\"Sheen\\\"),hl=ze(jt,\\\"float\\\",\\\"SheenRoughness\\\"),a0=ze(jt,\\\"float\\\",\\\"Iridescence\\\"),n0=ze(jt,\\\"float\\\",\\\"IridescenceIOR\\\"),o0=ze(jt,\\\"float\\\",\\\"IridescenceThickness\\\"),l0=ze(jt,\\\"float\\\",\\\"AlphaT\\\"),dl=ze(jt,\\\"float\\\",\\\"Anisotropy\\\"),Ap=ze(jt,\\\"vec3\\\",\\\"AnisotropyT\\\"),Cu=ze(jt,\\\"vec3\\\",\\\"AnisotropyB\\\"),cl=ze(jt,\\\"color\\\",\\\"SpecularColor\\\"),Ru=ze(jt,\\\"color\\\",\\\"SpecularColorBlended\\\"),Eu=ze(jt,\\\"float\\\",\\\"SpecularF90\\\"),u0=ze(jt,\\\"float\\\",\\\"Shininess\\\"),Sd=ze(jt,\\\"output\\\",\\\"Output\\\"),Pu=ze(jt,\\\"float\\\",\\\"dashSize\\\"),Cp=ze(jt,\\\"float\\\",\\\"gapSize\\\"),t6=ze(jt,\\\"float\\\",\\\"pointWidth\\\"),Rp=ze(jt,\\\"float\\\",\\\"IOR\\\"),h0=ze(jt,\\\"float\\\",\\\"Transmission\\\"),Mb=ze(jt,\\\"float\\\",\\\"Thickness\\\"),Nb=ze(jt,\\\"float\\\",\\\"AttenuationDistance\\\"),Ab=ze(jt,\\\"color\\\",\\\"AttenuationColor\\\"),Cb=ze(jt,\\\"float\\\",\\\"Dispersion\\\"),Rb=ze(jt,\\\"float\\\",\\\"AmbientOcclusion\\\",!1,1),oA=class extends Ke{static get type(){return\\\"UniformGroupNode\\\"}constructor(e,t=!1,r=1,i=null){super(\\\"string\\\"),this.name=e,this.shared=t,this.order=r,this.updateType=i,this.isUniformGroup=!0}update(){this.needsUpdate=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}},lA=(e,t=1,r=null)=>new oA(e,!1,t,r),d0=(e,t=0,r=null)=>new oA(e,!0,t,r),r6=d0(\\\"frame\\\",0,ut.FRAME),st=d0(\\\"render\\\",0,ut.RENDER),uA=lA(\\\"object\\\",1,ut.OBJECT),Ep=class extends db{static get type(){return\\\"UniformNode\\\"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name=\\\"\\\",this.groupNode=uA}setName(e){return this.name=e,this}label(e){return Ue('TSL: \\\"label()\\\" has been deprecated. Use \\\"setName()\\\" instead.',new $r),this.setName(e)}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){return e=e.bind(this),super.onUpdate(r=>{let i=e(r,this);i!==void 0&&(this.value=i)},t)}getInputType(e){let t=super.getInputType(e);return t===\\\"bool\\\"&&(t=\\\"uint\\\"),t}generate(e,t){let r=this.getNodeType(e),i=this.getUniformHash(e),s=e.getNodeFromHash(i);s===void 0&&(e.setHashNode(this,i),s=this);let a=s.getInputType(e),n=e.getUniformFromNode(s,a,e.shaderStage,this.name||e.context.nodeName),o=e.getPropertyName(n);e.context.nodeName!==void 0&&delete e.context.nodeName;let l=o;if(r===\\\"bool\\\"){let u=e.getDataFromNode(this),h=u.propertyName;if(h===void 0){let d=e.getVarFromNode(this,null,\\\"bool\\\");h=e.getPropertyName(d),u.propertyName=h,l=e.format(o,a,r),e.addLineFlowCode(`${h} = ${l}`,this)}l=h}return e.format(l,r,t)}},Qe=(e,t)=>{let r=tA(t||e);if(r===e&&(e=hb(r)),e&&e.isNode===!0){let i=e.value;e.traverse(s=>{s.isConstNode===!0&&(i=s.value)}),e=i}return new Ep(e,r)},hA=class extends rr{static get type(){return\\\"ArrayNode\\\"}constructor(e,t,r=null){super(e),this.count=t,this.values=r,this.isArrayNode=!0}getArrayCount(){return this.count}generateNodeType(e){return this.nodeType===null?this.values[0].getNodeType(e):this.nodeType}getElementType(e){return this.getNodeType(e)}getMemberType(e,t){return this.nodeType===null?this.values[0].getMemberType(e,t):super.getMemberType(e,t)}generate(e){let t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}},dA=(...e)=>{let t;if(e.length===1){let r=e[0];t=new hA(null,r.length,r)}else{let r=e[0],i=e[1];t=new hA(r,i)}return Ye(t)};xe(\\\"toArray\\\",(e,t)=>dA(Array(t).fill(e)));var i6=class extends rr{static get type(){return\\\"AssignNode\\\"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t,this.isAssignNode=!0}hasDependencies(){return!1}generateNodeType(e,t){return t!==\\\"void\\\"?this.targetNode.getNodeType(e):\\\"void\\\"}needsSplitAssign(e){let{targetNode:t}=this;if(e.isAvailable(\\\"swizzleAssign\\\")===!1&&t.isSplitNode&&t.components.length>1){let r=e.getTypeLength(t.node.getNodeType(e));return Su.join(\\\"\\\").slice(0,r)!==t.components}return!1}setup(e){let{targetNode:t,sourceNode:r}=this,i=t.getScope(),s=e.getDataFromNode(i);s.assign=!0;let a=e.getNodeProperties(this);a.sourceNode=r,a.targetNode=t.context({assign:!0})}generate(e,t){let{targetNode:r,sourceNode:i}=e.getNodeProperties(this),s=this.needsSplitAssign(e),a=r.build(e),n=r.getNodeType(e),o=i.build(e,n),l=i.getNodeType(e),u=e.getDataFromNode(this),h;if(u.initialized===!0)t!==\\\"void\\\"&&(h=a);else if(s){let d=e.getVarFromNode(this,null,n),c=e.getPropertyName(d);e.addLineFlowCode(`${c} = ${o}`,this);let m=r.node,g=m.node.context({assign:!0}).build(e);for(let y=0;y\\u003cm.components.length;y++){let b=m.components[y];e.addLineFlowCode(`${g}.${b} = ${c}[ ${y} ]`,this)}t!==\\\"void\\\"&&(h=a)}else h=`${a} = ${o}`,(t===\\\"void\\\"||l===\\\"void\\\")&&(e.addLineFlowCode(h,this),t!==\\\"void\\\"&&(h=a));return u.initialized=!0,e.format(h,n,t)}},cA=Mt(i6).setParameterLength(2);xe(\\\"assign\\\",cA);var s6=class extends rr{static get type(){return\\\"FunctionCallNode\\\"}constructor(e=null,t={}){super(),this.functionNode=e,this.parameters=t}setParameters(e){return this.parameters=e,this}getParameters(){return this.parameters}generateNodeType(e){return this.functionNode.getNodeType(e)}getMemberType(e,t){return this.functionNode.getMemberType(e,t)}generate(e){let t=[],r=this.functionNode,i=r.getInputs(e),s=this.parameters,a=(n,o)=>{let l=o.type,u=l===\\\"pointer\\\",h;return u?h=\\\"&\\\"+n.build(e):h=n.build(e,l),h};if(Array.isArray(s)){if(s.length>i.length)Ce(\\\"TSL: The number of provided parameters exceeds the expected number of inputs in 'Fn()'.\\\"),s.length=i.length;else if(s.length\\u003ci.length)for(Ce(\\\"TSL: The number of provided parameters is less than the expected number of inputs in 'Fn()'.\\\");s.length\\u003ci.length;)s.push(D(0));for(let n=0;n\\u003cs.length;n++)t.push(a(s[n],i[n]))}else for(let n of i){let o=s[n.name];o!==void 0?t.push(a(o,n)):(Ce(`TSL: Input '${n.name}' not found in 'Fn()'.`),t.push(a(D(0),n)))}return`${r.build(e,\\\"property\\\")}( ${t.join(\\\", \\\")} )`}},pA=(e,...t)=>(t=t.length>1||t[0]&&t[0].isNode===!0?wu(t):t0(t[0]),new s6(Ye(e),t));xe(\\\"call\\\",pA);var a6={\\\"==\\\":\\\"equal\\\",\\\"!=\\\":\\\"notEqual\\\",\\\"\\u003c\\\":\\\"lessThan\\\",\\\">\\\":\\\"greaterThan\\\",\\\"\\u003c=\\\":\\\"lessThanEqual\\\",\\\">=\\\":\\\"greaterThanEqual\\\",\\\"%\\\":\\\"mod\\\"},qr=class lM extends rr{static get type(){return\\\"OperatorNode\\\"}constructor(t,r,i,...s){if(super(),s.length>0){let a=new lM(t,r,i);for(let n=0;n\\u003cs.length-1;n++)a=new lM(t,a,s[n]);r=a,i=s[s.length-1]}this.op=t,this.aNode=r,this.bNode=i,this.isOperatorNode=!0}getOperatorMethod(t,r){return t.getMethod(a6[this.op],r)}generateNodeType(t,r=null){let i=this.op,s=this.aNode,a=this.bNode,n=s.getNodeType(t),o=a?a.getNodeType(t):null;if(n===\\\"void\\\"||o===\\\"void\\\")return r||\\\"void\\\";if(i===\\\"%\\\")return n;if(i===\\\"~\\\"||i===\\\"&\\\"||i===\\\"|\\\"||i===\\\"^\\\"||i===\\\">>\\\"||i===\\\"\\u003c\\u003c\\\")return t.getIntegerType(n);if(i===\\\"&&\\\"||i===\\\"||\\\"||i===\\\"^^\\\")return\\\"bool\\\";if(i===\\\"!\\\"){let l=t.getTypeLength(n);return l>1?`bvec${l}`:\\\"bool\\\"}else if(i===\\\"==\\\"||i===\\\"!=\\\"||i===\\\"\\u003c\\\"||i===\\\">\\\"||i===\\\"\\u003c=\\\"||i===\\\">=\\\"){let l=Math.max(t.getTypeLength(n),t.getTypeLength(o));return l>1?`bvec${l}`:\\\"bool\\\"}else{if(t.isMatrix(n)){if(o===\\\"float\\\")return n;if(t.isVector(o))return t.getVectorFromMatrix(n);if(t.isMatrix(o))return n}else if(t.isMatrix(o)){if(n===\\\"float\\\")return o;if(t.isVector(n))return t.getVectorFromMatrix(o)}return t.getTypeLength(o)>t.getTypeLength(n)?o:n}}generate(t,r){let i=this.op,{aNode:s,bNode:a}=this,n=this.getNodeType(t,r),o=null,l=null;n!==\\\"void\\\"?(o=s.getNodeType(t),l=a?a.getNodeType(t):null,i===\\\"\\u003c\\\"||i===\\\">\\\"||i===\\\"\\u003c=\\\"||i===\\\">=\\\"||i===\\\"==\\\"||i===\\\"!=\\\"?t.isVector(o)?l=o:t.isVector(l)?o=l:o!==l&&(o=l=\\\"float\\\"):i===\\\">>\\\"||i===\\\"\\u003c\\u003c\\\"?(o=n,l=t.changeComponentType(l,\\\"uint\\\")):i===\\\"%\\\"?(o=n,l=t.isInteger(o)&&t.isInteger(l)?l:o):t.isMatrix(o)?l===\\\"float\\\"?l=\\\"float\\\":t.isVector(l)?l=t.getVectorFromMatrix(o):t.isMatrix(l)||(o=l=n):t.isMatrix(l)?o===\\\"float\\\"?o=\\\"float\\\":t.isVector(o)?o=t.getVectorFromMatrix(l):o=l=n:o=l=n):o=l=n;let u=s.build(t,o),h=a?a.build(t,l):null,d=t.getFunctionOperator(i);if(r!==\\\"void\\\"){let c=t.renderer.coordinateSystem===Ds;if(i===\\\"==\\\"||i===\\\"!=\\\"||i===\\\"\\u003c\\\"||i===\\\">\\\"||i===\\\"\\u003c=\\\"||i===\\\">=\\\")return c?t.isVector(o)?t.format(`${this.getOperatorMethod(t,r)}( ${u}, ${h} )`,n,r):t.format(`( ${u} ${i} ${h} )`,n,r):t.format(`( ${u} ${i} ${h} )`,n,r);if(i===\\\"%\\\")return t.isInteger(l)?t.format(`( ${u} % ${h} )`,n,r):t.format(`${this.getOperatorMethod(t,n)}( ${u}, ${h} )`,n,r);if(i===\\\"!\\\")return c&&t.isVector(o)?t.format(`not( ${u} )`,r):t.format(`( ${i} ${u} )`,o,r);if(i===\\\"~\\\")return t.format(`( ${i} ${u} )`,o,r);if(d)return t.format(`${d}( ${u}, ${h} )`,n,r);if(t.isMatrix(o)&&l===\\\"float\\\")return t.format(`( ${h} ${i} ${u} )`,n,r);if(o===\\\"float\\\"&&t.isMatrix(l))return t.format(`${u} ${i} ${h}`,n,r);{let m=`( ${u} ${i} ${h} )`;return!c&&n===\\\"bool\\\"&&t.isVector(o)&&t.isVector(l)&&(m=`all${m}`),t.format(m,n,r)}}else if(o!==\\\"void\\\")return d?t.format(`${d}( ${u}, ${h} )`,n,r):t.isMatrix(o)&&l===\\\"float\\\"?t.format(`${h} ${i} ${u}`,n,r):t.format(`${u} ${i} ${h}`,n,r)}serialize(t){super.serialize(t),t.op=this.op}deserialize(t){super.deserialize(t),this.op=t.op}},Yr=Ee(qr,\\\"+\\\").setParameterLength(2,1/0).setName(\\\"add\\\"),It=Ee(qr,\\\"-\\\").setParameterLength(2,1/0).setName(\\\"sub\\\"),mt=Ee(qr,\\\"*\\\").setParameterLength(2,1/0).setName(\\\"mul\\\"),js=Ee(qr,\\\"/\\\").setParameterLength(2,1/0).setName(\\\"div\\\"),c0=Ee(qr,\\\"%\\\").setParameterLength(2).setName(\\\"mod\\\"),mA=Ee(qr,\\\"==\\\").setParameterLength(2).setName(\\\"equal\\\"),fA=Ee(qr,\\\"!=\\\").setParameterLength(2).setName(\\\"notEqual\\\"),gA=Ee(qr,\\\"\\u003c\\\").setParameterLength(2).setName(\\\"lessThan\\\"),Eb=Ee(qr,\\\">\\\").setParameterLength(2).setName(\\\"greaterThan\\\"),yA=Ee(qr,\\\"\\u003c=\\\").setParameterLength(2).setName(\\\"lessThanEqual\\\"),xA=Ee(qr,\\\">=\\\").setParameterLength(2).setName(\\\"greaterThanEqual\\\"),vA=Ee(qr,\\\"&&\\\").setParameterLength(2,1/0).setName(\\\"and\\\"),bA=Ee(qr,\\\"||\\\").setParameterLength(2,1/0).setName(\\\"or\\\"),TA=Ee(qr,\\\"!\\\").setParameterLength(1).setName(\\\"not\\\"),SA=Ee(qr,\\\"^^\\\").setParameterLength(2).setName(\\\"xor\\\"),_A=Ee(qr,\\\"&\\\").setParameterLength(2).setName(\\\"bitAnd\\\"),wA=Ee(qr,\\\"~\\\").setParameterLength(1).setName(\\\"bitNot\\\"),MA=Ee(qr,\\\"|\\\").setParameterLength(2).setName(\\\"bitOr\\\"),NA=Ee(qr,\\\"^\\\").setParameterLength(2).setName(\\\"bitXor\\\"),AA=Ee(qr,\\\"\\u003c\\u003c\\\").setParameterLength(2).setName(\\\"shiftLeft\\\"),CA=Ee(qr,\\\">>\\\").setParameterLength(2).setName(\\\"shiftRight\\\"),RA=Q(([e])=>(e.addAssign(1),e)),EA=Q(([e])=>(e.subAssign(1),e)),PA=Q(([e])=>{let t=Y(e).toConst();return e.addAssign(1),t}),BA=Q(([e])=>{let t=Y(e).toConst();return e.subAssign(1),t});xe(\\\"add\\\",Yr),xe(\\\"sub\\\",It),xe(\\\"mul\\\",mt),xe(\\\"div\\\",js),xe(\\\"mod\\\",c0),xe(\\\"equal\\\",mA),xe(\\\"notEqual\\\",fA),xe(\\\"lessThan\\\",gA),xe(\\\"greaterThan\\\",Eb),xe(\\\"lessThanEqual\\\",yA),xe(\\\"greaterThanEqual\\\",xA),xe(\\\"and\\\",vA),xe(\\\"or\\\",bA),xe(\\\"not\\\",TA),xe(\\\"xor\\\",SA),xe(\\\"bitAnd\\\",_A),xe(\\\"bitNot\\\",wA),xe(\\\"bitOr\\\",MA),xe(\\\"bitXor\\\",NA),xe(\\\"shiftLeft\\\",AA),xe(\\\"shiftRight\\\",CA),xe(\\\"incrementBefore\\\",RA),xe(\\\"decrementBefore\\\",EA),xe(\\\"increment\\\",PA),xe(\\\"decrement\\\",BA);var he=class Sr extends rr{static get type(){return\\\"MathNode\\\"}constructor(t,r,i=null,s=null){if(super(),(t===Sr.MAX||t===Sr.MIN)&&arguments.length>3){let a=new Sr(t,r,i);for(let n=3;n\\u003carguments.length-1;n++)a=new Sr(t,a,arguments[n]);r=a,i=arguments[arguments.length-1],s=null}this.method=t,this.aNode=r,this.bNode=i,this.cNode=s,this.isMathNode=!0}getInputType(t){let r=this.aNode.getNodeType(t),i=this.bNode?this.bNode.getNodeType(t):null,s=this.cNode?this.cNode.getNodeType(t):null,a=t.isMatrix(r)?0:t.getTypeLength(r),n=t.isMatrix(i)?0:t.getTypeLength(i),o=t.isMatrix(s)?0:t.getTypeLength(s);return a>n&&a>o?r:n>o?i:o>a?s:r}generateNodeType(t){let r=this.method;return r===Sr.LENGTH||r===Sr.DISTANCE||r===Sr.DOT?\\\"float\\\":r===Sr.CROSS?\\\"vec3\\\":r===Sr.ALL||r===Sr.ANY?\\\"bool\\\":r===Sr.EQUALS?t.changeComponentType(this.aNode.getNodeType(t),\\\"bool\\\"):this.getInputType(t)}setup(t){let{aNode:r,bNode:i,method:s}=this,a=null;if(s===Sr.ONE_MINUS)a=It(1,r);else if(s===Sr.RECIPROCAL)a=js(1,r);else if(s===Sr.DIFFERENCE)a=ur(It(r,i));else if(s===Sr.TRANSFORM_DIRECTION){let n,o;t.isMatrix(r.getNodeType(t))?(n=r,o=i):(n=i,o=r),a=Yi(mt(n,Ve(K(o),0)).xyz)}return a!==null?a:super.setup(t)}generate(t,r){if(t.getNodeProperties(this).outputNode)return super.generate(t,r);let i=this.method,s=this.getNodeType(t),a=this.getInputType(t),n=this.aNode,o=this.bNode,l=this.cNode,u=t.renderer.coordinateSystem;if(i===Sr.NEGATE)return t.format(\\\"( - \\\"+n.build(t,a)+\\\" )\\\",s,r);{let h=[];return i===Sr.CROSS?h.push(n.build(t,s),o.build(t,s)):u===Ds&&i===Sr.STEP?h.push(n.build(t,t.getTypeLength(n.getNodeType(t))===1?\\\"float\\\":a),o.build(t,a)):u===Ds&&(i===Sr.MIN||i===Sr.MAX)?h.push(n.build(t,a),o.build(t,t.getTypeLength(o.getNodeType(t))===1?\\\"float\\\":a)):i===Sr.REFRACT?h.push(n.build(t,a),o.build(t,a),l.build(t,\\\"float\\\")):i===Sr.MIX?h.push(n.build(t,a),o.build(t,a),l.build(t,t.getTypeLength(l.getNodeType(t))===1?\\\"float\\\":a)):(u===da&&i===Sr.ATAN&&o!==null&&(i=\\\"atan2\\\"),t.shaderStage!==\\\"fragment\\\"&&(i===Sr.DFDX||i===Sr.DFDY)&&(Ue(`TSL: '${i}' is not supported in the ${t.shaderStage} stage.`,this.stackTrace),i=\\\"/*\\\"+i+\\\"*/\\\"),h.push(n.build(t,a)),o!==null&&h.push(o.build(t,a)),l!==null&&h.push(l.build(t,a))),t.format(`${t.getMethod(i,s)}( ${h.join(\\\", \\\")} )`,s,r)}}serialize(t){super.serialize(t),t.method=this.method}deserialize(t){super.deserialize(t),this.method=t.method}};he.ALL=\\\"all\\\",he.ANY=\\\"any\\\",he.RADIANS=\\\"radians\\\",he.DEGREES=\\\"degrees\\\",he.EXP=\\\"exp\\\",he.EXP2=\\\"exp2\\\",he.LOG=\\\"log\\\",he.LOG2=\\\"log2\\\",he.SQRT=\\\"sqrt\\\",he.INVERSE_SQRT=\\\"inversesqrt\\\",he.FLOOR=\\\"floor\\\",he.CEIL=\\\"ceil\\\",he.NORMALIZE=\\\"normalize\\\",he.FRACT=\\\"fract\\\",he.SIN=\\\"sin\\\",he.SINH=\\\"sinh\\\",he.COS=\\\"cos\\\",he.COSH=\\\"cosh\\\",he.TAN=\\\"tan\\\",he.TANH=\\\"tanh\\\",he.ASIN=\\\"asin\\\",he.ASINH=\\\"asinh\\\",he.ACOS=\\\"acos\\\",he.ACOSH=\\\"acosh\\\",he.ATAN=\\\"atan\\\",he.ATANH=\\\"atanh\\\",he.ABS=\\\"abs\\\",he.SIGN=\\\"sign\\\",he.LENGTH=\\\"length\\\",he.NEGATE=\\\"negate\\\",he.ONE_MINUS=\\\"oneMinus\\\",he.DFDX=\\\"dFdx\\\",he.DFDY=\\\"dFdy\\\",he.ROUND=\\\"round\\\",he.RECIPROCAL=\\\"reciprocal\\\",he.TRUNC=\\\"trunc\\\",he.FWIDTH=\\\"fwidth\\\",he.TRANSPOSE=\\\"transpose\\\",he.DETERMINANT=\\\"determinant\\\",he.INVERSE=\\\"inverse\\\",he.EQUALS=\\\"equals\\\",he.MIN=\\\"min\\\",he.MAX=\\\"max\\\",he.STEP=\\\"step\\\",he.REFLECT=\\\"reflect\\\",he.DISTANCE=\\\"distance\\\",he.DIFFERENCE=\\\"difference\\\",he.DOT=\\\"dot\\\",he.CROSS=\\\"cross\\\",he.POW=\\\"pow\\\",he.TRANSFORM_DIRECTION=\\\"transformDirection\\\",he.MIX=\\\"mix\\\",he.CLAMP=\\\"clamp\\\",he.REFRACT=\\\"refract\\\",he.SMOOTHSTEP=\\\"smoothstep\\\",he.FACEFORWARD=\\\"faceforward\\\";var p0=D(1e-6),n6=D(1e6),m0=D(Math.PI),o6=D(Math.PI*2),l6=D(Math.PI*2),u6=D(Math.PI*.5),IA=Ee(he,he.ALL).setParameterLength(1),FA=Ee(he,he.ANY).setParameterLength(1),LA=Ee(he,he.RADIANS).setParameterLength(1),kA=Ee(he,he.DEGREES).setParameterLength(1),Pb=Ee(he,he.EXP).setParameterLength(1),_d=Ee(he,he.EXP2).setParameterLength(1),f0=Ee(he,he.LOG).setParameterLength(1),wn=Ee(he,he.LOG2).setParameterLength(1),ys=Ee(he,he.SQRT).setParameterLength(1),Bb=Ee(he,he.INVERSE_SQRT).setParameterLength(1),Mn=Ee(he,he.FLOOR).setParameterLength(1),g0=Ee(he,he.CEIL).setParameterLength(1),Yi=Ee(he,he.NORMALIZE).setParameterLength(1),Oa=Ee(he,he.FRACT).setParameterLength(1),xs=Ee(he,he.SIN).setParameterLength(1),DA=Ee(he,he.SINH).setParameterLength(1),Ua=Ee(he,he.COS).setParameterLength(1),OA=Ee(he,he.COSH).setParameterLength(1),UA=Ee(he,he.TAN).setParameterLength(1),zA=Ee(he,he.TANH).setParameterLength(1),VA=Ee(he,he.ASIN).setParameterLength(1),GA=Ee(he,he.ASINH).setParameterLength(1),Ib=Ee(he,he.ACOS).setParameterLength(1),WA=Ee(he,he.ACOSH).setParameterLength(1),Fb=Ee(he,he.ATAN).setParameterLength(1,2),jA=Ee(he,he.ATANH).setParameterLength(1),ur=Ee(he,he.ABS).setParameterLength(1),Lb=Ee(he,he.SIGN).setParameterLength(1),Nn=Ee(he,he.LENGTH).setParameterLength(1),kb=Ee(he,he.NEGATE).setParameterLength(1),HA=Ee(he,he.ONE_MINUS).setParameterLength(1),Db=Ee(he,he.DFDX).setParameterLength(1),Ob=Ee(he,he.DFDY).setParameterLength(1),XA=Ee(he,he.ROUND).setParameterLength(1),$A=Ee(he,he.RECIPROCAL).setParameterLength(1),Ub=Ee(he,he.TRUNC).setParameterLength(1),zb=Ee(he,he.FWIDTH).setParameterLength(1),qA=Ee(he,he.TRANSPOSE).setParameterLength(1),YA=Ee(he,he.DETERMINANT).setParameterLength(1),ZA=Ee(he,he.INVERSE).setParameterLength(1),Rs=Ee(he,he.MIN).setParameterLength(2,1/0),Br=Ee(he,he.MAX).setParameterLength(2,1/0),Bu=Ee(he,he.STEP).setParameterLength(2),JA=Ee(he,he.REFLECT).setParameterLength(2),QA=Ee(he,he.DISTANCE).setParameterLength(2),KA=Ee(he,he.DIFFERENCE).setParameterLength(2),pa=Ee(he,he.DOT).setParameterLength(2),xo=Ee(he,he.CROSS).setParameterLength(2),ma=Ee(he,he.POW).setParameterLength(2),Vb=e=>mt(e,e),eC=e=>mt(e,e,e),Gb=e=>mt(e,e,e,e),tC=Ee(he,he.TRANSFORM_DIRECTION).setParameterLength(2),rC=(e,t)=>Yi(mt(t,Ve(K(e),0)).xyz),iC=(e,t)=>Yi(Ve(K(e),0).mul(t).xyz),sC=e=>mt(Lb(e),ma(ur(e),1/3)),Wb=e=>pa(e,e),Ct=Ee(he,he.MIX).setParameterLength(3),za=(e,t=0,r=1)=>new he(he.CLAMP,Ye(e),Ye(t),Ye(r)),y0=e=>za(e),jb=Ee(he,he.REFRACT).setParameterLength(3),Hs=Ee(he,he.SMOOTHSTEP).setParameterLength(3),Hb=Ee(he,he.FACEFORWARD).setParameterLength(3),aC=Q(([e])=>{let t=43758.5453,r=pa(e.xy,ke(12.9898,78.233)),i=c0(r,m0);return Oa(xs(i).mul(t))}),nC=(e,t,r)=>Ct(t,r,e),oC=(e,t,r)=>Hs(t,r,e),lC=(e,t)=>Bu(t,e),h6=Hb,d6=Bb;xe(\\\"all\\\",IA),xe(\\\"any\\\",FA),xe(\\\"radians\\\",LA),xe(\\\"degrees\\\",kA),xe(\\\"exp\\\",Pb),xe(\\\"exp2\\\",_d),xe(\\\"log\\\",f0),xe(\\\"log2\\\",wn),xe(\\\"sqrt\\\",ys),xe(\\\"inverseSqrt\\\",Bb),xe(\\\"floor\\\",Mn),xe(\\\"ceil\\\",g0),xe(\\\"normalize\\\",Yi),xe(\\\"fract\\\",Oa),xe(\\\"sin\\\",xs),xe(\\\"sinh\\\",DA),xe(\\\"cos\\\",Ua),xe(\\\"cosh\\\",OA),xe(\\\"tan\\\",UA),xe(\\\"tanh\\\",zA),xe(\\\"asin\\\",VA),xe(\\\"asinh\\\",GA),xe(\\\"acos\\\",Ib),xe(\\\"acosh\\\",WA),xe(\\\"atan\\\",Fb),xe(\\\"atanh\\\",jA),xe(\\\"abs\\\",ur),xe(\\\"sign\\\",Lb),xe(\\\"length\\\",Nn),xe(\\\"lengthSq\\\",Wb),xe(\\\"negate\\\",kb),xe(\\\"oneMinus\\\",HA),xe(\\\"dFdx\\\",Db),xe(\\\"dFdy\\\",Ob),xe(\\\"round\\\",XA),xe(\\\"reciprocal\\\",$A),xe(\\\"trunc\\\",Ub),xe(\\\"fwidth\\\",zb),xe(\\\"min\\\",Rs),xe(\\\"max\\\",Br),xe(\\\"step\\\",lC),xe(\\\"reflect\\\",JA),xe(\\\"distance\\\",QA),xe(\\\"dot\\\",pa),xe(\\\"cross\\\",xo),xe(\\\"pow\\\",ma),xe(\\\"pow2\\\",Vb),xe(\\\"pow3\\\",eC),xe(\\\"pow4\\\",Gb),xe(\\\"transformDirection\\\",tC),xe(\\\"transformNormalByViewMatrix\\\",rC),xe(\\\"transformNormalByInverseViewMatrix\\\",iC),xe(\\\"mix\\\",nC),xe(\\\"clamp\\\",za),xe(\\\"refract\\\",jb),xe(\\\"smoothstep\\\",oC),xe(\\\"faceForward\\\",Hb),xe(\\\"difference\\\",KA),xe(\\\"saturate\\\",y0),xe(\\\"cbrt\\\",sC),xe(\\\"transpose\\\",qA),xe(\\\"determinant\\\",YA),xe(\\\"inverse\\\",ZA),xe(\\\"rand\\\",aC);var c6=class extends Ke{static get type(){return\\\"ConditionalNode\\\"}constructor(e,t,r=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=r}generateNodeType(e){let{ifNode:t,elseNode:r}=e.getNodeProperties(this);if(t===void 0)return e.flowBuildStage(this,\\\"setup\\\"),this.getNodeType(e);let i=t.getNodeType(e);if(r!==null){let s=r.getNodeType(e);if(e.getTypeLength(s)>e.getTypeLength(i))return s}return i}setup(e){let t=this.condNode,r=this.ifNode.isolate(),i=this.elseNode?this.elseNode.isolate():null,s=e.context.nodeBlock;e.getDataFromNode(r).parentNodeBlock=s,i!==null&&(e.getDataFromNode(i).parentNodeBlock=s);let a=e.context.uniformFlow,n=e.getNodeProperties(this);n.condNode=t,n.ifNode=a?r:r.context({nodeBlock:r}),n.elseNode=i?a?i:i.context({nodeBlock:i}):null}generate(e,t){let r=this.getNodeType(e),i=e.getDataFromNode(this);if(i.nodeProperty!==void 0)return i.nodeProperty;let{condNode:s,ifNode:a,elseNode:n}=e.getNodeProperties(this),o=e.currentFunctionNode,l=t!==\\\"void\\\",u=l?go(r).build(e):\\\"\\\";i.nodeProperty=u;let h=s.build(e,\\\"bool\\\");if(e.context.uniformFlow&&n!==null){let c=a.build(e,r),m=n.build(e,r),g=e.getTernary(h,c,m);return e.format(g,r,t)}e.addFlowCode(`\\n${e.tab}if ( ${h} ) {\\n\\n`).addFlowTab();let d=a.build(e,r);if(d&&(l?d=u+\\\" = \\\"+d+\\\";\\\":(d=\\\"return \\\"+d+\\\";\\\",o===null&&(Ue(\\\"TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.\\\",this.stackTrace),d=\\\"// \\\"+d))),e.removeFlowTab().addFlowCode(e.tab+\\\"\\t\\\"+d+`\\n\\n`+e.tab+\\\"}\\\"),n!==null){e.addFlowCode(` else {\\n\\n`).addFlowTab();let c=n.build(e,r);c&&(l?c=u+\\\" = \\\"+c+\\\";\\\":(c=\\\"return \\\"+c+\\\";\\\",o===null&&(Ue(\\\"TSL: Return statement used in an inline 'Fn()'. Define a layout struct to allow return values.\\\",this.stackTrace),c=\\\"// \\\"+c))),e.removeFlowTab().addFlowCode(e.tab+\\\"\\t\\\"+c+`\\n\\n`+e.tab+`}\\n\\n`)}else e.addFlowCode(`\\n\\n`);return e.format(u,r,t)}},Zi=Mt(c6).setParameterLength(2,3);xe(\\\"select\\\",Zi);var Xb=class extends Ke{static get type(){return\\\"ContextNode\\\"}constructor(e=null,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}generateNodeType(e){return this.node.getNodeType(e)}getFlowContextData(){let e=[];return this.traverse(t=>{t.isContextNode===!0&&e.push(t.value)}),Object.assign({},...e)}getMemberType(e,t){return this.node.getMemberType(e,t)}analyze(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}setup(e){let t=e.addContext(this.value);this.node.build(e),e.setContext(t)}generate(e,t){let r=e.addContext(this.value),i=this.node.build(e,t);return e.setContext(r),i}},vo=(e=null,t={})=>{let r=e;return(r===null||r.isNode!==!0)&&(t=r||t,r=null),new Xb(r,t)},uC=e=>vo(e,{uniformFlow:!0}),$b=(e,t)=>vo(e,{nodeName:t});function hC(e,t,r=null){return vo(r,{getShadow:({light:i,shadowColorNode:s})=>t===i?s.mul(e):s})}function dC(e,t=null){return vo(t,{getAO:(r,{material:i})=>i.transparent===!0?r:r!==null?r.mul(e):e})}function cC(e,t){return Ue('TSL: \\\"label()\\\" has been deprecated. Use \\\"setName()\\\" instead.'),$b(e,t)}xe(\\\"context\\\",vo),xe(\\\"label\\\",cC),xe(\\\"uniformFlow\\\",uC),xe(\\\"setName\\\",$b),xe(\\\"builtinShadowContext\\\",(e,t,r)=>hC(t,r,e)),xe(\\\"builtinAOContext\\\",(e,t)=>dC(t,e));var x0=class extends Ke{static get type(){return\\\"VarNode\\\"}constructor(e,t=null,r=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=r,this.parents=!0,this.intent=!1}setIntent(e){return this.intent=e,this}isIntent(e){return e.getDataFromNode(this).forceDeclaration===!0?!1:this.intent}getIntent(){return this.intent}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}generateNodeType(e){return this.node.getNodeType(e)}getArrayCount(e){return this.node.getArrayCount(e)}isAssign(e){return e.getDataFromNode(this).assign}build(...e){let t=e[0],r=this.getShared(t);if(this!==r)return r.build(...e);if(this._hasStack(t)===!1&&t.buildStage===\\\"setup\\\"&&(t.context.nodeLoop||t.context.nodeBlock)){let i=!1;if(this.node.isShaderCallNodeInternal&&this.node.shaderNode.getLayout()===null&&t.fnCall&&t.fnCall.shaderNode&&t.getDataFromNode(this.node.shaderNode).hasLoop){let a=t.getDataFromNode(this);a.forceDeclaration=!0,i=!0}let s=t.getBaseStack();i?s.addToStackBefore(this):s.addToStack(this)}return this.isIntent(t)&&this.isAssign(t)!==!0?this.node.build(...e):super.build(...e)}generate(e){let{node:t,name:r,readOnly:i}=this,{renderer:s}=e,a=s.backend.isWebGPUBackend===!0,n=!1,o=!1;i&&(n=e.isDeterministic(t),o=a?i:n);let l=this.getNodeType(e);if(l==\\\"void\\\")return this.isIntent(e)!==!0&&Ce('TSL: \\\".toVar()\\\" can not be used with void type.',this.stackTrace),t.build(e);let u=e.getVectorType(l),h=t.build(e,u),d=e.getVarFromNode(this,r,u,void 0,o),c=e.getPropertyName(d),m=c;if(o)if(a)m=n?`const ${c}`:`let ${c}`;else{let g=t.getArrayCount(e);m=`const ${e.getVar(d.type,c,g)}`}return e.addLineFlowCode(`${m} = ${h}`,this),c}_hasStack(e){return e.getDataFromNode(this).stack!==void 0}},qb=Mt(x0),pC=(e,t=null)=>qb(e,t).toStack(),mC=(e,t=null)=>qb(e,t,!0).toStack(),fC=e=>qb(e).setIntent(!0).toStack();xe(\\\"toVar\\\",pC),xe(\\\"toConst\\\",mC),xe(\\\"toVarIntent\\\",fC);var p6=class extends Ke{static get type(){return\\\"SubBuild\\\"}constructor(e,t,r=null){super(r),this.node=e,this.name=t,this.isSubBuildNode=!0}generateNodeType(e){if(this.nodeType!==null)return this.nodeType;e.addSubBuild(this.name);let t=this.node.getNodeType(e);return e.removeSubBuild(),t}build(e,...t){e.addSubBuild(this.name);let r=this.node.build(e,...t);return e.removeSubBuild(),r}},Iu=(e,t,r=null)=>new p6(Ye(e),t,r),m6=class extends Ke{static get type(){return\\\"VaryingNode\\\"}constructor(e,t=null){super(),this.node=Iu(e,\\\"VERTEX\\\"),this.name=t,this.isVaryingNode=!0,this.interpolationType=null,this.interpolationSampling=null,this.global=!0}setInterpolation(e,t=null){return this.interpolationType=e,this.interpolationSampling=t,this}getHash(e){return this.name||super.getHash(e)}generateNodeType(e){return this.node.getNodeType(e)}setupVarying(e){let t=e.getNodeProperties(this),r=t.varying;if(r===void 0){let i=this.name,s=this.getNodeType(e),a=this.interpolationType,n=this.interpolationSampling;t.varying=r=e.getVaryingFromNode(this,i,s,a,n),t.node=Iu(this.node,\\\"VERTEX\\\")}return r.needsInterpolation||(r.needsInterpolation=e.shaderStage===\\\"fragment\\\"),r}setup(e){this.setupVarying(e),e.flowNodeFromShaderStage(xd.VERTEX,this.node)}analyze(e){this.setupVarying(e),e.flowNodeFromShaderStage(xd.VERTEX,this.node)}generate(e){let t=e.getSubBuildProperty(\\\"property\\\",e.currentStack),r=e.getNodeProperties(this),i=this.setupVarying(e);if(r[t]===void 0){let s=this.getNodeType(e),a=e.getPropertyName(i,xd.VERTEX);if(e.shaderStage===xd.VERTEX){let n=r.node.build(e,s);e.addLineFlowCode(`${a} = ${n}`,this)}else e.flowNodeFromShaderStage(xd.VERTEX,r.node,s,a);r[t]=a}return e.getPropertyName(i)}},pl=Mt(m6).setParameterLength(1,2),gC=e=>pl(e);xe(\\\"toVarying\\\",pl),xe(\\\"toVertexStage\\\",gC);var yC=Q(([e])=>{let t=e.mul(.9478672986).add(.0521327014).pow(2.4),r=e.mul(.0773993808),i=e.lessThanEqual(.04045);return Ct(t,r,i)}).setLayout({name:\\\"sRGBTransferEOTF\\\",type:\\\"vec3\\\",inputs:[{name:\\\"color\\\",type:\\\"vec3\\\"}]}),xC=Q(([e])=>{let t=e.pow(.41666).mul(1.055).sub(.055),r=e.mul(12.92),i=e.lessThanEqual(.0031308);return Ct(t,r,i)}).setLayout({name:\\\"sRGBTransferOETF\\\",type:\\\"vec3\\\",inputs:[{name:\\\"color\\\",type:\\\"vec3\\\"}]}),Yb=\\\"WorkingColorSpace\\\",f6=\\\"OutputColorSpace\\\",Zb=class extends rr{static get type(){return\\\"ColorSpaceNode\\\"}constructor(e,t,r){super(\\\"vec4\\\"),this.colorNode=e,this.source=t,this.target=r}resolveColorSpace(e,t){return t===Yb?Gt.workingColorSpace:t===f6?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){let{colorNode:t}=this,r=this.resolveColorSpace(e,this.source),i=this.resolveColorSpace(e,this.target),s=t;return Gt.enabled===!1||r===i||!r||!i||(Gt.getTransfer(r)===Tt&&(s=Ve(yC(s.rgb),s.a)),Gt.getPrimaries(r)!==Gt.getPrimaries(i)&&(s=Ve(Ni(Gt._getMatrix(new Dr,r,i)).mul(s.rgb),s.a)),Gt.getTransfer(i)===Tt&&(s=Ve(xC(s.rgb),s.a))),s}},vC=(e,t)=>new Zb(Ye(e),Yb,t),v0=(e,t)=>new Zb(Ye(e),t,Yb),g6=(e,t,r)=>new Zb(Ye(e),t,r);xe(\\\"workingToColorSpace\\\",vC),xe(\\\"colorSpaceToWorking\\\",v0);var y6=class extends _u{static get type(){return\\\"ReferenceElementNode\\\"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),r=this.referenceNode.getNodeType(),i=this.getNodeType();return e.format(t,r,i)}},bC=class extends Ke{static get type(){return\\\"ReferenceBaseNode\\\"}constructor(e,t,r=null,i=null){super(),this.property=e,this.uniformType=t,this.object=r,this.count=i,this.properties=e.split(\\\".\\\"),this.reference=r,this.node=null,this.group=null,this.updateType=ut.OBJECT}setGroup(e){return this.group=e,this}element(e){return new y6(this,Ye(e))}setNodeType(e){let t=Qe(null,e);this.group!==null&&t.setGroup(this.group),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,r=e[t[0]];for(let i=1;i\\u003ct.length;i++)r=r[t[i]];return r}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},x6=(e,t,r)=>new bC(e,t,r),v6=class extends bC{static get type(){return\\\"RendererReferenceNode\\\"}constructor(e,t,r=null){super(e,t,r),this.renderer=r,this.setGroup(st)}updateReference(e){return this.reference=this.renderer!==null?this.renderer:e.renderer,this.reference}},TC=(e,t,r=null)=>new v6(e,t,r),b6=class extends rr{static get type(){return\\\"ToneMappingNode\\\"}constructor(e,t=_C,r=null){super(\\\"vec3\\\"),this._toneMapping=e,this.exposureNode=t,this.colorNode=r}customCacheKey(){return _p(this._toneMapping)}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup(e){let t=this.colorNode||e.context.color,r=this._toneMapping;if(r===eo)return t;let i=null,s=e.renderer.library.getToneMappingFunction(r);return s!==null?i=Ve(s(t.rgb,this.exposureNode),t.a):(Ce(\\\"ToneMappingNode: Unsupported Tone Mapping configuration.\\\",r),i=t),i}},SC=(e,t,r)=>new b6(e,Ye(t),Ye(r)),_C=TC(\\\"toneMappingExposure\\\",\\\"float\\\");xe(\\\"toneMapping\\\",(e,t,r)=>SC(t,r,e));var wC=new WeakMap;function MC(e,t){let r=wC.get(e);return r===void 0&&(r=new aN(e,t),wC.set(e,r)),r}var ml=class extends db{static get type(){return\\\"BufferAttributeNode\\\"}constructor(e,t=null,r=0,i=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=r,this.bufferOffset=i,this.usage=qh,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&e.itemSize\\u003c=4&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){let t;if(this.bufferStride===0&&this.bufferOffset===0){let r=e.globalCache.getData(this.value);r===void 0&&(r={node:this},e.globalCache.setData(this.value,r)),t=r.node.id}else t=this.id;return String(t)}generateNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;let t=this.getNodeType(e),r=e.getTypeLength(t),i=this.value,s=this.bufferStride||r,a=this.bufferOffset,n;i.isInterleavedBuffer===!0?n=i:i.isBufferAttribute===!0?n=MC(i.array,s):n=MC(i,s);let o=new L4(n,r,a);n.setUsage(this.usage),this.attribute=o,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){let t=this.getNodeType(e),r=e.context.nodeName;r!==void 0&&delete e.context.nodeName;let i=e.getBufferAttributeFromNode(this,t,r),s=e.getPropertyName(i),a=null;if(e.shaderStage===\\\"vertex\\\"||e.shaderStage===\\\"compute\\\")this.name=s,a=s;else{let n;r&&(n=r+\\\"Varying\\\"),a=pl(this,n).build(e,t)}return a}getInputType(){return\\\"bufferAttribute\\\"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}};function b0(e,t=null,r=0,i=0,s=qh,a=!1){return t===\\\"mat3\\\"||t===null&&e.itemSize===9?Ni(new ml(e,\\\"vec3\\\",9,0).setUsage(s).setInstanced(a),new ml(e,\\\"vec3\\\",9,3).setUsage(s).setInstanced(a),new ml(e,\\\"vec3\\\",9,6).setUsage(s).setInstanced(a)):t===\\\"mat4\\\"||t===null&&e.itemSize===16?ul(new ml(e,\\\"vec4\\\",16,0).setUsage(s).setInstanced(a),new ml(e,\\\"vec4\\\",16,4).setUsage(s).setInstanced(a),new ml(e,\\\"vec4\\\",16,8).setUsage(s).setInstanced(a),new ml(e,\\\"vec4\\\",16,12).setUsage(s).setInstanced(a)):new ml(e,t,r,i).setUsage(s)}var Jb=(e,t=null,r=0,i=0)=>b0(e,t,r,i),T6=(e,t=null,r=0,i=0)=>b0(e,t,r,i,rp),T0=(e,t=null,r=0,i=0)=>b0(e,t,r,i,qh,!0),Qb=(e,t=null,r=0,i=0)=>b0(e,t,r,i,rp,!0);xe(\\\"toAttribute\\\",e=>Jb(e.value));var Ai=class Ih extends Ke{static get type(){return\\\"IndexNode\\\"}constructor(t){super(\\\"uint\\\"),this.scope=t,this.isIndexNode=!0}generate(t){let r=this.getNodeType(t),i=this.scope,s;if(i===Ih.VERTEX)s=t.getVertexIndex();else if(i===Ih.INSTANCE)s=t.getInstanceIndex();else if(i===Ih.DRAW)s=t.getDrawIndex();else if(i===Ih.INVOCATION_LOCAL)s=t.getInvocationLocalIndex();else if(i===Ih.INVOCATION_SUBGROUP)s=t.getInvocationSubgroupIndex();else if(i===Ih.SUBGROUP)s=t.getSubgroupIndex();else throw new Error(\\\"THREE.IndexNode: Unknown scope: \\\"+i);let a;return t.shaderStage===\\\"vertex\\\"||t.shaderStage===\\\"compute\\\"?a=s:a=pl(this).build(t,r),a}};Ai.VERTEX=\\\"vertex\\\",Ai.INSTANCE=\\\"instance\\\",Ai.SUBGROUP=\\\"subgroup\\\",Ai.INVOCATION_LOCAL=\\\"invocationLocal\\\",Ai.INVOCATION_SUBGROUP=\\\"invocationSubgroup\\\",Ai.DRAW=\\\"draw\\\";var NC=ze(Ai,Ai.VERTEX),Va=ze(Ai,Ai.INSTANCE),S6=ze(Ai,Ai.SUBGROUP),_6=ze(Ai,Ai.INVOCATION_SUBGROUP),w6=ze(Ai,Ai.INVOCATION_LOCAL),AC=ze(Ai,Ai.DRAW),M6=class extends Ke{static get type(){return\\\"ComputeNode\\\"}constructor(e,t){super(\\\"void\\\"),this.isComputeNode=!0,this.computeNode=e,this.workgroupSize=t,this.count=null,this.dispatchSize=null,this.version=1,this.name=\\\"\\\",this.updateBeforeType=ut.OBJECT,this.onInitFunction=null,this.countNode=null}dispose(){this.dispatchEvent({type:\\\"dispose\\\"})}setName(e){return this.name=e,this}label(e){return Ue('TSL: \\\"label()\\\" has been deprecated. Use \\\"setName()\\\" instead.',new $r),this.setName(e)}onInit(e){return this.onInitFunction=e,this}updateBefore({renderer:e}){e.compute(this)}setup(e){this.count!==null&&this.countNode===null&&(this.countNode=Qe(this.count,\\\"uint\\\").onObjectUpdate(()=>this.count));let t=this.computeNode.build(e);if(t){let r=e.getNodeProperties(this);r.outputComputeNode=t.outputNode,t.outputNode=null}return t}generate(e,t){let{shaderStage:r}=e;if(r===\\\"compute\\\"){let i=this.computeNode.build(e,\\\"void\\\");if(i!==\\\"\\\"&&e.addLineFlowCode(i,this),this.count!==null&&e.allowEarlyReturns===!0){let s=this.countNode.build(e,\\\"uint\\\"),a=Va.build(e,\\\"uint\\\");e.flow.code=`${e.tab}if ( ${a} >= ${s} ) { return; }\\n\\n${e.flow.code}`}}else{let i=e.getNodeProperties(this).outputComputeNode;if(i)return i.build(e,t)}}},Kb=(e,t=[64])=>{(t.length===0||t.length>3)&&Ce(\\\"TSL: compute() workgroupSize must have 1, 2, or 3 elements\\\",new $r);for(let r=0;r\\u003ct.length;r++){let i=t[r];(typeof i!=\\\"number\\\"||i\\u003c=0||!Number.isInteger(i))&&Ce(`TSL: compute() workgroupSize element at index [ ${r} ] must be a positive integer`,new $r)}for(;t.length\\u003c3;)t.push(1);return new M6(Ye(e),t)},CC=(e,t,r)=>{let i=Kb(e,r);return typeof t==\\\"number\\\"?i.count=t:i.dispatchSize=t,i};xe(\\\"compute\\\",CC),xe(\\\"computeKernel\\\",Kb);var N6=class extends Ke{static get type(){return\\\"IsolateNode\\\"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isIsolateNode=!0}generateNodeType(e){let t=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);let i=this.node.getNodeType(e);return e.setCache(t),i}build(e,...t){let r=e.getCache(),i=e.getCacheFromNode(this,this.parent);e.setCache(i);let s=this.node.build(e,...t);return e.setCache(r),s}setParent(e){return this.parent=e,this}getParent(){return this.parent}},wd=e=>new N6(Ye(e));function RC(e,t=!0){return Ue('TSL: \\\"cache()\\\" has been deprecated. Use \\\"isolate()\\\" instead.'),wd(e).setParent(t)}xe(\\\"cache\\\",RC),xe(\\\"isolate\\\",wd);var A6=class extends Ke{static get type(){return\\\"BypassNode\\\"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}generateNodeType(e){return this.outputNode.getNodeType(e)}generate(e){let t=this.callNode.build(e,\\\"void\\\");return t!==\\\"\\\"&&e.addLineFlowCode(t,this),this.outputNode.build(e)}},EC=Mt(A6).setParameterLength(2);xe(\\\"bypass\\\",EC);var eT=Q(([e,t,r,i=D(0),s=D(1),a=Gs(!1)])=>{let n=e.sub(t).div(r.sub(t));return vd(a)&&(n=n.clamp()),n.mul(s.sub(i)).add(i)});function PC(e,t,r,i=D(0),s=D(1)){return eT(e,t,r,i,s,!0)}xe(\\\"remap\\\",eT),xe(\\\"remapClamp\\\",PC);var S0=class extends Ke{static get type(){return\\\"ExpressionNode\\\"}constructor(e=\\\"\\\",t=\\\"void\\\"){super(t),this.snippet=e}generate(e,t){let r=this.getNodeType(e),i=this.snippet;if(r===\\\"void\\\")e.addLineFlowCode(i,this);else return e.format(i,r,t)}},Xs=Mt(S0).setParameterLength(1,2),BC=e=>(e?Zi(e,Xs(\\\"discard\\\")):Xs(\\\"discard\\\")).toStack(),C6=()=>Xs(\\\"return\\\").toStack();xe(\\\"discard\\\",BC);var tT=Q(([e])=>Ve(e.rgb.mul(e.a),e.a),{color:\\\"vec4\\\",return:\\\"vec4\\\"}),IC=Q(([e])=>e.a.equal(0).select(Ve(0),Ve(e.rgb.div(e.a),e.a)),{color:\\\"vec4\\\",return:\\\"vec4\\\"}),R6=class extends rr{static get type(){return\\\"RenderOutputNode\\\"}constructor(e,t,r){super(\\\"vec4\\\"),this.colorNode=e,this._toneMapping=t,this.outputColorSpace=r,this.isRenderOutputNode=!0}setToneMapping(e){return this._toneMapping=e,this}getToneMapping(){return this._toneMapping}setup({context:e}){let t=this.colorNode||e.color;t=Ve(t.rgb,t.a.clamp(0,1)),t=IC(t);let r=(this._toneMapping!==null?this._toneMapping:e.toneMapping)||eo,i=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||Fa;return r!==eo&&(t=t.toneMapping(r)),i!==Fa&&i!==Gt.workingColorSpace&&(t=t.workingToColorSpace(i)),t=tT(t),t}},_0=(e,t=null,r=null)=>new R6(Ye(e),t,r);xe(\\\"renderOutput\\\",_0);var E6=class extends rr{static get type(){return\\\"DebugNode\\\"}constructor(e,t=null){super(),this.node=e,this.callback=t}generateNodeType(e){return this.node.getNodeType(e)}setup(e){return this.node.build(e)}analyze(e){return this.node.build(e)}generate(e){let t=this.callback,r=this.node.build(e);if(t!==null)t(e,r);else{let i=\\\"--- TSL debug - \\\"+e.shaderStage+\\\" shader ---\\\",s=\\\"-\\\".repeat(i.length),a=\\\"\\\";a+=\\\"// #\\\"+i+`#\\n`,a+=e.flow.code.replace(/^\\\\t/gm,\\\"\\\")+`\\n`,a+=\\\"/* ... */ \\\"+r+` /* ... */\\n`,a+=\\\"// #\\\"+s+`#\\n`,xv(a)}return r}},FC=(e,t=null)=>new E6(Ye(e),t).toStack();xe(\\\"debug\\\",FC);var LC=class extends hn{constructor(){super(),this._renderer=null,this.currentFrame=null}get nodeFrame(){return this._renderer._nodes.nodeFrame}setRenderer(e){return this._renderer=e,this}getRenderer(){return this._renderer}init(){}begin(){}finish(){}inspect(){}computeAsync(){}beginCompute(){}finishCompute(){}beginRender(){}finishRender(){}copyTextureToTexture(){}copyFramebufferToTexture(){}},P6=class extends Ke{static get type(){return\\\"InspectorNode\\\"}constructor(e,t=\\\"\\\",r=null){super(),this.node=e,this.name=t,this.callback=r,this.updateType=ut.FRAME,this.isInspectorNode=!0}getName(){return this.name||this.node.name}update(e){e.renderer.inspector.inspect(this)}generateNodeType(e){return this.node.getNodeType(e)}setup(e){let t=this.node;return e.context.inspector===!0&&this.callback!==null&&(t=this.callback(t)),e.renderer.backend.isWebGPUBackend!==!0&&e.renderer.inspector.constructor!==LC&&Et('TSL: \\\".toInspector()\\\" is only available with WebGPU.'),t}};function kC(e,t=\\\"\\\",r=null){return e=Ye(e),e.before(new P6(e,t,r))}xe(\\\"toInspector\\\",kC);function B6(e){Ue(\\\"TSL: AddNodeElement has been removed in favor of tree-shaking. Trying add\\\",e)}var DC=class extends Ke{static get type(){return\\\"AttributeNode\\\"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}generateNodeType(e){let t=this.nodeType;if(t===null){let r=this.getAttributeName(e);if(e.hasGeometryAttribute(r)){let i=e.geometry.getAttribute(r);t=e.getTypeFromAttribute(i)}else t=\\\"float\\\"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){let t=this.getAttributeName(e),r=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){let i=e.geometry.getAttribute(t),s=e.getTypeFromAttribute(i),a=e.getAttribute(t,s);return e.shaderStage===\\\"vertex\\\"?e.format(a.name,s,r):pl(this).build(e,r)}else return Ue(`AttributeNode: Vertex attribute \\\"${t}\\\" not found on geometry.`),e.generateConst(r)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}},$s=(e,t=null)=>new DC(e,t),Jt=(e=0)=>$s(\\\"uv\\\"+(e>0?e:\\\"\\\"),\\\"vec2\\\"),I6=class extends Ke{static get type(){return\\\"TextureSizeNode\\\"}constructor(e,t=null){super(\\\"uvec2\\\"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){let r=this.textureNode.build(e,\\\"property\\\"),i=this.levelNode===null?\\\"0\\\":this.levelNode.build(e,\\\"int\\\");return e.format(`${e.getMethod(\\\"textureDimensions\\\")}( ${r}, ${i} )`,this.getNodeType(e),t)}},Fu=Mt(I6).setParameterLength(1,2),F6=class extends Ep{static get type(){return\\\"MaxMipLevelNode\\\"}constructor(e){super(0),this._textureNode=e,this.updateType=ut.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){let e=this.texture,t=e.images,r=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(r&&r.width!==void 0){let{width:i,height:s}=r;this.value=Math.log2(Math.max(i,s))}}},rT=Mt(F6).setParameterLength(1),OC=class extends Error{constructor(e,t=null){super(e),this.name=\\\"NodeError\\\",this.stackTrace=t}},iT=new ji,An=class extends Ep{static get type(){return\\\"TextureNode\\\"}constructor(e=iT,t=null,r=null,i=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=r,this.biasNode=i,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.gatherNode=null,this.offsetNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=ut.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this._flipYUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}generateNodeType(){return this.value.isDepthTexture===!0?this.gatherNode===null?\\\"float\\\":\\\"vec4\\\":this.value.type===gr?\\\"uvec4\\\":this.value.type===ci?\\\"ivec4\\\":\\\"vec4\\\"}getInputType(){return\\\"texture\\\"}getDefaultUV(){return Jt(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Qe(this.value.matrix)),this._matrixUniform.mul(K(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this}setupUV(e,t){return e.isFlipY()&&(this._flipYUniform===null&&(this._flipYUniform=Qe(!1)),t=t.toVar(),this.sampler?t=this._flipYUniform.select(t.flipY(),t):t=this._flipYUniform.select(t.setY(Y(Fu(this,this.levelNode).y).sub(t.y).sub(1)),t)),t}setup(e){let t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;let r=this.value;if(!r||r.isTexture!==!0)throw new OC(\\\"THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().\\\",this.stackTrace);let i=Q(()=>{let o=this.uvNode;return(o===null||e.context.forceUVContext===!0)&&e.context.getUV&&(o=e.context.getUV(this,e)),o||(o=this.getDefaultUV()),this.updateMatrix===!0&&(o=this.getTransformedUV(o)),o=this.setupUV(e,o),this.updateType=this._matrixUniform!==null||this._flipYUniform!==null?ut.OBJECT:ut.NONE,o})(),s=this.levelNode;s===null&&e.context.getTextureLevel&&(s=e.context.getTextureLevel(this));let a=null,n=null;if(this.compareNode!==null)if(e.renderer.hasCompatibility(fu.TEXTURE_COMPARE))a=this.compareNode;else{let o=r.compareFunction;o===null||o===yv||o===tp||o===fg||o===$h?n=this.compareNode:(a=this.compareNode,Et('TSL: Only \\\"LessCompare\\\", \\\"LessEqualCompare\\\", \\\"GreaterCompare\\\" and \\\"GreaterEqualCompare\\\" are supported for depth texture comparison fallback.'))}t.uvNode=i,t.levelNode=s,t.biasNode=this.biasNode,t.compareNode=a,t.compareStepNode=n,t.gradNode=this.gradNode,t.gatherNode=this.gatherNode,t.depthNode=this.depthNode,t.offsetNode=this.offsetNode}generateUV(e,t){return t.build(e,this.sampler===!0?\\\"vec2\\\":\\\"ivec2\\\")}generateOffset(e,t){return t.build(e,\\\"ivec2\\\")}generateSnippet(e,t,r,i,s,a,n,o,l,u,h){let d=this.value,c;return s?c=e.generateTextureBias(d,t,r,s,a,u):o?c=e.generateTextureGrad(d,t,r,o,a,u):l?n?c=e.generateTextureGatherCompare(d,t,r,n,a,u,h):c=e.generateTextureGather(d,t,r,l,a,u,h):n?c=e.generateTextureCompare(d,t,r,n,a,u):this.sampler===!1?c=e.generateTextureLoad(d,t,r,i,a,u):i?c=e.generateTextureLevel(d,t,r,i,a,u):c=e.generateTexture(d,t,r,a,u),c}generate(e,t){let r=this.value,i=e.getNodeProperties(this),s=super.generate(e,\\\"property\\\");if(/^sampler/.test(t))return s+\\\"_sampler\\\";if(e.isReference(t))return s;{let a=e.getDataFromNode(this),n=this.getNodeType(e),o=a.propertyName;if(o===void 0){let{uvNode:u,levelNode:h,biasNode:d,compareNode:c,compareStepNode:m,depthNode:g,gradNode:y,gatherNode:b,offsetNode:v}=i,S=this.generateUV(e,u),T=h?h.build(e,\\\"float\\\"):null,w=d?d.build(e,\\\"float\\\"):null,N=g?g.build(e,\\\"int\\\"):null,C=c?c.build(e,\\\"float\\\"):null,R=m?m.build(e,\\\"float\\\"):null,E=y?[y[0].build(e,\\\"vec2\\\"),y[1].build(e,\\\"vec2\\\")]:null,P=b?b.build(e,\\\"int\\\"):null,I=v?this.generateOffset(e,v):null,O=this._flipYUniform?this._flipYUniform.build(e,\\\"bool\\\"):null;P&&(n=\\\"vec4\\\");let L=N;L===null&&r.isArrayTexture&&this.isTexture3DNode!==!0&&(L=\\\"0\\\");let X=e.getVarFromNode(this);o=e.getPropertyName(X);let z=this.generateSnippet(e,s,S,T,w,L,C,E,P,I,O);if(R!==null){let H=r.compareFunction;H===fg||H===$h?z=Bu(Xs(z,n),Xs(R,\\\"float\\\")).build(e,n):z=Bu(Xs(R,\\\"float\\\"),Xs(z,n)).build(e,n)}e.addLineFlowCode(`${o} = ${z}`,this),a.snippet=z,a.propertyName=o}let l=o;return e.needsToWorkingColorSpace(r)&&(l=v0(Xs(l,n),r.colorSpace).setup(e).build(e,n)),e.format(l,n,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}sample(e){let t=this.clone();return t.uvNode=Ye(e),t.referenceNode=this.getBase(),Ye(t)}load(e){return this.sample(e).setSampler(!1)}blur(e){let t=this.clone();t.biasNode=Ye(e).mul(rT(t)),t.referenceNode=this.getBase();let r=t.value;return t.generateMipmaps===!1&&(r&&r.generateMipmaps===!1||r.minFilter===or||r.magFilter===or)&&(Ue(\\\"TSL: texture().blur() requires mipmaps and sampling. Use .generateMipmaps=true and .minFilter/.magFilter=THREE.LinearFilter in the Texture.\\\"),t.biasNode=null),Ye(t)}level(e){let t=this.clone();return t.levelNode=Ye(e),t.referenceNode=this.getBase(),Ye(t)}size(e){return Fu(this,e)}bias(e){let t=this.clone();return t.biasNode=Ye(e),t.referenceNode=this.getBase(),Ye(t)}getBase(){return this.referenceNode?this.referenceNode.getBase():this}compare(e){let t=this.clone();return t.compareNode=Ye(e),t.referenceNode=this.getBase(),Ye(t)}grad(e,t){let r=this.clone();return r.gradNode=[Ye(e),Ye(t)],r.referenceNode=this.getBase(),Ye(r)}gather(e=0){let t=this.clone();return t.gatherNode=Ye(e),t.referenceNode=this.getBase(),Ye(t)}depth(e){let t=this.clone();return t.depthNode=Ye(e),t.referenceNode=this.getBase(),Ye(t)}offset(e){let t=this.clone();return t.offsetNode=Ye(e),t.referenceNode=this.getBase(),Ye(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){let e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix();let r=this._flipYUniform;r!==null&&(r.value=e.image instanceof ImageBitmap&&e.flipY===!0||e.isRenderTargetTexture===!0||e.isFramebufferTexture===!0||e.isDepthTexture===!0)}clone(){let e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},L6=Mt(An).setParameterLength(1,4).setName(\\\"texture\\\"),Ot=(e=iT,t=null,r=null,i=null)=>{let s;return e&&e.isTextureNode===!0?(s=Ye(e.clone()),s.referenceNode=e.getBase(),t!==null&&(s.uvNode=Ye(t)),r!==null&&(s.levelNode=Ye(r)),i!==null&&(s.biasNode=Ye(i))):s=L6(e,t,r,i),s},k6=(e=iT)=>Ot(e),Gr=(...e)=>Ot(...e).setSampler(!1),D6=(e,t,r)=>Ot(e,t).level(r),O6=e=>(e.isNode===!0?e:Ot(e)).convert(\\\"sampler\\\"),U6=e=>(e.isNode===!0?e:Ot(e)).convert(\\\"samplerComparison\\\"),sT=class extends Ep{static get type(){return\\\"BufferNode\\\"}constructor(e,t,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=r,this.updateRanges=[]}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}getElementType(e){return this.getNodeType(e)}getInputType(){return\\\"buffer\\\"}},Md=(e,t,r)=>new sT(e,t,r),z6=class extends _u{static get type(){return\\\"UniformArrayElementNode\\\"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){let t=super.generate(e),r=this.getNodeType(e),i=this.node.getPaddedType();return e.format(t,i,r)}},V6=class extends sT{static get type(){return\\\"UniformArrayNode\\\"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?ol(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=ut.RENDER,this.isArrayBufferNode=!0}generateNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){let e=this.elementType,t=\\\"vec4\\\";return e===\\\"mat2\\\"?t=\\\"mat2\\\":/mat/.test(e)===!0?t=\\\"mat4\\\":e.charAt(0)===\\\"i\\\"?t=\\\"ivec4\\\":e.charAt(0)===\\\"u\\\"&&(t=\\\"uvec4\\\"),t}update(){let{array:e,value:t}=this,r=this.elementType;if(r===\\\"float\\\"||r===\\\"int\\\"||r===\\\"uint\\\")for(let i=0;i\\u003ce.length;i++){let s=i*4;t[s]=e[i]}else if(r===\\\"color\\\")for(let i=0;i\\u003ce.length;i++){let s=i*4,a=e[i];t[s]=a.r,t[s+1]=a.g,t[s+2]=a.b||0}else if(r===\\\"mat2\\\")for(let i=0;i\\u003ce.length;i++){let s=i*4,a=e[i];t[s]=a.elements[0],t[s+1]=a.elements[1],t[s+2]=a.elements[2],t[s+3]=a.elements[3]}else if(r===\\\"mat3\\\")for(let i=0;i\\u003ce.length;i++){let s=i*16,a=e[i];t[s]=a.elements[0],t[s+1]=a.elements[1],t[s+2]=a.elements[2],t[s+4]=a.elements[3],t[s+5]=a.elements[4],t[s+6]=a.elements[5],t[s+8]=a.elements[6],t[s+9]=a.elements[7],t[s+10]=a.elements[8],t[s+15]=1}else if(r===\\\"mat4\\\")for(let i=0;i\\u003ce.length;i++){let s=i*16,a=e[i];for(let n=0;n\\u003ca.elements.length;n++)t[s+n]=a.elements[n]}else for(let i=0;i\\u003ce.length;i++){let s=i*4,a=e[i];t[s]=a.x,t[s+1]=a.y,t[s+2]=a.z||0,t[s+3]=a.w||0}}setup(e){let t=this.array.length,r=this.elementType,i=Float32Array,s=this.paddedType,a=e.getTypeLength(s);return r.charAt(0)===\\\"i\\\"&&(i=Int32Array),r.charAt(0)===\\\"u\\\"&&(i=Uint32Array),this.value=new i(t*a),this.bufferCount=t,this.bufferType=s,this.update(),super.setup(e)}element(e){return new z6(this,Ye(e))}},Li=(e,t)=>new V6(e,t),G6=class extends Ke{constructor(e){super(\\\"float\\\"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}},bo=Mt(G6).setParameterLength(1),Pp,Bp,vs=class Ba extends Ke{static get type(){return\\\"ScreenNode\\\"}constructor(t){super(),this.scope=t,this._output=null,this.isViewportNode=!0}generateNodeType(){return this.scope===Ba.DPR?\\\"float\\\":this.scope===Ba.VIEWPORT?\\\"vec4\\\":\\\"vec2\\\"}getUpdateType(){let t=ut.NONE;return(this.scope===Ba.SIZE||this.scope===Ba.VIEWPORT||this.scope===Ba.DPR)&&(t=ut.RENDER),this.updateType=t,t}update({renderer:t}){let r=t.getRenderTarget();this.scope===Ba.VIEWPORT?r!==null?Bp.copy(r.viewport):(t.getViewport(Bp),Bp.multiplyScalar(t.getPixelRatio())):this.scope===Ba.DPR?this._output.value=t.getPixelRatio():r!==null?(Pp.width=r.width,Pp.height=r.height):t.getDrawingBufferSize(Pp)}setup(){let t=this.scope,r=null;return t===Ba.SIZE?r=Qe(Pp||(Pp=new fe)):t===Ba.VIEWPORT?r=Qe(Bp||(Bp=new Wt)):t===Ba.DPR?r=Qe(1):r=ke(ku.div(Lu)),this._output=r,r}generate(t){if(this.scope===Ba.COORDINATE){let r=t.getFragCoord();if(t.isFlipY()){let i=t.getNodeProperties(Lu).outputNode.build(t);r=`${t.getType(\\\"vec2\\\")}( ${r}.x, ${i}.y - ${r}.y )`}return r}return super.generate(t)}};vs.COORDINATE=\\\"coordinate\\\",vs.VIEWPORT=\\\"viewport\\\",vs.SIZE=\\\"size\\\",vs.UV=\\\"uv\\\",vs.DPR=\\\"dpr\\\";var aT=ze(vs,vs.DPR),Ga=ze(vs,vs.UV),Lu=ze(vs,vs.SIZE),ku=ze(vs,vs.COORDINATE),Nd=ze(vs,vs.VIEWPORT),nT=Nd.zw,UC=ku.sub(Nd.xy),W6=UC.div(nT),j6=Q(()=>(Ue('TSL: \\\"viewportResolution\\\" is deprecated. Use \\\"screenSize\\\" instead.',new $r),Lu),\\\"vec2\\\").once()(),oT=null,w0=null,lT=null,M0=null,uT=null,N0=null,hT=null,A0=null,dT=null,C0=null,cT=null,R0=null,pT=null,E0=null,fl=Qe(0,\\\"uint\\\").setName(\\\"u_cameraIndex\\\").setGroup(d0(\\\"cameraIndex\\\")).toVarying(\\\"v_cameraIndex\\\"),gl=Qe(\\\"float\\\").setName(\\\"cameraNear\\\").setGroup(st).onRenderUpdate(({camera:e})=>e.near),yl=Qe(\\\"float\\\").setName(\\\"cameraFar\\\").setGroup(st).onRenderUpdate(({camera:e})=>e.far),bs=Q(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let r=[];for(let i of e.cameras)r.push(i.projectionMatrix);w0===null?w0=Li(r).setGroup(st).setName(\\\"cameraProjectionMatrices\\\"):w0.array=r,t=w0.element(e.isMultiViewCamera?bo(\\\"gl_ViewID_OVR\\\"):fl)}else oT===null&&(oT=Qe(e.projectionMatrix).setName(\\\"cameraProjectionMatrix\\\").setGroup(st).onRenderUpdate(({camera:r})=>r.projectionMatrix)),t=oT;return t}).once()(),zC=Q(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let r=[];for(let i of e.cameras)r.push(i.projectionMatrixInverse);M0===null?M0=Li(r).setGroup(st).setName(\\\"cameraProjectionMatricesInverse\\\"):M0.array=r,t=M0.element(e.isMultiViewCamera?bo(\\\"gl_ViewID_OVR\\\"):fl)}else lT===null&&(lT=Qe(e.projectionMatrixInverse).setName(\\\"cameraProjectionMatrixInverse\\\").setGroup(st).onRenderUpdate(({camera:r})=>r.projectionMatrixInverse)),t=lT;return t}).once()(),xl=Q(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let r=[];for(let i of e.cameras)r.push(i.matrixWorldInverse);N0===null?N0=Li(r).setGroup(st).setName(\\\"cameraViewMatrices\\\"):N0.array=r,t=N0.element(e.isMultiViewCamera?bo(\\\"gl_ViewID_OVR\\\"):fl)}else uT===null&&(uT=Qe(e.matrixWorldInverse).setName(\\\"cameraViewMatrix\\\").setGroup(st).onRenderUpdate(({camera:r})=>r.matrixWorldInverse)),t=uT;return t}).once()(),Ip=Q(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let r=[];for(let i of e.cameras)r.push(i.matrixWorld);A0===null?A0=Li(r).setGroup(st).setName(\\\"cameraWorldMatrices\\\"):A0.array=r,t=A0.element(e.isMultiViewCamera?bo(\\\"gl_ViewID_OVR\\\"):fl)}else hT===null&&(hT=Qe(e.matrixWorld).setName(\\\"cameraWorldMatrix\\\").setGroup(st).onRenderUpdate(({camera:r})=>r.matrixWorld)),t=hT;return t}).once()(),H6=Q(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let r=[];for(let i of e.cameras)r.push(i.normalMatrix);C0===null?C0=Li(r).setGroup(st).setName(\\\"cameraNormalMatrices\\\"):C0.array=r,t=C0.element(e.isMultiViewCamera?bo(\\\"gl_ViewID_OVR\\\"):fl)}else dT===null&&(dT=Qe(e.normalMatrix).setName(\\\"cameraNormalMatrix\\\").setGroup(st).onRenderUpdate(({camera:r})=>r.normalMatrix)),t=dT;return t}).once()(),VC=Q(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let r=[];for(let i=0,s=e.cameras.length;i\\u003cs;i++)r.push(new F);R0===null?R0=Li(r).setGroup(st).setName(\\\"cameraPositions\\\").onRenderUpdate(({camera:i},s)=>{let a=i.cameras,n=s.array;for(let o=0,l=a.length;o\\u003cl;o++)n[o].setFromMatrixPosition(a[o].matrixWorld)}):R0.array=r,t=R0.element(e.isMultiViewCamera?bo(\\\"gl_ViewID_OVR\\\"):fl)}else cT===null&&(cT=Qe(new F).setName(\\\"cameraPosition\\\").setGroup(st).onRenderUpdate(({camera:r},i)=>i.value.setFromMatrixPosition(r.matrixWorld))),t=cT;return t}).once()(),X6=Q(({camera:e})=>{let t;if(e.isArrayCamera&&e.cameras.length>0){let r=[];for(let i of e.cameras)r.push(i.viewport);E0===null?E0=Li(r,\\\"vec4\\\").setGroup(st).setName(\\\"cameraViewports\\\"):E0.array=r,t=E0.element(fl)}else pT===null&&(pT=Ve(0,0,Lu.x,Lu.y).toConst(\\\"cameraViewport\\\")),t=pT;return t}).once()(),GC=new Ng,mi=class bi extends Ke{static get type(){return\\\"Object3DNode\\\"}constructor(t,r=null){super(),this.scope=t,this.object3d=r,this.updateType=ut.OBJECT,this.uniformNode=new Ep(null)}generateNodeType(){let t=this.scope;if(t===bi.WORLD_MATRIX)return\\\"mat4\\\";if(t===bi.POSITION||t===bi.VIEW_POSITION||t===bi.DIRECTION||t===bi.SCALE)return\\\"vec3\\\";if(t===bi.RADIUS)return\\\"float\\\"}update(t){let r=this.object3d,i=this.uniformNode,s=this.scope;if(s===bi.WORLD_MATRIX)i.value=r.matrixWorld;else if(s===bi.POSITION)i.value=i.value||new F,i.value.setFromMatrixPosition(r.matrixWorld);else if(s===bi.SCALE)i.value=i.value||new F,i.value.setFromMatrixScale(r.matrixWorld);else if(s===bi.DIRECTION)i.value=i.value||new F,r.getWorldDirection(i.value);else if(s===bi.VIEW_POSITION){let a=t.camera;i.value=i.value||new F,i.value.setFromMatrixPosition(r.matrixWorld),i.value.applyMatrix4(a.matrixWorldInverse)}else if(s===bi.RADIUS){let a=t.object.geometry;a.boundingSphere===null&&a.computeBoundingSphere(),GC.copy(a.boundingSphere).applyMatrix4(r.matrixWorld),i.value=GC.radius}}generate(t){let r=this.scope;return r===bi.WORLD_MATRIX?this.uniformNode.nodeType=\\\"mat4\\\":r===bi.POSITION||r===bi.VIEW_POSITION||r===bi.DIRECTION||r===bi.SCALE?this.uniformNode.nodeType=\\\"vec3\\\":r===bi.RADIUS&&(this.uniformNode.nodeType=\\\"float\\\"),this.uniformNode.build(t)}serialize(t){super.serialize(t),t.scope=this.scope}deserialize(t){super.deserialize(t),this.scope=t.scope}};mi.WORLD_MATRIX=\\\"worldMatrix\\\",mi.POSITION=\\\"position\\\",mi.SCALE=\\\"scale\\\",mi.VIEW_POSITION=\\\"viewPosition\\\",mi.DIRECTION=\\\"direction\\\",mi.RADIUS=\\\"radius\\\";var $6=Mt(mi,mi.DIRECTION).setParameterLength(1),q6=Mt(mi,mi.WORLD_MATRIX).setParameterLength(1),Y6=Mt(mi,mi.POSITION).setParameterLength(1),Z6=Mt(mi,mi.SCALE).setParameterLength(1),J6=Mt(mi,mi.VIEW_POSITION).setParameterLength(1),Q6=Mt(mi,mi.RADIUS).setParameterLength(1),fa=class extends mi{static get type(){return\\\"ModelNode\\\"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}},K6=ze(fa,fa.DIRECTION),ga=ze(fa,fa.WORLD_MATRIX),ez=ze(fa,fa.POSITION),tz=ze(fa,fa.SCALE),rz=ze(fa,fa.VIEW_POSITION),iz=ze(fa,fa.RADIUS),WC=Qe(new Dr).onObjectUpdate(({object:e},t)=>t.value.getNormalMatrix(e.matrixWorld)),sz=Qe(new We).onObjectUpdate(({object:e},t)=>t.value.copy(e.matrixWorld).invert()),Cn=Q(e=>e.context.modelViewMatrix||jC).once()().toVar(\\\"modelViewMatrix\\\"),jC=xl.mul(ga),mT=Q(e=>(e.context.isHighPrecisionModelViewMatrix=!0,Qe(\\\"mat4\\\").onObjectUpdate(({object:t,camera:r})=>t.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,t.matrixWorld)))).once()().toVar(\\\"highpModelViewMatrix\\\"),fT=Q(e=>{let t=e.context.isHighPrecisionModelViewMatrix;return Qe(\\\"mat3\\\").onObjectUpdate(({object:r,camera:i})=>(t!==!0&&r.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,r.matrixWorld),r.normalMatrix.getNormalMatrix(r.modelViewMatrix)))}).once()().toVar(\\\"highpModelNormalViewMatrix\\\"),HC=Q(e=>e.shaderStage!==\\\"fragment\\\"?(Et(\\\"TSL: `clipSpace` is only available in fragment stage.\\\"),Ve()):e.context.clipSpace.toVarying(\\\"v_clipSpace\\\")).once()(),Ji=$s(\\\"position\\\",\\\"vec3\\\"),wr=Ji.toVarying(\\\"positionLocal\\\"),Du=Ji.toVarying(\\\"positionPrevious\\\"),Rn=Q(e=>ga.mul(wr).xyz.toVarying(e.getSubBuildProperty(\\\"v_positionWorld\\\")),\\\"vec3\\\").once([\\\"POSITION\\\"])(),gT=Q(()=>wr.transformDirection(ga).toVarying(\\\"v_positionWorldDirection\\\").normalize().toVar(\\\"positionWorldDirection\\\"),\\\"vec3\\\").once([\\\"POSITION\\\"])(),Wr=Q(e=>{if(e.shaderStage===\\\"fragment\\\"&&e.material.vertexNode){let t=zC.mul(HC);return t.xyz.div(t.w).toVar(\\\"positionView\\\")}return e.context.setupPositionView().toVarying(\\\"v_positionView\\\")},\\\"vec3\\\").once([\\\"POSITION\\\",\\\"VERTEX\\\"])(),ar=Q(e=>{let t;return e.camera.isOrthographicCamera?t=K(0,0,1):t=Wr.negate().toVarying(\\\"v_positionViewDirection\\\").normalize(),t.toVar(\\\"positionViewDirection\\\")},\\\"vec3\\\").once([\\\"POSITION\\\"])(),az=class extends Ke{static get type(){return\\\"FrontFacingNode\\\"}constructor(){super(\\\"bool\\\"),this.isFrontFacingNode=!0}generate(e){if(e.shaderStage!==\\\"fragment\\\")return\\\"true\\\";let{material:t}=e;return t.side===ii?\\\"false\\\":e.getFrontFacing()}},XC=ze(az),yT=D(XC).mul(2).sub(1),Ou=Q(([e],{material:t})=>{let r=t.side;return r===ii?e=e.mul(-1):r===hs&&(e=e.mul(yT)),e}),nz=e=>(Et('TSL: \\\"directionToFaceDirection()\\\" has been renamed to \\\"negateOnBackSide()\\\".'),Ou(e)),P0=$s(\\\"normal\\\",\\\"vec3\\\"),Qi=Q(e=>e.geometry.hasAttribute(\\\"normal\\\")===!1?(Ue('TSL: Vertex attribute \\\"normal\\\" not found on geometry.'),K(0,1,0)):P0,\\\"vec3\\\").once()().toVar(\\\"normalLocal\\\"),$C=Wr.dFdx().cross(Wr.dFdy()).normalize().toVar(\\\"normalFlat\\\"),Ad=Q(e=>{let t;return e.isFlatShading()?t=$C:t=vT(Qi).toVarying(\\\"v_normalViewGeometry\\\").normalize(),t},\\\"vec3\\\").once()().toVar(\\\"normalViewGeometry\\\"),qC=Q(e=>{let t=Ad.transformNormalByInverseViewMatrix(xl);return e.isFlatShading()!==!0&&(t=t.toVarying(\\\"v_normalWorldGeometry\\\")),t.normalize().toVar(\\\"normalWorldGeometry\\\")},\\\"vec3\\\").once()(),Ut=Q(e=>{let t;return e.subBuildFn===\\\"NORMAL\\\"||e.subBuildFn===\\\"VERTEX\\\"?(t=Ad,e.isFlatShading()!==!0&&(t=Ou(t))):t=e.context.setupNormal().context({getUV:null,getTextureLevel:null}),t},\\\"vec3\\\").once([\\\"NORMAL\\\",\\\"VERTEX\\\"])().toVar(\\\"normalView\\\"),vl=Ut.transformNormalByInverseViewMatrix(xl).toVar(\\\"normalWorld\\\"),bl=Q(({subBuildFn:e,context:t})=>{let r;return e===\\\"NORMAL\\\"||e===\\\"VERTEX\\\"?r=Ut:r=t.setupClearcoatNormal().context({getUV:null,getTextureLevel:null}),r},\\\"vec3\\\").once([\\\"NORMAL\\\",\\\"VERTEX\\\"])().toVar(\\\"clearcoatNormalView\\\"),xT=Q(([e,t=ga])=>Ni(t).inverse().transpose().mul(e).normalize());xe(\\\"transformNormal\\\",xT);var vT=Q(([e],t)=>{let r=t.context.modelNormalViewMatrix;return r?e.transformNormalByViewMatrix(r):WC.mul(e).transformNormalByViewMatrix(xl)}),oz=Q(()=>(Ue('TSL: \\\"transformedNormalView\\\" is deprecated. Use \\\"normalView\\\" instead.'),Ut)).once([\\\"NORMAL\\\",\\\"VERTEX\\\"])(),lz=Q(()=>(Ue('TSL: \\\"transformedNormalWorld\\\" is deprecated. Use \\\"normalWorld\\\" instead.'),vl)).once([\\\"NORMAL\\\",\\\"VERTEX\\\"])(),uz=Q(()=>(Ue('TSL: \\\"transformedClearcoatNormalView\\\" is deprecated. Use \\\"clearcoatNormalView\\\" instead.'),bl)).once([\\\"NORMAL\\\",\\\"VERTEX\\\"])(),bT=new We,YC=Qe(0).onReference(({material:e})=>e).onObjectUpdate(({material:e})=>e.refractionRatio),B0=Qe(1).onReference(({material:e})=>e).onObjectUpdate(function({material:e,scene:t}){return e.envMap?e.envMapIntensity:t.environmentIntensity}),I0=Qe(new We).onReference(function(e){return e.material}).onObjectUpdate(function({material:e,scene:t}){let r=(t.environment!==null||t.environmentNode&&t.environmentNode.isNode)&&e.envMap===null?t.environmentRotation:e.envMapRotation;return r?bT.makeRotationFromEuler(r).transpose():bT.identity(),bT}),ZC=ar.negate().reflect(Ut),JC=ar.negate().refract(Ut,YC),QC=ZC.transformDirection(Ip).toVar(\\\"reflectVector\\\"),KC=JC.transformDirection(Ip).toVar(\\\"refractVector\\\"),eR=new Ug,hz=class extends An{static get type(){return\\\"CubeTextureNode\\\"}constructor(e,t=null,r=null,i=null){super(e,t,r,i),this.isCubeTextureNode=!0}getInputType(){return this.value.isDepthTexture===!0?\\\"cubeDepthTexture\\\":\\\"cubeTexture\\\"}getDefaultUV(){let e=this.value;return e.mapping===Vh?QC:e.mapping===Lf?KC:(Ce('CubeTextureNode: Mapping \\\"%s\\\" not supported.',e.mapping),K(0,0,0))}setUpdateMatrix(){}setupUV(e,t){let r=this.value;return r.isDepthTexture===!0?e.renderer.coordinateSystem===da?K(t.x,t.y.negate(),t.z):t:(t=I0.mul(t),(e.renderer.coordinateSystem===da||!r.isRenderTargetTexture)&&(t=K(t.x.negate(),t.yz)),t)}generateUV(e,t){return t.build(e,this.sampler===!0?\\\"vec3\\\":\\\"ivec3\\\")}},TT=Mt(hz).setParameterLength(1,4).setName(\\\"cubeTexture\\\"),Ts=(e=eR,t=null,r=null,i=null)=>{let s;return e&&e.isCubeTextureNode===!0?(s=Ye(e.clone()),s.referenceNode=e,t!==null&&(s.uvNode=Ye(t)),r!==null&&(s.levelNode=Ye(r)),i!==null&&(s.biasNode=Ye(i))):s=TT(e,t,r,i),s},dz=(e=eR)=>TT(e),cz=class extends _u{static get type(){return\\\"ReferenceElementNode\\\"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}generateNodeType(){return this.referenceNode.uniformType}generate(e){let t=super.generate(e),r=this.referenceNode.getNodeType(e),i=this.getNodeType(e);return e.format(t,r,i)}},F0=class extends Ke{static get type(){return\\\"ReferenceNode\\\"}constructor(e,t,r=null,i=null){super(),this.property=e,this.uniformType=t,this.object=r,this.count=i,this.properties=e.split(\\\".\\\"),this.reference=r,this.node=null,this.group=null,this.name=null,this.updateType=ut.OBJECT}element(e){return new cz(this,Ye(e))}setGroup(e){return this.group=e,this}setName(e){return this.name=e,this}label(e){return Ue('TSL: \\\"label()\\\" has been deprecated. Use \\\"setName()\\\" instead.'),this.setName(e)}setNodeType(e){let t=null;this.count!==null?t=Md(null,e,this.count):Array.isArray(this.getValueFromReference())?(t=Li(null,e),t.updateType=ut.OBJECT):e===\\\"texture\\\"?t=Ot(null):e===\\\"cubeTexture\\\"?t=Ts(null):t=Qe(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.setName(this.name),this.node=t}generateNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){let{properties:t}=this,r=e[t[0]];for(let i=1;i\\u003ct.length;i++)r=r[t[i]];return r}updateReference(e){return this.reference=this.object!==null?this.object:e.object,this.reference}setup(){return this.updateValue(),this.node}update(){this.updateValue()}updateValue(){this.node===null&&this.setNodeType(this.uniformType);let e=this.getValueFromReference();Array.isArray(e)?this.node.array=e:this.node.value=e}},cr=(e,t,r)=>new F0(e,t,r),tR=(e,t,r,i)=>new F0(e,t,i,r),pz=class extends F0{static get type(){return\\\"MaterialReferenceNode\\\"}constructor(e,t,r=null){super(e,t,r),this.material=r,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}},To=(e,t,r=null)=>new pz(e,t,r),rR=Jt(),mz=Wr.dFdx(),fz=Wr.dFdy(),iR=rR.dFdx(),sR=rR.dFdy(),aR=Ut,nR=fz.cross(aR),oR=aR.cross(mz),ST=nR.mul(iR.x).add(oR.mul(sR.x)),_T=nR.mul(iR.y).add(oR.mul(sR.y)),lR=ST.dot(ST).max(_T.dot(_T)),uR=lR.equal(0).select(0,lR.inverseSqrt()),gz=ST.mul(uR).toVar(\\\"tangentViewFrame\\\"),yz=_T.mul(uR).toVar(\\\"bitangentViewFrame\\\"),L0=$s(\\\"tangent\\\",\\\"vec4\\\"),Tl=L0.xyz.toVar(\\\"tangentLocal\\\"),k0=Q(e=>{let t;return e.subBuildFn===\\\"VERTEX\\\"||e.geometry.hasAttribute(\\\"tangent\\\")?t=Cn.mul(Ve(Tl,0)).xyz.toVarying(\\\"v_tangentView\\\").normalize():t=gz,e.isFlatShading()!==!0&&(t=Ou(t)),t},\\\"vec3\\\").once([\\\"NORMAL\\\",\\\"VERTEX\\\"])().toVar(\\\"tangentView\\\"),hR=k0.transformDirection(Ip).toVarying(\\\"v_tangentWorld\\\").normalize().toVar(\\\"tangentWorld\\\"),D0=Q(([e,t],r)=>{let i=e.mul(L0.w).xyz;return r.subBuildFn===\\\"NORMAL\\\"&&r.isFlatShading()!==!0&&(i=i.toVarying(t)),i}).once([\\\"NORMAL\\\"]),xz=D0(P0.cross(L0),\\\"v_bitangentGeometry\\\").normalize().toVar(\\\"bitangentGeometry\\\"),vz=D0(Qi.cross(Tl),\\\"v_bitangentLocal\\\").normalize().toVar(\\\"bitangentLocal\\\"),dR=Q(e=>{let t;return e.subBuildFn===\\\"VERTEX\\\"||e.geometry.hasAttribute(\\\"tangent\\\")?t=D0(Ut.cross(k0),\\\"v_bitangentView\\\").normalize():t=yz,e.isFlatShading()!==!0&&(t=Ou(t)),t},\\\"vec3\\\").once([\\\"NORMAL\\\",\\\"VERTEX\\\"])().toVar(\\\"bitangentView\\\"),bz=D0(vl.cross(hR),\\\"v_bitangentWorld\\\").normalize().toVar(\\\"bitangentWorld\\\"),Uu=Ni(k0,dR,Ut).toVar(\\\"TBNViewMatrix\\\"),cR=ar.mul(Uu),Tz=(e,t)=>e.sub(cR.mul(t)),pR=Q(()=>{let e=Cu.cross(ar);return e=e.cross(Cu).normalize(),e=Ct(e,Ut,dl.mul(_n.oneMinus()).oneMinus().pow2().pow2()).normalize(),e}).once()(),wT=e=>Ye(e).mul(.5).add(.5),mR=e=>Ye(e).mul(2).sub(1),MT=e=>K(e,ys(y0(D(1).sub(pa(e,e))))),Sz=e=>(Et('TSL: \\\"directionToColor()\\\" has been renamed to \\\"packNormalToRGB()\\\".'),wT(e)),_z=e=>(Et('TSL: \\\"colorToDirection()\\\" has been renamed to \\\"unpackRGBToNormal()\\\".'),mR(e)),wz=class extends rr{static get type(){return\\\"NormalMapNode\\\"}constructor(e,t=null){super(\\\"vec3\\\"),this.node=e,this.scaleNode=t,this.normalMapType=so,this.unpackNormalMode=fv}setup(e){let{normalMapType:t,scaleNode:r,unpackNormalMode:i}=this,s=this.node.mul(2).sub(1);if(t===so?i===FM?s=MT(s.xy):i===DD?s=MT(s.yw):i!==fv&&Ce(`THREE.NodeMaterial: Unexpected unpack normal mode: ${i}`):i!==fv&&Ce(`THREE.NodeMaterial: Normal map type '${t}' is not compatible with unpack normal mode '${i}'`),r!==null){let n=r;e.isFlatShading()===!0&&(n=Ou(n)),s=K(s.xy.mul(n),s.z)}let a=null;return t===kD?a=vT(s):t===so?a=Uu.mul(s).normalize():(Ce(`NodeMaterial: Unsupported normal map type: ${t}`),a=Ut),a}},NT=Mt(wz).setParameterLength(1,2),Mz=Q(({textureNode:e,bumpScale:t})=>{let r=s=>e.isolate().context({getUV:a=>s(a.uvNode||Jt()),forceUVContext:!0}),i=D(r(s=>s));return ke(D(r(s=>s.add(s.dFdx()))).sub(i),D(r(s=>s.add(s.dFdy()))).sub(i)).mul(t)}),Nz=Q(e=>{let{surf_pos:t,surf_norm:r,dHdxy:i}=e,s=t.dFdx().normalize(),a=t.dFdy().normalize(),n=r,o=a.cross(n),l=n.cross(s),u=s.dot(o).mul(yT),h=u.sign().mul(i.x.mul(o).add(i.y.mul(l)));return u.abs().mul(r).sub(h).normalize()}),Az=class extends rr{static get type(){return\\\"BumpMapNode\\\"}constructor(e,t=null){super(\\\"vec3\\\"),this.textureNode=e,this.scaleNode=t}setup(e){if(e.material.wireframe===!0)return Ut;let t=this.scaleNode!==null?this.scaleNode:1,r=Mz({textureNode:this.textureNode,bumpScale:t});return Nz({surf_pos:Wr,surf_norm:Ut,dHdxy:r})}},AT=Mt(Az).setParameterLength(1,2),fR=new Map,Pe=class zr extends Ke{static get type(){return\\\"MaterialNode\\\"}constructor(t){super(),this.scope=t}getCache(t,r){let i=fR.get(t);return i===void 0&&(i=To(t,r),fR.set(t,i)),i}getFloat(t){return this.getCache(t,\\\"float\\\")}getColor(t){return this.getCache(t,\\\"color\\\")}getTexture(t){return this.getCache(t===\\\"map\\\"?\\\"map\\\":t+\\\"Map\\\",\\\"texture\\\")}setup(t){let r=t.context.material,i=this.scope,s=null;if(i===zr.COLOR){let a=r.color!==void 0?this.getColor(i):K();r.map&&r.map.isTexture===!0?s=a.mul(this.getTexture(\\\"map\\\")):s=a}else if(i===zr.OPACITY){let a=this.getFloat(i);r.alphaMap&&r.alphaMap.isTexture===!0?s=a.mul(this.getTexture(\\\"alpha\\\")):s=a}else if(i===zr.SPECULAR_STRENGTH)r.specularMap&&r.specularMap.isTexture===!0?s=this.getTexture(\\\"specular\\\").r:s=D(1);else if(i===zr.SPECULAR_INTENSITY){let a=this.getFloat(i);r.specularIntensityMap&&r.specularIntensityMap.isTexture===!0?s=a.mul(this.getTexture(i).a):s=a}else if(i===zr.SPECULAR_COLOR){let a=this.getColor(i);r.specularColorMap&&r.specularColorMap.isTexture===!0?s=a.mul(this.getTexture(i).rgb):s=a}else if(i===zr.ROUGHNESS){let a=this.getFloat(i);r.roughnessMap&&r.roughnessMap.isTexture===!0?s=a.mul(this.getTexture(i).g):s=a}else if(i===zr.METALNESS){let a=this.getFloat(i);r.metalnessMap&&r.metalnessMap.isTexture===!0?s=a.mul(this.getTexture(i).b):s=a}else if(i===zr.EMISSIVE){let a=this.getFloat(\\\"emissiveIntensity\\\"),n=this.getColor(i).mul(a);r.emissiveMap&&r.emissiveMap.isTexture===!0?s=n.mul(this.getTexture(i)):s=n}else if(i===zr.NORMAL)r.normalMap?(s=NT(this.getTexture(\\\"normal\\\"),this.getCache(\\\"normalScale\\\",\\\"vec2\\\")),s.normalMapType=r.normalMapType,(r.normalMap.format==ha||r.normalMap.format==ep||r.normalMap.format==Kc)&&(s.unpackNormalMode=FM)):r.bumpMap?s=AT(this.getTexture(\\\"bump\\\").r,this.getFloat(\\\"bumpScale\\\")):s=Ut;else if(i===zr.CLEARCOAT){let a=this.getFloat(i);r.clearcoatMap&&r.clearcoatMap.isTexture===!0?s=a.mul(this.getTexture(i).r):s=a}else if(i===zr.CLEARCOAT_ROUGHNESS){let a=this.getFloat(i);r.clearcoatRoughnessMap&&r.clearcoatRoughnessMap.isTexture===!0?s=a.mul(this.getTexture(i).r):s=a}else if(i===zr.CLEARCOAT_NORMAL)r.clearcoatNormalMap?s=NT(this.getTexture(i),this.getCache(i+\\\"Scale\\\",\\\"vec2\\\")):s=Ut;else if(i===zr.SHEEN){let a=this.getColor(\\\"sheenColor\\\").mul(this.getFloat(\\\"sheen\\\"));r.sheenColorMap&&r.sheenColorMap.isTexture===!0?s=a.mul(this.getTexture(\\\"sheenColor\\\").rgb):s=a}else if(i===zr.SHEEN_ROUGHNESS){let a=this.getFloat(i);r.sheenRoughnessMap&&r.sheenRoughnessMap.isTexture===!0?s=a.mul(this.getTexture(i).a):s=a,s=s.clamp(1e-4,1)}else if(i===zr.ANISOTROPY)if(r.anisotropyMap&&r.anisotropyMap.isTexture===!0){let a=this.getTexture(i);s=i0(Cd.x,Cd.y,Cd.y.negate(),Cd.x).mul(a.rg.mul(2).sub(ke(1)).normalize().mul(a.b))}else s=Cd;else if(i===zr.IRIDESCENCE_THICKNESS){let a=cr(\\\"1\\\",\\\"float\\\",r.iridescenceThicknessRange);if(r.iridescenceThicknessMap){let n=cr(\\\"0\\\",\\\"float\\\",r.iridescenceThicknessRange);s=a.sub(n).mul(this.getTexture(i).g).add(n)}else s=a}else if(i===zr.TRANSMISSION){let a=this.getFloat(i);r.transmissionMap?s=a.mul(this.getTexture(i).r):s=a}else if(i===zr.THICKNESS){let a=this.getFloat(i);r.thicknessMap?s=a.mul(this.getTexture(i).g):s=a}else if(i===zr.IOR)s=this.getFloat(i);else if(i===zr.LIGHT_MAP)r.lightMap?s=this.getTexture(i).rgb.mul(this.getFloat(\\\"lightMapIntensity\\\")):s=K(0);else if(i===zr.AO)r.aoMap?s=this.getTexture(i).r.sub(1).mul(this.getFloat(\\\"aoMapIntensity\\\")).add(1):s=D(1);else if(i===zr.LINE_DASH_OFFSET)s=r.dashOffset?this.getFloat(i):D(0);else{let a=this.getNodeType(t);s=this.getCache(i,a)}return s}};Pe.ALPHA_TEST=\\\"alphaTest\\\",Pe.COLOR=\\\"color\\\",Pe.OPACITY=\\\"opacity\\\",Pe.SHININESS=\\\"shininess\\\",Pe.SPECULAR=\\\"specular\\\",Pe.SPECULAR_STRENGTH=\\\"specularStrength\\\",Pe.SPECULAR_INTENSITY=\\\"specularIntensity\\\",Pe.SPECULAR_COLOR=\\\"specularColor\\\",Pe.REFLECTIVITY=\\\"reflectivity\\\",Pe.ROUGHNESS=\\\"roughness\\\",Pe.METALNESS=\\\"metalness\\\",Pe.NORMAL=\\\"normal\\\",Pe.CLEARCOAT=\\\"clearcoat\\\",Pe.CLEARCOAT_ROUGHNESS=\\\"clearcoatRoughness\\\",Pe.CLEARCOAT_NORMAL=\\\"clearcoatNormal\\\",Pe.EMISSIVE=\\\"emissive\\\",Pe.ROTATION=\\\"rotation\\\",Pe.SHEEN=\\\"sheen\\\",Pe.SHEEN_ROUGHNESS=\\\"sheenRoughness\\\",Pe.ANISOTROPY=\\\"anisotropy\\\",Pe.IRIDESCENCE=\\\"iridescence\\\",Pe.IRIDESCENCE_IOR=\\\"iridescenceIOR\\\",Pe.IRIDESCENCE_THICKNESS=\\\"iridescenceThickness\\\",Pe.IOR=\\\"ior\\\",Pe.TRANSMISSION=\\\"transmission\\\",Pe.THICKNESS=\\\"thickness\\\",Pe.ATTENUATION_DISTANCE=\\\"attenuationDistance\\\",Pe.ATTENUATION_COLOR=\\\"attenuationColor\\\",Pe.LINE_SCALE=\\\"scale\\\",Pe.LINE_DASH_SIZE=\\\"dashSize\\\",Pe.LINE_GAP_SIZE=\\\"gapSize\\\",Pe.LINE_WIDTH=\\\"linewidth\\\",Pe.LINE_DASH_OFFSET=\\\"dashOffset\\\",Pe.POINT_SIZE=\\\"size\\\",Pe.DISPERSION=\\\"dispersion\\\",Pe.LIGHT_MAP=\\\"light\\\",Pe.AO=\\\"ao\\\";var gR=ze(Pe,Pe.ALPHA_TEST),yR=ze(Pe,Pe.COLOR),xR=ze(Pe,Pe.SHININESS),vR=ze(Pe,Pe.EMISSIVE),CT=ze(Pe,Pe.OPACITY),bR=ze(Pe,Pe.SPECULAR),RT=ze(Pe,Pe.SPECULAR_INTENSITY),TR=ze(Pe,Pe.SPECULAR_COLOR),Fp=ze(Pe,Pe.SPECULAR_STRENGTH),O0=ze(Pe,Pe.REFLECTIVITY),SR=ze(Pe,Pe.ROUGHNESS),_R=ze(Pe,Pe.METALNESS),wR=ze(Pe,Pe.NORMAL),MR=ze(Pe,Pe.CLEARCOAT),NR=ze(Pe,Pe.CLEARCOAT_ROUGHNESS),AR=ze(Pe,Pe.CLEARCOAT_NORMAL),CR=ze(Pe,Pe.ROTATION),RR=ze(Pe,Pe.SHEEN),ER=ze(Pe,Pe.SHEEN_ROUGHNESS),PR=ze(Pe,Pe.ANISOTROPY),BR=ze(Pe,Pe.IRIDESCENCE),IR=ze(Pe,Pe.IRIDESCENCE_IOR),FR=ze(Pe,Pe.IRIDESCENCE_THICKNESS),LR=ze(Pe,Pe.TRANSMISSION),kR=ze(Pe,Pe.THICKNESS),DR=ze(Pe,Pe.IOR),OR=ze(Pe,Pe.ATTENUATION_DISTANCE),UR=ze(Pe,Pe.ATTENUATION_COLOR),ET=ze(Pe,Pe.LINE_SCALE),PT=ze(Pe,Pe.LINE_DASH_SIZE),BT=ze(Pe,Pe.LINE_GAP_SIZE),U0=ze(Pe,Pe.LINE_WIDTH),IT=ze(Pe,Pe.LINE_DASH_OFFSET),zR=ze(Pe,Pe.POINT_SIZE),VR=ze(Pe,Pe.DISPERSION),FT=ze(Pe,Pe.LIGHT_MAP),GR=ze(Pe,Pe.AO),Cd=Qe(new fe).onReference(function(e){return e.material}).onRenderUpdate(function({material:e}){this.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation))}),WR=Q(e=>e.context.setupModelViewProjection(),\\\"vec4\\\").once()().toVarying(\\\"v_modelViewProjection\\\"),qs=class Fh extends Ke{static get type(){return\\\"EventNode\\\"}constructor(t,r){super(\\\"void\\\"),this.eventType=t,this.callback=r,t===Fh.OBJECT?this.updateType=ut.OBJECT:t===Fh.MATERIAL?this.updateType=ut.RENDER:t===Fh.FRAME?this.updateType=ut.FRAME:t===Fh.BEFORE_OBJECT?this.updateBeforeType=ut.OBJECT:t===Fh.BEFORE_MATERIAL?this.updateBeforeType=ut.RENDER:t===Fh.BEFORE_FRAME&&(this.updateBeforeType=ut.FRAME)}update(t){this.callback(t)}updateBefore(t){this.callback(t)}};qs.OBJECT=\\\"object\\\",qs.MATERIAL=\\\"material\\\",qs.FRAME=\\\"frame\\\",qs.BEFORE_OBJECT=\\\"beforeObject\\\",qs.BEFORE_MATERIAL=\\\"beforeMaterial\\\",qs.BEFORE_FRAME=\\\"beforeFrame\\\";var Rd=(e,t)=>new qs(e,t).toStack(),Lp=e=>Rd(qs.OBJECT,e),Cz=e=>Rd(qs.MATERIAL,e),jR=e=>Rd(qs.FRAME,e),Rz=e=>Rd(qs.BEFORE_OBJECT,e),Ez=e=>Rd(qs.BEFORE_MATERIAL,e),Pz=e=>Rd(qs.BEFORE_FRAME,e),Bz=class extends _u{static get type(){return\\\"StorageArrayElementNode\\\"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){let r=this.storageBufferNode.structTypeNode;return r?r.getMemberType(e,t):\\\"void\\\"}setup(e){return e.isAvailable(\\\"storageBuffer\\\")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let r,i=e.isContextAssign();if(e.isAvailable(\\\"storageBuffer\\\")===!1?this.node.isPBO===!0&&i!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!==\\\"compute\\\")?r=e.generatePBO(this):r=this.node.build(e):r=super.generate(e),i!==!0){let s=this.getNodeType(e);r=e.format(r,s,t)}return r}},Iz=Mt(Bz).setParameterLength(2),Fz=class extends sT{static get type(){return\\\"StorageBufferNode\\\"}constructor(e,t=null,r=0){let i,s=null;t&&t.isStructTypeNode?(i=\\\"struct\\\",s=t,(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(r=e.count)):t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(i=WN(e.itemSize),r=e.count):i=t,super(e,i,r),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=Fi.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){let t;if(this.bufferCount===0){let r=e.globalCache.getData(this.value);r===void 0&&(r={node:this},e.globalCache.setData(this.value,r)),t=r.node.id}else t=this.id;return String(t)}getInputType(){return this.value.isIndirectStorageBufferAttribute?\\\"indirectStorageBuffer\\\":\\\"storageBuffer\\\"}element(e){return Iz(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(Fi.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=Jb(this.value),this._varying=pl(this._attribute)),{attribute:this._attribute,varying:this._varying}}generateNodeType(e){if(this.structTypeNode!==null)return this.structTypeNode.getNodeType(e);if(e.isAvailable(\\\"storageBuffer\\\")||e.isAvailable(\\\"indirectStorageBuffer\\\"))return super.generateNodeType(e);let{attribute:t}=this.getAttributeData();return t.getNodeType(e)}getMemberType(e,t){return this.structTypeNode!==null?this.structTypeNode.getMemberType(e,t):\\\"void\\\"}generate(e){if(this.structTypeNode!==null&&this.structTypeNode.build(e),e.isAvailable(\\\"storageBuffer\\\")||e.isAvailable(\\\"indirectStorageBuffer\\\"))return super.generate(e);let{attribute:t,varying:r}=this.getAttributeData(),i=r.build(e);return e.registerTransform(i,t),i}},Sl=(e,t=null,r=0)=>new Fz(e,t,r),LT=new WeakMap,HR=new WeakMap,kT=new WeakMap;function XR(e,t){let r,i=Math.max(t.count,1);if(t.isStorageInstancedBufferAttribute===!0)r=Sl(t,\\\"mat4\\\",i).element(Va);else if(i*16*4\\u003c=e.getUniformBufferLimit())r=Md(t.array,\\\"mat4\\\",i).element(Va);else{let s=LT.get(t);s||(s=new fU(t.array,16,1),LT.set(t,s));let a=t.usage===rp?Qb:T0,n=[a(s,\\\"vec4\\\",16,0),a(s,\\\"vec4\\\",16,4),a(s,\\\"vec4\\\",16,8),a(s,\\\"vec4\\\",16,12)];r=ul(...n)}return r}function Lz(e,t,r){let i=kT.get(e);if(i===void 0){let s=t.clone();i={previousInstanceMatrix:s,node:XR(r,s)},kT.set(e,i)}return i.node}var DT=Nu(\\\"vec3\\\",\\\"vInstanceColor\\\"),$R=Q(([e,t=null],r)=>{let i=e.isStorageInstancedBufferAttribute===!0,s=t&&t.isStorageInstancedBufferAttribute===!0,a=XR(r,e),n=null;i||Math.max(e.count,1)*16*4>r.getUniformBufferLimit()&&(n=LT.get(e));let o=null,l=null;if(t)if(s)o=Sl(t,\\\"vec3\\\",Math.max(t.count,1)).element(Va);else{let h=HR.get(t);h||(h=new ud(t.array,3),HR.set(t,h)),l=h;let d=t.usage===rp?Qb:T0;o=K(d(h,\\\"vec3\\\",3,0))}(n!==null||l!==null)&&jR(()=>{n!==null&&(n.clearUpdateRanges(),n.updateRanges.push(...e.updateRanges),e.version!==n.version&&(n.version=e.version)),t&&l!==null&&(l.clearUpdateRanges(),l.updateRanges.push(...t.updateRanges),t.version!==l.version&&(l.version=t.version))});let u=a.mul(wr).xyz;if(wr.assign(u),r.needsPreviousData()){let h=r.object;Lp(({object:c})=>{kT.get(c).previousInstanceMatrix.array.set(e.array)});let d=Lz(h,e,r);Du.assign(d.mul(Du).xyz)}if(r.hasGeometryAttribute(\\\"normal\\\")){let h=xT(Qi,a);Qi.assign(h)}o!==null&&DT.assign(o)},\\\"void\\\"),qR=Q(([e])=>{let{instanceMatrix:t,instanceColor:r}=e;$R(t,r)},\\\"void\\\"),kz=Q(([e,t])=>{let r=Y(Fu(Gr(e),0).x).toConst(),i=Y(t),s=i.mod(r).toConst(),a=i.div(r).toConst();return Gr(e,Pr(s,a))}),Dz=Q(([e,t])=>{let r=Y(Fu(Gr(e),0).x).toConst(),i=Y(t).mod(r).toConst(),s=Y(t).div(r).toConst();return Gr(e,Pr(i,s)).x}),OT=Nu(\\\"vec4\\\",\\\"vBatchColor\\\"),YR=Q(([e],t)=>{let r=t.getDrawIndex()===null?Va:AC,i=Dz(e._indirectTexture,Y(r)),s=e._matricesTexture,a=Y(Fu(Gr(s),0).x).toConst(),n=D(i).mul(4).toInt().toConst(),o=n.mod(a).toConst(),l=n.div(a).toConst(),u=ul(Gr(s,Pr(o,l)),Gr(s,Pr(o.add(1),l)),Gr(s,Pr(o.add(2),l)),Gr(s,Pr(o.add(3),l))),h=e._colorsTexture;if(h!==null){let g=kz(h,i);OT.assign(g)}let d=Ni(u);wr.assign(u.mul(wr));let c=Qi.div(K(d[0].dot(d[0]),d[1].dot(d[1]),d[2].dot(d[2]))),m=d.mul(c).xyz;Qi.assign(m),t.hasGeometryAttribute(\\\"tangent\\\")&&Tl.mulAssign(d)},\\\"void\\\"),z0=new WeakMap,V0=new WeakMap;function UT(e,t,r,i,s,a){let n=e.element(s.x),o=e.element(s.y),l=e.element(s.z),u=e.element(s.w),h=r.mul(t),d=Yr(n.mul(a.x).mul(h),o.mul(a.y).mul(h),l.mul(a.z).mul(h),u.mul(a.w).mul(h));return i.mul(d).xyz}function ZR(e,t,r,i,s,a,n){let o=e.element(a.x),l=e.element(a.y),u=e.element(a.z),h=e.element(a.w),d=Yr(n.x.mul(o),n.y.mul(l),n.z.mul(u),n.w.mul(h));d=s.mul(d).mul(i);let c=d.transformDirection(t).xyz,m=d.transformDirection(r).xyz;return{skinNormal:c,skinTangent:m}}function JR(e,t,r,i,s){let a=e.skeleton,n=V0.get(a);if(n===void 0){a.update();let o=new Float32Array(a.boneMatrices);n={previousBoneMatrices:o,node:Md(o,\\\"mat4\\\",a.bones.length)},V0.set(a,n)}return UT(n.node,Du,t,r,i,s)}var QR=Q(([e],t)=>{let r=$s(\\\"skinIndex\\\",\\\"uvec4\\\"),i=$s(\\\"skinWeight\\\",\\\"vec4\\\"),s=cr(\\\"bindMatrix\\\",\\\"mat4\\\"),a=cr(\\\"bindMatrixInverse\\\",\\\"mat4\\\"),n=tR(\\\"skeleton.boneMatrices\\\",\\\"mat4\\\",e.skeleton.bones.length);if(Lp(({object:l,frameId:u})=>{let h=l.skeleton;if(z0.get(h)!==u){z0.set(h,u);let d=V0.get(h);d!==void 0&&d.previousBoneMatrices.set(h.boneMatrices),h.update()}}),t.needsPreviousData()){let l=JR(e,s,a,r,i);Du.assign(l)}let o=UT(n,wr,s,a,r,i);if(wr.assign(o),t.hasGeometryAttribute(\\\"normal\\\")){let{skinNormal:l,skinTangent:u}=ZR(n,Qi,Tl,s,a,r,i);Qi.assign(l),t.hasGeometryAttribute(\\\"tangent\\\")&&Tl.assign(u)}},\\\"void\\\"),Oz=Q(([e,t=null],r)=>{let i=Sl(new ud(e.geometry.getAttribute(\\\"position\\\").array,3),\\\"vec3\\\").setPBO(!0).toReadOnly().element(Va).toVar(),s=Sl(new ud(new Uint32Array(e.geometry.getAttribute(\\\"skinIndex\\\").array),4),\\\"uvec4\\\").setPBO(!0).toReadOnly().element(Va).toVar(),a=Sl(new ud(e.geometry.getAttribute(\\\"skinWeight\\\").array,4),\\\"vec4\\\").setPBO(!0).toReadOnly().element(Va).toVar(),n=Qe(e.bindMatrix,\\\"mat4\\\"),o=Qe(e.bindMatrixInverse,\\\"mat4\\\"),l=Md(e.skeleton.boneMatrices,\\\"mat4\\\",e.skeleton.bones.length),u=e.skeleton;if(Lp(({frameId:d})=>{if(z0.get(u)!==d){z0.set(u,d);let c=V0.get(u);c!==void 0&&c.previousBoneMatrices.set(u.boneMatrices),u.update()}}),r.needsPreviousData()){let d=JR(e,n,o,s,a);Du.assign(d)}let h=UT(l,i,n,o,s,a);if(t!==null&&t.assign(h),r.hasGeometryAttribute(\\\"normal\\\")){let{skinNormal:d,skinTangent:c}=ZR(l,Qi,Tl,n,o,s,a);Qi.assign(d),r.hasGeometryAttribute(\\\"tangent\\\")&&Tl.assign(c)}return h}),Uz=class extends Ke{static get type(){return\\\"LoopNode\\\"}constructor(e=[]){super(\\\"void\\\"),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){let t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;let r={};for(let n=0,o=this.params.length-1;n\\u003co;n++){let l=this.params[n],u=l.isNode!==!0&&l.name||this.getVarName(n),h=l.isNode!==!0&&l.type||\\\"int\\\";r[u]=Xs(u,h)}let i=e.addStack(),s=this.params[this.params.length-1](r);t.returnsNode=s.context({nodeLoop:s}),t.stackNode=i;let a=this.params[0];if(a.isNode!==!0&&typeof a.update==\\\"function\\\"){let n=Q(this.params[0].update)(r);t.updateNode=n.context({nodeLoop:n})}return e.removeStack(),t}setup(e){if(this.getProperties(e),e.fnCall){let t=e.getDataFromNode(e.fnCall.shaderNode);t.hasLoop=!0}}generate(e){let t=this.getProperties(e),r=this.params,i=t.stackNode;for(let a=0,n=r.length-1;a\\u003cn;a++){let o=r[a],l=!1,u=null,h=null,d=null,c=null,m=null,g=null;o.isNode?o.getNodeType(e)===\\\"bool\\\"?(l=!0,c=\\\"bool\\\",h=o.build(e,c)):(c=\\\"int\\\",d=this.getVarName(a),u=\\\"0\\\",h=o.build(e,c),m=\\\"\\u003c\\\"):(c=o.type||\\\"int\\\",d=o.name||this.getVarName(a),u=o.start,h=o.end,m=o.condition,g=o.update,typeof u==\\\"number\\\"?u=e.generateConst(c,u):u&&u.isNode&&(u=u.build(e,c)),typeof h==\\\"number\\\"?h=e.generateConst(c,h):h&&h.isNode&&(h=h.build(e,c)),u!==void 0&&h===void 0?(u=u+\\\" - 1\\\",h=\\\"0\\\",m=\\\">=\\\"):h!==void 0&&u===void 0&&(u=\\\"0\\\",m=\\\"\\u003c\\\"),m===void 0&&(Number(u)>Number(h)?m=\\\">=\\\":m=\\\"\\u003c\\\"));let y;if(l)y=`while ( ${h} )`;else{let b={start:u,end:h},v=b.start,S=b.end,T,w=()=>m.includes(\\\"\\u003c\\\")?\\\"+=\\\":\\\"-=\\\";if(g!=null)switch(typeof g){case\\\"function\\\":T=e.flowStagesNode(t.updateNode,\\\"void\\\").code.replace(/\\\\t|;/g,\\\"\\\");break;case\\\"number\\\":T=d+\\\" \\\"+w()+\\\" \\\"+e.generateConst(c,g);break;case\\\"string\\\":T=d+\\\" \\\"+g;break;default:g.isNode?T=d+\\\" \\\"+w()+\\\" \\\"+g.build(e):(Ce(\\\"TSL: 'Loop( { update: ... } )' is not a function, string or number.\\\",this.stackTrace),T=\\\"break /* invalid update */\\\")}else c===\\\"int\\\"||c===\\\"uint\\\"?g=m.includes(\\\"\\u003c\\\")?\\\"++\\\":\\\"--\\\":g=w()+\\\" 1.\\\",T=d+\\\" \\\"+g;let N=e.getVar(c,d)+\\\" = \\\"+v,C=d+\\\" \\\"+m+\\\" \\\"+S;y=`for ( ${N}; ${C}; ${T} )`}e.addFlowCode((a===0?`\\n`:\\\"\\\")+e.tab+y+` {\\n\\n`).addFlowTab()}let s=i.build(e,\\\"void\\\");t.returnsNode.build(e,\\\"void\\\"),e.removeFlowTab().addFlowCode(`\\n`+e.tab+s);for(let a=0,n=this.params.length-1;a\\u003cn;a++)e.addFlowCode((a===0?\\\"\\\":e.tab)+`}\\n\\n`).removeFlowTab();e.addFlowTab()}},Qt=(...e)=>new Uz(wu(e,\\\"int\\\")).toStack(),zz=()=>Xs(\\\"continue\\\").toStack(),KR=()=>Xs(\\\"break\\\").toStack(),zT=new WeakMap,Ys=new Wt,eE=new WeakMap,tE=Q(({bufferMap:e,influence:t,stride:r,width:i,depth:s,offset:a})=>{let n=Y(NC).mul(r).add(a),o=n.div(i),l=n.sub(o.mul(i));return Gr(e,Pr(l,o)).depth(s).xyz.mul(t)});function Vz(e){let t=e.morphAttributes.position!==void 0,r=e.morphAttributes.normal!==void 0,i=e.morphAttributes.color!==void 0,s=e.morphAttributes.position||e.morphAttributes.normal||e.morphAttributes.color,a=s!==void 0?s.length:0,n=zT.get(e);if(n===void 0||n.count!==a){let o=function(){b.dispose(),zT.delete(e),e.removeEventListener(\\\"dispose\\\",o)};n!==void 0&&n.texture.dispose();let l=e.morphAttributes.position||[],u=e.morphAttributes.normal||[],h=e.morphAttributes.color||[],d=0;t===!0&&(d=1),r===!0&&(d=2),i===!0&&(d=3);let c=e.attributes.position.count*d,m=1,g=4096;c>g&&(m=Math.ceil(c/g),c=g);let y=new Float32Array(c*m*4*a),b=new b4(y,c,m,a);b.type=Er,b.needsUpdate=!0;let v=d*4;for(let S=0;S\\u003ca;S++){let T=l[S],w=u[S],N=h[S],C=c*m*4*S;for(let R=0;R\\u003cT.count;R++){let E=R*v;t===!0&&(Ys.fromBufferAttribute(T,R),y[C+E+0]=Ys.x,y[C+E+1]=Ys.y,y[C+E+2]=Ys.z,y[C+E+3]=0),r===!0&&(Ys.fromBufferAttribute(w,R),y[C+E+4]=Ys.x,y[C+E+5]=Ys.y,y[C+E+6]=Ys.z,y[C+E+7]=0),i===!0&&(Ys.fromBufferAttribute(N,R),y[C+E+8]=Ys.x,y[C+E+9]=Ys.y,y[C+E+10]=Ys.z,y[C+E+11]=N.itemSize===4?Ys.w:1)}}n={count:a,texture:b,stride:d,size:new fe(c,m)},zT.set(e,n),e.addEventListener(\\\"dispose\\\",o)}return n}var rE=Q(([e])=>{let{geometry:t}=e,r=t.morphAttributes.position!==void 0,i=t.hasAttribute(\\\"normal\\\")&&t.morphAttributes.normal!==void 0,s=t.morphAttributes.position||t.morphAttributes.normal||t.morphAttributes.color,a=s!==void 0?s.length:0;if(a===0)return;let n=eE.get(e);(n===void 0||n.count!==a)&&(n={base:Qe(1),influences:e.morphTargetInfluences?Li(e.morphTargetInfluences,\\\"float\\\"):null,count:a},eE.set(e,n));let{base:o,influences:l}=n,{texture:u,stride:h,size:d}=Vz(t);r===!0&&wr.mulAssign(o),i===!0&&Qi.mulAssign(o);let c=Y(d.width);Qt(a,({i:m})=>{let g=D(0).toVar();e.count>1&&e.morphTexture!==null&&e.morphTexture!==void 0?g.assign(Gr(e.morphTexture,Pr(Y(m).add(1),Y(Va))).r):g.assign(l.element(m).toVar()),et(g.notEqual(0),()=>{r===!0&&wr.addAssign(tE({bufferMap:u,influence:g,stride:h,width:c,depth:m,offset:Y(0)})),i===!0&&Qi.addAssign(tE({bufferMap:u,influence:g,stride:h,width:c,depth:m,offset:Y(1)}))})}),Lp(({object:m})=>{let{base:g,influences:y}=n;m.geometry.morphTargetsRelative?g.value=1:g.value=1-m.morphTargetInfluences.reduce((b,v)=>b+v,0),y&&(y.array=m.morphTargetInfluences,y.update())})},\\\"void\\\"),Ed=class extends Ke{static get type(){return\\\"LightingNode\\\"}constructor(){super(\\\"vec3\\\"),this.isLightingNode=!0}},Gz=class extends Ed{static get type(){return\\\"AONode\\\"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}},Wz=class extends Xb{static get type(){return\\\"LightingContextNode\\\"}constructor(e,t=null,r=[],i=null,s=null){super(e),this.lightingModel=t,this.materialLightings=r,this.backdropNode=i,this.backdropAlphaNode=s,this._value=null}getContext(){let{materialLightings:e,backdropNode:t,backdropAlphaNode:r}=this,i=K().toVar(\\\"directDiffuse\\\"),s=K().toVar(\\\"directSpecular\\\"),a=K().toVar(\\\"indirectDiffuse\\\"),n=K().toVar(\\\"indirectSpecular\\\"),o={directDiffuse:i,directSpecular:s,indirectDiffuse:a,indirectSpecular:n};return{radiance:K().toVar(\\\"radiance\\\"),irradiance:K().toVar(\\\"irradiance\\\"),iblIrradiance:K().toVar(\\\"iblIrradiance\\\"),ambientOcclusion:D(1).toVar(\\\"ambientOcclusion\\\"),reflectedLight:o,materialLightings:e,backdrop:t,backdropAlpha:r}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}},iE=Mt(Wz),jz=class extends Ed{static get type(){return\\\"IrradianceNode\\\"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}},zu=new fe,G0=class extends An{static get type(){return\\\"ViewportTextureNode\\\"}constructor(e=Ga,t=null,r=null){let i=null;r===null?(i=new Gv,i.minFilter=Ia,r=i):i=r,super(r,e,t),this.generateMipmaps=!1,this.defaultFramebuffer=i,this.isOutputTextureNode=!0,this.updateBeforeType=ut.RENDER,this._cacheTextures=new WeakMap}getTextureForReference(e=null){let t,r;if(this.referenceNode?(t=this.referenceNode.defaultFramebuffer,r=this.referenceNode._cacheTextures):(t=this.defaultFramebuffer,r=this._cacheTextures),e===null)return t;if(r.has(e)===!1){let i=t.clone();r.set(e,i)}return r.get(e)}updateReference(e){let t=e.renderer,r=t.getRenderTarget(),i=t.getCanvasTarget(),s=r||i;return this.value=this.getTextureForReference(s),this.value}updateBefore(e){let t=e.renderer,r=t.getRenderTarget(),i=t.getCanvasTarget(),s=r||i;s===null?t.getDrawingBufferSize(zu):s.getDrawingBufferSize?s.getDrawingBufferSize(zu):zu.set(s.width,s.height);let a=this.getTextureForReference(s);(a.image.width!==zu.width||a.image.height!==zu.height)&&(a.image.width=zu.width,a.image.height=zu.height,a.needsUpdate=!0);let n=a.generateMipmaps;a.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(a),a.generateMipmaps=n}clone(){let e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}},Hz=Mt(G0).setParameterLength(0,3),VT=Mt(G0,null,null,{generateMipmaps:!0}).setParameterLength(0,3),Xz=VT(),sE=(e=Ga,t=null)=>Xz.sample(e,t),GT=null,$z=class extends G0{static get type(){return\\\"ViewportDepthTextureNode\\\"}constructor(e=Ga,t=null,r=null){r===null&&(GT===null&&(GT=new fs),r=GT),super(e,t,r)}},WT=Mt($z).setParameterLength(0,3),So=class Mf extends Ke{static get type(){return\\\"ViewportDepthNode\\\"}constructor(t,r=null){super(\\\"float\\\"),this.scope=t,this.valueNode=r,this.isViewportDepthNode=!0}generate(t){let{scope:r}=this;return r===Mf.DEPTH_BASE?t.getFragDepth():super.generate(t)}setup({camera:t}){let{scope:r}=this,i=this.valueNode,s=null;if(r===Mf.DEPTH_BASE)i!==null&&(s=oE().assign(i));else if(r===Mf.DEPTH)t.isPerspectiveCamera?s=jT(Wr.z,gl,yl):s=Vu(Wr.z,gl,yl);else if(r===Mf.LINEAR_DEPTH)if(i!==null)if(t.isPerspectiveCamera){let a=W0(i,gl,yl);s=Vu(a,gl,yl)}else s=i;else s=Vu(Wr.z,gl,yl);return s}};So.DEPTH_BASE=\\\"depthBase\\\",So.DEPTH=\\\"depth\\\",So.LINEAR_DEPTH=\\\"linearDepth\\\";var Vu=(e,t,r)=>e.add(t).div(t.sub(r)),qz=(e,t,r)=>e.add(r).div(r.sub(t)),aE=Q(([e,t,r],i)=>i.renderer.reversedDepthBuffer===!0?r.sub(t).mul(e).sub(r):t.sub(r).mul(e).sub(t)),jT=(e,t,r)=>t.add(e).mul(r).div(r.sub(t).mul(e)),nE=(e,t,r)=>t.mul(e.add(r)).div(e.mul(t.sub(r))),W0=Q(([e,t,r],i)=>i.renderer.reversedDepthBuffer===!0?t.mul(r).div(t.sub(r).mul(e).sub(t)):t.mul(r).div(r.sub(t).mul(e).sub(r))),j0=(e,t,r)=>{t=t.max(1e-6).toVar();let i=wn(e.negate().div(t)),s=wn(r.div(t));return i.div(s)},Yz=(e,t,r)=>{let i=e.mul(f0(r.div(t)));return D(Math.E).pow(i).mul(t).negate()},oE=Mt(So,So.DEPTH_BASE),HT=ze(So,So.DEPTH),H0=Mt(So,So.LINEAR_DEPTH).setParameterLength(0,1),Zz=H0(WT());HT.assign=e=>oE(e);var _l=class Jx extends Ke{static get type(){return\\\"ClippingNode\\\"}constructor(t=Jx.DEFAULT){super(),this.scope=t}setup(t){super.setup(t);let r=t.clippingContext,{intersectionPlanes:i,unionPlanes:s}=r;return this.hardwareClipping=t.hardwareClipping,this.scope===Jx.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(i,s):this.scope===Jx.HARDWARE?this.setupHardwareClipping(s,t):this.setupDefault(i,s)}setupAlphaToCoverage(t,r){return Q(()=>{let i=D().toVar(\\\"distanceToPlane\\\"),s=D().toVar(\\\"distanceToGradient\\\"),a=D(1).toVar(\\\"clipOpacity\\\"),n=r.length;if(this.hardwareClipping===!1&&n>0){let l=Li(r).setGroup(st);Qt(n,({i:u})=>{let h=l.element(u);i.assign(Wr.dot(h.xyz).negate().add(h.w)),s.assign(i.fwidth().div(2)),a.mulAssign(Hs(s.negate(),s,i))})}let o=t.length;if(o>0){let l=Li(t).setGroup(st),u=D(1).toVar(\\\"intersectionClipOpacity\\\");Qt(o,({i:h})=>{let d=l.element(h);i.assign(Wr.dot(d.xyz).negate().add(d.w)),s.assign(i.fwidth().div(2)),u.mulAssign(Hs(s.negate(),s,i).oneMinus())}),a.mulAssign(u.oneMinus())}Zt.a.mulAssign(a),Zt.a.equal(0).discard()})()}setupDefault(t,r){return Q(()=>{let i=r.length;if(this.hardwareClipping===!1&&i>0){let a=Li(r).setGroup(st);Qt(i,({i:n})=>{let o=a.element(n);Wr.dot(o.xyz).greaterThan(o.w).discard()})}let s=t.length;if(s>0){let a=Li(t).setGroup(st),n=Gs(!0).toVar(\\\"clipped\\\");Qt(s,({i:o})=>{let l=a.element(o);n.assign(Wr.dot(l.xyz).greaterThan(l.w).and(n))}),n.discard()}})()}setupHardwareClipping(t,r){let i=t.length;return r.enableHardwareClipping(i),Q(()=>{let s=Li(t).setGroup(st),a=bo(r.getClipDistance());Qt(i,({i:n})=>{let o=s.element(n),l=Wr.dot(o.xyz).sub(o.w).negate();a.element(n).assign(l)})})()}};_l.ALPHA_TO_COVERAGE=\\\"alphaToCoverage\\\",_l.DEFAULT=\\\"default\\\",_l.HARDWARE=\\\"hardware\\\";var Jz=()=>new _l,Qz=()=>new _l(_l.ALPHA_TO_COVERAGE),Kz=()=>new _l(_l.HARDWARE),eV=.05,lE=Q(([e])=>Oa(mt(1e4,xs(mt(17,e.x).add(mt(.1,e.y)))).mul(Yr(.1,ur(xs(mt(13,e.y).add(e.x))))))),uE=Q(([e])=>lE(ke(lE(e.xy),e.z))),tV=Q(([e])=>{let t=Br(Nn(Db(e.xyz)),Nn(Ob(e.xyz))),r=D(1).div(D(eV).mul(t)).toVar(\\\"pixScale\\\"),i=ke(_d(Mn(wn(r))),_d(g0(wn(r)))),s=ke(uE(Mn(i.x.mul(e.xyz))),uE(Mn(i.y.mul(e.xyz)))),a=Oa(wn(r)),n=Yr(mt(a.oneMinus(),s.x),mt(a,s.y)),o=Rs(a,a.oneMinus()),l=K(n.mul(n).div(mt(2,o).mul(It(1,o))),n.sub(mt(.5,o)).div(It(1,o)),It(1,It(1,n).mul(It(1,n)).div(mt(2,o).mul(It(1,o))))),u=n.lessThan(o.oneMinus()).select(n.lessThan(o).select(l.x,l.y),l.z);return za(u,1e-6,1)}).setLayout({name:\\\"getAlphaHashThreshold\\\",type:\\\"float\\\",inputs:[{name:\\\"position\\\",type:\\\"vec3\\\"}]}),rV=class extends DC{static get type(){return\\\"VertexColorNode\\\"}constructor(e){super(null,\\\"vec4\\\"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){let e=this.index;return\\\"color\\\"+(e>0?e:\\\"\\\")}generate(e){let t=this.getAttributeName(e),r=e.hasGeometryAttribute(t),i;return r===!0?i=super.generate(e):i=e.generateConst(this.nodeType,new Wt(1,1,1,1)),i}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}},hE=(e=0)=>new rV(e),Pt=class extends Vs{static get type(){return\\\"NodeMaterial\\\"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.maskNode=null,this.maskShadowNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.receivedShadowPositionNode=null,this.castShadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null,this.contextNode=null}_getNodeChildren(){let e=[];for(let t of Object.getOwnPropertyNames(this)){if(t.startsWith(\\\"_\\\")===!0)continue;let r=this[t];r&&r.isNode===!0&&e.push({property:t,childNode:r})}return e}customProgramCacheKey(){let e=[];for(let{property:t,childNode:r}of this._getNodeChildren())e.push(yd(t.slice(0,-4)),r.getCacheKey());return this.type+Sp(e)}build(e){this.setup(e)}setupObserver(e){return new SU(e)}setup(e){e.context.setupNormal=()=>Iu(this.setupNormal(e),\\\"NORMAL\\\",\\\"vec3\\\"),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);let t=e.renderer,r=t.getRenderTarget();e.addStack();let i=this.setupVertex(e),s=Iu(this.vertexNode||i,\\\"VERTEX\\\");e.context.clipSpace=s,e.stack.outputNode=s,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow(\\\"vertex\\\",e.removeStack()),e.addStack();let a,n=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(r!==null?r.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupAmbientOcclusion(e),this.setupVariants(e);let o=this.setupLighting(e);n!==null&&e.stack.addToStack(n);let l=Ve(o,Zt.a).max(0);a=this.setupOutput(e,l),Sd.assign(a);let u=this.outputNode!==null;if(u&&(a=this.outputNode),e.context.getOutput&&(a=e.context.getOutput(a,e)),r!==null){let h=t.getMRT(),d=this.mrtNode;h!==null?(u&&Sd.assign(a),a=h,d!==null&&(a=h.merge(d))):d!==null&&(a=d)}}else{let o=this.fragmentNode;o.isOutputStructNode!==!0&&(o=o.convert(e.getOutputType())),a=this.setupOutput(e,o)}e.stack.outputNode=a,e.addFlow(\\\"fragment\\\",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;let{unionPlanes:t,intersectionPlanes:r}=e.clippingContext,i=null;if(t.length>0||r.length>0){let s=e.renderer.currentSamples;this.alphaToCoverage&&s>1?i=Qz():e.stack.addToStack(Jz())}return i}setupHardwareClipping(e){if(e.hardwareClipping=!1,e.clippingContext===null)return;let t=e.clippingContext.unionPlanes.length;t>0&&t\\u003c=8&&e.isAvailable(\\\"clipDistance\\\")&&(e.stack.addToStack(Kz()),e.hardwareClipping=!0)}setupDepth(e){let{renderer:t,camera:r}=e,i=this.depthNode;if(i===null){let s=t.getMRT();s&&s.has(\\\"depth\\\")?i=s.get(\\\"depth\\\"):t.logarithmicDepthBuffer===!0&&(r.isPerspectiveCamera?i=j0(Wr.z,gl,yl):i=Vu(Wr.z,gl,yl))}i!==null&&HT.assign(i).toStack()}setupPositionView(){return Cn.mul(wr).xyz}setupModelViewProjection(){return bs.mul(Wr)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.position=e.removeStack(),WR}setupPosition(e){let{object:t,geometry:r}=e;if((r.morphAttributes.position||r.morphAttributes.normal||r.morphAttributes.color)&&rE(t),t.isSkinnedMesh===!0&&QR(t),this.displacementMap){let i=To(\\\"displacementMap\\\",\\\"texture\\\"),s=To(\\\"displacementScale\\\",\\\"float\\\"),a=To(\\\"displacementBias\\\",\\\"float\\\");wr.addAssign(Qi.normalize().mul(i.x.mul(s).add(a)))}return t.isBatchedMesh&&YR(t),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&qR(t),this.positionNode!==null&&wr.assign(Iu(this.positionNode,\\\"POSITION\\\",\\\"vec3\\\")),wr}setupDiffuseColor(e){let{object:t,geometry:r}=e;this.maskNode!==null&&Gs(this.maskNode).not().discard();let i=this.colorNode?Ve(this.colorNode):yR;this.vertexColors===!0&&r.hasAttribute(\\\"color\\\")&&(i=i.mul(hE())),t.instanceColor&&(i=DT.mul(i)),t.isBatchedMesh&&t._colorsTexture&&(i=OT.mul(i)),Zt.assign(i);let s=this.opacityNode?D(this.opacityNode):CT;Zt.a.assign(Zt.a.mul(s));let a=null;(this.alphaTestNode!==null||this.alphaTest>0)&&(a=this.alphaTestNode!==null?D(this.alphaTestNode):gR,this.alphaToCoverage===!0?(Zt.a=Hs(a,a.add(zb(Zt.a)),Zt.a),Zt.a.lessThanEqual(0).discard()):Zt.a.lessThanEqual(a).discard()),this.alphaHash===!0&&Zt.a.lessThan(tV(wr)).discard(),e.isOpaque()&&Zt.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?K(0):Zt.rgb}setupNormal(){return this.normalNode?K(this.normalNode):wR}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?To(\\\"envMap\\\",\\\"cubeTexture\\\"):To(\\\"envMap\\\",\\\"texture\\\")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new jz(FT)),t}setupMaterialLightings(e){let t=[];if(e.renderer.lighting.enabled===!1)return t;let r=this.setupEnvironment(e);r&&r.isLightingNode&&t.push(r);let i=this.setupLightMap(e);return i&&i.isLightingNode&&t.push(i),e.context.ambientOcclusion&&t.push(new Gz(e.context.ambientOcclusion)),t}setupAmbientOcclusion(e){let t=this.aoNode;t===null&&e.material.aoMap&&(t=GR),e.context.getAO&&(t=e.context.getAO(t,e)),t!==null&&(Rb.assign(t),e.context.ambientOcclusion=Rb)}setupLightingModel(){}setupLighting(e){let{material:t}=e,{backdropNode:r,backdropAlphaNode:i,emissiveNode:s}=this,a=this.lights===!0||this.lightsNode!==null,n=this.lights===!0?this.setupMaterialLightings(e):[],o=a?this.lightsNode||e.lightsNode:null,l=this.setupOutgoingLight(e);if(o&&(n.length>0||o.getScope().hasLights)){let u=this.setupLightingModel(e)||null;l=iE(o,u,n,r,i)}else r!==null&&(l=K(i!==null?Ct(l,r,i):r));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(wb.assign(K(s||vR)),l=l.add(wb)),l}setupFog(e,t){let r=e.fogNode;return r&&(Sd.assign(t),t=Ve(r.toVar())),t}setupPremultipliedAlpha(e,t){return tT(t)}setupOutput(e,t){return this.fog===!0&&(t=this.setupFog(e,t)),this.premultipliedAlpha===!0&&(t=this.setupPremultipliedAlpha(e,t)),t}setDefaultValues(e){for(let r in e){let i=e[r];this[r]===void 0&&(this[r]=i,i&&i.clone&&(this[r]=i.clone()))}let t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(let r in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,r)===void 0&&t[r].get!==void 0&&Object.defineProperty(this.constructor.prototype,r,t[r])}toJSON(e){let t=e===void 0||typeof e==\\\"string\\\";t&&(e={textures:{},images:{},nodes:{}});let r=Vs.prototype.toJSON.call(this,e);r.inputNodes={};for(let{property:s,childNode:a}of this._getNodeChildren())r.inputNodes[s]=a.toJSON(e).uuid;function i(s){let a=[];for(let n in s){let o=s[n];delete o.metadata,a.push(o)}return a}if(t){let s=i(e.textures),a=i(e.images),n=i(e.nodes);s.length>0&&(r.textures=s),a.length>0&&(r.images=a),n.length>0&&(r.nodes=n)}return r}copy(e){let t=Object.getOwnPropertyDescriptors(this.constructor.prototype);for(let r in t)if(t[r].set!==void 0&&e[r]!==void 0){let i=e[r];this[r]&&this[r].copy!==void 0?this[r].copy(i):this[r]=i}for(let r in this)if(!/^(?:is[A-Z]|_)|^(?:id|uuid|version|type|userData|clippingPlanes)$/.test(r)&&this[r]!==void 0&&e[r]!==void 0){let i=e[r];this[r]&&this[r].copy!==void 0?this[r].copy(i):this[r]=i}return this.clippingPlanes=e.clippingPlanes?e.clippingPlanes.map(r=>r.clone()):null,this.userData=JSON.parse(JSON.stringify(e.userData)),this}},iV=new hN,sV=class extends Pt{static get type(){return\\\"LineBasicNodeMaterial\\\"}constructor(e){super(),this.isLineBasicNodeMaterial=!0,this.setDefaultValues(iV),this.setValues(e)}},aV=new LO,nV=class extends Pt{static get type(){return\\\"LineDashedNodeMaterial\\\"}constructor(e){super(),this.isLineDashedNodeMaterial=!0,this.setDefaultValues(aV),this.dashOffset=0,this.offsetNode=null,this.dashScaleNode=null,this.dashSizeNode=null,this.gapSizeNode=null,this.setValues(e)}setupVariants(){let e=this.offsetNode?D(this.offsetNode):IT,t=this.dashScaleNode?D(this.dashScaleNode):ET,r=this.dashSizeNode?D(this.dashSizeNode):PT,i=this.gapSizeNode?D(this.gapSizeNode):BT;Pu.assign(r),Cp.assign(i);let s=pl($s(\\\"lineDistance\\\").mul(t));(e?s.add(e):s).mod(Pu.add(Cp)).greaterThan(Pu).discard()}},X0=Nu(\\\"vec3\\\",\\\"worldStart\\\"),XT=Nu(\\\"vec3\\\",\\\"worldEnd\\\"),dE=Nu(\\\"float\\\",\\\"lineDistance\\\"),Gu=Nu(\\\"vec4\\\",\\\"worldPos\\\"),cE=Q(({start:e,end:t})=>{let r=bs.element(2).element(2),i=bs.element(3).element(2);return r.greaterThan(0).select(i.negate().div(r.add(1)),i.mul(-.5).div(r)).sub(e.z).div(t.z.sub(e.z))},{start:\\\"vec4\\\",end:\\\"vec4\\\",return:\\\"float\\\"}),oV=Q(({p1:e,p2:t,p3:r,p4:i})=>{let s=e.sub(r),a=i.sub(r),n=t.sub(e),o=s.dot(a),l=a.dot(n),u=s.dot(n),h=a.dot(a),d=n.dot(n).mul(h).sub(l.mul(l)),c=o.mul(l).sub(u.mul(h)).div(d).clamp(),m=o.add(l.mul(c)).div(h).clamp();return ke(c,m)},{p1:\\\"vec3\\\",p2:\\\"vec3\\\",p3:\\\"vec3\\\",p4:\\\"vec3\\\",return:\\\"vec2\\\"}),w0e=Q(({material:e})=>{let t=e._useDash,r=e._useWorldUnits,i=$s(\\\"instanceStart\\\"),s=$s(\\\"instanceEnd\\\"),a=Ve(Cn.mul(Ve(i,1))).toVar(\\\"start\\\"),n=Ve(Cn.mul(Ve(s,1))).toVar(\\\"end\\\"),o,l;t&&(o=D($s(\\\"instanceDistanceStart\\\")).toVar(\\\"distanceStart\\\"),l=D($s(\\\"instanceDistanceEnd\\\")).toVar(\\\"distanceEnd\\\")),r&&(X0.assign(a.xyz),XT.assign(n.xyz));let u=Nd.z.div(Nd.w),h=bs.element(2).element(3).equal(-1);if(et(h,()=>{et(a.z.lessThan(0).and(n.z.greaterThan(0)),()=>{let v=cE({start:a,end:n});n.assign(Ve(Ct(a.xyz,n.xyz,v),n.w)),t&&l.assign(Ct(o,l,v))}).ElseIf(n.z.lessThan(0).and(a.z.greaterThanEqual(0)),()=>{let v=cE({start:n,end:a});a.assign(Ve(Ct(n.xyz,a.xyz,v),a.w)),t&&o.assign(Ct(l,o,v))})}),t){let v=e.dashScaleNode?D(e.dashScaleNode):ET,S=e.offsetNode?D(e.offsetNode):IT,T=Ji.y.lessThan(.5).select(v.mul(o),v.mul(l));T=T.add(S),dE.assign(T)}let d=bs.mul(a),c=bs.mul(n),m=d.xyz.div(d.w),g=c.xyz.div(c.w),y=g.xy.sub(m.xy).toVar();y.x.assign(y.x.mul(u)),y.assign(y.normalize());let b=Ve().toVar();if(r){let v=n.xyz.sub(a.xyz).normalize(),S=Ct(a.xyz,n.xyz,.5).normalize(),T=v.cross(S).normalize(),w=v.cross(T);Gu.assign(Ji.y.lessThan(.5).select(a,n));let N=U0.mul(.5);Gu.addAssign(Ve(Ji.x.lessThan(0).select(T.mul(N),T.mul(N).negate()),0)),t||(Gu.addAssign(Ve(Ji.y.lessThan(.5).select(v.mul(N).negate(),v.mul(N)),0)),Gu.addAssign(Ve(w.mul(N),0)),et(Ji.y.greaterThan(1).or(Ji.y.lessThan(0)),()=>{Gu.subAssign(Ve(w.mul(2).mul(N),0))})),b.assign(bs.mul(Gu));let C=K().toVar();C.assign(Ji.y.lessThan(.5).select(m,g)),b.z.assign(C.z.mul(b.w))}else{let v=ke(y.y,y.x.negate()).toVar(\\\"offset\\\");y.x.assign(y.x.div(u)),v.x.assign(v.x.div(u)),v.assign(Ji.x.lessThan(0).select(v.negate(),v)),et(Ji.y.lessThan(0),()=>{v.assign(v.sub(y))}).ElseIf(Ji.y.greaterThan(1),()=>{v.assign(v.add(y))}),v.assign(v.mul(U0)),v.assign(v.div(Nd.w.div(aT))),b.assign(Ji.y.lessThan(.5).select(d,c)),v.assign(v.mul(b.w)),b.assign(b.add(Ve(v,0,0)))}return b})(),M0e=Q(({material:e,renderer:t})=>{let r=e._useAlphaToCoverage,i=e._useDash,s=e._useWorldUnits,a=Jt();if(i){let o=e.dashSizeNode?D(e.dashSizeNode):PT,l=e.gapSizeNode?D(e.gapSizeNode):BT;Pu.assign(o),Cp.assign(l),a.y.lessThan(-1).or(a.y.greaterThan(1)).discard(),dE.mod(Pu.add(Cp)).greaterThan(Pu).discard()}let n=D(1).toVar(\\\"alpha\\\");if(s){let o=Gu.xyz.normalize().mul(1e5),l=XT.sub(X0),u=oV({p1:X0,p2:XT,p3:K(0,0,0),p4:o}),h=X0.add(l.mul(u.x)),d=o.mul(u.y),c=h.sub(d).length().div(U0);if(!i)if(r&&t.currentSamples>0){let m=c.fwidth();n.assign(Hs(m.negate().add(.5),m.add(.5),c).oneMinus())}else c.greaterThan(.5).discard()}else if(r&&t.currentSamples>0){let o=a.x,l=a.y.greaterThan(0).select(a.y.sub(1),a.y.add(1)),u=o.mul(o).add(l.mul(l)),h=D(u.fwidth()).toVar(\\\"dlen\\\");et(a.y.abs().greaterThan(1),()=>{n.assign(Hs(h.oneMinus(),h.add(1),u).oneMinus())})}else et(a.y.abs().greaterThan(1),()=>{let o=a.x,l=a.y.greaterThan(0).select(a.y.sub(1),a.y.add(1));o.mul(o).add(l.mul(l)).greaterThan(1).discard()});return n})(),lV=new BO,uV=class extends Pt{static get type(){return\\\"MeshNormalNodeMaterial\\\"}constructor(e){super(),this.isMeshNormalNodeMaterial=!0,this.setDefaultValues(lV),this.setValues(e)}setupDiffuseColor(){let e=this.opacityNode?D(this.opacityNode):CT;Zt.assign(v0(Ve(wT(Ut),e),ds))}},$T=Q(([e=gT])=>{let t=e.z.atan(e.x).mul(1/(Math.PI*2)).add(.5),r=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return ke(t,r)}),qT=Q(([e=Jt()])=>{let t=e.x.sub(.5).mul(Math.PI*2),r=e.y.sub(.5).mul(Math.PI),i=r.cos(),s=i.mul(t.cos()),a=r.sin(),n=i.mul(t.sin());return K(s,a,n)}),pE=class extends er{constructor(e=1,t={}){super(e,e,t),this.isCubeRenderTarget=!0;let r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new Ug(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){let r=t.minFilter,i=t.generateMipmaps;t.generateMipmaps=!0,this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let s=new Wv(5,5,5),a=$T(gT),n=new Pt;n.colorNode=Ot(t,a,0),n.side=ii,n.blending=Kn;let o=new Mi(s,n),l=new bg;l.add(o),t.minFilter===Ia&&(t.minFilter=lr);let u=new sU(1,10,this),h=e.getMRT();return e.setMRT(null),u.update(e,l),e.setMRT(h),t.minFilter=r,t.generateMipmaps=i,o.geometry.dispose(),o.material.dispose(),this}clear(e,t=!0,r=!0,i=!0){let s=e.getRenderTarget();for(let a=0;a\\u003c6;a++)e.setRenderTarget(this,a),e.clear(t,r,i);e.setRenderTarget(s)}},kp=new WeakMap,hV=class extends rr{static get type(){return\\\"CubeMapNode\\\"}constructor(e){super(\\\"vec3\\\"),this.envNode=e,this._cubeTexture=null,this._cubeTextureNode=Ts(null);let t=new Ug;t.isRenderTargetTexture=!0,this._defaultTexture=t,this.updateBeforeType=ut.RENDER}updateBefore(e){let{renderer:t,material:r}=e,i=this.envNode;if(i.isTextureNode||i.isMaterialReferenceNode){let s=i.isTextureNode?i.value:r[i.property];if(s&&s.isTexture){let a=s.mapping;if(a===kf||a===iv){if(kp.has(s)){let n=kp.get(s);fE(n,s.mapping),this._cubeTexture=n}else{let n=s.image;if(dV(n)){let o=new pE(n.height);o.fromEquirectangularTexture(t,s),fE(o.texture,s.mapping),this._cubeTexture=o.texture,kp.set(s,o.texture),s.addEventListener(\\\"dispose\\\",mE)}else this._cubeTexture=this._defaultTexture}this._cubeTextureNode.value=this._cubeTexture}else this._cubeTextureNode=this.envNode}}}setup(e){return this.updateBefore(e),this._cubeTextureNode}};function dV(e){return e==null?!1:e.height>0}function mE(e){let t=e.target;t.removeEventListener(\\\"dispose\\\",mE);let r=kp.get(t);r!==void 0&&(kp.delete(t),r.dispose())}function fE(e,t){t===kf?e.mapping=Vh:t===iv&&(e.mapping=Lf)}var gE=Mt(hV).setParameterLength(1),YT=class extends Ed{static get type(){return\\\"BasicEnvironmentNode\\\"}constructor(e=null){super(),this.envNode=e}setup(e){e.context.environment=gE(this.envNode)}},cV=class extends Ed{static get type(){return\\\"BasicLightMapNode\\\"}constructor(e=null){super(),this.lightMapNode=e}setup(e){let t=D(1/Math.PI);e.context.irradianceLightMap=this.lightMapNode.mul(t)}},$0=class{start(e){e.lightsNode.setupLights(e,e.lightsNode.getLightNodes(e)),this.indirect(e)}finish(){}direct(){}directRectArea(){}indirect(){}ambientOcclusion(){}},yE=class extends $0{constructor(){super()}indirect({context:e}){let t=e.ambientOcclusion,r=e.reflectedLight,i=e.irradianceLightMap;r.indirectDiffuse.assign(Ve(0)),i?r.indirectDiffuse.addAssign(i):r.indirectDiffuse.addAssign(Ve(1,1,1,0)),r.indirectDiffuse.mulAssign(t),r.indirectDiffuse.mulAssign(Zt.rgb)}finish(e){let{material:t,context:r}=e,i=r.outgoingLight,s=e.context.environment;if(s)switch(t.combine){case Ff:i.rgb.assign(Ct(i.rgb,i.rgb.mul(s.rgb),Fp.mul(O0)));break;case AD:i.rgb.assign(Ct(i.rgb,s.rgb,Fp.mul(O0)));break;case CD:i.rgb.addAssign(s.rgb.mul(Fp.mul(O0)));break;default:Ue(\\\"BasicLightingModel: Unsupported .combine value:\\\",t.combine);break}}},pV=new mn,Pd=class extends Pt{static get type(){return\\\"MeshBasicNodeMaterial\\\"}constructor(e){super(),this.isMeshBasicNodeMaterial=!0,this.lights=!0,this.setDefaultValues(pV),this.setValues(e)}setupNormal(){return Ou(Ad)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new YT(t):null}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new cV(FT)),t}setupOutgoingLight(){return Zt.rgb}setupLightingModel(){return new yE}},Bd=Q(({f0:e,f90:t,dotVH:r})=>{let i=r.mul(-5.55473).sub(6.98316).mul(r).exp2();return e.mul(i.oneMinus()).add(t.mul(i))}),Wu=Q(e=>e.diffuseColor.mul(1/Math.PI)),mV=()=>D(.25),fV=Q(({dotNH:e})=>u0.mul(D(.5)).add(1).mul(D(1/Math.PI)).mul(e.pow(u0))),gV=Q(({lightDirection:e})=>{let t=e.add(ar).normalize(),r=Ut.dot(t).clamp(),i=ar.dot(t).clamp(),s=Bd({f0:cl,f90:1,dotVH:i}),a=mV(),n=fV({dotNH:r});return s.mul(a).mul(n)}),xE=class extends yE{constructor(e=!0){super(),this.specular=e}direct({lightDirection:e,lightColor:t,reflectedLight:r}){let i=Ut.dot(e).clamp().mul(t);r.directDiffuse.addAssign(i.mul(Wu({diffuseColor:Zt.rgb}))),this.specular===!0&&r.directSpecular.addAssign(i.mul(gV({lightDirection:e})).mul(Fp))}indirect(e){let{ambientOcclusion:t,irradiance:r,reflectedLight:i}=e.context;i.indirectDiffuse.addAssign(r.mul(Wu({diffuseColor:Zt}))),i.indirectDiffuse.mulAssign(t)}},yV=new IO,xV=class extends Pt{static get type(){return\\\"MeshLambertNodeMaterial\\\"}constructor(e){super(),this.isMeshLambertNodeMaterial=!0,this.lights=!0,this.setDefaultValues(yV),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new YT(t):null}setupLightingModel(){return new xE(!1)}},vV=new EO,bV=class extends Pt{static get type(){return\\\"MeshPhongNodeMaterial\\\"}constructor(e){super(),this.isMeshPhongNodeMaterial=!0,this.lights=!0,this.shininessNode=null,this.specularNode=null,this.setDefaultValues(vV),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t?new YT(t):null}setupLightingModel(){return new xE}setupVariants(){let e=(this.shininessNode?D(this.shininessNode):xR).max(1e-4);u0.assign(e);let t=this.specularNode||bR;cl.assign(t)}},vE=Q(e=>{if(e.geometry.hasAttribute(\\\"normal\\\")===!1)return D(0);let t=Ad.dFdx().abs().max(Ad.dFdy().abs());return t.x.max(t.y).max(t.z)}),ZT=Q(e=>{let{roughness:t}=e,r=vE(),i=t.max(.0525);return i=i.add(r),i=i.min(1),i}),bE=Q(({alpha:e,dotNL:t,dotNV:r})=>{let i=e.pow2(),s=t.mul(i.add(i.oneMinus().mul(r.pow2())).sqrt()),a=r.mul(i.add(i.oneMinus().mul(t.pow2())).sqrt());return js(.5,s.add(a).max(p0))}).setLayout({name:\\\"V_GGX_SmithCorrelated\\\",type:\\\"float\\\",inputs:[{name:\\\"alpha\\\",type:\\\"float\\\"},{name:\\\"dotNL\\\",type:\\\"float\\\"},{name:\\\"dotNV\\\",type:\\\"float\\\"}]}),TV=Q(({alphaT:e,alphaB:t,dotTV:r,dotBV:i,dotTL:s,dotBL:a,dotNV:n,dotNL:o})=>{let l=o.mul(K(e.mul(r),t.mul(i),n).length()),u=n.mul(K(e.mul(s),t.mul(a),o).length());return js(.5,l.add(u).max(p0))}).setLayout({name:\\\"V_GGX_SmithCorrelated_Anisotropic\\\",type:\\\"float\\\",inputs:[{name:\\\"alphaT\\\",type:\\\"float\\\",qualifier:\\\"in\\\"},{name:\\\"alphaB\\\",type:\\\"float\\\",qualifier:\\\"in\\\"},{name:\\\"dotTV\\\",type:\\\"float\\\",qualifier:\\\"in\\\"},{name:\\\"dotBV\\\",type:\\\"float\\\",qualifier:\\\"in\\\"},{name:\\\"dotTL\\\",type:\\\"float\\\",qualifier:\\\"in\\\"},{name:\\\"dotBL\\\",type:\\\"float\\\",qualifier:\\\"in\\\"},{name:\\\"dotNV\\\",type:\\\"float\\\",qualifier:\\\"in\\\"},{name:\\\"dotNL\\\",type:\\\"float\\\",qualifier:\\\"in\\\"}]}),TE=Q(({alpha:e,dotNH:t})=>{let r=e.pow2(),i=t.pow2().mul(r.oneMinus()).oneMinus();return r.div(i.pow2()).mul(1/Math.PI)}).setLayout({name:\\\"D_GGX\\\",type:\\\"float\\\",inputs:[{name:\\\"alpha\\\",type:\\\"float\\\"},{name:\\\"dotNH\\\",type:\\\"float\\\"}]}),SV=D(1/Math.PI),_V=Q(({alphaT:e,alphaB:t,dotNH:r,dotTH:i,dotBH:s})=>{let a=e.mul(t),n=K(t.mul(i),e.mul(s),a.mul(r)),o=n.dot(n),l=a.div(o);return SV.mul(a.mul(l.pow2()))}).setLayout({name:\\\"D_GGX_Anisotropic\\\",type:\\\"float\\\",inputs:[{name:\\\"alphaT\\\",type:\\\"float\\\",qualifier:\\\"in\\\"},{name:\\\"alphaB\\\",type:\\\"float\\\",qualifier:\\\"in\\\"},{name:\\\"dotNH\\\",type:\\\"float\\\",qualifier:\\\"in\\\"},{name:\\\"dotTH\\\",type:\\\"float\\\",qualifier:\\\"in\\\"},{name:\\\"dotBH\\\",type:\\\"float\\\",qualifier:\\\"in\\\"}]}),JT=Q(({lightDirection:e,f0:t,f90:r,roughness:i,f:s,normalView:a=Ut,USE_IRIDESCENCE:n,USE_ANISOTROPY:o})=>{let l=i.pow2(),u=e.add(ar).normalize(),h=a.dot(e).clamp(),d=a.dot(ar).clamp(),c=a.dot(u).clamp(),m=ar.dot(u).clamp(),g=Bd({f0:t,f90:r,dotVH:m}),y,b;if(vd(n)&&(g=a0.mix(g,s)),vd(o)){let v=Ap.dot(e),S=Ap.dot(ar),T=Ap.dot(u),w=Cu.dot(e),N=Cu.dot(ar),C=Cu.dot(u);y=TV({alphaT:l0,alphaB:l,dotTV:S,dotBV:N,dotTL:v,dotBL:w,dotNV:d,dotNL:h}),b=_V({alphaT:l0,alphaB:l,dotNH:c,dotTH:T,dotBH:C})}else y=bE({alpha:l,dotNL:h,dotNV:d}),b=TE({alpha:l,dotNH:c});return g.mul(y).mul(b)}),wV=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),En=null,Dp=Q(({roughness:e,dotNV:t})=>{En===null&&(En=new kg(wV,16,16,ha,Dt),En.name=\\\"DFG_LUT\\\",En.minFilter=lr,En.magFilter=lr,En.wrapS=Ti,En.wrapT=Ti,En.generateMipmaps=!1,En.needsUpdate=!0);let r=ke(e,t);return Ot(En,r).rg}),MV=Q(({lightDirection:e,f0:t,f90:r,roughness:i,f:s,USE_IRIDESCENCE:a,USE_ANISOTROPY:n})=>{let o=JT({lightDirection:e,f0:t,f90:r,roughness:i,f:s,USE_IRIDESCENCE:a,USE_ANISOTROPY:n}),l=Ut.dot(e).clamp(),u=Ut.dot(ar).clamp(),h=Dp({roughness:i,dotNV:u}),d=Dp({roughness:i,dotNV:l}),c=t.mul(h.x).add(r.mul(h.y)),m=t.mul(d.x).add(r.mul(d.y)),g=h.x.add(h.y),y=d.x.add(d.y),b=D(1).sub(g),v=D(1).sub(y),S=t.add(t.oneMinus().mul(.047619)),T=c.mul(m).mul(S).div(D(1).sub(b.mul(v).mul(S).mul(S)).add(p0)),w=b.mul(v),N=T.mul(w);return o.add(N)}),SE=Q(e=>{let{dotNV:t,specularColor:r,specularF90:i,roughness:s}=e,a=Dp({dotNV:t,roughness:s});return r.mul(a.x).add(i.mul(a.y))}),QT=Q(({f:e,f90:t,dotVH:r})=>{let i=r.oneMinus().saturate(),s=i.mul(i),a=i.mul(s,s).clamp(0,.9999);return e.sub(K(t).mul(a)).div(a.oneMinus())}).setLayout({name:\\\"Schlick_to_F0\\\",type:\\\"vec3\\\",inputs:[{name:\\\"f\\\",type:\\\"vec3\\\"},{name:\\\"f90\\\",type:\\\"float\\\"},{name:\\\"dotVH\\\",type:\\\"float\\\"}]}),NV=Q(({roughness:e,dotNH:t})=>{let r=e.pow2(),i=D(1).div(r),s=t.pow2().oneMinus().max(.0078125);return D(2).add(i).mul(s.pow(i.mul(.5))).div(2*Math.PI)}).setLayout({name:\\\"D_Charlie\\\",type:\\\"float\\\",inputs:[{name:\\\"roughness\\\",type:\\\"float\\\"},{name:\\\"dotNH\\\",type:\\\"float\\\"}]}),AV=Q(({dotNV:e,dotNL:t})=>D(1).div(D(4).mul(t.add(e).sub(t.mul(e))))).setLayout({name:\\\"V_Neubelt\\\",type:\\\"float\\\",inputs:[{name:\\\"dotNV\\\",type:\\\"float\\\"},{name:\\\"dotNL\\\",type:\\\"float\\\"}]}),CV=Q(({lightDirection:e})=>{let t=e.add(ar).normalize(),r=Ut.dot(e).clamp(),i=Ut.dot(ar).clamp(),s=Ut.dot(t).clamp(),a=NV({roughness:hl,dotNH:s}),n=AV({dotNV:i,dotNL:r});return Ws.mul(a).mul(n)}),_E=Q(({N:e,V:t,roughness:r})=>{let i=.0078125,s=e.dot(t).saturate(),a=ke(r,s.oneMinus().sqrt());return a.assign(a.mul(.984375).add(i)),a}).setLayout({name:\\\"LTC_Uv\\\",type:\\\"vec2\\\",inputs:[{name:\\\"N\\\",type:\\\"vec3\\\"},{name:\\\"V\\\",type:\\\"vec3\\\"},{name:\\\"roughness\\\",type:\\\"float\\\"}]}),RV=Q(({f:e})=>{let t=e.length();return Br(t.mul(t).add(e.z).div(t.add(1)),0)}).setLayout({name:\\\"LTC_ClippedSphereFormFactor\\\",type:\\\"float\\\",inputs:[{name:\\\"f\\\",type:\\\"vec3\\\"}]}),q0=Q(({v1:e,v2:t})=>{let r=e.dot(t),i=r.abs().toVar(),s=i.mul(.0145206).add(.4965155).mul(i).add(.8543985).toVar(),a=i.add(4.1616724).mul(i).add(3.417594).toVar(),n=s.div(a),o=r.greaterThan(0).select(n,Br(r.mul(r).oneMinus(),1e-7).inverseSqrt().mul(.5).sub(n));return e.cross(t).mul(o)}).setLayout({name:\\\"LTC_EdgeVectorFormFactor\\\",type:\\\"vec3\\\",inputs:[{name:\\\"v1\\\",type:\\\"vec3\\\"},{name:\\\"v2\\\",type:\\\"vec3\\\"}]}),KT=Q(({N:e,V:t,P:r,mInv:i,p0:s,p1:a,p2:n,p3:o})=>{let l=a.sub(s).toVar(),u=o.sub(s).toVar(),h=l.cross(u),d=K().toVar();return et(h.dot(r.sub(s)).greaterThanEqual(0),()=>{let c=t.sub(e.mul(t.dot(e))).normalize(),m=e.cross(c).negate(),g=i.mul(Ni(c,m,e).transpose()).toVar(),y=g.mul(s.sub(r)).normalize().toVar(),b=g.mul(a.sub(r)).normalize().toVar(),v=g.mul(n.sub(r)).normalize().toVar(),S=g.mul(o.sub(r)).normalize().toVar(),T=K(0).toVar();T.addAssign(q0({v1:y,v2:b})),T.addAssign(q0({v1:b,v2:v})),T.addAssign(q0({v1:v,v2:S})),T.addAssign(q0({v1:S,v2:y})),d.assign(K(RV({f:T})))}),d}).setLayout({name:\\\"LTC_Evaluate\\\",type:\\\"vec3\\\",inputs:[{name:\\\"N\\\",type:\\\"vec3\\\"},{name:\\\"V\\\",type:\\\"vec3\\\"},{name:\\\"P\\\",type:\\\"vec3\\\"},{name:\\\"mInv\\\",type:\\\"mat3\\\"},{name:\\\"p0\\\",type:\\\"vec3\\\"},{name:\\\"p1\\\",type:\\\"vec3\\\"},{name:\\\"p2\\\",type:\\\"vec3\\\"},{name:\\\"p3\\\",type:\\\"vec3\\\"}]}),Y0=1/6,wE=e=>mt(Y0,mt(e,mt(e,e.negate().add(3)).sub(3)).add(1)),eS=e=>mt(Y0,mt(e,mt(e,mt(3,e).sub(6))).add(4)),ME=e=>mt(Y0,mt(e,mt(e,mt(-3,e).add(3)).add(3)).add(1)),tS=e=>mt(Y0,ma(e,3)),NE=e=>wE(e).add(eS(e)),AE=e=>ME(e).add(tS(e)),CE=e=>Yr(-1,eS(e).div(wE(e).add(eS(e)))),RE=e=>Yr(1,tS(e).div(ME(e).add(tS(e)))),EE=(e,t,r)=>{let i=e.uvNode,s=mt(i,t.zw).add(.5),a=Mn(s),n=Oa(s),o=NE(n.x),l=AE(n.x),u=CE(n.x),h=RE(n.x),d=CE(n.y),c=RE(n.y),m=ke(a.x.add(u),a.y.add(d)).sub(.5).mul(t.xy),g=ke(a.x.add(h),a.y.add(d)).sub(.5).mul(t.xy),y=ke(a.x.add(u),a.y.add(c)).sub(.5).mul(t.xy),b=ke(a.x.add(h),a.y.add(c)).sub(.5).mul(t.xy),v=NE(n.y).mul(Yr(o.mul(e.sample(m).level(r)),l.mul(e.sample(g).level(r)))),S=AE(n.y).mul(Yr(o.mul(e.sample(y).level(r)),l.mul(e.sample(b).level(r))));return v.add(S)},rS=Q(([e,t])=>{let r=ke(e.size(Y(t))),i=ke(e.size(Y(t.add(1)))),s=js(1,r),a=js(1,i),n=EE(e,Ve(s,r),Mn(t)),o=EE(e,Ve(a,i),g0(t));return Oa(t).mix(n,o)}),EV=Q(([e,t])=>{let r=t.mul(rT(e));return rS(e,r)}),PE=Q(([e,t,r,i,s])=>{let a=K(jb(t.negate(),Yi(e),js(1,i))),n=K(Nn(s[0].xyz),Nn(s[1].xyz),Nn(s[2].xyz));return Yi(a).mul(r.mul(n))}).setLayout({name:\\\"getVolumeTransmissionRay\\\",type:\\\"vec3\\\",inputs:[{name:\\\"n\\\",type:\\\"vec3\\\"},{name:\\\"v\\\",type:\\\"vec3\\\"},{name:\\\"thickness\\\",type:\\\"float\\\"},{name:\\\"ior\\\",type:\\\"float\\\"},{name:\\\"modelMatrix\\\",type:\\\"mat4\\\"}]}),PV=Q(([e,t])=>e.mul(za(t.mul(2).sub(2),0,1))).setLayout({name:\\\"applyIorToRoughness\\\",type:\\\"float\\\",inputs:[{name:\\\"roughness\\\",type:\\\"float\\\"},{name:\\\"ior\\\",type:\\\"float\\\"}]}),BV=VT(),IV=sE(),BE=Q(([e,t,r],{material:i})=>{let s=(i.side===ii?BV:IV).sample(e),a=wn(Lu.x).mul(PV(t,r));return rS(s,a)}),IE=Q(([e,t,r])=>(et(r.notEqual(0),()=>{let i=f0(t).negate().div(r);return Pb(i.negate().mul(e))}),K(1))).setLayout({name:\\\"volumeAttenuation\\\",type:\\\"vec3\\\",inputs:[{name:\\\"transmissionDistance\\\",type:\\\"float\\\"},{name:\\\"attenuationColor\\\",type:\\\"vec3\\\"},{name:\\\"attenuationDistance\\\",type:\\\"float\\\"}]}),FV=Q(([e,t,r,i,s,a,n,o,l,u,h,d,c,m,g])=>{let y,b;if(g){y=Ve().toVar(),b=K().toVar();let N=h.sub(1).mul(g.mul(.025)),C=K(h.sub(N),h,h.add(N));Qt({start:0,end:3},({i:R})=>{let E=C.element(R),P=PE(e,t,d,E,o),I=n.add(P),O=u.mul(l.mul(Ve(I,1))),L=ke(O.xy.div(O.w)).toVar();L.addAssign(1),L.divAssign(2),L.assign(ke(L.x,L.y.oneMinus()));let X=BE(L,r,E);y.element(R).assign(X.element(R)),y.a.addAssign(X.a),b.element(R).assign(i.element(R).mul(IE(Nn(P),c,m).element(R)))}),y.a.divAssign(3)}else{let N=PE(e,t,d,h,o),C=n.add(N),R=u.mul(l.mul(Ve(C,1))),E=ke(R.xy.div(R.w)).toVar();E.addAssign(1),E.divAssign(2),E.assign(ke(E.x,E.y.oneMinus())),y=BE(E,r,h),b=i.mul(IE(Nn(N),c,m))}let v=b.rgb.mul(y.rgb),S=e.dot(t).clamp(),T=K(SE({dotNV:S,specularColor:s,specularF90:a,roughness:r})),w=b.r.add(b.g,b.b).div(3);return Ve(T.oneMinus().mul(v),y.a.oneMinus().mul(w).oneMinus())}),LV=Ni(3.2404542,-.969266,.0556434,-1.5371385,1.8760108,-.2040259,-.4985314,.041556,1.0572252),kV=e=>{let t=e.sqrt();return K(1).add(t).div(K(1).sub(t))},FE=(e,t)=>e.sub(t).div(e.add(t)).pow2(),DV=(e,t)=>{let r=e.mul(2*Math.PI*1e-9),i=K(54856e-17,44201e-17,52481e-17),s=K(1681e3,1795300,2208400),a=K(43278e5,93046e5,66121e5),n=D(9747e-17*Math.sqrt(2*Math.PI*45282e5)).mul(r.mul(2239900).add(t.x).cos()).mul(r.pow2().mul(-45282e5).exp()),o=i.mul(a.mul(2*Math.PI).sqrt()).mul(s.mul(r).add(t).cos()).mul(r.pow2().negate().mul(a).exp());return o=K(o.x.add(n),o.y,o.z).div(10685e-11),LV.mul(o)},LE=Q(({outsideIOR:e,eta2:t,cosTheta1:r,thinFilmThickness:i,baseF0:s})=>{let a=Ct(e,t,Hs(0,.03,i)),n=e.div(a).pow2().mul(r.pow2().oneMinus()).oneMinus();et(n.lessThan(0),()=>K(1));let o=n.sqrt(),l=FE(a,e),u=Bd({f0:l,f90:1,dotVH:r}),h=u.oneMinus(),d=a.lessThan(e).select(Math.PI,0),c=D(Math.PI).sub(d),m=kV(s.clamp(0,.9999)),g=FE(m,a.toVec3()),y=Bd({f0:g,f90:1,dotVH:o}),b=K(m.x.lessThan(a).select(Math.PI,0),m.y.lessThan(a).select(Math.PI,0),m.z.lessThan(a).select(Math.PI,0)),v=a.mul(i,o,2),S=K(c).add(b),T=u.mul(y).clamp(1e-5,.9999),w=T.sqrt(),N=h.pow2().mul(y).div(K(1).sub(T)),C=u.add(N).toVar(),R=N.sub(h).toVar();return Qt({start:1,end:2,condition:\\\"\\u003c=\\\",name:\\\"m\\\"},({m:E})=>{R.mulAssign(w);let P=DV(D(E).mul(v),D(E).mul(S)).mul(2);C.addAssign(R.mul(P))}),C.max(K(0))}).setLayout({name:\\\"evalIridescence\\\",type:\\\"vec3\\\",inputs:[{name:\\\"outsideIOR\\\",type:\\\"float\\\"},{name:\\\"eta2\\\",type:\\\"float\\\"},{name:\\\"cosTheta1\\\",type:\\\"float\\\"},{name:\\\"thinFilmThickness\\\",type:\\\"float\\\"},{name:\\\"baseF0\\\",type:\\\"vec3\\\"}]}),Op=Q(({normal:e,viewDir:t,roughness:r})=>{let i=e.dot(t).saturate(),s=r.mul(r),a=r.add(.1).reciprocal(),n=D(-1.9362).add(r.mul(1.0678)).add(s.mul(.4573)).sub(a.mul(.8469)),o=D(-.6014).add(r.mul(.5538)).sub(s.mul(.467)).sub(a.mul(.1255));return n.mul(i).add(o).exp().saturate()}),Up=K(.04),Z0=D(1),kE=class extends $0{constructor(e=!1,t=!1,r=!1,i=!1,s=!1,a=!1){super(),this.clearcoat=e,this.sheen=t,this.iridescence=r,this.anisotropy=i,this.transmission=s,this.dispersion=a,this.clearcoatRadiance=null,this.clearcoatSpecularDirect=null,this.clearcoatSpecularIndirect=null,this.sheenSpecularDirect=null,this.sheenSpecularIndirect=null,this.iridescenceFresnel=null,this.iridescenceF0=null,this.iridescenceF0Dielectric=null,this.iridescenceF0Metallic=null}start(e){if(this.clearcoat===!0&&(this.clearcoatRadiance=K().toVar(\\\"clearcoatRadiance\\\"),this.clearcoatSpecularDirect=K().toVar(\\\"clearcoatSpecularDirect\\\"),this.clearcoatSpecularIndirect=K().toVar(\\\"clearcoatSpecularIndirect\\\")),this.sheen===!0&&(this.sheenSpecularDirect=K().toVar(\\\"sheenSpecularDirect\\\"),this.sheenSpecularIndirect=K().toVar(\\\"sheenSpecularIndirect\\\")),this.iridescence===!0){let t=Ut.dot(ar).clamp(),r=LE({outsideIOR:D(1),eta2:n0,cosTheta1:t,thinFilmThickness:o0,baseF0:cl}),i=LE({outsideIOR:D(1),eta2:n0,cosTheta1:t,thinFilmThickness:o0,baseF0:Zt.rgb});this.iridescenceFresnel=Ct(r,i,yo),this.iridescenceF0Dielectric=QT({f:r,f90:1,dotVH:t}),this.iridescenceF0Metallic=QT({f:i,f90:1,dotVH:t}),this.iridescenceF0=Ct(this.iridescenceF0Dielectric,this.iridescenceF0Metallic,yo)}if(this.transmission===!0){let t=Rn,r=VC.sub(Rn).normalize(),i=vl,s=e.context;s.backdrop=FV(i,r,_n,Au,Ru,Eu,t,ga,xl,bs,Rp,Mb,Ab,Nb,this.dispersion?Cb:null),s.backdropAlpha=h0,Zt.a.mulAssign(Ct(1,s.backdrop.a,h0))}super.start(e)}computeMultiscattering(e,t,r,i,s=null){let a=Ut.dot(ar).clamp(),n=Dp({roughness:_n,dotNV:a}),o=s?a0.mix(i,s):i,l=o.mul(n.x).add(r.mul(n.y)),u=n.x.add(n.y).oneMinus(),h=o.add(o.oneMinus().mul(.047619)),d=l.mul(h).div(u.mul(h).oneMinus());e.addAssign(l),t.addAssign(d.mul(u))}direct({lightDirection:e,lightColor:t,reflectedLight:r}){let i=Ut.dot(e).clamp().mul(t).toVar();if(this.sheen===!0){this.sheenSpecularDirect.addAssign(i.mul(CV({lightDirection:e})));let s=Op({normal:Ut,viewDir:ar,roughness:hl}),a=Op({normal:Ut,viewDir:e,roughness:hl}),n=Ws.r.max(Ws.g).max(Ws.b).mul(s.max(a)).oneMinus();i.mulAssign(n)}if(this.clearcoat===!0){let s=bl.dot(e).clamp().mul(t);this.clearcoatSpecularDirect.addAssign(s.mul(JT({lightDirection:e,f0:Up,f90:Z0,roughness:Td,normalView:bl})))}r.directDiffuse.addAssign(i.mul(Wu({diffuseColor:Au}))),r.directSpecular.addAssign(i.mul(MV({lightDirection:e,f0:Ru,f90:1,roughness:_n,f:this.iridescenceFresnel,USE_IRIDESCENCE:this.iridescence,USE_ANISOTROPY:this.anisotropy})))}directRectArea({lightColor:e,lightPosition:t,halfWidth:r,halfHeight:i,reflectedLight:s,ltc_1:a,ltc_2:n}){let o=t.add(r).sub(i),l=t.sub(r).sub(i),u=t.sub(r).add(i),h=t.add(r).add(i),d=Ut,c=ar,m=Wr.toVar(),g=_E({N:d,V:c,roughness:_n}),y=a.sample(g).toVar(),b=n.sample(g).toVar(),v=Ni(K(y.x,0,y.y),K(0,1,0),K(y.z,0,y.w)).toVar(),S=Ru.mul(b.x).add(Eu.sub(Ru).mul(b.y)).toVar();if(s.directSpecular.addAssign(e.mul(S).mul(KT({N:d,V:c,P:m,mInv:v,p0:o,p1:l,p2:u,p3:h}))),s.directDiffuse.addAssign(e.mul(Au).mul(KT({N:d,V:c,P:m,mInv:Ni(1,0,0,0,1,0,0,0,1),p0:o,p1:l,p2:u,p3:h}))),this.clearcoat===!0){let T=bl,w=_E({N:T,V:c,roughness:Td}),N=a.sample(w),C=n.sample(w),R=Ni(K(N.x,0,N.y),K(0,1,0),K(N.z,0,N.w)),E=Up.mul(C.x).add(Z0.sub(Up).mul(C.y));this.clearcoatSpecularDirect.addAssign(e.mul(E).mul(KT({N:T,V:c,P:m,mInv:R,p0:o,p1:l,p2:u,p3:h})))}}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e),this.ambientOcclusion(e)}indirectDiffuse(e){let{irradiance:t,reflectedLight:r}=e.context,i=t.mul(Wu({diffuseColor:Au})).toVar();if(this.sheen===!0){let s=Op({normal:Ut,viewDir:ar,roughness:hl}),a=Ws.r.max(Ws.g).max(Ws.b).mul(s).oneMinus();i.mulAssign(a)}r.indirectDiffuse.addAssign(i)}indirectSpecular(e){let{radiance:t,iblIrradiance:r,reflectedLight:i}=e.context;if(this.sheen===!0&&this.sheenSpecularIndirect.addAssign(r.mul(Ws,Op({normal:Ut,viewDir:ar,roughness:hl}))),this.clearcoat===!0){let y=bl.dot(ar).clamp(),b=SE({dotNV:y,specularColor:Up,specularF90:Z0,roughness:Td});this.clearcoatSpecularIndirect.addAssign(this.clearcoatRadiance.mul(b))}let s=K().toVar(\\\"singleScatteringDielectric\\\"),a=K().toVar(\\\"multiScatteringDielectric\\\"),n=K().toVar(\\\"singleScatteringMetallic\\\"),o=K().toVar(\\\"multiScatteringMetallic\\\");this.computeMultiscattering(s,a,Eu,cl,this.iridescenceF0Dielectric),this.computeMultiscattering(n,o,Eu,Zt.rgb,this.iridescenceF0Metallic);let l=Ct(s,n,yo),u=Ct(a,o,yo),h=s.add(a),d=Au.mul(h.oneMinus()),c=r.mul(1/Math.PI),m=t.mul(l).add(u.mul(c)).toVar(),g=d.mul(c).toVar();if(this.sheen===!0){let y=Op({normal:Ut,viewDir:ar,roughness:hl}),b=Ws.r.max(Ws.g).max(Ws.b).mul(y).oneMinus();m.mulAssign(b),g.mulAssign(b)}i.indirectSpecular.addAssign(m),i.indirectDiffuse.addAssign(g)}ambientOcclusion(e){let{ambientOcclusion:t,reflectedLight:r}=e.context,i=Ut.dot(ar).clamp().add(t),s=_n.mul(-16).oneMinus().negate().exp2(),a=t.sub(i.pow(s).oneMinus()).clamp();this.clearcoat===!0&&this.clearcoatSpecularIndirect.mulAssign(t),this.sheen===!0&&this.sheenSpecularIndirect.mulAssign(t),r.indirectDiffuse.mulAssign(t),r.indirectSpecular.mulAssign(a)}finish({context:e}){let{outgoingLight:t}=e;if(this.clearcoat===!0){let r=bl.dot(ar).clamp(),i=Bd({dotVH:r,f0:Up,f90:Z0}),s=t.mul(s0.mul(i).oneMinus()).add(this.clearcoatSpecularDirect.add(this.clearcoatSpecularIndirect).mul(s0));t.assign(s)}if(this.sheen===!0){let r=t.add(this.sheenSpecularDirect,this.sheenSpecularIndirect.mul(1/Math.PI));t.assign(r)}}},DE=D(1),iS=D(-2),J0=D(.8),sS=D(-1),Q0=D(.4),aS=D(2),K0=D(.305),nS=D(3),OE=D(.21),OV=D(4),UE=D(4),UV=D(16),zV=Q(([e])=>{let t=K(ur(e)).toVar(),r=D(-1).toVar();return et(t.x.greaterThan(t.z),()=>{et(t.x.greaterThan(t.y),()=>{r.assign(Zi(e.x.greaterThan(0),0,3))}).Else(()=>{r.assign(Zi(e.y.greaterThan(0),1,4))})}).Else(()=>{et(t.z.greaterThan(t.y),()=>{r.assign(Zi(e.z.greaterThan(0),2,5))}).Else(()=>{r.assign(Zi(e.y.greaterThan(0),1,4))})}),r}).setLayout({name:\\\"getFace\\\",type:\\\"float\\\",inputs:[{name:\\\"direction\\\",type:\\\"vec3\\\"}]}),VV=Q(([e,t])=>{let r=ke().toVar();return et(t.equal(0),()=>{r.assign(ke(e.z,e.y).div(ur(e.x)))}).ElseIf(t.equal(1),()=>{r.assign(ke(e.x.negate(),e.z.negate()).div(ur(e.y)))}).ElseIf(t.equal(2),()=>{r.assign(ke(e.x.negate(),e.y).div(ur(e.z)))}).ElseIf(t.equal(3),()=>{r.assign(ke(e.z.negate(),e.y).div(ur(e.x)))}).ElseIf(t.equal(4),()=>{r.assign(ke(e.x.negate(),e.z).div(ur(e.y)))}).Else(()=>{r.assign(ke(e.x,e.y).div(ur(e.z)))}),mt(.5,r.add(1))}).setLayout({name:\\\"getUV\\\",type:\\\"vec2\\\",inputs:[{name:\\\"direction\\\",type:\\\"vec3\\\"},{name:\\\"face\\\",type:\\\"float\\\"}]}),GV=Q(([e])=>{let t=D(0).toVar();return et(e.greaterThanEqual(J0),()=>{t.assign(DE.sub(e).mul(sS.sub(iS)).div(DE.sub(J0)).add(iS))}).ElseIf(e.greaterThanEqual(Q0),()=>{t.assign(J0.sub(e).mul(aS.sub(sS)).div(J0.sub(Q0)).add(sS))}).ElseIf(e.greaterThanEqual(K0),()=>{t.assign(Q0.sub(e).mul(nS.sub(aS)).div(Q0.sub(K0)).add(aS))}).ElseIf(e.greaterThanEqual(OE),()=>{t.assign(K0.sub(e).mul(OV.sub(nS)).div(K0.sub(OE)).add(nS))}).Else(()=>{t.assign(D(-2).mul(wn(mt(1.16,e))))}),t}).setLayout({name:\\\"roughnessToMip\\\",type:\\\"float\\\",inputs:[{name:\\\"roughness\\\",type:\\\"float\\\"}]}),zE=Q(([e,t])=>{let r=e.toVar();r.assign(mt(2,r).sub(1));let i=K(r,1).toVar();return et(t.equal(0),()=>{i.assign(i.zyx)}).ElseIf(t.equal(1),()=>{i.assign(i.xzy),i.xz.mulAssign(-1)}).ElseIf(t.equal(2),()=>{i.x.mulAssign(-1)}).ElseIf(t.equal(3),()=>{i.assign(i.zyx),i.xz.mulAssign(-1)}).ElseIf(t.equal(4),()=>{i.assign(i.xzy),i.xy.mulAssign(-1)}).ElseIf(t.equal(5),()=>{i.z.mulAssign(-1)}),i}).setLayout({name:\\\"getDirection\\\",type:\\\"vec3\\\",inputs:[{name:\\\"uv\\\",type:\\\"vec2\\\"},{name:\\\"face\\\",type:\\\"float\\\"}]}),VE=Q(([e,t,r,i,s,a])=>{let n=D(r),o=K(t),l=za(GV(n),iS,a),u=Oa(l),h=Mn(l),d=K(zp(e,o,h,i,s,a)).toVar();return et(u.notEqual(0),()=>{let c=K(zp(e,o,h.add(1),i,s,a)).toVar();d.assign(Ct(d,c,u))}),d}),zp=Q(([e,t,r,i,s,a])=>{let n=D(r).toVar(),o=K(t),l=D(zV(o)).toVar(),u=D(Br(UE.sub(n),0)).toVar();n.assign(Br(n,UE));let h=D(_d(n)).toVar(),d=ke(VV(o,l).mul(h.sub(2)).add(1)).toVar();return et(l.greaterThan(2),()=>{d.y.addAssign(h),l.subAssign(3)}),d.x.addAssign(l.mul(h)),d.x.addAssign(u.mul(mt(3,UV))),d.y.addAssign(mt(4,_d(a).sub(h))),d.x.mulAssign(i),d.y.mulAssign(s),e.sample(d).grad(ke(),ke())}),oS=Q(({envMap:e,mipInt:t,outputDirection:r,theta:i,axis:s,CUBEUV_TEXEL_WIDTH:a,CUBEUV_TEXEL_HEIGHT:n,CUBEUV_MAX_MIP:o})=>{let l=Ua(i),u=r.mul(l).add(s.cross(r).mul(xs(i))).add(s.mul(s.dot(r).mul(l.oneMinus())));return zp(e,u,t,a,n,o)}),GE=Q(({n:e,latitudinal:t,poleAxis:r,outputDirection:i,weights:s,samples:a,dTheta:n,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:h,CUBEUV_MAX_MIP:d})=>{let c=K(Zi(t,r,xo(r,i))).toVar();et(c.equal(K(0)),()=>{c.assign(K(i.z,0,i.x.negate()))}),c.assign(Yi(c));let m=K().toVar();return m.addAssign(s.element(0).mul(oS({theta:0,axis:c,outputDirection:i,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:h,CUBEUV_MAX_MIP:d}))),Qt({start:Y(1),end:e},({i:g})=>{et(g.greaterThanEqual(a),()=>{KR()});let y=D(n.mul(D(g))).toVar();m.addAssign(s.element(g).mul(oS({theta:y.mul(-1),axis:c,outputDirection:i,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:h,CUBEUV_MAX_MIP:d}))),m.addAssign(s.element(g).mul(oS({theta:y,axis:c,outputDirection:i,mipInt:o,envMap:l,CUBEUV_TEXEL_WIDTH:u,CUBEUV_TEXEL_HEIGHT:h,CUBEUV_MAX_MIP:d})))}),Ve(m,1)}),WV=Q(([e])=>{let t=Ne(e).toVar();return t.assign(t.shiftLeft(Ne(16)).bitOr(t.shiftRight(Ne(16)))),t.assign(t.bitAnd(Ne(1431655765)).shiftLeft(Ne(1)).bitOr(t.bitAnd(Ne(2863311530)).shiftRight(Ne(1)))),t.assign(t.bitAnd(Ne(858993459)).shiftLeft(Ne(2)).bitOr(t.bitAnd(Ne(3435973836)).shiftRight(Ne(2)))),t.assign(t.bitAnd(Ne(252645135)).shiftLeft(Ne(4)).bitOr(t.bitAnd(Ne(4042322160)).shiftRight(Ne(4)))),t.assign(t.bitAnd(Ne(16711935)).shiftLeft(Ne(8)).bitOr(t.bitAnd(Ne(4278255360)).shiftRight(Ne(8)))),D(t).mul(23283064365386963e-26)}),jV=Q(([e,t])=>ke(D(e).div(D(t)),WV(e))),HV=Q(([e,t,r])=>{let i=r.mul(r).toConst(),s=K(1,0,0).toConst(),a=xo(t,s).toConst(),n=ys(e.x).toConst(),o=mt(2,3.14159265359).mul(e.y).toConst(),l=n.mul(Ua(o)).toConst(),u=n.mul(xs(o)).toVar(),h=mt(.5,t.z.add(1)).toConst();u.assign(h.oneMinus().mul(ys(l.mul(l).oneMinus())).add(h.mul(u)));let d=s.mul(l).add(a.mul(u)).add(t.mul(ys(Br(0,l.mul(l).add(u.mul(u)).oneMinus()))));return Yi(K(i.mul(d.x),i.mul(d.y),Br(0,d.z)))}),WE=Q(({roughness:e,mipInt:t,envMap:r,N_immutable:i,GGX_SAMPLES:s,CUBEUV_TEXEL_WIDTH:a,CUBEUV_TEXEL_HEIGHT:n,CUBEUV_MAX_MIP:o})=>{let l=K(i).toVar(),u=K(0).toVar(),h=D(0).toVar();return et(e.lessThan(.001),()=>{u.assign(zp(r,l,t,a,n,o))}).Else(()=>{let d=Zi(ur(l.z).lessThan(.999),K(0,0,1),K(1,0,0)),c=Yi(xo(d,l)).toVar(),m=xo(l,c).toVar();Qt({start:Ne(0),end:s},({i:g})=>{let y=jV(g,s),b=HV(y,K(0,0,1),e),v=Yi(c.mul(b.x).add(m.mul(b.y)).add(l.mul(b.z))),S=Yi(v.mul(pa(l,v).mul(2)).sub(l)),T=Br(pa(l,S),0);et(T.greaterThan(0),()=>{let w=zp(r,S,t,a,n,o);u.addAssign(w.mul(T)),h.addAssign(T)})}),et(h.greaterThan(0),()=>{u.assign(u.div(h))})}),Ve(u,1)}),wl=4,jE=[.125,.215,.35,.446,.526,.582],ju=20,XV=512,Vp=new sb(-1,1,1,-1,0,1),$V=new gs(90,1),HE=new gt,lS=null,uS=0,hS=0,qV=new F,ey=new WeakMap,YV=[3,1,5,0,4,2],dS=zE(Jt(),$s(\\\"faceIndex\\\")).normalize(),ty=K(dS.x,dS.y,dS.z),ZV=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._blurMaterial=null,this._ggxMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._backgroundBox=null}get _hasInitialized(){return this._renderer.hasInitialized()}fromScene(e,t=0,r=.1,i=100,s={}){let{size:a=256,position:n=qV,renderTarget:o=null}=s;if(this._setSize(a),this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromScene() called before the backend is initialized. Use \\\"await renderer.init();\\\" before using this method.');lS=this._renderer.getRenderTarget(),uS=this._renderer.getActiveCubeFace(),hS=this._renderer.getActiveMipmapLevel();let l=o||this._allocateTarget(!0);return this._init(l),this._sceneToCubeUV(e,r,i,l,n),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}async fromSceneAsync(e,t=0,r=.1,i=100,s={}){return Et('PMREMGenerator: \\\".fromSceneAsync()\\\" is deprecated. Use \\\"await renderer.init()\\\" instead.'),await this._renderer.init(),this.fromScene(e,t,r,i,s)}fromEquirectangular(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromEquirectangular() called before the backend is initialized. Use \\\"await renderer.init();\\\" before using this method.');return this._fromTexture(e,t)}async fromEquirectangularAsync(e,t=null){return Et('PMREMGenerator: \\\".fromEquirectangularAsync()\\\" is deprecated. Use \\\"await renderer.init()\\\" instead.'),await this._renderer.init(),this._fromTexture(e,t)}fromCubemap(e,t=null){if(this._hasInitialized===!1)throw new Error('THREE.PMREMGenerator: .fromCubemap() called before the backend is initialized. Use \\\"await renderer.init();\\\" before using this method.');return this._fromTexture(e,t)}async fromCubemapAsync(e,t=null){return Et('PMREMGenerator: \\\".fromCubemapAsync()\\\" is deprecated. Use \\\"await renderer.init()\\\" instead.'),await this._renderer.init(),this._fromTexture(e,t)}async compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=$E(),await this._compileMaterial(this._cubemapMaterial))}async compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=qE(),await this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSizeFromTexture(e){e.mapping===Vh||e.mapping===Lf?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4)}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e\\u003cthis._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(lS,uS,hS),e.scissorTest=!1,this._setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){this._setSizeFromTexture(e),lS=this._renderer.getRenderTarget(),uS=this._renderer.getActiveCubeFace(),hS=this._renderer.getActiveMipmapLevel();let r=t||this._allocateTarget(!1);return this._init(r),this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTarget(e){let t=3*Math.max(this._cubeSize,112),r=4*this._cubeSize;return XE(t,r,e)}_init(e){if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e.width||this._pingPongRenderTarget.height!==e.height){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=XE(e.width,e.height);let{_lodMax:t}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=JV(t)),this._blurMaterial=QV(t,e.width,e.height),this._ggxMaterial=KV(t,e.width,e.height)}}async _compileMaterial(e){let t=new Mi(new ps,e);await this._renderer.compile(t,Vp)}_sceneToCubeUV(e,t,r,i,s){let a=$V;a.near=t,a.far=r;let n=[1,1,1,1,-1,1],o=[1,-1,1,-1,1,-1],l=this._renderer,u=l.autoClear;l.getClearColor(HE),l.autoClear=!1,this._backgroundBox===null&&(this._backgroundBox=new Mi(new Wv,new mn({name:\\\"PMREM.Background\\\",side:ii,depthWrite:!1,depthTest:!1})));let h=this._backgroundBox,d=h.material,c=!1,m=e.background;m?m.isColor&&(d.color.copy(m),e.background=null,c=!0):(d.color.copy(HE),c=!0),l.setRenderTarget(i),l.clear(),c&&l.render(h,a);for(let g=0;g\\u003c6;g++){let y=g%3;y===0?(a.up.set(0,n[g],0),a.position.set(s.x,s.y,s.z),a.lookAt(s.x+o[g],s.y,s.z)):y===1?(a.up.set(0,0,n[g]),a.position.set(s.x,s.y,s.z),a.lookAt(s.x,s.y+o[g],s.z)):(a.up.set(0,n[g],0),a.position.set(s.x,s.y,s.z),a.lookAt(s.x,s.y,s.z+o[g]));let b=this._cubeSize;this._setViewport(i,y*b,g>2?b:0,b,b),l.render(e,a)}l.autoClear=u,e.background=m}_textureToCubeUV(e,t){let r=this._renderer,i=e.mapping===Vh||e.mapping===Lf;i?this._cubemapMaterial===null&&(this._cubemapMaterial=$E(e)):this._equirectMaterial===null&&(this._equirectMaterial=qE(e));let s=i?this._cubemapMaterial:this._equirectMaterial;s.fragmentNode.value=e;let a=this._lodMeshes[0];a.material=s;let n=this._cubeSize;this._setViewport(t,0,0,3*n,2*n),r.setRenderTarget(t),r.render(a,Vp)}_applyPMREM(e){let t=this._renderer,r=t.autoClear;t.autoClear=!1;let i=this._lodMeshes.length;for(let s=1;s\\u003ci;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=r}_applyGGXFilter(e,t,r){let i=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,n=this._lodMeshes[r];n.material=a;let o=ey.get(a),l=r/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),h=Math.sqrt(l*l-u*u),d=0+l*1.25,c=h*d,{_lodMax:m}=this,g=this._sizeLods[r],y=3*g*(r>m-wl?r-m+wl:0),b=4*(this._cubeSize-g);e.texture.frame=(e.texture.frame||0)+1,o.envMap.value=e.texture,o.roughness.value=c,o.mipInt.value=m-t,this._setViewport(s,y,b,3*g,2*g),i.setRenderTarget(s),i.render(n,Vp),s.texture.frame=(s.texture.frame||0)+1,o.envMap.value=s.texture,o.roughness.value=0,o.mipInt.value=m-r,this._setViewport(e,y,b,3*g,2*g),i.setRenderTarget(e),i.render(n,Vp)}_blur(e,t,r,i,s){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,r,i,\\\"latitudinal\\\",s),this._halfBlur(a,e,r,r,i,\\\"longitudinal\\\",s)}_halfBlur(e,t,r,i,s,a,n){let o=this._renderer,l=this._blurMaterial;a!==\\\"latitudinal\\\"&&a!==\\\"longitudinal\\\"&&Ce(\\\"blur direction must be either latitudinal or longitudinal!\\\");let u=3,h=this._lodMeshes[i];h.material=l;let d=ey.get(l),c=this._sizeLods[r]-1,m=isFinite(s)?Math.PI/(2*c):2*Math.PI/(2*ju-1),g=s/m,y=isFinite(s)?1+Math.floor(u*g):ju;y>ju&&Ue(`sigmaRadians, ${s}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${ju}`);let b=[],v=0;for(let C=0;C\\u003cju;++C){let R=C/g,E=Math.exp(-R*R/2);b.push(E),C===0?v+=E:C\\u003cy&&(v+=2*E)}for(let C=0;C\\u003cb.length;C++)b[C]=b[C]/v;e.texture.frame=(e.texture.frame||0)+1,d.envMap.value=e.texture,d.samples.value=y,d.weights.array=b,d.latitudinal.value=a===\\\"latitudinal\\\"?1:0,n&&(d.poleAxis.value=n);let{_lodMax:S}=this;d.dTheta.value=m,d.mipInt.value=S-r;let T=this._sizeLods[i],w=3*T*(i>S-wl?i-S+wl:0),N=4*(this._cubeSize-T);this._setViewport(t,w,N,3*T,2*T),o.setRenderTarget(t),o.render(h,Vp)}_setViewport(e,t,r,i,s){this._renderer.isWebGLRenderer?(e.viewport.set(t,e.height-s-r,i,s),e.scissor.set(t,e.height-s-r,i,s)):(e.viewport.set(t,r,i,s),e.scissor.set(t,r,i,s))}};function JV(e){let t=[],r=[],i=[],s=e,a=e-wl+1+jE.length;for(let n=0;n\\u003ca;n++){let o=Math.pow(2,s);t.push(o);let l=1/o;n>e-wl?l=jE[n-e+wl-1]:n===0&&(l=0),r.push(l);let u=1/(o-2),h=-u,d=1+u,c=[h,h,d,h,d,d,h,h,d,d,h,d],m=6,g=6,y=3,b=2,v=1,S=new Float32Array(y*g*m),T=new Float32Array(b*g*m),w=new Float32Array(v*g*m);for(let C=0;C\\u003cm;C++){let R=C%3*2/3-1,E=C>2?0:-1,P=[R,E,0,R+2/3,E,0,R+2/3,E+1,0,R,E,0,R+2/3,E+1,0,R,E+1,0],I=YV[C];S.set(P,y*g*I),T.set(c,b*g*I);let O=[I,I,I,I,I,I];w.set(O,v*g*I)}let N=new ps;N.setAttribute(\\\"position\\\",new _i(S,y)),N.setAttribute(\\\"uv\\\",new _i(T,b)),N.setAttribute(\\\"faceIndex\\\",new _i(w,v)),i.push(new Mi(N,null)),s>wl&&s--}return{lodMeshes:i,sizeLods:t,sigmas:r}}function XE(e,t,r){let i={magFilter:lr,minFilter:lr,generateMipmaps:!1,type:Dt,format:pi,colorSpace:Xh,depthBuffer:r},s=new er(e,t,i);return s.texture.mapping=Df,s.texture.name=\\\"PMREM.cubeUv\\\",s.texture.isPMREMTexture=!0,s.scissorTest=!0,s}function ry(e){let t=new Pt;return t.depthTest=!1,t.depthWrite=!1,t.blending=Kn,t.name=`PMREM_${e}`,t}function QV(e,t,r){let i=Li(new Array(ju).fill(0)),s=Qe(new F(0,1,0)),a=Qe(0),n=D(ju),o=Qe(0),l=Qe(1),u=Ot(),h=Qe(0),d=D(1/t),c=D(1/r),m=D(e),g={n,latitudinal:o,weights:i,poleAxis:s,outputDirection:ty,dTheta:a,samples:l,envMap:u,mipInt:h,CUBEUV_TEXEL_WIDTH:d,CUBEUV_TEXEL_HEIGHT:c,CUBEUV_MAX_MIP:m},y=ry(\\\"blur\\\");return y.fragmentNode=GE({...g,latitudinal:o.equal(1)}),ey.set(y,g),y}function KV(e,t,r){let i=Ot(),s=Qe(0),a=Qe(0),n=D(1/t),o=D(1/r),l=D(e),u={envMap:i,roughness:s,mipInt:a,CUBEUV_TEXEL_WIDTH:n,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:l},h=ry(\\\"ggx\\\");return h.fragmentNode=WE({...u,N_immutable:ty,GGX_SAMPLES:Ne(XV)}),ey.set(h,u),h}function $E(e){let t=ry(\\\"cubemap\\\");return t.fragmentNode=Ts(e,ty),t}function qE(e){let t=ry(\\\"equirect\\\");return t.fragmentNode=Ot(e,$T(ty),0),t}var YE=new WeakMap;function eG(e){let t=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:r,maxMip:t}}function tG(e,t,r){let i=rG(t),s=i.get(e);if((s!==void 0?s.pmremVersion:-1)!==e.pmremVersion){let a=e.image;if(e.isCubeTexture)if(sG(a))s=r.fromCubemap(e,s);else return null;else if(aG(a))s=r.fromEquirectangular(e,s);else return null;if(s.pmremVersion=e.pmremVersion,i.has(e)===!1){let n=()=>{e.removeEventListener(\\\"dispose\\\",n);let o=i.get(e);o!==void 0&&(o.dispose(),i.delete(e))};e.addEventListener(\\\"dispose\\\",n)}i.set(e,s)}return s.texture}function rG(e){let t=YE.get(e);return t===void 0&&(t=new WeakMap,YE.set(e,t)),t}var iG=class extends rr{static get type(){return\\\"PMREMNode\\\"}constructor(e,t=null,r=null){super(\\\"vec3\\\"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=r,this._generator=null;let i=new ji;i.isRenderTargetTexture=!0,this._texture=Ot(i),this._width=Qe(0),this._height=Qe(0),this._maxMip=Qe(0),this.updateBeforeType=ut.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){let t=eG(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(e){let t=this._pmrem,r=t?t.pmremVersion:-1,i=this._value;r!==i.pmremVersion&&(i.isPMREMTexture===!0||i.mapping===Df?t=i:t=tG(i,e.renderer,this._generator),t!==null&&(this._pmrem=t,this.updateFromTexture(t)))}setup(e){this._generator===null&&(this._generator=new ZV(e.renderer)),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this,e)),t=this._pmrem.isRenderTargetTexture?I0.mul(K(t.x,t.y.negate(),t.z)):I0.mul(t);let r=this.levelNode;return r===null&&e.context.getTextureLevel&&(r=e.context.getTextureLevel(this)),VE(this._texture,t,r,this._width,this._height,this._maxMip)}dispose(){super.dispose(),this._generator!==null&&this._generator.dispose()}};function sG(e){if(e==null)return!1;let t=0,r=6;for(let i=0;i\\u003cr;i++)e[i]!==void 0&&t++;return t===r}function aG(e){return e==null?!1:e.height>0}var cS=Mt(iG).setParameterLength(1,3),ZE=new WeakMap,nG=class extends Ed{static get type(){return\\\"EnvironmentNode\\\"}constructor(e=null){super(),this.envNode=e}setup(e){let{material:t}=e,r=this.envNode;if(r.isTextureNode||r.isMaterialReferenceNode){let u=r.isTextureNode?r.value:t[r.property],h=this._getPMREMNodeCache(e.renderer),d=h.get(u);d===void 0&&(d=cS(u),h.set(u,d)),r=d}let i=t.useAnisotropy===!0||t.anisotropy>0?pR:Ut,s=r.context(JE(_n,i)).mul(B0),a=r.context(oG(vl)).mul(Math.PI).mul(B0),n=wd(s),o=wd(a);e.context.radiance.addAssign(n),e.context.iblIrradiance.addAssign(o);let l=e.context.lightingModel.clearcoatRadiance;if(l){let u=r.context(JE(Td,bl)).mul(B0),h=wd(u);l.addAssign(h)}}_getPMREMNodeCache(e){let t=ZE.get(e);return t===void 0&&(t=new WeakMap,ZE.set(e,t)),t}},JE=(e,t)=>{let r=null;return{getUV:()=>(r===null&&(r=ar.negate().reflect(t),r=Gb(e).mix(r,t).normalize(),r=r.transformDirection(Ip)),r),getTextureLevel:()=>e}},oG=e=>({getUV:()=>e,getTextureLevel:()=>D(1)}),lG=new AN,pS=class extends Pt{static get type(){return\\\"MeshStandardNodeMaterial\\\"}constructor(e){super(),this.isMeshStandardNodeMaterial=!0,this.lights=!0,this.emissiveNode=null,this.metalnessNode=null,this.roughnessNode=null,this.setDefaultValues(lG),this.setValues(e)}setupEnvironment(e){let t=super.setupEnvironment(e);return t===null&&e.environmentNode&&(t=e.environmentNode),t?new nG(t):null}setupLightingModel(){return new kE}setupSpecular(){let e=Ct(K(.04),Zt.rgb,yo);cl.assign(K(.04)),Ru.assign(e),Eu.assign(1)}setupVariants(){let e=this.metalnessNode?D(this.metalnessNode):_R;yo.assign(e);let t=this.roughnessNode?D(this.roughnessNode):SR;t=ZT({roughness:t}),_n.assign(t),this.setupSpecular(),Au.assign(Zt.rgb.mul(e.oneMinus()))}},uG=new RO,mS=class extends pS{static get type(){return\\\"MeshPhysicalNodeMaterial\\\"}constructor(e){super(),this.isMeshPhysicalNodeMaterial=!0,this.clearcoatNode=null,this.clearcoatRoughnessNode=null,this.clearcoatNormalNode=null,this.sheenNode=null,this.sheenRoughnessNode=null,this.iridescenceNode=null,this.iridescenceIORNode=null,this.iridescenceThicknessNode=null,this.specularIntensityNode=null,this.specularColorNode=null,this.iorNode=null,this.transmissionNode=null,this.thicknessNode=null,this.attenuationDistanceNode=null,this.attenuationColorNode=null,this.dispersionNode=null,this.anisotropyNode=null,this.setDefaultValues(uG),this.setValues(e)}get useClearcoat(){return this.clearcoat>0||this.clearcoatNode!==null}get useIridescence(){return this.iridescence>0||this.iridescenceNode!==null}get useSheen(){return this.sheen>0||this.sheenNode!==null}get useAnisotropy(){return this.anisotropy>0||this.anisotropyNode!==null}get useTransmission(){return this.transmission>0||this.transmissionNode!==null}get useDispersion(){return this.dispersion>0||this.dispersionNode!==null}setupSpecular(){let e=this.iorNode?D(this.iorNode):DR;Rp.assign(e),cl.assign(Rs(Vb(Rp.sub(1).div(Rp.add(1))).mul(TR),K(1)).mul(RT)),Ru.assign(Ct(cl,Zt.rgb,yo)),Eu.assign(Ct(RT,1,yo))}setupLightingModel(){return new kE(this.useClearcoat,this.useSheen,this.useIridescence,this.useAnisotropy,this.useTransmission,this.useDispersion)}setupVariants(e){if(super.setupVariants(e),this.useClearcoat){let t=this.clearcoatNode?D(this.clearcoatNode):MR,r=this.clearcoatRoughnessNode?D(this.clearcoatRoughnessNode):NR;s0.assign(t),Td.assign(ZT({roughness:r}))}if(this.useSheen){let t=this.sheenNode?K(this.sheenNode):RR,r=this.sheenRoughnessNode?D(this.sheenRoughnessNode):ER;Ws.assign(t),hl.assign(r)}if(this.useIridescence){let t=this.iridescenceNode?D(this.iridescenceNode):BR,r=this.iridescenceIORNode?D(this.iridescenceIORNode):IR,i=this.iridescenceThicknessNode?D(this.iridescenceThicknessNode):FR;a0.assign(t),n0.assign(r),o0.assign(i)}if(this.useAnisotropy){let t=(this.anisotropyNode?ke(this.anisotropyNode):PR).toVar();dl.assign(t.length()),et(dl.equal(0),()=>{t.assign(ke(1,0))}).Else(()=>{t.divAssign(ke(dl)),dl.assign(dl.saturate())}),l0.assign(dl.pow2().mix(_n.pow2(),1)),Ap.assign(Uu[0].mul(t.x).add(Uu[1].mul(t.y))),Cu.assign(Uu[1].mul(t.x).sub(Uu[0].mul(t.y)))}if(this.useTransmission){let t=this.transmissionNode?D(this.transmissionNode):LR,r=this.thicknessNode?D(this.thicknessNode):kR,i=this.attenuationDistanceNode?D(this.attenuationDistanceNode):OR,s=this.attenuationColorNode?K(this.attenuationColorNode):UR;if(h0.assign(t),Mb.assign(r),Nb.assign(i),Ab.assign(s),this.useDispersion){let a=this.dispersionNode?D(this.dispersionNode):VR;Cb.assign(a)}}}setupClearcoatNormal(){return this.clearcoatNormalNode?K(this.clearcoatNormalNode):AR}setup(e){e.context.setupClearcoatNormal=()=>Iu(this.setupClearcoatNormal(e),\\\"NORMAL\\\",\\\"vec3\\\"),super.setup(e)}},hG=Q(({normal:e,lightDirection:t,builder:r})=>{let i=e.dot(t),s=ke(i.mul(.5).add(.5),0);if(r.material.gradientMap){let a=To(\\\"gradientMap\\\",\\\"texture\\\").context({getUV:()=>s});return K(a.r)}else{let a=s.fwidth().mul(.5);return Ct(K(.7),K(1),Hs(D(.7).sub(a.x),D(.7).add(a.x),s.x))}}),dG=class extends $0{direct({lightDirection:e,lightColor:t,reflectedLight:r},i){let s=hG({normal:P0,lightDirection:e,builder:i}).mul(t);r.directDiffuse.addAssign(s.mul(Wu({diffuseColor:Zt.rgb})))}indirect(e){let{ambientOcclusion:t,irradiance:r,reflectedLight:i}=e.context;i.indirectDiffuse.addAssign(r.mul(Wu({diffuseColor:Zt}))),i.indirectDiffuse.mulAssign(t)}},cG=new PO,pG=class extends Pt{static get type(){return\\\"MeshToonNodeMaterial\\\"}constructor(e){super(),this.isMeshToonNodeMaterial=!0,this.lights=!0,this.setDefaultValues(cG),this.setValues(e)}setupLightingModel(){return new dG}},QE=Q(()=>{let e=K(ar.z,0,ar.x.negate()).normalize(),t=ar.cross(e);return ke(e.dot(Ut),t.dot(Ut)).mul(.495).add(.5)}).once([\\\"NORMAL\\\",\\\"VERTEX\\\"])().toVar(\\\"matcapUV\\\"),mG=new FO,fG=class extends Pt{static get type(){return\\\"MeshMatcapNodeMaterial\\\"}constructor(e){super(),this.isMeshMatcapNodeMaterial=!0,this.setDefaultValues(mG),this.setValues(e)}setupVariants(e){let t=QE,r;e.material.matcap?r=To(\\\"matcap\\\",\\\"texture\\\").context({getUV:()=>t}):r=K(Ct(.2,.8,t.y)),Zt.rgb.mulAssign(r.rgb)}},gG=class extends rr{static get type(){return\\\"RotateNode\\\"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}generateNodeType(e){return this.positionNode.getNodeType(e)}setup(e){let{rotationNode:t,positionNode:r}=this;if(this.getNodeType(e)===\\\"vec2\\\"){let i=t.cos(),s=t.sin();return i0(i,s,s.negate(),i).mul(r)}else{let i=t,s=ul(Ve(1,0,0,0),Ve(0,Ua(i.x),xs(i.x).negate(),0),Ve(0,xs(i.x),Ua(i.x),0),Ve(0,0,0,1)),a=ul(Ve(Ua(i.y),0,xs(i.y),0),Ve(0,1,0,0),Ve(xs(i.y).negate(),0,Ua(i.y),0),Ve(0,0,0,1)),n=ul(Ve(Ua(i.z),xs(i.z).negate(),0,0),Ve(xs(i.z),Ua(i.z),0,0),Ve(0,0,1,0),Ve(0,0,0,1));return s.mul(a).mul(n).mul(Ve(r,1)).xyz}}},Gp=Mt(gG).setParameterLength(2),yG=new D4,KE=class extends Pt{static get type(){return\\\"SpriteNodeMaterial\\\"}constructor(e){super(),this.isSpriteNodeMaterial=!0,this._useSizeAttenuation=!0,this.positionNode=null,this.rotationNode=null,this.scaleNode=null,this.transparent=!0,this.setDefaultValues(yG),this.setValues(e)}setupPositionView(e){let{object:t,camera:r}=e,{positionNode:i,rotationNode:s,scaleNode:a,sizeAttenuation:n}=this,o=Cn.mul(K(i||0)),l=ke(ga[0].xyz.length(),ga[1].xyz.length());a!==null&&(l=l.mul(ke(a))),r.isPerspectiveCamera&&n===!1&&(l=l.mul(o.z.negate()));let u=Ji.xy;if(t.center&&t.center.isVector2===!0){let c=x6(\\\"center\\\",\\\"vec2\\\",t);u=u.sub(c.sub(.5))}u=u.mul(l);let h=D(s||CR),d=Gp(u,h);return Ve(o.xy.add(d),o.zw)}get sizeAttenuation(){return this._useSizeAttenuation}set sizeAttenuation(e){this._useSizeAttenuation!==e&&(this._useSizeAttenuation=e,this.needsUpdate=!0)}},xG=new W4,vG=new fe,bG=class extends KE{static get type(){return\\\"PointsNodeMaterial\\\"}constructor(e){super(),this.sizeNode=null,this.isPointsNodeMaterial=!0,this.setDefaultValues(xG),this.setValues(e)}setupPositionView(){let{positionNode:e}=this;return Cn.mul(K(e||wr)).xyz}setupVertexSprite(e){let{material:t,camera:r}=e,{rotationNode:i,scaleNode:s,sizeNode:a,sizeAttenuation:n}=this,o=super.setupVertex(e);if(t.isNodeMaterial!==!0)return o;let l=a!==null?ke(a):zR;l=l.mul(aT),r.isPerspectiveCamera&&n===!0&&(l=l.mul(TG.div(Wr.z.negate()))),s&&s.isNode&&(l=l.mul(ke(s)));let u=Ji.xy;if(i&&i.isNode){let h=D(i);u=Gp(u,h)}return u=u.mul(l),u=u.div(nT.div(2)),u=u.mul(o.w),o=o.add(Ve(u,0,0)),o}setupVertex(e){return e.object.isPoints?super.setupVertex(e):this.setupVertexSprite(e)}get alphaToCoverage(){return this._useAlphaToCoverage}set alphaToCoverage(e){this._useAlphaToCoverage!==e&&(this._useAlphaToCoverage=e,this.needsUpdate=!0)}},TG=Qe(1).onFrameUpdate(function({renderer:e}){let t=e.getSize(vG);this.value=.5*t.y}),SG=class extends $0{constructor(){super(),this.shadowNode=D(1).toVar(\\\"shadowMask\\\")}direct({lightNode:e}){e.shadowNode!==null&&this.shadowNode.mulAssign(e.shadowNode)}finish({context:e}){Zt.a.mulAssign(this.shadowNode.oneMinus()),e.outgoingLight.rgb.assign(Zt.rgb)}},_G=new CO,wG=class extends Pt{static get type(){return\\\"ShadowNodeMaterial\\\"}constructor(e){super(),this.isShadowNodeMaterial=!0,this.lights=!0,this.transparent=!0,this.setDefaultValues(_G),this.setValues(e)}setupLightingModel(){return new SG}},N0e=go(\\\"vec3\\\"),A0e=go(\\\"vec3\\\"),C0e=go(\\\"vec3\\\"),MG=class{constructor(e,t,r){this.renderer=e,this.nodes=t,this.info=r,this._context=typeof self\\u003c\\\"u\\\"?self:null,this._animationLoop=null,this._requestId=null}start(){let e=(t,r)=>{this._requestId=this._context.requestAnimationFrame(e),this.info.autoReset===!0&&this.info.reset(),this.nodes.nodeFrame.update(),this.info.frame=this.nodes.nodeFrame.frameId,this.renderer._inspector.begin(),this._animationLoop!==null&&this._animationLoop(t,r),this.renderer._inspector.finish()};e()}stop(){this._context!==null&&this._context.cancelAnimationFrame(this._requestId),this._requestId=null}getAnimationLoop(){return this._animationLoop}setAnimationLoop(e){this._animationLoop=e}getContext(){return this._context}setContext(e){this._context=e}dispose(){this.stop()}},Ml=class{constructor(){this.weakMaps={}}_getWeakMap(e){let t=e.length,r=this.weakMaps[t];return r===void 0&&(r=new WeakMap,this.weakMaps[t]=r),r}get(e){let t=this._getWeakMap(e);for(let r=0;r\\u003ce.length-1;r++)if(t=t.get(e[r]),t===void 0)return;return t.get(e[e.length-1])}set(e,t){let r=this._getWeakMap(e);for(let i=0;i\\u003ce.length-1;i++){let s=e[i];r.has(s)===!1&&r.set(s,new WeakMap),r=r.get(s)}return r.set(e[e.length-1],t),this}delete(e){let t=this._getWeakMap(e);for(let r=0;r\\u003ce.length-1;r++)if(t=t.get(e[r]),t===void 0)return!1;return t.delete(e[e.length-1])}},NG=0,eP=new WeakMap;function AG(e){let t=Object.keys(e),r=eP.get(e.constructor);if(r===void 0){r=[];let i=Object.getPrototypeOf(e);for(;i;){let s=Object.getOwnPropertyDescriptors(i);for(let a in s){let n=s[a];n&&typeof n.get==\\\"function\\\"&&r.push(a)}i=Object.getPrototypeOf(i)}eP.set(e.constructor,r)}for(let i=0;i\\u003cr.length;i++)t.push(r[i]);return t}var CG=class{constructor(e,t,r,i,s,a,n,o,l,u){this.id=NG++,this._nodes=e,this._geometries=t,this.renderer=r,this.object=i,this.material=s,this.scene=a,this.camera=n,this.lightsNode=o,this.context=l,this.geometry=i.geometry,this.version=s.version,this.drawRange=null,this.attributes=null,this.attributesId=null,this.pipeline=null,this.group=null,this.vertexBuffers=null,this.drawParams=null,this.bundle=null,this.clippingContext=u,this.clippingContextCacheKey=u!==null?u.cacheKey:\\\"\\\",this.initialNodesCacheKey=this.getDynamicCacheKey(),this.initialCacheKey=this.getCacheKey(),this._nodeBuilderState=null,this._bindings=null,this._monitor=null,this._sourceMaterial=r._currentSourceMaterial,this.onDispose=null,this.isRenderObject=!0,this.onMaterialDispose=()=>{this.dispose()},this.onGeometryDispose=()=>{this.attributes=null,this.attributesId=null},this.material.addEventListener(\\\"dispose\\\",this.onMaterialDispose),this.geometry.addEventListener(\\\"dispose\\\",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.addEventListener(\\\"dispose\\\",this.onMaterialDispose)}updateClipping(e){this.clippingContext=e}get clippingNeedsUpdate(){return this.clippingContext===null||this.clippingContext.cacheKey===this.clippingContextCacheKey?!1:(this.clippingContextCacheKey=this.clippingContext.cacheKey,!0)}get hardwareClippingPlanes(){return this.getNodeBuilderState().hardwareClipping===!0?this.clippingContext.unionClippingCount:0}getNodeBuilderState(){return this._nodeBuilderState||(this._nodeBuilderState=this._nodes.getForRender(this))}getMonitor(){return this._monitor||(this._monitor=this.getNodeBuilderState().observer)}getBindings(){return this._bindings||(this._bindings=this.getNodeBuilderState().createBindings())}getBindingGroup(e){for(let t of this.getBindings())if(t.name===e)return t}getIndex(){return this._geometries.getIndex(this)}getIndirect(){return this._geometries.getIndirect(this)}getIndirectOffset(){return this._geometries.getIndirectOffset(this)}getChainArray(){return[this.object,this.material,this.context,this.lightsNode]}setGeometry(e){this.geometry=e,this.attributes=null,this.attributesId=null}getAttributes(){if(this.attributes!==null)return this.attributes;let e=this.getNodeBuilderState().nodeAttributes,t=this.geometry,r=[],i=new Set,s={};for(let a of e){let n;if(a.node&&a.node.attribute?n=a.node.attribute:(n=t.getAttribute(a.name),n!==void 0&&(n.isInterleavedBufferAttribute?s[a.name]=n.data.uuid:s[a.name]=n.id)),n===void 0)continue;r.push(n);let o=n.isInterleavedBufferAttribute?n.data:n;i.add(o)}return this.attributes=r,this.attributesId=s,this.vertexBuffers=Array.from(i.values()),r}getVertexBuffers(){return this.vertexBuffers===null&&this.getAttributes(),this.vertexBuffers}getDrawParameters(){let{object:e,material:t,geometry:r,group:i,drawRange:s}=this,a=this.drawParams||(this.drawParams={vertexCount:0,firstVertex:0,instanceCount:0,firstInstance:0}),n=this.getIndex(),o=n!==null,l=1;if(r.isInstancedBufferGeometry===!0?l=r.instanceCount:e.count!==void 0&&(l=Math.max(0,e.count)),l===0)return null;if(a.instanceCount=l,e.isBatchedMesh===!0)return a;let u=1;t.wireframe===!0&&!e.isPoints&&!e.isLineSegments&&!e.isLine&&!e.isLineLoop&&(u=2);let h=s.start*u,d=(s.start+s.count)*u;i!==null&&(h=Math.max(h,i.start*u),d=Math.min(d,(i.start+i.count)*u));let c=r.attributes.position,m=1/0;o?m=n.count:c!=null&&(m=c.count),h=Math.max(h,0),d=Math.min(d,m);let g=d-h;return g\\u003c0||g===1/0?null:(a.vertexCount=g,a.firstVertex=h,a)}getGeometryCacheKey(){let{geometry:e}=this,t=\\\"\\\";for(let r of Object.keys(e.attributes).sort()){let i=e.attributes[r];t+=r+\\\",\\\",i.data&&(t+=i.data.stride+\\\",\\\"),i.offset&&(t+=i.offset+\\\",\\\"),i.itemSize&&(t+=i.itemSize+\\\",\\\"),i.normalized&&(t+=\\\"n,\\\")}for(let r of Object.keys(e.morphAttributes).sort()){let i=e.morphAttributes[r];t+=\\\"morph-\\\"+r+\\\",\\\";for(let s=0,a=i.length;s\\u003ca;s++){let n=i[s];t+=n.id+\\\",\\\"}}return e.index&&(t+=\\\"index,\\\"),t}getMaterialCacheKey(){let{object:e,material:t,renderer:r}=this,i=t.customProgramCacheKey();for(let s of AG(t)){if(/^(is[A-Z]|_)|^(visible|version|uuid|name|opacity|userData)$/.test(s))continue;let a=t[s],n;if(a!==null){let o=typeof a;o===\\\"number\\\"?s===\\\"side\\\"?n=String(a):n=a!==0?\\\"1\\\":\\\"0\\\":o===\\\"object\\\"?(n=\\\"{\\\",a.isTexture&&(n+=a.mapping,r.backend.isWebGPUBackend===!0&&(n+=a.magFilter,n+=a.minFilter,n+=a.wrapS,n+=a.wrapT,n+=a.wrapR)),n+=\\\"}\\\"):n=String(a)}else n=String(a);i+=n+\\\",\\\"}return i+=this.clippingContextCacheKey+\\\",\\\",e.geometry&&(i+=this.getGeometryCacheKey()),e.skeleton&&(i+=e.skeleton.bones.length+\\\",\\\"),e.isBatchedMesh&&(i+=e._matricesTexture.uuid+\\\",\\\",e._colorsTexture!==null&&(i+=e._colorsTexture.uuid+\\\",\\\")),(e.isInstancedMesh||e.count>1)&&(i+=e.uuid+\\\",\\\"),i+=this.context.id+\\\",\\\",i+=e.receiveShadow+\\\",\\\",yd(i)}get needsGeometryUpdate(){if(this.geometry.id!==this.object.geometry.id)return!0;if(this.attributes!==null){let e=this.attributesId;for(let t in e){let r=this.geometry.getAttribute(t);if(r===void 0)return!0;let i=r.isInterleavedBufferAttribute?r.data.uuid:r.id;if(e[t]!==i)return!0}}return!1}get needsUpdate(){return this.initialNodesCacheKey!==this.getDynamicCacheKey()||this.clippingNeedsUpdate}getDynamicCacheKey(){let e=0;return this.material.isShadowPassMaterial!==!0&&(e=this._nodes.getCacheKey(this.scene,this.lightsNode)),this.camera.isArrayCamera&&(e=_p(e,this.camera.cameras.length)),this.object.receiveShadow&&(e=_p(e,1)),e=_p(e,this.renderer.contextNode.id,this.renderer.contextNode.version),e}getCacheKey(){return this.getMaterialCacheKey()+this.getDynamicCacheKey()}dispose(){this.material.removeEventListener(\\\"dispose\\\",this.onMaterialDispose),this.geometry.removeEventListener(\\\"dispose\\\",this.onGeometryDispose),this._sourceMaterial!==null&&this._sourceMaterial.removeEventListener(\\\"dispose\\\",this.onMaterialDispose),this.onDispose()}},Pn=[],RG=class{constructor(e,t,r,i,s,a){this.renderer=e,this.nodes=t,this.geometries=r,this.pipelines=i,this.bindings=s,this.info=a,this.chainMaps={}}get(e,t,r,i,s,a,n,o){let l=this.getChainMap(o);Pn[0]=e,Pn[1]=t,Pn[2]=a,Pn[3]=s;let u=l.get(Pn);return u===void 0?(u=this.createRenderObject(this.nodes,this.geometries,this.renderer,e,t,r,i,s,a,n,o),l.set(Pn,u)):(u.camera=i,u.updateClipping(n),u.needsGeometryUpdate&&u.setGeometry(e.geometry),(u.version!==t.version||u.needsUpdate)&&(u.initialCacheKey!==u.getCacheKey()?(u.dispose(),u=this.get(e,t,r,i,s,a,n,o)):u.version=t.version)),Pn[0]=null,Pn[1]=null,Pn[2]=null,Pn[3]=null,u}getChainMap(e=\\\"default\\\"){return this.chainMaps[e]||(this.chainMaps[e]=new Ml)}dispose(){this.chainMaps={}}createRenderObject(e,t,r,i,s,a,n,o,l,u,h){let d=this.getChainMap(h),c=new CG(e,t,r,i,s,a,n,o,l,u);return c.onDispose=()=>{this.pipelines.delete(c),this.bindings.deleteForRender(c),this.nodes.delete(c),d.delete(c.getChainArray())},c}},Nl=class{constructor(){this.data=new WeakMap}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}delete(e){let t=null;return this.data.has(e)&&(t=this.data.get(e),this.data.delete(e)),t}has(e){return this.data.has(e)}dispose(){this.data=new WeakMap}},ya={VERTEX:1,INDEX:2,STORAGE:3,INDIRECT:4},Al=16,EG=211,PG=212,BG=class extends Nl{constructor(e,t){super(),this.backend=e,this.info=t}delete(e){let t=super.delete(e);return t!==null&&(this.backend.destroyAttribute(e),this.info.destroyAttribute(e)),t}update(e,t){let r=this.get(e);if(r.version===void 0)t===ya.VERTEX?(this.backend.createAttribute(e),this.info.createAttribute(e)):t===ya.INDEX?(this.backend.createIndexAttribute(e),this.info.createIndexAttribute(e)):t===ya.STORAGE?(this.backend.createStorageAttribute(e),this.info.createStorageAttribute(e)):t===ya.INDIRECT&&(this.backend.createIndirectStorageAttribute(e),this.info.createIndirectStorageAttribute(e)),r.version=this._getBufferAttribute(e).version;else{let i=this._getBufferAttribute(e);(r.version\\u003ci.version||i.usage===rp)&&(this.backend.updateAttribute(e),r.version=i.version)}}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}};function tP(e){return e.index!==null?e.index.version:e.attributes.position.version}function rP(e){return e.index!==null?e.index.id:e.attributes.position.id}function iP(e){let t=[],r=e.index,i=e.attributes.position;if(r!==null){let a=r.array;for(let n=0,o=a.length;n\\u003co;n+=3){let l=a[n+0],u=a[n+1],h=a[n+2];t.push(l,u,u,h,h,l)}}else{let a=i.array;for(let n=0,o=a.length/3-1;n\\u003co;n+=3){let l=n+0,u=n+1,h=n+2;t.push(l,u,u,h,h,l)}}let s=new(i.count>=65535?iN:rN)(t,1);return s.version=tP(e),s.__id=rP(e),s}var IG=class extends Nl{constructor(e,t){super(),this.attributes=e,this.info=t,this.wireframes=new WeakMap,this.attributeCall=new WeakMap,this._geometryDisposeListeners=new Map}has(e){let t=e.geometry;return super.has(t)&&this.get(t).initialized===!0}updateForRender(e){this.has(e)===!1&&this.initGeometry(e),this.updateAttributes(e)}initGeometry(e){let t=e.geometry,r=this.get(t);r.initialized=!0,this.info.memory.geometries++;let i=()=>{this.info.memory.geometries--;let s=t.index,a=e.getAttributes();s!==null&&this.attributes.delete(s);for(let o of a)this.attributes.delete(o);let n=this.wireframes.get(t);n!==void 0&&this.attributes.delete(n),t.removeEventListener(\\\"dispose\\\",i),this._geometryDisposeListeners.delete(t)};t.addEventListener(\\\"dispose\\\",i),this._geometryDisposeListeners.set(t,i)}updateAttributes(e){let t=e.getAttributes();for(let s of t)s.isStorageBufferAttribute||s.isStorageInstancedBufferAttribute?this.updateAttribute(s,ya.STORAGE):this.updateAttribute(s,ya.VERTEX);let r=this.getIndex(e);r!==null&&this.updateAttribute(r,ya.INDEX);let i=e.geometry.indirect;i!==null&&this.updateAttribute(i,ya.INDIRECT)}updateAttribute(e,t){let r=this.info.render.calls;e.isInterleavedBufferAttribute?this.attributeCall.get(e)===void 0?(this.attributes.update(e,t),this.attributeCall.set(e,r)):this.attributeCall.get(e.data)!==r&&(this.attributes.update(e,t),this.attributeCall.set(e.data,r),this.attributeCall.set(e,r)):this.attributeCall.get(e)!==r&&(this.attributes.update(e,t),this.attributeCall.set(e,r))}getIndirect(e){return e.geometry.indirect}getIndirectOffset(e){return e.geometry.indirectOffset}getIndex(e){let{geometry:t,material:r}=e,i=t.index;if(r.wireframe===!0){let s=this.wireframes,a=s.get(t);a===void 0?(a=iP(t),s.set(t,a)):(a.version!==tP(t)||a.__id!==rP(t))&&(this.attributes.delete(a),a=iP(t),s.set(t,a)),i=a}return i}dispose(){for(let[e,t]of this._geometryDisposeListeners.entries())e.removeEventListener(\\\"dispose\\\",t);this._geometryDisposeListeners.clear()}},FG=class{constructor(){this.autoReset=!0,this.frame=0,this.calls=0,this.render={calls:0,frameCalls:0,drawCalls:0,triangles:0,points:0,lines:0,timestamp:0},this.compute={calls:0,frameCalls:0,timestamp:0},this.memory={attributes:0,attributesSize:0,geometries:0,indexAttributes:0,indexAttributesSize:0,indirectStorageAttributes:0,indirectStorageAttributesSize:0,programs:0,programsSize:0,readbackBuffers:0,readbackBuffersSize:0,renderTargets:0,storageAttributes:0,storageAttributesSize:0,textures:0,texturesSize:0,uniformBuffers:0,uniformBuffersSize:0,total:0},this.memoryMap=new Map}update(e,t,r){this.render.drawCalls++,e.isMesh||e.isSprite?this.render.triangles+=r*(t/3):e.isPoints?this.render.points+=r*t:e.isLineSegments?this.render.lines+=r*(t/2):e.isLine?this.render.lines+=r*(t-1):Ce(\\\"WebGPUInfo: Unknown object type.\\\")}reset(){this.render.drawCalls=0,this.render.frameCalls=0,this.compute.frameCalls=0,this.render.triangles=0,this.render.points=0,this.render.lines=0}dispose(){this.reset(),this.calls=0,this.render.calls=0,this.compute.calls=0,this.render.timestamp=0,this.compute.timestamp=0;for(let e in this.memory)this.memory[e]=0;this.memoryMap.clear()}createTexture(e){let t=this._getTextureMemorySize(e);this.memoryMap.set(e,t),this.memory.textures++,this.memory.total+=t,this.memory.texturesSize+=t}destroyTexture(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.textures--,this.memory.total-=t,this.memory.texturesSize-=t}_createAttribute(e,t){let r=this._getAttributeMemorySize(e);this.memoryMap.set(e,{size:r,type:t}),this.memory[t]++,this.memory.total+=r,this.memory[t+\\\"Size\\\"]+=r}createAttribute(e){this._createAttribute(e,\\\"attributes\\\")}createIndexAttribute(e){this._createAttribute(e,\\\"indexAttributes\\\")}createStorageAttribute(e){this._createAttribute(e,\\\"storageAttributes\\\")}createIndirectStorageAttribute(e){this._createAttribute(e,\\\"indirectStorageAttributes\\\")}destroyAttribute(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory[t.type]--,this.memory.total-=t.size,this.memory[t.type+\\\"Size\\\"]-=t.size)}createReadbackBuffer(e){let t=e.maxByteLength;this.memoryMap.set(e,{size:t,type:\\\"readbackBuffers\\\"}),this.memory.readbackBuffers++,this.memory.total+=t,this.memory.readbackBuffersSize+=t}destroyReadbackBuffer(e){let{size:t}=this.memoryMap.get(e);this.memoryMap.delete(e),this.memory.readbackBuffers--,this.memory.total-=t,this.memory.readbackBuffersSize-=t}createUniformBuffer(e){let t=e.byteLength;this.memoryMap.set(e,{size:t,type:\\\"uniformBuffers\\\"}),this.memory.uniformBuffers++,this.memory.total+=t,this.memory.uniformBuffersSize+=t}destroyUniformBuffer(e){let t=this.memoryMap.get(e);t&&(this.memoryMap.delete(e),this.memory.uniformBuffers--,this.memory.total-=t.size,this.memory.uniformBuffersSize-=t.size)}createProgram(e){let t=e.code.length;this.memoryMap.set(e,t),this.memory.programs++,this.memory.total+=t,this.memory.programsSize+=t}destroyProgram(e){let t=this.memoryMap.get(e)||0;this.memoryMap.delete(e),this.memory.programs--,this.memory.total-=t,this.memory.programsSize-=t}_getTextureMemorySize(e){if(e.isCompressedTexture)return 1;let t=1;e.type===cu||e.type===Si?t=1:e.type===pu||e.type===Ko||e.type===Dt?t=2:(e.type===ci||e.type===gr||e.type===Er)&&(t=4);let r=4;e.format===ov||e.format===io||e.format===jh||e.format===ua||e.format===ln?r=1:e.format===ha||e.format===Hh?r=2:(e.format===Wh||e.format===lv)&&(r=3);let i=t*r;e.type===av||e.type===nv?i=2:(e.type===ro||e.type===Of||e.type===Uf)&&(i=4);let s=e.width||1,a=e.height||1,n=e.isCubeTexture?6:e.depth||1,o=s*a*n*i,l=e.mipmaps;if(l&&l.length>0){let u=0;for(let h=0;h\\u003cl.length;h++){let d=l[h];if(d.data)u+=d.data.byteLength;else{let c=d.width||Math.max(1,s>>h),m=d.height||Math.max(1,a>>h);u+=c*m*n*i}}o+=u}else e.generateMipmaps&&(o=o*1.333);return Math.round(o)}_getAttributeMemorySize(e){return e.isInterleavedBufferAttribute&&(e=e.data),e.array?e.array.byteLength:e.count&&e.itemSize?e.count*e.itemSize*4:0}},sP=class{constructor(e){this.cacheKey=e,this.usedTimes=0}},LG=class extends sP{constructor(e,t,r){super(e),this.vertexProgram=t,this.fragmentProgram=r}},kG=class extends sP{constructor(e,t){super(e),this.computeProgram=t,this.isComputePipeline=!0}},DG=0,fS=class{constructor(e,t,r,i=null,s=null){this.id=DG++,this.code=e,this.stage=t,this.name=r,this.transforms=i,this.attributes=s,this.usedTimes=0}},OG=class extends Nl{constructor(e,t,r){super(),this.backend=e,this.nodes=t,this.info=r,this.bindings=null,this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}getForCompute(e,t){let{backend:r}=this,i=this.get(e);if(this._needsComputeUpdate(e)){let s=i.pipeline;s&&(s.usedTimes--,s.computeProgram.usedTimes--);let a=this.nodes.getForCompute(e),n=this.programs.compute.get(a.computeShader);n===void 0&&(s&&s.computeProgram.usedTimes===0&&this._releaseProgram(s.computeProgram),n=new fS(a.computeShader,\\\"compute\\\",e.name,a.transforms,a.nodeAttributes),this.programs.compute.set(a.computeShader,n),r.createProgram(n),this.info.createProgram(n));let o=this._getComputeCacheKey(e,n),l=this.caches.get(o);l===void 0&&(s&&s.usedTimes===0&&this._releasePipeline(s),l=this._getComputePipeline(e,n,o,t)),l.usedTimes++,n.usedTimes++,i.version=e.version,i.pipeline=l}return i.pipeline}getForRender(e,t=null){let{backend:r}=this,i=this.get(e);if(this._needsRenderUpdate(e)){let s=i.pipeline;s&&(s.usedTimes--,s.vertexProgram.usedTimes--,s.fragmentProgram.usedTimes--);let a=e.getNodeBuilderState(),n=e.material?e.material.name:\\\"\\\",o=this.programs.vertex.get(a.vertexShader);o===void 0&&(s&&s.vertexProgram.usedTimes===0&&this._releaseProgram(s.vertexProgram),o=new fS(a.vertexShader,\\\"vertex\\\",n),this.programs.vertex.set(a.vertexShader,o),r.createProgram(o),this.info.createProgram(o));let l=this.programs.fragment.get(a.fragmentShader);l===void 0&&(s&&s.fragmentProgram.usedTimes===0&&this._releaseProgram(s.fragmentProgram),l=new fS(a.fragmentShader,\\\"fragment\\\",n),this.programs.fragment.set(a.fragmentShader,l),r.createProgram(l),this.info.createProgram(l));let u=this._getRenderCacheKey(e,o,l),h=this.caches.get(u);h===void 0?(s&&s.usedTimes===0&&this._releasePipeline(s),h=this._getRenderPipeline(e,o,l,u,t)):e.pipeline=h,h.usedTimes++,o.usedTimes++,l.usedTimes++,i.pipeline=h}return i.pipeline}isReady(e){let t=this.get(e).pipeline;if(t===void 0)return!1;let r=this.backend.get(t);return r.pipeline!==void 0&&r.pipeline!==null}delete(e){let t=this.get(e).pipeline;return t&&(t.usedTimes--,t.usedTimes===0&&this._releasePipeline(t),t.isComputePipeline?(t.computeProgram.usedTimes--,t.computeProgram.usedTimes===0&&this._releaseProgram(t.computeProgram)):(t.fragmentProgram.usedTimes--,t.vertexProgram.usedTimes--,t.vertexProgram.usedTimes===0&&this._releaseProgram(t.vertexProgram),t.fragmentProgram.usedTimes===0&&this._releaseProgram(t.fragmentProgram))),super.delete(e)}dispose(){super.dispose(),this.caches=new Map,this.programs={vertex:new Map,fragment:new Map,compute:new Map}}updateForRender(e){this.getForRender(e)}_getComputePipeline(e,t,r,i){r=r||this._getComputeCacheKey(e,t);let s=this.caches.get(r);return s===void 0&&(s=new kG(r,t),this.caches.set(r,s),this.backend.createComputePipeline(s,i)),s}_getRenderPipeline(e,t,r,i,s){i=i||this._getRenderCacheKey(e,t,r);let a=this.caches.get(i);return a===void 0&&(a=new LG(i,t,r),this.caches.set(i,a),e.pipeline=a,this.backend.createRenderPipeline(e,s)),a}_getComputeCacheKey(e,t){return e.id+\\\",\\\"+t.id}_getRenderCacheKey(e,t,r){return t.id+\\\",\\\"+r.id+\\\",\\\"+this.backend.getRenderCacheKey(e)}_releasePipeline(e){this.caches.delete(e.cacheKey)}_releaseProgram(e){let t=e.code,r=e.stage;this.programs[r].delete(t),this.info.destroyProgram(e)}_needsComputeUpdate(e){let t=this.get(e);return t.pipeline===void 0||t.version!==e.version}_needsRenderUpdate(e){return this.get(e).pipeline===void 0||this.backend.needsRenderUpdate(e)}},UG=class extends Nl{constructor(e,t,r,i,s,a){super(),this.backend=e,this.textures=r,this.pipelines=s,this.attributes=i,this.nodes=t,this.info=a,this.pipelines.bindings=this}getForRender(e){let t=e.getBindings(),r=this.get(e);return r.initialized!==!0&&(this._createBindings(t),r.initialized=!0),t}getForCompute(e){let t=this.nodes.getForCompute(e).bindings,r=this.get(e);return(r.initialized!==!0||r.bindings!==t)&&(r.bindings!==void 0&&this._destroyBindings(r.bindings),this._createBindings(t),r.initialized=!0,r.bindings=t),t}updateForCompute(e){this._updateBindings(this.getForCompute(e))}updateForRender(e){this._updateBindings(this.getForRender(e))}deleteForCompute(e){let t=this.get(e).bindings||this.nodes.getForCompute(e).bindings;this._destroyBindings(t),this.delete(e)}deleteForRender(e){let t=e.getBindings();this._destroyBindings(t),this.delete(e)}_createBindings(e){for(let t of e){let r=this.get(t);if(r.bindGroup===void 0){for(let i of t.bindings)if(i.isUniformBuffer)this.backend.createUniformBuffer(i),this.info.createUniformBuffer(i);else if(i.isSampledTexture)this.textures.updateTexture(i.texture);else if(i.isSampler)this.textures.updateSampler(i);else if(i.isStorageBuffer){let s=i.attribute,a=s.isIndirectStorageBufferAttribute?ya.INDIRECT:ya.STORAGE;this.attributes.update(s,a)}this.backend.createBindings(t,e,0),r.bindGroup=t,r.usedTimes=1}else r.usedTimes++}}_destroyBindings(e){for(let t of e){let r=this.get(t);if(r.usedTimes--,r.usedTimes===0){for(let i of t.bindings)i.isUniformBuffer?(this.backend.destroyUniformBuffer(i),this.info.destroyUniformBuffer(i),i.release()):i.isSampler&&(i.isSampledTexture!==!0&&this.backend.destroySampler(i),i.release());this.backend.deleteBindGroupData(t),this.delete(t)}}}_updateBindings(e){for(let t of e)this._update(t,e)}_update(e,t){let{backend:r}=this,i=!1,s=!0,a=0,n=0;for(let o of e.bindings)if(this.nodes.updateGroup(o)!==!1){if(o.isStorageBuffer){let l=o.attribute,u=l.isIndirectStorageBufferAttribute?ya.INDIRECT:ya.STORAGE,h=r.get(o);this.attributes.update(l,u),h.attribute!==l&&(h.attribute=l,i=!0)}if(o.isUniformBuffer)o.update()&&r.updateBinding(o);else if(o.isSampledTexture){let l=o.update(),u=o.texture,h=this.textures.get(u);if(l&&(this.textures.updateTexture(u),o.generation!==h.generation&&(o.generation=h.generation,i=!0),h.bindGroups.add(e)),r.get(u).externalTexture!==void 0||h.isDefaultTexture?s=!1:(a=a*10+u.id,n+=u.version),u.isStorageTexture===!0&&u.mipmapsAutoUpdate===!0){let d=this.get(u);o.store===!0?d.needsMipmap=!0:this.textures.needsMipmaps(u)&&d.needsMipmap===!0&&(this.backend.generateMipmaps(u),d.needsMipmap=!1)}}else if(o.isSampler&&o.update()){let l=this.textures.updateSampler(o);o.samplerKey!==l&&(o.samplerKey=l,i=!0)}o.isBuffer&&o.updateRanges.length>0&&o.clearUpdateRanges()}i===!0&&this.backend.updateBindings(e,t,s?a:0,n)}},zG=Object.freeze([]);function VG(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?e.z-t.z:e.id-t.id}function aP(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function nP(e){return(e.transmission>0||e.transmissionNode&&e.transmissionNode.isNode)&&e.side===hs&&e.forceSinglePass===!1}var GG=class{constructor(e,t,r){this.renderItems=[],this.renderItemsIndex=0,this.opaque=[],this.transparentDoublePass=[],this.transparent=[],this.bundles=[],this.lighting=e,this.lightsNode=e.getNode(t),this.lightsArray=[],this.scene=t,this.camera=r,this.occlusionQueryCount=0,this._lastOcclusionObject=null}begin(){return this.renderItemsIndex=0,this.opaque.length=0,this.transparentDoublePass.length=0,this.transparent.length=0,this.bundles.length=0,this.lightsArray.length=0,this.occlusionQueryCount=0,this}getNextRenderItem(e,t,r,i,s,a,n){let o=this.renderItems[this.renderItemsIndex];return o===void 0?(o={id:e.id,object:e,geometry:t,material:r,groupOrder:i,renderOrder:e.renderOrder,z:s,group:a,clippingContext:n},this.renderItems[this.renderItemsIndex]=o):(o.id=e.id,o.object=e,o.geometry=t,o.material=r,o.groupOrder=i,o.renderOrder=e.renderOrder,o.z=s,o.group=a,o.clippingContext=n),this.renderItemsIndex++,o}push(e,t,r,i,s,a,n){let o=this.getNextRenderItem(e,t,r,i,s,a,n);e.occlusionTest===!0&&this._lastOcclusionObject!==e&&(this.occlusionQueryCount++,this._lastOcclusionObject=e),r.transparent===!0||r.transmission>0||r.transmissionNode&&r.transmissionNode.isNode||r.backdropNode&&r.backdropNode.isNode?(nP(r)&&this.transparentDoublePass.push(o),this.transparent.push(o)):this.opaque.push(o)}unshift(e,t,r,i,s,a,n){let o=this.getNextRenderItem(e,t,r,i,s,a,n);r.transparent===!0||r.transmission>0||r.transmissionNode&&r.transmissionNode.isNode||r.backdropNode&&r.backdropNode.isNode?(nP(r)&&this.transparentDoublePass.unshift(o),this.transparent.unshift(o)):this.opaque.unshift(o)}pushBundle(e){this.bundles.push(e)}pushLight(e){this.lightsArray.push(e)}sort(e,t,r){this.opaque.length>1&&this.opaque.sort(e||VG),this.transparentDoublePass.length>1&&this.transparentDoublePass.sort(t||aP),this.transparent.length>1&&this.transparent.sort(t||aP),r&&(this.opaque.reverse(),this.transparentDoublePass.reverse(),this.transparent.reverse())}finish(){this.lightsNode.setLights(this.lighting.enabled?this.lightsArray:zG);for(let e=this.renderItemsIndex,t=this.renderItems.length;e\\u003ct;e++){let r=this.renderItems[e];if(r.id===null)break;r.id=null,r.object=null,r.geometry=null,r.material=null,r.groupOrder=null,r.renderOrder=null,r.z=null,r.group=null,r.clippingContext=null}this._lastOcclusionObject=null}},Id=[],WG=class{constructor(e){this.lighting=e,this.lists=new Ml}get(e,t){let r=this.lists;Id[0]=e,Id[1]=t;let i=r.get(Id);return i===void 0&&(i=new GG(this.lighting,e,t),r.set(Id,i)),Id[0]=null,Id[1]=null,i}dispose(){this.lists=new Ml}},jG=0,HG=class{constructor(){this.id=jG++,this.mrt=null,this.color=!0,this.clearColor=!0,this.clearColorValue={r:0,g:0,b:0,a:1},this.depth=!0,this.clearDepth=!0,this.clearDepthValue=1,this.stencil=!1,this.clearStencil=!0,this.clearStencilValue=1,this.viewport=!1,this.viewportValue=new Wt,this.scissor=!1,this.scissorValue=new Wt,this.renderTarget=null,this.textures=null,this.depthTexture=null,this.activeCubeFace=0,this.activeMipmapLevel=0,this.sampleCount=1,this.width=0,this.height=0,this.occlusionQueryCount=0,this.clippingContext=null,this.camera=null,this.isRenderContext=!0}getCacheKey(){return oP(this)}};function oP(e){let{textures:t,activeCubeFace:r,activeMipmapLevel:i}=e,s=[r,i];for(let a of t)s.push(a.id);return Sp(s)}var XG=class{constructor(e){this.renderer=e,this._renderContexts={}}get(e=null,t=null,r=0){let i;if(e===null)i=\\\"default\\\";else{let o=e.texture.format,l=e.texture.type;i=`${e.textures.length}:${o}:${l}:${e.samples}:${e.depthBuffer}:${e.stencilBuffer}`}let s=t!==null?t.id:\\\"default\\\",a=i+\\\"-\\\"+s+\\\"-\\\"+r,n=this._renderContexts[a];return n===void 0&&(n=new HG,n.mrt=t,this._renderContexts[a]=n),e!==null&&(n.sampleCount=e.samples===0?1:e.samples),n.clearDepthValue=this.renderer.getClearDepth(),n.clearStencilValue=this.renderer.getClearStencil(),n}dispose(){this._renderContexts={}}},$G=new F,qG=class extends Nl{constructor(e,t,r){super(),this.renderer=e,this.backend=t,this.info=r,this._htmlTextures=new Set}updateRenderTarget(e,t=0){let r=this.get(e),i=e.samples===0?1:e.samples,s=r.depthTextureMips||(r.depthTextureMips={}),a=e.textures,n=this.getSize(a[0]),o=n.width>>t,l=n.height>>t,u=e.depthTexture||s[t],h=e.depthBuffer===!0||e.stencilBuffer===!0,d=!1,c=u!==void 0&&u.image!==void 0&&u.image.depth>1,m=n.depth>1&&(e.useArrayDepthTexture||e.multiview||c);u===void 0&&h&&(u=new fs,u.format=e.stencilBuffer?ln:ua,u.type=e.stencilBuffer?ro:gr,u.image.width=o,u.image.height=l,u.image.depth=n.depth,u.renderTarget=e,s[t]=u),u&&(u.isArrayTexture=m),(r.width!==n.width||n.height!==r.height)&&(d=!0,u&&(u.needsUpdate=!0,u.image.width=o,u.image.height=l,u.image.depth=m?n.depth:1)),r.width=n.width,r.height=n.height,r.textures=a,r.depthTexture=u||null,r.depth=e.depthBuffer,r.stencil=e.stencilBuffer,r.renderTarget=e,r.sampleCount!==i&&(d=!0,u&&(u.needsUpdate=!0),r.sampleCount=i);let g={sampleCount:i};if(e.isXRRenderTarget!==!0){for(let y=0;y\\u003ca.length;y++){let b=a[y];d&&(b.needsUpdate=!0),this.updateTexture(b,g)}u&&this.updateTexture(u,g)}r.initialized!==!0&&(r.initialized=!0,this.info.memory.renderTargets++,r.onDispose=()=>{this._destroyRenderTarget(e)},e.addEventListener(\\\"dispose\\\",r.onDispose))}updateTexture(e,t={}){let r=this.get(e);if(r.initialized===!0&&r.version===e.version)return;let i=e.isRenderTargetTexture||e.isDepthTexture||e.isFramebufferTexture,s=this.backend;if(i&&r.initialized===!0&&s.destroyTexture(e),e.isFramebufferTexture){let l=this.renderer.getRenderTarget();l?e.type=l.texture.type:e.type=Si}if(e.isHTMLTexture&&e.image){let l=this.renderer.domElement;if(\\\"requestPaint\\\"in l){if(l.hasAttribute(\\\"layoutsubtree\\\")||l.setAttribute(\\\"layoutsubtree\\\",\\\"true\\\"),e.image.parentNode!==l&&l.appendChild(e.image),this._htmlTextures.size===0){let u=this._htmlTextures;l.onpaint=h=>{let d=h&&h.changedElements;for(let c of u)(!d||d.includes(c.image))&&(c.needsUpdate=!0)}}this._htmlTextures.add(e)}}let{width:a,height:n,depth:o}=this.getSize(e);if(t.width=a,t.height=n,t.depth=o,t.needsMipmaps=this.needsMipmaps(e),t.levels=t.needsMipmaps?this.getMipLevels(e,a,n):1,e.isCubeTexture&&e.mipmaps.length>0&&t.levels++,i||e.isStorageTexture===!0||e.isExternalTexture===!0)s.createTexture(e,t),r.generation=e.version;else if(e.version>0){let l=e.image;if(l===void 0)Ue(\\\"Renderer: Texture marked for update but image is undefined.\\\");else if(l.complete===!1)Ue(\\\"Renderer: Texture marked for update but image is incomplete.\\\");else{if(e.images){let h=[];for(let d of e.images)h.push(d);t.images=h}else t.image=l;(r.isDefaultTexture===void 0||r.isDefaultTexture===!0)&&(s.createTexture(e,t),r.isDefaultTexture=!1,r.generation=e.version),e.source.dataReady===!0&&s.updateTexture(e,t);let u=e.isStorageTexture===!0&&e.mipmapsAutoUpdate===!1;t.needsMipmaps&&e.mipmaps.length===0&&!u&&s.generateMipmaps(e),e.onUpdate&&e.onUpdate(e)}}else s.createDefaultTexture(e),r.isDefaultTexture=!0,r.generation=e.version;r.initialized!==!0&&(r.initialized=!0,r.generation=e.version,r.bindGroups=new Set,this.info.createTexture(e),e.isVideoTexture&&Gt.enabled===!0&&Gt.getTransfer(e.colorSpace)!==Tt&&Ue(\\\"WebGPURenderer: Video textures must use a color space with a sRGB transfer function, e.g. SRGBColorSpace.\\\"),r.onDispose=()=>{this._destroyTexture(e)},e.addEventListener(\\\"dispose\\\",r.onDispose)),r.version=e.version}updateSampler(e){return this.backend.updateSampler(e)}getSize(e,t=$G){let r=e.images?e.images[0]:e.image;return r?(r.image!==void 0&&(r=r.image),e.isHTMLTexture?(t.width=r.offsetWidth||1,t.height=r.offsetHeight||1,t.depth=1):typeof HTMLVideoElement\\u003c\\\"u\\\"&&r instanceof HTMLVideoElement?(t.width=r.videoWidth||1,t.height=r.videoHeight||1,t.depth=1):typeof VideoFrame\\u003c\\\"u\\\"&&r instanceof VideoFrame?(t.width=r.displayWidth||1,t.height=r.displayHeight||1,t.depth=1):(t.width=r.width||1,t.height=r.height||1,t.depth=e.isCubeTexture?6:r.depth||1)):t.width=t.height=t.depth=1,t}getMipLevels(e,t,r){let i;return e.mipmaps.length>0?i=e.mipmaps.length:e.isCompressedTexture===!0?i=1:i=Math.floor(Math.log2(Math.max(t,r)))+1,i}needsMipmaps(e){return e.generateMipmaps===!0||e.mipmaps.length>0}_destroyRenderTarget(e){if(this.has(e)===!0){let t=this.get(e),r=t.textures,i=t.depthTexture;e.removeEventListener(\\\"dispose\\\",t.onDispose);for(let s=0;s\\u003cr.length;s++)this._destroyTexture(r[s]);i&&this._destroyTexture(i),this.delete(e),this.backend.delete(e),this.info.memory.renderTargets--}}_destroyTexture(e){if(this.has(e)===!0){let t=this.get(e);e.removeEventListener(\\\"dispose\\\",t.onDispose);let r=t.isDefaultTexture;if(this.backend.destroyTexture(e,r),t.bindGroups)for(let i of t.bindGroups){let s=this.backend.get(i);s.groups=void 0,s.versions=void 0;for(let a of i.bindings)a.isSampler&&a.texture===e&&(a.isSampledTexture!==!0&&this.backend.destroySampler(a),a.reset(),a.release())}this._htmlTextures.delete(e),this.delete(e),this.info.destroyTexture(e)}}},gS=class extends gt{constructor(e,t,r,i=1){super(e,t,r),this.a=i}set(e,t,r,i=1){return this.a=i,super.set(e,t,r)}copy(e){return e.a!==void 0&&(this.a=e.a),super.copy(e)}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}},lP=class extends Xb{static get type(){return\\\"OverrideContextNode\\\"}constructor(e,t=null){super(t,{overrideNodes:e}),this.isOverrideContextNode=!0}getFlowContextData(){let e=[];this.traverse(i=>{i.isOverrideContextNode===!0&&e.push(i.value.overrideNodes)});let t=new Map(e.flatMap(i=>Array.from(i.entries()))),r=super.getFlowContextData();return r.overrideNodes=t,r}};function uP(e,t=null,r=null){if(t&&t.isNode){let i=t;t=()=>i}return new lP(new Map([[e,t]]),r)}xe(\\\"overrideNode\\\",(e,t,r)=>uP(t,r,e));function hP(e,t=null){let r=new Map;for(let[i,s]of e){let a=s!==null?typeof s==\\\"function\\\"?s:()=>s:null;r.set(i,a)}return new lP(r,t)}xe(\\\"overrideNodes\\\",(e,t)=>hP(t,e));var dP=class extends jt{static get type(){return\\\"ParameterNode\\\"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getMemberType(e,t){let r=this.getNodeType(e),i=e.getStructTypeNode(r),s;return i!==null?s=i.getMemberType(e,t):(Ce(`TSL: Member \\\"${t}\\\" not found in struct \\\"${r}\\\".`,new $r),s=\\\"float\\\"),s}getHash(){return String(this.id)}generate(){return this.name}},YG=(e,t)=>new dP(e,t),ZG=class extends Ke{static get type(){return\\\"StackNode\\\"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this._expressionNode=null,this._currentNode=null,this._nodeDataLibrary=new Map,this.isStackNode=!0}getElementType(e){return this.outputNode?this.outputNode.getElementType(e):\\\"void\\\"}generateNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):\\\"void\\\"}getMemberType(e,t){return this.outputNode?this.outputNode.getMemberType(e,t):\\\"void\\\"}addToStack(e,t=-1){if(e.isNode!==!0)return Ce(\\\"TSL: Invalid node added to stack.\\\",new $r),this;if(t===-1)if(this._currentNode){let r=this._nodeDataLibrary.get(this._currentNode);r===void 0&&(r={delta:0},this._nodeDataLibrary.set(this._currentNode,r)),r.delta++,t=this.nodes.indexOf(this._currentNode)+r.delta}else t=this.nodes.length;return this.nodes.splice(t,0,e),this}addToStackBefore(e){let t=this._currentNode?this.nodes.indexOf(this._currentNode):0;return this.addToStack(e,t)}If(e,t){let r=new bd(t);return this._currentCond=Zi(e,r),this.addToStack(this._currentCond)}ElseIf(e,t){let r=new bd(t),i=Zi(e,r);return this._currentCond.elseNode=i,this._currentCond=i,this}Else(e){return this._currentCond.elseNode=new bd(e),this}Switch(e){return this._expressionNode=Ye(e),this}Case(...e){let t=[];if(e.length>=2)for(let n=0;n\\u003ce.length-1;n++)t.push(this._expressionNode.equal(Ye(e[n])));else Ce(\\\"TSL: Invalid parameter length. Case() requires at least two parameters.\\\",new $r);let r=e[e.length-1],i=new bd(r),s=t[0];for(let n=1;n\\u003ct.length;n++)s=s.or(t[n]);let a=Zi(s,i);return this._currentCond===null?(this._currentCond=a,this.addToStack(this._currentCond)):(this._currentCond.elseNode=a,this._currentCond=a,this)}Default(e){return this.Else(e),this}setup(e){let t=e.getNodeProperties(this),r=0;for(let i of this.getChildren())i.isVarNode&&i.isIntent(e)&&i.isAssign(e)!==!0||(t[\\\"node\\\"+r++]=i);return t.outputNode||null}build(e,...t){let r=xb(),i=e.buildStage;Np(this),e.setActiveStack(this);for(let a=0;a\\u003cthis.nodes.length;a++){let n=this.nodes[a],o=this._currentNode;if(this._currentNode=n,!(n.isVarNode&&n.isIntent(e)&&n.isAssign(e)!==!0)){if(i===\\\"setup\\\")n.build(e);else if(i===\\\"analyze\\\")n.build(e,this);else if(i===\\\"generate\\\"){let l=e.getDataFromNode(n,\\\"any\\\").stages,u=l&&l[e.shaderStage];if(n.isVarNode&&u&&u.length===1&&u[0]&&u[0].isStackNode)continue;n.build(e,\\\"void\\\")}this._currentNode=o}}let s;if(this.outputNode){let a=this.outputNode.build(e,...t);(e.buildStage!==\\\"generate\\\"||this.outputNode.getNodeType(e)!==\\\"void\\\")&&(s=a)}else s=super.build(e,...t);return Np(r),e.removeActiveStack(this),s}},iy=Mt(ZG).setParameterLength(0,1);function JG(e){return Object.entries(e).map(([t,r])=>typeof r==\\\"string\\\"?{name:t,type:r,atomic:!1}:{name:t,type:r.type,atomic:r.atomic||!1})}var Cl=class extends Ke{static get type(){return\\\"StructTypeNode\\\"}constructor(e,t=null){super(\\\"struct\\\"),this.membersLayout=JG(e),this.name=t,this.isStructTypeNode=!0}getLength(){let e=1,t=0;for(let r of this.membersLayout){let i=r.type,s=NU(i),a=AU(i);e=Math.max(e,a);let n=t%e%a;n!==0&&(t+=a-n),t+=s}return Math.ceil(t/e)*e}getMemberType(e,t){let r=this.membersLayout.find(i=>i.name===t);return r?r.type:\\\"void\\\"}generateNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}setup(e){e.getStructTypeFromNode(this,this.membersLayout,this.name),e.addInclude(this)}generate(e){return this.getNodeType(e)}},QG=class extends Ke{static get type(){return\\\"StructNode\\\"}constructor(e,t){super(\\\"vec3\\\"),this.structTypeNode=e,this.values=t,this.isStructNode=!0}generateNodeType(e){return this.structTypeNode.getNodeType(e)}getMemberType(e,t){return this.structTypeNode.getMemberType(e,t)}_getChildren(){let e=super._getChildren(),t=e.find(r=>r.childNode===this.structTypeNode);return e.splice(e.indexOf(t),1),e.push(t),e}generate(e){let t=e.getVarFromNode(this),r=t.type,i=e.getPropertyName(t);return e.addLineFlowCode(`${i} = ${e.generateStruct(r,this.structTypeNode.membersLayout,this.values)}`,this),t.name}},KG=(e,t=null)=>{let r=new Cl(e,t);return yb((...i)=>{let s=null;if(i.length>0)if(i[0].isNode){s={};let a=Object.keys(e);for(let n=0;n\\u003ci.length;n++)s[a[n]]=i[n]}else s=i[0];return new QG(r,s)},r)},cP=class extends Ke{static get type(){return\\\"OutputStructNode\\\"}constructor(...e){super(),this.members=e,this.isOutputStructNode=!0}generateNodeType(){return\\\"OutputType\\\"}generate(e){let t=e.getDataFromNode(this);if(t.membersLayout===void 0){let a=this.members,n=[];for(let o=0;o\\u003ca.length;o++){let l=\\\"m\\\"+o,u=a[o].getNodeType(e);n.push({name:l,type:u,index:o})}t.membersLayout=n,t.structType=e.getOutputStructTypeFromNode(this,t.membersLayout)}let r=e.getOutputStructName(),i=this.members,s=r!==\\\"\\\"?r+\\\".\\\":\\\"\\\";for(let a=0;a\\u003ci.length;a++){let n=i[a].build(e,t.membersLayout[a].type);e.addLineFlowCode(`${s}m${a} = ${n}`,this)}return r}},e8=Mt(cP),pP=class{constructor(e=oa){this.blending=e,this.blendSrc=$c,this.blendDst=qc,this.blendEquation=la,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.premultiplyAlpha=!1}copy(e){return this.blending=e.blending,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.premultiplyAlpha=e.premultiplyAlpha,this}clone(){return new this.constructor().copy(this)}},t8=new pP(Kn),r8=new pP(tv);function mP(e,t){for(let r=0;r\\u003ce.length;r++)if(e[r].name===t)return r;return-1}var i8=class extends cP{static get type(){return\\\"MRTNode\\\"}constructor(e){super(),this.outputNodes=e,this.blendModes={output:r8},this.isMRTNode=!0}setBlendMode(e,t){return this.blendModes[e]=t,this}getBlendMode(e){return this.blendModes[e]||t8}has(e){return this.outputNodes[e]!==void 0}get(e){return this.outputNodes[e]}merge(e){let t={...this.outputNodes,...e.outputNodes},r={...this.blendModes,...e.blendModes},i=fP(t);return i.blendings=r,i}setup(e){let t=this.outputNodes,r=e.renderer.getRenderTarget(),i=[],s=r.textures;for(let a in t){let n=mP(s,a);if(n===-1)continue;let o=e.getOutputType(n);i[n]=t[a].convert(o)}return this.members=i,super.setup(e)}},fP=Mt(i8),Wp=class extends rr{static get type(){return\\\"BitcastNode\\\"}constructor(e,t,r=null){super(),this.valueNode=e,this.conversionType=t,this.inputType=r,this.isBitcastNode=!0}generateNodeType(e){if(this.inputType!==null){let t=this.valueNode.getNodeType(e),r=e.getTypeLength(t);return e.getTypeFromLength(r,this.conversionType)}return this.conversionType}generate(e){let t=this.getNodeType(e),r=\\\"\\\";if(this.inputType!==null){let i=this.valueNode.getNodeType(e);r=e.getTypeLength(i)===1?this.inputType:e.changeComponentType(i,this.inputType)}else r=this.valueNode.getNodeType(e);return`${e.getBitcastMethod(t,r)}( ${this.valueNode.build(e,r)} )`}},gP=Ee(Wp).setParameterLength(2),s8=e=>new Wp(e,\\\"int\\\",\\\"float\\\"),yP=e=>new Wp(e,\\\"uint\\\",\\\"float\\\"),a8=e=>new Wp(e,\\\"float\\\",\\\"int\\\"),n8=e=>new Wp(e,\\\"float\\\",\\\"uint\\\"),sy={},_o=class Qx extends he{static get type(){return\\\"BitcountNode\\\"}constructor(t,r){super(t,r),this.isBitcountNode=!0}_resolveElementType(t,r,i){i===\\\"int\\\"?r.assign(gP(t,\\\"uint\\\")):r.assign(t)}_returnDataNode(t){switch(t){case\\\"uint\\\":return Ne;case\\\"int\\\":return Y;case\\\"uvec2\\\":return vb;case\\\"uvec3\\\":return Mu;case\\\"uvec4\\\":return _b;case\\\"ivec2\\\":return Pr;case\\\"ivec3\\\":return bb;case\\\"ivec4\\\":return Sb}}_createTrailingZerosBaseLayout(t,r){let i=this._returnDataNode(r);return Q(([s])=>{let a=Ne(0);this._resolveElementType(s,a,r);let n=D(a.bitAnd(kb(a))),o=yP(n).shiftRight(23).sub(127);return i(o)}).setLayout({name:t,type:r,inputs:[{name:\\\"value\\\",type:r}]})}_createLeadingZerosBaseLayout(t,r){let i=this._returnDataNode(r);return Q(([s])=>{et(s.equal(Ne(0)),()=>Ne(32));let a=Ne(0),n=Ne(0);return this._resolveElementType(s,a,r),et(a.shiftRight(16).equal(0),()=>{n.addAssign(16),a.shiftLeftAssign(16)}),et(a.shiftRight(24).equal(0),()=>{n.addAssign(8),a.shiftLeftAssign(8)}),et(a.shiftRight(28).equal(0),()=>{n.addAssign(4),a.shiftLeftAssign(4)}),et(a.shiftRight(30).equal(0),()=>{n.addAssign(2),a.shiftLeftAssign(2)}),et(a.shiftRight(31).equal(0),()=>{n.addAssign(1)}),i(n)}).setLayout({name:t,type:r,inputs:[{name:\\\"value\\\",type:r}]})}_createOneBitsBaseLayout(t,r){let i=this._returnDataNode(r);return Q(([s])=>{let a=Ne(0);this._resolveElementType(s,a,r),a.assign(a.sub(a.shiftRight(Ne(1)).bitAnd(Ne(1431655765)))),a.assign(a.bitAnd(Ne(858993459)).add(a.shiftRight(Ne(2)).bitAnd(Ne(858993459))));let n=a.add(a.shiftRight(Ne(4))).bitAnd(Ne(252645135)).mul(Ne(16843009)).shiftRight(Ne(24));return i(n)}).setLayout({name:t,type:r,inputs:[{name:\\\"value\\\",type:r}]})}_createMainLayout(t,r,i,s){let a=this._returnDataNode(r);return Q(([n])=>{if(i===1)return a(s(n));{let o=a(0),l=[\\\"x\\\",\\\"y\\\",\\\"z\\\",\\\"w\\\"];for(let u=0;u\\u003ci;u++){let h=l[u];o[h].assign(s(n[h]))}return o}}).setLayout({name:t,type:r,inputs:[{name:\\\"value\\\",type:r}]})}setup(t){let{method:r,aNode:i}=this,{renderer:s}=t;if(s.backend.isWebGPUBackend)return super.setup(t);let a=this.getInputType(t),n=t.getElementType(a),o=t.getTypeLength(a),l=`${r}_base_${n}`,u=`${r}_${a}`,h=sy[l];if(h===void 0){switch(r){case Qx.COUNT_LEADING_ZEROS:{h=this._createLeadingZerosBaseLayout(l,n);break}case Qx.COUNT_TRAILING_ZEROS:{h=this._createTrailingZerosBaseLayout(l,n);break}case Qx.COUNT_ONE_BITS:{h=this._createOneBitsBaseLayout(l,n);break}}sy[l]=h}let d=sy[u];return d===void 0&&(d=this._createMainLayout(u,a,o,h),sy[u]=d),Q(()=>d(i))()}};_o.COUNT_TRAILING_ZEROS=\\\"countTrailingZeros\\\",_o.COUNT_LEADING_ZEROS=\\\"countLeadingZeros\\\",_o.COUNT_ONE_BITS=\\\"countOneBits\\\";var o8=Ee(_o,_o.COUNT_TRAILING_ZEROS).setParameterLength(1),l8=Ee(_o,_o.COUNT_LEADING_ZEROS).setParameterLength(1),u8=Ee(_o,_o.COUNT_ONE_BITS).setParameterLength(1),h8=Q(([e])=>{let t=e.toUint().mul(747796405).add(2891336453),r=t.shiftRight(t.shiftRight(28).add(4)).bitXor(t).mul(277803737);return r.shiftRight(22).bitXor(r).toFloat().mul(1/2**32)}),yS=(e,t)=>ma(mt(4,e.mul(It(1,e))),t),d8=(e,t)=>e.lessThan(.5)?yS(e.mul(2),t).div(2):It(1,yS(mt(It(1,e),2),t).div(2)),c8=(e,t,r)=>ma(js(ma(e,t),Yr(ma(e,t),ma(It(1,e),r))),1/t),p8=(e,t)=>xs(m0.mul(t.mul(e).sub(1))).div(m0.mul(t.mul(e).sub(1))),xS=class extends rr{static get type(){return\\\"PackFloatNode\\\"}constructor(e,t){super(),this.vectorNode=t,this.encoding=e,this.isPackFloatNode=!0}generateNodeType(){return\\\"uint\\\"}generate(e){let t=this.vectorNode.getNodeType(e);return`${e.getFloatPackingMethod(this.encoding)}(${this.vectorNode.build(e,t)})`}},m8=Ee(xS,\\\"snorm\\\").setParameterLength(1),f8=Ee(xS,\\\"unorm\\\").setParameterLength(1),g8=Ee(xS,\\\"float16\\\").setParameterLength(1),vS=class extends rr{static get type(){return\\\"UnpackFloatNode\\\"}constructor(e,t){super(),this.uintNode=t,this.encoding=e,this.isUnpackFloatNode=!0}generateNodeType(){return\\\"vec2\\\"}generate(e){let t=this.uintNode.getNodeType(e);return`${e.getFloatUnpackingMethod(this.encoding)}(${this.uintNode.build(e,t)})`}},y8=Ee(vS,\\\"snorm\\\").setParameterLength(1),x8=Ee(vS,\\\"unorm\\\").setParameterLength(1),v8=Ee(vS,\\\"float16\\\").setParameterLength(1),wo=Q(([e])=>e.fract().sub(.5).abs()).setLayout({name:\\\"tri\\\",type:\\\"float\\\",inputs:[{name:\\\"x\\\",type:\\\"float\\\"}]}),b8=Q(([e])=>K(wo(e.z.add(wo(e.y.mul(1)))),wo(e.z.add(wo(e.x.mul(1)))),wo(e.y.add(wo(e.x.mul(1)))))).setLayout({name:\\\"tri3\\\",type:\\\"vec3\\\",inputs:[{name:\\\"p\\\",type:\\\"vec3\\\"}]}),T8=Q(([e,t,r])=>{let i=K(e).toVar(),s=D(1.4).toVar(),a=D(0).toVar(),n=K(i).toVar();return Qt({start:D(0),end:D(3),type:\\\"float\\\",condition:\\\"\\u003c=\\\"},()=>{let o=K(b8(n.mul(2))).toVar();i.addAssign(o.add(r.mul(D(.1).mul(t)))),n.mulAssign(1.8),s.mulAssign(1.5),i.mulAssign(1.2);let l=D(wo(i.z.add(wo(i.x.add(wo(i.y)))))).toVar();a.addAssign(l.div(s)),n.addAssign(.14)}),a}).setLayout({name:\\\"triNoise3D\\\",type:\\\"float\\\",inputs:[{name:\\\"position\\\",type:\\\"vec3\\\"},{name:\\\"speed\\\",type:\\\"float\\\"},{name:\\\"time\\\",type:\\\"float\\\"}]}),S8=class extends Ke{static get type(){return\\\"FunctionOverloadingNode\\\"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFn=null,this.global=!0}generateNodeType(e){return this.getCandidateFn(e).shaderNode.layout.type}getCandidateFn(e){let t=this.parametersNodes,r=this._candidateFn;if(r===null){let i=null,s=-1;for(let a of this.functionNodes){let n=a.shaderNode.layout;if(n===null)throw new Error(\\\"THREE.FunctionOverloadingNode: FunctionNode must be a layout.\\\");let o=n.inputs;if(t.length===o.length){let l=0;for(let u=0;u\\u003ct.length;u++){let h=t[u],d=o[u];h.getNodeType(e)===d.type&&l++}l>s&&(i=a,s=l)}}this._candidateFn=r=i}return r}setup(e){return this.getCandidateFn(e)(...this.parametersNodes)}},_8=Mt(S8),ki=e=>(...t)=>_8(e,...t),Fd=Qe(0).setGroup(st).onRenderUpdate(e=>e.time),w8=Qe(0).setGroup(st).onRenderUpdate(e=>e.deltaTime),xP=Qe(0,\\\"uint\\\").setGroup(st).onRenderUpdate(e=>e.frameId),M8=(e=Fd)=>e.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),N8=(e=Fd)=>e.fract().round(),A8=(e=Fd)=>e.add(.5).fract().mul(2).sub(1).abs(),C8=(e=Fd)=>e.fract();function R8(e,t=null){return vo(t,{getUV:typeof e==\\\"function\\\"?e:()=>e})}var E8=Q(([e,t,r=ke(.5)])=>Gp(e.sub(r),t).add(r)),P8=Q(([e,t,r=ke(.5)])=>{let i=e.sub(r),s=i.dot(i),a=s.mul(s).mul(t);return e.add(i.mul(a))}),B8=Q(({position:e=null,horizontal:t=!0,vertical:r=!1})=>{let i;e!==null?(i=ga.toVar(),i[3][0]=e.x,i[3][1]=e.y,i[3][2]=e.z):i=ga;let s=xl.mul(i);return vd(t)&&(s[0][0]=ga[0].length(),s[0][1]=0,s[0][2]=0),vd(r)&&(s[1][0]=0,s[1][1]=ga[1].length(),s[1][2]=0),s[2][0]=0,s[2][1]=0,s[2][2]=1,bs.mul(s).mul(wr)}),I8=Q(([e=null])=>{let t=H0();return H0(WT(e)).sub(t).lessThan(0).select(Ga,e)}),F8=Q(([e,t=Jt(),r=D(0)])=>{let i=e.x,s=e.y,a=r.mod(i.mul(s)).floor(),n=a.mod(i),o=s.sub(a.add(1).div(i).ceil()),l=e.reciprocal(),u=ke(n,o);return t.add(u).mul(l)}),vP=Q(([e,t=null,r=null,i=D(1),s=wr,a=Qi])=>{let n=a.abs().normalize();n=n.div(n.dot(K(1)));let o=s.yz.mul(i),l=s.zx.mul(i),u=s.xy.mul(i),h=e.value,d=t!==null?t.value:h,c=r!==null?r.value:h,m=Ot(h,o).mul(n.x),g=Ot(d,l).mul(n.y),y=Ot(c,u).mul(n.z);return Yr(m,g,y)}),L8=(...e)=>vP(...e),Ld=new fn,Hu=new F,kd=new F,bS=new F,jp=new We,ay=new F(0,0,-1),Bn=new Wt,Hp=new F,ny=new F,Xp=new Wt,oy=new fe,ly=new er,k8=Ga.flipX();ly.depthTexture=new fs(1,1);var uy=!1,D8=class iD extends An{static get type(){return\\\"ReflectorNode\\\"}constructor(t={}){super(t.defaultTexture||ly.texture,k8),this._reflectorBaseNode=t.reflector||new O8(this,t),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error(\\\"THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. \\\");this._depthNode=new iD({defaultTexture:ly.depthTexture,reflector:this._reflectorBaseNode})}return this._depthNode}setup(t){return t.object.isQuadMesh||this._reflectorBaseNode.build(t),super.setup(t)}clone(){let t=new this.constructor(this.reflectorNode);return t.uvNode=this.uvNode,t.levelNode=this.levelNode,t.biasNode=this.biasNode,t.sampler=this.sampler,t.depthNode=this.depthNode,t.compareNode=this.compareNode,t.gradNode=this.gradNode,t.gatherNode=this.gatherNode,t.offsetNode=this.offsetNode,t._reflectorBaseNode=this._reflectorBaseNode,t}dispose(){super.dispose(),this._reflectorBaseNode.dispose()}},O8=class extends Ke{static get type(){return\\\"ReflectorBaseNode\\\"}constructor(e,t={}){super();let{target:r=new Hi,resolutionScale:i=1,generateMipmaps:s=!1,bounces:a=!0,depth:n=!1,samples:o=0}=t;this.textureNode=e,this.target=r,this.resolutionScale=i,t.resolution!==void 0&&(Et('ReflectorNode: The \\\"resolution\\\" parameter has been renamed to \\\"resolutionScale\\\".'),this.resolutionScale=t.resolution),this.generateMipmaps=s,this.bounces=a,this.depth=n,this.samples=o,this.updateBeforeType=a?ut.RENDER:ut.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new Map,this.forceUpdate=!1,this.hasOutput=!1}_updateResolution(e,t){let r=this.resolutionScale;t.getDrawingBufferSize(oy),e.setSize(Math.round(oy.width*r),Math.round(oy.height*r))}setup(e){return this._updateResolution(ly,e.renderer),super.setup(e)}dispose(){super.dispose();for(let e of this.renderTargets.values())e.dispose()}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new er(0,0,{type:Dt,samples:this.samples}),this.generateMipmaps===!0&&(t.texture.minFilter=LD,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new fs),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&uy)return!1;uy=!0;let{scene:t,camera:r,renderer:i,material:s}=e,{target:a}=this,n=this.getVirtualCamera(r),o=this.getRenderTarget(n);i.getDrawingBufferSize(oy),this._updateResolution(o,i),kd.setFromMatrixPosition(a.matrixWorld),bS.setFromMatrixPosition(r.matrixWorld),jp.extractRotation(a.matrixWorld),Hu.set(0,0,1),Hu.applyMatrix4(jp),Hp.subVectors(kd,bS);let l=Hp.dot(Hu)>0,u=!1;if(l===!0&&this.forceUpdate===!1){if(this.hasOutput===!1){uy=!1;return}u=!0}Hp.reflect(Hu).negate(),Hp.add(kd),jp.extractRotation(r.matrixWorld),ay.set(0,0,-1),ay.applyMatrix4(jp),ay.add(bS),ny.subVectors(kd,ay),ny.reflect(Hu).negate(),ny.add(kd),n.coordinateSystem=r.coordinateSystem,n.position.copy(Hp),n.up.set(0,1,0),n.up.applyMatrix4(jp),n.up.reflect(Hu),n.lookAt(ny),n.near=r.near,n.far=r.far,n.updateMatrixWorld(),n.projectionMatrix.copy(r.projectionMatrix),Ld.setFromNormalAndCoplanarPoint(Hu,kd),Ld.applyMatrix4(n.matrixWorldInverse),Bn.set(Ld.normal.x,Ld.normal.y,Ld.normal.z,Ld.constant);let h=n.projectionMatrix;Xp.x=(Math.sign(Bn.x)+h.elements[8])/h.elements[0],Xp.y=(Math.sign(Bn.y)+h.elements[9])/h.elements[5],Xp.z=-1,Xp.w=(1+h.elements[10])/h.elements[14],Bn.multiplyScalar(1/Bn.dot(Xp));let d=0;h.elements[2]=Bn.x,h.elements[6]=Bn.y,h.elements[10]=i.coordinateSystem===da?Bn.z-d:Bn.z+1-d,h.elements[14]=Bn.w,this.textureNode.value=o.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=o.depthTexture),s.visible=!1;let c=i.getRenderTarget(),m=i.getMRT(),g=i.autoClear;i.setMRT(null),i.setRenderTarget(o),i.autoClear=!0;let y=t.name;t.name=(t.name||\\\"Scene\\\")+\\\" [ Reflector ]\\\",u?(i.clear(),this.hasOutput=!1):(i.render(t,n),this.hasOutput=!0),t.name=y,i.setMRT(m),i.setRenderTarget(c),i.autoClear=g,s.visible=!0,uy=!1,this.forceUpdate=!1}get resolution(){return Et('ReflectorNode: The \\\"resolution\\\" property has been renamed to \\\"resolutionScale\\\".'),this.resolutionScale}set resolution(e){Et('ReflectorNode: The \\\"resolution\\\" property has been renamed to \\\"resolutionScale\\\".'),this.resolutionScale=e}},U8=e=>new D8(e),TS=new sb(-1,1,1,-1,0,1),z8=class extends ps{constructor(e=!1){super();let t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute(\\\"position\\\",new tr([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute(\\\"uv\\\",new tr(t,2))}},V8=new z8,Wa=class extends Mi{constructor(e=null){super(V8,e),this.camera=TS,this.isQuadMesh=!0}async renderAsync(e){Et('QuadMesh: \\\"renderAsync()\\\" has been deprecated. Use \\\"render()\\\" and \\\"await renderer.init();\\\" when creating the renderer.'),await e.init(),e.render(this,TS)}render(e){e.render(this,TS)}},G8=new fe,W8=class extends An{static get type(){return\\\"RTTNode\\\"}constructor(e,t=null,r=null,i={type:Dt}){let s=new er(t,r,i);super(s.texture,Jt()),this.isRTTNode=!0,this.node=e,this.width=t,this.height=r,this.renderTarget=s,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._resolutionScale=1,this._rttNode=null,this._quadMesh=new Wa(new Pt),this.updateBeforeType=ut.RENDER}get autoResize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name=\\\"RTT\\\",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){let r=Math.floor(e*this._resolutionScale),i=Math.floor(t*this._resolutionScale);this.renderTarget.setSize(r,i),this.textureNeedsUpdate=!0}setResolutionScale(e){return this._resolutionScale=e,this.autoResize===!1&&this.setSize(this.width,this.height),this}getResolutionScale(){return this._resolutionScale}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;this.textureNeedsUpdate=!1;let t=e.getRenderTarget();if(this.autoResize===!0){let i=e.getDrawingBufferSize(G8),s=Math.floor(i.width*this._resolutionScale),a=Math.floor(i.height*this._resolutionScale);(s!==this.renderTarget.width||a!==this.renderTarget.height)&&(this.renderTarget.setSize(s,a),this.textureNeedsUpdate=!0)}let r=\\\"RTT\\\";this.node.name&&(r=this.node.name+\\\" [ \\\"+r+\\\" ]\\\"),this._quadMesh.material.fragmentNode=this._rttNode,this._quadMesh.name=r,e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){let e=new An(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}},bP=(e,...t)=>new W8(Ye(e),...t),j8=(e,...t)=>e.isSampleNode||e.isTextureNode?e:e.isPassNode?e.getTextureNode():bP(e,...t),Dd=Q(([e,t,r],i)=>{let s;i.renderer.coordinateSystem===da?(e=ke(e.x,e.y.oneMinus()).mul(2).sub(1),s=Ve(K(e,t),1)):s=Ve(K(e.x,e.y.oneMinus(),t).mul(2).sub(1),1);let a=Ve(r.mul(s));return a.xyz.div(a.w)}),H8=Q(([e,t])=>{let r=t.mul(Ve(e,1)),i=r.xy.div(r.w).mul(.5).add(.5).toVar();return ke(i.x,i.y.oneMinus())}),X8=Q(([e,t,r])=>{let i=Fu(Gr(t)),s=Pr(e.mul(i)).toVar(),a=Gr(t,s).toVar(),n=Gr(t,s.sub(Pr(2,0))).toVar(),o=Gr(t,s.sub(Pr(1,0))).toVar(),l=Gr(t,s.add(Pr(1,0))).toVar(),u=Gr(t,s.add(Pr(2,0))).toVar(),h=Gr(t,s.add(Pr(0,2))).toVar(),d=Gr(t,s.add(Pr(0,1))).toVar(),c=Gr(t,s.sub(Pr(0,1))).toVar(),m=Gr(t,s.sub(Pr(0,2))).toVar(),g=ur(It(D(2).mul(o).sub(n),a)).toVar(),y=ur(It(D(2).mul(l).sub(u),a)).toVar(),b=ur(It(D(2).mul(d).sub(h),a)).toVar(),v=ur(It(D(2).mul(c).sub(m),a)).toVar(),S=Dd(e,a,r).toVar(),T=g.lessThan(y).select(S.sub(Dd(e.sub(ke(D(1).div(i.x),0)),o,r)),S.negate().add(Dd(e.add(ke(D(1).div(i.x),0)),l,r))),w=b.lessThan(v).select(S.sub(Dd(e.add(ke(0,D(1).div(i.y))),d,r)),S.negate().add(Dd(e.sub(ke(0,D(1).div(i.y))),c,r)));return Yi(xo(T,w))}),SS=Q(([e])=>Oa(D(52.9829189).mul(Oa(pa(e,ke(.06711056,.00583715)))))).setLayout({name:\\\"interleavedGradientNoise\\\",type:\\\"float\\\",inputs:[{name:\\\"position\\\",type:\\\"vec2\\\"}]}),ja=Q(([e,t,r])=>{let i=D(2.399963229728653),s=ys(D(e).add(.5).div(D(t))),a=D(e).mul(i).add(r);return ke(Ua(a),xs(a)).mul(s)}).setLayout({name:\\\"vogelDiskSample\\\",type:\\\"vec2\\\",inputs:[{name:\\\"sampleIndex\\\",type:\\\"int\\\"},{name:\\\"samplesCount\\\",type:\\\"int\\\"},{name:\\\"phi\\\",type:\\\"float\\\"}]}),$8=class extends Ke{static get type(){return\\\"SampleNode\\\"}constructor(e,t=null){super(),this.callback=e,this.uvNode=t,this.isSampleNode=!0}setup(){return this.sample(Jt())}sample(e){return this.callback(e)}},q8=(e,t=null)=>new $8(e,Ye(t)),Y8=class extends ud{constructor(e,t,r=Float32Array){let i=ArrayBuffer.isView(e)?e:new r(e*t);super(i,t),this.isStorageInstancedBufferAttribute=!0}},$p=class extends _i{constructor(e,t,r=Float32Array){let i=ArrayBuffer.isView(e)?e:new r(e*t);super(i,t),this.isStorageBufferAttribute=!0}},Z8=(e,t=\\\"float\\\")=>{let r,i;t.isStructTypeNode===!0?(r=t.getLength(),i=Yg(\\\"float\\\")):(r=jN(t),i=Yg(t));let s=new $p(e,r,i);return Sl(s,t,e)},J8=(e,t=\\\"float\\\")=>{let r,i;t.isStructTypeNode===!0?(r=t.getLength(),i=Yg(\\\"float\\\")):(r=jN(t),i=Yg(t));let s=new Y8(e,r,i);return Sl(s,t,s.count)},Q8=class extends Ke{static get type(){return\\\"PointUVNode\\\"}constructor(){super(\\\"vec2\\\"),this.isPointUVNode=!0}generate(){return\\\"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )\\\"}},K8=ze(Q8),_S=new We,TP=Qe(0).setGroup(st).onRenderUpdate(({scene:e})=>e.backgroundBlurriness),wS=Qe(1).setGroup(st).onRenderUpdate(({scene:e})=>e.backgroundIntensity),SP=Qe(new We).setGroup(st).onRenderUpdate(({scene:e})=>{let t=e.background;return t!==null&&t.isTexture&&t.mapping!==rv||e.backgroundNode&&e.backgroundNode.isNode?_S.makeRotationFromEuler(e.backgroundRotation).transpose():_S.identity(),_S}),_P=class extends An{static get type(){return\\\"StorageTextureNode\\\"}constructor(e,t,r=null){super(e,t),this.storeNode=r,this.mipLevel=0,this.isStorageTextureNode=!0,this.access=Fi.WRITE_ONLY}getInputType(){return\\\"storageTexture\\\"}getTransformedUV(e){return e}setup(e){super.setup(e);let t=e.getNodeProperties(this);return t.storeNode=this.storeNode,t}setAccess(e){return this.access=e,this}setMipLevel(e){return this.mipLevel=e,this}generate(e,t){return this.storeNode!==null?(this.generateStore(e),\\\"\\\"):super.generate(e,t)}generateSnippet(e,t,r,i,s,a,n,o,l){let u=this.value;return e.generateStorageTextureLoad(u,t,r,i,a,l)}toReadWrite(){return this.setAccess(Fi.READ_WRITE)}toReadOnly(){return this.setAccess(Fi.READ_ONLY)}toWriteOnly(){return this.setAccess(Fi.WRITE_ONLY)}store(e,t){let r=this.clone();return r.referenceNode=this.getBase(),r.uvNode=e,r.storeNode=t,t!==null&&r.toStack(),r}generateStore(e){let t=e.getNodeProperties(this),{uvNode:r,storeNode:i,depthNode:s}=t,a=super.generate(e,\\\"property\\\"),n=r.build(e,this.value.is3DTexture===!0?\\\"uvec3\\\":\\\"uvec2\\\"),o=i.build(e,\\\"vec4\\\"),l=s?s.build(e,\\\"int\\\"):null,u=e.generateTextureStore(this.value,a,n,l,o);e.addLineFlowCode(u,this)}clone(){let e=super.clone();return e.storeNode=this.storeNode,e.mipLevel=this.mipLevel,e.access=this.access,e}},wP=Mt(_P).setParameterLength(1,3),e7=(e,t,r)=>{let i;return e.isStorageTextureNode===!0?i=e.store(t,r):(i=wP(e,t,r),r!==null&&i.toStack()),i},t7=class extends _P{static get type(){return\\\"StorageTexture3DNode\\\"}constructor(e,t,r=null){super(e,t,r),this.isStorageTexture3DNode=!0}getDefaultUV(){return K(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?\\\"vec3\\\":\\\"ivec3\\\")}generateOffset(e,t){return t.build(e,\\\"ivec3\\\")}},r7=Mt(t7).setParameterLength(1,3),i7=Q(({texture:e,uv:t})=>{let r=K().toVar();return et(t.x.lessThan(1e-4),()=>{r.assign(K(1,0,0))}).ElseIf(t.y.lessThan(1e-4),()=>{r.assign(K(0,1,0))}).ElseIf(t.z.lessThan(1e-4),()=>{r.assign(K(0,0,1))}).ElseIf(t.x.greaterThan(1-1e-4),()=>{r.assign(K(-1,0,0))}).ElseIf(t.y.greaterThan(1-1e-4),()=>{r.assign(K(0,-1,0))}).ElseIf(t.z.greaterThan(1-1e-4),()=>{r.assign(K(0,0,-1))}).Else(()=>{let i=e.sample(t.add(K(-.01,0,0))).r.sub(e.sample(t.add(K(.01,0,0))).r),s=e.sample(t.add(K(0,-.01,0))).r.sub(e.sample(t.add(K(0,.01,0))).r),a=e.sample(t.add(K(0,0,-.01))).r.sub(e.sample(t.add(K(0,0,.01))).r);r.assign(K(i,s,a))}),r.normalize()}),s7=class extends An{static get type(){return\\\"Texture3DNode\\\"}constructor(e,t=null,r=null){super(e,t,r),this.isTexture3DNode=!0}getInputType(){return\\\"texture3D\\\"}getDefaultUV(){return K(.5,.5,.5)}setUpdateMatrix(){}generateUV(e,t){return t.build(e,this.sampler===!0?\\\"vec3\\\":\\\"ivec3\\\")}generateOffset(e,t){return t.build(e,\\\"ivec3\\\")}normal(e){return i7({texture:this,uv:e})}},MS=Mt(s7).setParameterLength(1,3),a7=(...e)=>MS(...e).setSampler(!1),n7=(e,t,r)=>MS(e,t).level(r),o7=class extends F0{static get type(){return\\\"UserDataNode\\\"}constructor(e,t,r=null){super(e,t,r),this.userData=r}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}},l7=(e,t,r)=>new o7(e,t,r),MP=new WeakMap,u7=class extends rr{static get type(){return\\\"VelocityNode\\\"}constructor(){super(\\\"vec2\\\"),this.projectionMatrix=null,this.updateType=ut.OBJECT,this.updateAfterType=ut.OBJECT,this.previousModelWorldMatrix=Qe(new We),this.previousProjectionMatrix=Qe(new We).setGroup(st),this.previousCameraViewMatrix=Qe(new We)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:r}){let i=AP(r);this.previousModelWorldMatrix.value.copy(i);let s=NP(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new We,s.previousCameraViewMatrix=new We,s.currentProjectionMatrix=new We,s.currentCameraViewMatrix=new We,s.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(s.previousProjectionMatrix.copy(s.currentProjectionMatrix),s.previousCameraViewMatrix.copy(s.currentCameraViewMatrix)),s.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(s.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(s.previousCameraViewMatrix))}updateAfter({object:e}){AP(e).copy(e.matrixWorld)}setup(){let e=this.projectionMatrix===null?bs:Qe(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),r=e.mul(Cn).mul(wr),i=this.previousProjectionMatrix.mul(t).mul(Du),s=r.xy.div(r.w),a=i.xy.div(i.w);return It(s,a)}};function NP(e){let t=MP.get(e);return t===void 0&&(t={},MP.set(e,t)),t}function AP(e,t=0){let r=NP(e),i=r[t];return i===void 0&&(r[t]=i=new We,r[t].copy(e.matrixWorld)),i}var h7=ze(u7),d7=Q(([e,t])=>Rs(1,e.oneMinus().div(t)).oneMinus()).setLayout({name:\\\"blendBurn\\\",type:\\\"vec3\\\",inputs:[{name:\\\"base\\\",type:\\\"vec3\\\"},{name:\\\"blend\\\",type:\\\"vec3\\\"}]}),c7=Q(([e,t])=>Rs(e.div(t.oneMinus()),1)).setLayout({name:\\\"blendDodge\\\",type:\\\"vec3\\\",inputs:[{name:\\\"base\\\",type:\\\"vec3\\\"},{name:\\\"blend\\\",type:\\\"vec3\\\"}]}),p7=Q(([e,t])=>e.oneMinus().mul(t.oneMinus()).oneMinus()).setLayout({name:\\\"blendScreen\\\",type:\\\"vec3\\\",inputs:[{name:\\\"base\\\",type:\\\"vec3\\\"},{name:\\\"blend\\\",type:\\\"vec3\\\"}]}),m7=Q(([e,t])=>Ct(e.mul(2).mul(t),e.oneMinus().mul(2).mul(t.oneMinus()).oneMinus(),Bu(.5,e))).setLayout({name:\\\"blendOverlay\\\",type:\\\"vec3\\\",inputs:[{name:\\\"base\\\",type:\\\"vec3\\\"},{name:\\\"blend\\\",type:\\\"vec3\\\"}]}),f7=Q(([e,t])=>{let r=t.a.add(e.a.mul(t.a.oneMinus()));return Ve(t.rgb.mul(t.a).add(e.rgb.mul(e.a).mul(t.a.oneMinus())).div(r),r)}).setLayout({name:\\\"blendColor\\\",type:\\\"vec4\\\",inputs:[{name:\\\"base\\\",type:\\\"vec4\\\"},{name:\\\"blend\\\",type:\\\"vec4\\\"}]}),g7=Q(([e])=>NS(e.rgb)),y7=Q(([e,t=D(1)])=>t.mix(NS(e.rgb),e.rgb).max(0)),x7=Q(([e,t=D(0)])=>{let r=Yr(e.r,e.g,e.b).div(3),i=e.r.max(e.g.max(e.b)),s=i.sub(r).mul(t).mul(-3);return Ct(e.rgb,i,s).max(0)}),v7=Q(([e,t=D(1)])=>{let r=K(.57735,.57735,.57735),i=t.cos();return K(e.rgb.mul(i).add(r.cross(e.rgb).mul(t.sin()).add(r.mul(pa(r,e.rgb).mul(i.oneMinus()))))).max(0)}),NS=(e,t=K(Gt.getLuminanceCoefficients(new F)))=>pa(e,t),b7=Q(([e,t=K(1),r=K(0),i=K(1),s=D(1),a=K(Gt.getLuminanceCoefficients(new F,Xh))])=>{let n=e.rgb.dot(K(a)),o=Br(e.rgb.mul(t).add(r),0),l=o.pow(i);return et(o.r.greaterThan(0),()=>{o.r.assign(l.r)}),et(o.g.greaterThan(0),()=>{o.g.assign(l.g)}),et(o.b.greaterThan(0),()=>{o.b.assign(l.b)}),o.assign(n.add(o.sub(n).mul(s)).max(0)),Ve(o.rgb,e.a)}),T7=Q(([e,t])=>e.mul(t).floor().div(t)),hy=null,S7=class extends G0{static get type(){return\\\"ViewportSharedTextureNode\\\"}constructor(e=Ga,t=null){hy===null&&(hy=new Gv),super(e,t,hy)}getTextureForReference(){return hy}updateReference(){return this}},_7=Mt(S7).setParameterLength(0,2),dy=new fe,CP=class extends An{static get type(){return\\\"PassTextureNode\\\"}constructor(e,t){super(t),this.passNode=e,this.isPassTextureNode=!0,this.setUpdateMatrix(!1)}setup(e){let t=e.getNodeProperties(this);return t.passNode=this.passNode,super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}},RP=class extends CP{static get type(){return\\\"PassMultipleTextureNode\\\"}constructor(e,t,r=!1){super(e,null),this.textureName=t,this.previousTexture=r,this.isPassMultipleTextureNode=!0}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){let e=new this.constructor(this.passNode,this.textureName,this.previousTexture);return e.uvNode=this.uvNode,e.levelNode=this.levelNode,e.biasNode=this.biasNode,e.sampler=this.sampler,e.depthNode=this.depthNode,e.compareNode=this.compareNode,e.gradNode=this.gradNode,e.gatherNode=this.gatherNode,e.offsetNode=this.offsetNode,e}},Rl=class uM extends rr{static get type(){return\\\"PassNode\\\"}constructor(t,r,i,s={}){super(\\\"vec4\\\"),this.scope=t,this.scene=r,this.camera=i,this.options=s,this._width=1,this._height=1;let a=new er(this._width,this._height,{type:Dt,...s});a.texture.name=\\\"output\\\";let n=null;(this.scope===uM.DEPTH||s.depthBuffer!==!1)&&(n=new fs,n.isRenderTargetTexture=!0,n.name=\\\"depth\\\",a.depthTexture=n),this.renderTarget=a,this.overrideMaterial=null,this.transparent=!0,this.opaque=!0,this.contextNode=null,this._contextNodeCache=null,this._textures={output:a.texture},n!==null&&(this._textures.depth=n),this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Qe(0),this._cameraFar=Qe(0),this._mrt=null,this._layers=null,this._resolutionScale=1,this._viewport=null,this._scissor=null,this.isPassNode=!0,this.updateBeforeType=ut.FRAME,this.global=!0}setResolutionScale(t){return this._resolutionScale=t,this}getResolutionScale(){return this._resolutionScale}setResolution(t){return Ue(\\\"PassNode: .setResolution() is deprecated. Use .setResolutionScale() instead.\\\"),this.setResolutionScale(t)}getResolution(){return Ue(\\\"PassNode: .getResolution() is deprecated. Use .getResolutionScale() instead.\\\"),this.getResolutionScale()}setLayers(t){return this._layers=t,this}getLayers(){return this._layers}setMRT(t){return this._mrt=t,this}getMRT(){return this._mrt}getTexture(t){let r=this._textures[t];if(r===void 0){if(t===\\\"depth\\\")throw new Error(\\\"THREE.PassNode: Depth texture is not available for this pass.\\\");r=this.renderTarget.texture.clone(),r.name=t,this._textures[t]=r,this.renderTarget.textures.push(r)}return r}getPreviousTexture(t){let r=this._previousTextures[t];return r===void 0&&(r=this.getTexture(t).clone(),this._previousTextures[t]=r),r}toggleTexture(t){let r=this._previousTextures[t];if(r!==void 0){let i=this._textures[t],s=this.renderTarget.textures.indexOf(i);this.renderTarget.textures[s]=r,this._textures[t]=r,this._previousTextures[t]=i,this._textureNodes[t].updateTexture(),this._previousTextureNodes[t].updateTexture()}}getTextureNode(t=\\\"output\\\"){let r=this._textureNodes[t];return r===void 0&&(r=new RP(this,t),r.updateTexture(),this._textureNodes[t]=r),r}getPreviousTextureNode(t=\\\"output\\\"){let r=this._previousTextureNodes[t];return r===void 0&&(this._textureNodes[t]===void 0&&this.getTextureNode(t),r=new RP(this,t,!0),r.updateTexture(),this._previousTextureNodes[t]=r),r}getViewZNode(t=\\\"depth\\\"){let r=this._viewZNodes[t];if(r===void 0){let i=this._cameraNear,s=this._cameraFar;this._viewZNodes[t]=r=W0(this.getTextureNode(t),i,s)}return r}getLinearDepthNode(t=\\\"depth\\\"){let r=this._linearDepthNodes[t];if(r===void 0){let i=this._cameraNear,s=this._cameraFar,a=this.getViewZNode(t);this._linearDepthNodes[t]=r=Vu(a,i,s)}return r}async compileAsync(t){let r=t.getRenderTarget(),i=t.getMRT();t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),await t.compileAsync(this.scene,this.camera),t.setRenderTarget(r),t.setMRT(i)}setup({renderer:t}){return this.renderTarget.samples=this.options.samples===void 0?t.samples:this.options.samples,this.renderTarget.texture.type=t.getOutputBufferType(),t.reversedDepthBuffer===!0&&this.renderTarget.depthTexture!==null&&(this.renderTarget.depthTexture.type=Er),this.scope===uM.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(t){let{renderer:r}=t,{scene:i}=this,s,a=r.getOutputRenderTarget();a&&a.isXRRenderTarget===!0?(s=r.xr.getCamera(),r.xr.updateCamera(s),dy.set(a.width,a.height)):(s=this.camera,r.getDrawingBufferSize(dy)),this.setSize(dy.width,dy.height);let n=r.getRenderTarget(),o=r.getMRT(),l=r.autoClear,u=r.transparent,h=r.opaque,d=s.layers.mask,c=r.contextNode,m=i.overrideMaterial;this._cameraNear.value=s.near,this._cameraFar.value=s.far,this._layers!==null&&(s.layers.mask=this._layers.mask);for(let y in this._previousTextures)this.toggleTexture(y);this.overrideMaterial!==null&&(i.overrideMaterial=this.overrideMaterial),r.setRenderTarget(this.renderTarget),r.setMRT(this._mrt),r.autoClear=!0,r.transparent=this.transparent,r.opaque=this.opaque,this.contextNode!==null&&((this._contextNodeCache===null||this._contextNodeCache.version!==this.version)&&(this._contextNodeCache={version:this.version,context:vo({...r.contextNode.getFlowContextData(),...this.contextNode.getFlowContextData()})}),r.contextNode=this._contextNodeCache.context);let g=i.name;i.name=this.name?this.name:i.name,r.render(i,s),i.name=g,i.overrideMaterial=m,r.setRenderTarget(n),r.setMRT(o),r.autoClear=l,r.transparent=u,r.opaque=h,r.contextNode=c,s.layers.mask=d}setSize(t,r){this._width=t,this._height=r;let i=Math.floor(this._width*this._resolutionScale),s=Math.floor(this._height*this._resolutionScale);this.renderTarget.setSize(i,s),this._scissor!==null?(this.renderTarget.scissor.copy(this._scissor).multiplyScalar(this._resolutionScale).floor(),this.renderTarget.scissorTest=!0):this.renderTarget.scissorTest=!1,this._viewport!==null&&this.renderTarget.viewport.copy(this._viewport).multiplyScalar(this._resolutionScale).floor()}setScissor(t,r,i,s){t===null?this._scissor=null:(this._scissor===null&&(this._scissor=new Wt),t.isVector4?this._scissor.copy(t):this._scissor.set(t,r,i,s))}setViewport(t,r,i,s){t===null?this._viewport=null:(this._viewport===null&&(this._viewport=new Wt),t.isVector4?this._viewport.copy(t):this._viewport.set(t,r,i,s))}dispose(){this.renderTarget.dispose()}};Rl.COLOR=\\\"color\\\",Rl.DEPTH=\\\"depth\\\";var w7=(e,t,r)=>new Rl(Rl.COLOR,e,t,r),M7=(e,t)=>new CP(e,t),N7=(e,t,r)=>new Rl(Rl.DEPTH,e,t,r),A7=class extends Rl{static get type(){return\\\"ToonOutlinePassNode\\\"}constructor(e,t,r,i,s){super(Rl.COLOR,e,t),this.colorNode=r,this.thicknessNode=i,this.alphaNode=s,this._materialCache=new WeakMap,this.name=\\\"Outline Pass\\\"}updateBefore(e){let{renderer:t}=e,r=t.getRenderObjectFunction();t.setRenderObjectFunction((i,s,a,n,o,l,u,h)=>{if((o.isMeshToonMaterial||o.isMeshToonNodeMaterial)&&o.wireframe===!1){let d=this._getOutlineMaterial(o);t.renderObject(i,s,a,n,d,l,u,h)}t.renderObject(i,s,a,n,o,l,u,h)}),super.updateBefore(e),t.setRenderObjectFunction(r)}_createMaterial(){let e=new Pt;e.isMeshToonOutlineMaterial=!0,e.name=\\\"Toon_Outline\\\",e.side=ii;let t=Qi.negate(),r=bs.mul(Cn),i=D(1),s=r.mul(Ve(wr,1)),a=r.mul(Ve(wr.add(t),1)),n=Yi(s.sub(a));return e.vertexNode=s.add(n.mul(this.thicknessNode).mul(s.w).mul(i)),e.colorNode=Ve(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}},C7=(e,t,r=new gt(0,0,0),i=.003,s=1)=>new A7(e,t,Ye(r),Ye(i),Ye(s)),EP=Q(([e,t])=>e.mul(t).clamp()).setLayout({name:\\\"linearToneMapping\\\",type:\\\"vec3\\\",inputs:[{name:\\\"color\\\",type:\\\"vec3\\\"},{name:\\\"exposure\\\",type:\\\"float\\\"}]}),PP=Q(([e,t])=>(e=e.mul(t),e.div(e.add(1)).clamp())).setLayout({name:\\\"reinhardToneMapping\\\",type:\\\"vec3\\\",inputs:[{name:\\\"color\\\",type:\\\"vec3\\\"},{name:\\\"exposure\\\",type:\\\"float\\\"}]}),BP=Q(([e,t])=>{e=e.mul(t),e=e.sub(.004).max(0);let r=e.mul(e.mul(6.2).add(.5)),i=e.mul(e.mul(6.2).add(1.7)).add(.06);return r.div(i).pow(2.2)}).setLayout({name:\\\"cineonToneMapping\\\",type:\\\"vec3\\\",inputs:[{name:\\\"color\\\",type:\\\"vec3\\\"},{name:\\\"exposure\\\",type:\\\"float\\\"}]}),R7=Q(([e])=>{let t=e.mul(e.add(.0245786)).sub(90537e-9),r=e.mul(e.add(.432951).mul(.983729)).add(.238081);return t.div(r)}),IP=Q(([e,t])=>{let r=Ni(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),i=Ni(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return e=e.mul(t).div(.6),e=r.mul(e),e=R7(e),e=i.mul(e),e.clamp()}).setLayout({name:\\\"acesFilmicToneMapping\\\",type:\\\"vec3\\\",inputs:[{name:\\\"color\\\",type:\\\"vec3\\\"},{name:\\\"exposure\\\",type:\\\"float\\\"}]}),E7=Ni(K(1.6605,-.1246,-.0182),K(-.5876,1.1329,-.1006),K(-.0728,-.0083,1.1187)),P7=Ni(K(.6274,.0691,.0164),K(.3293,.9195,.088),K(.0433,.0113,.8956)),B7=Q(([e])=>{let t=K(e).toVar(),r=K(t.mul(t)).toVar(),i=K(r.mul(r)).toVar();return D(15.5).mul(i.mul(r)).sub(mt(40.14,i.mul(t))).add(mt(31.96,i).sub(mt(6.868,r.mul(t))).add(mt(.4298,r).add(mt(.1191,t).sub(.00232))))}),FP=Q(([e,t])=>{let r=K(e).toVar(),i=Ni(K(.856627153315983,.137318972929847,.11189821299995),K(.0951212405381588,.761241990602591,.0767994186031903),K(.0482516061458583,.101439036467562,.811302368396859)),s=Ni(K(1.1271005818144368,-.1413297634984383,-.14132976349843826),K(-.11060664309660323,1.157823702216272,-.11060664309660294),K(-.016493938717834573,-.016493938717834257,1.2519364065950405)),a=D(-12.47393),n=D(4.026069);return r.mulAssign(t),r.assign(P7.mul(r)),r.assign(i.mul(r)),r.assign(Br(r,1e-10)),r.assign(wn(r)),r.assign(r.sub(a).div(n.sub(a))),r.assign(za(r,0,1)),r.assign(B7(r)),r.assign(s.mul(r)),r.assign(ma(Br(K(0),r),K(2.2))),r.assign(E7.mul(r)),r.assign(za(r,0,1)),r}).setLayout({name:\\\"agxToneMapping\\\",type:\\\"vec3\\\",inputs:[{name:\\\"color\\\",type:\\\"vec3\\\"},{name:\\\"exposure\\\",type:\\\"float\\\"}]}),LP=Q(([e,t])=>{let r=D(.76),i=D(.15);e=e.mul(t);let s=Rs(e.r,Rs(e.g,e.b)),a=Zi(s.lessThan(.08),s.sub(mt(6.25,s.mul(s))),.04);e.subAssign(a);let n=Br(e.r,Br(e.g,e.b));et(n.lessThan(r),()=>e);let o=It(1,r),l=It(1,o.mul(o).div(n.add(o.sub(r))));e.mulAssign(l.div(n));let u=It(1,js(1,i.mul(n.sub(l)).add(1)));return Ct(e,K(l),u)}).setLayout({name:\\\"neutralToneMapping\\\",type:\\\"vec3\\\",inputs:[{name:\\\"color\\\",type:\\\"vec3\\\"},{name:\\\"exposure\\\",type:\\\"float\\\"}]}),pr=class extends Ke{static get type(){return\\\"CodeNode\\\"}constructor(e=\\\"\\\",t=[],r=\\\"\\\"){super(\\\"code\\\"),this.isCodeNode=!0,this.global=!0,this.code=e,this.includes=t,this.language=r}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){let t=this.getIncludes(e);for(let i of t)i.build(e);let r=e.getCodeFromNode(this,this.getNodeType(e));return r.code=this.code,r.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}},cy=Mt(pr).setParameterLength(1,3),I7=(e,t)=>cy(e,t,\\\"js\\\"),F7=(e,t)=>cy(e,t,\\\"wgsl\\\"),L7=(e,t)=>cy(e,t,\\\"glsl\\\"),AS=class extends pr{static get type(){return\\\"FunctionNode\\\"}constructor(e=\\\"\\\",t=[],r=\\\"\\\"){super(e,t,r)}generateNodeType(e){return this.getNodeFunction(e).type}getMemberType(e,t){let r=this.getNodeType(e);return e.getStructTypeNode(r).getMemberType(e,t)}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){let t=e.getDataFromNode(this),r=t.nodeFunction;return r===void 0&&(r=e.parser.parseFunction(this.code),t.nodeFunction=r),r}generate(e,t){super.generate(e);let r=this.getNodeFunction(e),i=r.name,s=r.type,a=e.getCodeFromNode(this,s);i!==\\\"\\\"&&(a.name=i);let n=e.getPropertyName(a),o=this.getNodeFunction(e).getCode(n);return a.code=o+`\\n`,t===\\\"property\\\"?n:e.format(`${n}()`,s,t)}},kP=(e,t=[],r=\\\"\\\")=>{let i=new AS(e,t,r);return yb((...s)=>i.call(...s),i)},k7=(e,t)=>kP(e,t,\\\"glsl\\\"),D7=(e,t)=>kP(e,t,\\\"wgsl\\\");function CS(e){let t,r=e.context.getViewZ;return r!==void 0&&(t=r(this)),(t||Wr.z).negate()}var DP=Q(([e,t],r)=>{let i=CS(r);return Hs(e,t,i)}),OP=Q(([e],t)=>{let r=CS(t);return e.mul(e,r,r).negate().exp().oneMinus()}),O7=Q(([e,t],r)=>{let i=CS(r),s=t.sub(Rn.y).max(0).toConst().mul(i).toConst();return e.mul(e,s,s).negate().exp().oneMinus()}),RS=Q(([e,t])=>Ve(t.toFloat().mix(Sd.rgb,e.toVec3()),Sd.a)),Xu=null,$u=null,U7=class extends Ke{static get type(){return\\\"RangeNode\\\"}constructor(e=D(),t=D()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){let t=this.getConstNode(this.minNode),r=this.getConstNode(this.maxNode),i=e.getTypeLength(ol(t.value)),s=e.getTypeLength(ol(r.value));return i>s?i:s}generateNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):\\\"float\\\"}getConstNode(e){let t=null;if(e.traverse(r=>{r.isConstNode===!0&&(t=r)}),t===null)throw new OC('THREE.TSL: No \\\"ConstNode\\\" found in node graph.',this.stackTrace);return t}setup(e){let t=e.object,r=null;if(t.count>1){let i=this.getConstNode(this.minNode),s=this.getConstNode(this.maxNode),a=i.value,n=s.value,o=e.getTypeLength(ol(a)),l=e.getTypeLength(ol(n));Xu=Xu||new Wt,$u=$u||new Wt,Xu.setScalar(0),$u.setScalar(0),o===1?Xu.setScalar(a):a.isColor?Xu.set(a.r,a.g,a.b,1):Xu.set(a.x,a.y,a.z||0,a.w||0),l===1?$u.setScalar(n):n.isColor?$u.set(n.r,n.g,n.b,1):$u.set(n.x,n.y,n.z||0,n.w||0);let u=4,h=u*t.count,d=new Float32Array(h);for(let m=0;m\\u003ch;m++){let g=m%u,y=Xu.getComponent(g),b=$u.getComponent(g);d[m]=Bt.lerp(y,b,Math.random())}let c=this.getNodeType(e);if(t.count*4*4\\u003c=e.getUniformBufferLimit())r=Md(d,\\\"vec4\\\",t.count).element(Va).convert(c);else{let m=new ud(d,4);e.geometry.setAttribute(\\\"__range\\\"+this.id,m),r=T0(m).convert(c)}}else r=D(0);return r}},z7=Mt(U7).setParameterLength(2),V7=class extends Ke{static get type(){return\\\"ComputeBuiltinNode\\\"}constructor(e,t){super(t),this._builtinName=e}getHash(e){return this.getBuiltinName(e)}generateNodeType(){return this.nodeType}setBuiltinName(e){return this._builtinName=e,this}getBuiltinName(){return this._builtinName}hasBuiltin(e){return e.hasBuiltin(this._builtinName)}generate(e,t){let r=this.getBuiltinName(e),i=this.getNodeType(e);return e.shaderStage===\\\"compute\\\"?e.format(r,i,t):(Ue(`ComputeBuiltinNode: Compute built-in value ${r} can not be accessed in the ${e.shaderStage} stage`),e.generateConst(i))}serialize(e){super.serialize(e),e.global=this.global,e._builtinName=this._builtinName}deserialize(e){super.deserialize(e),this.global=e.global,this._builtinName=e._builtinName}},qp=(e,t)=>new V7(e,t),G7=qp(\\\"numWorkgroups\\\",\\\"uvec3\\\"),W7=qp(\\\"workgroupId\\\",\\\"uvec3\\\"),j7=qp(\\\"globalId\\\",\\\"uvec3\\\"),H7=qp(\\\"localId\\\",\\\"uvec3\\\"),X7=qp(\\\"subgroupSize\\\",\\\"uint\\\"),$7=class extends Ke{constructor(e){super(),this.scope=e,this.isBarrierNode=!0}setup(e){e.allowEarlyReturns=!1,e.allowGlobalVariables=!1}generate(e){let{scope:t}=this,{renderer:r}=e;r.backend.isWebGLBackend===!0?e.addFlowCode(`\\t// ${t}Barrier \\n`):e.addLineFlowCode(`${t}Barrier()`,this)}},ES=Mt($7),q7=()=>ES(\\\"workgroup\\\").toStack(),Y7=()=>ES(\\\"storage\\\").toStack(),Z7=()=>ES(\\\"texture\\\").toStack(),J7=class extends _u{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let r,i=e.isContextAssign();if(r=super.generate(e),i!==!0){let s=this.getNodeType(e);r=e.format(r,s,t)}return r}},Q7=class extends Ke{constructor(e,t,r=0){super(t),this.bufferType=t,this.bufferCount=r,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e,this.name=\\\"\\\"}setName(e){return this.name=e,this}label(e){return Ue('TSL: \\\"label()\\\" has been deprecated. Use \\\"setName()\\\" instead.',new $r),this.setName(e)}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return`${this.scope}Array`}element(e){return new J7(this,e)}generate(e){let t=this.name!==\\\"\\\"?this.name:`${this.scope}Array_${this.id}`;return e.getScopedArray(t,this.scope.toLowerCase(),this.bufferType,this.bufferCount)}},K7=(e,t)=>new Q7(\\\"Workgroup\\\",e,t),fi=class extends Ke{static get type(){return\\\"AtomicFunctionNode\\\"}constructor(e,t,r){super(\\\"uint\\\"),this.method=e,this.pointerNode=t,this.valueNode=r,this.parents=!0}getInputType(e){return this.pointerNode.getNodeType(e)}generateNodeType(e){return this.getInputType(e)}generate(e){let t=e.getNodeProperties(this),r=t.parents,i=this.method,s=this.getNodeType(e),a=this.getInputType(e),n=this.pointerNode,o=this.valueNode,l=[];l.push(`&${n.build(e,a)}`),o!==null&&l.push(o.build(e,a));let u=`${e.getMethod(i,s)}( ${l.join(\\\", \\\")} )`;if(r&&r.length===1&&r[0].isStackNode===!0)e.addLineFlowCode(u,this);else return t.constNode===void 0&&(t.constNode=Xs(u,s).toConst()),t.constNode.build(e)}};fi.ATOMIC_LOAD=\\\"atomicLoad\\\",fi.ATOMIC_STORE=\\\"atomicStore\\\",fi.ATOMIC_ADD=\\\"atomicAdd\\\",fi.ATOMIC_SUB=\\\"atomicSub\\\",fi.ATOMIC_MAX=\\\"atomicMax\\\",fi.ATOMIC_MIN=\\\"atomicMin\\\",fi.ATOMIC_AND=\\\"atomicAnd\\\",fi.ATOMIC_OR=\\\"atomicOr\\\",fi.ATOMIC_XOR=\\\"atomicXor\\\";var e9=Mt(fi),In=(e,t,r)=>e9(e,t,r).toStack(),t9=e=>In(fi.ATOMIC_LOAD,e,null),r9=(e,t)=>In(fi.ATOMIC_STORE,e,t),i9=(e,t)=>In(fi.ATOMIC_ADD,e,t),s9=(e,t)=>In(fi.ATOMIC_SUB,e,t),a9=(e,t)=>In(fi.ATOMIC_MAX,e,t),n9=(e,t)=>In(fi.ATOMIC_MIN,e,t),o9=(e,t)=>In(fi.ATOMIC_AND,e,t),l9=(e,t)=>In(fi.ATOMIC_OR,e,t),u9=(e,t)=>In(fi.ATOMIC_XOR,e,t),$e=class Zo extends rr{static get type(){return\\\"SubgroupFunctionNode\\\"}constructor(t,r=null,i=null){super(),this.method=t,this.aNode=r,this.bNode=i}getInputType(t){let r=this.aNode?this.aNode.getNodeType(t):null,i=this.bNode?this.bNode.getNodeType(t):null,s=t.isMatrix(r)?0:t.getTypeLength(r),a=t.isMatrix(i)?0:t.getTypeLength(i);return s>a?r:i}generateNodeType(t){let r=this.method;return r===Zo.SUBGROUP_ELECT?\\\"bool\\\":r===Zo.SUBGROUP_BALLOT?\\\"uvec4\\\":this.getInputType(t)}generate(t,r){let i=this.method,s=this.getNodeType(t),a=this.getInputType(t),n=this.aNode,o=this.bNode,l=[];if(i===Zo.SUBGROUP_BROADCAST||i===Zo.SUBGROUP_SHUFFLE||i===Zo.QUAD_BROADCAST){let h=o.getNodeType(t);l.push(n.build(t,s),o.build(t,h===\\\"float\\\"?\\\"int\\\":s))}else i===Zo.SUBGROUP_SHUFFLE_XOR||i===Zo.SUBGROUP_SHUFFLE_DOWN||i===Zo.SUBGROUP_SHUFFLE_UP?l.push(n.build(t,s),o.build(t,\\\"uint\\\")):(n!==null&&l.push(n.build(t,a)),o!==null&&l.push(o.build(t,a)));let u=l.length===0?\\\"()\\\":`( ${l.join(\\\", \\\")} )`;return t.format(`${t.getMethod(i,s)}${u}`,s,r)}serialize(t){super.serialize(t),t.method=this.method}deserialize(t){super.deserialize(t),this.method=t.method}};$e.SUBGROUP_ELECT=\\\"subgroupElect\\\",$e.SUBGROUP_BALLOT=\\\"subgroupBallot\\\",$e.SUBGROUP_ADD=\\\"subgroupAdd\\\",$e.SUBGROUP_INCLUSIVE_ADD=\\\"subgroupInclusiveAdd\\\",$e.SUBGROUP_EXCLUSIVE_AND=\\\"subgroupExclusiveAdd\\\",$e.SUBGROUP_MUL=\\\"subgroupMul\\\",$e.SUBGROUP_INCLUSIVE_MUL=\\\"subgroupInclusiveMul\\\",$e.SUBGROUP_EXCLUSIVE_MUL=\\\"subgroupExclusiveMul\\\",$e.SUBGROUP_AND=\\\"subgroupAnd\\\",$e.SUBGROUP_OR=\\\"subgroupOr\\\",$e.SUBGROUP_XOR=\\\"subgroupXor\\\",$e.SUBGROUP_MIN=\\\"subgroupMin\\\",$e.SUBGROUP_MAX=\\\"subgroupMax\\\",$e.SUBGROUP_ALL=\\\"subgroupAll\\\",$e.SUBGROUP_ANY=\\\"subgroupAny\\\",$e.SUBGROUP_BROADCAST_FIRST=\\\"subgroupBroadcastFirst\\\",$e.QUAD_SWAP_X=\\\"quadSwapX\\\",$e.QUAD_SWAP_Y=\\\"quadSwapY\\\",$e.QUAD_SWAP_DIAGONAL=\\\"quadSwapDiagonal\\\",$e.SUBGROUP_BROADCAST=\\\"subgroupBroadcast\\\",$e.SUBGROUP_SHUFFLE=\\\"subgroupShuffle\\\",$e.SUBGROUP_SHUFFLE_XOR=\\\"subgroupShuffleXor\\\",$e.SUBGROUP_SHUFFLE_UP=\\\"subgroupShuffleUp\\\",$e.SUBGROUP_SHUFFLE_DOWN=\\\"subgroupShuffleDown\\\",$e.QUAD_BROADCAST=\\\"quadBroadcast\\\";var h9=Ee($e,$e.SUBGROUP_ELECT).setParameterLength(0),d9=Ee($e,$e.SUBGROUP_BALLOT).setParameterLength(1),c9=Ee($e,$e.SUBGROUP_ADD).setParameterLength(1),p9=Ee($e,$e.SUBGROUP_INCLUSIVE_ADD).setParameterLength(1),m9=Ee($e,$e.SUBGROUP_EXCLUSIVE_AND).setParameterLength(1),f9=Ee($e,$e.SUBGROUP_MUL).setParameterLength(1),g9=Ee($e,$e.SUBGROUP_INCLUSIVE_MUL).setParameterLength(1),y9=Ee($e,$e.SUBGROUP_EXCLUSIVE_MUL).setParameterLength(1),x9=Ee($e,$e.SUBGROUP_AND).setParameterLength(1),v9=Ee($e,$e.SUBGROUP_OR).setParameterLength(1),b9=Ee($e,$e.SUBGROUP_XOR).setParameterLength(1),T9=Ee($e,$e.SUBGROUP_MIN).setParameterLength(1),S9=Ee($e,$e.SUBGROUP_MAX).setParameterLength(1),_9=Ee($e,$e.SUBGROUP_ALL).setParameterLength(0),w9=Ee($e,$e.SUBGROUP_ANY).setParameterLength(0),M9=Ee($e,$e.SUBGROUP_BROADCAST_FIRST).setParameterLength(2),N9=Ee($e,$e.QUAD_SWAP_X).setParameterLength(1),A9=Ee($e,$e.QUAD_SWAP_Y).setParameterLength(1),C9=Ee($e,$e.QUAD_SWAP_DIAGONAL).setParameterLength(1),R9=Ee($e,$e.SUBGROUP_BROADCAST).setParameterLength(2),E9=Ee($e,$e.SUBGROUP_SHUFFLE).setParameterLength(2),P9=Ee($e,$e.SUBGROUP_SHUFFLE_XOR).setParameterLength(2),B9=Ee($e,$e.SUBGROUP_SHUFFLE_UP).setParameterLength(2),I9=Ee($e,$e.SUBGROUP_SHUFFLE_DOWN).setParameterLength(2),F9=Ee($e,$e.QUAD_BROADCAST).setParameterLength(1),py;function my(e){py=py||new WeakMap;let t=py.get(e);return t===void 0&&py.set(e,t={}),t}function fy(e){let t=my(e);return t.shadowMatrix||(t.shadowMatrix=Qe(\\\"mat4\\\").setGroup(st).onRenderUpdate(r=>((e.castShadow!==!0||r.renderer.shadowMap.enabled===!1)&&(e.shadow.camera.coordinateSystem!==r.camera.coordinateSystem&&(e.shadow.camera.coordinateSystem=r.camera.coordinateSystem,e.shadow.camera.updateProjectionMatrix()),e.shadow.updateMatrices(e)),e.shadow.matrix)))}function UP(e,t=Rn){let r=fy(e).mul(t);return r.xyz.div(r.w)}function PS(e){let t=my(e);return t.position||(t.position=Qe(new F).setGroup(st).onRenderUpdate((r,i)=>i.value.setFromMatrixPosition(e.matrixWorld)))}function zP(e){let t=my(e);return t.targetPosition||(t.targetPosition=Qe(new F).setGroup(st).onRenderUpdate((r,i)=>i.value.setFromMatrixPosition(e.target.matrixWorld)))}function BS(e){let t=my(e);return t.viewPosition||(t.viewPosition=Qe(new F).setGroup(st).onRenderUpdate(({camera:r},i)=>{i.value=i.value||new F,i.value.setFromMatrixPosition(e.matrixWorld),i.value.applyMatrix4(r.matrixWorldInverse)}))}var IS=e=>xl.transformDirection(PS(e).sub(zP(e))),L9=go(\\\"vec3\\\",\\\"totalDiffuse\\\"),k9=go(\\\"vec3\\\",\\\"totalSpecular\\\"),D9=go(\\\"vec3\\\",\\\"outgoingLight\\\"),O9=e=>e.sort((t,r)=>t.id-r.id),U9=(e,t)=>{for(let r of t)if(r.isAnalyticLightNode&&r.light.id===e)return r;return null},FS=new WeakMap,Yp=[],LS=class extends Ke{static get type(){return\\\"LightsNode\\\"}constructor(){super(\\\"vec3\\\"),this.totalDiffuseNode=L9,this.totalSpecularNode=k9,this.outgoingLightNode=D9,this._lights=[],this.global=!0}customCacheKey(){let e=this._lights;for(let r=0;r\\u003ce.length;r++){let i=e[r];if(Yp.push(i.id),Yp.push(i.castShadow?1:0),i.isSpotLight===!0){let s=i.map!==null?i.map.id:-1,a=i.colorNode?i.colorNode.getCacheKey():-1;Yp.push(s,a)}}let t=Sp(Yp);return Yp.length=0,t}getHash(e){let t=e.getDataFromNode(this);if(t.lightNodesHash===void 0){let r=this.setupLightsNode(e);t.lightNodes=r;let i=[];for(let s of r)i.push(s.getHash());t.lightNodesHash=\\\"lights-\\\"+i.join(\\\",\\\")}return t.lightNodesHash}analyze(e){let t=e.getNodeProperties(this);for(let r of t.nodes)r.build(e);t.outputNode.build(e)}setupLightsNode(e){let t=e.getDataFromNode(this),r=[],i=t.lightNodes||null,s=e.context.materialLightings,a=O9([...s,...this._lights]),n=e.renderer.library;for(let o of a)if(o.isNode)r.push(o);else{let l=null;if(i!==null&&(l=U9(o.id,i)),l===null){let u=n.getLightNodeClass(o.constructor);if(u===null){Ue(`LightsNode.setupNodeLights: Light node not found for ${o.constructor.name}`);continue}FS.has(o)===!1&&FS.set(o,new u(o)),l=FS.get(o)}r.push(l)}return r}setupDirectLight(e,t,r){let{lightingModel:i,reflectedLight:s}=e.context;i.direct({...r,lightNode:t,reflectedLight:s},e)}setupDirectRectAreaLight(e,t,r){let{lightingModel:i,reflectedLight:s}=e.context;i.directRectArea({...r,lightNode:t,reflectedLight:s},e)}setupLights(e,t){for(let r of t)r.build(e)}getLightNodes(e){let t=e.getDataFromNode(this);return t.lightNodes===void 0&&(t.lightNodes=this.setupLightsNode(e)),t.lightNodes}setup(e){let t=e.lightsNode;e.lightsNode=this;let r=this.outgoingLightNode,i=e.context,s=i.lightingModel,a=e.getNodeProperties(this);if(s){let{totalDiffuseNode:n,totalSpecularNode:o}=this;i.outgoingLight=r;let l=e.addStack();a.nodes=l.nodes,s.start(e);let{backdrop:u,backdropAlpha:h}=i,{directDiffuse:d,directSpecular:c,indirectDiffuse:m,indirectSpecular:g}=i.reflectedLight,y=d.add(m);u!==null&&(h!==null?y=K(h.mix(y,u)):y=K(u)),n.assign(y),o.assign(c.add(g)),r.assign(n.add(o)),s.finish(e),r=r.bypass(e.removeStack())}else a.nodes=[];return e.lightsNode=t,r}setLights(e){return this._lights=e,this}getLights(){return this._lights}get hasLights(){return this._lights.length>0}},z9=(e=[])=>new LS().setLights(e),V9=class extends Ke{static get type(){return\\\"ShadowBaseNode\\\"}constructor(e){super(),this.light=e,this.updateBeforeType=ut.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({context:e,material:t}){kS.assign(t.receivedShadowPositionNode||e.shadowPositionWorld||Rn)}},kS=go(\\\"vec3\\\",\\\"shadowPositionWorld\\\");function DS(e,t={}){return t.toneMapping=e.toneMapping,t.toneMappingExposure=e.toneMappingExposure,t.outputColorSpace=e.outputColorSpace,t.renderTarget=e.getRenderTarget(),t.activeCubeFace=e.getActiveCubeFace(),t.activeMipmapLevel=e.getActiveMipmapLevel(),t.renderObjectFunction=e.getRenderObjectFunction(),t.pixelRatio=e.getPixelRatio(),t.mrt=e.getMRT(),t.clearColor=e.getClearColor(t.clearColor||new gt),t.clearAlpha=e.getClearAlpha(),t.autoClear=e.autoClear,t.scissorTest=e.getScissorTest(),t}function VP(e,t){return t=DS(e,t),e.setMRT(null),e.setRenderObjectFunction(null),e.setClearColor(0,1),e.autoClear=!0,t}function GP(e,t){e.toneMapping=t.toneMapping,e.toneMappingExposure=t.toneMappingExposure,e.outputColorSpace=t.outputColorSpace,e.setRenderTarget(t.renderTarget,t.activeCubeFace,t.activeMipmapLevel),e.setRenderObjectFunction(t.renderObjectFunction),e.setPixelRatio(t.pixelRatio),e.setMRT(t.mrt),e.setClearColor(t.clearColor,t.clearAlpha),e.autoClear=t.autoClear,e.setScissorTest(t.scissorTest)}function OS(e,t={}){return t.background=e.background,t.backgroundNode=e.backgroundNode,t.overrideMaterial=e.overrideMaterial,t}function WP(e,t){return t=OS(e,t),e.background=null,e.backgroundNode=null,e.overrideMaterial=null,t}function jP(e,t){e.background=t.background,e.backgroundNode=t.backgroundNode,e.overrideMaterial=t.overrideMaterial}function G9(e,t,r={}){return r=DS(e,r),r=OS(t,r),r}function HP(e,t,r){return r=VP(e,r),r=WP(t,r),r}function XP(e,t,r){GP(e,r),jP(t,r)}var Es=Object.freeze({__proto__:null,resetRendererAndSceneState:HP,resetRendererState:VP,resetSceneState:WP,restoreRendererAndSceneState:XP,restoreRendererState:GP,restoreSceneState:jP,saveRendererAndSceneState:G9,saveRendererState:DS,saveSceneState:OS}),gy=new WeakMap,$P=Q(({depthTexture:e,shadowCoord:t,depthLayer:r})=>{let i=Ot(e,t.xy).setName(\\\"t_basic\\\");return e.isArrayTexture&&(i=i.depth(r)),i.compare(t.z)}),qP=Q(({depthTexture:e,shadowCoord:t,shadow:r,depthLayer:i})=>{let s=(h,d)=>{let c=Ot(e,h);return e.isArrayTexture&&(c=c.depth(i)),c.compare(d)},a=cr(\\\"mapSize\\\",\\\"vec2\\\",r).setGroup(st),n=cr(\\\"radius\\\",\\\"float\\\",r).setGroup(st),o=ke(1).div(a),l=n.mul(o.x),u=SS(ku.xy).mul(6.28318530718);return Yr(s(t.xy.add(ja(0,5,u).mul(l)),t.z),s(t.xy.add(ja(1,5,u).mul(l)),t.z),s(t.xy.add(ja(2,5,u).mul(l)),t.z),s(t.xy.add(ja(3,5,u).mul(l)),t.z),s(t.xy.add(ja(4,5,u).mul(l)),t.z)).mul(1/5)}),YP=Q(({depthTexture:e,shadowCoord:t,shadow:r,depthLayer:i})=>{let s=cr(\\\"mapSize\\\",\\\"vec2\\\",r).setGroup(st),a=ke(1).div(s),n=t.xy,o=Oa(n.mul(s).add(.5)).toConst();n.subAssign(o.sub(.5).mul(a));let l=m=>{let g=Ot(e,n).offset(m).gather();return e.isArrayTexture&&(g=g.depth(i)),g.compare(t.z)},u=l(Pr(-1,1)).toConst(),h=l(Pr(1,1)).toConst(),d=l(Pr(-1,-1)).toConst(),c=l(Pr(1,-1)).toConst();return Yr(Ct(u.x,h.y,o.x).add(u.y).add(h.x).mul(o.y),Ct(u.w,h.z,o.x).add(u.z).add(h.w),Ct(d.x,c.y,o.x).add(d.y).add(c.x),Ct(d.w,c.z,o.x).add(d.z).add(c.w).mul(o.y.oneMinus())).mul(1/9)}),ZP=Q(({depthTexture:e,shadowCoord:t,depthLayer:r},i)=>{let s=Ot(e).sample(t.xy);e.isArrayTexture&&(s=s.depth(r)),s=s.rg;let a=s.x,n=Br(1e-7,s.y.mul(s.y)),o=i.renderer.reversedDepthBuffer?Bu(a,t.z):Bu(t.z,a),l=D(1).toVar();return et(o.notEqual(1),()=>{let u=t.z.sub(a),h=n.div(n.add(u.mul(u)));h=za(It(h,.3).div(.65)),l.assign(Br(o,h))}),l}),JP=e=>{let t=gy.get(e);return t===void 0&&(t=new Pt,t.colorNode=Ve(0,0,0,1),t.isShadowPassMaterial=!0,t.name=\\\"ShadowMaterial\\\",t.blending=Kn,t.fog=!1,gy.set(e,t)),t},QP=e=>{let t=gy.get(e);t!==void 0&&(t.dispose(),gy.delete(e))},KP=new Ml,Od=[],e3=(e,t,r,i)=>{Od[0]=e,Od[1]=t;let s=KP.get(Od);return(s===void 0||s.shadowType!==r||s.useVelocity!==i)&&(s=(a,n,o,l,u,h,d,c,m)=>{(a.castShadow===!0||a.receiveShadow&&r===Lh)&&(i&&(HN(a).useVelocity=!0),a.onBeforeShadow(e,a,o,t.camera,l,n.overrideMaterial,h),e.renderObject(a,n,o,l,u,h,d,c,m),a.onAfterShadow(e,a,o,t.camera,l,n.overrideMaterial,h))},s.shadowType=r,s.useVelocity=i,KP.set(Od,s)),Od[0]=null,Od[1]=null,s},W9=Q(({samples:e,radius:t,size:r,shadowPass:i,depthLayer:s})=>{let a=D(0).toVar(\\\"meanVertical\\\"),n=D(0).toVar(\\\"squareMeanVertical\\\"),o=e.lessThanEqual(D(1)).select(D(0),D(2).div(e.sub(1))),l=e.lessThanEqual(D(1)).select(D(0),D(-1));Qt({start:Y(0),end:Y(e),type:\\\"int\\\",condition:\\\"\\u003c\\\"},({i:h})=>{let d=l.add(D(h).mul(o)),c=i.sample(Yr(ku.xy,ke(0,d).mul(t)).div(r));i.value.isArrayTexture&&(c=c.depth(s)),c=c.x,a.addAssign(c),n.addAssign(c.mul(c))}),a.divAssign(e),n.divAssign(e);let u=ys(n.sub(a.mul(a)).max(0));return ke(a,u)}),j9=Q(({samples:e,radius:t,size:r,shadowPass:i,depthLayer:s})=>{let a=D(0).toVar(\\\"meanHorizontal\\\"),n=D(0).toVar(\\\"squareMeanHorizontal\\\"),o=e.lessThanEqual(D(1)).select(D(0),D(2).div(e.sub(1))),l=e.lessThanEqual(D(1)).select(D(0),D(-1));Qt({start:Y(0),end:Y(e),type:\\\"int\\\",condition:\\\"\\u003c\\\"},({i:h})=>{let d=l.add(D(h).mul(o)),c=i.sample(Yr(ku.xy,ke(d,0).mul(t)).div(r));i.value.isArrayTexture&&(c=c.depth(s)),a.addAssign(c.x),n.addAssign(Yr(c.y.mul(c.y),c.x.mul(c.x)))}),a.divAssign(e),n.divAssign(e);let u=ys(n.sub(a.mul(a)).max(0));return ke(a,u)}),H9=[$P,qP,YP,ZP],US,yy=new Wa,t3=class extends V9{static get type(){return\\\"ShadowNode\\\"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this._currentShadowType=null,this._cameraFrameId=new WeakMap,this.isShadowNode=!0,this.depthLayer=0}setupShadowFilter(e,{filterFn:t,depthTexture:r,shadowCoord:i,shadow:s,depthLayer:a}){let n=i.x.greaterThanEqual(0).and(i.x.lessThanEqual(1)).and(i.y.greaterThanEqual(0)).and(i.y.lessThanEqual(1)).and(i.z.lessThanEqual(1)),o=t({depthTexture:r,shadowCoord:i,shadow:s,depthLayer:a});return n.select(o,D(1))}setupShadowCoord(e,t){let{shadow:r}=this,{renderer:i}=e,s=r.biasNode||cr(\\\"bias\\\",\\\"float\\\",r).setGroup(st),a=t,n;if(r.camera.isOrthographicCamera||i.logarithmicDepthBuffer!==!0)a=a.xyz.div(a.w),n=a.z;else{let o=a.w;a=a.xy.div(o);let l=cr(\\\"near\\\",\\\"float\\\",r.camera).setGroup(st),u=cr(\\\"far\\\",\\\"float\\\",r.camera).setGroup(st);n=j0(o.negate(),l,u)}return a=K(a.x,a.y.oneMinus(),i.reversedDepthBuffer?n.sub(s):n.add(s)),a}getShadowFilterFn(e){return H9[e]}setupRenderTarget(e,t){let r=new fs(e.mapSize.width,e.mapSize.height);r.name=\\\"ShadowDepthTexture\\\",r.compareFunction=t.renderer.reversedDepthBuffer?$h:tp;let i=t.createRenderTarget(e.mapSize.width,e.mapSize.height);return i.texture.name=\\\"ShadowMap\\\",i.texture.type=e.mapType,i.depthTexture=r,{shadowMap:i,depthTexture:r}}setupShadow(e){let{renderer:t,camera:r}=e,{light:i,shadow:s}=this,{depthTexture:a,shadowMap:n}=this.setupRenderTarget(s,e),o=t.shadowMap.type,l=t.hasCompatibility(fu.TEXTURE_COMPARE);if((o===xM||o===wD)&&l?(a.minFilter=lr,a.magFilter=lr):(a.minFilter=or,a.magFilter=or),s.camera.coordinateSystem=r.coordinateSystem,s.camera.updateProjectionMatrix(),o===Lh&&s.isPointLightShadow!==!0){a.compareFunction=null,n.depth>1?(n._vsmShadowMapVertical||(n._vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:ha,type:Dt,depth:n.depth,depthBuffer:!1}),n._vsmShadowMapVertical.texture.name=\\\"VSMVertical\\\"),this.vsmShadowMapVertical=n._vsmShadowMapVertical,n._vsmShadowMapHorizontal||(n._vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:ha,type:Dt,depth:n.depth,depthBuffer:!1}),n._vsmShadowMapHorizontal.texture.name=\\\"VSMHorizontal\\\"),this.vsmShadowMapHorizontal=n._vsmShadowMapHorizontal):(this.vsmShadowMapVertical=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:ha,type:Dt,depthBuffer:!1}),this.vsmShadowMapHorizontal=e.createRenderTarget(s.mapSize.width,s.mapSize.height,{format:ha,type:Dt,depthBuffer:!1}));let N=Ot(a);a.isArrayTexture&&(N=N.depth(this.depthLayer));let C=Ot(this.vsmShadowMapVertical.texture);a.isArrayTexture&&(C=C.depth(this.depthLayer));let R=cr(\\\"blurSamples\\\",\\\"float\\\",s).setGroup(st),E=cr(\\\"radius\\\",\\\"float\\\",s).setGroup(st),P=cr(\\\"mapSize\\\",\\\"vec2\\\",s).setGroup(st),I=this.vsmMaterialVertical||(this.vsmMaterialVertical=new Pt);I.fragmentNode=W9({samples:R,radius:E,size:P,shadowPass:N,depthLayer:this.depthLayer}).context(e.getSharedContext()),I.name=\\\"VSMVertical\\\",I=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new Pt),I.fragmentNode=j9({samples:R,radius:E,size:P,shadowPass:C,depthLayer:this.depthLayer}).context(e.getSharedContext()),I.name=\\\"VSMHorizontal\\\"}let u=cr(\\\"intensity\\\",\\\"float\\\",s).setGroup(st),h=cr(\\\"normalBias\\\",\\\"float\\\",s).setGroup(st),d=fy(i),c=vl.mul(h),m;!t.highPrecision||e.material.receivedShadowPositionNode||e.context.shadowPositionWorld?m=d.mul(kS.add(c)):m=Qe(\\\"mat4\\\").onObjectUpdate(({object:N},C)=>C.value.multiplyMatrices(d.value,N.matrixWorld)).mul(wr).add(d.mul(Ve(c,0)));let g=this.setupShadowCoord(e,m),y=s.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(y===null)throw new Error(\\\"THREE.WebGPURenderer: Shadow map type not supported yet.\\\");let b=o===Lh&&s.isPointLightShadow!==!0?this.vsmShadowMapHorizontal.texture:a,v=this.setupShadowFilter(e,{filterFn:y,shadowTexture:n.texture,depthTexture:b,shadowCoord:g,shadow:s,depthLayer:this.depthLayer}),S;t.shadowMap.transmitted===!0&&(n.texture.isCubeTexture?S=Ts(n.texture,g.xyz):(S=Ot(n.texture,g),a.isArrayTexture&&(S=S.depth(this.depthLayer))));let T;S?T=Ct(1,v.rgb.mix(S,1),u.mul(S.a)).toVar():T=Ct(1,v,u).toVar(),this.shadowMap=n,this.shadow.map=n;let w=`${this.light.type} Shadow [ ${this.light.name||\\\"ID: \\\"+this.light.id} ]`;return S&&T.toInspector(`${w} / Color`,()=>this.shadowMap.texture.isCubeTexture?Ts(this.shadowMap.texture,qT()):Ot(this.shadowMap.texture)),T.toInspector(`${w} / Depth`,()=>{let N=cr(\\\"near\\\",\\\"float\\\",this.shadow.camera),C=cr(\\\"far\\\",\\\"float\\\",this.shadow.camera),R;this.shadowMap.texture.isCubeTexture?R=Ts(this.shadowMap.depthTexture,qT()).r:R=Ot(this.shadowMap.depthTexture).r;let E;return this.shadow.camera.isPerspectiveCamera?E=W0(R,N,C):E=aE(R,N,C),E=Vu(E,N,C),E.oneMinus()})}setup(e){if(e.renderer.shadowMap.enabled!==!1)return Q(()=>{let t=e.renderer.shadowMap.type;this._currentShadowType!==t&&(this._reset(),this._node=null);let r=this._node;return this.setupShadowPosition(e),r===null&&(this._node=r=this.setupShadow(e),this._currentShadowType=t),e.material.receivedShadowNode&&(r=e.material.receivedShadowNode(r)),r})()}renderShadow(e){let{shadow:t,shadowMap:r,light:i}=this,{renderer:s,scene:a}=e;t.updateMatrices(i),r.setSize(t.mapSize.width,t.mapSize.height,r.depth);let n=a.name;a.name=`Shadow Map [ ${i.name||\\\"ID: \\\"+i.id} ]`,s.render(a,t.camera),a.name=n}updateShadow(e){let{shadowMap:t,light:r,shadow:i}=this,{renderer:s,scene:a,camera:n}=e,o=s.shadowMap.type,l=t.depthTexture.version;this._depthVersionCached=l;let u=i.camera.layers.mask;(i.camera.layers.mask&4294967294)===0&&(i.camera.layers.mask=n.layers.mask);let h=s.getRenderObjectFunction(),d=s.getMRT(),c=d?d.has(\\\"velocity\\\"):!1;US=HP(s,a,US),a.overrideMaterial=JP(r),s.setRenderObjectFunction(e3(s,i,o,c)),s.setClearColor(0,0),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(h),o===Lh&&i.isPointLightShadow!==!0&&this.vsmPass(s),i.camera.layers.mask=u,XP(s,a,US)}vsmPass(e){let{shadow:t}=this,r=this.shadowMap.depth;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height,r),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height,r),e.setRenderTarget(this.vsmShadowMapVertical),yy.material=this.vsmMaterialVertical,yy.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),yy.material=this.vsmMaterialHorizontal,yy.render(e)}dispose(){this._reset(),super.dispose()}_reset(){this._currentShadowType=null,QP(this.light),this.shadowMap&&(this.shadowMap.dispose(),this.shadowMap=null),this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null)}updateBefore(e){let{shadow:t}=this,r=t.needsUpdate||t.autoUpdate;r&&(this._cameraFrameId[e.camera]===e.frameId&&(r=!1),this._cameraFrameId[e.camera]=e.frameId),r&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}},r3=(e,t)=>new t3(e,t),X9=new gt,i3=new We,Zp=new F,zS=new F,$9=[new F(1,0,0),new F(-1,0,0),new F(0,-1,0),new F(0,1,0),new F(0,0,1),new F(0,0,-1)],q9=[new F(0,-1,0),new F(0,-1,0),new F(0,0,-1),new F(0,0,1),new F(0,-1,0),new F(0,-1,0)],Y9=[new F(1,0,0),new F(-1,0,0),new F(0,1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1)],Z9=[new F(0,-1,0),new F(0,-1,0),new F(0,0,1),new F(0,0,-1),new F(0,-1,0),new F(0,-1,0)],s3=Q(({depthTexture:e,bd3D:t,dp:r})=>Ts(e,t).compare(r)),a3=Q(({depthTexture:e,bd3D:t,dp:r,shadow:i})=>{let s=cr(\\\"radius\\\",\\\"float\\\",i).setGroup(st),a=cr(\\\"mapSize\\\",\\\"vec2\\\",i).setGroup(st),n=s.div(a.x),o=ur(t),l=Yi(xo(t,o.x.greaterThan(o.z).select(K(0,1,0),K(1,0,0)))),u=xo(t,l),h=SS(ku.xy).mul(6.28318530718),d=ja(0,5,h),c=ja(1,5,h),m=ja(2,5,h),g=ja(3,5,h),y=ja(4,5,h);return Ts(e,t.add(l.mul(d.x).add(u.mul(d.y)).mul(n))).compare(r).add(Ts(e,t.add(l.mul(c.x).add(u.mul(c.y)).mul(n))).compare(r)).add(Ts(e,t.add(l.mul(m.x).add(u.mul(m.y)).mul(n))).compare(r)).add(Ts(e,t.add(l.mul(g.x).add(u.mul(g.y)).mul(n))).compare(r)).add(Ts(e,t.add(l.mul(y.x).add(u.mul(y.y)).mul(n))).compare(r)).mul(1/5)}),J9=Q(({filterFn:e,depthTexture:t,shadowCoord:r,shadow:i},s)=>{let a=r.xyz.toConst(),n=a.abs().toConst(),o=n.x.max(n.y).max(n.z),l=Qe(\\\"float\\\").setGroup(st).onRenderUpdate(()=>i.camera.near),u=Qe(\\\"float\\\").setGroup(st).onRenderUpdate(()=>i.camera.far),h=cr(\\\"bias\\\",\\\"float\\\",i).setGroup(st),d=D(1).toVar();return et(o.sub(u).lessThanEqual(0).and(o.sub(l).greaterThanEqual(0)),()=>{let c;s.renderer.reversedDepthBuffer?(c=nE(o.negate(),l,u),c.subAssign(h)):s.renderer.logarithmicDepthBuffer?(c=j0(o.negate(),l,u),c.addAssign(h)):(c=jT(o.negate(),l,u),c.addAssign(h));let m=a.normalize();d.assign(e({depthTexture:t,bd3D:m,dp:c,shadow:i}))}),d}),Q9=class extends t3{static get type(){return\\\"PointShadowNode\\\"}constructor(e,t=null){super(e,t)}getShadowFilterFn(e){return e===_D?s3:a3}setupShadowCoord(e,t){return t}setupShadowFilter(e,{filterFn:t,depthTexture:r,shadowCoord:i,shadow:s}){return J9({filterFn:t,depthTexture:r,shadowCoord:i,shadow:s})}setupRenderTarget(e,t){let r=new H4(e.mapSize.width);r.name=\\\"PointShadowDepthTexture\\\",r.compareFunction=t.renderer.reversedDepthBuffer?$h:tp;let i=t.createCubeRenderTarget(e.mapSize.width);return i.texture.name=\\\"PointShadowMap\\\",i.depthTexture=r,{shadowMap:i,depthTexture:r}}renderShadow(e){let{shadow:t,shadowMap:r,light:i}=this,{renderer:s,scene:a}=e,n=t.camera,o=t.matrix,l=s.coordinateSystem===da,u=l?$9:Y9,h=l?q9:Z9;r.setSize(t.mapSize.width,t.mapSize.width);let d=s.autoClear,c=s.getClearColor(X9),m=s.getClearAlpha();s.autoClear=!1,s.setClearColor(t.clearColor,t.clearAlpha);for(let g=0;g\\u003c6;g++){s.setRenderTarget(r,g),s.clear();let y=i.distance||n.far;y!==n.far&&(n.far=y,n.updateProjectionMatrix()),Zp.setFromMatrixPosition(i.matrixWorld),n.position.copy(Zp),zS.copy(n.position),zS.add(u[g]),n.up.copy(h[g]),n.lookAt(zS),n.updateMatrixWorld(),o.makeTranslation(-Zp.x,-Zp.y,-Zp.z),i3.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),t._frustum.setFromProjectionMatrix(i3,n.coordinateSystem,n.reversedDepth);let b=a.name;a.name=`Point Light Shadow [ ${i.name||\\\"ID: \\\"+i.id} ] - Face ${g+1}`,s.render(a,n),a.name=b}s.autoClear=d,s.setClearColor(c,m)}},n3=(e,t)=>new Q9(e,t),qu=class extends Ed{static get type(){return\\\"AnalyticLightNode\\\"}constructor(e=null){super(),this.light=e,this.color=new gt,this.colorNode=e&&e.colorNode||Qe(this.color).setGroup(st),this.baseColorNode=null,this.shadowNode=null,this.shadowColorNode=null,this.isAnalyticLightNode=!0,this.updateType=ut.FRAME,e&&e.shadow&&(this._shadowDisposeListener=()=>{this.disposeShadow()},e.addEventListener(\\\"dispose\\\",this._shadowDisposeListener))}dispose(){this._shadowDisposeListener&&this.light.removeEventListener(\\\"dispose\\\",this._shadowDisposeListener),super.dispose()}disposeShadow(){this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null),this.shadowColorNode=null,this.baseColorNode!==null&&(this.colorNode=this.baseColorNode,this.baseColorNode=null)}getHash(){return this.light.uuid}getLightVector(e){return BS(this.light).sub(e.context.positionView||Wr)}setupDirect(){}setupDirectRectArea(){}setupShadowNode(){return r3(this.light)}setupShadow(e){let{renderer:t}=e;if(t.shadowMap.enabled===!1)return;let r=this.shadowColorNode;if(r===null){let i=this.light.shadow.shadowNode,s;i!==void 0?s=Ye(i):s=this.setupShadowNode(),this.shadowNode=s,this.shadowColorNode=r=this.colorNode.mul(s),this.baseColorNode=this.colorNode}e.context.getShadow&&(r=e.context.getShadow(this,e)),this.colorNode=r}setup(e){this.colorNode=this.baseColorNode||this.colorNode,this.light.castShadow?e.object.receiveShadow&&this.setupShadow(e):this.shadowNode!==null&&(this.shadowNode.dispose(),this.shadowNode=null,this.shadowColorNode=null);let t=this.setupDirect(e),r=this.setupDirectRectArea(e);t&&e.lightsNode.setupDirectLight(e,this,t),r&&e.lightsNode.setupDirectRectAreaLight(e,this,r)}update(){let{light:e}=this;this.color.copy(e.color).multiplyScalar(e.intensity)}},VS=Q(({lightDistance:e,cutoffDistance:t,decayExponent:r})=>{let i=e.pow(r).max(.01).reciprocal();return t.greaterThan(0).select(i.mul(e.div(t).pow4().oneMinus().clamp().pow2()),i)}),o3=({color:e,lightVector:t,cutoffDistance:r,decayExponent:i})=>{let s=t.normalize(),a=t.length(),n=VS({lightDistance:a,cutoffDistance:r,decayExponent:i}),o=e.mul(n);return{lightDirection:s,lightColor:o}},K9=class extends qu{static get type(){return\\\"PointLightNode\\\"}constructor(e=null){super(e),this.cutoffDistanceNode=Qe(0).setGroup(st),this.decayExponentNode=Qe(2).setGroup(st)}update(e){let{light:t}=this;super.update(e),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}setupShadowNode(){return n3(this.light)}setupDirect(e){return o3({color:this.colorNode,lightVector:this.getLightVector(e),cutoffDistance:this.cutoffDistanceNode,decayExponent:this.decayExponentNode})}},eW=Q(([e=Jt()])=>{let t=e.mul(2),r=t.x.floor(),i=t.y.floor();return r.add(i).mod(2).sign()}),tW=Q(([e=Jt()],{renderer:t,material:r})=>{let i=Wb(e.mul(2).sub(1)),s;if(r.alphaToCoverage&&t.currentSamples>0){let a=D(i.fwidth()).toVar();s=Hs(a.oneMinus(),a.add(1),i).oneMinus()}else s=Zi(i.greaterThan(1),0,1);return s}),Jp=Q(([e,t,r])=>{let i=D(r).toVar(),s=D(t).toVar(),a=Gs(e).toVar();return Zi(a,s,i).uniformFlow()}).setLayout({name:\\\"mx_select\\\",type:\\\"float\\\",inputs:[{name:\\\"b\\\",type:\\\"bool\\\"},{name:\\\"t\\\",type:\\\"float\\\"},{name:\\\"f\\\",type:\\\"float\\\"}]}),xy=Q(([e,t])=>{let r=Gs(t).toVar(),i=D(e).toVar();return Zi(r,i.negate(),i).uniformFlow()}).setLayout({name:\\\"mx_negate_if\\\",type:\\\"float\\\",inputs:[{name:\\\"val\\\",type:\\\"float\\\"},{name:\\\"b\\\",type:\\\"bool\\\"}]}),Zr=Q(([e])=>{let t=D(e).toVar();return Y(Mn(t))}).setLayout({name:\\\"mx_floor\\\",type:\\\"int\\\",inputs:[{name:\\\"x\\\",type:\\\"float\\\"}]}),Mr=Q(([e,t])=>{let r=D(e).toVar();return t.assign(Zr(r)),r.sub(D(t))}),rW=Q(([e,t,r,i,s,a])=>{let n=D(a).toVar(),o=D(s).toVar(),l=D(i).toVar(),u=D(r).toVar(),h=D(t).toVar(),d=D(e).toVar(),c=D(It(1,o)).toVar();return It(1,n).mul(d.mul(c).add(h.mul(o))).add(n.mul(u.mul(c).add(l.mul(o))))}).setLayout({name:\\\"mx_bilerp_0\\\",type:\\\"float\\\",inputs:[{name:\\\"v0\\\",type:\\\"float\\\"},{name:\\\"v1\\\",type:\\\"float\\\"},{name:\\\"v2\\\",type:\\\"float\\\"},{name:\\\"v3\\\",type:\\\"float\\\"},{name:\\\"s\\\",type:\\\"float\\\"},{name:\\\"t\\\",type:\\\"float\\\"}]}),iW=Q(([e,t,r,i,s,a])=>{let n=D(a).toVar(),o=D(s).toVar(),l=K(i).toVar(),u=K(r).toVar(),h=K(t).toVar(),d=K(e).toVar(),c=D(It(1,o)).toVar();return It(1,n).mul(d.mul(c).add(h.mul(o))).add(n.mul(u.mul(c).add(l.mul(o))))}).setLayout({name:\\\"mx_bilerp_1\\\",type:\\\"vec3\\\",inputs:[{name:\\\"v0\\\",type:\\\"vec3\\\"},{name:\\\"v1\\\",type:\\\"vec3\\\"},{name:\\\"v2\\\",type:\\\"vec3\\\"},{name:\\\"v3\\\",type:\\\"vec3\\\"},{name:\\\"s\\\",type:\\\"float\\\"},{name:\\\"t\\\",type:\\\"float\\\"}]}),l3=ki([rW,iW]),sW=Q(([e,t,r,i,s,a,n,o,l,u,h])=>{let d=D(h).toVar(),c=D(u).toVar(),m=D(l).toVar(),g=D(o).toVar(),y=D(n).toVar(),b=D(a).toVar(),v=D(s).toVar(),S=D(i).toVar(),T=D(r).toVar(),w=D(t).toVar(),N=D(e).toVar(),C=D(It(1,m)).toVar(),R=D(It(1,c)).toVar();return D(It(1,d)).toVar().mul(R.mul(N.mul(C).add(w.mul(m))).add(c.mul(T.mul(C).add(S.mul(m))))).add(d.mul(R.mul(v.mul(C).add(b.mul(m))).add(c.mul(y.mul(C).add(g.mul(m))))))}).setLayout({name:\\\"mx_trilerp_0\\\",type:\\\"float\\\",inputs:[{name:\\\"v0\\\",type:\\\"float\\\"},{name:\\\"v1\\\",type:\\\"float\\\"},{name:\\\"v2\\\",type:\\\"float\\\"},{name:\\\"v3\\\",type:\\\"float\\\"},{name:\\\"v4\\\",type:\\\"float\\\"},{name:\\\"v5\\\",type:\\\"float\\\"},{name:\\\"v6\\\",type:\\\"float\\\"},{name:\\\"v7\\\",type:\\\"float\\\"},{name:\\\"s\\\",type:\\\"float\\\"},{name:\\\"t\\\",type:\\\"float\\\"},{name:\\\"r\\\",type:\\\"float\\\"}]}),aW=Q(([e,t,r,i,s,a,n,o,l,u,h])=>{let d=D(h).toVar(),c=D(u).toVar(),m=D(l).toVar(),g=K(o).toVar(),y=K(n).toVar(),b=K(a).toVar(),v=K(s).toVar(),S=K(i).toVar(),T=K(r).toVar(),w=K(t).toVar(),N=K(e).toVar(),C=D(It(1,m)).toVar(),R=D(It(1,c)).toVar();return D(It(1,d)).toVar().mul(R.mul(N.mul(C).add(w.mul(m))).add(c.mul(T.mul(C).add(S.mul(m))))).add(d.mul(R.mul(v.mul(C).add(b.mul(m))).add(c.mul(y.mul(C).add(g.mul(m))))))}).setLayout({name:\\\"mx_trilerp_1\\\",type:\\\"vec3\\\",inputs:[{name:\\\"v0\\\",type:\\\"vec3\\\"},{name:\\\"v1\\\",type:\\\"vec3\\\"},{name:\\\"v2\\\",type:\\\"vec3\\\"},{name:\\\"v3\\\",type:\\\"vec3\\\"},{name:\\\"v4\\\",type:\\\"vec3\\\"},{name:\\\"v5\\\",type:\\\"vec3\\\"},{name:\\\"v6\\\",type:\\\"vec3\\\"},{name:\\\"v7\\\",type:\\\"vec3\\\"},{name:\\\"s\\\",type:\\\"float\\\"},{name:\\\"t\\\",type:\\\"float\\\"},{name:\\\"r\\\",type:\\\"float\\\"}]}),u3=ki([sW,aW]),nW=Q(([e,t,r])=>{let i=D(r).toVar(),s=D(t).toVar(),a=Ne(e).toVar(),n=Ne(a.bitAnd(Ne(7))).toVar(),o=D(Jp(n.lessThan(Ne(4)),s,i)).toVar(),l=D(mt(2,Jp(n.lessThan(Ne(4)),i,s))).toVar();return xy(o,Gs(n.bitAnd(Ne(1)))).add(xy(l,Gs(n.bitAnd(Ne(2)))))}).setLayout({name:\\\"mx_gradient_float_0\\\",type:\\\"float\\\",inputs:[{name:\\\"hash\\\",type:\\\"uint\\\"},{name:\\\"x\\\",type:\\\"float\\\"},{name:\\\"y\\\",type:\\\"float\\\"}]}),oW=Q(([e,t,r,i])=>{let s=D(i).toVar(),a=D(r).toVar(),n=D(t).toVar(),o=Ne(e).toVar(),l=Ne(o.bitAnd(Ne(15))).toVar(),u=D(Jp(l.lessThan(Ne(8)),n,a)).toVar(),h=D(Jp(l.lessThan(Ne(4)),a,Jp(l.equal(Ne(12)).or(l.equal(Ne(14))),n,s))).toVar();return xy(u,Gs(l.bitAnd(Ne(1)))).add(xy(h,Gs(l.bitAnd(Ne(2)))))}).setLayout({name:\\\"mx_gradient_float_1\\\",type:\\\"float\\\",inputs:[{name:\\\"hash\\\",type:\\\"uint\\\"},{name:\\\"x\\\",type:\\\"float\\\"},{name:\\\"y\\\",type:\\\"float\\\"},{name:\\\"z\\\",type:\\\"float\\\"}]}),Ci=ki([nW,oW]),lW=Q(([e,t,r])=>{let i=D(r).toVar(),s=D(t).toVar(),a=Mu(e).toVar();return K(Ci(a.x,s,i),Ci(a.y,s,i),Ci(a.z,s,i))}).setLayout({name:\\\"mx_gradient_vec3_0\\\",type:\\\"vec3\\\",inputs:[{name:\\\"hash\\\",type:\\\"uvec3\\\"},{name:\\\"x\\\",type:\\\"float\\\"},{name:\\\"y\\\",type:\\\"float\\\"}]}),uW=Q(([e,t,r,i])=>{let s=D(i).toVar(),a=D(r).toVar(),n=D(t).toVar(),o=Mu(e).toVar();return K(Ci(o.x,n,a,s),Ci(o.y,n,a,s),Ci(o.z,n,a,s))}).setLayout({name:\\\"mx_gradient_vec3_1\\\",type:\\\"vec3\\\",inputs:[{name:\\\"hash\\\",type:\\\"uvec3\\\"},{name:\\\"x\\\",type:\\\"float\\\"},{name:\\\"y\\\",type:\\\"float\\\"},{name:\\\"z\\\",type:\\\"float\\\"}]}),xa=ki([lW,uW]),hW=Q(([e])=>{let t=D(e).toVar();return mt(.6616,t)}).setLayout({name:\\\"mx_gradient_scale2d_0\\\",type:\\\"float\\\",inputs:[{name:\\\"v\\\",type:\\\"float\\\"}]}),dW=Q(([e])=>{let t=D(e).toVar();return mt(.982,t)}).setLayout({name:\\\"mx_gradient_scale3d_0\\\",type:\\\"float\\\",inputs:[{name:\\\"v\\\",type:\\\"float\\\"}]}),cW=Q(([e])=>{let t=K(e).toVar();return mt(.6616,t)}).setLayout({name:\\\"mx_gradient_scale2d_1\\\",type:\\\"vec3\\\",inputs:[{name:\\\"v\\\",type:\\\"vec3\\\"}]}),h3=ki([hW,cW]),pW=Q(([e])=>{let t=K(e).toVar();return mt(.982,t)}).setLayout({name:\\\"mx_gradient_scale3d_1\\\",type:\\\"vec3\\\",inputs:[{name:\\\"v\\\",type:\\\"vec3\\\"}]}),d3=ki([dW,pW]),Zs=Q(([e,t])=>{let r=Y(t).toVar(),i=Ne(e).toVar();return i.shiftLeft(r).bitOr(i.shiftRight(Y(32).sub(r)))}).setLayout({name:\\\"mx_rotl32\\\",type:\\\"uint\\\",inputs:[{name:\\\"x\\\",type:\\\"uint\\\"},{name:\\\"k\\\",type:\\\"int\\\"}]}),c3=Q(([e,t,r])=>{e.subAssign(r),e.bitXorAssign(Zs(r,Y(4))),r.addAssign(t),t.subAssign(e),t.bitXorAssign(Zs(e,Y(6))),e.addAssign(r),r.subAssign(t),r.bitXorAssign(Zs(t,Y(8))),t.addAssign(e),e.subAssign(r),e.bitXorAssign(Zs(r,Y(16))),r.addAssign(t),t.subAssign(e),t.bitXorAssign(Zs(e,Y(19))),e.addAssign(r),r.subAssign(t),r.bitXorAssign(Zs(t,Y(4))),t.addAssign(e)}),Qp=Q(([e,t,r])=>{let i=Ne(r).toVar(),s=Ne(t).toVar(),a=Ne(e).toVar();return i.bitXorAssign(s),i.subAssign(Zs(s,Y(14))),a.bitXorAssign(i),a.subAssign(Zs(i,Y(11))),s.bitXorAssign(a),s.subAssign(Zs(a,Y(25))),i.bitXorAssign(s),i.subAssign(Zs(s,Y(16))),a.bitXorAssign(i),a.subAssign(Zs(i,Y(4))),s.bitXorAssign(a),s.subAssign(Zs(a,Y(14))),i.bitXorAssign(s),i.subAssign(Zs(s,Y(24))),i}).setLayout({name:\\\"mx_bjfinal\\\",type:\\\"uint\\\",inputs:[{name:\\\"a\\\",type:\\\"uint\\\"},{name:\\\"b\\\",type:\\\"uint\\\"},{name:\\\"c\\\",type:\\\"uint\\\"}]}),Ki=Q(([e])=>{let t=Ne(e).toVar();return D(t).div(D(Ne(Y(4294967295))))}).setLayout({name:\\\"mx_bits_to_01\\\",type:\\\"float\\\",inputs:[{name:\\\"bits\\\",type:\\\"uint\\\"}]}),Fn=Q(([e])=>{let t=D(e).toVar();return t.mul(t).mul(t).mul(t.mul(t.mul(6).sub(15)).add(10))}).setLayout({name:\\\"mx_fade\\\",type:\\\"float\\\",inputs:[{name:\\\"t\\\",type:\\\"float\\\"}]}),mW=Q(([e])=>{let t=Y(e).toVar(),r=Ne(Ne(1)).toVar(),i=Ne(Ne(Y(3735928559)).add(r.shiftLeft(Ne(2))).add(Ne(13))).toVar();return Qp(i.add(Ne(t)),i,i)}).setLayout({name:\\\"mx_hash_int_0\\\",type:\\\"uint\\\",inputs:[{name:\\\"x\\\",type:\\\"int\\\"}]}),fW=Q(([e,t])=>{let r=Y(t).toVar(),i=Y(e).toVar(),s=Ne(Ne(2)).toVar(),a=Ne().toVar(),n=Ne().toVar(),o=Ne().toVar();return a.assign(n.assign(o.assign(Ne(Y(3735928559)).add(s.shiftLeft(Ne(2))).add(Ne(13))))),a.addAssign(Ne(i)),n.addAssign(Ne(r)),Qp(a,n,o)}).setLayout({name:\\\"mx_hash_int_1\\\",type:\\\"uint\\\",inputs:[{name:\\\"x\\\",type:\\\"int\\\"},{name:\\\"y\\\",type:\\\"int\\\"}]}),gW=Q(([e,t,r])=>{let i=Y(r).toVar(),s=Y(t).toVar(),a=Y(e).toVar(),n=Ne(Ne(3)).toVar(),o=Ne().toVar(),l=Ne().toVar(),u=Ne().toVar();return o.assign(l.assign(u.assign(Ne(Y(3735928559)).add(n.shiftLeft(Ne(2))).add(Ne(13))))),o.addAssign(Ne(a)),l.addAssign(Ne(s)),u.addAssign(Ne(i)),Qp(o,l,u)}).setLayout({name:\\\"mx_hash_int_2\\\",type:\\\"uint\\\",inputs:[{name:\\\"x\\\",type:\\\"int\\\"},{name:\\\"y\\\",type:\\\"int\\\"},{name:\\\"z\\\",type:\\\"int\\\"}]}),yW=Q(([e,t,r,i])=>{let s=Y(i).toVar(),a=Y(r).toVar(),n=Y(t).toVar(),o=Y(e).toVar(),l=Ne(Ne(4)).toVar(),u=Ne().toVar(),h=Ne().toVar(),d=Ne().toVar();return u.assign(h.assign(d.assign(Ne(Y(3735928559)).add(l.shiftLeft(Ne(2))).add(Ne(13))))),u.addAssign(Ne(o)),h.addAssign(Ne(n)),d.addAssign(Ne(a)),c3(u,h,d),u.addAssign(Ne(s)),Qp(u,h,d)}).setLayout({name:\\\"mx_hash_int_3\\\",type:\\\"uint\\\",inputs:[{name:\\\"x\\\",type:\\\"int\\\"},{name:\\\"y\\\",type:\\\"int\\\"},{name:\\\"z\\\",type:\\\"int\\\"},{name:\\\"xx\\\",type:\\\"int\\\"}]}),xW=Q(([e,t,r,i,s])=>{let a=Y(s).toVar(),n=Y(i).toVar(),o=Y(r).toVar(),l=Y(t).toVar(),u=Y(e).toVar(),h=Ne(Ne(5)).toVar(),d=Ne().toVar(),c=Ne().toVar(),m=Ne().toVar();return d.assign(c.assign(m.assign(Ne(Y(3735928559)).add(h.shiftLeft(Ne(2))).add(Ne(13))))),d.addAssign(Ne(u)),c.addAssign(Ne(l)),m.addAssign(Ne(o)),c3(d,c,m),d.addAssign(Ne(n)),c.addAssign(Ne(a)),Qp(d,c,m)}).setLayout({name:\\\"mx_hash_int_4\\\",type:\\\"uint\\\",inputs:[{name:\\\"x\\\",type:\\\"int\\\"},{name:\\\"y\\\",type:\\\"int\\\"},{name:\\\"z\\\",type:\\\"int\\\"},{name:\\\"xx\\\",type:\\\"int\\\"},{name:\\\"yy\\\",type:\\\"int\\\"}]}),ir=ki([mW,fW,gW,yW,xW]),vW=Q(([e,t])=>{let r=Y(t).toVar(),i=Y(e).toVar(),s=Ne(ir(i,r)).toVar(),a=Mu().toVar();return a.x.assign(s.bitAnd(Y(255))),a.y.assign(s.shiftRight(Y(8)).bitAnd(Y(255))),a.z.assign(s.shiftRight(Y(16)).bitAnd(Y(255))),a}).setLayout({name:\\\"mx_hash_vec3_0\\\",type:\\\"uvec3\\\",inputs:[{name:\\\"x\\\",type:\\\"int\\\"},{name:\\\"y\\\",type:\\\"int\\\"}]}),bW=Q(([e,t,r])=>{let i=Y(r).toVar(),s=Y(t).toVar(),a=Y(e).toVar(),n=Ne(ir(a,s,i)).toVar(),o=Mu().toVar();return o.x.assign(n.bitAnd(Y(255))),o.y.assign(n.shiftRight(Y(8)).bitAnd(Y(255))),o.z.assign(n.shiftRight(Y(16)).bitAnd(Y(255))),o}).setLayout({name:\\\"mx_hash_vec3_1\\\",type:\\\"uvec3\\\",inputs:[{name:\\\"x\\\",type:\\\"int\\\"},{name:\\\"y\\\",type:\\\"int\\\"},{name:\\\"z\\\",type:\\\"int\\\"}]}),va=ki([vW,bW]),TW=Q(([e])=>{let t=ke(e).toVar(),r=Y().toVar(),i=Y().toVar(),s=D(Mr(t.x,r)).toVar(),a=D(Mr(t.y,i)).toVar(),n=D(Fn(s)).toVar(),o=D(Fn(a)).toVar(),l=D(l3(Ci(ir(r,i),s,a),Ci(ir(r.add(Y(1)),i),s.sub(1),a),Ci(ir(r,i.add(Y(1))),s,a.sub(1)),Ci(ir(r.add(Y(1)),i.add(Y(1))),s.sub(1),a.sub(1)),n,o)).toVar();return h3(l)}).setLayout({name:\\\"mx_perlin_noise_float_0\\\",type:\\\"float\\\",inputs:[{name:\\\"p\\\",type:\\\"vec2\\\"}]}),SW=Q(([e])=>{let t=K(e).toVar(),r=Y().toVar(),i=Y().toVar(),s=Y().toVar(),a=D(Mr(t.x,r)).toVar(),n=D(Mr(t.y,i)).toVar(),o=D(Mr(t.z,s)).toVar(),l=D(Fn(a)).toVar(),u=D(Fn(n)).toVar(),h=D(Fn(o)).toVar(),d=D(u3(Ci(ir(r,i,s),a,n,o),Ci(ir(r.add(Y(1)),i,s),a.sub(1),n,o),Ci(ir(r,i.add(Y(1)),s),a,n.sub(1),o),Ci(ir(r.add(Y(1)),i.add(Y(1)),s),a.sub(1),n.sub(1),o),Ci(ir(r,i,s.add(Y(1))),a,n,o.sub(1)),Ci(ir(r.add(Y(1)),i,s.add(Y(1))),a.sub(1),n,o.sub(1)),Ci(ir(r,i.add(Y(1)),s.add(Y(1))),a,n.sub(1),o.sub(1)),Ci(ir(r.add(Y(1)),i.add(Y(1)),s.add(Y(1))),a.sub(1),n.sub(1),o.sub(1)),l,u,h)).toVar();return d3(d)}).setLayout({name:\\\"mx_perlin_noise_float_1\\\",type:\\\"float\\\",inputs:[{name:\\\"p\\\",type:\\\"vec3\\\"}]}),GS=ki([TW,SW]),_W=Q(([e])=>{let t=ke(e).toVar(),r=Y().toVar(),i=Y().toVar(),s=D(Mr(t.x,r)).toVar(),a=D(Mr(t.y,i)).toVar(),n=D(Fn(s)).toVar(),o=D(Fn(a)).toVar(),l=K(l3(xa(va(r,i),s,a),xa(va(r.add(Y(1)),i),s.sub(1),a),xa(va(r,i.add(Y(1))),s,a.sub(1)),xa(va(r.add(Y(1)),i.add(Y(1))),s.sub(1),a.sub(1)),n,o)).toVar();return h3(l)}).setLayout({name:\\\"mx_perlin_noise_vec3_0\\\",type:\\\"vec3\\\",inputs:[{name:\\\"p\\\",type:\\\"vec2\\\"}]}),wW=Q(([e])=>{let t=K(e).toVar(),r=Y().toVar(),i=Y().toVar(),s=Y().toVar(),a=D(Mr(t.x,r)).toVar(),n=D(Mr(t.y,i)).toVar(),o=D(Mr(t.z,s)).toVar(),l=D(Fn(a)).toVar(),u=D(Fn(n)).toVar(),h=D(Fn(o)).toVar(),d=K(u3(xa(va(r,i,s),a,n,o),xa(va(r.add(Y(1)),i,s),a.sub(1),n,o),xa(va(r,i.add(Y(1)),s),a,n.sub(1),o),xa(va(r.add(Y(1)),i.add(Y(1)),s),a.sub(1),n.sub(1),o),xa(va(r,i,s.add(Y(1))),a,n,o.sub(1)),xa(va(r.add(Y(1)),i,s.add(Y(1))),a.sub(1),n,o.sub(1)),xa(va(r,i.add(Y(1)),s.add(Y(1))),a,n.sub(1),o.sub(1)),xa(va(r.add(Y(1)),i.add(Y(1)),s.add(Y(1))),a.sub(1),n.sub(1),o.sub(1)),l,u,h)).toVar();return d3(d)}).setLayout({name:\\\"mx_perlin_noise_vec3_1\\\",type:\\\"vec3\\\",inputs:[{name:\\\"p\\\",type:\\\"vec3\\\"}]}),Kp=ki([_W,wW]),MW=Q(([e])=>{let t=D(e).toVar(),r=Y(Zr(t)).toVar();return Ki(ir(r))}).setLayout({name:\\\"mx_cell_noise_float_0\\\",type:\\\"float\\\",inputs:[{name:\\\"p\\\",type:\\\"float\\\"}]}),NW=Q(([e])=>{let t=ke(e).toVar(),r=Y(Zr(t.x)).toVar(),i=Y(Zr(t.y)).toVar();return Ki(ir(r,i))}).setLayout({name:\\\"mx_cell_noise_float_1\\\",type:\\\"float\\\",inputs:[{name:\\\"p\\\",type:\\\"vec2\\\"}]}),AW=Q(([e])=>{let t=K(e).toVar(),r=Y(Zr(t.x)).toVar(),i=Y(Zr(t.y)).toVar(),s=Y(Zr(t.z)).toVar();return Ki(ir(r,i,s))}).setLayout({name:\\\"mx_cell_noise_float_2\\\",type:\\\"float\\\",inputs:[{name:\\\"p\\\",type:\\\"vec3\\\"}]}),CW=Q(([e])=>{let t=Ve(e).toVar(),r=Y(Zr(t.x)).toVar(),i=Y(Zr(t.y)).toVar(),s=Y(Zr(t.z)).toVar(),a=Y(Zr(t.w)).toVar();return Ki(ir(r,i,s,a))}).setLayout({name:\\\"mx_cell_noise_float_3\\\",type:\\\"float\\\",inputs:[{name:\\\"p\\\",type:\\\"vec4\\\"}]}),RW=ki([MW,NW,AW,CW]),EW=Q(([e])=>{let t=D(e).toVar(),r=Y(Zr(t)).toVar();return K(Ki(ir(r,Y(0))),Ki(ir(r,Y(1))),Ki(ir(r,Y(2))))}).setLayout({name:\\\"mx_cell_noise_vec3_0\\\",type:\\\"vec3\\\",inputs:[{name:\\\"p\\\",type:\\\"float\\\"}]}),PW=Q(([e])=>{let t=ke(e).toVar(),r=Y(Zr(t.x)).toVar(),i=Y(Zr(t.y)).toVar();return K(Ki(ir(r,i,Y(0))),Ki(ir(r,i,Y(1))),Ki(ir(r,i,Y(2))))}).setLayout({name:\\\"mx_cell_noise_vec3_1\\\",type:\\\"vec3\\\",inputs:[{name:\\\"p\\\",type:\\\"vec2\\\"}]}),BW=Q(([e])=>{let t=K(e).toVar(),r=Y(Zr(t.x)).toVar(),i=Y(Zr(t.y)).toVar(),s=Y(Zr(t.z)).toVar();return K(Ki(ir(r,i,s,Y(0))),Ki(ir(r,i,s,Y(1))),Ki(ir(r,i,s,Y(2))))}).setLayout({name:\\\"mx_cell_noise_vec3_2\\\",type:\\\"vec3\\\",inputs:[{name:\\\"p\\\",type:\\\"vec3\\\"}]}),IW=Q(([e])=>{let t=Ve(e).toVar(),r=Y(Zr(t.x)).toVar(),i=Y(Zr(t.y)).toVar(),s=Y(Zr(t.z)).toVar(),a=Y(Zr(t.w)).toVar();return K(Ki(ir(r,i,s,a,Y(0))),Ki(ir(r,i,s,a,Y(1))),Ki(ir(r,i,s,a,Y(2))))}).setLayout({name:\\\"mx_cell_noise_vec3_3\\\",type:\\\"vec3\\\",inputs:[{name:\\\"p\\\",type:\\\"vec4\\\"}]}),vy=ki([EW,PW,BW,IW]),by=Q(([e,t,r,i])=>{let s=D(i).toVar(),a=D(r).toVar(),n=Y(t).toVar(),o=K(e).toVar(),l=D(0).toVar(),u=D(1).toVar();return Qt(n,()=>{l.addAssign(u.mul(GS(o))),u.mulAssign(s),o.mulAssign(a)}),l}).setLayout({name:\\\"mx_fractal_noise_float\\\",type:\\\"float\\\",inputs:[{name:\\\"p\\\",type:\\\"vec3\\\"},{name:\\\"octaves\\\",type:\\\"int\\\"},{name:\\\"lacunarity\\\",type:\\\"float\\\"},{name:\\\"diminish\\\",type:\\\"float\\\"}]}),Ty=Q(([e,t,r,i])=>{let s=D(i).toVar(),a=D(r).toVar(),n=Y(t).toVar(),o=K(e).toVar(),l=K(0).toVar(),u=D(1).toVar();return Qt(n,()=>{l.addAssign(u.mul(Kp(o))),u.mulAssign(s),o.mulAssign(a)}),l}).setLayout({name:\\\"mx_fractal_noise_vec3\\\",type:\\\"vec3\\\",inputs:[{name:\\\"p\\\",type:\\\"vec3\\\"},{name:\\\"octaves\\\",type:\\\"int\\\"},{name:\\\"lacunarity\\\",type:\\\"float\\\"},{name:\\\"diminish\\\",type:\\\"float\\\"}]}),FW=Q(([e,t,r,i])=>{let s=D(i).toVar(),a=D(r).toVar(),n=Y(t).toVar(),o=K(e).toVar();return ke(by(o,n,a,s),by(o.add(K(Y(19),Y(193),Y(17))),n,a,s))}).setLayout({name:\\\"mx_fractal_noise_vec2\\\",type:\\\"vec2\\\",inputs:[{name:\\\"p\\\",type:\\\"vec3\\\"},{name:\\\"octaves\\\",type:\\\"int\\\"},{name:\\\"lacunarity\\\",type:\\\"float\\\"},{name:\\\"diminish\\\",type:\\\"float\\\"}]}),LW=Q(([e,t,r,i])=>{let s=D(i).toVar(),a=D(r).toVar(),n=Y(t).toVar(),o=K(e).toVar(),l=K(Ty(o,n,a,s)).toVar(),u=D(by(o.add(K(Y(19),Y(193),Y(17))),n,a,s)).toVar();return Ve(l,u)}).setLayout({name:\\\"mx_fractal_noise_vec4\\\",type:\\\"vec4\\\",inputs:[{name:\\\"p\\\",type:\\\"vec3\\\"},{name:\\\"octaves\\\",type:\\\"int\\\"},{name:\\\"lacunarity\\\",type:\\\"float\\\"},{name:\\\"diminish\\\",type:\\\"float\\\"}]}),kW=Q(([e,t,r,i,s,a,n])=>{let o=Y(n).toVar(),l=D(a).toVar(),u=Y(s).toVar(),h=Y(i).toVar(),d=Y(r).toVar(),c=Y(t).toVar(),m=ke(e).toVar(),g=K(vy(ke(c.add(h),d.add(u)))).toVar(),y=ke(g.x,g.y).toVar();y.subAssign(.5),y.mulAssign(l),y.addAssign(.5);let b=ke(ke(D(c),D(d)).add(y)).toVar(),v=ke(b.sub(m)).toVar();return et(o.equal(Y(2)),()=>ur(v.x).add(ur(v.y))),et(o.equal(Y(3)),()=>Br(ur(v.x),ur(v.y))),pa(v,v)}).setLayout({name:\\\"mx_worley_distance_0\\\",type:\\\"float\\\",inputs:[{name:\\\"p\\\",type:\\\"vec2\\\"},{name:\\\"x\\\",type:\\\"int\\\"},{name:\\\"y\\\",type:\\\"int\\\"},{name:\\\"xoff\\\",type:\\\"int\\\"},{name:\\\"yoff\\\",type:\\\"int\\\"},{name:\\\"jitter\\\",type:\\\"float\\\"},{name:\\\"metric\\\",type:\\\"int\\\"}]}),DW=Q(([e,t,r,i,s,a,n,o,l])=>{let u=Y(l).toVar(),h=D(o).toVar(),d=Y(n).toVar(),c=Y(a).toVar(),m=Y(s).toVar(),g=Y(i).toVar(),y=Y(r).toVar(),b=Y(t).toVar(),v=K(e).toVar(),S=K(vy(K(b.add(m),y.add(c),g.add(d)))).toVar();S.subAssign(.5),S.mulAssign(h),S.addAssign(.5);let T=K(K(D(b),D(y),D(g)).add(S)).toVar(),w=K(T.sub(v)).toVar();return et(u.equal(Y(2)),()=>ur(w.x).add(ur(w.y)).add(ur(w.z))),et(u.equal(Y(3)),()=>Br(ur(w.x),ur(w.y),ur(w.z))),pa(w,w)}).setLayout({name:\\\"mx_worley_distance_1\\\",type:\\\"float\\\",inputs:[{name:\\\"p\\\",type:\\\"vec3\\\"},{name:\\\"x\\\",type:\\\"int\\\"},{name:\\\"y\\\",type:\\\"int\\\"},{name:\\\"z\\\",type:\\\"int\\\"},{name:\\\"xoff\\\",type:\\\"int\\\"},{name:\\\"yoff\\\",type:\\\"int\\\"},{name:\\\"zoff\\\",type:\\\"int\\\"},{name:\\\"jitter\\\",type:\\\"float\\\"},{name:\\\"metric\\\",type:\\\"int\\\"}]}),Ud=ki([kW,DW]),OW=Q(([e,t,r])=>{let i=Y(r).toVar(),s=D(t).toVar(),a=ke(e).toVar(),n=Y().toVar(),o=Y().toVar(),l=ke(Mr(a.x,n),Mr(a.y,o)).toVar(),u=D(1e6).toVar();return Qt({start:-1,end:Y(1),name:\\\"x\\\",condition:\\\"\\u003c=\\\"},({x:h})=>{Qt({start:-1,end:Y(1),name:\\\"y\\\",condition:\\\"\\u003c=\\\"},({y:d})=>{let c=D(Ud(l,h,d,n,o,s,i)).toVar();u.assign(Rs(u,c))})}),et(i.equal(Y(0)),()=>{u.assign(ys(u))}),u}).setLayout({name:\\\"mx_worley_noise_float_0\\\",type:\\\"float\\\",inputs:[{name:\\\"p\\\",type:\\\"vec2\\\"},{name:\\\"jitter\\\",type:\\\"float\\\"},{name:\\\"metric\\\",type:\\\"int\\\"}]}),UW=Q(([e,t,r])=>{let i=Y(r).toVar(),s=D(t).toVar(),a=ke(e).toVar(),n=Y().toVar(),o=Y().toVar(),l=ke(Mr(a.x,n),Mr(a.y,o)).toVar(),u=ke(1e6,1e6).toVar();return Qt({start:-1,end:Y(1),name:\\\"x\\\",condition:\\\"\\u003c=\\\"},({x:h})=>{Qt({start:-1,end:Y(1),name:\\\"y\\\",condition:\\\"\\u003c=\\\"},({y:d})=>{let c=D(Ud(l,h,d,n,o,s,i)).toVar();et(c.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(c)}).ElseIf(c.lessThan(u.y),()=>{u.y.assign(c)})})}),et(i.equal(Y(0)),()=>{u.assign(ys(u))}),u}).setLayout({name:\\\"mx_worley_noise_vec2_0\\\",type:\\\"vec2\\\",inputs:[{name:\\\"p\\\",type:\\\"vec2\\\"},{name:\\\"jitter\\\",type:\\\"float\\\"},{name:\\\"metric\\\",type:\\\"int\\\"}]}),zW=Q(([e,t,r])=>{let i=Y(r).toVar(),s=D(t).toVar(),a=ke(e).toVar(),n=Y().toVar(),o=Y().toVar(),l=ke(Mr(a.x,n),Mr(a.y,o)).toVar(),u=K(1e6,1e6,1e6).toVar();return Qt({start:-1,end:Y(1),name:\\\"x\\\",condition:\\\"\\u003c=\\\"},({x:h})=>{Qt({start:-1,end:Y(1),name:\\\"y\\\",condition:\\\"\\u003c=\\\"},({y:d})=>{let c=D(Ud(l,h,d,n,o,s,i)).toVar();et(c.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(c)}).ElseIf(c.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(c)}).ElseIf(c.lessThan(u.z),()=>{u.z.assign(c)})})}),et(i.equal(Y(0)),()=>{u.assign(ys(u))}),u}).setLayout({name:\\\"mx_worley_noise_vec3_0\\\",type:\\\"vec3\\\",inputs:[{name:\\\"p\\\",type:\\\"vec2\\\"},{name:\\\"jitter\\\",type:\\\"float\\\"},{name:\\\"metric\\\",type:\\\"int\\\"}]}),VW=Q(([e,t,r])=>{let i=Y(r).toVar(),s=D(t).toVar(),a=K(e).toVar(),n=Y().toVar(),o=Y().toVar(),l=Y().toVar(),u=K(Mr(a.x,n),Mr(a.y,o),Mr(a.z,l)).toVar(),h=D(1e6).toVar();return Qt({start:-1,end:Y(1),name:\\\"x\\\",condition:\\\"\\u003c=\\\"},({x:d})=>{Qt({start:-1,end:Y(1),name:\\\"y\\\",condition:\\\"\\u003c=\\\"},({y:c})=>{Qt({start:-1,end:Y(1),name:\\\"z\\\",condition:\\\"\\u003c=\\\"},({z:m})=>{let g=D(Ud(u,d,c,m,n,o,l,s,i)).toVar();h.assign(Rs(h,g))})})}),et(i.equal(Y(0)),()=>{h.assign(ys(h))}),h}).setLayout({name:\\\"mx_worley_noise_float_1\\\",type:\\\"float\\\",inputs:[{name:\\\"p\\\",type:\\\"vec3\\\"},{name:\\\"jitter\\\",type:\\\"float\\\"},{name:\\\"metric\\\",type:\\\"int\\\"}]}),GW=ki([OW,VW]),WW=Q(([e,t,r])=>{let i=Y(r).toVar(),s=D(t).toVar(),a=K(e).toVar(),n=Y().toVar(),o=Y().toVar(),l=Y().toVar(),u=K(Mr(a.x,n),Mr(a.y,o),Mr(a.z,l)).toVar(),h=ke(1e6,1e6).toVar();return Qt({start:-1,end:Y(1),name:\\\"x\\\",condition:\\\"\\u003c=\\\"},({x:d})=>{Qt({start:-1,end:Y(1),name:\\\"y\\\",condition:\\\"\\u003c=\\\"},({y:c})=>{Qt({start:-1,end:Y(1),name:\\\"z\\\",condition:\\\"\\u003c=\\\"},({z:m})=>{let g=D(Ud(u,d,c,m,n,o,l,s,i)).toVar();et(g.lessThan(h.x),()=>{h.y.assign(h.x),h.x.assign(g)}).ElseIf(g.lessThan(h.y),()=>{h.y.assign(g)})})})}),et(i.equal(Y(0)),()=>{h.assign(ys(h))}),h}).setLayout({name:\\\"mx_worley_noise_vec2_1\\\",type:\\\"vec2\\\",inputs:[{name:\\\"p\\\",type:\\\"vec3\\\"},{name:\\\"jitter\\\",type:\\\"float\\\"},{name:\\\"metric\\\",type:\\\"int\\\"}]}),jW=ki([UW,WW]),HW=Q(([e,t,r])=>{let i=Y(r).toVar(),s=D(t).toVar(),a=K(e).toVar(),n=Y().toVar(),o=Y().toVar(),l=Y().toVar(),u=K(Mr(a.x,n),Mr(a.y,o),Mr(a.z,l)).toVar(),h=K(1e6,1e6,1e6).toVar();return Qt({start:-1,end:Y(1),name:\\\"x\\\",condition:\\\"\\u003c=\\\"},({x:d})=>{Qt({start:-1,end:Y(1),name:\\\"y\\\",condition:\\\"\\u003c=\\\"},({y:c})=>{Qt({start:-1,end:Y(1),name:\\\"z\\\",condition:\\\"\\u003c=\\\"},({z:m})=>{let g=D(Ud(u,d,c,m,n,o,l,s,i)).toVar();et(g.lessThan(h.x),()=>{h.z.assign(h.y),h.y.assign(h.x),h.x.assign(g)}).ElseIf(g.lessThan(h.y),()=>{h.z.assign(h.y),h.y.assign(g)}).ElseIf(g.lessThan(h.z),()=>{h.z.assign(g)})})})}),et(i.equal(Y(0)),()=>{h.assign(ys(h))}),h}).setLayout({name:\\\"mx_worley_noise_vec3_1\\\",type:\\\"vec3\\\",inputs:[{name:\\\"p\\\",type:\\\"vec3\\\"},{name:\\\"jitter\\\",type:\\\"float\\\"},{name:\\\"metric\\\",type:\\\"int\\\"}]}),WS=ki([zW,HW]),XW=Q(([e,t,r,i,s,a,n,o,l,u,h])=>{let d=Y(e).toVar(),c=ke(t).toVar(),m=ke(r).toVar(),g=ke(i).toVar(),y=D(s).toVar(),b=D(a).toVar(),v=D(n).toVar(),S=Gs(o).toVar(),T=Y(l).toVar(),w=D(u).toVar(),N=D(h).toVar(),C=c.mul(m).add(g),R=D(0).toVar();return et(d.equal(Y(0)),()=>{R.assign(Kp(C))}),et(d.equal(Y(1)),()=>{R.assign(vy(C))}),et(d.equal(Y(2)),()=>{R.assign(WS(C,y,Y(0)))}),et(d.equal(Y(3)),()=>{R.assign(Ty(K(C,0),T,w,N))}),R.assign(R.mul(v.sub(b)).add(b)),et(S,()=>{R.assign(za(R,b,v))}),R}).setLayout({name:\\\"mx_unifiednoise2d\\\",type:\\\"float\\\",inputs:[{name:\\\"noiseType\\\",type:\\\"int\\\"},{name:\\\"texcoord\\\",type:\\\"vec2\\\"},{name:\\\"freq\\\",type:\\\"vec2\\\"},{name:\\\"offset\\\",type:\\\"vec2\\\"},{name:\\\"jitter\\\",type:\\\"float\\\"},{name:\\\"outmin\\\",type:\\\"float\\\"},{name:\\\"outmax\\\",type:\\\"float\\\"},{name:\\\"clampoutput\\\",type:\\\"bool\\\"},{name:\\\"octaves\\\",type:\\\"int\\\"},{name:\\\"lacunarity\\\",type:\\\"float\\\"},{name:\\\"diminish\\\",type:\\\"float\\\"}]}),$W=Q(([e,t,r,i,s,a,n,o,l,u,h])=>{let d=Y(e).toVar(),c=K(t).toVar(),m=K(r).toVar(),g=K(i).toVar(),y=D(s).toVar(),b=D(a).toVar(),v=D(n).toVar(),S=Gs(o).toVar(),T=Y(l).toVar(),w=D(u).toVar(),N=D(h).toVar(),C=c.mul(m).add(g),R=D(0).toVar();return et(d.equal(Y(0)),()=>{R.assign(Kp(C))}),et(d.equal(Y(1)),()=>{R.assign(vy(C))}),et(d.equal(Y(2)),()=>{R.assign(WS(C,y,Y(0)))}),et(d.equal(Y(3)),()=>{R.assign(Ty(C,T,w,N))}),R.assign(R.mul(v.sub(b)).add(b)),et(S,()=>{R.assign(za(R,b,v))}),R}).setLayout({name:\\\"mx_unifiednoise3d\\\",type:\\\"float\\\",inputs:[{name:\\\"noiseType\\\",type:\\\"int\\\"},{name:\\\"position\\\",type:\\\"vec3\\\"},{name:\\\"freq\\\",type:\\\"vec3\\\"},{name:\\\"offset\\\",type:\\\"vec3\\\"},{name:\\\"jitter\\\",type:\\\"float\\\"},{name:\\\"outmin\\\",type:\\\"float\\\"},{name:\\\"outmax\\\",type:\\\"float\\\"},{name:\\\"clampoutput\\\",type:\\\"bool\\\"},{name:\\\"octaves\\\",type:\\\"int\\\"},{name:\\\"lacunarity\\\",type:\\\"float\\\"},{name:\\\"diminish\\\",type:\\\"float\\\"}]}),qW=Q(([e])=>{let t=e.y,r=e.z,i=K().toVar();return et(t.lessThan(1e-4),()=>{i.assign(K(r,r,r))}).Else(()=>{let s=e.x;s=s.sub(Mn(s)).mul(6).toVar();let a=Y(Ub(s)),n=s.sub(D(a)),o=r.mul(t.oneMinus()),l=r.mul(t.mul(n).oneMinus()),u=r.mul(t.mul(n.oneMinus()).oneMinus());et(a.equal(Y(0)),()=>{i.assign(K(r,u,o))}).ElseIf(a.equal(Y(1)),()=>{i.assign(K(l,r,o))}).ElseIf(a.equal(Y(2)),()=>{i.assign(K(o,r,u))}).ElseIf(a.equal(Y(3)),()=>{i.assign(K(o,l,r))}).ElseIf(a.equal(Y(4)),()=>{i.assign(K(u,o,r))}).Else(()=>{i.assign(K(r,o,l))})}),i}).setLayout({name:\\\"mx_hsvtorgb\\\",type:\\\"vec3\\\",inputs:[{name:\\\"hsv\\\",type:\\\"vec3\\\"}]}),YW=Q(([e])=>{let t=K(e).toVar(),r=D(t.x).toVar(),i=D(t.y).toVar(),s=D(t.z).toVar(),a=D(Rs(r,Rs(i,s))).toVar(),n=D(Br(r,Br(i,s))).toVar(),o=D(n.sub(a)).toVar(),l=D().toVar(),u=D().toVar(),h=D().toVar();return h.assign(n),et(n.greaterThan(0),()=>{u.assign(o.div(n))}).Else(()=>{u.assign(0)}),et(u.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{et(r.greaterThanEqual(n),()=>{l.assign(i.sub(s).div(o))}).ElseIf(i.greaterThanEqual(n),()=>{l.assign(Yr(2,s.sub(r).div(o)))}).Else(()=>{l.assign(Yr(4,r.sub(i).div(o)))}),l.mulAssign(1/6),et(l.lessThan(0),()=>{l.addAssign(1)})}),K(l,u,h)}).setLayout({name:\\\"mx_rgbtohsv\\\",type:\\\"vec3\\\",inputs:[{name:\\\"c\\\",type:\\\"vec3\\\"}]}),ZW=Q(([e])=>{let t=K(e).toVar(),r=Tb(Eb(t,K(.04045))).toVar(),i=K(t.div(12.92)).toVar(),s=K(ma(Br(t.add(K(.055)),K(0)).div(1.055),K(2.4))).toVar();return Ct(i,s,r)}).setLayout({name:\\\"mx_srgb_texture_to_lin_rec709\\\",type:\\\"vec3\\\",inputs:[{name:\\\"color\\\",type:\\\"vec3\\\"}]}),p3=(e,t)=>{e=D(e),t=D(t);let r=ke(t.dFdx(),t.dFdy()).length().mul(.7071067811865476);return Hs(e.sub(r),e.add(r),t)},m3=(e,t,r,i)=>Ct(e,t,r[i].clamp()),JW=(e,t,r=Jt())=>m3(e,t,r,\\\"x\\\"),QW=(e,t,r=Jt())=>m3(e,t,r,\\\"y\\\"),KW=(e,t,r,i,s=Jt())=>{let a=s.x.clamp(),n=s.y.clamp(),o=Ct(e,t,a),l=Ct(r,i,a);return Ct(o,l,n)},f3=(e,t,r,i,s)=>Ct(e,t,p3(r,i[s])),ej=(e,t,r,i=Jt())=>f3(e,t,r,i,\\\"x\\\"),tj=(e,t,r,i=Jt())=>f3(e,t,r,i,\\\"y\\\"),rj=(e=1,t=0,r=Jt())=>r.mul(e).add(t),ij=(e,t=1)=>(e=D(e),e.abs().pow(t).mul(e.sign())),sj=(e,t=1,r=.5)=>D(e).sub(r).mul(t).add(r),aj=(e=Jt(),t=1,r=0)=>GS(e.convert(\\\"vec2|vec3\\\")).mul(t).add(r),nj=(e=Jt(),t=1,r=0)=>Kp(e.convert(\\\"vec2|vec3\\\")).mul(t).add(r),oj=(e=Jt(),t=1,r=0)=>(e=e.convert(\\\"vec2|vec3\\\"),Ve(Kp(e),GS(e.add(ke(19,73)))).mul(t).add(r)),lj=(e,t=Jt(),r=ke(1,1),i=ke(0,0),s=1,a=0,n=1,o=!1,l=1,u=2,h=.5)=>XW(e,t.convert(\\\"vec2|vec3\\\"),r,i,s,a,n,o,l,u,h),uj=(e,t=Jt(),r=ke(1,1),i=ke(0,0),s=1,a=0,n=1,o=!1,l=1,u=2,h=.5)=>$W(e,t.convert(\\\"vec2|vec3\\\"),r,i,s,a,n,o,l,u,h),hj=(e=Jt(),t=1)=>GW(e.convert(\\\"vec2|vec3\\\"),t,Y(1)),dj=(e=Jt(),t=1)=>jW(e.convert(\\\"vec2|vec3\\\"),t,Y(1)),cj=(e=Jt(),t=1)=>WS(e.convert(\\\"vec2|vec3\\\"),t,Y(1)),pj=(e=Jt())=>RW(e.convert(\\\"vec2|vec3\\\")),mj=(e=Jt(),t=3,r=2,i=.5,s=1)=>by(e,Y(t),r,i).mul(s),fj=(e=Jt(),t=3,r=2,i=.5,s=1)=>FW(e,Y(t),r,i).mul(s),gj=(e=Jt(),t=3,r=2,i=.5,s=1)=>Ty(e,Y(t),r,i).mul(s),yj=(e=Jt(),t=3,r=2,i=.5,s=1)=>LW(e,Y(t),r,i).mul(s),xj=(e,t=D(0))=>Yr(e,t),vj=(e,t=D(0))=>It(e,t),bj=(e,t=D(1))=>mt(e,t),Tj=(e,t=D(1))=>js(e,t),Sj=(e,t=D(1))=>c0(e,t),_j=(e,t=D(1))=>ma(e,t),wj=(e=D(0),t=D(1))=>Fb(e,t),Mj=()=>Fd,Nj=()=>xP,Aj=(e,t=D(1))=>It(t,e),Cj=(e,t,r,i)=>e.greaterThan(t).mix(r,i),Rj=(e,t,r,i)=>e.greaterThanEqual(t).mix(r,i),Ej=(e,t,r,i)=>e.equal(t).mix(r,i),Pj=(e,t=null)=>{if(typeof t==\\\"string\\\"){let r={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3},i=t.replace(/^out/,\\\"\\\").toLowerCase();if(r[i]!==void 0)return e.element(r[i])}if(typeof t==\\\"number\\\")return e.element(t);if(typeof t==\\\"string\\\"&&t.length===1){let r={x:0,r:0,y:1,g:1,z:2,b:2,w:3,a:3};if(r[t]!==void 0)return e.element(r[t])}return e},Bj=(e,t=ke(.5,.5),r=ke(1,1),i=D(0),s=ke(0,0))=>{let a=e;if(t&&(a=a.sub(t)),r&&(a=a.mul(r)),i){let n=i.mul(Math.PI/180),o=n.cos(),l=n.sin();a=ke(a.x.mul(o).sub(a.y.mul(l)),a.x.mul(l).add(a.y.mul(o)))}return t&&(a=a.add(t)),s&&(a=a.add(s)),a},Ij=(e,t)=>{e=ke(e),t=D(t);let r=t.mul(Math.PI/180);return Gp(e,r)},Fj=(e,t,r)=>{e=K(e),t=D(t),r=K(r);let i=t.mul(Math.PI/180),s=r.normalize(),a=i.cos(),n=i.sin(),o=D(1).sub(a);return e.mul(a).add(s.cross(e).mul(n)).add(s.mul(s.dot(e)).mul(o))},Lj=(e,t)=>(e=K(e),t=D(t),AT(e,t)),kj=Q(([e,t,r])=>{let i=Yi(e).toVar(),s=It(D(.5).mul(t.sub(r)),Rn).div(i).toVar(),a=It(D(-.5).mul(t.sub(r)),Rn).div(i).toVar(),n=K().toVar();n.x=i.x.greaterThan(D(0)).select(s.x,a.x),n.y=i.y.greaterThan(D(0)).select(s.y,a.y),n.z=i.z.greaterThan(D(0)).select(s.z,a.z);let o=Rs(n.x,n.y,n.z).toVar();return Rn.add(i.mul(o)).toVar().sub(r)}),g3=Q(([e,t])=>{let r=e.x,i=e.y,s=e.z,a=t.element(0).mul(.886227);return a=a.add(t.element(1).mul(2*.511664).mul(i)),a=a.add(t.element(2).mul(2*.511664).mul(s)),a=a.add(t.element(3).mul(2*.511664).mul(r)),a=a.add(t.element(4).mul(2*.429043).mul(r).mul(i)),a=a.add(t.element(5).mul(2*.429043).mul(i).mul(s)),a=a.add(t.element(6).mul(s.mul(s).mul(.743125).sub(.247708))),a=a.add(t.element(7).mul(2*.429043).mul(r).mul(s)),a=a.add(t.element(8).mul(.429043).mul(mt(r,r).sub(mt(i,i)))),a}),M=Object.freeze({__proto__:null,BRDF_GGX:JT,BRDF_Lambert:Wu,BasicPointShadowFilter:s3,BasicShadowFilter:$P,Break:KR,Const:mC,Continue:zz,DFGLUT:Dp,D_GGX:TE,Discard:BC,EPSILON:p0,F_Schlick:Bd,Fn:Q,HALF_PI:u6,INFINITY:n6,If:et,Loop:Qt,NodeAccess:Fi,NodeShaderStage:xd,NodeType:EU,NodeUpdateType:ut,OnBeforeFrameUpdate:Pz,OnBeforeMaterialUpdate:Ez,OnBeforeObjectUpdate:Rz,OnFrameUpdate:jR,OnMaterialUpdate:Cz,OnObjectUpdate:Lp,PCFShadowFilter:qP,PCFSoftShadowFilter:YP,PI:m0,PI2:o6,PointShadowFilter:a3,Return:C6,Schlick_to_F0:QT,ShaderNode:bd,Stack:r0,Switch:QU,TBNViewMatrix:Uu,TWO_PI:l6,VSMShadowFilter:ZP,V_GGX_SmithCorrelated:bE,Var:pC,VarIntent:fC,abs:ur,acesFilmicToneMapping:IP,acos:Ib,acosh:WA,add:Yr,addMethodChaining:xe,addNodeElement:B6,agxToneMapping:FP,all:IA,alphaT:l0,ambientOcclusion:Rb,and:vA,anisotropy:dl,anisotropyB:Cu,anisotropyT:Ap,any:FA,append:e6,array:dA,asin:VA,asinh:GA,assign:cA,atan:Fb,atanh:jA,atomicAdd:i9,atomicAnd:o9,atomicFunc:In,atomicLoad:t9,atomicMax:a9,atomicMin:n9,atomicOr:l9,atomicStore:r9,atomicSub:s9,atomicXor:u9,attenuationColor:Ab,attenuationDistance:Nb,attribute:$s,attributeArray:Z8,backgroundBlurriness:TP,backgroundIntensity:wS,backgroundRotation:SP,batch:YR,batchColor:OT,bentNormalView:pR,billboarding:B8,bitAnd:_A,bitNot:wA,bitOr:MA,bitXor:NA,bitangentGeometry:xz,bitangentLocal:vz,bitangentView:dR,bitangentWorld:bz,bitcast:gP,blendBurn:d7,blendColor:f7,blendDodge:c7,blendOverlay:m7,blendScreen:p7,blur:GE,bool:Gs,buffer:Md,bufferAttribute:Jb,builtin:bo,builtinAOContext:dC,builtinShadowContext:hC,bumpMap:AT,bvec2:iA,bvec3:Tb,bvec4:sA,bypass:EC,cache:RC,call:pA,cameraFar:yl,cameraIndex:fl,cameraNear:gl,cameraNormalMatrix:H6,cameraPosition:VC,cameraProjectionMatrix:bs,cameraProjectionMatrixInverse:zC,cameraViewMatrix:xl,cameraViewport:X6,cameraWorldMatrix:Ip,cbrt:sC,cdl:b7,ceil:g0,checker:eW,cineonToneMapping:BP,clamp:za,clearcoat:s0,clearcoatNormalView:bl,clearcoatRoughness:Td,clipSpace:HC,code:cy,color:rA,colorSpaceToWorking:v0,colorToDirection:_z,compute:CC,computeKernel:Kb,computeSkinning:Oz,context:vo,convert:nA,convertColorSpace:g6,convertToTexture:j8,cos:Ua,cosh:OA,countLeadingZeros:l8,countOneBits:u8,countTrailingZeros:o8,cross:xo,cubeTexture:Ts,cubeTextureBase:TT,dFdx:Db,dFdy:Ob,dashSize:Pu,debug:FC,decrement:BA,decrementBefore:EA,defaultBuildStages:Zg,defaultShaderStages:XN,defined:vd,degrees:kA,deltaTime:w8,densityFogFactor:OP,depth:HT,depthPass:N7,determinant:YA,difference:KA,diffuseColor:Zt,diffuseContribution:Au,directPointLight:o3,directionToColor:Sz,directionToFaceDirection:nz,dispersion:Cb,disposeShadowMaterial:QP,distance:QA,div:js,dot:pa,drawIndex:AC,dynamicBufferAttribute:T6,element:aA,emissive:wb,equal:mA,equirectDirection:qT,equirectUV:$T,exp:Pb,exp2:_d,exponentialHeightFogFactor:O7,expression:Xs,faceDirection:yT,faceForward:Hb,faceforward:h6,float:D,floatBitsToInt:s8,floatBitsToUint:yP,floor:Mn,fog:RS,fract:Oa,frameGroup:r6,frameId:xP,frontFacing:XC,fwidth:zb,gain:d8,gapSize:Cp,getConstNodeType:tA,getCurrentStack:xb,getDirection:zE,getDistanceAttenuation:VS,getGeometryRoughness:vE,getNormalFromDepth:X8,getParallaxCorrectNormal:kj,getRoughness:ZT,getScreenPosition:H8,getShIrradianceAt:g3,getShadowMaterial:JP,getShadowRenderObjectFunction:e3,getTextureIndex:mP,getViewPosition:Dd,ggxConvolution:WE,globalId:j7,glsl:L7,glslFn:k7,grayscale:g7,greaterThan:Eb,greaterThanEqual:xA,hash:h8,highpModelNormalViewMatrix:fT,highpModelViewMatrix:mT,hue:v7,increment:PA,incrementBefore:RA,inspector:kC,instance:$R,instanceColor:DT,instanceIndex:Va,instancedArray:J8,instancedBufferAttribute:T0,instancedDynamicBufferAttribute:Qb,instancedMesh:qR,int:Y,intBitsToFloat:a8,interleavedGradientNoise:SS,inverse:ZA,inverseSqrt:Bb,inversesqrt:d6,invocationLocalIndex:w6,invocationSubgroupIndex:_6,ior:Rp,iridescence:a0,iridescenceIOR:n0,iridescenceThickness:o0,isolate:wd,ivec2:Pr,ivec3:bb,ivec4:Sb,js:I7,label:cC,length:Nn,lengthSq:Wb,lessThan:gA,lessThanEqual:yA,lightPosition:PS,lightProjectionUV:UP,lightShadowMatrix:fy,lightTargetDirection:IS,lightTargetPosition:zP,lightViewPosition:BS,lightingContext:iE,lights:z9,linearDepth:H0,linearToneMapping:EP,localId:H7,log:f0,log2:wn,logarithmicDepthToViewZ:Yz,luminance:NS,mat2:i0,mat3:Ni,mat4:ul,matcapUV:QE,materialAO:GR,materialAlphaTest:gR,materialAnisotropy:PR,materialAnisotropyVector:Cd,materialAttenuationColor:UR,materialAttenuationDistance:OR,materialClearcoat:MR,materialClearcoatNormal:AR,materialClearcoatRoughness:NR,materialColor:yR,materialDispersion:VR,materialEmissive:vR,materialEnvIntensity:B0,materialEnvRotation:I0,materialIOR:DR,materialIridescence:BR,materialIridescenceIOR:IR,materialIridescenceThickness:FR,materialLightMap:FT,materialLineDashOffset:IT,materialLineDashSize:PT,materialLineGapSize:BT,materialLineScale:ET,materialLineWidth:U0,materialMetalness:_R,materialNormal:wR,materialOpacity:CT,materialPointSize:zR,materialReference:To,materialReflectivity:O0,materialRefractionRatio:YC,materialRotation:CR,materialRoughness:SR,materialSheen:RR,materialSheenRoughness:ER,materialShininess:xR,materialSpecular:bR,materialSpecularColor:TR,materialSpecularIntensity:RT,materialSpecularStrength:Fp,materialThickness:kR,materialTransmission:LR,max:Br,maxMipLevel:rT,mediumpModelViewMatrix:jC,metalness:yo,min:Rs,mix:Ct,mixElement:nC,mod:c0,modelDirection:K6,modelNormalMatrix:WC,modelPosition:ez,modelRadius:iz,modelScale:tz,modelViewMatrix:Cn,modelViewPosition:rz,modelViewProjection:WR,modelWorldMatrix:ga,modelWorldMatrixInverse:sz,morphReference:rE,mrt:fP,mul:mt,mx_aastep:p3,mx_add:xj,mx_atan2:wj,mx_cell_noise_float:pj,mx_contrast:sj,mx_divide:Tj,mx_fractal_noise_float:mj,mx_fractal_noise_vec2:fj,mx_fractal_noise_vec3:gj,mx_fractal_noise_vec4:yj,mx_frame:Nj,mx_heighttonormal:Lj,mx_hsvtorgb:qW,mx_ifequal:Ej,mx_ifgreater:Cj,mx_ifgreatereq:Rj,mx_invert:Aj,mx_modulo:Sj,mx_multiply:bj,mx_noise_float:aj,mx_noise_vec3:nj,mx_noise_vec4:oj,mx_place2d:Bj,mx_power:_j,mx_ramp4:KW,mx_ramplr:JW,mx_ramptb:QW,mx_rgbtohsv:YW,mx_rotate2d:Ij,mx_rotate3d:Fj,mx_safepower:ij,mx_separate:Pj,mx_splitlr:ej,mx_splittb:tj,mx_srgb_texture_to_lin_rec709:ZW,mx_subtract:vj,mx_timer:Mj,mx_transform_uv:rj,mx_unifiednoise2d:lj,mx_unifiednoise3d:uj,mx_worley_noise_float:hj,mx_worley_noise_vec2:dj,mx_worley_noise_vec3:cj,negate:kb,negateOnBackSide:Ou,neutralToneMapping:LP,nodeArray:wu,nodeImmutable:ze,nodeObject:Ye,nodeObjectIntent:Mp,nodeObjects:t0,nodeProxy:Mt,nodeProxyConstructor:yb,nodeProxyIntent:Ee,normalFlat:$C,normalGeometry:P0,normalLocal:Qi,normalMap:NT,normalView:Ut,normalViewGeometry:Ad,normalWorld:vl,normalWorldGeometry:qC,normalize:Yi,not:TA,notEqual:fA,numWorkgroups:G7,objectDirection:$6,objectGroup:uA,objectPosition:Y6,objectRadius:Q6,objectScale:Z6,objectViewPosition:J6,objectWorldMatrix:q6,oneMinus:HA,or:bA,orthographicDepthToViewZ:aE,oscSawtooth:C8,oscSine:M8,oscSquare:N8,oscTriangle:A8,output:Sd,outputStruct:e8,overloadingFn:ki,overrideNode:uP,overrideNodes:hP,packHalf2x16:g8,packNormalToRGB:wT,packSnorm2x16:m8,packUnorm2x16:f8,parabola:yS,parallaxDirection:cR,parallaxUV:Tz,parameter:YG,pass:w7,passTexture:M7,pcurve:c8,perspectiveDepthToViewZ:W0,pmremTexture:cS,pointShadow:n3,pointUV:K8,pointWidth:t6,positionGeometry:Ji,positionLocal:wr,positionPrevious:Du,positionView:Wr,positionViewDirection:ar,positionWorld:Rn,positionWorldDirection:gT,posterize:T7,pow:ma,pow2:Vb,pow3:eC,pow4:Gb,premultiplyAlpha:tT,property:go,quadBroadcast:F9,quadSwapDiagonal:C9,quadSwapX:N9,quadSwapY:A9,radians:LA,rand:aC,range:z7,rangeFogFactor:DP,reciprocal:$A,reference:cr,referenceBuffer:tR,reflect:JA,reflectVector:QC,reflectView:ZC,reflector:U8,refract:jb,refractVector:KC,refractView:JC,reinhardToneMapping:PP,remap:eT,remapClamp:PC,renderGroup:st,renderOutput:_0,rendererReference:TC,replaceDefaultUV:R8,rotate:Gp,rotateUV:E8,roughness:_n,round:XA,rtt:bP,sRGBTransferEOTF:yC,sRGBTransferOETF:xC,sample:q8,sampler:O6,samplerComparison:U6,saturate:y0,saturation:y7,screenCoordinate:ku,screenDPR:aT,screenSize:Lu,screenUV:Ga,select:Zi,setCurrentStack:Np,setName:$b,shaderStages:Jg,shadow:r3,shadowPositionWorld:kS,shapeCircle:tW,sharedUniformGroup:d0,sheen:Ws,sheenRoughness:hl,shiftLeft:AA,shiftRight:CA,shininess:u0,sign:Lb,sin:xs,sinc:p8,sinh:DA,skinning:QR,smoothstep:Hs,smoothstepElement:oC,specularColor:cl,specularColorBlended:Ru,specularF90:Eu,spherizeUV:P8,split:KU,spritesheetUV:F8,sqrt:ys,stack:iy,step:Bu,stepElement:lC,storage:Sl,storageBarrier:Y7,storageTexture:wP,storageTexture3D:r7,struct:KG,sub:It,subBuild:Iu,subgroupAdd:c9,subgroupAll:_9,subgroupAnd:x9,subgroupAny:w9,subgroupBallot:d9,subgroupBroadcast:R9,subgroupBroadcastFirst:M9,subgroupElect:h9,subgroupExclusiveAdd:m9,subgroupExclusiveMul:y9,subgroupInclusiveAdd:p9,subgroupInclusiveMul:g9,subgroupIndex:S6,subgroupMax:S9,subgroupMin:T9,subgroupMul:f9,subgroupOr:v9,subgroupShuffle:E9,subgroupShuffleDown:I9,subgroupShuffleUp:B9,subgroupShuffleXor:P9,subgroupSize:X7,subgroupXor:b9,tan:UA,tangentGeometry:L0,tangentLocal:Tl,tangentView:k0,tangentWorld:hR,tanh:zA,texture:Ot,texture3D:MS,texture3DLevel:n7,texture3DLoad:a7,textureBarrier:Z7,textureBicubic:EV,textureBicubicLevel:rS,textureCubeUV:VE,textureLevel:D6,textureLoad:Gr,textureSize:Fu,textureStore:e7,thickness:Mb,time:Fd,toneMapping:SC,toneMappingExposure:_C,toonOutlinePass:C7,transformDirection:tC,transformNormal:xT,transformNormalByInverseViewMatrix:iC,transformNormalByViewMatrix:rC,transformNormalToView:vT,transformedClearcoatNormalView:uz,transformedNormalView:oz,transformedNormalWorld:lz,transmission:h0,transpose:qA,triNoise3D:T8,triplanarTexture:L8,triplanarTextures:vP,trunc:Ub,uint:Ne,uintBitsToFloat:n8,uniform:Qe,uniformArray:Li,uniformCubeTexture:dz,uniformFlow:uC,uniformGroup:lA,uniformTexture:k6,unpackHalf2x16:v8,unpackNormal:MT,unpackRGBToNormal:mR,unpackSnorm2x16:y8,unpackUnorm2x16:x8,unpremultiplyAlpha:IC,userData:l7,uv:Jt,uvec2:vb,uvec3:Mu,uvec4:_b,varying:pl,varyingProperty:Nu,vec2:ke,vec3:K,vec4:Ve,vectorComponents:Su,velocity:h7,vertexColor:hE,vertexIndex:NC,vertexStage:gC,vibrance:x7,viewZToLogarithmicDepth:j0,viewZToOrthographicDepth:Vu,viewZToPerspectiveDepth:jT,viewZToReversedOrthographicDepth:qz,viewZToReversedPerspectiveDepth:nE,viewport:Nd,viewportCoordinate:UC,viewportDepthTexture:WT,viewportLinearDepth:Zz,viewportMipTexture:VT,viewportOpaqueMipTexture:sE,viewportResolution:j6,viewportSafeUV:I8,viewportSharedTexture:_7,viewportSize:nT,viewportTexture:Hz,viewportUV:W6,vogelDiskSample:ja,wgsl:F7,wgslFn:D7,workgroupArray:K7,workgroupBarrier:q7,workgroupId:W7,workingToColorSpace:vC,xor:SA}),Ha=new gS,Dj=class extends Nl{constructor(e,t){super(),this.renderer=e,this.nodes=t}update(e,t,r){let i=this.renderer,s=this.nodes.getBackgroundNode(e)||e.background,a=!1;if(s===null)i._clearColor.getRGB(Ha),Ha.a=i._clearColor.a;else if(s.isColor===!0)s.getRGB(Ha),Ha.a=1,a=!0;else if(s.isNode===!0){let o=this.get(e),l=s;Ha.copy(i._clearColor);let u=o.backgroundMesh;if(u===void 0){let d=function(){s.removeEventListener(\\\"dispose\\\",d),u.material.dispose(),u.geometry.dispose()},c=Ve(l).mul(wS).context({getUV:()=>SP.mul(qC),getTextureLevel:()=>TP}),m=bs.element(3).element(3).equal(1),g=js(1,bs.element(1).element(1)).mul(3),y=m.select(wr.mul(g),wr),b=Cn.mul(Ve(y,0)),v=bs.mul(Ve(b.xyz,1));v=v.setZ(v.w);let S=new Pt;S.name=\\\"Background.material\\\",S.side=ii,S.depthTest=!1,S.depthWrite=!1,S.allowOverride=!1,S.fog=!1,S.lights=!1,S.vertexNode=v,S.colorNode=c,o.backgroundMeshNode=c,o.backgroundMesh=u=new Mi(new eb(1,32,32),S),u.frustumCulled=!1,u.name=\\\"Background.mesh\\\",s.addEventListener(\\\"dispose\\\",d)}let h=l.getCacheKey();o.backgroundCacheKey!==h&&(o.backgroundMeshNode.node=Ve(l).mul(wS),o.backgroundMeshNode.needsUpdate=!0,u.material.needsUpdate=!0,o.backgroundCacheKey=h),t.unshift(u,u.geometry,u.material,0,0,null,null)}else Ce(\\\"Renderer: Unsupported background configuration.\\\",s);let n=i.xr.getEnvironmentBlendMode();if(n===\\\"additive\\\"?Ha.set(0,0,0,1):n===\\\"alpha-blend\\\"&&Ha.set(0,0,0,0),i.autoClear===!0||a===!0){let o=r.clearColorValue;o.r=Ha.r,o.g=Ha.g,o.b=Ha.b,o.a=Ha.a,(i.backend.isWebGLBackend===!0||i.alpha===!0)&&(o.r*=o.a,o.g*=o.a,o.b*=o.a),r.depthClearValue=i.getClearDepth(),r.stencilClearValue=i.getClearStencil(),r.clearColor=i.autoClearColor===!0,r.clearDepth=i.autoClearDepth===!0,r.clearStencil=i.autoClearStencil===!0}else r.clearColor=!1,r.clearDepth=!1,r.clearStencil=!1}},Oj=0,jS=class{constructor(e=\\\"\\\",t=[]){this.name=e,this.bindings=t,this.id=Oj++}},Uj=class{constructor(e,t,r,i,s,a,n,o,l,u,h=[]){this.vertexShader=e,this.fragmentShader=t,this.computeShader=r,this.transforms=h,this.nodeAttributes=i,this.bindings=s,this.updateNodes=a,this.updateBeforeNodes=n,this.updateAfterNodes=o,this.observer=l,this.hardwareClipping=u,this.usedTimes=0}createBindings(){let e=[];for(let t of this.bindings)if(t.bindings[0].groupNode.shared!==!0){let r=new jS(t.name,[]);e.push(r);for(let i of t.bindings)r.bindings.push(i.clone())}else e.push(t);return e}},y3=class{constructor(e,t,r=null){this.isNodeAttribute=!0,this.name=e,this.type=t,this.node=r}},zj=class{constructor(e,t,r){this.isNodeUniform=!0,this.name=e,this.type=t,this.node=r}get value(){return this.node.value}set value(e){this.node.value=e}get id(){return this.node.id}get groupNode(){return this.node.groupNode}},x3=class{constructor(e,t,r=!1,i=null){this.isNodeVar=!0,this.name=e,this.type=t,this.readOnly=r,this.count=i}},Vj=class extends x3{constructor(e,t,r=null,i=null){super(e,t),this.needsInterpolation=!1,this.isNodeVarying=!0,this.interpolationType=r,this.interpolationSampling=i}},Gj=class{constructor(e,t,r=\\\"\\\"){this.name=e,this.type=t,this.code=r,Object.defineProperty(this,\\\"isNodeCode\\\",{value:!0})}},Wj=0,HS=class{constructor(e=null){this.id=Wj++,this.nodesData=new WeakMap,this.parent=e}getData(e){let t=this.nodesData.get(e);return t===void 0&&this.parent!==null&&(t=this.parent.getData(e)),t}setData(e,t){this.nodesData.set(e,t)}},jj=class{constructor(e,t){this.name=e,this.members=t,this.output=!1}},El=class{constructor(e,t){this.name=e,this.value=t,this.boundary=0,this.itemSize=0,this.offset=0,this.index=-1}setValue(e){this.value=e}getValue(){return this.value}},Hj=class extends El{constructor(e,t=0){super(e,t),this.isNumberUniform=!0,this.boundary=4,this.itemSize=1}},Xj=class extends El{constructor(e,t=new fe){super(e,t),this.isVector2Uniform=!0,this.boundary=8,this.itemSize=2}},$j=class extends El{constructor(e,t=new F){super(e,t),this.isVector3Uniform=!0,this.boundary=16,this.itemSize=3}},qj=class extends El{constructor(e,t=new Wt){super(e,t),this.isVector4Uniform=!0,this.boundary=16,this.itemSize=4}},Yj=class extends El{constructor(e,t=new gt){super(e,t),this.isColorUniform=!0,this.boundary=16,this.itemSize=3}},Zj=class extends El{constructor(e,t=new kN){super(e,t),this.isMatrix2Uniform=!0,this.boundary=8,this.itemSize=4}},Jj=class extends El{constructor(e,t=new Dr){super(e,t),this.isMatrix3Uniform=!0,this.boundary=48,this.itemSize=12}},Qj=class extends El{constructor(e,t=new We){super(e,t),this.isMatrix4Uniform=!0,this.boundary=64,this.itemSize=16}},Kj=class extends Hj{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},eH=class extends Xj{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},tH=class extends $j{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},rH=class extends qj{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},iH=class extends Yj{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},sH=class extends Zj{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},aH=class extends Jj{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},nH=class extends Qj{constructor(e){super(e.name,e.value),this.nodeUniform=e}getValue(){return this.nodeUniform.value}getType(){return this.nodeUniform.type}},oH=0,v3=new WeakMap,b3=new WeakMap,lH=new WeakMap,uH=new Map([[Int8Array,\\\"int\\\"],[Int16Array,\\\"int\\\"],[Int32Array,\\\"int\\\"],[Uint8Array,\\\"uint\\\"],[Uint16Array,\\\"uint\\\"],[Uint32Array,\\\"uint\\\"],[Float32Array,\\\"float\\\"]]),Sy=e=>/e/g.test(e)?String(e).replace(/\\\\+/g,\\\"\\\"):(e=Number(e),e+(e%1?\\\"\\\":\\\".0\\\")),T3=e=>{if(e.writeUsageCount>0)return!0;if(e.subBuildsCache!==void 0){for(let t in e.subBuildsCache)if(T3(e.subBuildsCache[t]))return!0}return!1},S3=class{constructor(e,t,r){this.object=e,this.material=e&&e.material||null,this.geometry=e&&e.geometry||null,this.renderer=t,this.parser=r,this.scene=null,this.camera=null,this.nodes=new Set,this.sequentialNodes=new Set,this.updateNodes=[],this.updateBeforeNodes=[],this.updateAfterNodes=[],this.hashNodes={},this.observer=null,this.lightsNode=null,this.environmentNode=null,this.fogNode=null,this.clippingContext=null,this.hardwareClipping=!1,this.vertexShader=null,this.fragmentShader=null,this.computeShader=null,this.flowNodes={vertex:[],fragment:[],compute:[]},this.flowCode={vertex:\\\"\\\",fragment:\\\"\\\",compute:\\\"\\\"},this.uniforms={vertex:[],fragment:[],compute:[],index:0},this.structs={vertex:[],fragment:[],compute:[],index:0},this.types={vertex:[],fragment:[],compute:[],index:0},this.bindings={vertex:{},fragment:{},compute:{}},this.bindingsIndexes={},this.bindGroups=null,this.attributes=[],this.bufferAttributes=[],this.varyings=[],this.codes={},this.vars={},this.declarations={},this.flow={code:\\\"\\\"},this.chaining=[],this.stack=iy(),this.stacks=[],this.tab=\\\"\\t\\\",this.currentFunctionNode=null,this.context={material:this.material},this.cache=new HS,this.globalCache=this.cache,this.flowsData=new WeakMap,this.shaderStage=null,this.buildStage=null,this.subBuildLayers=[],this.activeStacks=[],this.subBuildFn=null,this.fnCall=null,Object.defineProperty(this,\\\"id\\\",{value:oH++})}isFlatShading(){return this.material.flatShading===!0||this.geometry.hasAttribute(\\\"normal\\\")===!1}isOpaque(){let e=this.material;return e.transparent===!1&&e.blending===oa&&e.alphaToCoverage===!1}createRenderTarget(e,t,r){return new er(e,t,r)}createCubeRenderTarget(e,t){return new pE(e,t)}includes(e){return this.nodes.has(e)}getOutputType(e=0){let t=\\\"vec4\\\",r=this.renderer.getRenderTarget();if(r!==null){let i=r.textures[e].type,s=r.textures[e].format,a=\\\"vec\\\";i===ci?a=\\\"ivec\\\":i===gr&&(a=\\\"uvec\\\"),s===io||s===jh?i===ci?t=\\\"int\\\":i===gr?t=\\\"uint\\\":t=\\\"float\\\":s===ha||s===Hh?t=`${a}2`:s===Wh||s===lv?t=`${a}3`:t=`${a}4`}return t}getOutputStructName(){}_getBindGroup(e,t){let r=t[0].groupNode,i=r.shared;if(i)for(let a=1;a\\u003ct.length;a++)r!==t[a].groupNode&&(i=!1);let s;if(i){let a=\\\"\\\";for(let u of t)if(u.isNodeUniformsGroup){u.uniforms.sort((h,d)=>h.nodeUniform.node.id-d.nodeUniform.node.id);for(let h of u.uniforms)a+=h.nodeUniform.node.id}else a+=u.nodeUniform.id;let n=this.renderer._currentRenderContext||this.renderer,o=v3.get(n);o===void 0&&(o=new Map,v3.set(n,o));let l=yd(a);s=o.get(l),s===void 0&&(s=new jS(e,t),o.set(l,s))}else s=new jS(e,t);return s}getBindGroupArray(e,t){let r=this.bindings[t],i=r[e];return i===void 0&&(this.bindingsIndexes[e]===void 0&&(this.bindingsIndexes[e]={binding:0,group:Object.keys(this.bindingsIndexes).length}),r[e]=i=[]),i}getBindings(){let e=this.bindGroups;if(e===null){let t={},r=this.bindings;for(let i of Jg)for(let s in r[i]){let a=r[i][s],n=t[s]||(t[s]=[]);for(let o of a)n.includes(o)===!1&&n.push(o)}e=[];for(let i in t){let s=t[i],a=this._getBindGroup(i,s);e.push(a)}this.bindGroups=e}return e}sortBindingGroups(){let e=this.getBindings();e.sort((t,r)=>t.bindings[0].groupNode.order-r.bindings[0].groupNode.order);for(let t=0;t\\u003ce.length;t++){let r=e[t];this.bindingsIndexes[r.name].group=t}}setHashNode(e,t){this.hashNodes[t]=e}addNode(e){this.nodes.has(e)===!1&&(this.nodes.add(e),this.setHashNode(e,e.getHash(this)))}addSequentialNode(e){let t=e.getUpdateBeforeType(),r=e.getUpdateAfterType();(t!==ut.NONE||r!==ut.NONE)&&this.sequentialNodes.add(e)}buildUpdateNodes(){for(let e of this.nodes)e.getUpdateType()!==ut.NONE&&this.updateNodes.push(e);for(let e of this.sequentialNodes){let t=e.getUpdateBeforeType(),r=e.getUpdateAfterType();t!==ut.NONE&&this.updateBeforeNodes.push(e),r!==ut.NONE&&this.updateAfterNodes.push(e)}}get currentNode(){return this.chaining[this.chaining.length-1]}isFilteredTexture(e){return e.magFilter===lr||e.magFilter===sv||e.magFilter===Gh||e.magFilter===Ia||e.minFilter===lr||e.minFilter===sv||e.minFilter===Gh||e.minFilter===Ia}getUniformBufferLimit(){return this.renderer.backend.capabilities.getUniformBufferLimit()}addChain(e){this.chaining.push(e)}removeChain(e){if(this.chaining.pop()!==e)throw new Error(\\\"THREE.NodeBuilder: Invalid node chaining!\\\")}getMethod(e){return e}getTernary(){return null}getNodeFromHash(e){return this.hashNodes[e]}addFlow(e,t){return this.flowNodes[e].push(t),t}setContext(e){this.context=e}getContext(){return this.context}addContext(e){let t=this.getContext();return this.setContext({...this.context,...e}),t}getSharedContext(){let e={...this.context};return delete e.material,delete e.getUV,delete e.getOutput,delete e.getTextureLevel,delete e.getAO,delete e.getShadow,e}setCache(e){this.cache=e}getCache(){return this.cache}getCacheFromNode(e,t=!0){let r=this.getDataFromNode(e);return r.cache===void 0&&(r.cache=new HS(t?this.getCache():null)),r.cache}isAvailable(){return!1}getVertexIndex(){Ue(\\\"Abstract function.\\\")}getInstanceIndex(){Ue(\\\"Abstract function.\\\")}getDrawIndex(){Ue(\\\"Abstract function.\\\")}getFrontFacing(){Ue(\\\"Abstract function.\\\")}getFragCoord(){Ue(\\\"Abstract function.\\\")}isFlipY(){return!1}isContextAssign(){return this.context.assign===!0}increaseUsage(e){let t=this.getDataFromNode(e);return t.usageCount=t.usageCount===void 0?1:t.usageCount+1,this.isContextAssign()?t.writeUsageCount=t.writeUsageCount===void 0?1:t.writeUsageCount+1:t.readUsageCount=t.readUsageCount===void 0?1:t.readUsageCount+1,t.usageCount}hasWriteUsage(e){let t=e.getShared(this),r=(t.isGlobal(this)?this.globalCache:this.cache).getData(t);if(r!==void 0){for(let i in r)if(T3(r[i]))return!0}return!1}generateTexture(){Ue(\\\"Abstract function.\\\")}generateTextureLod(){Ue(\\\"Abstract function.\\\")}generateArrayDeclaration(e,t){return this.getType(e)+\\\"[ \\\"+t+\\\" ]\\\"}generateArray(e,t,r=null){let i=this.generateArrayDeclaration(e,t)+\\\"( \\\";for(let s=0;s\\u003ct;s++){let a=r?r[s]:null;a!==null?i+=a.build(this,e):i+=this.generateConst(e),s\\u003ct-1&&(i+=\\\", \\\")}return i+=\\\" )\\\",i}generateStruct(e,t,r=null){let i=[];for(let s of t){let{name:a,type:n}=s;r&&r[a]&&r[a].isNode?i.push(r[a].build(this,n)):i.push(this.generateConst(n))}return e+\\\"( \\\"+i.join(\\\", \\\")+\\\" )\\\"}generateConst(e,t=null){if(t===null&&(e===\\\"float\\\"||e===\\\"int\\\"||e===\\\"uint\\\"?t=0:e===\\\"bool\\\"?t=!1:e===\\\"color\\\"?t=new gt:e===\\\"vec2\\\"||e===\\\"uvec2\\\"||e===\\\"ivec2\\\"?t=new fe:e===\\\"vec3\\\"||e===\\\"uvec3\\\"||e===\\\"ivec3\\\"?t=new F:(e===\\\"vec4\\\"||e===\\\"uvec4\\\"||e===\\\"ivec4\\\")&&(t=new Wt)),e===\\\"float\\\")return Sy(t);if(e===\\\"int\\\")return`${Math.round(t)}`;if(e===\\\"uint\\\")return t>=0?`${Math.round(t)}u`:\\\"0u\\\";if(e===\\\"bool\\\")return t?\\\"true\\\":\\\"false\\\";if(e===\\\"color\\\")return`${this.getType(\\\"vec3\\\")}( ${Sy(t.r)}, ${Sy(t.g)}, ${Sy(t.b)} )`;let r=this.getTypeLength(e),i=this.getComponentType(e),s=a=>this.generateConst(i,a);if(r===2)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)} )`;if(r===3)return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)} )`;if(r===4&&e!==\\\"mat2\\\")return`${this.getType(e)}( ${s(t.x)}, ${s(t.y)}, ${s(t.z)}, ${s(t.w)} )`;if(r>=4&&t&&(t.isMatrix2||t.isMatrix3||t.isMatrix4))return`${this.getType(e)}( ${t.elements.map(s).join(\\\", \\\")} )`;if(r>4)return`${this.getType(e)}()`;throw new Error(`THREE.NodeBuilder: Type '${e}' not found in generate constant attempt.`)}getType(e){return e===\\\"color\\\"?\\\"vec3\\\":e}hasGeometryAttribute(e){return this.geometry&&this.geometry.getAttribute(e)!==void 0}getAttribute(e,t){let r=this.attributes;for(let s of r)if(s.name===e)return s;let i=new y3(e,t);return this.registerDeclaration(i),r.push(i),i}getPropertyName(e){return e.name}isVector(e){return/vec\\\\d/.test(e)}isMatrix(e){return/mat\\\\d/.test(e)}isReference(e){return e===\\\"void\\\"||e===\\\"property\\\"||e===\\\"sampler\\\"||e===\\\"samplerComparison\\\"||e===\\\"texture\\\"||e===\\\"cubeTexture\\\"||e===\\\"storageTexture\\\"||e===\\\"depthTexture\\\"||e===\\\"texture3D\\\"}needsToWorkingColorSpace(){return!1}getComponentTypeFromTexture(e){let t=e.type;return e.isDepthTexture===!0?\\\"float\\\":t===ci?\\\"int\\\":t===gr?\\\"uint\\\":\\\"float\\\"}getElementType(e){return e===\\\"mat2\\\"?\\\"vec2\\\":e===\\\"mat3\\\"?\\\"vec3\\\":e===\\\"mat4\\\"?\\\"vec4\\\":this.getComponentType(e)}getComponentType(e){if(e=this.getVectorType(e),e===\\\"float\\\"||e===\\\"bool\\\"||e===\\\"int\\\"||e===\\\"uint\\\")return e;let t=/(b|i|u|)(vec|mat)([2-4])/.exec(e);return t===null?null:t[1]===\\\"b\\\"?\\\"bool\\\":t[1]===\\\"i\\\"?\\\"int\\\":t[1]===\\\"u\\\"?\\\"uint\\\":\\\"float\\\"}getVectorType(e){return e===\\\"color\\\"?\\\"vec3\\\":e===\\\"texture\\\"||e===\\\"cubeTexture\\\"||e===\\\"storageTexture\\\"||e===\\\"texture3D\\\"?\\\"vec4\\\":e}getTypeFromLength(e,t=\\\"float\\\"){if(e===1)return t;let r=WN(e),i=t===\\\"float\\\"?\\\"\\\":t[0];return/mat2/.test(t)===!0&&(r=r.replace(\\\"vec\\\",\\\"mat\\\")),i+r}getTypeFromArray(e){return uH.get(e.constructor)}isInteger(e){return/int|uint|(i|u)vec/.test(e)}getTypeFromAttribute(e){let t=e;e.isInterleavedBufferAttribute&&(t=e.data);let r=t.array,i=e.itemSize,s=e.normalized,a;return!(e instanceof sN)&&s!==!0&&(a=this.getTypeFromArray(r)),this.getTypeFromLength(i,a)}getTypeLength(e){let t=this.getVectorType(e),r=/vec([2-4])/.exec(t);return r!==null?Number(r[1]):t===\\\"float\\\"||t===\\\"bool\\\"||t===\\\"int\\\"||t===\\\"uint\\\"?1:/mat2/.test(e)===!0?4:/mat3/.test(e)===!0?9:/mat4/.test(e)===!0?16:0}getVectorFromMatrix(e){return e.replace(\\\"mat\\\",\\\"vec\\\")}changeComponentType(e,t){return this.getTypeFromLength(this.getTypeLength(e),t)}getIntegerType(e){let t=this.getComponentType(e);return t===\\\"int\\\"||t===\\\"uint\\\"?e:this.changeComponentType(e,\\\"int\\\")}setActiveStack(e){this.activeStacks.push(e)}removeActiveStack(e){if(this.activeStacks[this.activeStacks.length-1]===e)this.activeStacks.pop();else throw new Error(\\\"THREE.NodeBuilder: Invalid active stack removal.\\\")}getActiveStack(){return this.activeStacks[this.activeStacks.length-1]}getBaseStack(){return this.activeStacks[0]}addStack(){this.stack=iy(this.stack);let e=xb();return this.stacks.push(e),Np(this.stack),this.stack}removeStack(){let e=this.stack;for(let t of e.nodes){let r=this.getDataFromNode(t);r.stack=e}return this.stack=e.parent,Np(this.stacks.pop()),e}getDataFromNode(e,t=this.shaderStage,r=null){r=r===null?e.isGlobal(this)?this.globalCache:this.cache:r;let i=r.getData(e);i===void 0&&(i={},r.setData(e,i)),i[t]===void 0&&(i[t]={});let s=i[t];if(this.subBuildLayers.length===0)return s;let a=i.any?i.any.subBuilds:null,n=this.getClosestSubBuild(a);return n&&(s.subBuildsCache===void 0&&(s.subBuildsCache={}),s=s.subBuildsCache[n]||(s.subBuildsCache[n]={}),s.subBuilds=a),s}getNodeProperties(e,t=\\\"any\\\"){let r=this.getDataFromNode(e,t);return r.properties||(r.properties={outputNode:null})}getBufferAttributeFromNode(e,t,r=null){let i=this.getDataFromNode(e,\\\"vertex\\\"),s=i.bufferAttribute;if(s===void 0){let a=this.uniforms.index++;r===null&&(r=\\\"nodeAttribute\\\"+a),s=new y3(r,t,e),this.bufferAttributes.push(s),i.bufferAttribute=s}return s}getStructTypeNode(e,t=this.shaderStage){return this.types[t][e]||null}getStructTypeFromNode(e,t,r=null,i=this.shaderStage){let s=this.getDataFromNode(e,i,this.globalCache),a=s.structType;if(a===void 0){let n=this.structs.index++;r===null&&(r=\\\"StructType\\\"+n),a=new jj(r,t),this.structs[i].push(a),this.types[i][r]=e,s.structType=a}return a}getOutputStructTypeFromNode(e,t){let r=this.getStructTypeFromNode(e,t,\\\"OutputType\\\",\\\"fragment\\\");return r.output=!0,r}getUniformFromNode(e,t,r=this.shaderStage,i=null){let s=this.getDataFromNode(e,r,this.globalCache),a=s.uniform;if(a===void 0){let n=this.uniforms.index++;a=new zj(i||\\\"nodeUniform\\\"+n,t,e),this.uniforms[r].push(a),this.registerDeclaration(a),s.uniform=a}return a}getVarFromNode(e,t=null,r=e.getNodeType(this),i=this.shaderStage,s=!1){let a=this.getDataFromNode(e,i),n=this.getSubBuildProperty(\\\"variable\\\",a.subBuilds),o=a[n];if(o===void 0){let l=s?\\\"_const\\\":\\\"_var\\\",u=this.vars[i]||(this.vars[i]=[]),h=this.vars[l]||(this.vars[l]=0);t===null&&(t=(s?\\\"nodeConst\\\":\\\"nodeVar\\\")+h,this.vars[l]++),n!==\\\"variable\\\"&&(t=this.getSubBuildProperty(t,a.subBuilds));let d=e.getArrayCount(this);o=new x3(t,r,s,d),s||u.push(o),this.registerDeclaration(o),a[n]=o}return o}isDeterministic(e){if(e.isMathNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0)&&(e.cNode?this.isDeterministic(e.cNode):!0);if(e.isOperatorNode)return this.isDeterministic(e.aNode)&&(e.bNode?this.isDeterministic(e.bNode):!0);if(e.isArrayNode){if(e.values!==null){for(let t of e.values)if(!this.isDeterministic(t))return!1}return!0}else if(e.isConstNode)return!0;return!1}getVaryingFromNode(e,t=null,r=e.getNodeType(this),i=null,s=null){let a=this.getDataFromNode(e,\\\"any\\\"),n=this.getSubBuildProperty(\\\"varying\\\",a.subBuilds),o=a[n];if(o===void 0){let l=this.varyings,u=l.length;t===null&&(t=\\\"nodeVarying\\\"+u),n!==\\\"varying\\\"&&(t=this.getSubBuildProperty(t,a.subBuilds)),o=new Vj(t,r,i,s),l.push(o),this.registerDeclaration(o),a[n]=o}return o}registerDeclaration(e){let t=this.shaderStage,r=this.declarations[t]||(this.declarations[t]={}),i=e.name,s=i,a=this.getPropertyName(e),n=1;for(;r[a]!==void 0;)s=i+\\\"_\\\"+n++,e.name=s,a=this.getPropertyName(e);s!==i&&Ue(`TSL: Declaration name '${i}' of '${e.type}' already in use. Renamed to '${s}'.`),r[a]=e}getCodeFromNode(e,t,r=this.shaderStage){let i=this.getDataFromNode(e),s=i.code;if(s===void 0){let a=this.codes[r]||(this.codes[r]=[]),n=a.length;s=new Gj(\\\"nodeCode\\\"+n,t),a.push(s),i.code=s}return s}addFlowCodeHierarchy(e,t){let{flowCodes:r,flowCodeBlock:i}=this.getDataFromNode(e),s=!0,a=t;for(;a;){if(i.get(a)===!0){s=!1;break}a=this.getDataFromNode(a).parentNodeBlock}if(s)for(let n of r)this.addLineFlowCode(n)}addLineFlowCodeBlock(e,t,r){let i=this.getDataFromNode(e),s=i.flowCodes||(i.flowCodes=[]),a=i.flowCodeBlock||(i.flowCodeBlock=new WeakMap);s.push(t),a.set(r,!0)}addLineFlowCode(e,t=null){return e===\\\"\\\"?this:(t!==null&&this.context.nodeBlock&&this.addLineFlowCodeBlock(t,e,this.context.nodeBlock),e=this.tab+e,/;\\\\s*$/.test(e)||(e=e+`;\\n`),this.flow.code+=e,this)}addFlowCode(e){return this.flow.code+=e,this}addFlowTab(){return this.tab+=\\\"\\t\\\",this}removeFlowTab(){return this.tab=this.tab.slice(0,-1),this}getFlowData(e){return this.flowsData.get(e)}flowNode(e){let t=e.getNodeType(this),r=this.flowChildNode(e,t);return this.flowsData.set(e,r),r}addInclude(e){this.currentFunctionNode!==null&&this.currentFunctionNode.includes.push(e)}buildFunctionNode(e){let t=this.renderer.backend,r=b3.get(t);r===void 0&&(r=new WeakMap,b3.set(t,r));let i=r.get(e);if(i===void 0){i=new AS;let s=this.currentFunctionNode;this.currentFunctionNode=i,i.code=this.buildFunctionCode(e),this.currentFunctionNode=s,r.set(e,i)}return i}flowShaderNode(e){let t=e.layout,r={[Symbol.iterator](){let a=0,n=Object.values(this);return{next:()=>({value:n[a],done:a++>=n.length})}}};for(let a of t.inputs)r[a.name]=new dP(a.type,a.name);e.layout=null;let i=e.call(r),s=this.flowStagesNode(i,t.type);return e.layout=t,s}flowBuildStage(e,t,r=null){let i=this.getBuildStage();this.setBuildStage(t);let s=e.build(this,r);return this.setBuildStage(i),s}flowStagesNode(e,t=null){let r=this.flow,i=this.vars,s=this.declarations,a=this.cache,n=this.buildStage,o=this.stack,l={code:\\\"\\\"};this.flow=l,this.vars={},this.declarations={},this.cache=new HS,this.stack=iy();for(let u of Zg)this.setBuildStage(u),l.result=e.build(this,t);return l.vars=this.getVars(this.shaderStage),this.flow=r,this.vars=i,this.declarations=s,this.cache=a,this.stack=o,this.setBuildStage(n),l}getFunctionOperator(){return null}buildFunctionCode(){Ue(\\\"Abstract function.\\\")}flowChildNode(e,t=null){let r=this.flow,i={code:\\\"\\\"};return this.flow=i,i.result=e.build(this,t),this.flow=r,i}flowNodeFromShaderStage(e,t,r=null,i=null){let s=this.tab,a=this.cache,n=this.shaderStage,o=this.context;this.setShaderStage(e);let l={...this.context};delete l.nodeBlock,this.cache=this.globalCache,this.tab=\\\"\\t\\\",this.context=l;let u=null;if(this.buildStage===\\\"generate\\\"){let h=this.flowChildNode(t,r);i!==null&&(h.code+=`${this.tab+i} = ${h.result};\\n`),this.flowCode[e]=this.flowCode[e]+h.code,u=h}else u=t.build(this);return this.setShaderStage(n),this.cache=a,this.tab=s,this.context=o,u}getAttributesArray(){return this.attributes.concat(this.bufferAttributes)}getAttributes(){Ue(\\\"Abstract function.\\\")}getVaryings(){Ue(\\\"Abstract function.\\\")}getVar(e,t,r=null){return`${r!==null?this.generateArrayDeclaration(e,r):this.getType(e)} ${t}`}getVars(e,t=!1){let r=[],i=this.vars[e];if(i!==void 0)for(let s of i)r.push(`${this.getVar(s.type,s.name,s.count)};`);return r.join(t?`\\n`:`\\n\\t`)}getUniforms(){Ue(\\\"Abstract function.\\\")}getCodes(e){let t=this.codes[e],r=\\\"\\\";if(t!==void 0)for(let i of t)r+=i.code+`\\n`;return r}getHash(){return this.vertexShader+this.fragmentShader+this.computeShader}setShaderStage(e){this.shaderStage=e}getShaderStage(){return this.shaderStage}setBuildStage(e){this.buildStage=e}getBuildStage(){return this.buildStage}buildCode(){Ue(\\\"Abstract function.\\\")}get subBuild(){return this.subBuildLayers[this.subBuildLayers.length-1]||null}addSubBuild(e){this.subBuildLayers.push(e)}removeSubBuild(){return this.subBuildLayers.pop()}getClosestSubBuild(e){let t;if(e&&e.isNode?e.isShaderCallNodeInternal?t=e.shaderNode.subBuilds:e.isStackNode?t=[e.subBuild]:t=this.getDataFromNode(e,\\\"any\\\").subBuilds:e instanceof Set?t=[...e]:t=e,!t)return null;let r=this.subBuildLayers;for(let i=t.length-1;i>=0;i--){let s=t[i];if(r.includes(s))return s}return null}getSubBuildOutput(e){return this.getSubBuildProperty(\\\"outputNode\\\",e)}getSubBuildProperty(e=\\\"\\\",t=null){let r;t!==null?r=this.getClosestSubBuild(t):r=this.subBuildFn;let i;return r?i=e?r+\\\"_\\\"+e:r:i=e,i}prebuild(){let{object:e,renderer:t,material:r}=this;if(t.contextNode.isContextNode===!0?this.context={...this.context,...t.contextNode.getFlowContextData()}:Ce('NodeBuilder: \\\"renderer.contextNode\\\" must be an instance of `context()`.'),r&&r.contextNode&&(r.contextNode.isContextNode===!0?this.context={...this.context,...r.contextNode.getFlowContextData()}:Ce('NodeBuilder: \\\"material.contextNode\\\" must be an instance of `context()`.')),r!==null){let i=t.library.fromMaterial(r);i===null&&(Ce(`NodeBuilder: Material \\\"${r.type}\\\" is not compatible.`),i=new Pt),i.build(this)}else this.addFlow(\\\"compute\\\",e)}build(){this.prebuild();for(let e of Zg){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage(\\\"vertex\\\",this.context.position);for(let t of Jg){this.setShaderStage(t);let r=this.flowNodes[t];for(let i of r)e===\\\"generate\\\"?this.flowNode(i):i.build(this)}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}async buildAsync(){this.prebuild();for(let e of Zg){this.setBuildStage(e),this.context.position&&this.context.position.isNode&&this.flowNodeFromShaderStage(\\\"vertex\\\",this.context.position);for(let t of Jg){this.setShaderStage(t);let r=this.flowNodes[t];for(let i of r)e===\\\"generate\\\"?this.flowNode(i):i.build(this);await VM()}}return this.setBuildStage(null),this.setShaderStage(null),this.buildCode(),this.buildUpdateNodes(),this}getSharedDataFromNode(e){let t=lH.get(e);return t===void 0&&(t={}),t}getNodeUniform(e,t){let r=this.getSharedDataFromNode(e),i=r.cache;if(i===void 0){if(t===\\\"float\\\"||t===\\\"int\\\"||t===\\\"uint\\\")i=new Kj(e);else if(t===\\\"vec2\\\"||t===\\\"ivec2\\\"||t===\\\"uvec2\\\")i=new eH(e);else if(t===\\\"vec3\\\"||t===\\\"ivec3\\\"||t===\\\"uvec3\\\")i=new tH(e);else if(t===\\\"vec4\\\"||t===\\\"ivec4\\\"||t===\\\"uvec4\\\")i=new rH(e);else if(t===\\\"color\\\")i=new iH(e);else if(t===\\\"mat2\\\")i=new sH(e);else if(t===\\\"mat3\\\")i=new aH(e);else if(t===\\\"mat4\\\")i=new nH(e);else throw new Error(`THREE.NodeBuilder: Uniform \\\"${t}\\\" not implemented.`);r.cache=i}return i}format(e,t,r){if(t=this.getVectorType(t),r=this.getVectorType(r),t===r||r===null||this.isReference(r))return e;let i=this.getTypeLength(t),s=this.getTypeLength(r);return i===16&&s===9?`${this.getType(r)}( ${e}[ 0 ].xyz, ${e}[ 1 ].xyz, ${e}[ 2 ].xyz )`:i===9&&s===4?`${this.getType(r)}( ${e}[ 0 ].xy, ${e}[ 1 ].xy )`:i>4||s>4||s===0?e:i===s?`${this.getType(r)}( ${e} )`:i>s?(e=r===\\\"bool\\\"?`all( ${e} )`:`${e}.${\\\"xyz\\\".slice(0,s)}`,this.format(e,this.getTypeFromLength(s,this.getComponentType(t)),r)):s===4&&i>1?`${this.getType(r)}( ${this.format(e,t,\\\"vec3\\\")}, 1.0 )`:i===2?`${this.getType(r)}( ${this.format(e,t,\\\"vec2\\\")}, 0.0 )`:(i===1&&s>1&&t!==this.getComponentType(r)&&(e=`${this.getType(this.getComponentType(r))}( ${e} )`),`${this.getType(r)}( ${e} )`)}getSignature(){return`// Three.js r185 - Node System\\n`}needsPreviousData(){let e=this.renderer.getMRT();return e&&e.has(\\\"velocity\\\")||HN(this.object).useVelocity===!0}},_3=class{constructor(){this.time=0,this.deltaTime=0,this.frameId=0,this.renderId=0,this.updateMap=new WeakMap,this.updateBeforeMap=new WeakMap,this.updateAfterMap=new WeakMap,this.renderer=null,this.material=null,this.camera=null,this.object=null,this.scene=null}_getMaps(e,t){let r=e.get(t);return r===void 0&&(r={renderId:0,frameId:0},e.set(t,r)),r}updateBeforeNode(e){let t=e.getUpdateBeforeType(),r=e.updateReference(this);if(t===ut.FRAME){let i=this._getMaps(this.updateBeforeMap,r);if(i.frameId!==this.frameId){let s=i.frameId;i.frameId=this.frameId,e.updateBefore(this)===!1&&(i.frameId=s)}}else if(t===ut.RENDER){let i=this._getMaps(this.updateBeforeMap,r);if(i.renderId!==this.renderId){let s=i.renderId;i.renderId=this.renderId,e.updateBefore(this)===!1&&(i.renderId=s)}}else t===ut.OBJECT&&e.updateBefore(this)}updateAfterNode(e){let t=e.getUpdateAfterType(),r=e.updateReference(this);if(t===ut.FRAME){let i=this._getMaps(this.updateAfterMap,r);i.frameId!==this.frameId&&e.updateAfter(this)!==!1&&(i.frameId=this.frameId)}else if(t===ut.RENDER){let i=this._getMaps(this.updateAfterMap,r);i.renderId!==this.renderId&&e.updateAfter(this)!==!1&&(i.renderId=this.renderId)}else t===ut.OBJECT&&e.updateAfter(this)}updateNode(e){let t=e.getUpdateType(),r=e.updateReference(this);if(t===ut.FRAME){let i=this._getMaps(this.updateMap,r);i.frameId!==this.frameId&&e.update(this)!==!1&&(i.frameId=this.frameId)}else if(t===ut.RENDER){let i=this._getMaps(this.updateMap,r);i.renderId!==this.renderId&&e.update(this)!==!1&&(i.renderId=this.renderId)}else t===ut.OBJECT&&e.update(this)}update(){this.frameId++,this.lastTime===void 0&&(this.lastTime=performance.now()),this.deltaTime=(performance.now()-this.lastTime)/1e3,this.lastTime=performance.now(),this.time+=this.deltaTime}},XS=class{constructor(e,t,r=null,i=\\\"\\\",s=!1){this.type=e,this.name=t,this.count=r,this.qualifier=i,this.isConst=s}};XS.isNodeFunctionInput=!0;var hH=class extends qu{static get type(){return\\\"AmbientLightNode\\\"}constructor(e=null){super(e)}setup({context:e}){e.irradiance.addAssign(this.colorNode)}},dH=class extends qu{static get type(){return\\\"DirectionalLightNode\\\"}constructor(e=null){super(e)}setupDirect(){let e=this.colorNode;return{lightDirection:IS(this.light),lightColor:e}}},cH=class extends qu{static get type(){return\\\"HemisphereLightNode\\\"}constructor(e=null){super(e),this.lightPositionNode=PS(e),this.lightDirectionNode=this.lightPositionNode.normalize(),this.groundColorNode=Qe(new gt).setGroup(st)}update(e){let{light:t}=this;super.update(e),this.lightPositionNode.object3d=t,this.groundColorNode.value.copy(t.groundColor).multiplyScalar(t.intensity)}setup(e){let{colorNode:t,groundColorNode:r,lightDirectionNode:i}=this,s=vl.dot(i).mul(.5).add(.5),a=Ct(r,t,s);e.context.irradiance.addAssign(a)}},$S=class extends qu{static get type(){return\\\"SpotLightNode\\\"}constructor(e=null){super(e),this.coneCosNode=Qe(0).setGroup(st),this.penumbraCosNode=Qe(0).setGroup(st),this.cutoffDistanceNode=Qe(0).setGroup(st),this.decayExponentNode=Qe(0).setGroup(st),this.colorNode=Qe(this.color).setGroup(st)}update(e){super.update(e);let{light:t}=this;this.coneCosNode.value=Math.cos(t.angle),this.penumbraCosNode.value=Math.cos(t.angle*(1-t.penumbra)),this.cutoffDistanceNode.value=t.distance,this.decayExponentNode.value=t.decay}getSpotAttenuation(e,t){let{coneCosNode:r,penumbraCosNode:i}=this;return Hs(r,i,t)}getLightCoord(e){let t=e.getNodeProperties(this),r=t.projectionUV;return r===void 0&&(r=UP(this.light,e.context.positionWorld),t.projectionUV=r),r}setupDirect(e){let{colorNode:t,cutoffDistanceNode:r,decayExponentNode:i,light:s}=this,a=this.getLightVector(e),n=a.normalize(),o=n.dot(IS(s)),l=this.getSpotAttenuation(e,o),u=a.length(),h=VS({lightDistance:u,cutoffDistance:r,decayExponent:i}),d=t.mul(l).mul(h),c,m;return s.colorNode?(m=this.getLightCoord(e),c=s.colorNode(m)):s.map&&(m=this.getLightCoord(e),c=Ot(s.map,m.xy).onRenderUpdate(()=>s.map)),c&&(d=m.mul(2).sub(1).abs().lessThan(1).all().select(d.mul(c),d)),{lightColor:d,lightDirection:n}}},pH=class extends $S{static get type(){return\\\"IESSpotLightNode\\\"}constructor(e=null){super(e),this._iesTextureNode=null}getSpotAttenuation(e,t){let r=this.light.iesMap,i=null;if(r&&r.isTexture===!0){let s=t.acos().mul(1/Math.PI);this._iesTextureNode=Ot(r,ke(s,0),0),i=this._iesTextureNode.r}else i=super.getSpotAttenuation(e,t);return i}update(e){super.update(e),this._iesTextureNode!==null&&this.light.iesMap&&(this._iesTextureNode.value=this.light.iesMap)}},mH=class extends qu{static get type(){return\\\"LightProbeNode\\\"}constructor(e=null){super(e);let t=[];for(let r=0;r\\u003c9;r++)t.push(new F);this.lightProbe=Li(t)}update(e){let{light:t}=this;super.update(e);for(let r=0;r\\u003c9;r++)this.lightProbe.array[r].copy(t.sh.coefficients[r]).multiplyScalar(t.intensity)}setup(e){let t=g3(vl,this.lightProbe);e.context.irradiance.addAssign(t)}},fH=Q(([e,t])=>{let r=e.abs().sub(t);return Nn(Br(r,0)).add(Rs(Br(r.x,r.y),0))}),gH=class extends $S{static get type(){return\\\"ProjectorLightNode\\\"}update(e){super.update(e);let t=this.light;if(this.penumbraCosNode.value=Math.min(Math.cos(t.angle*(1-t.penumbra)),.99999),t.aspect===null){let r=1;t.map!==null&&(r=t.map.width/t.map.height),t.shadow.aspect=r}else t.shadow.aspect=t.aspect}getSpotAttenuation(e){let t=D(0),r=this.penumbraCosNode,i=fy(this.light).mul(e.context.positionWorld||Rn);return et(i.w.greaterThan(0),()=>{let s=i.xyz.div(i.w),a=fH(s.xy.sub(ke(.5)),ke(.5)),n=js(-1,It(1,Ib(r)).sub(1));t.assign(y0(a.mul(-2).mul(n)))}),t}},qS=new We,_y=new We,em=null,yH=class extends qu{static get type(){return\\\"RectAreaLightNode\\\"}constructor(e=null){super(e),this.halfHeight=Qe(new F).setGroup(st),this.halfWidth=Qe(new F).setGroup(st),this.updateType=ut.RENDER}update(e){super.update(e);let{light:t}=this,r=e.camera.matrixWorldInverse;_y.identity(),qS.copy(t.matrixWorld),qS.premultiply(r),_y.extractRotation(qS),this.halfWidth.value.set(t.width*.5,0,0),this.halfHeight.value.set(0,t.height*.5,0),this.halfWidth.value.applyMatrix4(_y),this.halfHeight.value.applyMatrix4(_y)}setupDirectRectArea(e){let t,r;e.isAvailable(\\\"float32Filterable\\\")?(t=Ot(em.LTC_FLOAT_1),r=Ot(em.LTC_FLOAT_2)):(t=Ot(em.LTC_HALF_1),r=Ot(em.LTC_HALF_2));let{colorNode:i,light:s}=this,a=BS(s);return{lightColor:i,lightPosition:a,halfWidth:this.halfWidth,halfHeight:this.halfHeight,ltc_1:t,ltc_2:r}}static setLTC(e){em=e}},w3=class{parseFunction(){Ue(\\\"Abstract function.\\\")}},YS=class{constructor(e,t,r=\\\"\\\",i=\\\"\\\"){this.type=e,this.inputs=t,this.name=r,this.precision=i}getCode(){Ue(\\\"Abstract function.\\\")}};YS.isNodeFunction=!0;var xH=/^\\\\s*(highp|mediump|lowp)?\\\\s*([a-z_0-9]+)\\\\s*([a-z_0-9]+)?\\\\s*\\\\(([\\\\s\\\\S]*?)\\\\)/i,vH=/[a-z_0-9]+/gi,M3=\\\"#pragma main\\\",bH=e=>{e=e.trim();let t=e.indexOf(M3),r=t!==-1?e.slice(t+M3.length):e,i=r.match(xH);if(i!==null&&i.length===5){let s=i[4],a=[],n=null;for(;(n=vH.exec(s))!==null;)a.push(n);let o=[],l=0;for(;l\\u003ca.length;){let g=a[l][0]===\\\"const\\\";g===!0&&l++;let y=a[l][0];y===\\\"in\\\"||y===\\\"out\\\"||y===\\\"inout\\\"?l++:y=\\\"\\\";let b=a[l++][0],v=Number.parseInt(a[l][0]);Number.isNaN(v)===!1?l++:v=null;let S=a[l++][0];o.push(new XS(b,S,v,y,g))}let u=r.substring(i[0].length),h=i[3]!==void 0?i[3]:\\\"\\\",d=i[2],c=i[1]!==void 0?i[1]:\\\"\\\",m=t!==-1?e.slice(0,t):\\\"\\\";return{type:d,inputs:o,name:h,precision:c,inputsCode:s,blockCode:u,headerCode:m}}else throw new Error(\\\"THREE.FunctionNode: Function is not a GLSL code.\\\")},TH=class extends YS{constructor(e){let{type:t,inputs:r,name:i,precision:s,inputsCode:a,blockCode:n,headerCode:o}=bH(e);super(t,r,i,s),this.inputsCode=a,this.blockCode=n,this.headerCode=o}getCode(e=this.name){let t,r=this.blockCode;if(r!==\\\"\\\"){let{type:i,inputsCode:s,headerCode:a,precision:n}=this,o=`${i} ${e} ( ${s.trim()} )`;n!==\\\"\\\"&&(o=`${n} ${o}`),t=a+o+r}else t=\\\"\\\";return t}},SH=class extends w3{parseFunction(e){return new TH(e)}},ba=[],Mo=[],N3=Qe(0,\\\"int\\\").setGroup(st),_H=class extends Nl{constructor(e,t){super(),this.renderer=e,this.backend=t,this.nodeFrame=new _3,this.nodeBuilderCache=new Map,this.callHashCache=new Ml,this.groupsData=new Ml,this._buildQueue=[],this._buildInProgress=!1,this.cacheLib={}}updateGroup(e){let t=e.groupNode;if(t.updateType===ut.OBJECT)return!0;ba[0]=t,ba[1]=e;let r=this.groupsData.get(ba);return r===void 0&&this.groupsData.set(ba,r={}),ba[0]=null,ba[1]=null,r.version!==t.version?(r.version=t.version,!0):!1}getForRenderCacheKey(e){return e.initialCacheKey}_createNodeBuilder(e,t){let r=this.backend.createNodeBuilder(e.object,this.renderer);return r.scene=e.scene,r.material=t,r.camera=e.camera,r.context.material=t,r.lightsNode=e.lightsNode,r.environmentNode=this.getEnvironmentNode(e.scene),r.fogNode=this.getFogNode(e.scene),r.clippingContext=e.clippingContext,this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview&&r.enableMultiview(),r}getForRender(e,t=!1){let r=this.get(e),i=r.nodeBuilderState;if(i===void 0){let{nodeBuilderCache:s}=this,a=this.getForRenderCacheKey(e);if(i=s.get(a),i===void 0){let n=async()=>{let o=this._createNodeBuilder(e,e.material);try{t?await o.buildAsync():o.build()}catch(l){o=this._createNodeBuilder(e,new Pt),t?await o.buildAsync():o.build(),Ce(\\\"TSL: \\\"+l)}return o};if(t)return n().then(o=>(i=this._createNodeBuilderState(o),s.set(a,i),i.usedTimes++,r.nodeBuilderState=i,i));{let o=this._createNodeBuilder(e,e.material);try{o.build()}catch(l){o=this._createNodeBuilder(e,new Pt),o.build();let u=l.stackTrace;!u&&l.stack&&(u=new $r(l.stack)),Ce(\\\"TSL: \\\"+l,u)}i=this._createNodeBuilderState(o),s.set(a,i)}}i.usedTimes++,r.nodeBuilderState=i}return i}getForRenderAsync(e){let t=this.getForRender(e,!0);return t.then?t:Promise.resolve(t)}getForRenderDeferred(e){let t=this.get(e);if(t.nodeBuilderState!==void 0)return t.nodeBuilderState;let r=this.getForRenderCacheKey(e),i=this.nodeBuilderCache.get(r);return i!==void 0?(i.usedTimes++,t.nodeBuilderState=i,i):(t.pendingBuild!==!0&&(t.pendingBuild=!0,this._buildQueue.push(()=>this.getForRenderAsync(e).then(()=>{t.pendingBuild=!1})),this._processBuildQueue()),null)}_processBuildQueue(){this._buildInProgress||this._buildQueue.length===0||(this._buildInProgress=!0,this._buildQueue.shift()().then(()=>{this._buildInProgress=!1,this._processBuildQueue()}))}delete(e){if(e.isRenderObject){let t=this.get(e).nodeBuilderState;t!==void 0&&(t.usedTimes--,t.usedTimes===0&&this.nodeBuilderCache.delete(this.getForRenderCacheKey(e)))}return super.delete(e)}getForCompute(e){let t=this.get(e),r=t.nodeBuilderState;if(r===void 0||t.version!==e.version){let i=this.backend.createNodeBuilder(e,this.renderer);i.build(),r=this._createNodeBuilderState(i),t.nodeBuilderState=r,t.version=e.version}return r}_createNodeBuilderState(e){return new Uj(e.vertexShader,e.fragmentShader,e.computeShader,e.getAttributesArray(),e.getBindings(),e.updateNodes,e.updateBeforeNodes,e.updateAfterNodes,e.observer,e.hardwareClipping,e.transforms)}getEnvironmentNode(e){if(this.renderer.lighting.enabled===!1)return null;this.updateEnvironment(e);let t=null;if(e.environmentNode&&e.environmentNode.isNode)t=e.environmentNode;else{let r=this.get(e);r.environmentNode&&(t=r.environmentNode)}return t}getBackgroundNode(e){this.updateBackground(e);let t=null;if(e.backgroundNode&&e.backgroundNode.isNode)t=e.backgroundNode;else{let r=this.get(e);r.backgroundNode&&(t=r.backgroundNode)}return t}getFogNode(e){return this.updateFog(e),e.fogNode||this.get(e).fogNode||null}getCacheKey(e,t){ba[0]=e,ba[1]=t;let r=this.renderer.info.calls,i=this.callHashCache.get(ba)||{};if(i.callId!==r){if(Mo.push(this.renderer.getOutputRenderTarget()&&this.renderer.getOutputRenderTarget().multiview?1:0),Mo.push(this.renderer.lighting.enabled?1:0),this.renderer.lighting.enabled){Mo.push(t.getCacheKey(!0)),Mo.push(this.renderer.shadowMap.enabled?1:0),Mo.push(this.renderer.shadowMap.type);let a=this.getEnvironmentNode(e);a&&Mo.push(a.getCacheKey())}let s=this.getFogNode(e);s&&Mo.push(s.getCacheKey()),i.callId=r,i.cacheKey=Sp(Mo),this.callHashCache.set(ba,i),Mo.length=0}return ba[0]=null,ba[1]=null,i.cacheKey}get isToneMappingState(){return!this.renderer.getRenderTarget()}updateBackground(e){let t=this.get(e),r=e.background;if(r){let i=e.backgroundBlurriness===0&&t.backgroundBlurriness>0||e.backgroundBlurriness>0&&t.backgroundBlurriness===0;if(t.background!==r||i){let s=this.getCacheNode(\\\"background\\\",r,()=>{if(r.isCubeTexture===!0||r.mapping===kf||r.mapping===iv||r.mapping===Df){if(e.backgroundBlurriness>0||r.mapping===Df)return cS(r);{let a;return r.isCubeTexture===!0?a=Ts(r):a=Ot(r),gE(a)}}else{if(r.isTexture===!0)return Ot(r,Ga.flipY()).setUpdateMatrix(!0);r.isColor!==!0&&Ce(\\\"WebGPUNodes: Unsupported background configuration.\\\",r)}},i);t.backgroundNode=s,t.background=r,t.backgroundBlurriness=e.backgroundBlurriness}}else t.backgroundNode&&(delete t.backgroundNode,delete t.background)}getCacheNode(e,t,r,i=!1){let s=this.cacheLib[e]||(this.cacheLib[e]=new WeakMap),a=s.get(t);return(a===void 0||i)&&(a=r(),s.set(t,a)),a}updateFog(e){let t=this.get(e),r=e.fog;if(r){if(t.fog!==r){let i=this.getCacheNode(\\\"fog\\\",r,()=>{if(r.isFogExp2){let s=cr(\\\"color\\\",\\\"color\\\",r).setGroup(st),a=cr(\\\"density\\\",\\\"float\\\",r).setGroup(st);return RS(s,OP(a))}else if(r.isFog){let s=cr(\\\"color\\\",\\\"color\\\",r).setGroup(st),a=cr(\\\"near\\\",\\\"float\\\",r).setGroup(st),n=cr(\\\"far\\\",\\\"float\\\",r).setGroup(st);return RS(s,DP(a,n))}else Ce(\\\"Renderer: Unsupported fog configuration.\\\",r)});t.fogNode=i,t.fog=r}}else delete t.fogNode,delete t.fog}updateEnvironment(e){let t=this.get(e),r=e.environment;if(r){if(t.environment!==r){let i=this.getCacheNode(\\\"environment\\\",r,()=>{if(r.isCubeTexture===!0)return Ts(r);if(r.isTexture===!0)return Ot(r);Ce(\\\"Nodes: Unsupported environment configuration.\\\",r)});t.environmentNode=i,t.environment=r}}else t.environmentNode&&(delete t.environmentNode,delete t.environment)}getNodeFrame(e=this.renderer,t=null,r=null,i=null,s=null){let a=this.nodeFrame;return a.renderer=e,a.scene=t,a.object=r,a.camera=i,a.material=s,a}getNodeFrameForRender(e){return this.getNodeFrame(e.renderer,e.scene,e.object,e.camera,e.material)}getOutputCacheKey(){let e=this.renderer;return e.toneMapping+\\\",\\\"+e.currentColorSpace+\\\",\\\"+e.xr.isPresenting}getOutputNode(e){let t=this.renderer,r;return e.isArrayTexture?this.backend.isWebGLBackend?r=Ot(e,Ga).depth(bo(\\\"gl_ViewID_OVR\\\")).renderOutput(t.toneMapping,t.currentColorSpace):r=Ot(e,Ga).depth(N3).renderOutput(t.toneMapping,t.currentColorSpace):r=Ot(e,Ga).renderOutput(t.toneMapping,t.currentColorSpace),r}setOutputLayerIndex(e){N3.value=e}updateBefore(e){let t=e.getNodeBuilderState();for(let r of t.updateBeforeNodes)this.getNodeFrameForRender(e).updateBeforeNode(r)}updateAfter(e){let t=e.getNodeBuilderState();for(let r of t.updateAfterNodes)this.getNodeFrameForRender(e).updateAfterNode(r)}updateForCompute(e){let t=this.getNodeFrame(),r=this.getForCompute(e);for(let i of r.updateNodes)t.updateNode(i)}updateForRender(e){let t=this.getNodeFrameForRender(e),r=e.getNodeBuilderState();for(let i of r.updateNodes)t.updateNode(i)}needsRefresh(e){let t=this.getNodeFrameForRender(e);return e.getMonitor().needsRefresh(e,t)}dispose(){super.dispose(),this.nodeFrame=new _3,this.nodeBuilderCache=new Map,this.cacheLib={}}},ZS=new fn,A3=class sD{constructor(t=null){this.version=0,this.clipIntersection=null,this.cacheKey=\\\"\\\",this.shadowPass=!1,this.viewMatrix=new We,this.viewNormalMatrix=new Dr,this.clippingGroupContexts=new WeakMap,this.intersectionPlanes=[],this.unionPlanes=[],this.parentVersion=null,t!==null&&(this.viewMatrix=t.viewMatrix,this.viewNormalMatrix=t.viewNormalMatrix,this.clippingGroupContexts=t.clippingGroupContexts,this.shadowPass=t.shadowPass)}projectPlanes(t,r,i){let s=t.length;for(let a=0;a\\u003cs;a++){ZS.copy(t[a]).applyMatrix4(this.viewMatrix,this.viewNormalMatrix);let n=r[i+a],o=ZS.normal;n.x=-o.x,n.y=-o.y,n.z=-o.z,n.w=ZS.constant}}updateGlobal(t,r){this.shadowPass=t.overrideMaterial!==null&&t.overrideMaterial.isShadowPassMaterial,this.viewMatrix.copy(r.matrixWorldInverse),this.viewNormalMatrix.getNormalMatrix(this.viewMatrix)}update(t,r){let i=!1;t.version!==this.parentVersion&&(this.intersectionPlanes=Array.from(t.intersectionPlanes),this.unionPlanes=Array.from(t.unionPlanes),this.parentVersion=t.version),this.clipIntersection!==r.clipIntersection&&(this.clipIntersection=r.clipIntersection,this.clipIntersection?this.unionPlanes.length=t.unionPlanes.length:this.intersectionPlanes.length=t.intersectionPlanes.length);let s=r.clippingPlanes,a=s.length,n,o;if(this.clipIntersection?(n=this.intersectionPlanes,o=t.intersectionPlanes.length):(n=this.unionPlanes,o=t.unionPlanes.length),n.length!==o+a){n.length=o+a;for(let l=0;l\\u003ca;l++)n[o+l]=new Wt;i=!0}this.projectPlanes(s,n,o),i&&(this.version++,this.cacheKey=`${this.intersectionPlanes.length}:${this.unionPlanes.length}`)}getGroupContext(t){if(this.shadowPass&&!t.clipShadows)return this;let r=this.clippingGroupContexts.get(t);return r===void 0&&(r=new sD(this),this.clippingGroupContexts.set(t,r)),r.update(this,t),r}get unionClippingCount(){return this.unionPlanes.length}},wH=class{constructor(e,t,r){this.bundleGroup=e,this.camera=t,this.renderContext=r}},Pl=[],MH=class{constructor(){this.bundles=new Ml}get(e,t,r){let i=this.bundles;Pl[0]=e,Pl[1]=t,Pl[2]=r;let s=i.get(Pl);return s===void 0&&(s=new wH(e,t,r),i.set(Pl,s)),Pl[0]=null,Pl[1]=null,Pl[2]=null,s}dispose(){this.bundles=new Ml}},C3=class{constructor(){this.lightNodes=new WeakMap,this.materialNodes=new Map,this.toneMappingNodes=new Map}fromMaterial(e){if(e.isNodeMaterial)return e;let t=null,r=this.getMaterialNodeClass(e.type);if(r!==null){t=new r;for(let i in e)t[i]=e[i]}return t}addToneMapping(e,t){this.addType(e,t,this.toneMappingNodes)}getToneMappingFunction(e){return this.toneMappingNodes.get(e)||null}getMaterialNodeClass(e){return this.materialNodes.get(e)||null}addMaterial(e,t){this.addType(e,t,this.materialNodes)}getLightNodeClass(e){return this.lightNodes.get(e)||null}addLight(e,t){this.addClass(e,t,this.lightNodes)}addType(e,t,r){if(r.has(t)){Ue(`Redefinition of node ${t}`);return}if(typeof e!=\\\"function\\\")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t==\\\"function\\\"||typeof t==\\\"object\\\")throw new Error(`THREE.NodeLibrary: Base class ${t} is not a class.`);r.set(t,e)}addClass(e,t,r){if(r.has(t)){Ue(`Redefinition of node ${t.name}`);return}if(typeof e!=\\\"function\\\")throw new Error(`THREE.NodeLibrary: Node class ${e.name} is not a class.`);if(typeof t!=\\\"function\\\")throw new Error(`THREE.NodeLibrary: Base class ${t.name} is not a class.`);r.set(t,e)}},NH=new LS,R3=new WeakMap,AH=class{constructor(){this.enabled=!0,this._cache=[]}createNode(e=[]){return new LS().setLights(e)}getNode(e){if(e.isScene!==!0&&e.isGroup!==!0)return NH;let t=R3.get(e);return t===void 0&&(t=this.createNode(),R3.set(e,t)),t}beginRender(e){this._cache.push(this.getNode(e).getLights())}finishRender(e){this.getNode(e).setLights(this._cache.pop())}},tm=class extends er{constructor(e=1,t=1,r={}){super(e,t,r),this.isXRRenderTarget=!0,this._hasExternalTextures=!1,this._autoAllocateDepthBuffer=!0,this._isOpaqueFramebuffer=!1}copy(e){return super.copy(e),this._hasExternalTextures=e._hasExternalTextures,this._autoAllocateDepthBuffer=e._autoAllocateDepthBuffer,this._isOpaqueFramebuffer=e._isOpaqueFramebuffer,this}},E3=new F,P3=new F,B3=new WeakMap,CH=class extends hn{constructor(e,t=!1){super(),this.enabled=!1,this.isPresenting=!1,this.cameraAutoUpdate=!0,this._renderer=e,this._cameraL=new gs,this._cameraL.viewport=new Wt,this._cameraL.matrixWorldAutoUpdate=!1,this._cameraR=new gs,this._cameraR.viewport=new Wt,this._cameraR.matrixWorldAutoUpdate=!1,this._cameras=[this._cameraL,this._cameraR],this._cameraXR=new aU,this._currentDepthNear=null,this._currentDepthFar=null,this._controllers=[],this._controllerInputSources=[],this._xrRenderTarget=null,this._layers=[],this._sessionUsesLayers=!1,this._supportsGlBinding=typeof XRWebGLBinding\\u003c\\\"u\\\",this._supportsWebGPUBinding=typeof globalThis.XRGPUBinding\\u003c\\\"u\\\",this._createXRLayer=FH.bind(this),this._gl=null,this._currentAnimationContext=null,this._currentAnimationLoop=null,this._currentPixelRatio=null,this._currentSamples=null,this._currentSize=new fe,this._onSessionEvent=PH.bind(this),this._onSessionEnd=BH.bind(this),this._onInputSourcesChange=IH.bind(this),this._onAnimationFrame=LH.bind(this),this._referenceSpace=null,this._referenceSpaceType=\\\"local-floor\\\",this._customReferenceSpace=null,this._framebufferScaleFactor=1,this._foveation=1,this._session=null,this._glBaseLayer=null,this._glBinding=null,this._webgpuBinding=null,this._glProjLayer=null,this._xrFrame=null,this._supportsLayers=this._supportsGlBinding&&\\\"createProjectionLayer\\\"in XRWebGLBinding.prototype,this._useMultiviewIfPossible=t,this._useMultiview=!1}getController(e){return this._getController(e).getTargetRaySpace()}getControllerGrip(e){return this._getController(e).getGripSpace()}getHand(e){return this._getController(e).getHandSpace()}getFoveation(){return this._foveation}setFoveation(e){this._foveation=e,this._glProjLayer!==null&&(this._glProjLayer.fixedFoveation=e),this._glBaseLayer!==null&&this._glBaseLayer.fixedFoveation!==void 0&&(this._glBaseLayer.fixedFoveation=e)}getFramebufferScaleFactor(){return this._framebufferScaleFactor}setFramebufferScaleFactor(e){this._framebufferScaleFactor=e,this.isPresenting===!0&&Ue(\\\"XRManager: Cannot change framebuffer scale while presenting.\\\")}getReferenceSpaceType(){return this._referenceSpaceType}setReferenceSpaceType(e){this._referenceSpaceType=e,this.isPresenting===!0&&Ue(\\\"XRManager: Cannot change reference space type while presenting.\\\")}getReferenceSpace(){return this._customReferenceSpace||this._referenceSpace}setReferenceSpace(e){this._customReferenceSpace=e}getCamera(){return this._cameraXR}getEnvironmentBlendMode(){if(this._session!==null)return this._session.environmentBlendMode}getBaseLayer(){return this._glProjLayer!==null?this._glProjLayer:this._glBaseLayer}getBinding(){return this._glBinding===null&&this._supportsGlBinding&&(this._glBinding=new XRWebGLBinding(this._session,this._gl)),this._glBinding}foveateBoundTexture(e){if(e.isPostProcessingRenderTarget!==!0||this.isPresenting!==!0||this._glProjLayer===null)return;let t=this._renderer.backend;if(t===void 0||t.isWebGLBackend!==!0||t.state===null)return;let r=this._renderer.getOutputRenderTarget();if(r===null||r.isXRRenderTarget!==!0)return;let i=this.getBinding();if(i===null||typeof i.foveateBoundTexture!=\\\"function\\\")return;this._renderer._textures.updateRenderTarget(e);let{textureGPU:s,glTextureType:a}=t.get(e.texture);if(!(s===void 0||a===void 0)&&e._xrFoveationTextureGPU!==s){e._xrFoveationTextureGPU=s,t.state.bindTexture(a,s);try{i.foveateBoundTexture(a,this.getFoveation())}catch(n){Et(`XRManager: Unable to foveate bound XR post-processing texture. ${n.name}: ${n.message}`)}finally{t.state.unbindTexture()}}}getWebGPUBinding(){return this._webgpuBinding===null&&this._supportsWebGPUBinding&&(this._webgpuBinding=new globalThis.XRGPUBinding(this._session,this._renderer.backend.device)),this._webgpuBinding}_isWebGPUSession(){return this._renderer.backend.isWebGPUBackend===!0&&this._session!==null&&this._session.enabledFeatures.includes(\\\"webgpu\\\")}_validateWebGPUSession(){let e=this._renderer;if(e.backend.isWebGPUBackend===!0){if(this._session.enabledFeatures.includes(\\\"webgpu\\\")===!1)throw new Error('THREE.XRManager: WebGPU XR sessions require the \\\"webgpu\\\" session feature. Use VRButtonGPU/XRButton with \\\"webgpu\\\" enabled or use a WebGL backend.');e.samples>0&&(Et(\\\"THREE.XRManager: WebGPU XR does not support MSAA yet. Disabling MSAA for this XR session.\\\"),this._currentSamples===null&&(this._currentSamples=e.samples),e._samples=0)}}async _initWebGPUSession(e){let t=this.getWebGPUBinding(),r=t.createProjectionLayer({colorFormat:t.getPreferredColorFormat(),depthStencilFormat:\\\"depth24plus\\\"});this._glProjLayer=r,e.updateRenderState({layers:[r]}),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._xrRenderTarget=new er(r.textureWidth,r.textureHeight,{depth:2,minFilter:lr,magFilter:lr,depthBuffer:!0,multiview:!1,useArrayDepthTexture:!0,samples:0}),this._xrRenderTarget.texture.isArrayTexture=!0,this._useMultiviewIfPossible===!0&&Et(\\\"THREE.XRManager: WebGPU XR does not support multiview yet. Disabling multiview for this XR session.\\\"),this._useMultiview=!1}_disposeWebGPUSession(){let e=this._renderer,t=this._xrRenderTarget;if(t===null||e.backend.isWebGPUBackend!==!0)return;let r=e.backend,i=e._textures,s=r.get?r.get(t):null;s&&(s.descriptors=void 0);let a=n=>{n!=null&&(r.delete&&r.delete(n),i.delete&&i.delete(n))};for(let n=0;n\\u003ct.textures.length;n++)a(t.textures[n]);a(t.depthTexture),a(t),e._renderContexts&&e._renderContexts.dispose&&e._renderContexts.dispose(),t.dispose()}_getWebGPUViewData(e){let t=this.getWebGPUBinding(),r={colorTexture:null,viewDescriptors:[],viewports:[]};for(let i=0;i\\u003ce.length;i++){let s=t.getViewSubImage(this._glProjLayer,e[i]);r.colorTexture===null&&(r.colorTexture=s.colorTexture),r.viewports.push(s.viewport),s.getViewDescriptor&&r.viewDescriptors.push(s.getViewDescriptor())}return r}getFrame(){return this._xrFrame}useMultiview(){return this._useMultiview}createQuadLayer(e,t,r,i,s,a,n,o={}){let l=new Kv(e,t),u=new tm(s,a,{format:pi,type:Si,depthTexture:new fs(s,a,o.stencil?ro:gr,void 0,void 0,void 0,void 0,void 0,void 0,o.stencil?ln:ua),stencilBuffer:o.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});u._autoAllocateDepthBuffer=!0;let h=new mn({color:16777215,side:Cs});h.map=u.texture,h.map.offset.y=1,h.map.repeat.y=-1;let d=new Mi(l,h);d.position.copy(r),d.quaternion.copy(i);let c={type:\\\"quad\\\",width:e,height:t,translation:r,quaternion:i,pixelwidth:s,pixelheight:a,plane:d,material:h,rendercall:n,renderTarget:u};if(this._layers.push(c),this._session!==null){c.plane.material=new mn({color:16777215,side:Cs}),c.plane.material.blending=Uh,c.plane.material.blendEquation=la,c.plane.material.blendSrc=Jo,c.plane.material.blendDst=Jo,c.xrlayer=this._createXRLayer(c);let m=this._session.renderState.layers;m.unshift(c.xrlayer),this._session.updateRenderState({layers:m})}else u.isXRRenderTarget=!1;return d}createCylinderLayer(e,t,r,i,s,a,n,o,l={}){let u=new X4(e,e,e*t/r,64,64,!0,Math.PI-t/2,t),h=new tm(a,n,{format:pi,type:Si,depthTexture:new fs(a,n,l.stencil?ro:gr,void 0,void 0,void 0,void 0,void 0,void 0,l.stencil?ln:ua),stencilBuffer:l.stencil,resolveDepthBuffer:!1,resolveStencilBuffer:!1});h._autoAllocateDepthBuffer=!0;let d=new mn({color:16777215,side:ii});d.map=h.texture,d.map.offset.y=1,d.map.repeat.y=-1;let c=new Mi(u,d);c.position.copy(i),c.quaternion.copy(s);let m={type:\\\"cylinder\\\",radius:e,centralAngle:t,aspectratio:r,translation:i,quaternion:s,pixelwidth:a,pixelheight:n,plane:c,material:d,rendercall:o,renderTarget:h};if(this._layers.push(m),this._session!==null){m.plane.material=new mn({color:16777215,side:ii}),m.plane.material.blending=Uh,m.plane.material.blendEquation=la,m.plane.material.blendSrc=Jo,m.plane.material.blendDst=Jo,m.xrlayer=this._createXRLayer(m);let g=this._session.renderState.layers;g.unshift(m.xrlayer),this._session.updateRenderState({layers:g})}else h.isXRRenderTarget=!1;return c}renderLayers(){let e=new F,t=new si,r=this._renderer,i=this.isPresenting;this.isPresenting=!1;let s=new fe;r.getSize(s);let a=r.getRenderTarget();for(let n of this._layers){n.renderTarget.isXRRenderTarget=this._session!==null,n.renderTarget._hasExternalTextures=n.renderTarget.isXRRenderTarget;let o=r.contextNode,l;if(n.renderTarget.isXRRenderTarget&&this._sessionUsesLayers){n.xrlayer.transform=new XRRigidTransform(n.plane.getWorldPosition(e),n.plane.getWorldQuaternion(t));let u=this._glBinding.getSubImage(n.xrlayer,this._xrFrame);r.backend.setXRRenderTargetTextures(n.renderTarget,u.colorTexture,void 0),r._setXRLayerSize(n.renderTarget.width,n.renderTarget.height),l=B3.get(o),l===void 0&&(l=o.context({getOutput:h=>_0(h,r.toneMapping,r.outputColorSpace)}),B3.set(o,l))}else l=o;r.contextNode=l,r.setRenderTarget(n.renderTarget),n.rendercall(),r.contextNode=o}r.setRenderTarget(a),r._setXRLayerSize(s.x,s.y),this.isPresenting=i}getSession(){return this._session}async setSession(e){let t=this._renderer;t.initialized===!1&&await t.init(),this._gl=t.getContext();let r=this._gl;if(this._session=e,e!==null){if(e.addEventListener(\\\"select\\\",this._onSessionEvent),e.addEventListener(\\\"selectstart\\\",this._onSessionEvent),e.addEventListener(\\\"selectend\\\",this._onSessionEvent),e.addEventListener(\\\"squeeze\\\",this._onSessionEvent),e.addEventListener(\\\"squeezestart\\\",this._onSessionEvent),e.addEventListener(\\\"squeezeend\\\",this._onSessionEvent),e.addEventListener(\\\"end\\\",this._onSessionEnd),e.addEventListener(\\\"inputsourceschange\\\",this._onInputSourcesChange),this._validateWebGPUSession(),this._currentPixelRatio=t.getPixelRatio(),t.getSize(this._currentSize),this._currentAnimationContext=t._animation.getContext(),this._currentAnimationLoop=t._animation.getAnimationLoop(),t._animation.stop(),this._isWebGPUSession())await this._initWebGPUSession(e);else if(this._supportsLayers===!0){let i=null,s=null,a=null,n=r.getContextAttributes();await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation()),t.depth&&(a=t.stencil?r.DEPTH24_STENCIL8:r.DEPTH_COMPONENT24,i=t.stencil?ln:ua,s=t.stencil?ro:gr);let o={colorFormat:r.RGBA8,depthFormat:a,scaleFactor:this._framebufferScaleFactor,clearOnAccess:!1};this._useMultiviewIfPossible&&t.hasFeature(\\\"OVR_multiview2\\\")&&(o.textureType=\\\"texture-array\\\",this._useMultiview=!0),this._glBinding=this.getBinding();let l=this._glBinding.createProjectionLayer(o),u=[l];this._glProjLayer=l,t.setPixelRatio(1),t._setXRLayerSize(l.textureWidth,l.textureHeight);let h=this._useMultiview?2:1,d=new fs(l.textureWidth,l.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,i,h);if(this._xrRenderTarget=new tm(l.textureWidth,l.textureHeight,{format:pi,type:Si,colorSpace:t.outputColorSpace,depthTexture:d,stencilBuffer:t.stencil,samples:n.antialias?4:0,resolveDepthBuffer:l.ignoreDepthValues===!1,resolveStencilBuffer:l.ignoreDepthValues===!1,depth:this._useMultiview?2:1,multiview:this._useMultiview}),this._xrRenderTarget._hasExternalTextures=!0,this._xrRenderTarget.depth=this._useMultiview?2:1,this._sessionUsesLayers=e.enabledFeatures.includes(\\\"layers\\\"),this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType()),this._sessionUsesLayers)for(let c of this._layers)c.plane.material=new mn({color:16777215,side:c.type===\\\"cylinder\\\"?ii:Cs}),c.plane.material.blending=Uh,c.plane.material.blendEquation=la,c.plane.material.blendSrc=Jo,c.plane.material.blendDst=Jo,c.xrlayer=this._createXRLayer(c),u.unshift(c.xrlayer);e.updateRenderState({layers:u})}else{await t.backend.makeXRCompatible(),this.setFoveation(this.getFoveation());let i={antialias:t.currentSamples>0,alpha:!0,depth:t.depth,stencil:t.stencil,framebufferScaleFactor:this.getFramebufferScaleFactor()},s=new XRWebGLLayer(e,r,i);this._glBaseLayer=s,e.updateRenderState({baseLayer:s}),t.setPixelRatio(1),t._setXRLayerSize(s.framebufferWidth,s.framebufferHeight),this._xrRenderTarget=new tm(s.framebufferWidth,s.framebufferHeight,{format:pi,type:Si,colorSpace:t.outputColorSpace,stencilBuffer:t.stencil,resolveDepthBuffer:s.ignoreDepthValues===!1,resolveStencilBuffer:s.ignoreDepthValues===!1}),this._xrRenderTarget._isOpaqueFramebuffer=!0,this._referenceSpace=await e.requestReferenceSpace(this.getReferenceSpaceType())}t._animation.setAnimationLoop(this._onAnimationFrame),t._animation.setContext(e),t._animation.start(),this.isPresenting=!0,this.dispatchEvent({type:\\\"sessionstart\\\"})}}updateCamera(e){let t=this._session;if(t===null)return;let r=e.near,i=e.far,s=this._cameraXR,a=this._cameraL,n=this._cameraR;s.near=n.near=a.near=r,s.far=n.far=a.far=i,s.isMultiViewCamera=this._useMultiview,(this._currentDepthNear!==s.near||this._currentDepthFar!==s.far)&&(t.updateRenderState({depthNear:s.near,depthFar:s.far}),this._currentDepthNear=s.near,this._currentDepthFar=s.far),s.layers.mask=e.layers.mask|6,a.layers.mask=s.layers.mask&-5,n.layers.mask=s.layers.mask&-3;let o=e.parent,l=s.cameras;I3(s,o);for(let u=0;u\\u003cl.length;u++)I3(l[u],o);l.length===2?RH(s,a,n):s.projectionMatrix.copy(a.projectionMatrix),EH(e,s,o)}_getController(e){let t=this._controllers[e];return t===void 0&&(t=new E4,this._controllers[e]=t),t}};function RH(e,t,r){E3.setFromMatrixPosition(t.matrixWorld),P3.setFromMatrixPosition(r.matrixWorld);let i=E3.distanceTo(P3),s=t.projectionMatrix.elements,a=r.projectionMatrix.elements,n=s[14]/(s[10]-1),o=s[14]/(s[10]+1),l=(s[9]+1)/s[5],u=(s[9]-1)/s[5],h=(s[8]-1)/s[0],d=(a[8]+1)/a[0],c=n*h,m=n*d,g=i/(-h+d),y=g*-h;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(y),e.translateZ(g),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),s[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let b=n+g,v=o+g,S=c-y,T=m+(i-y),w=l*o/v*b,N=u*o/v*b;e.projectionMatrix.makePerspective(S,T,w,N,b,v),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function I3(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}function EH(e,t,r){r===null?e.matrix.copy(t.matrixWorld):(e.matrix.copy(r.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld)),e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=Zh*2*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}function PH(e){let t=this._controllerInputSources.indexOf(e.inputSource);if(t===-1)return;let r=this._controllers[t];if(r!==void 0){let i=this.getReferenceSpace();r.update(e.inputSource,e.frame,i),r.dispatchEvent({type:e.type,data:e.inputSource})}}function BH(){let e=this._session,t=this._renderer;e.removeEventListener(\\\"select\\\",this._onSessionEvent),e.removeEventListener(\\\"selectstart\\\",this._onSessionEvent),e.removeEventListener(\\\"selectend\\\",this._onSessionEvent),e.removeEventListener(\\\"squeeze\\\",this._onSessionEvent),e.removeEventListener(\\\"squeezestart\\\",this._onSessionEvent),e.removeEventListener(\\\"squeezeend\\\",this._onSessionEvent),e.removeEventListener(\\\"end\\\",this._onSessionEnd),e.removeEventListener(\\\"inputsourceschange\\\",this._onInputSourcesChange);for(let r=0;r\\u003cthis._controllers.length;r++){let i=this._controllerInputSources[r];i!==null&&(this._controllerInputSources[r]=null,this._controllers[r].disconnect(i))}if(this._currentDepthNear=null,this._currentDepthFar=null,this._currentSamples!==null&&(t._samples=this._currentSamples,this._currentSamples=null),t._resetXRState(),this._disposeWebGPUSession(),this._session=null,this._xrRenderTarget=null,this._glBinding=null,this._webgpuBinding=null,this._glBaseLayer=null,this._glProjLayer=null,this._sessionUsesLayers===!0)for(let r of this._layers)r.renderTarget=new tm(r.pixelwidth,r.pixelheight,{format:pi,type:Si,depthTexture:new fs(r.pixelwidth,r.pixelheight,r.stencilBuffer?ro:gr,void 0,void 0,void 0,void 0,void 0,void 0,r.stencilBuffer?ln:ua),stencilBuffer:r.stencilBuffer,resolveDepthBuffer:!1,resolveStencilBuffer:!1}),r.renderTarget.isXRRenderTarget=!1,r.plane.material=r.material,r.material.map=r.renderTarget.texture,r.material.map.offset.y=1,r.material.map.repeat.y=-1,delete r.xrlayer;this.isPresenting=!1,this._useMultiview=!1,t._animation.stop(),t._animation.setAnimationLoop(this._currentAnimationLoop),t._animation.setContext(this._currentAnimationContext),t._animation.start(),t.setPixelRatio(this._currentPixelRatio),t.setSize(this._currentSize.width,this._currentSize.height,!1),this.dispatchEvent({type:\\\"sessionend\\\"})}function IH(e){let t=this._controllers,r=this._controllerInputSources;for(let i=0;i\\u003ce.removed.length;i++){let s=e.removed[i],a=r.indexOf(s);a>=0&&(r[a]=null,t[a].disconnect(s))}for(let i=0;i\\u003ce.added.length;i++){let s=e.added[i],a=r.indexOf(s);if(a===-1){for(let o=0;o\\u003ct.length;o++)if(o>=r.length){r.push(s),a=o;break}else if(r[o]===null){r[o]=s,a=o;break}if(a===-1)break}let n=t[a];n&&n.connect(s)}}function FH(e){return e.type===\\\"quad\\\"?this._glBinding.createQuadLayer({transform:new XRRigidTransform(e.translation,e.quaternion),width:e.width/2,height:e.height/2,space:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1}):this._glBinding.createCylinderLayer({transform:new XRRigidTransform(e.translation,e.quaternion),radius:e.radius,centralAngle:e.centralAngle,aspectRatio:e.aspectRatio,space:this._referenceSpace,viewPixelWidth:e.pixelwidth,viewPixelHeight:e.pixelheight,clearOnAccess:!1})}function LH(e,t){if(t===void 0)return;let r=this._cameraXR,i=this._renderer,s=i.backend,a=this._glBaseLayer,n=this.getReferenceSpace(),o=t.getViewerPose(n);if(this._xrFrame=t,o!==null){let l=o.views,u=this._isWebGPUSession()?this._getWebGPUViewData(l):null;this._glBaseLayer!==null&&u===null&&s.setXRTarget(a.framebuffer);let h=!1;l.length!==r.cameras.length&&(r.cameras.length=0,h=!0);for(let c=0;c\\u003cl.length;c++){let m=l[c],g;if(u!==null)g=u.viewports[c];else if(this._supportsLayers===!0){let b=this._glBinding.getViewSubImage(this._glProjLayer,m);g=b.viewport,c===0&&s.setXRRenderTargetTextures(this._xrRenderTarget,b.colorTexture,this._glProjLayer.ignoreDepthValues&&!this._useMultiview?void 0:b.depthStencilTexture)}else g=a.getViewport(m);let y=this._cameras[c];y===void 0&&(y=new gs,y.layers.enable(c),y.viewport=new Wt,y.matrixWorldAutoUpdate=!1,this._cameras[c]=y),y.matrix.fromArray(m.transform.matrix),y.matrix.decompose(y.position,y.quaternion,y.scale),y.projectionMatrix.fromArray(m.projectionMatrix),y.projectionMatrixInverse.copy(y.projectionMatrix).invert(),y.viewport.set(g.x,g.y,g.width,g.height),c===0&&(r.matrix.copy(y.matrix),r.matrix.decompose(r.position,r.quaternion,r.scale)),h===!0&&r.cameras.push(y)}u!==null&&u.colorTexture!==null&&s.setXRRenderTargetTextures(this._xrRenderTarget,u.colorTexture,u.viewDescriptors),i.setOutputRenderTarget(this._xrRenderTarget);let d=i._getFrameBufferTarget();i.xr.foveateBoundTexture(d)}for(let l=0;l\\u003cthis._controllers.length;l++){let u=this._controllerInputSources[l],h=this._controllers[l];u!==null&&h!==void 0&&h.update(u,t,n)}this._currentAnimationLoop&&this._currentAnimationLoop(e,t),t.detectedPlanes&&this.dispatchEvent({type:\\\"planesdetected\\\",data:t}),this._xrFrame=null}var kH=class extends hn{constructor(e){super(),this.domElement=e,this._pixelRatio=1,this._width=this.domElement.width,this._height=this.domElement.height,this._viewport=new Wt(0,0,this._width,this._height),this._scissor=new Wt(0,0,this._width,this._height),this._scissorTest=!1,this.colorTexture=new Gv,this.depthTexture=new fs}getPixelRatio(){return this._pixelRatio}getDrawingBufferSize(e){return e.set(this._width*this._pixelRatio,this._height*this._pixelRatio).floor()}getSize(e){return e.set(this._width,this._height)}setPixelRatio(e=1){this._pixelRatio!==e&&(this._pixelRatio=e,this.setSize(this._width,this._height,!1))}setDrawingBufferSize(e,t,r){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this._pixelRatio=r,this.domElement.width=Math.floor(e*r),this.domElement.height=Math.floor(t*r),this.setViewport(0,0,e,t),this._dispatchResize())}setSize(e,t,r=!0){this.xr&&this.xr.isPresenting||(this._width=e,this._height=t,this.domElement.width=Math.floor(e*this._pixelRatio),this.domElement.height=Math.floor(t*this._pixelRatio),r===!0&&(this.domElement.style.width=e+\\\"px\\\",this.domElement.style.height=t+\\\"px\\\"),this.setViewport(0,0,e,t),this._dispatchResize())}getScissor(e){let t=this._scissor;return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e}setScissor(e,t,r,i){let s=this._scissor;e.isVector4?s.copy(e):s.set(e,t,r,i)}getScissorTest(){return this._scissorTest}setScissorTest(e){this._scissorTest=e}getViewport(e){return e.copy(this._viewport)}setViewport(e,t,r,i,s=0,a=1){let n=this._viewport;e.isVector4?n.copy(e):n.set(e,t,r,i),n.minDepth=s,n.maxDepth=a}_dispatchResize(){this.dispatchEvent({type:\\\"resize\\\"})}dispose(){this.dispatchEvent({type:\\\"dispose\\\"})}},F3=new bg,zd=new fe,JS=new Wt,wy=new Og,My=new G4,Vd=new We,No=new Wt,DH={[Cs]:ii,[ii]:Cs,[hs]:hs},OH=class{constructor(e,t={}){this.isRenderer=!0;let{logarithmicDepthBuffer:r=!1,reversedDepthBuffer:i=!1,alpha:s=!0,depth:a=!0,stencil:n=!1,antialias:o=!1,samples:l=0,getFallback:u=null,outputBufferType:h=Dt,multiview:d=!1}=t;this.backend=e,this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.alpha=s,this.logarithmicDepthBuffer=r,this.reversedDepthBuffer=i,this.outputColorSpace=ds,this.toneMapping=eo,this.toneMappingExposure=1,this.sortObjects=!0,this.depth=a,this.stencil=n,this.info=new FG,this.contextNode=vo(),this.library=new C3,this.lighting=new AH,this._samples=l||o===!0?4:0,this._onCanvasTargetResize=this._onCanvasTargetResize.bind(this),this._canvasTarget=new kH(e.getDomElement()),this._canvasTarget.addEventListener(\\\"resize\\\",this._onCanvasTargetResize),this._canvasTarget.isDefaultCanvasTarget=!0,this._inspector=new LC,this._inspector.setRenderer(this),this._getFallback=u,this._attributes=null,this._geometries=null,this._nodes=null,this._animation=null,this._bindings=null,this._objects=null,this._pipelines=null,this._bundles=null,this._renderLists=null,this._renderContexts=null,this._textures=null,this._background=null,this._quadCache=new Map,this._currentRenderContext=null,this._opaqueSort=null,this._transparentSort=null,this._frameBufferTargets=new Map;let c=this.alpha===!0?0:1;this._clearColor=new gS(0,0,0,c),this._clearDepth=1,this._clearStencil=0,this._renderTarget=null,this._activeCubeFace=0,this._activeMipmapLevel=0,this._outputRenderTarget=null,this._mrt=null,this._renderObjectFunction=null,this._currentRenderObjectFunction=null,this._currentRenderBundle=null,this._handleObjectFunction=this._renderObjectDirect,this._isDeviceLost=!1,this.onDeviceLost=this._onDeviceLost,this.onError=this._onError,this._outputBufferType=h,this._cacheShadowNodes=new WeakMap,this._initialized=!1,this._callDepth=-1,this._initPromise=null,this._compilationPromises=null,this._currentSourceMaterial=null,this.transparent=!0,this.opaque=!0,this.shadowMap={enabled:!1,transmitted:!1,type:xM},this.xr=new CH(this,d),this.debug={checkShaderErrors:!0,onShaderError:null,getShaderAsync:async(m,g,y)=>{await this.compileAsync(y,g,m);let b=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,v=this._renderLists.get(m,g),S=this._renderContexts.get(b,this._mrt),T=m.overrideMaterial||y.material,w=this._objects.get(y,T,m,g,v.lightsNode,S,S.clippingContext),{fragmentShader:N,vertexShader:C}=w.getNodeBuilderState();return{fragmentShader:N,vertexShader:C}}}}async init(){return this._initPromise!==null?this._initPromise:(this._initPromise=new Promise(async(e,t)=>{let r=this.backend;try{await r.init(this)}catch(i){if(this._getFallback!==null)try{this.backend=r=this._getFallback(i),await r.init(this)}catch(s){t(s);return}else{t(i);return}}this._nodes=new _H(this,r),this._animation=new MG(this,this._nodes,this.info),this._attributes=new BG(r,this.info),this._background=new Dj(this,this._nodes),this._geometries=new IG(this._attributes,this.info),this._textures=new qG(this,r,this.info),this._pipelines=new OG(r,this._nodes,this.info),this._bindings=new UG(r,this._nodes,this._textures,this._attributes,this._pipelines,this.info),this._objects=new RG(this,this._nodes,this._geometries,this._pipelines,this._bindings,this.info),this._renderLists=new WG(this.lighting),this._bundles=new MH,this._renderContexts=new XG(this),this._animation.start(),this._initialized=!0,this._inspector.init(),e(this)}),this._initPromise)}get domElement(){return this._canvasTarget.domElement}get coordinateSystem(){return this.backend.coordinateSystem}async compileAsync(e,t,r=null){if(this._isDeviceLost===!0)return;this._initialized===!1&&await this.init();let i=this._nodes.nodeFrame,s=i.renderId,a=this._currentRenderContext,n=this._currentRenderObjectFunction,o=this._handleObjectFunction,l=this._compilationPromises;r===null&&(r=e);let u=e.isScene===!0?e:r.isScene===!0?r:F3,h=this.needsFrameBufferTarget&&this._renderTarget===null?this._getFrameBufferTarget():this._renderTarget||this._outputRenderTarget,d=this._renderContexts.get(h,this._mrt),c=this._activeMipmapLevel,m=[];this._currentRenderContext=d,this._currentRenderObjectFunction=this.renderObject,this._handleObjectFunction=this._createObjectPipeline,this._compilationPromises=m,i.renderId++,i.update(),d.depth=this.depth,d.stencil=this.stencil,d.clippingContext||(d.clippingContext=new A3),d.clippingContext.updateGlobal(u,t),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t),u.onBeforeRender(this,e,t,h);let g=t.isArrayCamera?My:wy;t.isArrayCamera?g.setFromArrayCamera(t):(Vd.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),g.setFromProjectionMatrix(Vd,t.coordinateSystem,t.reversedDepth));let y=this._renderLists.get(u,t);if(y.begin(),this._projectObject(e,t,0,y,d.clippingContext),r!==e&&r.traverseVisible(function(w){w.isLight&&w.layers.test(t.layers)&&y.pushLight(w)}),y.finish(),h!==null){this._textures.updateRenderTarget(h,c);let w=this._textures.get(h);d.textures=w.textures,d.depthTexture=w.depthTexture}else d.textures=null,d.depthTexture=null;r!==e?this._background.update(r,y,d):this._background.update(u,y,d);let b=y.opaque,v=y.transparent,S=y.transparentDoublePass,T=y.lightsNode;this.opaque===!0&&b.length>0&&this._renderObjects(b,t,u,T),this.transparent===!0&&v.length>0&&this._renderTransparents(v,S,t,u,T),i.renderId=s,this._currentRenderContext=a,this._currentRenderObjectFunction=n,this._handleObjectFunction=o,this._compilationPromises=l;for(let w of m){let N=this._objects.get(w.object,w.material,w.scene,w.camera,w.lightsNode,w.renderContext,w.clippingContext,w.passId);N.drawRange=w.object.geometry.drawRange,N.group=w.group,await this._nodes.getForRenderAsync(N),this._nodes.updateBefore(N),this._geometries.updateForRender(N),this._nodes.updateForRender(N),this._bindings.updateForRender(N);let C=[];this._pipelines.getForRender(N,C),C.length>0&&await Promise.all(C),this._nodes.updateAfter(N),await VM()}}async renderAsync(e,t){Et('Renderer: \\\"renderAsync()\\\" has been deprecated. Use \\\"render()\\\" and \\\"await renderer.init();\\\" when creating the renderer.'),await this.init(),this.render(e,t)}async waitForGPU(){Ce(\\\"Renderer: waitForGPU() has been removed. Read https://github.com/mrdoob/three.js/issues/32012 for more information.\\\")}set inspector(e){this._inspector!==null&&this._inspector.setRenderer(null),this._inspector=e,this._inspector.setRenderer(this)}get inspector(){return this._inspector}set highPrecision(e){let t=this.contextNode.value;e===!0?(t.modelViewMatrix=mT,t.modelNormalViewMatrix=fT):this.highPrecision&&(delete t.modelViewMatrix,delete t.modelNormalViewMatrix)}get highPrecision(){let e=this.contextNode.value;return e.modelViewMatrix===mT&&e.modelNormalViewMatrix===fT}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}getOutputBufferType(){return this._outputBufferType}getColorBufferType(){return Et('Renderer: \\\".getColorBufferType()\\\" has been renamed to \\\".getOutputBufferType()\\\".'),this.getOutputBufferType()}_onDeviceLost(e){let t=`THREE.WebGPURenderer: ${e.api} Device Lost:\\n\\nMessage: ${e.message}`;e.reason&&(t+=`\\nReason: ${e.reason}`),Ce(t),this._isDeviceLost=!0}_onError(e){let t=`WebGPURenderer: Uncaptured ${e.api} ${e.type}`;e.message&&(t+=`: ${e.message}`),Ce(t)}_bundleNeedsUpdate(e,t){return t.bundleGPU===void 0||e.version!==t.version}_renderBundle(e,t,r){let{bundleGroup:i,camera:s,renderList:a}=e,n=this._currentRenderContext,o=this._bundles.get(i,s,n),l=this.backend.get(o);if(this._bundleNeedsUpdate(i,l)){this.backend.beginBundle(n),this._currentRenderBundle=o;let{transparentDoublePass:u,transparent:h,opaque:d}=a;this.opaque===!0&&d.length>0&&this._renderObjects(d,s,t,r),this.transparent===!0&&h.length>0&&this._renderTransparents(h,u,s,t,r),this._currentRenderBundle=null,this.backend.finishBundle(n,o),l.version=i.version}else{let{renderObjects:u}=l;for(let h=0,d=u.length;h\\u003cd;h++){let c=u[h];this._nodes.needsRefresh(c)&&(this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c),this._nodes.updateAfter(c))}}this.backend.addBundle(n,o)}render(e,t){if(this._initialized===!1)throw new Error('THREE.Renderer: .render() called before the backend is initialized. Use \\\"await renderer.init();\\\" before rendering.');this._renderScene(e,t)}get initialized(){return this._initialized}_renderOutputLayers(e,t){if(t.texture.isArrayTexture!==!0||t.texture.image.depth\\u003c=1){this._renderScene(e,e.camera,!1);return}let r=this._activeCubeFace;try{for(let i=0;i\\u003ct.texture.image.depth;i++)this._nodes.setOutputLayerIndex(i),this._activeCubeFace=i,this._renderScene(e,e.camera,!1)}finally{this._nodes.setOutputLayerIndex(0),this._activeCubeFace=r}}_getFrameBufferTarget(){let{currentToneMapping:e,currentColorSpace:t}=this,r=e!==eo,i=t!==Gt.workingColorSpace;if(r===!1&&i===!1)return null;let{width:s,height:a}=this.getDrawingBufferSize(zd),{depth:n,stencil:o}=this,l=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(l);if(u===void 0){u=new er(s,a,{depthBuffer:n,stencilBuffer:o,type:this._outputBufferType,format:pi,colorSpace:Gt.workingColorSpace,generateMipmaps:!1,minFilter:lr,magFilter:lr,samples:this.samples}),u.isPostProcessingRenderTarget=!0;let y=()=>{l.removeEventListener(\\\"dispose\\\",y),u.dispose(),this._frameBufferTargets.delete(l)};l.addEventListener(\\\"dispose\\\",y),this._frameBufferTargets.set(l,u)}let h=this.getOutputRenderTarget();u.depthBuffer=n,u.stencilBuffer=o,h!==null?u.setSize(h.width,h.height,h.depth):u.setSize(s,a,1);let d=this._outputRenderTarget?this._outputRenderTarget.viewport:l._viewport,c=this._outputRenderTarget?this._outputRenderTarget.scissor:l._scissor,m=this._outputRenderTarget?1:l._pixelRatio,g=this._outputRenderTarget?this._outputRenderTarget.scissorTest:l._scissorTest;return u.viewport.copy(d),u.scissor.copy(c),u.viewport.multiplyScalar(m),u.scissor.multiplyScalar(m),u.scissorTest=g,u.multiview=h!==null?h.multiview:!1,u.useArrayDepthTexture=h!==null?h.useArrayDepthTexture:!1,u.resolveDepthBuffer=h!==null?h.resolveDepthBuffer:!0,u._autoAllocateDepthBuffer=h!==null?h._autoAllocateDepthBuffer:!1,u}_renderScene(e,t,r=!0){if(this._isDeviceLost===!0)return;let i=r?this._getFrameBufferTarget():null,s=this._nodes.nodeFrame,a=s.renderId,n=this._currentRenderContext,o=this._currentRenderObjectFunction,l=this._handleObjectFunction;this.lighting.beginRender(e),this._callDepth++;let u=e.isScene===!0?e:F3,h=this._renderTarget||this._outputRenderTarget,d=this._activeCubeFace,c=this._activeMipmapLevel,m;if(i!==null?(m=i,this.setRenderTarget(m)):m=h,m!==null&&m.depthBuffer===!0){let L=this._textures.get(m);L.depthInitialized!==!0&&((this.autoClear===!1||this.autoClear===!0&&this.autoClearDepth===!1)&&this.clearDepth(),L.depthInitialized=!0)}let g=this._renderContexts.get(m,this._mrt,this._callDepth);this._currentRenderContext=g,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,s.renderId=this.info.calls,this.backend.updateTimeStampUID(g),this.inspector.beginRender(this.backend.getTimestampUID(g),e,t,m),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t);let y=this._canvasTarget,b=y._viewport,v=y._scissor,S=y._pixelRatio;m!==null&&(b=m.viewport,v=m.scissor,S=1),this.getDrawingBufferSize(zd),JS.set(0,0,zd.width,zd.height);let T=b.minDepth===void 0?0:b.minDepth,w=b.maxDepth===void 0?1:b.maxDepth;g.viewportValue.copy(b).multiplyScalar(S).floor(),g.viewportValue.width>>=c,g.viewportValue.height>>=c,g.viewportValue.minDepth=T,g.viewportValue.maxDepth=w,g.viewport=g.viewportValue.equals(JS)===!1,g.scissorValue.copy(v).multiplyScalar(S).floor(),g.scissor=y._scissorTest&&g.scissorValue.equals(JS)===!1,g.scissorValue.width>>=c,g.scissorValue.height>>=c,g.clippingContext||(g.clippingContext=new A3),g.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,m);let N=t.isArrayCamera?My:wy;t.isArrayCamera?N.setFromArrayCamera(t):(Vd.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),N.setFromProjectionMatrix(Vd,t.coordinateSystem,t.reversedDepth));let C=this._renderLists.get(e,t);if(C.begin(),this._projectObject(e,t,0,C,g.clippingContext),C.finish(),this.sortObjects===!0&&C.sort(this._opaqueSort,this._transparentSort,t.reversedDepth),m!==null){this._textures.updateRenderTarget(m,c);let L=this._textures.get(m);g.textures=L.textures,g.depthTexture=L.depthTexture,g.width=L.width,g.height=L.height,g.renderTarget=m,g.depth=m.depthBuffer,g.stencil=m.stencilBuffer}else g.textures=null,g.depthTexture=null,g.width=zd.width,g.height=zd.height,g.depth=this.depth,g.stencil=this.stencil;g.width>>=c,g.height>>=c,g.activeCubeFace=d,g.activeMipmapLevel=c,g.occlusionQueryCount=C.occlusionQueryCount,g.scissorValue.max(No.set(0,0,0,0)),g.scissorValue.x+g.scissorValue.width>g.width&&(g.scissorValue.width=Math.max(g.width-g.scissorValue.x,0)),g.scissorValue.y+g.scissorValue.height>g.height&&(g.scissorValue.height=Math.max(g.height-g.scissorValue.y,0)),this._background.update(u,C,g),g.camera=t,this.backend.beginRender(g);let{bundles:R,lightsNode:E,transparentDoublePass:P,transparent:I,opaque:O}=C;return R.length>0&&this._renderBundles(R,u,E),this.opaque===!0&&O.length>0&&this._renderObjects(O,t,u,E),this.transparent===!0&&I.length>0&&this._renderTransparents(I,P,t,u,E),this.backend.finishRender(g),s.renderId=a,this._currentRenderContext=n,this._currentRenderObjectFunction=o,this._handleObjectFunction=l,this.lighting.finishRender(e),this._callDepth--,i!==null&&(this.setRenderTarget(h,d,c),this._renderOutput(m)),u.onAfterRender(this,e,t,m),this.inspector.finishRender(this.backend.getTimestampUID(g)),g}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){let t=this._nodes.getOutputCacheKey(),r=this._quadCache.get(e.texture),i;if(r===void 0){i=new Wa(new Pt),i.name=\\\"Output Color Transform\\\",i.material.name=\\\"outputColorTransform\\\",i.material.fragmentNode=this._nodes.getOutputNode(e.texture),r={quad:i,cacheKey:t},this._quadCache.set(e.texture,r);let n=()=>{i.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener(\\\"dispose\\\",n)};e.texture.addEventListener(\\\"dispose\\\",n)}else i=r.quad,r.cacheKey!==t&&(i.material.fragmentNode=this._nodes.getOutputNode(e.texture),i.material.needsUpdate=!0,r.cacheKey=t);let s=this.autoClear,a=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderOutputLayers(i,e),this.autoClear=s,this.xr.enabled=a}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e,t=null,r=0,i=-1){if(t!==null&&t.isReadbackBuffer&&this.info.memoryMap.has(t)===!1){this.info.createReadbackBuffer(t);let s=()=>{t.removeEventListener(\\\"dispose\\\",s),this.info.destroyReadbackBuffer(t)};t.addEventListener(\\\"dispose\\\",s)}if(r%4!==0||i>0&&i%4!==0)throw new Error('THREE.Renderer: \\\"getArrayBufferAsync()\\\" offset and count must be a multiple of 4.');return await this.backend.getArrayBufferAsync(e,t,r,i)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,r){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,r)}setSize(e,t,r=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,r)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,r,i){this._canvasTarget.setScissor(e,t,r,i)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,r,i,s=0,a=1){this._canvasTarget.setViewport(e,t,r,i,s,a)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this.reversedDepthBuffer===!0?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){let t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,r=!0){if(this._initialized===!1)throw new Error('THREE.Renderer: .clear() called before the backend is initialized. Use \\\"await renderer.init();\\\" before using this method.');let i=this._renderTarget||this._getFrameBufferTarget(),s=null;if(i!==null){this._textures.updateRenderTarget(i);let a=this._textures.get(i);s=this._renderContexts.get(i,null,-1),s.textures=a.textures,s.depthTexture=a.depthTexture,s.width=a.width,s.height=a.height,s.renderTarget=i,s.depth=i.depthBuffer,s.stencil=i.stencilBuffer;let n=this.backend.getClearColor();s.clearColorValue.r=n.r,s.clearColorValue.g=n.g,s.clearColorValue.b=n.b,s.clearColorValue.a=n.a,s.clearDepthValue=this.getClearDepth(),s.clearStencilValue=this.getClearStencil(),s.activeCubeFace=this.getActiveCubeFace(),s.activeMipmapLevel=this.getActiveMipmapLevel(),i.depthBuffer===!0&&(a.depthInitialized=!0)}this.backend.clear(e,t,r,s),i!==null&&this._renderTarget===null&&this._renderOutput(i)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,r=!0){Et('Renderer: \\\"clearAsync()\\\" has been deprecated. Use \\\"clear()\\\" and \\\"await renderer.init();\\\" when creating the renderer.'),await this.init(),this.clear(e,t,r)}async clearColorAsync(){Et('Renderer: \\\"clearColorAsync()\\\" has been deprecated. Use \\\"clearColor()\\\" and \\\"await renderer.init();\\\" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){Et('Renderer: \\\"clearDepthAsync()\\\" has been deprecated. Use \\\"clearDepth()\\\" and \\\"await renderer.init();\\\" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){Et('Renderer: \\\"clearStencilAsync()\\\" has been deprecated. Use \\\"clearStencil()\\\" and \\\"await renderer.init();\\\" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){let e=this.currentToneMapping!==eo,t=this.currentColorSpace!==Gt.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return this._renderTarget!==null?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:eo}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:Gt.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||this._renderTarget===null}dispose(){if(this._initialized===!0){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose();for(let e of this._frameBufferTargets.keys())e.dispose();Object.values(this.backend.timestampQueryPool).forEach(e=>{e!==null&&e.dispose()})}this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,r=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=r}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener(\\\"resize\\\",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener(\\\"resize\\\",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null);for(let e of this._frameBufferTargets.keys())e.dispose()}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(this._isDeviceLost===!0)return;if(this._initialized===!1)return Ue(\\\"Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead.\\\"),this.computeAsync(e,t);let r=this._nodes.nodeFrame,i=r.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,r.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);let s=this.backend,a=this._pipelines,n=this._bindings,o=this._nodes,l=Array.isArray(e)?e:[e];if(l[0]===void 0||l[0].isComputeNode!==!0)throw new Error(\\\"THREE.Renderer: .compute() expects a ComputeNode.\\\");s.beginCompute(e);for(let u of l){if(a.has(u)===!1){let c=()=>{u.removeEventListener(\\\"dispose\\\",c),a.delete(u),n.deleteForCompute(u),o.delete(u)};u.addEventListener(\\\"dispose\\\",c);let m=u.onInitFunction;m!==null&&m.call(u,{renderer:this})}o.updateForCompute(u),n.updateForCompute(u);let h=n.getForCompute(u),d=a.getForCompute(u,h);s.compute(e,u,h,d,t)}s.finishCompute(e),r.renderId=i,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){this._initialized===!1&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return Et('Renderer: \\\"hasFeatureAsync()\\\" has been deprecated. Use \\\"hasFeature()\\\" and \\\"await renderer.init();\\\" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e=\\\"render\\\"){return this._initialized===!1&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasFeature() called before the backend is initialized. Use \\\"await renderer.init();\\\" before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){Et('Renderer: \\\"initTextureAsync()\\\" has been deprecated. Use \\\"initTexture()\\\" and \\\"await renderer.init();\\\" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initTexture() called before the backend is initialized. Use \\\"await renderer.init();\\\" before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initRenderTarget() called before the backend is initialized. Use \\\"await renderer.init();\\\" before using this method.');this._textures.updateRenderTarget(e);let t=this._textures.get(e),r=this._renderContexts.get(e);r.textures=t.textures,r.depthTexture=t.depthTexture,r.width=t.width,r.height=t.height,r.renderTarget=e,r.depth=e.depthBuffer,r.stencil=e.stencilBuffer,this.backend.initRenderTarget(r)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=No.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=No.copy(t).floor();else{Ce(\\\"Renderer.copyFramebufferToTexture: Invalid rectangle.\\\");return}else t=No.set(0,0,e.image.width,e.image.height);let r=this._currentRenderContext,i;r!==null?i=r.renderTarget:(i=this._renderTarget||this._getFrameBufferTarget(),i!==null&&(this._textures.updateRenderTarget(i),r=this._textures.get(i))),this._textures.updateTexture(e,{renderTarget:i}),this.backend.copyFramebufferToTexture(e,r,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,r=null,i=null,s=0,a=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,r,i,s,a),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,r,i,s,a=0,n=0){return this.backend.copyTextureToBuffer(e.textures[a],t,r,i,s,n)}_projectObject(e,t,r,i,s){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)r=e.renderOrder,e.isClippingGroup&&e.enabled&&(s=s.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)i.pushLight(e);else if(e.isSprite){let n=t.isArrayCamera?My:wy;if(!e.frustumCulled||n.intersectsSprite(e)){this.sortObjects===!0&&No.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Vd);let{geometry:o,material:l}=e;l.visible&&i.push(e,o,l,r,No.z,null,s)}}else if(e.isLineLoop)Ce(\\\"Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.\\\");else if(e.isMesh||e.isLine||e.isPoints){let n=t.isArrayCamera?My:wy;if(!e.frustumCulled||n.intersectsObject(e)){let{geometry:o,material:l}=e;if(this.sortObjects===!0&&(o.boundingSphere===null&&o.computeBoundingSphere(),No.copy(o.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(Vd)),Array.isArray(l)){let u=o.groups;for(let h=0,d=u.length;h\\u003cd;h++){let c=u[h],m=l[c.materialIndex];m&&m.visible&&i.push(e,o,m,r,No.z,c,s)}}else l.visible&&i.push(e,o,l,r,No.z,null,s)}}}if(e.isBundleGroup===!0&&this.backend.beginBundle!==void 0){let n=i;i=this._renderLists.get(e,t);let o=this._bundles.get(e,t,this._currentRenderContext),l=this.backend.get(o);if(this._bundleNeedsUpdate(e,l)){i.begin(),l.renderObjects===void 0?l.renderObjects=[]:l.renderObjects.length=0;let u=e.children;for(let h=0,d=u.length;h\\u003cd;h++)this._projectObject(u[h],t,r,i,s);i.finish()}n.pushBundle({bundleGroup:e,camera:t,renderList:i});return}let a=e.children;for(let n=0,o=a.length;n\\u003co;n++)this._projectObject(a[n],t,r,i,s)}_renderBundles(e,t,r){for(let i of e)this._renderBundle(i,t,r)}_renderTransparents(e,t,r,i,s){if(t.length>0){for(let{material:a}of t)a.side=ii;this._renderObjects(t,r,i,s,\\\"backSide\\\");for(let{material:a}of t)a.side=Cs;this._renderObjects(e,r,i,s);for(let{material:a}of t)a.side=hs}else this._renderObjects(e,r,i,s)}_renderObjects(e,t,r,i,s=null){for(let a=0,n=e.length;a\\u003cn;a++){let{object:o,geometry:l,material:u,group:h,clippingContext:d}=e[a];this._currentRenderObjectFunction(o,r,t,l,u,h,i,d,s)}}_getShadowNodes(e){let t=e.version,r=this._cacheShadowNodes.get(e);if(r===void 0||r.version!==t){let i=e.map&&e.map.isTexture,s=e.colorNode&&e.colorNode.isNode,a=e.castShadowNode&&e.castShadowNode.isNode,n=e.maskShadowNode&&e.maskShadowNode.isNode||e.maskNode&&e.maskNode.isNode,o=null,l=null,u=null;if(i||s||a||n){let h,d;if(a?(h=e.castShadowNode.rgb,d=e.castShadowNode.a,this.shadowMap.transmitted!==!0&&Et(\\\"Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.\\\")):(h=K(0),d=D(1)),i&&(d=d.mul(cr(\\\"map\\\",\\\"texture\\\",e).a)),s&&(d=d.mul(e.colorNode.a)),l=Ve(h,d),n){let c=e.maskShadowNode||e.maskNode;l=Q(([m])=>(c.not().discard(),m))(l)}}e.depthNode&&e.depthNode.isNode&&(u=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?o=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(o=e.positionNode),r={version:t,colorNode:l,depthNode:u,positionNode:o},this._cacheShadowNodes.set(e,r)}return r}_updateCamera(e){let t=this.xr;if(t.isPresenting===!1){let r=!1;if(this.reversedDepthBuffer===!0&&e.reversedDepth!==!0){if(e._reversedDepth=!0,e.isArrayCamera)for(let s of e.cameras)s._reversedDepth=!0;r=!0}let i=this.coordinateSystem;if(e.coordinateSystem!==i){if(e.coordinateSystem=i,e.isArrayCamera)for(let s of e.cameras)s.coordinateSystem=i;r=!0}if(r===!0&&(e.updateProjectionMatrix(),e.isArrayCamera))for(let s of e.cameras)s.updateProjectionMatrix()}return e.parent===null&&e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.enabled===!0&&t.isPresenting===!0&&(t.cameraAutoUpdate===!0&&t.updateCamera(e),e=t.getCamera()),e}renderObject(e,t,r,i,s,a,n,o=null,l=null){let u=!1,h,d,c,m,g,y,b,v=this._currentSourceMaterial;if(e.onBeforeRender(this,t,r,i,s,a),s.allowOverride===!0&&t.overrideMaterial!==null){this._currentSourceMaterial=s;let S=t.overrideMaterial;if(u=!0,h=S.isNodeMaterial?S.colorNode:null,d=S.isNodeMaterial?S.depthNode:null,c=S.isNodeMaterial?S.positionNode:null,m=t.overrideMaterial.side,g=S.displacementMap,y=S.displacementScale,b=S.displacementBias,s.positionNode&&s.positionNode.isNode&&(S.positionNode=s.positionNode),S.alphaTest=s.alphaTest,S.alphaMap=s.alphaMap,S.displacementMap=s.displacementMap,S.displacementScale=s.displacementScale,S.displacementBias=s.displacementBias,S.transparent=s.transparent||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode,S.isShadowPassMaterial){let{colorNode:T,depthNode:w,positionNode:N}=this._getShadowNodes(s);this.shadowMap.type===Lh?S.side=s.shadowSide!==null?s.shadowSide:s.side:S.side=s.shadowSide!==null?s.shadowSide:DH[s.side],T!==null&&(S.colorNode=T),w!==null&&(S.depthNode=w),N!==null&&(S.positionNode=N)}s=S}s.transparent===!0&&s.side===hs&&s.forceSinglePass===!1?(s.side=ii,this._handleObjectFunction(e,s,t,r,n,a,o,\\\"backSide\\\"),s.side=Cs,this._handleObjectFunction(e,s,t,r,n,a,o,l),s.side=hs):this._handleObjectFunction(e,s,t,r,n,a,o,l),u&&(t.overrideMaterial.colorNode=h,t.overrideMaterial.depthNode=d,t.overrideMaterial.positionNode=c,t.overrideMaterial.side=m,t.overrideMaterial.displacementMap=g,t.overrideMaterial.displacementScale=y,t.overrideMaterial.displacementBias=b),this._currentSourceMaterial=v,e.onAfterRender(this,t,r,i,s,a)}hasCompatibility(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasCompatibility() called before the backend is initialized. Use \\\"await renderer.init();\\\" before using this method.');return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,r,i,s,a,n,o){let l=this._objects.get(e,t,r,i,s,this._currentRenderContext,n,o);l.drawRange=e.geometry.drawRange,l.group=a,this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(l),l.bundle=this._currentRenderBundle.bundleGroup);let u=this._nodes.needsRefresh(l);u&&(this._nodes.updateBefore(l),this._geometries.updateForRender(l),this._nodes.updateForRender(l),this._bindings.updateForRender(l)),this._pipelines.updateForRender(l),this._pipelines.isReady(l)&&(this.backend.draw(l,this.info),u&&this._nodes.updateAfter(l))}_createObjectPipeline(e,t,r,i,s,a,n,o){if(this._compilationPromises!==null){this._compilationPromises.push({object:e,material:t,scene:r,camera:i,lightsNode:s,group:a,clippingContext:n,passId:o,renderContext:this._currentRenderContext});return}let l=this._objects.get(e,t,r,i,s,this._currentRenderContext,n,o);l.drawRange=e.geometry.drawRange,l.group=a,this._nodes.updateBefore(l),this._geometries.updateForRender(l),this._nodes.updateForRender(l),this._bindings.updateForRender(l),this._pipelines.getForRender(l,this._compilationPromises),this._nodes.updateAfter(l)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}},L3=class{constructor(e=\\\"\\\"){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}};function k3(e){return e+(Al-e%Al)%Al}var D3=class extends L3{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return k3(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},O3=class extends D3{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},UH=0,U3=class extends O3{constructor(e,t){super(\\\"UniformBuffer_\\\"+UH++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get byteLength(){return k3(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},zH=class extends O3{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map,this._addedIndices=new Set}addUniformUpdateRange(e){let t=e.index;if(this._addedIndices.has(t))return;let r=this._updateRangeCache.get(t);r===void 0&&(r={start:0,count:0},this._updateRangeCache.set(t,r)),r.start=e.offset,r.count=e.itemSize,this._addedIndices.add(t),this.updateRanges.push(r)}clearUpdateRanges(){this._addedIndices.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){let t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}get values(){return this._values===null&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(e===null){let t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){let e=this.bytesPerElement,t=0;for(let r=0,i=this.uniforms.length;r\\u003ci;r++){let s=this.uniforms[r],a=s.boundary,n=s.itemSize*e,o=t%Al,l=o%a,u=o+l;t+=l,u!==0&&Al-u\\u003cn&&(t+=Al-u),s.offset=t/e,s.index=r,t+=n}return Math.ceil(t/Al)*Al}update(){let e=!1;for(let t of this.uniforms)this.updateByType(t)===!0&&(e=!0);return e}release(){super.release(),this._values=null}updateByType(e){if(e.isNumberUniform)return this.updateNumber(e);if(e.isVector2Uniform)return this.updateVector2(e);if(e.isVector3Uniform)return this.updateVector3(e);if(e.isVector4Uniform)return this.updateVector4(e);if(e.isColorUniform)return this.updateColor(e);if(e.isMatrix3Uniform)return this.updateMatrix3(e);if(e.isMatrix4Uniform)return this.updateMatrix4(e);Ce(\\\"WebGPUUniformsGroup: Unsupported uniform type.\\\",e)}updateNumber(e){let t=!1,r=this.values,i=e.getValue(),s=e.offset,a=e.getType();if(r[s]!==i){let n=this._getBufferForType(a);n[s]=r[s]=i,t=!0,this.addUniformUpdateRange(e)}return t}updateVector2(e){let t=!1,r=this.values,i=e.getValue(),s=e.offset,a=e.getType();if(r[s+0]!==i.x||r[s+1]!==i.y){let n=this._getBufferForType(a);n[s+0]=r[s+0]=i.x,n[s+1]=r[s+1]=i.y,t=!0,this.addUniformUpdateRange(e)}return t}updateVector3(e){let t=!1,r=this.values,i=e.getValue(),s=e.offset,a=e.getType();if(r[s+0]!==i.x||r[s+1]!==i.y||r[s+2]!==i.z){let n=this._getBufferForType(a);n[s+0]=r[s+0]=i.x,n[s+1]=r[s+1]=i.y,n[s+2]=r[s+2]=i.z,t=!0,this.addUniformUpdateRange(e)}return t}updateVector4(e){let t=!1,r=this.values,i=e.getValue(),s=e.offset,a=e.getType();if(r[s+0]!==i.x||r[s+1]!==i.y||r[s+2]!==i.z||r[s+3]!==i.w){let n=this._getBufferForType(a);n[s+0]=r[s+0]=i.x,n[s+1]=r[s+1]=i.y,n[s+2]=r[s+2]=i.z,n[s+3]=r[s+3]=i.w,t=!0,this.addUniformUpdateRange(e)}return t}updateColor(e){let t=!1,r=this.values,i=e.getValue(),s=e.offset;if(r[s+0]!==i.r||r[s+1]!==i.g||r[s+2]!==i.b){let a=this.buffer;a[s+0]=r[s+0]=i.r,a[s+1]=r[s+1]=i.g,a[s+2]=r[s+2]=i.b,t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix3(e){let t=!1,r=this.values,i=e.getValue().elements,s=e.offset;if(r[s+0]!==i[0]||r[s+1]!==i[1]||r[s+2]!==i[2]||r[s+4]!==i[3]||r[s+5]!==i[4]||r[s+6]!==i[5]||r[s+8]!==i[6]||r[s+9]!==i[7]||r[s+10]!==i[8]){let a=this.buffer;a[s+0]=r[s+0]=i[0],a[s+1]=r[s+1]=i[1],a[s+2]=r[s+2]=i[2],a[s+4]=r[s+4]=i[3],a[s+5]=r[s+5]=i[4],a[s+6]=r[s+6]=i[5],a[s+8]=r[s+8]=i[6],a[s+9]=r[s+9]=i[7],a[s+10]=r[s+10]=i[8],t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix4(e){let t=!1,r=this.values,i=e.getValue().elements,s=e.offset;return GH(r,i,s)===!1&&(this.buffer.set(i,s),VH(r,i,s),t=!0,this.addUniformUpdateRange(e)),t}_getBufferForType(e){return e===\\\"int\\\"||e===\\\"ivec2\\\"||e===\\\"ivec3\\\"||e===\\\"ivec4\\\"?new Int32Array(this.buffer.buffer):e===\\\"uint\\\"||e===\\\"uvec2\\\"||e===\\\"uvec3\\\"||e===\\\"uvec4\\\"?new Uint32Array(this.buffer.buffer):this.buffer}};function VH(e,t,r){for(let i=0,s=t.length;i\\u003cs;i++)e[r+i]=t[i]}function GH(e,t,r){for(let i=0,s=t.length;i\\u003cs;i++)if(e[r+i]!==t[i])return!1;return!0}var WH=0,z3=class extends zH{constructor(e,t){super(e),this.id=WH++,this.groupNode=t,this.isNodeUniformsGroup=!0}},V3=class extends L3{constructor(e,t){super(e),this._texture=t,this.version=-1,this.generation=null,this.samplerKey=\\\"\\\",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture=e,this.reset())}get texture(){return this._texture}update(){let{texture:e,version:t}=this;return t!==e.version?(this.version=e.version,!0):!1}reset(){this.generation=null,this.version=-1}release(){this._texture=null}},jH=0,HH=class extends V3{constructor(e,t){super(e,t),this.id=jH++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},Ny=class extends HH{constructor(e,t,r,i=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=r,this.access=i}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},G3=class extends Ny{constructor(e,t,r,i=null){super(e,t,r,i),this.isSampledCubeTexture=!0}},QS=class extends Ny{constructor(e,t,r,i=null){super(e,t,r,i),this.isSampledTexture3D=!0}},W3={bitcast_int_uint:new pr(\\\"uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }\\\"),bitcast_uint_int:new pr(\\\"uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }\\\"),textureGather:new pr(`\\nvec4 tsl_textureGather( const int comp, sampler2D map, vec2 coord, ivec2 offset, bool flipY ) {\\n\\tif ( flipY ) offset.y = - offset.y;\\n\\tvec2 size = vec2( textureSize( map, 0 ) );\\n\\tvec2 st = floor( coord * size + vec2( offset ) - 0.5 );\\n\\tvec4 ij = vec4( st + 0.5, st + 1.5 ) / size.xyxy;\\n\\tvec4 ret = vec4(\\n\\t\\ttextureLod( map, ij.xw, 0.0 )[ comp ],\\n\\t\\ttextureLod( map, ij.zw, 0.0 )[ comp ],\\n\\t\\ttextureLod( map, ij.zy, 0.0 )[ comp ],\\n\\t\\ttextureLod( map, ij.xy, 0.0 )[ comp ]\\n\\t);\\n\\treturn flipY ? ret.wzyx : ret;\\n}\\n`),textureGatherArray:new pr(`\\nvec4 tsl_textureGather_array( const int comp, sampler2DArray map, vec3 coord, ivec2 offset, bool flipY ) {\\n\\tif ( flipY ) offset.y = - offset.y;\\n\\tvec2 size = vec2( textureSize( map, 0 ).xy );\\n\\tvec2 st = floor( coord.xy * size + vec2( offset ) - 0.5 );\\n\\tvec4 ij = vec4( st + 0.5, st + 1.5 ) / size.xyxy;\\n\\tvec4 ret = vec4(\\n\\t\\ttextureLod( map, vec3( ij.xw, coord.z ), 0.0 )[ comp ],\\n\\t\\ttextureLod( map, vec3( ij.zw, coord.z ), 0.0 )[ comp ],\\n\\t\\ttextureLod( map, vec3( ij.zy, coord.z ), 0.0 )[ comp ],\\n\\t\\ttextureLod( map, vec3( ij.xy, coord.z ), 0.0 )[ comp ]\\n\\t);\\n\\treturn flipY ? ret.wzyx : ret;\\n}\\n`),textureGatherCompare:new pr(`\\nvec4 tsl_textureGatherCompare( sampler2DShadow map, vec2 coord, ivec2 offset, float ref, bool flipY ) {\\n\\tif ( flipY ) offset.y = - offset.y;\\n\\tvec2 size = vec2( textureSize( map, 0 ) );\\n\\tvec2 st = floor( coord * size + vec2( offset ) - 0.5 );\\n\\tvec4 ij = vec4( st + 0.5, st + 1.5 ) / size.xyxy;\\n\\tvec4 ret = vec4(\\n\\t\\ttextureLod( map, vec3( ij.xw, ref ), 0.0 ),\\n\\t\\ttextureLod( map, vec3( ij.zw, ref ), 0.0 ),\\n\\t\\ttextureLod( map, vec3( ij.zy, ref ), 0.0 ),\\n\\t\\ttextureLod( map, vec3( ij.xy, ref ), 0.0 )\\n\\t);\\n\\treturn flipY ? ret.wzyx : ret;\\n}\\n`),textureGatherCompareArray:new pr(`\\nvec4 tsl_textureGatherCompare_array( sampler2DArrayShadow map, vec3 coord, ivec2 offset, float ref, bool flipY ) {\\n\\tif ( flipY ) offset.y = - offset.y;\\n\\tvec2 size = vec2( textureSize( map, 0 ).xy );\\n\\tvec2 st = floor( coord.xy * size + vec2( offset ) - 0.5 );\\n\\tvec4 ij = vec4( st + 0.5, st + 1.5 ) / size.xyxy;\\n\\tvec4 ret = vec4(\\n\\t\\ttexture( map, vec4( ij.xw, coord.z, ref ) ),\\n\\t\\ttexture( map, vec4( ij.zw, coord.z, ref ) ),\\n\\t\\ttexture( map, vec4( ij.zy, coord.z, ref ) ),\\n\\t\\ttexture( map, vec4( ij.xy, coord.z, ref ) )\\n\\t);\\n\\treturn flipY ? ret.wzyx : ret;\\n}\\n`)},XH={textureDimensions:\\\"textureSize\\\",equals:\\\"equal\\\",bitcast_float_int:\\\"floatBitsToInt\\\",bitcast_int_float:\\\"intBitsToFloat\\\",bitcast_uint_float:\\\"uintBitsToFloat\\\",bitcast_float_uint:\\\"floatBitsToUint\\\",bitcast_uint_int:\\\"tsl_bitcast_uint_to_int\\\",bitcast_int_uint:\\\"tsl_bitcast_int_to_uint\\\",floatpack_snorm_2x16:\\\"packSnorm2x16\\\",floatpack_unorm_2x16:\\\"packUnorm2x16\\\",floatpack_float16_2x16:\\\"packHalf2x16\\\",floatunpack_snorm_2x16:\\\"unpackSnorm2x16\\\",floatunpack_unorm_2x16:\\\"unpackUnorm2x16\\\",floatunpack_float16_2x16:\\\"unpackHalf2x16\\\"},j3={low:\\\"lowp\\\",medium:\\\"mediump\\\",high:\\\"highp\\\"},H3={swizzleAssign:!0,storageBuffer:!1},X3={perspective:\\\"smooth\\\",linear:\\\"noperspective\\\"},$3={centroid:\\\"centroid\\\"},q3=`\\nprecision highp float;\\nprecision highp int;\\nprecision highp sampler2D;\\nprecision highp sampler3D;\\nprecision highp samplerCube;\\nprecision highp sampler2DArray;\\n\\nprecision highp usampler2D;\\nprecision highp usampler3D;\\nprecision highp usamplerCube;\\nprecision highp usampler2DArray;\\n\\nprecision highp isampler2D;\\nprecision highp isampler3D;\\nprecision highp isamplerCube;\\nprecision highp isampler2DArray;\\n\\nprecision highp sampler2DShadow;\\nprecision highp sampler2DArrayShadow;\\nprecision highp samplerCubeShadow;\\n`,$H=class extends S3{constructor(e,t){super(e,t,new SH),this.uniformGroups={},this.transforms=[],this.extensions={},this.builtins={vertex:[],fragment:[],compute:[]}}needsToWorkingColorSpace(e){return e.isVideoTexture===!0&&e.colorSpace!==Fa}_include(e){let t=W3[e];return t.build(this),this.addInclude(t),t}getMethod(e){return W3[e]!==void 0&&this._include(e),XH[e]||e}getBitcastMethod(e,t){return this.getMethod(`bitcast_${t}_${e}`)}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,r){return`${e} ? ${t} : ${r}`}getOutputStructName(){return\\\"\\\"}buildFunctionCode(e){let t=e.layout,r=this.flowShaderNode(e),i=[];for(let s of t.inputs)i.push(this.getType(s.type)+\\\" \\\"+s.name);return`${this.getType(t.type)} ${t.name}( ${i.join(\\\", \\\")} ) {\\n\\n\\t${r.vars}\\n\\n${r.code}\\n\\treturn ${r.result};\\n\\n}`}setupPBO(e){let t=e.value;if(t.pbo===void 0){let r=t.array,i=t.count*t.itemSize,{itemSize:s}=t,a=t.array.constructor.name.toLowerCase().includes(\\\"int\\\"),n=a?jh:io;s===2?n=a?Hh:ha:s===3?n=a?lv:Wh:s===4&&(n=a?zf:pi);let o={Float32Array:Er,Uint8Array:Si,Uint16Array:Ko,Uint32Array:gr,Int8Array:cu,Int16Array:pu,Int32Array:ci,Uint8ClampedArray:Si},l=Math.pow(2,Math.ceil(Math.log2(Math.sqrt(i/s)))),u=Math.ceil(i/s/l);l*u*s\\u003ci&&u++;let h=l*u*s,d=new r.constructor(h);d.set(r,0),t.array=d;let c=new kg(t.array,l,u,n,o[t.array.constructor.name]||Er);c.needsUpdate=!0,c.isPBOTexture=!0;let m=new An(c,null,null);m.setPrecision(\\\"high\\\"),t.pboNode=m,t.pbo=m.value,this.getUniformFromNode(t.pboNode,\\\"texture\\\",this.shaderStage,this.context.nodeName)}}getPropertyName(e,t=this.shaderStage){return e.isNodeUniform&&e.node.isTextureNode!==!0&&e.node.isBufferNode!==!0?e.name:super.getPropertyName(e,t)}generatePBO(e){let{node:t,indexNode:r}=e,i=t.value;if(this.renderer.backend.has(i)){let u=this.renderer.backend.get(i);u.pbo=i.pbo}let s=this.getUniformFromNode(i.pboNode,\\\"texture\\\",this.shaderStage,this.context.nodeName),a=this.getPropertyName(s);this.increaseUsage(r);let n=r.build(this,\\\"uint\\\"),o=this.getDataFromNode(e),l=o.propertyName;if(l===void 0){let u=this.getVarFromNode(e);l=this.getPropertyName(u);let h=this.getDataFromNode(t),d=h.propertySizeName;d===void 0&&(d=l+\\\"Size\\\",this.getVarFromNode(t,d,\\\"uint\\\"),this.addLineFlowCode(`${d} = uint( textureSize( ${a}, 0 ).x )`,e),h.propertySizeName=d);let{itemSize:c}=i,m=\\\".\\\"+Su.join(\\\"\\\").slice(0,c),g=`ivec2(${n} % ${d}, ${n} / ${d})`,y=this.generateTextureLoad(null,a,g,\\\"0\\\",null,null),b=\\\"vec4\\\";i.pbo.type===gr?b=\\\"uvec4\\\":i.pbo.type===ci&&(b=\\\"ivec4\\\"),this.addLineFlowCode(`${l} = ${b}(${y})${m}`,e),o.propertyName=l}return l}generateTextureLoad(e,t,r,i,s,a){i===null&&(i=\\\"0\\\");let n;return s?a?n=`texelFetchOffset( ${t}, ivec3( ${r}, ${s} ), int( ${i} ), ${a} )`:n=`texelFetch( ${t}, ivec3( ${r}, ${s} ), int( ${i} ) )`:a?n=`texelFetchOffset( ${t}, ${r}, int( ${i} ), ${a} )`:n=`texelFetch( ${t}, ${r}, int( ${i} ) )`,e!==null&&e.isDepthTexture&&(n+=\\\".x\\\"),n}generateTexture(e,t,r,i,s){return i&&(r=`vec3( ${r}, ${i} )`),e.isDepthTexture?s?`textureOffset( ${t}, ${r}, ${s} ).x`:`texture( ${t}, ${r} ).x`:s?`textureOffset( ${t}, ${r}, ${s} )`:`texture( ${t}, ${r} )`}generateTextureLevel(e,t,r,i,s,a){return s&&(r=`vec3( ${r}, ${s} )`),a?`textureLodOffset( ${t}, ${r}, ${i}, ${a} )`:`textureLod( ${t}, ${r}, ${i} )`}generateTextureBias(e,t,r,i,s,a){return s&&(r=`vec3( ${r}, ${s} )`),a?`textureOffset( ${t}, ${r}, ${a}, ${i} )`:`texture( ${t}, ${r}, ${i} )`}generateTextureGrad(e,t,r,i,s,a){return s&&(r=`vec3( ${r}, ${s} )`),a?`textureGradOffset( ${t}, ${r}, ${i[0]}, ${i[1]}, ${a} )`:`textureGrad( ${t}, ${r}, ${i[0]}, ${i[1]} )`}generateTextureCompare(e,t,r,i,s,a,n=this.shaderStage){if(n===\\\"fragment\\\")return e.isCubeTexture?`texture( ${t}, vec4( ${r}, ${i} ) )`:s?a?`textureOffset( ${t}, vec4( ${r}, ${s}, ${i} ), ${a} )`:`texture( ${t}, vec4( ${r}, ${s}, ${i} ) )`:a?`textureOffset( ${t}, vec3( ${r}, ${i} ), ${a} )`:`texture( ${t}, vec3( ${r}, ${i} ) )`;Ce(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${n} shader.`)}generateTextureGather(e,t,r,i,s,a,n){return e.isDepthTexture&&(i=\\\"0\\\"),a===null&&(a=\\\"ivec2( 0 )\\\"),n===null&&(n=\\\"false\\\"),s?(this._include(\\\"textureGatherArray\\\"),`tsl_textureGather_array( ${i}, ${t}, vec3( ${r}, ${s} ), ${a}, ${n} )`):(this._include(\\\"textureGather\\\"),`tsl_textureGather( ${i}, ${t}, ${r}, ${a}, ${n} )`)}generateTextureGatherCompare(e,t,r,i,s,a,n){return a===null&&(a=\\\"ivec2( 0 )\\\"),n===null&&(n=\\\"false\\\"),s?(this._include(\\\"textureGatherCompareArray\\\"),`tsl_textureGatherCompare_array( ${t}, vec3( ${r}, ${s} ), ${a}, ${i}, ${n} )`):(this._include(\\\"textureGatherCompare\\\"),`tsl_textureGatherCompare( ${t}, ${r}, ${a}, ${i}, ${n} )`)}getUniforms(e){let t=this.uniforms[e],r=[],i={};for(let a of t){let n=null,o=!1;if(a.type===\\\"texture\\\"||a.type===\\\"texture3D\\\"){let l=a.node,u=l.value,h=\\\"\\\";(u.isDataTexture===!0||u.isData3DTexture===!0)&&(u.type===gr?h=\\\"u\\\":u.type===ci&&(h=\\\"i\\\")),a.type===\\\"texture3D\\\"&&u.isArrayTexture===!1?n=`${h}sampler3D ${a.name};`:u.compareFunction&&l.compareNode!==null?u.isArrayTexture===!0?n=`sampler2DArrayShadow ${a.name};`:n=`sampler2DShadow ${a.name};`:u.isArrayTexture===!0||u.isDataArrayTexture===!0||u.isCompressedArrayTexture===!0?n=`${h}sampler2DArray ${a.name};`:n=`${h}sampler2D ${a.name};`}else if(a.type===\\\"cubeTexture\\\")n=`samplerCube ${a.name};`;else if(a.type===\\\"cubeDepthTexture\\\")a.node.value.compareFunction?n=`samplerCubeShadow ${a.name};`:n=`samplerCube ${a.name};`;else if(a.type===\\\"buffer\\\"){let l=a.node,u=this.getType(l.bufferType),h=l.bufferCount,d=h>0?h:\\\"\\\";n=`${l.name} {\\n\\t${u} ${a.name}[${d}];\\n};\\n`}else{let l=a.groupNode.name;if(i[l]===void 0){let u=this.uniformGroups[l];if(u!==void 0){let h=[];for(let d of u.uniforms){let c=d.getType(),m=this.getVectorType(c),g=d.nodeUniform.node.precision,y=`${m} ${d.name};`;g!==null&&(y=j3[g]+\\\" \\\"+y),h.push(\\\"\\t\\\"+y)}i[l]=h}}o=!0}if(!o){let l=a.node.precision;l!==null&&(n=j3[l]+\\\" \\\"+n),n=\\\"uniform \\\"+n,r.push(n)}}let s=\\\"\\\";for(let a in i){let n=i[a];s+=this._getGLSLUniformStruct(a,n.join(`\\n`))+`\\n`}return s+=r.join(`\\n`),s}getTypeFromAttribute(e){let t=super.getTypeFromAttribute(e);if(/^[iu]/.test(t)&&e.gpuType!==ci){let r=e;e.isInterleavedBufferAttribute&&(r=e.data);let i=r.array;i instanceof Uint32Array||i instanceof Int32Array||(t=t.slice(1))}return t}getAttributes(e){let t=\\\"\\\";if(e===\\\"vertex\\\"||e===\\\"compute\\\"){let r=this.getAttributesArray(),i=0;for(let s of r)t+=`layout( location = ${i++} ) in ${s.type} ${s.name};\\n`}return t}getStructMembers(e){let t=[];for(let r of e.members)t.push(`\\t${r.type} ${r.name};`);return t.join(`\\n`)}getStructs(e){let t=[],r=this.structs[e],i=[];for(let s of r)if(s.output)for(let a of s.members)i.push(`layout( location = ${a.index} ) out ${a.type} ${a.name};`);else{let a=\\\"struct \\\"+s.name+` {\\n`;a+=this.getStructMembers(s),a+=`\\n};\\n`,t.push(a)}return e===\\\"fragment\\\"&&i.length===0&&i.push(`layout( location = 0 ) out ${this.getOutputType()} fragColor;`),`\\n`+i.join(`\\n`)+`\\n\\n`+t.join(`\\n`)}getVaryings(e){let t=\\\"\\\",r=this.varyings;if(e===\\\"vertex\\\"||e===\\\"compute\\\")for(let i of r){e===\\\"compute\\\"&&(i.needsInterpolation=!0);let s=this.getType(i.type);if(i.needsInterpolation)if(i.interpolationType){let a=X3[i.interpolationType]||i.interpolationType,n=$3[i.interpolationSampling]||\\\"\\\";t+=`${a} ${n} out ${s} ${i.name};\\n`}else{let a=s.includes(\\\"int\\\")||s.includes(\\\"uv\\\")||s.includes(\\\"iv\\\")?\\\"flat \\\":\\\"\\\";t+=`${a}out ${s} ${i.name};\\n`}else t+=`${s} ${i.name};\\n`}else if(e===\\\"fragment\\\"){for(let i of r)if(i.needsInterpolation){let s=this.getType(i.type);if(i.interpolationType){let a=X3[i.interpolationType]||i.interpolationType,n=$3[i.interpolationSampling]||\\\"\\\";t+=`${a} ${n} in ${s} ${i.name};\\n`}else{let a=s.includes(\\\"int\\\")||s.includes(\\\"uv\\\")||s.includes(\\\"iv\\\")?\\\"flat \\\":\\\"\\\";t+=`${a}in ${s} ${i.name};\\n`}}}for(let i of this.builtins[e])t+=`${i};\\n`;return t}getVertexIndex(){return\\\"uint( gl_VertexID )\\\"}getInstanceIndex(){return\\\"uint( gl_InstanceID )\\\"}getInvocationLocalIndex(){return`uint( gl_InstanceID ) % ${this.object.workgroupSize.reduce((e,t)=>e*t,1)}u`}getSubgroupSize(){Ce(\\\"GLSLNodeBuilder: WebGLBackend does not support the subgroupSize node\\\")}getInvocationSubgroupIndex(){Ce(\\\"GLSLNodeBuilder: WebGLBackend does not support the invocationSubgroupIndex node\\\")}getSubgroupIndex(){Ce(\\\"GLSLNodeBuilder: WebGLBackend does not support the subgroupIndex node\\\")}getDrawIndex(){return this.renderer.backend.extensions.has(\\\"WEBGL_multi_draw\\\")?\\\"uint( gl_DrawID )\\\":\\\"nodeUniformDrawId\\\"}getFrontFacing(){return\\\"gl_FrontFacing\\\"}getFragCoord(){return\\\"gl_FragCoord.xy\\\"}getFragDepth(){return\\\"gl_FragDepth\\\"}enableExtension(e,t,r=this.shaderStage){let i=this.extensions[r]||(this.extensions[r]=new Map);i.has(e)===!1&&i.set(e,{name:e,behavior:t})}getExtensions(e){let t=[];if(e===\\\"vertex\\\"){let i=this.renderer.backend.extensions;this.object.isBatchedMesh&&i.has(\\\"WEBGL_multi_draw\\\")&&this.enableExtension(\\\"GL_ANGLE_multi_draw\\\",\\\"require\\\",e)}let r=this.extensions[e];if(r!==void 0)for(let{name:i,behavior:s}of r.values())t.push(`#extension ${i} : ${s}`);return t.join(`\\n`)}getClipDistance(){return\\\"gl_ClipDistance\\\"}isAvailable(e){let t=H3[e];if(t===void 0){let r;switch(t=!1,e){case\\\"float32Filterable\\\":r=\\\"OES_texture_float_linear\\\";break;case\\\"clipDistance\\\":r=\\\"WEBGL_clip_cull_distance\\\";break}if(r!==void 0){let i=this.renderer.backend.extensions;i.has(r)&&(i.get(r),t=!0)}H3[e]=t}return t}isFlipY(){return!0}enableHardwareClipping(e){this.enableExtension(\\\"GL_ANGLE_clip_cull_distance\\\",\\\"require\\\"),this.builtins.vertex.push(`out float gl_ClipDistance[ ${e} ]`)}enableMultiview(){this.enableExtension(\\\"GL_OVR_multiview2\\\",\\\"require\\\",\\\"fragment\\\"),this.enableExtension(\\\"GL_OVR_multiview2\\\",\\\"require\\\",\\\"vertex\\\"),this.builtins.vertex.push(\\\"layout(num_views = 2) in\\\")}registerTransform(e,t){this.transforms.push({varyingName:e,attributeNode:t})}getTransforms(){let e=this.transforms,t=\\\"\\\";for(let r=0;r\\u003ce.length;r++){let i=e[r],s=this.getPropertyName(i.attributeNode);s&&(t+=`${i.varyingName} = ${s};\\n\\t`)}return t}_getGLSLUniformStruct(e,t){return`\\nlayout( std140 ) uniform ${e} {\\n${t}\\n};`}_getGLSLVertexCode(e){return`#version 300 es\\n\\n${this.getSignature()}\\n\\n// extensions\\n${e.extensions}\\n\\n// precision\\n${q3}\\n\\n// structs\\n${e.structs}\\n\\n// uniforms\\n${e.uniforms}\\n\\n// varyings\\n${e.varyings}\\n\\n// attributes\\n${e.attributes}\\n\\n// vars\\n${e.vars}\\n\\n// codes\\n${e.codes}\\n\\nvoid main() {\\n\\n\\t// transforms\\n\\t${e.transforms}\\n\\n\\t// flow\\n\\t${e.flow}\\n\\n\\tgl_PointSize = 1.0;\\n\\n}\\n`}_getGLSLFragmentCode(e){return`#version 300 es\\n\\n${this.getSignature()}\\n\\n// extensions\\n${e.extensions}\\n\\n// precision\\n${q3}\\n\\n// structs\\n${e.structs}\\n\\n// uniforms\\n${e.uniforms}\\n\\n// varyings\\n${e.varyings}\\n\\n// vars\\n${e.vars}\\n\\n// codes\\n${e.codes}\\n\\nvoid main() {\\n\\n\\t// flow\\n\\t${e.flow}\\n\\n}\\n`}buildCode(){let e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(let t in e){let r=`// code\\n\\n`;r+=this.flowCode[t];let i=this.flowNodes[t],s=i[i.length-1];for(let n of i){let o=this.getFlowData(n),l=n.name;l&&(r.length>0&&(r+=`\\n`),r+=`\\t// flow -> ${l}\\n\\t`),r+=`${o.code}\\n\\t`,n===s&&t!==\\\"compute\\\"&&(r+=`// result\\n\\t`,t===\\\"vertex\\\"?(r+=\\\"gl_Position = \\\",r+=`${this.format(o.result,s.getNodeType(this),\\\"vec4\\\")};`):t===\\\"fragment\\\"&&(n.outputNode.isOutputStructNode||(r+=\\\"fragColor = \\\",r+=`${this.format(o.result,s.getNodeType(this),this.getOutputType())};`)))}let a=e[t];if(a.extensions=this.getExtensions(t),a.uniforms=this.getUniforms(t),a.attributes=this.getAttributes(t),a.varyings=this.getVaryings(t),a.vars=this.getVars(t,!0),a.structs=this.getStructs(t),a.codes=this.getCodes(t),a.transforms=this.getTransforms(t),a.flow=r,t===\\\"vertex\\\"){let n=this.renderer.backend.extensions;this.object.isBatchedMesh&&n.has(\\\"WEBGL_multi_draw\\\")===!1&&(a.uniforms+=`\\nuniform uint nodeUniformDrawId;\\n`)}}this.material!==null?(this.vertexShader=this._getGLSLVertexCode(e.vertex),this.fragmentShader=this._getGLSLFragmentCode(e.fragment)):this.computeShader=this._getGLSLVertexCode(e.compute)}getUniformFromNode(e,t,r,i=null){let s=super.getUniformFromNode(e,t,r,i),a=this.getDataFromNode(e,r,this.globalCache),n=a.uniformGPU;if(n===void 0){let o=e.groupNode,l=o.name,u=this.getBindGroupArray(l,r);if(t===\\\"texture\\\")n=new Ny(s.name,s.node,o),u.push(n);else if(t===\\\"cubeTexture\\\"||t===\\\"cubeDepthTexture\\\")n=new G3(s.name,s.node,o),u.push(n);else if(t===\\\"texture3D\\\")n=new QS(s.name,s.node,o),u.push(n);else if(t===\\\"buffer\\\"){s.name=`buffer${e.id}`;let h=this.getSharedDataFromNode(e),d=h.buffer;d===void 0&&(e.name=`NodeBuffer_${e.id}`,d=new U3(e,o),d.name=e.name,h.buffer=d),u.push(d),n=d}else{let h=this.uniformGroups[l];h===void 0?(h=new z3(l,o),this.uniformGroups[l]=h,u.push(h)):u.indexOf(h)===-1&&u.push(h),n=this.getNodeUniform(s,t);let d=n.name;h.uniforms.some(c=>c.name===d)||h.addUniform(n)}a.uniformGPU=n}return s}},KS=null,Gd=null,Y3=class{constructor(e={}){this.parameters=Object.assign({},e),this.data=new WeakMap,this.renderer=null,this.domElement=null,this.timestampQueryPool={[un.RENDER]:null,[un.COMPUTE]:null},this.trackTimestamp=e.trackTimestamp===!0}async init(e){this.renderer=e}get coordinateSystem(){}beginRender(){}finishRender(){}setXRTarget(){}beginCompute(){}finishCompute(){}draw(){}compute(){}createProgram(){}destroyProgram(){}createBindings(){}updateBindings(){}updateBinding(){}createRenderPipeline(){}createComputePipeline(){}needsRenderUpdate(){}getRenderCacheKey(){}createNodeBuilder(){}updateSampler(){}destroySampler(){}createDefaultTexture(){}createTexture(){}updateTexture(){}generateMipmaps(){}destroyTexture(){}async copyTextureToBuffer(){}copyTextureToTexture(){}copyFramebufferToTexture(){}createAttribute(){}createIndexAttribute(){}createStorageAttribute(){}createUniformBuffer(){}destroyUniformBuffer(){}updateAttribute(){}destroyAttribute(){}getContext(){}updateSize(){}updateViewport(){}updateTimeStampUID(e){let t=this.get(e),r=this.renderer.info.frame,i;e.isComputeNode===!0?i=\\\"c:\\\"+this.renderer.info.compute.frameCalls:i=\\\"r:\\\"+this.renderer.info.render.frameCalls,t.timestampUID=i+\\\":\\\"+e.id+\\\":f\\\"+r}getTimestampUID(e){return this.get(e).timestampUID}getTimestampFrames(e){let t=this.timestampQueryPool[e];return t?t.getTimestampFrames():[]}_getQueryPool(e){let t=e.startsWith(\\\"c:\\\")?un.COMPUTE:un.RENDER;return this.timestampQueryPool[t]}getTimestamp(e){return this._getQueryPool(e).getTimestamp(e)}get hasTimestamp(){return!1}hasTimestampQuery(e){return this._getQueryPool(e).hasTimestampQuery(e)}isOccluded(){}async resolveTimestampsAsync(e=\\\"render\\\"){if(!this.trackTimestamp){Et(\\\"WebGPURenderer: Timestamp tracking is disabled.\\\");return}let t=this.timestampQueryPool[e];if(!t)return;let r=await t.resolveQueriesAsync();return this.renderer.info[e].timestamp=r,r}async getArrayBufferAsync(){}async hasFeatureAsync(){}hasFeature(){}getDrawingBufferSize(){return KS=KS||new fe,this.renderer.getDrawingBufferSize(KS)}setScissorTest(){}getClearColor(){let e=this.renderer;return Gd=Gd||new gS,e.getClearColor(Gd),Gd.getRGB(Gd),Gd}getDomElement(){let e=this.domElement;return e===null&&(e=this.parameters.canvas!==void 0?this.parameters.canvas:KD(),\\\"setAttribute\\\"in e&&e.setAttribute(\\\"data-engine\\\",\\\"three.js r185 webgpu\\\"),this.domElement=e),e}hasCompatibility(){return!1}initRenderTarget(){}set(e,t){this.data.set(e,t)}get(e){let t=this.data.get(e);return t===void 0&&(t={},this.data.set(e,t)),t}has(e){return this.data.has(e)}delete(e){this.data.delete(e)}deleteBindGroupData(){}dispose(){}},qH=0,YH=class{constructor(e,t){this.buffers=[e.bufferGPU,t],this.type=e.type,this.bufferType=e.bufferType,this.pbo=e.pbo,this.byteLength=e.byteLength,this.bytesPerElement=e.BYTES_PER_ELEMENT,this.version=e.version,this.isInteger=e.isInteger,this.activeBufferIndex=0,this.baseId=e.id}get id(){return`${this.baseId}|${this.activeBufferIndex}`}get bufferGPU(){return this.buffers[this.activeBufferIndex]}get transformBuffer(){return this.buffers[this.activeBufferIndex^1]}switchBuffers(){this.activeBufferIndex^=1}},ZH=class{constructor(e){this.backend=e}createAttribute(e,t){let r=this.backend,{gl:i}=r,s=e.array,a=e.usage||i.STATIC_DRAW,n=e.isInterleavedBufferAttribute?e.data:e,o=r.get(n),l=o.bufferGPU;l===void 0&&(l=this._createBuffer(i,t,s,a),o.bufferGPU=l,o.bufferType=t,o.version=n.version);let u;if(s instanceof Float32Array)u=i.FLOAT;else if(typeof Float16Array\\u003c\\\"u\\\"&&s instanceof Float16Array)u=i.HALF_FLOAT;else if(s instanceof Uint16Array)e.isFloat16BufferAttribute?u=i.HALF_FLOAT:u=i.UNSIGNED_SHORT;else if(s instanceof Int16Array)u=i.SHORT;else if(s instanceof Uint32Array)u=i.UNSIGNED_INT;else if(s instanceof Int32Array)u=i.INT;else if(s instanceof Int8Array)u=i.BYTE;else if(s instanceof Uint8Array)u=i.UNSIGNED_BYTE;else if(s instanceof Uint8ClampedArray)u=i.UNSIGNED_BYTE;else throw new Error(\\\"THREE.WebGLBackend: Unsupported buffer data format: \\\"+s);let h={bufferGPU:l,bufferType:t,type:u,byteLength:s.byteLength,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version,pbo:e.pbo,isInteger:u===i.INT||u===i.UNSIGNED_INT||e.gpuType===ci,id:qH++};if(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute){let d=this._createBuffer(i,t,s,a);h=new YH(h,d)}r.set(e,h)}updateAttribute(e){let t=this.backend,{gl:r}=t,i=e.array,s=e.isInterleavedBufferAttribute?e.data:e,a=t.get(s),n=a.bufferType,o=e.isInterleavedBufferAttribute?e.data.updateRanges:e.updateRanges;if(r.bindBuffer(n,a.bufferGPU),o.length===0)r.bufferSubData(n,0,i);else{for(let l=0,u=o.length;l\\u003cu;l++){let h=o[l];r.bufferSubData(n,h.start*i.BYTES_PER_ELEMENT,i,h.start,h.count)}s.clearUpdateRanges()}r.bindBuffer(n,null),a.version=s.version}destroyAttribute(e){let t=this.backend,{gl:r}=t;e.isInterleavedBufferAttribute&&t.delete(e.data);let i=t.get(e);r.deleteBuffer(i.bufferGPU),t.delete(e)}async getArrayBufferAsync(e,t=null,r=0,i=-1){let s=this.backend,{gl:a}=s,n=e.isInterleavedBufferAttribute?e.data:e,o=s.get(n),{bufferGPU:l}=o,u=i===-1?o.byteLength-r:i,h;if(t===null)h=new Uint8Array(new ArrayBuffer(u));else if(t.isReadbackBuffer){if(t._mapped===!0)throw new Error(\\\"THREE.WebGPURenderer: ReadbackBuffer must be released before being used again.\\\");let d=()=>{t.buffer=null,t._mapped=!1,t.removeEventListener(\\\"release\\\",d),t.removeEventListener(\\\"dispose\\\",d)};t.addEventListener(\\\"release\\\",d),t.addEventListener(\\\"dispose\\\",d),h=new Uint8Array(new ArrayBuffer(u)),t.buffer=h.buffer}else h=new Uint8Array(t);return a.bindBuffer(a.COPY_READ_BUFFER,l),a.getBufferSubData(a.COPY_READ_BUFFER,r,h),a.bindBuffer(a.COPY_READ_BUFFER,null),a.bindBuffer(a.COPY_WRITE_BUFFER,null),t&&t.isReadbackBuffer?t:h.buffer}_createBuffer(e,t,r,i){let s=e.createBuffer();return e.bindBuffer(t,s),e.bufferData(t,r,i),e.bindBuffer(t,null),s}},rm,Ao,JH=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.enabled={},this.parameters={},this.currentFlipSided=null,this.currentCullFace=null,this.currentProgram=null,this.currentBlendingEnabled=!1,this.currentBlending=null,this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentPremultipledAlpha=null,this.currentPolygonOffsetFactor=null,this.currentPolygonOffsetUnits=null,this.currentColorMask=null,this.currentDepthReversed=!1,this.currentDepthFunc=null,this.currentDepthMask=null,this.currentStencilFunc=null,this.currentStencilRef=null,this.currentStencilFuncMask=null,this.currentStencilFail=null,this.currentStencilZFail=null,this.currentStencilZPass=null,this.currentStencilMask=null,this.currentLineWidth=null,this.currentClippingPlanes=0,this.currentVAO=null,this.currentIndex=null,this.currentBoundFramebuffers={},this.currentDrawbuffers=new WeakMap,this.maxTextures=this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS),this.currentTextureSlot=null,this.currentBoundTextures={},this.currentBoundBufferBases={},this._init()}_init(){let e=this.gl;rm={[la]:e.FUNC_ADD,[vM]:e.FUNC_SUBTRACT,[bM]:e.FUNC_REVERSE_SUBTRACT},Ao={[Jo]:e.ZERO,[TM]:e.ONE,[SM]:e.SRC_COLOR,[$c]:e.SRC_ALPHA,[CM]:e.SRC_ALPHA_SATURATE,[NM]:e.DST_COLOR,[wM]:e.DST_ALPHA,[_M]:e.ONE_MINUS_SRC_COLOR,[qc]:e.ONE_MINUS_SRC_ALPHA,[AM]:e.ONE_MINUS_DST_COLOR,[MM]:e.ONE_MINUS_DST_ALPHA};let t=e.getParameter(e.SCISSOR_BOX),r=e.getParameter(e.VIEWPORT);this.currentScissor=new Wt().fromArray(t),this.currentViewport=new Wt().fromArray(r),this._tempVec4=new Wt}enable(e){let{enabled:t}=this;t[e]!==!0&&(this.gl.enable(e),t[e]=!0)}disable(e){let{enabled:t}=this;t[e]!==!1&&(this.gl.disable(e),t[e]=!1)}setFlipSided(e){if(this.currentFlipSided!==e){let{gl:t}=this;e?t.frontFace(t.CW):t.frontFace(t.CCW),this.currentFlipSided=e}}setCullFace(e){let{gl:t}=this;e!==bD?(this.enable(t.CULL_FACE),e!==this.currentCullFace&&(e===TD?t.cullFace(t.BACK):e===SD?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):this.disable(t.CULL_FACE),this.currentCullFace=e}setLineWidth(e){let{currentLineWidth:t,gl:r}=this;e!==t&&(r.lineWidth(e),this.currentLineWidth=e)}setMRTBlending(e,t,r){let i=this.gl,s=this.backend.drawBuffersIndexedExt;if(!s){Et(\\\"WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets.\\\");return}for(let a=0;a\\u003ce.length;a++){let n=e[a],o=null;if(t!==null){let l=t.getBlendMode(n.name);l.blending===tv?o=r:l.blending!==Kn&&(o=l)}else o=r;o!==null?this._setMRTBlendingIndex(a,o):s.blendFuncSeparateiOES(a,i.ONE,i.ZERO,i.ONE,i.ZERO)}}_setMRTBlendingIndex(e,t){let{gl:r}=this,i=this.backend.drawBuffersIndexedExt,s=t.blending,a=t.blendSrc,n=t.blendDst,o=t.blendEquation,l=t.premultipliedAlpha;if(s===Uh){let u=t.blendSrcAlpha!==null?t.blendSrcAlpha:a,h=t.blendDstAlpha!==null?t.blendDstAlpha:n,d=t.blendEquationAlpha!==null?t.blendEquationAlpha:o;i.blendEquationSeparateiOES(e,rm[o],rm[d]),i.blendFuncSeparateiOES(e,Ao[a],Ao[n],Ao[u],Ao[h])}else if(i.blendEquationSeparateiOES(e,r.FUNC_ADD,r.FUNC_ADD),l)switch(s){case oa:i.blendFuncSeparateiOES(e,r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case kh:i.blendFuncSeparateiOES(e,r.ONE,r.ONE,r.ONE,r.ONE);break;case Dh:i.blendFuncSeparateiOES(e,r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Oh:i.blendFuncSeparateiOES(e,r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:i.blendFuncSeparateiOES(e,r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break}else switch(s){case oa:i.blendFuncSeparateiOES(e,r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case kh:i.blendFuncSeparateiOES(e,r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case Dh:i.blendFuncSeparateiOES(e,r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Oh:i.blendFuncSeparateiOES(e,r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:i.blendFuncSeparateiOES(e,r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break}}setBlending(e,t,r,i,s,a,n,o){let{gl:l}=this;if(e===Kn){this.currentBlendingEnabled===!0&&(this.disable(l.BLEND),this.currentBlendingEnabled=!1);return}if(this.currentBlendingEnabled===!1&&(this.enable(l.BLEND),this.currentBlendingEnabled=!0),e!==Uh){if(e!==this.currentBlending||o!==this.currentPremultipledAlpha){if((this.currentBlendEquation!==la||this.currentBlendEquationAlpha!==la)&&(l.blendEquation(l.FUNC_ADD),this.currentBlendEquation=la,this.currentBlendEquationAlpha=la),o)switch(e){case oa:l.blendFuncSeparate(l.ONE,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA);break;case kh:l.blendFunc(l.ONE,l.ONE);break;case Dh:l.blendFuncSeparate(l.ZERO,l.ONE_MINUS_SRC_COLOR,l.ZERO,l.ONE);break;case Oh:l.blendFuncSeparate(l.DST_COLOR,l.ONE_MINUS_SRC_ALPHA,l.ZERO,l.ONE);break;default:Ce(\\\"WebGLState: Invalid blending: \\\",e);break}else switch(e){case oa:l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA);break;case kh:l.blendFuncSeparate(l.SRC_ALPHA,l.ONE,l.ONE,l.ONE);break;case Dh:Ce(\\\"WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true\\\");break;case Oh:Ce(\\\"WebGLState: MultiplyBlending requires material.premultipliedAlpha = true\\\");break;default:Ce(\\\"WebGLState: Invalid blending: \\\",e);break}this.currentBlendSrc=null,this.currentBlendDst=null,this.currentBlendSrcAlpha=null,this.currentBlendDstAlpha=null,this.currentBlending=e,this.currentPremultipledAlpha=o}return}s=s||t,a=a||r,n=n||i,(t!==this.currentBlendEquation||s!==this.currentBlendEquationAlpha)&&(l.blendEquationSeparate(rm[t],rm[s]),this.currentBlendEquation=t,this.currentBlendEquationAlpha=s),(r!==this.currentBlendSrc||i!==this.currentBlendDst||a!==this.currentBlendSrcAlpha||n!==this.currentBlendDstAlpha)&&(l.blendFuncSeparate(Ao[r],Ao[i],Ao[a],Ao[n]),this.currentBlendSrc=r,this.currentBlendDst=i,this.currentBlendSrcAlpha=a,this.currentBlendDstAlpha=n),this.currentBlending=e,this.currentPremultipledAlpha=!1}setColorMask(e){this.currentColorMask!==e&&(this.gl.colorMask(e,e,e,e),this.currentColorMask=e)}setDepthTest(e){let{gl:t}=this;e?this.enable(t.DEPTH_TEST):this.disable(t.DEPTH_TEST)}setReversedDepth(e){if(this.currentDepthReversed!==e){let t=this.backend.extensions.get(\\\"EXT_clip_control\\\");e?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT),this.currentDepthReversed=e}}setDepthMask(e){this.currentDepthMask!==e&&(this.gl.depthMask(e),this.currentDepthMask=e)}setDepthFunc(e){if(this.currentDepthReversed&&(e=GM[e]),this.currentDepthFunc!==e){let{gl:t}=this;switch(e){case Af:t.depthFunc(t.NEVER);break;case Cf:t.depthFunc(t.ALWAYS);break;case Rf:t.depthFunc(t.LESS);break;case zh:t.depthFunc(t.LEQUAL);break;case Ef:t.depthFunc(t.EQUAL);break;case Pf:t.depthFunc(t.GEQUAL);break;case Bf:t.depthFunc(t.GREATER);break;case If:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}this.currentDepthFunc=e}}scissor(e,t,r,i){let s=this._tempVec4.set(e,t,r,i);if(this.currentScissor.equals(s)===!1){let{gl:a}=this;a.scissor(s.x,s.y,s.z,s.w),this.currentScissor.copy(s)}}viewport(e,t,r,i){let s=this._tempVec4.set(e,t,r,i);if(this.currentViewport.equals(s)===!1){let{gl:a}=this;a.viewport(s.x,s.y,s.z,s.w),this.currentViewport.copy(s)}}setScissorTest(e){let t=this.gl;e?this.enable(t.SCISSOR_TEST):this.disable(t.SCISSOR_TEST)}setStencilTest(e){let{gl:t}=this;e?this.enable(t.STENCIL_TEST):this.disable(t.STENCIL_TEST)}setStencilMask(e){this.currentStencilMask!==e&&(this.gl.stencilMask(e),this.currentStencilMask=e)}setStencilFunc(e,t,r){(this.currentStencilFunc!==e||this.currentStencilRef!==t||this.currentStencilFuncMask!==r)&&(this.gl.stencilFunc(e,t,r),this.currentStencilFunc=e,this.currentStencilRef=t,this.currentStencilFuncMask=r)}setStencilOp(e,t,r){(this.currentStencilFail!==e||this.currentStencilZFail!==t||this.currentStencilZPass!==r)&&(this.gl.stencilOp(e,t,r),this.currentStencilFail=e,this.currentStencilZFail=t,this.currentStencilZPass=r)}setMaterial(e,t,r){let{gl:i}=this;e.side===hs?this.disable(i.CULL_FACE):this.enable(i.CULL_FACE);let s=e.side===ii;t&&(s=!s),this.setFlipSided(s),e.blending===oa&&e.transparent===!1?this.setBlending(Kn):this.setBlending(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),this.setDepthFunc(e.depthFunc),this.setDepthTest(e.depthTest),this.setDepthMask(e.depthWrite),this.setColorMask(e.colorWrite);let a=e.stencilWrite;if(this.setStencilTest(a),a&&(this.setStencilMask(e.stencilWriteMask),this.setStencilFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),this.setStencilOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),this.setPolygonOffset(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),e.alphaToCoverage===!0&&this.backend.renderer.currentSamples>0?this.enable(i.SAMPLE_ALPHA_TO_COVERAGE):this.disable(i.SAMPLE_ALPHA_TO_COVERAGE),r>0&&this.currentClippingPlanes!==r)for(let n=0;n\\u003c8;n++)n\\u003cr?this.enable(12288+n):this.disable(12288+n)}setPolygonOffset(e,t,r){let{gl:i}=this;e?(this.enable(i.POLYGON_OFFSET_FILL),(this.currentPolygonOffsetFactor!==t||this.currentPolygonOffsetUnits!==r)&&(i.polygonOffset(t,r),this.currentPolygonOffsetFactor=t,this.currentPolygonOffsetUnits=r)):this.disable(i.POLYGON_OFFSET_FILL)}useProgram(e){return this.currentProgram!==e?(this.gl.useProgram(e),this.currentProgram=e,!0):!1}setVertexState(e,t=null){let r=this.gl;return this.currentVAO!==e||this.currentIndex!==t?(r.bindVertexArray(e),t!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t),this.currentVAO=e,this.currentIndex=t,!0):!1}resetVertexState(){let e=this.gl;e.bindVertexArray(null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),this.currentVAO=null,this.currentIndex=null}bindFramebuffer(e,t){let{gl:r,currentBoundFramebuffers:i}=this;return i[e]!==t?(r.bindFramebuffer(e,t),i[e]=t,e===r.DRAW_FRAMEBUFFER&&(i[r.FRAMEBUFFER]=t),e===r.FRAMEBUFFER&&(i[r.DRAW_FRAMEBUFFER]=t),!0):!1}drawBuffers(e,t){let{gl:r}=this,i=[],s=!1;if(e.textures!==null){i=this.currentDrawbuffers.get(t),i===void 0&&(i=[],this.currentDrawbuffers.set(t,i));let a=e.textures;if(i.length!==a.length||i[0]!==r.COLOR_ATTACHMENT0){for(let n=0,o=a.length;n\\u003co;n++)i[n]=r.COLOR_ATTACHMENT0+n;i.length=a.length,s=!0}}else i[0]!==r.BACK&&(i[0]=r.BACK,s=!0);s&&r.drawBuffers(i)}activeTexture(e){let{gl:t,currentTextureSlot:r,maxTextures:i}=this;e===void 0&&(e=t.TEXTURE0+i-1),r!==e&&(t.activeTexture(e),this.currentTextureSlot=e)}bindTexture(e,t,r){let{gl:i,currentTextureSlot:s,currentBoundTextures:a,maxTextures:n}=this;r===void 0&&(s===null?r=i.TEXTURE0+n-1:r=s);let o=a[r];o===void 0&&(o={type:void 0,texture:void 0},a[r]=o),(o.type!==e||o.texture!==t)&&(s!==r&&(i.activeTexture(r),this.currentTextureSlot=r),i.bindTexture(e,t),o.type=e,o.texture=t)}bindBufferBase(e,t,r){let{gl:i}=this,s=`${e}-${t}`;return this.currentBoundBufferBases[s]!==r?(i.bindBufferBase(e,t,r),this.currentBoundBufferBases[s]=r,!0):!1}unbindTexture(){let{gl:e,currentTextureSlot:t,currentBoundTextures:r}=this,i=r[t];i!==void 0&&i.type!==void 0&&(e.bindTexture(i.type,null),i.type=void 0,i.texture=void 0)}getParameter(e){let{gl:t,parameters:r}=this;return r[e]!==void 0?r[e]:t.getParameter(e)}pixelStorei(e,t){let{gl:r,parameters:i}=this;i[e]!==t&&(r.pixelStorei(e,t),i[e]=t)}},QH=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.extensions=e.extensions}convert(e,t=Fa){let{gl:r,extensions:i}=this,s,a=Gt.getTransfer(t);if(e===Si)return r.UNSIGNED_BYTE;if(e===av)return r.UNSIGNED_SHORT_4_4_4_4;if(e===nv)return r.UNSIGNED_SHORT_5_5_5_1;if(e===Of)return r.UNSIGNED_INT_5_9_9_9_REV;if(e===Uf)return r.UNSIGNED_INT_10F_11F_11F_REV;if(e===cu)return r.BYTE;if(e===pu)return r.SHORT;if(e===Ko)return r.UNSIGNED_SHORT;if(e===ci)return r.INT;if(e===gr)return r.UNSIGNED_INT;if(e===Er)return r.FLOAT;if(e===Dt)return r.HALF_FLOAT;if(e===ov)return r.ALPHA;if(e===Wh)return r.RGB;if(e===pi)return r.RGBA;if(e===ua)return r.DEPTH_COMPONENT;if(e===ln)return r.DEPTH_STENCIL;if(e===io)return r.RED;if(e===jh)return r.RED_INTEGER;if(e===ha)return r.RG;if(e===Hh)return r.RG_INTEGER;if(e===zf)return r.RGBA_INTEGER;if(e===Yc||e===Zc||e===Jc||e===Qc)if(a===Tt)if(s=i.get(\\\"WEBGL_compressed_texture_s3tc_srgb\\\"),s!==null){if(e===Yc)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(e===Zc)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(e===Jc)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(e===Qc)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=i.get(\\\"WEBGL_compressed_texture_s3tc\\\"),s!==null){if(e===Yc)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===Zc)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===Jc)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===Qc)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(e===uv||e===hv||e===dv||e===cv)if(s=i.get(\\\"WEBGL_compressed_texture_pvrtc\\\"),s!==null){if(e===uv)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===hv)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===dv)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===cv)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(e===Vf||e===Gf||e===Wf||e===jf||e===Hf||e===Kc||e===Xf)if(s=i.get(\\\"WEBGL_compressed_texture_etc\\\"),s!==null){if(e===Vf||e===Gf)return a===Tt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(e===Wf)return a===Tt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(e===jf)return s.COMPRESSED_R11_EAC;if(e===Hf)return s.COMPRESSED_SIGNED_R11_EAC;if(e===Kc)return s.COMPRESSED_RG11_EAC;if(e===Xf)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(e===$f||e===qf||e===Yf||e===Zf||e===Jf||e===Qf||e===Kf||e===eg||e===tg||e===rg||e===ig||e===sg||e===ag||e===ng)if(s=i.get(\\\"WEBGL_compressed_texture_astc\\\"),s!==null){if(e===$f)return a===Tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(e===qf)return a===Tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(e===Yf)return a===Tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(e===Zf)return a===Tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(e===Jf)return a===Tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(e===Qf)return a===Tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(e===Kf)return a===Tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(e===eg)return a===Tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(e===tg)return a===Tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(e===rg)return a===Tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(e===ig)return a===Tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(e===sg)return a===Tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(e===ag)return a===Tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(e===ng)return a===Tt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(e===og||e===lg||e===ug)if(s=i.get(\\\"EXT_texture_compression_bptc\\\"),s!==null){if(e===og)return a===Tt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(e===lg)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(e===ug)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(e===hg||e===dg||e===ep||e===cg)if(s=i.get(\\\"EXT_texture_compression_rgtc\\\"),s!==null){if(e===hg)return s.COMPRESSED_RED_RGTC1_EXT;if(e===dg)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(e===ep)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(e===cg)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return e===ro?r.UNSIGNED_INT_24_8:r[e]!==void 0?r[e]:null}_clientWaitAsync(){let{gl:e}=this,t=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);return e.flush(),new Promise((r,i)=>{function s(){let a=e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0);if(a===e.WAIT_FAILED){e.deleteSync(t),i();return}if(a===e.TIMEOUT_EXPIRED){requestAnimationFrame(s);return}e.deleteSync(t),r()}s()})}},Z3=!1,Ay,e_,J3,KH=class{constructor(e){this.backend=e,this.gl=e.gl,this.extensions=e.extensions,this.defaultTextures={},this._srcFramebuffer=null,this._dstFramebuffer=null,Z3===!1&&(this._init(),Z3=!0)}_init(){let e=this.gl;Ay={[to]:e.REPEAT,[Ti]:e.CLAMP_TO_EDGE,[Qo]:e.MIRRORED_REPEAT},e_={[or]:e.NEAREST,[RM]:e.NEAREST_MIPMAP_NEAREST,[Gh]:e.NEAREST_MIPMAP_LINEAR,[lr]:e.LINEAR,[sv]:e.LINEAR_MIPMAP_NEAREST,[Ia]:e.LINEAR_MIPMAP_LINEAR},J3={[LM]:e.NEVER,[OM]:e.ALWAYS,[yv]:e.LESS,[tp]:e.LEQUAL,[kM]:e.EQUAL,[$h]:e.GEQUAL,[fg]:e.GREATER,[DM]:e.NOTEQUAL}}getGLTextureType(e){let{gl:t}=this,r;return e.isCubeTexture===!0?r=t.TEXTURE_CUBE_MAP:e.isArrayTexture===!0||e.isDataArrayTexture===!0||e.isCompressedArrayTexture===!0?r=t.TEXTURE_2D_ARRAY:e.isData3DTexture===!0?r=t.TEXTURE_3D:r=t.TEXTURE_2D,r}getInternalFormat(e,t,r,i,s,a=!1){let{gl:n,extensions:o}=this;if(e!==null){if(n[e]!==void 0)return n[e];Ue(\\\"WebGLBackend: Attempt to use non-existing WebGL internal format '\\\"+e+\\\"'\\\")}let l=null;i&&(l=o.get(\\\"EXT_texture_norm16\\\"),l||Ue(\\\"WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension\\\"));let u=t;if(t===n.RED&&(r===n.FLOAT&&(u=n.R32F),r===n.HALF_FLOAT&&(u=n.R16F),r===n.UNSIGNED_BYTE&&(u=n.R8),r===n.BYTE&&(u=n.R8_SNORM),r===n.UNSIGNED_SHORT&&l&&(u=l.R16_EXT),r===n.SHORT&&l&&(u=l.R16_SNORM_EXT)),t===n.RED_INTEGER&&(r===n.UNSIGNED_BYTE&&(u=n.R8UI),r===n.UNSIGNED_SHORT&&(u=n.R16UI),r===n.UNSIGNED_INT&&(u=n.R32UI),r===n.BYTE&&(u=n.R8I),r===n.SHORT&&(u=n.R16I),r===n.INT&&(u=n.R32I)),t===n.RG&&(r===n.FLOAT&&(u=n.RG32F),r===n.HALF_FLOAT&&(u=n.RG16F),r===n.UNSIGNED_BYTE&&(u=n.RG8),r===n.BYTE&&(u=n.RG8_SNORM),r===n.UNSIGNED_SHORT&&l&&(u=l.RG16_EXT),r===n.SHORT&&l&&(u=l.RG16_SNORM_EXT)),t===n.RG_INTEGER&&(r===n.UNSIGNED_BYTE&&(u=n.RG8UI),r===n.UNSIGNED_SHORT&&(u=n.RG16UI),r===n.UNSIGNED_INT&&(u=n.RG32UI),r===n.BYTE&&(u=n.RG8I),r===n.SHORT&&(u=n.RG16I),r===n.INT&&(u=n.RG32I)),t===n.RGB){let h=a?mg:Gt.getTransfer(s);r===n.FLOAT&&(u=n.RGB32F),r===n.HALF_FLOAT&&(u=n.RGB16F),r===n.UNSIGNED_BYTE&&(u=h===Tt?n.SRGB8:n.RGB8),r===n.BYTE&&(u=n.RGB8_SNORM),r===n.UNSIGNED_SHORT&&l&&(u=l.RGB16_EXT),r===n.SHORT&&l&&(u=l.RGB16_SNORM_EXT),r===n.UNSIGNED_SHORT_5_6_5&&(u=n.RGB565),r===n.UNSIGNED_SHORT_5_5_5_1&&(u=n.RGB5_A1),r===n.UNSIGNED_SHORT_4_4_4_4&&(u=n.RGB4),r===n.UNSIGNED_INT_5_9_9_9_REV&&(u=n.RGB9_E5),r===n.UNSIGNED_INT_10F_11F_11F_REV&&(u=n.R11F_G11F_B10F)}if(t===n.RGB_INTEGER&&(r===n.UNSIGNED_BYTE&&(u=n.RGB8UI),r===n.UNSIGNED_SHORT&&(u=n.RGB16UI),r===n.UNSIGNED_INT&&(u=n.RGB32UI),r===n.BYTE&&(u=n.RGB8I),r===n.SHORT&&(u=n.RGB16I),r===n.INT&&(u=n.RGB32I)),t===n.RGBA){let h=a?mg:Gt.getTransfer(s);r===n.FLOAT&&(u=n.RGBA32F),r===n.HALF_FLOAT&&(u=n.RGBA16F),r===n.UNSIGNED_BYTE&&(u=h===Tt?n.SRGB8_ALPHA8:n.RGBA8),r===n.BYTE&&(u=n.RGBA8_SNORM),r===n.UNSIGNED_SHORT&&l&&(u=l.RGBA16_EXT),r===n.SHORT&&l&&(u=l.RGBA16_SNORM_EXT),r===n.UNSIGNED_SHORT_4_4_4_4&&(u=n.RGBA4),r===n.UNSIGNED_SHORT_5_5_5_1&&(u=n.RGB5_A1)}return t===n.RGBA_INTEGER&&(r===n.UNSIGNED_BYTE&&(u=n.RGBA8UI),r===n.UNSIGNED_SHORT&&(u=n.RGBA16UI),r===n.UNSIGNED_INT&&(u=n.RGBA32UI),r===n.BYTE&&(u=n.RGBA8I),r===n.SHORT&&(u=n.RGBA16I),r===n.INT&&(u=n.RGBA32I)),t===n.DEPTH_COMPONENT&&(r===n.UNSIGNED_SHORT&&(u=n.DEPTH_COMPONENT16),r===n.UNSIGNED_INT&&(u=n.DEPTH_COMPONENT24),r===n.FLOAT&&(u=n.DEPTH_COMPONENT32F)),t===n.DEPTH_STENCIL&&r===n.UNSIGNED_INT_24_8&&(u=n.DEPTH24_STENCIL8),(u===n.R16F||u===n.R32F||u===n.RG16F||u===n.RG32F||u===n.RGBA16F||u===n.RGBA32F)&&o.get(\\\"EXT_color_buffer_float\\\"),u}setTextureParameters(e,t){let{gl:r,extensions:i,backend:s}=this,{state:a}=this.backend,n=Gt.getPrimaries(Gt.workingColorSpace),o=t.colorSpace===Fa?null:Gt.getPrimaries(t.colorSpace),l=t.colorSpace===Fa||n===o?r.NONE:r.BROWSER_DEFAULT_WEBGL;a.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,t.flipY),a.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),a.pixelStorei(r.UNPACK_ALIGNMENT,t.unpackAlignment),a.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,l),r.texParameteri(e,r.TEXTURE_WRAP_S,Ay[t.wrapS]),r.texParameteri(e,r.TEXTURE_WRAP_T,Ay[t.wrapT]),(e===r.TEXTURE_3D||e===r.TEXTURE_2D_ARRAY)&&(t.isArrayTexture||r.texParameteri(e,r.TEXTURE_WRAP_R,Ay[t.wrapR])),r.texParameteri(e,r.TEXTURE_MAG_FILTER,e_[t.magFilter]);let u=t.mipmaps!==void 0&&t.mipmaps.length>0,h=t.minFilter===lr&&u?Ia:t.minFilter;if(r.texParameteri(e,r.TEXTURE_MIN_FILTER,e_[h]),t.compareFunction&&(r.texParameteri(e,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(e,r.TEXTURE_COMPARE_FUNC,J3[t.compareFunction])),i.has(\\\"EXT_texture_filter_anisotropic\\\")===!0){if(t.magFilter===or||t.minFilter!==Gh&&t.minFilter!==Ia||t.type===Er&&i.has(\\\"OES_texture_float_linear\\\")===!1)return;if(t.anisotropy>1){let d=i.get(\\\"EXT_texture_filter_anisotropic\\\");r.texParameterf(e,d.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(t.anisotropy,s.capabilities.getMaxAnisotropy()))}}}createDefaultTexture(e){let{gl:t,backend:r,defaultTextures:i}=this,s=this.getGLTextureType(e),a=i[s];a===void 0&&(a=t.createTexture(),r.state.bindTexture(s,a),t.texParameteri(s,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(s,t.TEXTURE_MAG_FILTER,t.NEAREST),i[s]=a),r.set(e,{textureGPU:a,glTextureType:s})}createTexture(e,t){let{gl:r,backend:i}=this,s,a,n,o,l;if(e.isExternalTexture===!0)s=e.sourceTexture,a=this.getGLTextureType(e);else{let{levels:u,width:h,height:d,depth:c}=t;n=i.utils.convert(e.format,e.colorSpace),o=i.utils.convert(e.type),l=this.getInternalFormat(e.internalFormat,n,o,e.normalized,e.colorSpace,e.isVideoTexture),s=r.createTexture(),a=this.getGLTextureType(e),i.state.bindTexture(a,s),this.setTextureParameters(a,e),e.isArrayTexture||e.isDataArrayTexture||e.isCompressedArrayTexture?r.texStorage3D(r.TEXTURE_2D_ARRAY,u,l,h,d,c):e.isData3DTexture?r.texStorage3D(r.TEXTURE_3D,u,l,h,d,c):e.isVideoTexture||r.texStorage2D(a,u,l,h,d)}i.set(e,{textureGPU:s,glTextureType:a,glFormat:n,glType:o,glInternalFormat:l})}copyBufferToTexture(e,t){let{gl:r,backend:i}=this,{state:s}=i,{textureGPU:a,glTextureType:n,glFormat:o,glType:l}=i.get(t),{width:u,height:h}=t.source.data;r.bindBuffer(r.PIXEL_UNPACK_BUFFER,e),i.state.bindTexture(n,a),s.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),s.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.texSubImage2D(n,0,0,0,u,h,o,l,0),r.bindBuffer(r.PIXEL_UNPACK_BUFFER,null),i.state.unbindTexture()}updateTexture(e,t){let{gl:r}=this,{width:i,height:s}=t,{textureGPU:a,glTextureType:n,glFormat:o,glType:l,glInternalFormat:u}=this.backend.get(e);if(!(e.isRenderTargetTexture||a===void 0))if(this.backend.state.bindTexture(n,a),this.setTextureParameters(n,e),e.isCompressedTexture){let h=e.mipmaps,d=t.image;for(let c=0;c\\u003ch.length;c++){let m=h[c];e.isCompressedArrayTexture?e.format!==r.RGBA?o!==null?r.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,c,0,0,0,m.width,m.height,d.depth,o,m.data):Ue(\\\"WebGLBackend: Attempt to load unsupported compressed texture format in .uploadTexture()\\\"):r.texSubImage3D(r.TEXTURE_2D_ARRAY,c,0,0,0,m.width,m.height,d.depth,o,l,m.data):o!==null?r.compressedTexSubImage2D(r.TEXTURE_2D,c,0,0,m.width,m.height,o,m.data):Ue(\\\"WebGLBackend: Unsupported compressed texture format\\\")}}else if(e.isCubeTexture){let h=t.images,d=e.mipmaps;for(let c=0;c\\u003c6;c++){let m=Cy(h[c]);r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,0,0,i,s,o,l,m);for(let g=0;g\\u003cd.length;g++){let y=d[g],b=Cy(y.images[c]);r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+c,g+1,0,0,b.width,b.height,o,l,b)}}}else if(e.isDataArrayTexture||e.isArrayTexture){let h=t.image;if(e.layerUpdates.size>0){let d=vU(h.width,h.height,e.format,e.type);for(let c of e.layerUpdates){let m=h.data.subarray(c*d/h.data.BYTES_PER_ELEMENT,(c+1)*d/h.data.BYTES_PER_ELEMENT);r.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,c,h.width,h.height,1,o,l,m)}e.clearLayerUpdates()}else r.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,h.width,h.height,h.depth,o,l,h.data)}else if(e.isData3DTexture){let h=t.image;r.texSubImage3D(r.TEXTURE_3D,0,0,0,0,h.width,h.height,h.depth,o,l,h.data)}else if(e.isVideoTexture)e.update(),r.texImage2D(n,0,u,o,l,t.image);else if(e.isHTMLTexture)typeof r.texElementImage2D==\\\"function\\\"&&(r.texElementImage2D.length===3?r.texElementImage2D(r.TEXTURE_2D,r.RGBA8,t.image):r.texElementImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,t.image));else{let h=e.mipmaps;if(h.length>0)for(let d=0,c=h.length;d\\u003cc;d++){let m=h[d],g=Cy(m);r.texSubImage2D(n,d,0,0,m.width,m.height,o,l,g)}else{let d=Cy(t.image);r.texSubImage2D(n,0,0,0,i,s,o,l,d)}}}generateMipmaps(e){let{gl:t,backend:r}=this,{textureGPU:i,glTextureType:s}=r.get(e);r.state.bindTexture(s,i),t.generateMipmap(s)}deallocateRenderBuffers(e){let{gl:t,backend:r}=this;if(e){let i=r.get(e);if(i.renderBufferStorageSetup=void 0,i.framebuffers){for(let s in i.framebuffers)t.deleteFramebuffer(i.framebuffers[s]);delete i.framebuffers}if(i.depthRenderbuffer&&(t.deleteRenderbuffer(i.depthRenderbuffer),delete i.depthRenderbuffer),i.stencilRenderbuffer&&(t.deleteRenderbuffer(i.stencilRenderbuffer),delete i.stencilRenderbuffer),i.msaaFrameBuffer&&(t.deleteFramebuffer(i.msaaFrameBuffer),delete i.msaaFrameBuffer),i.msaaRenderbuffers){for(let s=0;s\\u003ci.msaaRenderbuffers.length;s++)t.deleteRenderbuffer(i.msaaRenderbuffers[s]);delete i.msaaRenderbuffers}}}destroyTexture(e,t=!1){let{gl:r,backend:i}=this,{textureGPU:s,renderTarget:a}=i.get(e);this.deallocateRenderBuffers(a),t===!1&&e.isExternalTexture!==!0&&r.deleteTexture(s),i.delete(e)}copyTextureToTexture(e,t,r=null,i=null,s=0,a=0){let{gl:n,backend:o}=this,{state:l}=this.backend,{textureGPU:u,glTextureType:h,glType:d,glFormat:c}=o.get(t);l.bindTexture(h,u);let m,g,y,b,v,S,T,w,N,C=e.isCompressedTexture?e.mipmaps[a]:e.image;if(r!==null)m=r.max.x-r.min.x,g=r.max.y-r.min.y,y=r.isBox3?r.max.z-r.min.z:1,b=r.min.x,v=r.min.y,S=r.isBox3?r.min.z:0;else{let z=Math.pow(2,-s);m=Math.floor(C.width*z),g=Math.floor(C.height*z),e.isDataArrayTexture||e.isArrayTexture?y=C.depth:e.isData3DTexture?y=Math.floor(C.depth*z):y=1,b=0,v=0,S=0}i!==null?(T=i.x,w=i.y,N=i.z):(T=0,w=0,N=0),l.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t.flipY),l.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),l.pixelStorei(n.UNPACK_ALIGNMENT,t.unpackAlignment);let R=l.getParameter(n.UNPACK_ROW_LENGTH),E=l.getParameter(n.UNPACK_IMAGE_HEIGHT),P=l.getParameter(n.UNPACK_SKIP_PIXELS),I=l.getParameter(n.UNPACK_SKIP_ROWS),O=l.getParameter(n.UNPACK_SKIP_IMAGES);l.pixelStorei(n.UNPACK_ROW_LENGTH,C.width),l.pixelStorei(n.UNPACK_IMAGE_HEIGHT,C.height),l.pixelStorei(n.UNPACK_SKIP_PIXELS,b),l.pixelStorei(n.UNPACK_SKIP_ROWS,v),l.pixelStorei(n.UNPACK_SKIP_IMAGES,S);let L=e.isDataArrayTexture||e.isData3DTexture||t.isArrayTexture,X=t.isDataArrayTexture||t.isData3DTexture||t.isArrayTexture;if(e.isDepthTexture){let z=o.get(e),H=o.get(t),ue=o.get(z.renderTarget),ne=o.get(H.renderTarget),re=ue.framebuffers[z.cacheKey],ce=ne.framebuffers[H.cacheKey],ge=l.currentBoundFramebuffers[n.READ_FRAMEBUFFER]??null,ye=l.currentBoundFramebuffers[n.DRAW_FRAMEBUFFER]??null;l.bindFramebuffer(n.READ_FRAMEBUFFER,re),l.bindFramebuffer(n.DRAW_FRAMEBUFFER,ce);for(let oe=0;oe\\u003cy;oe++)L&&(n.framebufferTextureLayer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,z.textureGPU,s,S+oe),n.framebufferTextureLayer(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,u,a,N+oe)),n.blitFramebuffer(b,v,m,g,T,w,m,g,n.DEPTH_BUFFER_BIT,n.NEAREST);l.bindFramebuffer(n.READ_FRAMEBUFFER,ge),l.bindFramebuffer(n.DRAW_FRAMEBUFFER,ye)}else if(s!==0||e.isRenderTargetTexture||o.has(e)){let z=o.get(e);this._srcFramebuffer===null&&(this._srcFramebuffer=n.createFramebuffer()),this._dstFramebuffer===null&&(this._dstFramebuffer=n.createFramebuffer());let H=l.currentBoundFramebuffers[n.READ_FRAMEBUFFER]??null,ue=l.currentBoundFramebuffers[n.DRAW_FRAMEBUFFER]??null;l.bindFramebuffer(n.READ_FRAMEBUFFER,this._srcFramebuffer),l.bindFramebuffer(n.DRAW_FRAMEBUFFER,this._dstFramebuffer);for(let ne=0;ne\\u003cy;ne++)L?n.framebufferTextureLayer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,z.textureGPU,s,S+ne):n.framebufferTexture2D(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,z.textureGPU,s),X?n.framebufferTextureLayer(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,u,a,N+ne):n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,u,a),s!==0?n.blitFramebuffer(b,v,m,g,T,w,m,g,n.COLOR_BUFFER_BIT,n.NEAREST):X?n.copyTexSubImage3D(h,a,T,w,N+ne,b,v,m,g):n.copyTexSubImage2D(h,a,T,w,b,v,m,g);l.bindFramebuffer(n.READ_FRAMEBUFFER,H),l.bindFramebuffer(n.DRAW_FRAMEBUFFER,ue)}else X?e.isDataTexture||e.isData3DTexture?n.texSubImage3D(h,a,T,w,N,m,g,y,c,d,C.data):t.isCompressedArrayTexture?n.compressedTexSubImage3D(h,a,T,w,N,m,g,y,c,C.data):n.texSubImage3D(h,a,T,w,N,m,g,y,c,d,C):e.isDataTexture?n.texSubImage2D(n.TEXTURE_2D,a,T,w,m,g,c,d,C.data):e.isCompressedTexture?n.compressedTexSubImage2D(n.TEXTURE_2D,a,T,w,C.width,C.height,c,C.data):n.texSubImage2D(n.TEXTURE_2D,a,T,w,m,g,c,d,C);l.pixelStorei(n.UNPACK_ROW_LENGTH,R),l.pixelStorei(n.UNPACK_IMAGE_HEIGHT,E),l.pixelStorei(n.UNPACK_SKIP_PIXELS,P),l.pixelStorei(n.UNPACK_SKIP_ROWS,I),l.pixelStorei(n.UNPACK_SKIP_IMAGES,O),a===0&&t.generateMipmaps&&n.generateMipmap(h),l.unbindTexture()}copyFramebufferToTexture(e,t,r){let{gl:i}=this,{state:s}=this.backend,{textureGPU:a}=this.backend.get(e),{x:n,y:o,z:l,w:u}=r,h=e.isDepthTexture===!0||t.renderTarget&&t.renderTarget.samples>0,d=t.renderTarget?t.renderTarget.height:this.backend.getDrawingBufferSize().y;if(h){let c=n!==0||o!==0,m,g;if(e.isDepthTexture===!0?(m=i.DEPTH_BUFFER_BIT,g=i.DEPTH_ATTACHMENT,t.stencil&&(m|=i.STENCIL_BUFFER_BIT)):(m=i.COLOR_BUFFER_BIT,g=i.COLOR_ATTACHMENT0),c){let y=this.backend.get(t.renderTarget),b=y.framebuffers[t.getCacheKey()],v=y.msaaFrameBuffer;s.bindFramebuffer(i.DRAW_FRAMEBUFFER,b),s.bindFramebuffer(i.READ_FRAMEBUFFER,v);let S=d-o-u;i.blitFramebuffer(n,S,n+l,S+u,n,S,n+l,S+u,m,i.NEAREST),s.bindFramebuffer(i.READ_FRAMEBUFFER,b),s.bindTexture(i.TEXTURE_2D,a),i.copyTexSubImage2D(i.TEXTURE_2D,0,0,0,n,S,l,u),s.unbindTexture()}else{let y=i.createFramebuffer();s.bindFramebuffer(i.DRAW_FRAMEBUFFER,y),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,g,i.TEXTURE_2D,a,0),i.blitFramebuffer(0,0,l,u,0,0,l,u,m,i.NEAREST),i.deleteFramebuffer(y)}}else s.bindTexture(i.TEXTURE_2D,a),i.copyTexSubImage2D(i.TEXTURE_2D,0,0,0,n,d-u-o,l,u),s.unbindTexture();e.generateMipmaps&&this.generateMipmaps(e),this.backend._setFramebuffer(t)}setupRenderBufferStorage(e,t,r,i=!1){let{gl:s}=this,a=t.renderTarget,{depthTexture:n,depthBuffer:o,stencilBuffer:l,width:u,height:h}=a;if(s.bindRenderbuffer(s.RENDERBUFFER,e),o&&!l){let d=s.DEPTH_COMPONENT24;i===!0?this.extensions.get(\\\"WEBGL_multisampled_render_to_texture\\\").renderbufferStorageMultisampleEXT(s.RENDERBUFFER,a.samples,d,u,h):r>0?(n&&n.isDepthTexture&&n.type===s.FLOAT&&(d=s.DEPTH_COMPONENT32F),s.renderbufferStorageMultisample(s.RENDERBUFFER,r,d,u,h)):s.renderbufferStorage(s.RENDERBUFFER,d,u,h),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,e)}else o&&l&&(r>0?s.renderbufferStorageMultisample(s.RENDERBUFFER,r,s.DEPTH24_STENCIL8,u,h):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,u,h),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,e));s.bindRenderbuffer(s.RENDERBUFFER,null)}async copyTextureToBuffer(e,t,r,i,s,a){let{backend:n,gl:o}=this,{textureGPU:l,glFormat:u,glType:h}=this.backend.get(e),d=o.createFramebuffer();n.state.bindFramebuffer(o.READ_FRAMEBUFFER,d);let c=e.isCubeTexture?o.TEXTURE_CUBE_MAP_POSITIVE_X+a:o.TEXTURE_2D;o.framebufferTexture2D(o.READ_FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,l,0);let m=this._getTypedArrayType(h),g=this._getBytesPerTexel(h,u),y=i*s*g,b=o.createBuffer();o.bindBuffer(o.PIXEL_PACK_BUFFER,b),o.bufferData(o.PIXEL_PACK_BUFFER,y,o.STREAM_READ),o.readPixels(t,r,i,s,u,h,0),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),await n.utils._clientWaitAsync();let v=new m(y/m.BYTES_PER_ELEMENT);return o.bindBuffer(o.PIXEL_PACK_BUFFER,b),o.getBufferSubData(o.PIXEL_PACK_BUFFER,0,v),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),n.state.bindFramebuffer(o.READ_FRAMEBUFFER,null),o.deleteFramebuffer(d),v}_getTypedArrayType(e){let{gl:t}=this;if(e===t.UNSIGNED_BYTE)return Uint8Array;if(e===t.UNSIGNED_SHORT_4_4_4_4||e===t.UNSIGNED_SHORT_5_5_5_1||e===t.UNSIGNED_SHORT_5_6_5||e===t.UNSIGNED_SHORT)return Uint16Array;if(e===t.UNSIGNED_INT)return Uint32Array;if(e===t.HALF_FLOAT)return Uint16Array;if(e===t.FLOAT)return Float32Array;throw new Error(`THREE.WebGLTextureUtils: Unsupported WebGL type: ${e}`)}_getBytesPerTexel(e,t){let{gl:r}=this,i=0;if(e===r.UNSIGNED_BYTE&&(i=1),(e===r.UNSIGNED_SHORT_4_4_4_4||e===r.UNSIGNED_SHORT_5_5_5_1||e===r.UNSIGNED_SHORT_5_6_5||e===r.UNSIGNED_SHORT||e===r.HALF_FLOAT)&&(i=2),(e===r.UNSIGNED_INT||e===r.FLOAT)&&(i=4),t===r.RGBA)return i*4;if(t===r.RGB)return i*3;if(t===r.ALPHA)return i}dispose(){let{gl:e}=this;this._srcFramebuffer!==null&&e.deleteFramebuffer(this._srcFramebuffer),this._dstFramebuffer!==null&&e.deleteFramebuffer(this._dstFramebuffer)}};function Cy(e){return e.isDataTexture?e.image.data:typeof HTMLImageElement\\u003c\\\"u\\\"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement\\u003c\\\"u\\\"&&e instanceof HTMLCanvasElement||typeof ImageBitmap\\u003c\\\"u\\\"&&e instanceof ImageBitmap||typeof OffscreenCanvas\\u003c\\\"u\\\"&&e instanceof OffscreenCanvas?e:e.data}var eX=class{constructor(e){this.backend=e,this.gl=this.backend.gl,this.availableExtensions=this.gl.getSupportedExtensions(),this.extensions={}}get(e){let t=this.extensions[e];return t===void 0&&(t=this.gl.getExtension(e),this.extensions[e]=t),t}has(e){return this.availableExtensions.includes(e)}},tX=class{constructor(e){this.backend=e,this.maxAnisotropy=null,this.maxUniformBlockSize=null}getMaxAnisotropy(){if(this.maxAnisotropy!==null)return this.maxAnisotropy;let e=this.backend.gl,t=this.backend.extensions;if(t.has(\\\"EXT_texture_filter_anisotropic\\\")===!0){let r=t.get(\\\"EXT_texture_filter_anisotropic\\\");this.maxAnisotropy=e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else this.maxAnisotropy=0;return this.maxAnisotropy}getUniformBufferLimit(){if(this.maxUniformBlockSize!==null)return this.maxUniformBlockSize;let e=this.backend.gl;return this.maxUniformBlockSize=e.getParameter(e.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBlockSize}},Q3={WEBGL_multi_draw:\\\"WEBGL_multi_draw\\\",WEBGL_compressed_texture_astc:\\\"texture-compression-astc\\\",WEBGL_compressed_texture_etc:\\\"texture-compression-etc2\\\",WEBGL_compressed_texture_etc1:\\\"texture-compression-etc1\\\",WEBGL_compressed_texture_pvrtc:\\\"texture-compression-pvrtc\\\",WEBGL_compressed_texture_s3tc:\\\"texture-compression-s3tc\\\",EXT_texture_compression_bptc:\\\"texture-compression-bc\\\",EXT_disjoint_timer_query_webgl2:\\\"timestamp-query\\\",OVR_multiview2:\\\"OVR_multiview2\\\"},rX=class{constructor(e){this.gl=e.gl,this.extensions=e.extensions,this.info=e.renderer.info,this.mode=null,this.index=0,this.type=null,this.object=null}render(e,t){let{gl:r,mode:i,object:s,type:a,info:n,index:o}=this;o!==0?r.drawElements(i,t,a,e):r.drawArrays(i,e,t),n.update(s,t,1)}renderInstances(e,t,r){let{gl:i,mode:s,type:a,index:n,object:o,info:l}=this;r!==0&&(n!==0?i.drawElementsInstanced(s,t,a,e,r):i.drawArraysInstanced(s,e,t,r),l.update(o,t,r))}renderMultiDraw(e,t,r){let{extensions:i,mode:s,object:a,info:n}=this;if(r===0)return;let o=i.get(\\\"WEBGL_multi_draw\\\");if(o===null)for(let l=0;l\\u003cr;l++)this.render(e[l],t[l]);else{this.index!==0?o.multiDrawElementsWEBGL(s,t,0,this.type,e,0,r):o.multiDrawArraysWEBGL(s,e,0,t,0,r);let l=0;for(let u=0;u\\u003cr;u++)l+=t[u];n.update(a,l,1)}}},K3=class{constructor(e=256){this.trackTimestamp=!0,this.maxQueries=e,this.currentQueryIndex=0,this.queryOffsets=new Map,this.isDisposed=!1,this.lastValue=0,this.frames=[],this.pendingResolve=!1,this.timestamps=new Map}getTimestampFrames(){return this.frames}getTimestamp(e){let t=this.timestamps.get(e);return t===void 0&&(Ue(`TimestampQueryPool: No timestamp available for uid ${e}.`),t=0),t}hasTimestampQuery(e){return this.timestamps.has(e)}allocateQueriesForContext(){}async resolveQueriesAsync(){}dispose(){}},iX=class extends K3{constructor(e,t,r=2048){if(super(r),this.gl=e,this.type=t,this.ext=e.getExtension(\\\"EXT_disjoint_timer_query_webgl2\\\")||e.getExtension(\\\"EXT_disjoint_timer_query\\\"),!this.ext){Ue(\\\"EXT_disjoint_timer_query not supported; timestamps will be disabled.\\\"),this.trackTimestamp=!1;return}this.queries=[];for(let i=0;i\\u003cthis.maxQueries;i++)this.queries.push(e.createQuery());this.activeQuery=null,this.queryStates=new Map}allocateQueriesForContext(e){if(!this.trackTimestamp)return null;if(this.currentQueryIndex+2>this.maxQueries)return Et(`WebGLTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryStates.set(t,\\\"inactive\\\"),this.queryOffsets.set(e,t),t}beginQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t==null||this.activeQuery!==null)return;let r=this.queries[t];if(r)try{this.queryStates.get(t)===\\\"inactive\\\"&&(this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT,r),this.activeQuery=t,this.queryStates.set(t,\\\"started\\\"))}catch(i){Ce(\\\"Error in beginQuery:\\\",i),this.activeQuery=null,this.queryStates.set(t,\\\"inactive\\\")}}endQuery(e){if(!this.trackTimestamp||this.isDisposed)return;let t=this.queryOffsets.get(e);if(t!=null&&this.activeQuery===t)try{this.gl.endQuery(this.ext.TIME_ELAPSED_EXT),this.queryStates.set(t,\\\"ended\\\"),this.activeQuery=null}catch(r){Ce(\\\"Error in endQuery:\\\",r),this.queryStates.set(t,\\\"inactive\\\"),this.activeQuery=null}}async resolveQueriesAsync(){if(!this.trackTimestamp||this.pendingResolve)return this.lastValue;this.pendingResolve=!0;try{let e=new Map;for(let[s,a]of this.queryOffsets)if(this.queryStates.get(a)===\\\"ended\\\"){let n=this.queries[a];e.set(s,this.resolveQuery(n))}if(e.size===0)return this.lastValue;let t={},r=[];for(let[s,a]of e){let n=s.match(/^(.*):f(\\\\d+)$/),o=parseInt(n[2]);r.includes(o)===!1&&r.push(o),t[o]===void 0&&(t[o]=0);let l=await a;this.timestamps.set(s,l),t[o]+=l}let i=t[r[r.length-1]];return this.lastValue=i,this.frames=r,this.currentQueryIndex=0,this.queryOffsets.clear(),this.queryStates.clear(),this.activeQuery=null,i}catch(e){return Ce(\\\"Error resolving queries:\\\",e),this.lastValue}finally{this.pendingResolve=!1}}async resolveQuery(e){return new Promise(t=>{if(this.isDisposed){t(this.lastValue);return}let r,i=!1,s=()=>{r&&(clearTimeout(r),r=null)},a=o=>{i||(i=!0,s(),t(o))},n=()=>{if(this.isDisposed){a(this.lastValue);return}try{if(this.gl.getParameter(this.ext.GPU_DISJOINT_EXT)){a(this.lastValue);return}if(!this.gl.getQueryParameter(e,this.gl.QUERY_RESULT_AVAILABLE)){r=setTimeout(n,1);return}let o=this.gl.getQueryParameter(e,this.gl.QUERY_RESULT);t(Number(o)/1e6)}catch(o){Ce(\\\"Error checking query:\\\",o),t(this.lastValue)}};n()})}dispose(){if(!this.isDisposed&&(this.isDisposed=!0,!!this.trackTimestamp)){for(let e of this.queries)this.gl.deleteQuery(e);this.queries=[],this.queryStates.clear(),this.queryOffsets.clear(),this.lastValue=0,this.activeQuery=null}}},eB=class extends Y3{constructor(e={}){super(e),this.isWebGLBackend=!0,this.attributeUtils=null,this.extensions=null,this.capabilities=null,this.textureUtils=null,this.bufferRenderer=null,this.gl=null,this.state=null,this.utils=null,this.vaoCache={},this.transformFeedbackCache={},this.discard=!1,this.disjoint=null,this.parallel=null,this._currentContext=null,this._knownBindings=new WeakSet,this._supportsInvalidateFramebuffer=typeof navigator>\\\"u\\\"?!1:/OculusBrowser/g.test(navigator.userAgent),this._xrFramebuffer=null}init(e){super.init(e);let t=this.parameters,r={antialias:e.currentSamples>0,alpha:!0,depth:e.depth,stencil:e.stencil},i=t.context!==void 0?t.context:e.domElement.getContext(\\\"webgl2\\\",r);function s(a){a.preventDefault();let n={api:\\\"WebGL\\\",message:a.statusMessage||\\\"Unknown reason\\\",reason:null,originalEvent:a};e.onDeviceLost(n)}this._onContextLost=s,e.domElement.addEventListener(\\\"webglcontextlost\\\",s,!1),this.gl=i,this.extensions=new eX(this),this.capabilities=new tX(this),this.attributeUtils=new ZH(this),this.textureUtils=new KH(this),this.bufferRenderer=new rX(this),this.state=new JH(this),this.utils=new QH(this),this.extensions.get(\\\"EXT_color_buffer_float\\\"),this.extensions.get(\\\"WEBGL_clip_cull_distance\\\"),this.extensions.get(\\\"OES_texture_float_linear\\\"),this.extensions.get(\\\"EXT_color_buffer_half_float\\\"),this.extensions.get(\\\"WEBGL_multisampled_render_to_texture\\\"),this.extensions.get(\\\"WEBGL_render_shared_exponent\\\"),this.extensions.get(\\\"WEBGL_multi_draw\\\"),this.extensions.get(\\\"OVR_multiview2\\\"),this.extensions.get(\\\"EXT_clip_control\\\"),this.disjoint=this.extensions.get(\\\"EXT_disjoint_timer_query_webgl2\\\"),this.parallel=this.extensions.get(\\\"KHR_parallel_shader_compile\\\"),this.drawBuffersIndexedExt=this.extensions.get(\\\"OES_draw_buffers_indexed\\\"),t.reversedDepthBuffer&&(this.extensions.has(\\\"EXT_clip_control\\\")?e.reversedDepthBuffer=!0:(Ue(\\\"WebGPURenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.\\\"),e.reversedDepthBuffer=!1)),e.reversedDepthBuffer&&this.state.setReversedDepth(!0)}get coordinateSystem(){return Ds}get hasTimestamp(){return this.disjoint!==null}async getArrayBufferAsync(e,t=null,r=0,i=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,r,i)}async makeXRCompatible(){this.gl.getContextAttributes().xrCompatible!==!0&&await this.gl.makeXRCompatible()}setXRTarget(e){this._xrFramebuffer=e}setXRRenderTargetTextures(e,t,r=null){let i=this.gl;if(this.set(e.texture,{textureGPU:t,glInternalFormat:i.RGBA8}),r!==null){let s=e.stencilBuffer?i.DEPTH24_STENCIL8:i.DEPTH_COMPONENT24;this.set(e.depthTexture,{textureGPU:r,glInternalFormat:s}),this.extensions.has(\\\"WEBGL_multisampled_render_to_texture\\\")===!0&&e._autoAllocateDepthBuffer===!0&&e.multiview===!1&&Ue(\\\"WebGLBackend: Render-to-texture extension was disabled because an external texture was provided\\\"),e._autoAllocateDepthBuffer=!1}}initTimestampQuery(e,t){if(!this.disjoint||!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new iX(this.gl,e,2048));let r=this.timestampQueryPool[e];r.allocateQueriesForContext(t)!==null&&r.beginQuery(t)}prepareTimestampBuffer(e,t){!this.disjoint||!this.trackTimestamp||this.timestampQueryPool[e].endQuery(t)}getContext(){return this.gl}beginRender(e){let{state:t}=this,r=this.get(e);if(e.viewport)this.updateViewport(e);else{let{width:s,height:a}=this.getDrawingBufferSize();t.viewport(0,0,s,a)}if(e.scissor)this.updateScissor(e);else{let{width:s,height:a}=this.getDrawingBufferSize();t.scissor(0,0,s,a)}this.initTimestampQuery(un.RENDER,this.getTimestampUID(e)),r.previousContext=this._currentContext,this._currentContext=e,this._setFramebuffer(e),this.clear(e.clearColor,e.clearDepth,e.clearStencil,e,!1);let i=e.occlusionQueryCount;i>0&&(r.currentOcclusionQueries=r.occlusionQueries,r.currentOcclusionQueryObjects=r.occlusionQueryObjects,r.lastOcclusionObject=null,r.occlusionQueries=new Array(i),r.occlusionQueryObjects=new Array(i),r.occlusionQueryIndex=0)}finishRender(e){let{gl:t,state:r}=this,i=this.get(e),s=i.previousContext;r.resetVertexState();let a=e.occlusionQueryCount;a>0&&(a>i.occlusionQueryIndex&&t.endQuery(t.ANY_SAMPLES_PASSED),this.resolveOccludedAsync(e));let n=e.textures;if(n!==null)for(let o=0;o\\u003cn.length;o++){let l=n[o];l.generateMipmaps&&this.generateMipmaps(l)}if(this._currentContext=s,this._resolveRenderTarget(e),s!==null){if(this._setFramebuffer(s),s.viewport)this.updateViewport(s);else{let{width:o,height:l}=this.getDrawingBufferSize();r.viewport(0,0,o,l)}if(s.scissor)this.updateScissor(s);else{let{width:o,height:l}=this.getDrawingBufferSize();r.scissor(0,0,o,l)}}this.prepareTimestampBuffer(un.RENDER,this.getTimestampUID(e))}resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueries:r,currentOcclusionQueryObjects:i}=t;if(r&&i){let s=new WeakSet,{gl:a}=this;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueries=null;let n=()=>{let o=0;for(let l=0;l\\u003cr.length;l++){let u=r[l];u!==null&&a.getQueryParameter(u,a.QUERY_RESULT_AVAILABLE)&&(a.getQueryParameter(u,a.QUERY_RESULT)===0&&s.add(i[l]),r[l]=null,a.deleteQuery(u),o++)}o\\u003cr.length?requestAnimationFrame(n):t.occluded=s};n()}}isOccluded(e,t){let r=this.get(e);return r.occluded&&r.occluded.has(t)}updateViewport(e){let{state:t}=this,{x:r,y:i,width:s,height:a}=e.viewportValue;t.viewport(r,e.height-a-i,s,a)}updateScissor(e){let{state:t}=this,{x:r,y:i,width:s,height:a}=e.scissorValue;t.scissor(r,e.height-a-i,s,a)}setScissorTest(e){this.state.setScissorTest(e)}getClearColor(){let e=super.getClearColor();return e.r*=e.a,e.g*=e.a,e.b*=e.a,e}clear(e,t,r,i=null,s=!0,a=!0){let{gl:n,renderer:o}=this;i===null&&(i={textures:null,clearColorValue:this.getClearColor()});let l=0;if(e&&(l|=n.COLOR_BUFFER_BIT),t&&(l|=n.DEPTH_BUFFER_BIT),r&&(l|=n.STENCIL_BUFFER_BIT),l!==0){let u;i.clearColorValue?u=i.clearColorValue:u=this.getClearColor();let h=o.getClearDepth(),d=o.getClearStencil();if(t&&this.state.setDepthMask(!0),i.textures===null)n.clearColor(u.r,u.g,u.b,u.a),n.clear(l);else{if(s&&this._setFramebuffer(i),e)for(let c=0;c\\u003ci.textures.length;c++)c===0?n.clearBufferfv(n.COLOR,c,[u.r,u.g,u.b,u.a]):n.clearBufferfv(n.COLOR,c,[0,0,0,1]);t&&r?n.clearBufferfi(n.DEPTH_STENCIL,0,h,d):t?n.clearBufferfv(n.DEPTH,0,[h]):r&&n.clearBufferiv(n.STENCIL,0,[d]),s&&a&&this._resolveRenderTarget(i),s&&this._currentContext!==null&&this._currentContext!==i&&this._setFramebuffer(this._currentContext)}}}beginCompute(e){let{state:t,gl:r}=this;t.bindFramebuffer(r.FRAMEBUFFER,null),this.initTimestampQuery(un.COMPUTE,this.getTimestampUID(e))}compute(e,t,r,i,s=null){let{state:a,gl:n}=this;this.discard===!1&&(a.enable(n.RASTERIZER_DISCARD),this.discard=!0);let{programGPU:o,transformBuffers:l,attributes:u}=this.get(i),h=this._getVaoKey(u),d=this.vaoCache[h];d===void 0?this.vaoCache[h]=this._createVao(u):a.setVertexState(d),a.useProgram(o),this._bindUniforms(r);let c=this._getTransformFeedback(l);n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,c),n.beginTransformFeedback(n.POINTS),s=s!==null?s:t.count,Array.isArray(s)?(Et(\\\"WebGLBackend.compute(): The count parameter must be a single number, not an array.\\\"),s=s[0]):s&&typeof s==\\\"object\\\"&&s.isIndirectStorageBufferAttribute&&(Et(\\\"WebGLBackend.compute(): The count parameter must be a single number, not IndirectStorageBufferAttribute\\\"),s=t.count),u[0].isStorageInstancedBufferAttribute?n.drawArraysInstanced(n.POINTS,0,1,s):n.drawArrays(n.POINTS,0,s),n.endTransformFeedback(),n.bindTransformFeedback(n.TRANSFORM_FEEDBACK,null);for(let m=0;m\\u003cl.length;m++){let g=l[m];g.pbo&&this.has(g.pbo)&&this.textureUtils.copyBufferToTexture(g.transformBuffer,g.pbo),g.switchBuffers()}}finishCompute(e){let{state:t,gl:r}=this;this.discard=!1,t.disable(r.RASTERIZER_DISCARD),this.prepareTimestampBuffer(un.COMPUTE,this.getTimestampUID(e)),this._currentContext&&this._setFramebuffer(this._currentContext)}_isRenderCameraDepthArray(e){return e.depthTexture&&e.depthTexture.isArrayTexture&&e.camera.isArrayCamera}_draw(e,t,r,i,s,a){if(e.isBatchedMesh)if(this.hasFeature(\\\"WEBGL_multi_draw\\\")===!1){let{gl:n}=this,o=n.getUniformLocation(a,\\\"nodeUniformDrawId\\\"),l=e._multiDrawStarts,u=e._multiDrawCounts,h=e._multiDrawCount;for(let d=0;d\\u003ch;d++)n.uniform1ui(o,d),t.render(l[d],u[d])}else t.renderMultiDraw(e._multiDrawStarts,e._multiDrawCounts,e._multiDrawCount);else s>1?t.renderInstances(r,i,s):t.render(r,i)}draw(e){let{object:t,pipeline:r,material:i,context:s,hardwareClippingPlanes:a}=e,{programGPU:n}=this.get(r),{gl:o,state:l}=this,u=this.get(s),h=e.getDrawParameters();if(h===null)return;this._bindUniforms(e.getBindings());let d=t.isMesh&&t.matrixWorld.determinantAffine()\\u003c0;l.setMaterial(i,d,a),s.mrt!==null&&s.textures!==null&&l.setMRTBlending(s.textures,s.mrt,i),l.useProgram(n);let c=e.getAttributes(),m=this.get(c),g=m.vaoGPU;if(g===void 0){let C=this._getVaoKey(c);g=this.vaoCache[C],g===void 0&&(g=this._createVao(c),this.vaoCache[C]=g,m.vaoGPU=g)}let y=e.getIndex(),b=y!==null?this.get(y).bufferGPU:null;l.setVertexState(g,b);let v=u.lastOcclusionObject;if(v!==t&&v!==void 0){if(v!==null&&v.occlusionTest===!0&&(o.endQuery(o.ANY_SAMPLES_PASSED),u.occlusionQueryIndex++),t.occlusionTest===!0){let C=o.createQuery();o.beginQuery(o.ANY_SAMPLES_PASSED,C),u.occlusionQueries[u.occlusionQueryIndex]=C,u.occlusionQueryObjects[u.occlusionQueryIndex]=t}u.lastOcclusionObject=t}let S=this.bufferRenderer;t.isPoints?S.mode=o.POINTS:t.isLineSegments?S.mode=o.LINES:t.isLine?S.mode=o.LINE_STRIP:t.isLineLoop?S.mode=o.LINE_LOOP:i.wireframe===!0?(l.setLineWidth(i.wireframeLinewidth*this.renderer.getPixelRatio()),S.mode=o.LINES):S.mode=o.TRIANGLES;let{vertexCount:T,instanceCount:w}=h,{firstVertex:N}=h;if(S.object=t,y!==null){N*=y.array.BYTES_PER_ELEMENT;let C=this.get(y);S.index=y.count,S.type=C.type}else S.index=0;if(e.camera.isArrayCamera===!0&&e.camera.cameras.length>0&&e.camera.isMultiViewCamera===!1){let C=this.get(e.camera),R=e.camera.cameras,E=e.getBindingGroup(\\\"cameraIndex\\\").bindings[0];if(C.indexesGPU===void 0||C.indexesGPU.length!==R.length){let z=new Uint32Array([0,0,0,0]),H=[];for(let ue=0,ne=R.length;ue\\u003cne;ue++){let re=o.createBuffer();z[0]=ue,o.bindBuffer(o.UNIFORM_BUFFER,re),o.bufferData(o.UNIFORM_BUFFER,z,o.STATIC_DRAW),H.push(re)}C.indexesGPU=H}let P=0;e:for(let z of e.getBindings())for(let H of z.bindings){if(H===E)break e;(H.isUniformsGroup||H.isUniformBuffer)&&P++}let I=this.renderer.getPixelRatio(),O=this._currentContext.renderTarget,L=this._isRenderCameraDepthArray(this._currentContext),X=this._currentContext.activeCubeFace;if(L){let z=this.get(O.depthTexture);if(z.clearedRenderId!==this.renderer._nodes.nodeFrame.renderId){z.clearedRenderId=this.renderer._nodes.nodeFrame.renderId;let{stencilBuffer:H}=O;for(let ue=0,ne=R.length;ue\\u003cne;ue++)this.renderer._activeCubeFace=ue,this._currentContext.activeCubeFace=ue,this._setFramebuffer(this._currentContext),this.clear(!1,!0,H,this._currentContext,!1,!1);this.renderer._activeCubeFace=X,this._currentContext.activeCubeFace=X}}for(let z=0,H=R.length;z\\u003cH;z++){let ue=R[z];if(t.layers.test(ue.layers)){L&&(this.renderer._activeCubeFace=z,this._currentContext.activeCubeFace=z,this._setFramebuffer(this._currentContext));let ne=ue.viewport;if(ne!==void 0){let re=ne.x*I,ce=ne.y*I,ge=ne.width*I,ye=ne.height*I;l.viewport(Math.floor(re),Math.floor(e.context.height-ye-ce),Math.floor(ge),Math.floor(ye))}l.bindBufferBase(o.UNIFORM_BUFFER,P,C.indexesGPU[z]),this._draw(t,S,N,T,w,n)}this._currentContext.activeCubeFace=X,this.renderer._activeCubeFace=X}}else this._draw(t,S,N,T,w,n)}needsRenderUpdate(){return!1}getRenderCacheKey(){return\\\"\\\"}createDefaultTexture(e){this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,r,i,s,a){return this.textureUtils.copyTextureToBuffer(e,t,r,i,s,a)}updateSampler(){return\\\"\\\"}createNodeBuilder(e,t){return new $H(e,t)}createProgram(e){let t=this.gl,{stage:r,code:i}=e,s=r===\\\"fragment\\\"?t.createShader(t.FRAGMENT_SHADER):t.createShader(t.VERTEX_SHADER);t.shaderSource(s,i),t.compileShader(s),this.set(e,{shaderGPU:s})}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){let r=this.gl,i=e.pipeline,{fragmentProgram:s,vertexProgram:a}=i,n=r.createProgram(),o=this.get(s).shaderGPU,l=this.get(a).shaderGPU;if(r.attachShader(n,o),r.attachShader(n,l),r.linkProgram(n),this.set(i,{programGPU:n,fragmentShader:o,vertexShader:l}),t!==null&&this.parallel){let u=new Promise(h=>{let d=this.parallel,c=()=>{r.getProgramParameter(n,d.COMPLETION_STATUS_KHR)?(this._completeCompile(e,i),h()):requestAnimationFrame(c)};c()});t.push(u);return}this._completeCompile(e,i)}_handleSource(e,t){let r=e.split(`\\n`),i=[],s=Math.max(t-6,0),a=Math.min(t+6,r.length);for(let n=s;n\\u003ca;n++){let o=n+1;i.push(`${o===t?\\\">\\\":\\\" \\\"} ${o}: ${r[n]}`)}return i.join(`\\n`)}_getShaderErrors(e,t,r){let i=e.getShaderParameter(t,e.COMPILE_STATUS),s=(e.getShaderInfoLog(t)||\\\"\\\").trim();if(i&&s===\\\"\\\")return\\\"\\\";let a=/ERROR: 0:(\\\\d+)/.exec(s);if(a){let n=parseInt(a[1]);return r.toUpperCase()+`\\n\\n`+s+`\\n\\n`+this._handleSource(e.getShaderSource(t),n)}else return s}_logProgramError(e,t,r){if(this.renderer.debug.checkShaderErrors){let i=this.gl,s=(i.getProgramInfoLog(e)||\\\"\\\").trim();if(i.getProgramParameter(e,i.LINK_STATUS)===!1)if(typeof this.renderer.debug.onShaderError==\\\"function\\\")this.renderer.debug.onShaderError(i,e,r,t);else{let a=this._getShaderErrors(i,r,\\\"vertex\\\"),n=this._getShaderErrors(i,t,\\\"fragment\\\");Ce(\\\"WebGLProgram: Shader Error \\\"+i.getError()+\\\" - VALIDATE_STATUS \\\"+i.getProgramParameter(e,i.VALIDATE_STATUS)+`\\n\\nProgram Info Log: `+s+`\\n`+a+`\\n`+n)}else s!==\\\"\\\"&&Ue(\\\"WebGLProgram: Program Info Log:\\\",s)}}_completeCompile(e,t){let{state:r,gl:i}=this,s=this.get(t),{programGPU:a,fragmentShader:n,vertexShader:o}=s;i.getProgramParameter(a,i.LINK_STATUS)===!1&&this._logProgramError(a,n,o),r.useProgram(a);let l=e.getBindings();this._setupBindings(l,a),this.set(t,{programGPU:a,pipeline:a})}createComputePipeline(e,t){let{state:r,gl:i}=this,s={stage:\\\"fragment\\\",code:`#version 300 es\\nprecision highp float;\\nvoid main() {}`};this.createProgram(s);let{computeProgram:a}=e,n=i.createProgram(),o=this.get(s).shaderGPU,l=this.get(a).shaderGPU,u=a.transforms,h=[],d=[];for(let y=0;y\\u003cu.length;y++){let b=u[y];h.push(b.varyingName),d.push(b.attributeNode)}i.attachShader(n,o),i.attachShader(n,l),i.transformFeedbackVaryings(n,h,i.SEPARATE_ATTRIBS),i.linkProgram(n),i.getProgramParameter(n,i.LINK_STATUS)===!1&&this._logProgramError(n,o,l),r.useProgram(n),this._setupBindings(t,n);let c=a.attributes,m=[],g=[];for(let y=0;y\\u003cc.length;y++){let b=c[y].node.attribute;m.push(b),this.has(b)||this.attributeUtils.createAttribute(b,i.ARRAY_BUFFER)}for(let y=0;y\\u003cd.length;y++){let b=d[y].attribute;this.has(b)||this.attributeUtils.createAttribute(b,i.ARRAY_BUFFER);let v=this.get(b);g.push(v)}this.set(e,{programGPU:n,transformBuffers:g,attributes:m})}createBindings(e,t){if(this._knownBindings.has(t)===!1){this._knownBindings.add(t);let r=0,i=0;for(let s of t){this.set(s,{textures:i,uniformBuffers:r});for(let a of s.bindings)a.isUniformBuffer&&r++,a.isSampledTexture&&i++}}this.updateBindings(e,t)}updateBindings(e){let{gl:t}=this;for(let r of e.bindings){let i=this.get(r);if(r.isUniformsGroup||r.isUniformBuffer){let s=r.buffer,a=i.bufferGPU;t.bindBuffer(t.UNIFORM_BUFFER,a);let n=r.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,a),n.length===0)t.bufferData(t.UNIFORM_BUFFER,s,t.DYNAMIC_DRAW);else{let o=ip(s),l=o?1:s.BYTES_PER_ELEMENT;for(let u=0,h=n.length;u\\u003ch;u++){let d=n[u],c=d.start*l,m=d.count*l,g=c*(o?s.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,g,s,c,m)}}this.set(r,i)}else if(r.isSampledTexture){let{textureGPU:s,glTextureType:a}=this.get(r.texture);i.textureGPU=s,i.glTextureType=a,this.set(r,i)}}}updateBinding(e){let t=this.gl;if(e.isUniformsGroup||e.isUniformBuffer){let r=this.get(e).bufferGPU,i=e.buffer,s=e.updateRanges;if(t.bindBuffer(t.UNIFORM_BUFFER,r),s.length===0)t.bufferData(t.UNIFORM_BUFFER,i,t.DYNAMIC_DRAW);else{let a=ip(i),n=a?1:i.BYTES_PER_ELEMENT,o=s[0].start;for(let l=0,u=s.length;l\\u003cu;l++){let h=s[l],d=s[l+1],c=h.start+h.count;if(d!==void 0&&d.start===c)continue;let m=o*n,g=(c-o)*n,y=m*(a?i.BYTES_PER_ELEMENT:1);t.bufferSubData(t.UNIFORM_BUFFER,y,i,m,g),d!==void 0&&(o=d.start)}}}}createUniformBuffer(e){let t=this.get(e);if(t.bufferGPU===void 0){let r=this.gl,i=e.buffer;t.bufferGPU=r.createBuffer(),r.bindBuffer(r.UNIFORM_BUFFER,t.bufferGPU),r.bufferData(r.UNIFORM_BUFFER,i.byteLength,r.DYNAMIC_DRAW)}}destroyUniformBuffer(e){let t=this.get(e);this.gl.deleteBuffer(t.bufferGPU),this.delete(e)}createIndexAttribute(e){let t=this.gl;this.attributeUtils.createAttribute(e,t.ELEMENT_ARRAY_BUFFER)}createAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}createStorageAttribute(e){if(this.has(e))return;let t=this.gl;this.attributeUtils.createAttribute(e,t.ARRAY_BUFFER)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}hasFeature(e){let t=Object.keys(Q3).filter(i=>Q3[i]===e),r=this.extensions;for(let i=0;i\\u003ct.length;i++)if(r.has(t[i]))return!0;return!1}copyTextureToTexture(e,t,r=null,i=null,s=0,a=0){this.textureUtils.copyTextureToTexture(e,t,r,i,s,a)}copyFramebufferToTexture(e,t,r){this.textureUtils.copyFramebufferToTexture(e,t,r)}hasCompatibility(e){return e===fu.TEXTURE_COMPARE?!0:super.hasCompatibility(e)}initRenderTarget(e){let{gl:t,state:r}=this;this._setFramebuffer(e),r.bindFramebuffer(t.FRAMEBUFFER,null)}_setFramebuffer(e){let{gl:t,state:r}=this,i=null;if(e.textures!==null){let s=e.renderTarget,a=this.get(s),{samples:n,depthBuffer:o,stencilBuffer:l}=s,u=s.isCubeRenderTarget===!0,h=s.isRenderTarget3D===!0,d=s.depth>1,c=s.isXRRenderTarget===!0,m=c===!0&&s._hasExternalTextures===!0,g=a.msaaFrameBuffer,y=a.depthRenderbuffer,b=this.extensions.get(\\\"WEBGL_multisampled_render_to_texture\\\"),v=this.extensions.get(\\\"OVR_multiview2\\\"),S=this._useMultisampledExtension(s),T=oP(e),w;if(u?(a.cubeFramebuffers||(a.cubeFramebuffers={}),w=a.cubeFramebuffers[T]):c&&m===!1?w=this._xrFramebuffer:(a.framebuffers||(a.framebuffers={}),w=a.framebuffers[T]),w===void 0){w=t.createFramebuffer(),r.bindFramebuffer(t.FRAMEBUFFER,w);let N=e.textures,C=[];if(u){a.cubeFramebuffers[T]=w;let{textureGPU:E}=this.get(N[0]),P=this.renderer._activeCubeFace,I=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+P,E,I)}else{a.framebuffers[T]=w;for(let E=0;E\\u003cN.length;E++){let P=N[E],I=this.get(P);I.renderTarget=e.renderTarget,I.cacheKey=T;let O=t.COLOR_ATTACHMENT0+E;if(s.multiview)v.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,O,I.textureGPU,0,n,0,2);else if(h||d){let L=this.renderer._activeCubeFace,X=this.renderer._activeMipmapLevel;t.framebufferTextureLayer(t.FRAMEBUFFER,O,I.textureGPU,X,L)}else if(S)b.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,O,t.TEXTURE_2D,I.textureGPU,0,n);else{let L=this.renderer._activeMipmapLevel;t.framebufferTexture2D(t.FRAMEBUFFER,O,t.TEXTURE_2D,I.textureGPU,L)}}}let R=l?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let E=t.createRenderbuffer();this.textureUtils.setupRenderBufferStorage(E,e,0,S),a.xrDepthRenderbuffer=E,C.push(l?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT),t.bindRenderbuffer(t.RENDERBUFFER,E),t.framebufferRenderbuffer(t.FRAMEBUFFER,R,t.RENDERBUFFER,E)}else if(e.depthTexture!==null){C.push(l?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT);let E=this.get(e.depthTexture);if(E.renderTarget=e.renderTarget,E.cacheKey=T,s.multiview)v.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,R,E.textureGPU,0,n,0,2);else if(m&&S)b.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,R,t.TEXTURE_2D,E.textureGPU,0,n);else if(e.depthTexture.isArrayTexture){let P=this.renderer._activeCubeFace;t.framebufferTextureLayer(t.FRAMEBUFFER,R,E.textureGPU,0,P)}else if(e.depthTexture.isCubeTexture){let P=this.renderer._activeCubeFace;t.framebufferTexture2D(t.FRAMEBUFFER,R,t.TEXTURE_CUBE_MAP_POSITIVE_X+P,E.textureGPU,0)}else t.framebufferTexture2D(t.FRAMEBUFFER,R,t.TEXTURE_2D,E.textureGPU,0)}a.depthInvalidationArray=C}else{if(this._isRenderCameraDepthArray(e)){r.bindFramebuffer(t.FRAMEBUFFER,w);let N=this.renderer._activeCubeFace,C=this.get(e.depthTexture),R=l?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTextureLayer(t.FRAMEBUFFER,R,C.textureGPU,0,N)}if((c||S||s.multiview)&&s._isOpaqueFramebuffer!==!0){r.bindFramebuffer(t.FRAMEBUFFER,w);let N=this.get(e.textures[0]);s.multiview?v.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,N.textureGPU,0,n,0,2):S?b.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,N.textureGPU,0,n):t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,N.textureGPU,0);let C=l?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(s._autoAllocateDepthBuffer===!0){let R=a.xrDepthRenderbuffer;t.bindRenderbuffer(t.RENDERBUFFER,R),t.framebufferRenderbuffer(t.FRAMEBUFFER,C,t.RENDERBUFFER,R)}else{let R=this.get(e.depthTexture);s.multiview?v.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,C,R.textureGPU,0,n,0,2):S?b.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,C,t.TEXTURE_2D,R.textureGPU,0,n):t.framebufferTexture2D(t.FRAMEBUFFER,C,t.TEXTURE_2D,R.textureGPU,0)}}}if(n>0&&S===!1&&!s.multiview){if(g===void 0){let N=[];g=t.createFramebuffer(),r.bindFramebuffer(t.FRAMEBUFFER,g);let C=[],R=e.textures;for(let E=0;E\\u003cR.length;E++){C[E]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,C[E]),N.push(t.COLOR_ATTACHMENT0+E);let P=e.textures[E],I=this.get(P);t.renderbufferStorageMultisample(t.RENDERBUFFER,n,I.glInternalFormat,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+E,t.RENDERBUFFER,C[E])}if(t.bindRenderbuffer(t.RENDERBUFFER,null),a.msaaFrameBuffer=g,a.msaaRenderbuffers=C,o&&y===void 0){y=t.createRenderbuffer(),this.textureUtils.setupRenderBufferStorage(y,e,n),a.depthRenderbuffer=y;let E=l?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;N.push(E)}a.invalidationArray=N}i=a.msaaFrameBuffer}else i=w;r.drawBuffers(e,w)}r.bindFramebuffer(t.FRAMEBUFFER,i)}_getVaoKey(e){let t=\\\"\\\";for(let r=0;r\\u003ce.length;r++){let i=this.get(e[r]);t+=\\\":\\\"+i.id}return t}_createVao(e){let{gl:t}=this,r=t.createVertexArray();t.bindVertexArray(r);for(let i=0;i\\u003ce.length;i++){let s=e[i],a=this.get(s);t.bindBuffer(t.ARRAY_BUFFER,a.bufferGPU),t.enableVertexAttribArray(i);let n,o;s.isInterleavedBufferAttribute===!0?(n=s.data.stride*a.bytesPerElement,o=s.offset*a.bytesPerElement):(n=0,o=0),a.isInteger?t.vertexAttribIPointer(i,s.itemSize,a.type,n,o):t.vertexAttribPointer(i,s.itemSize,a.type,s.normalized,n,o),s.isInstancedBufferAttribute&&!s.isInterleavedBufferAttribute?t.vertexAttribDivisor(i,s.meshPerAttribute):s.isInterleavedBufferAttribute&&s.data.isInstancedInterleavedBuffer&&t.vertexAttribDivisor(i,s.data.meshPerAttribute)}return t.bindBuffer(t.ARRAY_BUFFER,null),r}_getTransformFeedback(e){let t=\\\"\\\";for(let s=0;s\\u003ce.length;s++)t+=\\\":\\\"+e[s].id;let r=this.transformFeedbackCache[t];if(r!==void 0)return r;let{gl:i}=this;r=i.createTransformFeedback(),i.bindTransformFeedback(i.TRANSFORM_FEEDBACK,r);for(let s=0;s\\u003ce.length;s++){let a=e[s];i.bindBufferBase(i.TRANSFORM_FEEDBACK_BUFFER,s,a.transformBuffer)}return i.bindTransformFeedback(i.TRANSFORM_FEEDBACK,null),this.transformFeedbackCache[t]=r,r}_setupBindings(e,t){let r=this.gl,i=0,s=0;for(let a of e)for(let n of a.bindings)if(n.isUniformsGroup||n.isUniformBuffer){let o=i++,l=r.getUniformBlockIndex(t,n.name);r.uniformBlockBinding(t,l,o)}else if(n.isSampledTexture){let o=s++,l=r.getUniformLocation(t,n.name);r.uniform1i(l,o)}}_bindUniforms(e){let{gl:t,state:r}=this,i=0,s=0;for(let a of e)for(let n of a.bindings){let o=this.get(n);if(n.isUniformsGroup||n.isUniformBuffer){let l=i++;r.bindBufferBase(t.UNIFORM_BUFFER,l,o.bufferGPU)}else if(n.isSampledTexture){let l=s++;r.bindTexture(o.glTextureType,o.textureGPU,t.TEXTURE0+l)}}}_resolveRenderTarget(e){let{gl:t,state:r}=this,i=e.renderTarget;if(e.textures!==null&&i){let s=this.get(i);if(i.samples>0&&this._useMultisampledExtension(i)===!1){let a=s.framebuffers[e.getCacheKey()],n=t.COLOR_BUFFER_BIT;i.resolveDepthBuffer&&(i.depthBuffer&&(n|=t.DEPTH_BUFFER_BIT),i.stencilBuffer&&i.resolveStencilBuffer&&(n|=t.STENCIL_BUFFER_BIT));let o=s.msaaFrameBuffer,l=s.msaaRenderbuffers,u=e.textures,h=u.length>1;if(r.bindFramebuffer(t.READ_FRAMEBUFFER,o),r.bindFramebuffer(t.DRAW_FRAMEBUFFER,a),h)for(let d=0;d\\u003cu.length;d++)t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,null),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,null,0);for(let d=0;d\\u003cu.length;d++){if(h){let{textureGPU:c}=this.get(u[d]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,l[d]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,c,0)}if(e.scissor){let{x:c,y:m,width:g,height:y}=e.scissorValue,b=e.height-y-m;t.blitFramebuffer(c,b,c+g,b+y,c,b,c+g,b+y,n,t.NEAREST)}else t.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,n,t.NEAREST)}if(h)for(let d=0;d\\u003cu.length;d++){let{textureGPU:c}=this.get(u[d]);t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,l[d]),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,c,0)}this._supportsInvalidateFramebuffer===!0&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,s.invalidationArray)}else if(i.resolveDepthBuffer===!1&&s.framebuffers){let a=s.framebuffers[e.getCacheKey()];r.bindFramebuffer(t.DRAW_FRAMEBUFFER,a),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,s.depthInvalidationArray)}}}_useMultisampledExtension(e){return e.multiview===!0?!0:e.samples>0&&this.extensions.has(\\\"WEBGL_multisampled_render_to_texture\\\")===!0&&e._autoAllocateDepthBuffer!==!1}dispose(){this.textureUtils!==null&&this.textureUtils.dispose();let e=this.extensions.get(\\\"WEBGL_lose_context\\\");e&&e.loseContext(),this.renderer.domElement.removeEventListener(\\\"webglcontextlost\\\",this._onContextLost)}},im={PointList:\\\"point-list\\\",LineList:\\\"line-list\\\",LineStrip:\\\"line-strip\\\",TriangleList:\\\"triangle-list\\\"},Ln=typeof self\\u003c\\\"u\\\"&&self.GPUShaderStage?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4},Di={Never:\\\"never\\\",Less:\\\"less\\\",Equal:\\\"equal\\\",LessEqual:\\\"less-equal\\\",Greater:\\\"greater\\\",NotEqual:\\\"not-equal\\\",GreaterEqual:\\\"greater-equal\\\",Always:\\\"always\\\"},Ss={Store:\\\"store\\\"},Kt={Load:\\\"load\\\",Clear:\\\"clear\\\"},tB={CCW:\\\"ccw\\\",CW:\\\"cw\\\"},rB={None:\\\"none\\\",Back:\\\"back\\\"},Ry={Uint16:\\\"uint16\\\",Uint32:\\\"uint32\\\"},Z={R8Unorm:\\\"r8unorm\\\",R8Snorm:\\\"r8snorm\\\",R8Uint:\\\"r8uint\\\",R8Sint:\\\"r8sint\\\",R16Uint:\\\"r16uint\\\",R16Sint:\\\"r16sint\\\",R16Float:\\\"r16float\\\",RG8Unorm:\\\"rg8unorm\\\",RG8Snorm:\\\"rg8snorm\\\",RG8Uint:\\\"rg8uint\\\",RG8Sint:\\\"rg8sint\\\",R16Unorm:\\\"r16unorm\\\",R16Snorm:\\\"r16snorm\\\",R32Uint:\\\"r32uint\\\",R32Sint:\\\"r32sint\\\",R32Float:\\\"r32float\\\",RG16Uint:\\\"rg16uint\\\",RG16Sint:\\\"rg16sint\\\",RG16Float:\\\"rg16float\\\",RGBA8Unorm:\\\"rgba8unorm\\\",RGBA8UnormSRGB:\\\"rgba8unorm-srgb\\\",RGBA8Snorm:\\\"rgba8snorm\\\",RGBA8Uint:\\\"rgba8uint\\\",RGBA8Sint:\\\"rgba8sint\\\",BGRA8Unorm:\\\"bgra8unorm\\\",BGRA8UnormSRGB:\\\"bgra8unorm-srgb\\\",RG16Unorm:\\\"rg16unorm\\\",RG16Snorm:\\\"rg16snorm\\\",RGB9E5UFloat:\\\"rgb9e5ufloat\\\",RGB10A2Unorm:\\\"rgb10a2unorm\\\",RG11B10UFloat:\\\"rg11b10ufloat\\\",RG32Uint:\\\"rg32uint\\\",RG32Sint:\\\"rg32sint\\\",RG32Float:\\\"rg32float\\\",RGBA16Uint:\\\"rgba16uint\\\",RGBA16Sint:\\\"rgba16sint\\\",RGBA16Float:\\\"rgba16float\\\",RGBA16Unorm:\\\"rgba16unorm\\\",RGBA16Snorm:\\\"rgba16snorm\\\",RGBA32Uint:\\\"rgba32uint\\\",RGBA32Sint:\\\"rgba32sint\\\",RGBA32Float:\\\"rgba32float\\\",Depth16Unorm:\\\"depth16unorm\\\",Depth24Plus:\\\"depth24plus\\\",Depth24PlusStencil8:\\\"depth24plus-stencil8\\\",Depth32Float:\\\"depth32float\\\",Depth32FloatStencil8:\\\"depth32float-stencil8\\\",BC1RGBAUnorm:\\\"bc1-rgba-unorm\\\",BC1RGBAUnormSRGB:\\\"bc1-rgba-unorm-srgb\\\",BC2RGBAUnorm:\\\"bc2-rgba-unorm\\\",BC2RGBAUnormSRGB:\\\"bc2-rgba-unorm-srgb\\\",BC3RGBAUnorm:\\\"bc3-rgba-unorm\\\",BC3RGBAUnormSRGB:\\\"bc3-rgba-unorm-srgb\\\",BC4RUnorm:\\\"bc4-r-unorm\\\",BC4RSnorm:\\\"bc4-r-snorm\\\",BC5RGUnorm:\\\"bc5-rg-unorm\\\",BC5RGSnorm:\\\"bc5-rg-snorm\\\",BC6HRGBUFloat:\\\"bc6h-rgb-ufloat\\\",BC6HRGBFloat:\\\"bc6h-rgb-float\\\",BC7RGBAUnorm:\\\"bc7-rgba-unorm\\\",BC7RGBAUnormSRGB:\\\"bc7-rgba-unorm-srgb\\\",ETC2RGB8Unorm:\\\"etc2-rgb8unorm\\\",ETC2RGB8UnormSRGB:\\\"etc2-rgb8unorm-srgb\\\",ETC2RGB8A1Unorm:\\\"etc2-rgb8a1unorm\\\",ETC2RGB8A1UnormSRGB:\\\"etc2-rgb8a1unorm-srgb\\\",ETC2RGBA8Unorm:\\\"etc2-rgba8unorm\\\",ETC2RGBA8UnormSRGB:\\\"etc2-rgba8unorm-srgb\\\",EACR11Unorm:\\\"eac-r11unorm\\\",EACR11Snorm:\\\"eac-r11snorm\\\",EACRG11Unorm:\\\"eac-rg11unorm\\\",EACRG11Snorm:\\\"eac-rg11snorm\\\",ASTC4x4Unorm:\\\"astc-4x4-unorm\\\",ASTC4x4UnormSRGB:\\\"astc-4x4-unorm-srgb\\\",ASTC5x4Unorm:\\\"astc-5x4-unorm\\\",ASTC5x4UnormSRGB:\\\"astc-5x4-unorm-srgb\\\",ASTC5x5Unorm:\\\"astc-5x5-unorm\\\",ASTC5x5UnormSRGB:\\\"astc-5x5-unorm-srgb\\\",ASTC6x5Unorm:\\\"astc-6x5-unorm\\\",ASTC6x5UnormSRGB:\\\"astc-6x5-unorm-srgb\\\",ASTC6x6Unorm:\\\"astc-6x6-unorm\\\",ASTC6x6UnormSRGB:\\\"astc-6x6-unorm-srgb\\\",ASTC8x5Unorm:\\\"astc-8x5-unorm\\\",ASTC8x5UnormSRGB:\\\"astc-8x5-unorm-srgb\\\",ASTC8x6Unorm:\\\"astc-8x6-unorm\\\",ASTC8x6UnormSRGB:\\\"astc-8x6-unorm-srgb\\\",ASTC8x8Unorm:\\\"astc-8x8-unorm\\\",ASTC8x8UnormSRGB:\\\"astc-8x8-unorm-srgb\\\",ASTC10x5Unorm:\\\"astc-10x5-unorm\\\",ASTC10x5UnormSRGB:\\\"astc-10x5-unorm-srgb\\\",ASTC10x6Unorm:\\\"astc-10x6-unorm\\\",ASTC10x6UnormSRGB:\\\"astc-10x6-unorm-srgb\\\",ASTC10x8Unorm:\\\"astc-10x8-unorm\\\",ASTC10x8UnormSRGB:\\\"astc-10x8-unorm-srgb\\\",ASTC10x10Unorm:\\\"astc-10x10-unorm\\\",ASTC10x10UnormSRGB:\\\"astc-10x10-unorm-srgb\\\",ASTC12x10Unorm:\\\"astc-12x10-unorm\\\",ASTC12x10UnormSRGB:\\\"astc-12x10-unorm-srgb\\\",ASTC12x12Unorm:\\\"astc-12x12-unorm\\\",ASTC12x12UnormSRGB:\\\"astc-12x12-unorm-srgb\\\"},t_={ClampToEdge:\\\"clamp-to-edge\\\",Repeat:\\\"repeat\\\",MirrorRepeat:\\\"mirror-repeat\\\"},Ta={Linear:\\\"linear\\\",Nearest:\\\"nearest\\\"},zt={Zero:\\\"zero\\\",One:\\\"one\\\",Src:\\\"src\\\",OneMinusSrc:\\\"one-minus-src\\\",SrcAlpha:\\\"src-alpha\\\",OneMinusSrcAlpha:\\\"one-minus-src-alpha\\\",Dst:\\\"dst\\\",OneMinusDst:\\\"one-minus-dst\\\",DstAlpha:\\\"dst-alpha\\\",OneMinusDstAlpha:\\\"one-minus-dst-alpha\\\",SrcAlphaSaturated:\\\"src-alpha-saturated\\\",Constant:\\\"constant\\\",OneMinusConstant:\\\"one-minus-constant\\\"},Yu={Add:\\\"add\\\",Subtract:\\\"subtract\\\",ReverseSubtract:\\\"reverse-subtract\\\",Min:\\\"min\\\",Max:\\\"max\\\"},iB={None:0,All:15},Bl={Keep:\\\"keep\\\",Zero:\\\"zero\\\",Replace:\\\"replace\\\",Invert:\\\"invert\\\",IncrementClamp:\\\"increment-clamp\\\",DecrementClamp:\\\"decrement-clamp\\\",IncrementWrap:\\\"increment-wrap\\\",DecrementWrap:\\\"decrement-wrap\\\"},sB={Storage:\\\"storage\\\",ReadOnlyStorage:\\\"read-only-storage\\\"},r_={WriteOnly:\\\"write-only\\\",ReadOnly:\\\"read-only\\\",ReadWrite:\\\"read-write\\\"},aB={NonFiltering:\\\"non-filtering\\\",Comparison:\\\"comparison\\\"},Zu={Float:\\\"float\\\",UnfilterableFloat:\\\"unfilterable-float\\\",Depth:\\\"depth\\\",SInt:\\\"sint\\\",UInt:\\\"uint\\\"},nB={TwoD:\\\"2d\\\",ThreeD:\\\"3d\\\"},Oi={TwoD:\\\"2d\\\",TwoDArray:\\\"2d-array\\\",Cube:\\\"cube\\\",ThreeD:\\\"3d\\\"},sX={All:\\\"all\\\"},Ey={Vertex:\\\"vertex\\\",Instance:\\\"instance\\\"},Py={CoreFeaturesAndLimits:\\\"core-features-and-limits\\\",DepthClipControl:\\\"depth-clip-control\\\",Depth32FloatStencil8:\\\"depth32float-stencil8\\\",TextureCompressionBC:\\\"texture-compression-bc\\\",TextureCompressionBCSliced3D:\\\"texture-compression-bc-sliced-3d\\\",TextureCompressionETC2:\\\"texture-compression-etc2\\\",TextureCompressionASTC:\\\"texture-compression-astc\\\",TextureCompressionASTCSliced3D:\\\"texture-compression-astc-sliced-3d\\\",TimestampQuery:\\\"timestamp-query\\\",IndirectFirstInstance:\\\"indirect-first-instance\\\",ShaderF16:\\\"shader-f16\\\",RG11B10UFloat:\\\"rg11b10ufloat-renderable\\\",BGRA8UNormStorage:\\\"bgra8unorm-storage\\\",Float32Filterable:\\\"float32-filterable\\\",Float32Blendable:\\\"float32-blendable\\\",ClipDistances:\\\"clip-distances\\\",DualSourceBlending:\\\"dual-source-blending\\\",Subgroups:\\\"subgroups\\\",TextureFormatsTier1:\\\"texture-formats-tier1\\\",TextureFormatsTier2:\\\"texture-formats-tier2\\\"},oB={\\\"texture-compression-s3tc\\\":\\\"texture-compression-bc\\\",\\\"texture-compression-etc1\\\":\\\"texture-compression-etc2\\\"},aX=class extends V3{constructor(e,t,r){super(e,t?t.value:null),this.textureNode=t,this.groupNode=r}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},nX=class extends D3{constructor(e,t){super(e,t?t.array:null),this._attribute=t,this.isStorageBuffer=!0}get attribute(){return this._attribute}},oX=0,lX=class extends nX{constructor(e,t){super(\\\"StorageBuffer_\\\"+oX++,e?e.value:null),this.nodeUniform=e,this.access=e?e.access:Fi.READ_WRITE,this.groupNode=t}get attribute(){return this.nodeUniform.value}get buffer(){return this.nodeUniform.value.array}},i_=[null],uX=class{constructor(e){this.backend=e,this._preferredCanvasFormat=null}getCurrentDepthStencilFormat(e){let t;return e.depth&&(e.depthTexture!==null?t=this.getTextureFormatGPU(e.depthTexture):e.stencil?this.backend.renderer.reversedDepthBuffer===!0?t=Z.Depth32FloatStencil8:t=Z.Depth24PlusStencil8:this.backend.renderer.reversedDepthBuffer===!0?t=Z.Depth32Float:t=Z.Depth24Plus),t}getTextureFormatGPU(e){return this.backend.get(e).format}getTextureSampleData(e){let t;if(e.isFramebufferTexture)t=1;else if(e.isDepthTexture&&!e.renderTarget){let i=this.backend.renderer,s=i.getRenderTarget();t=s?s.samples:i.currentSamples}else e.renderTarget&&(t=e.renderTarget.samples);t=this.getSampleCount(t||1);let r=t>1&&e.renderTarget!==null&&e.isDepthTexture!==!0&&e.isFramebufferTexture!==!0;return{samples:t,primarySamples:r?1:t,isMSAA:r}}getCurrentColorFormat(e){let t;return e.textures!==null?t=this.getTextureFormatGPU(e.textures[0]):t=this.getPreferredCanvasFormat(),t}getCurrentColorFormats(e){return e.textures!==null?e.textures.map(t=>this.getTextureFormatGPU(t)):[this.getPreferredCanvasFormat()]}getCurrentColorSpace(e){return e.textures!==null?e.textures[0].colorSpace:this.backend.renderer.outputColorSpace}getPrimitiveTopology(e,t){if(e.isPoints)return im.PointList;if(e.isLineSegments||e.isMesh&&t.wireframe===!0)return im.LineList;if(e.isLine)return im.LineStrip;if(e.isMesh)return im.TriangleList}getSampleCount(e){return e>=4?4:1}getSampleCountRenderContext(e){return e.textures!==null?this.getSampleCount(e.sampleCount):this.getSampleCount(this.backend.renderer.currentSamples)}getPreferredCanvasFormat(){let e=this.backend.parameters.outputType;if(e===void 0)return this._preferredCanvasFormat===null&&(this._preferredCanvasFormat=navigator.gpu.getPreferredCanvasFormat()),this._preferredCanvasFormat;if(e===Si)return Z.BGRA8Unorm;if(e===Dt)return Z.RGBA16Float;throw new Error(\\\"THREE.WebGPUUtils: Unsupported output buffer type.\\\")}};function kn(e,t){i_[0]=t,e.queue.submit(i_),i_[0]=null}var lB=class{constructor(){this.label=\\\"\\\",this.layout=null,this.entries=[]}reset(){this.label=\\\"\\\",this.layout=null,this.entries.length=0}},Wd=class{constructor(){this.label=\\\"\\\",this.size=0,this.usage=0,this.mappedAtCreation=!1}reset(){this.label=\\\"\\\",this.size=0,this.usage=0,this.mappedAtCreation=!1}},sm=class{constructor(){this.label=\\\"\\\"}reset(){this.label=\\\"\\\"}},uB=class{constructor(){this.label=\\\"\\\",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}reset(){this.label=\\\"\\\",this.colorFormats=null,this.depthStencilFormat=void 0,this.sampleCount=1,this.depthReadOnly=!1,this.stencilReadOnly=!1}},am=class{constructor(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}reset(){this.view=null,this.depthSlice=void 0,this.resolveTarget=void 0,this.clearValue=void 0,this.loadOp=void 0,this.storeOp=void 0}},nm=class{constructor(){this.label=\\\"\\\",this.colorAttachments=[],this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}reset(){this.label=\\\"\\\",this.colorAttachments.length=0,this.depthStencilAttachment=void 0,this.occlusionQuerySet=void 0,this.timestampWrites=void 0,this.maxDrawCount=5e7}},hB=class{constructor(){this.label=\\\"\\\",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample=new hX,this.fragment=null}reset(){this.label=\\\"\\\",this.layout=null,this.vertex=null,this.primitive={},this.depthStencil=void 0,this.multisample.reset(),this.fragment=null}},hX=class{constructor(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}reset(){this.count=1,this.mask=4294967295,this.alphaToCoverageEnabled=!1}},dB=class{constructor(){this.label=\\\"\\\",this.code=\\\"\\\",this.compilationHints=[]}reset(){this.label=\\\"\\\",this.code=\\\"\\\",this.compilationHints.length=0}},s_=class{constructor(){this.label=\\\"\\\",this.size={width:0,height:1,depthOrArrayLayers:1},this.mipLevelCount=1,this.sampleCount=1,this.dimension=\\\"2d\\\",this.format=void 0,this.usage=void 0,this.viewFormats=[],this.textureBindingViewDimension=void 0}reset(){this.label=\\\"\\\",this.size.width=0,this.size.height=1,this.size.depthOrArrayLayers=1,this.mipLevelCount=1,this.sampleCount=1,this.dimension=\\\"2d\\\",this.format=void 0,this.usage=void 0,this.viewFormats.length=0,this.textureBindingViewDimension=void 0}},a_=class{constructor(){this.label=\\\"\\\",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect=\\\"all\\\",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle=\\\"rgba\\\"}reset(){this.label=\\\"\\\",this.format=void 0,this.dimension=void 0,this.usage=0,this.aspect=\\\"all\\\",this.baseMipLevel=0,this.mipLevelCount=void 0,this.baseArrayLayer=0,this.arrayLayerCount=void 0,this.swizzle=\\\"rgba\\\"}},Il=new lB,Fl=new Wd,By=new sm,n_=new uB,o_=new nm,jd=new hB,om=new am,Iy=new dB,Hd=new s_,jr=new a_,dX=class extends Nl{constructor(e){super(),this.device=e;let t=`\\nstruct VarysStruct {\\n\\t@builtin( position ) Position: vec4f,\\n\\t@location( 0 ) vTex : vec2f,\\n\\t@location( 1 ) @interpolate(flat, either) vBaseArrayLayer: u32,\\n};\\n\\n@group( 0 ) @binding ( 2 )\\nvar\\u003cuniform> flipY: u32;\\n\\n@vertex\\nfn mainVS(\\n\\t\\t@builtin( vertex_index ) vertexIndex : u32,\\n\\t\\t@builtin( instance_index ) instanceIndex : u32 ) -> VarysStruct {\\n\\n\\tvar Varys : VarysStruct;\\n\\n\\tvar pos = array(\\n\\t\\tvec2f( -1, -1 ),\\n\\t\\tvec2f( -1, 3 ),\\n\\t\\tvec2f( 3, -1 ),\\n\\t);\\n\\n\\tlet p = pos[ vertexIndex ];\\n\\tlet mult = select( vec2f( 0.5, -0.5 ), vec2f( 0.5, 0.5 ), flipY != 0 );\\n\\tVarys.vTex = p * mult + vec2f( 0.5 );\\n\\tVarys.Position = vec4f( p, 0, 1 );\\n\\tVarys.vBaseArrayLayer = instanceIndex;\\n\\n\\treturn Varys;\\n\\n}\\n\\n@group( 0 ) @binding( 0 )\\nvar imgSampler : sampler;\\n\\n@group( 0 ) @binding( 1 )\\nvar img2d : texture_2d\\u003cf32>;\\n\\n@fragment\\nfn main_2d( Varys: VarysStruct ) -> @location( 0 ) vec4\\u003cf32> {\\n\\n\\treturn textureSample( img2d, imgSampler, Varys.vTex );\\n\\n}\\n\\n@group( 0 ) @binding( 1 )\\nvar img2dArray : texture_2d_array\\u003cf32>;\\n\\n@fragment\\nfn main_2d_array( Varys: VarysStruct ) -> @location( 0 ) vec4\\u003cf32> {\\n\\n\\treturn textureSample( img2dArray, imgSampler, Varys.vTex, Varys.vBaseArrayLayer );\\n\\n}\\n\\nconst faceMat = array(\\n mat3x3f( 0, 0, -2, 0, -2, 0, 1, 1, 1 ), // pos-x\\n mat3x3f( 0, 0, 2, 0, -2, 0, -1, 1, -1 ), // neg-x\\n mat3x3f( 2, 0, 0, 0, 0, 2, -1, 1, -1 ), // pos-y\\n mat3x3f( 2, 0, 0, 0, 0, -2, -1, -1, 1 ), // neg-y\\n mat3x3f( 2, 0, 0, 0, -2, 0, -1, 1, 1 ), // pos-z\\n mat3x3f( -2, 0, 0, 0, -2, 0, 1, 1, -1 ), // neg-z\\n);\\n\\n@group( 0 ) @binding( 1 )\\nvar imgCube : texture_cube\\u003cf32>;\\n\\n@fragment\\nfn main_cube( Varys: VarysStruct ) -> @location( 0 ) vec4\\u003cf32> {\\n\\n\\treturn textureSample( imgCube, imgSampler, faceMat[ Varys.vBaseArrayLayer ] * vec3f( fract( Varys.vTex ), 1 ) );\\n\\n}\\n`;this.mipmapSampler=e.createSampler({minFilter:Ta.Linear}),this.flipYSampler=e.createSampler({minFilter:Ta.Nearest}),Fl.size=4,Fl.usage=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,this.flipUniformBuffer=e.createBuffer(Fl),Fl.reset(),e.queue.writeBuffer(this.flipUniformBuffer,0,new Uint32Array([1])),Fl.size=4,Fl.usage=GPUBufferUsage.UNIFORM,this.noFlipUniformBuffer=e.createBuffer(Fl),Fl.reset(),this.transferPipelines={},Iy.label=\\\"mipmap\\\",Iy.code=t,this.mipmapShaderModule=e.createShaderModule(Iy),Iy.reset()}getTransferPipeline(e,t){t=t||\\\"2d-array\\\";let r=`${e}-${t}`,i=this.transferPipelines[r];return i===void 0&&(jd.label=`mipmap-${e}-${t}`,jd.vertex={module:this.mipmapShaderModule},jd.fragment={module:this.mipmapShaderModule,entryPoint:`main_${t.replace(\\\"-\\\",\\\"_\\\")}`,targets:[{format:e}]},jd.layout=\\\"auto\\\",i=this.device.createRenderPipeline(jd),jd.reset(),this.transferPipelines[r]=i),i}flipY(e,t,r=0){let i=t.format,{width:s,height:a}=t.size;Hd.size.width=s,Hd.size.height=a,Hd.format=i,Hd.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING;let n=this.device.createTexture(Hd);Hd.reset();let o=this.getTransferPipeline(i,e.textureBindingViewDimension),l=this.getTransferPipeline(i,n.textureBindingViewDimension),u=this.device.createCommandEncoder(By),h=(d,c,m,g,y,b)=>{let v=d.getBindGroupLayout(0);jr.dimension=c.textureBindingViewDimension||\\\"2d-array\\\",jr.mipLevelCount=1;let S=c.createView(jr);jr.reset(),Il.layout=v,Il.entries.push({binding:0,resource:this.flipYSampler},{binding:1,resource:S},{binding:2,resource:{buffer:b?this.flipUniformBuffer:this.noFlipUniformBuffer}});let T=this.device.createBindGroup(Il);Il.reset(),jr.dimension=\\\"2d\\\",jr.mipLevelCount=1,jr.baseArrayLayer=y,jr.arrayLayerCount=1;let w=g.createView(jr);jr.reset(),om.view=w,om.loadOp=Kt.Clear,om.storeOp=Ss.Store,o_.colorAttachments.push(om);let N=u.beginRenderPass(o_);o_.reset(),om.reset(),N.setPipeline(d),N.setBindGroup(0,T),N.draw(3,1,0,m),N.end()};h(o,e,r,n,0,!1),h(l,n,0,e,r,!0),kn(this.device,u.finish()),n.destroy()}generateMipmaps(e,t=null){let r=this.get(e),i=r.layers||this._mipmapCreateBundles(e),s=t;s===null&&(By.label=\\\"mipmapEncoder\\\",s=this.device.createCommandEncoder(By),By.reset()),this._mipmapRunBundles(s,i),t===null&&kn(this.device,s.finish()),r.layers=i}_mipmapCreateBundles(e){let t=e.textureBindingViewDimension||\\\"2d-array\\\",r=this.getTransferPipeline(e.format,t),i=r.getBindGroupLayout(0),s=[];for(let a=1;a\\u003ce.mipLevelCount;a++)for(let n=0;n\\u003ce.depthOrArrayLayers;n++){jr.dimension=t,jr.baseMipLevel=a-1,jr.mipLevelCount=1;let o=e.createView(jr);jr.reset(),Il.layout=i,Il.entries.push({binding:0,resource:this.mipmapSampler},{binding:1,resource:o},{binding:2,resource:{buffer:this.noFlipUniformBuffer}});let l=this.device.createBindGroup(Il);Il.reset(),jr.dimension=\\\"2d\\\",jr.baseMipLevel=a,jr.mipLevelCount=1,jr.baseArrayLayer=n,jr.arrayLayerCount=1;let u=e.createView(jr);jr.reset();let h=new am;h.view=u,h.loadOp=Kt.Clear,h.storeOp=Ss.Store;let d=new nm;d.colorAttachments.push(h),n_.colorFormats=[e.format];let c=this.device.createRenderBundleEncoder(n_);n_.reset(),c.setPipeline(r),c.setBindGroup(0,l),c.draw(3,1,0,n),s.push({renderBundles:[c.finish()],passDescriptor:d})}return s}_mipmapRunBundles(e,t){let r=t.length;for(let i=0;i\\u003cr;i++){let s=t[i],a=e.beginRenderPass(s.passDescriptor);a.executeBundles(s.renderBundles),a.end()}}},cX=class{constructor(){this.label=\\\"\\\",this.addressModeU=\\\"clamp-to-edge\\\",this.addressModeV=\\\"clamp-to-edge\\\",this.addressModeW=\\\"clamp-to-edge\\\",this.magFilter=\\\"nearest\\\",this.minFilter=\\\"nearest\\\",this.mipmapFilter=\\\"nearest\\\",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}reset(){this.label=\\\"\\\",this.addressModeU=\\\"clamp-to-edge\\\",this.addressModeV=\\\"clamp-to-edge\\\",this.addressModeW=\\\"clamp-to-edge\\\",this.magFilter=\\\"nearest\\\",this.minFilter=\\\"nearest\\\",this.mipmapFilter=\\\"nearest\\\",this.lodMinClamp=0,this.lodMaxClamp=32,this.compare=void 0,this.maxAnisotropy=1}},Fy=class{constructor(){this.texture=null,this.mipLevel=0,this.origin={x:0,y:0,z:0},this.aspect=\\\"all\\\"}reset(){this.texture=null,this.mipLevel=0,this.origin.x=0,this.origin.y=0,this.origin.z=0,this.aspect=\\\"all\\\"}},pX=class{constructor(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.buffer=null,this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},mX=class{constructor(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}reset(){this.offset=0,this.bytesPerRow=void 0,this.rowsPerImage=void 0}},fX=class{constructor(){this.source=null,this.origin={x:0,y:0},this.flipY=!1}reset(){this.source=null,this.origin.x=0,this.origin.y=0,this.flipY=!1}},gX=class extends Fy{constructor(){super(),this.colorSpace=\\\"srgb\\\",this.premultipliedAlpha=!1}reset(){super.reset(),this.colorSpace=\\\"srgb\\\",this.premultipliedAlpha=!1}},cB=class{constructor(){this.width=0,this.height=1,this.depthOrArrayLayers=1}reset(){this.width=0,this.height=1,this.depthOrArrayLayers=1}},Ly=new Wd,yX=new sm,es=new cX,ts=new Fy,ky=new pX,Co=new mX,Dy=new fX,Xd=new gX,Ll=new s_,rs=new cB,xX={[LM]:\\\"never\\\",[yv]:\\\"less\\\",[kM]:\\\"equal\\\",[tp]:\\\"less-equal\\\",[fg]:\\\"greater\\\",[$h]:\\\"greater-equal\\\",[OM]:\\\"always\\\",[DM]:\\\"not-equal\\\"},vX=[0,1,3,2,4,5];function pB(e,t,r,i,s,a,n,o,l,u){ts.texture=t,ts.mipLevel=r,ts.origin.z=i,Co.offset=i*a,Co.bytesPerRow=n,Co.rowsPerImage=o,rs.width=l,rs.height=u,e.queue.writeTexture(ts,s.data,Co,rs),ts.reset(),Co.reset(),rs.reset()}var bX=class{constructor(e){this.backend=e,this._passUtils=null,this.defaultTexture={},this.defaultCubeTexture={},this.defaultVideoFrame=null,this._samplerCache=new Map}updateSampler(e){let t=this.backend,r=e.texture,i=e.textureNode,s=r.minFilter+\\\"-\\\"+r.magFilter+\\\"-\\\"+r.wrapS+\\\"-\\\"+r.wrapT+\\\"-\\\"+(r.wrapR||\\\"0\\\")+\\\"-\\\"+r.anisotropy+\\\"-\\\"+(r.isDepthTexture===!0?1:0)+\\\"-\\\"+(r.compareFunction!==null&&i.compareNode!==null?r.compareFunction:0),a=this._samplerCache.get(s);if(a===void 0){es.addressModeU=this._convertAddressMode(r.wrapS),es.addressModeV=this._convertAddressMode(r.wrapT),es.addressModeW=this._convertAddressMode(r.wrapR),es.magFilter=this._convertFilterMode(r.magFilter),es.minFilter=this._convertFilterMode(r.minFilter),es.mipmapFilter=this._convertMipmapFilterMode(r.minFilter),r.isDepthTexture&&(r.compareFunction===null||i.compareNode===null)&&(es.magFilter=Ta.Nearest,es.minFilter=Ta.Nearest,es.mipmapFilter=Ta.Nearest),es.magFilter===Ta.Linear&&es.minFilter===Ta.Linear&&es.mipmapFilter===Ta.Linear&&(es.maxAnisotropy=r.anisotropy),r.isDepthTexture&&r.compareFunction!==null&&i.compareNode!==null&&t.hasCompatibility(fu.TEXTURE_COMPARE)&&(es.compare=xX[r.compareFunction]);let o=t.device.createSampler(es);es.reset(),a={sampler:o,usedTimes:0},this._samplerCache.set(s,a)}let n=t.get(e);return n.sampler!==a.sampler&&(this._releaseSampler(n),n.samplerKey=s,n.sampler=a.sampler,a.usedTimes++),s}destroySampler(e){this._releaseSampler(this.backend.get(e))}_releaseSampler(e){if(e.sampler!==void 0){let t=this._samplerCache.get(e.samplerKey);t.usedTimes--,t.usedTimes===0&&this._samplerCache.delete(e.samplerKey),e.sampler=void 0,e.samplerKey=void 0}}createDefaultTexture(e){let t,r=l_(e,this.backend.device);e.isCubeTexture?t=this._getDefaultCubeTextureGPU(r):t=this._getDefaultTextureGPU(r),this.backend.get(e).texture=t}createTexture(e,t={}){let r=this.backend,i=r.get(e);if(i.initialized){if(i.externalTexture===!0)return;throw new Error(\\\"THREE.WebGPUTextureUtils: Texture already initialized.\\\")}if(e.isExternalTexture){i.texture=e.sourceTexture,i.initialized=!0;return}t.needsMipmaps===void 0&&(t.needsMipmaps=!1),t.levels===void 0&&(t.levels=1),t.depth===void 0&&(t.depth=1);let{width:s,height:a,depth:n,levels:o}=t;e.isFramebufferTexture&&(t.renderTarget?t.format=this.backend.utils.getCurrentColorFormat(t.renderTarget):t.format=this.backend.utils.getPreferredCanvasFormat());let l=this._getDimension(e),u=e.internalFormat||t.format||l_(e,r.device);i.format=u;let{samples:h,primarySamples:d,isMSAA:c}=r.utils.getTextureSampleData(e),m=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC;e.isStorageTexture===!0&&(m|=GPUTextureUsage.STORAGE_BINDING),e.isCompressedTexture!==!0&&e.isCompressedArrayTexture!==!0&&u!==Z.RGB9E5UFloat&&(m|=GPUTextureUsage.RENDER_ATTACHMENT);let g=new s_;if(g.label=e.name,g.size.width=s,g.size.height=a,g.size.depthOrArrayLayers=n,g.mipLevelCount=o,g.sampleCount=d,g.dimension=l,g.format=u,g.usage=m,u===void 0){Ue(\\\"WebGPURenderer: Texture format not supported.\\\"),this.createDefaultTexture(e);return}e.isCubeTexture&&(g.textureBindingViewDimension=Oi.Cube);try{i.texture=r.device.createTexture(g)}catch{Ue(\\\"WebGPURenderer: Failed to create texture with descriptor:\\\",g),this.createDefaultTexture(e);return}if(c){let y=Object.assign({},g);y.label=y.label+\\\"-msaa\\\",y.sampleCount=h,y.mipLevelCount=1,i.msaaTexture=r.device.createTexture(y)}i.initialized=!0,i.textureDescriptorGPU=g}destroyTexture(e,t=!1){let r=this.backend,i=r.get(e);i.texture!==void 0&&t===!1&&e.isExternalTexture!==!0&&i.texture.destroy(),i.msaaTexture!==void 0&&i.msaaTexture.destroy(),r.delete(e)}generateMipmaps(e,t=null){let r=this.backend.get(e);this._generateMipmaps(r.texture,t)}getColorBuffer(){let e=this.backend,t=e.renderer.getCanvasTarget(),{width:r,height:i}=e.getDrawingBufferSize(),s=e.renderer.currentSamples,a=t.colorTexture,n=e.get(a);if(a.width===r&&a.height===i&&a.samples===s)return n.texture;let o=n.texture;return o&&o.destroy(),Ll.label=\\\"colorBuffer\\\",Ll.size.width=r,Ll.size.height=i,Ll.sampleCount=e.utils.getSampleCount(e.renderer.currentSamples),Ll.format=e.utils.getPreferredCanvasFormat(),Ll.usage=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,o=e.device.createTexture(Ll),Ll.reset(),a.source.width=r,a.source.height=i,a.samples=s,n.texture=o,o}getDepthBuffer(e=!0,t=!1){let r=this.backend,i=r.renderer.getCanvasTarget(),{width:s,height:a}=r.getDrawingBufferSize(),n=r.renderer.currentSamples,o=i.depthTexture;if(o.width===s&&o.height===a&&o.samples===n&&o.depth===e&&o.stencil===t)return r.get(o).texture;let l=r.get(o).texture,u,h;if(t?(u=ln,h=r.renderer.reversedDepthBuffer===!0?Er:ro):e&&(u=ua,h=r.renderer.reversedDepthBuffer===!0?Er:gr),l!==void 0){if(o.image.width===s&&o.image.height===a&&o.format===u&&o.type===h&&o.samples===n)return l;this.destroyTexture(o)}return o.name=\\\"depthBuffer\\\",o.format=u,o.type=h,o.image.width=s,o.image.height=a,o.samples=n,this.createTexture(o,{width:s,height:a}),r.get(o).texture}updateTexture(e,t){let r=this.backend.get(e),i=e.mipmaps,{textureDescriptorGPU:s}=r;if(!(e.isRenderTargetTexture||s===void 0)){if(e.isDataTexture)if(i.length>0)for(let a=0,n=i.length;a\\u003cn;a++){let o=i[a];this._copyBufferToTexture(o,r.texture,s,0,e.flipY,0,a)}else this._copyBufferToTexture(t.image,r.texture,s,0,e.flipY);else if(e.isArrayTexture||e.isDataArrayTexture||e.isData3DTexture)if(e.layerUpdates&&e.layerUpdates.size>0){for(let a of e.layerUpdates)this._copyBufferToTexture(t.image,r.texture,s,a,e.flipY,a);e.clearLayerUpdates()}else for(let a=0;a\\u003ct.image.depth;a++)this._copyBufferToTexture(t.image,r.texture,s,a,e.flipY,a);else if(e.isCompressedTexture||e.isCompressedArrayTexture)e.isCompressedArrayTexture&&e.layerUpdates.size>0?(this._copyCompressedBufferToTexture(e.mipmaps,r.texture,s,e.layerUpdates),e.clearLayerUpdates()):this._copyCompressedBufferToTexture(e.mipmaps,r.texture,s);else if(e.isCubeTexture)this._copyCubeMapToTexture(e,r.texture,s);else if(e.isHTMLTexture){let a=this.backend.device,n=this.backend.renderer.domElement,o=e.image;if(typeof a.queue.copyElementImageToTexture!=\\\"function\\\")return;if(!r.hasPaintCallback){r.hasPaintCallback=!0,n.requestPaint();return}let l=s.size.width,u=s.size.height;a.queue.copyElementImageToTexture.length===2?a.queue.copyElementImageToTexture({source:o},{destination:{texture:r.texture},width:l,height:u}):a.queue.copyElementImageToTexture(o,l,u,{texture:r.texture}),e.flipY&&this._flipY(r.texture,s)}else if(i.length>0)for(let a=0,n=i.length;a\\u003cn;a++){let o=i[a];this._copyImageToTexture(o,r.texture,s,0,e.flipY,e.premultiplyAlpha,a)}else this._copyImageToTexture(t.image,r.texture,s,0,e.flipY,e.premultiplyAlpha);r.version=e.version}}async copyTextureToBuffer(e,t,r,i,s,a){let n=this.backend.device,o=this.backend.get(e),l=o.texture,u=o.textureDescriptorGPU.format,h=this._getBytesPerTexel(u),d=i*h;d=Math.ceil(d/256)*256,Ly.size=(s-1)*d+i*h,Ly.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let c=n.createBuffer(Ly);Ly.reset();let m=n.createCommandEncoder(yX);ts.texture=l,ts.origin.x=t,ts.origin.y=r,ts.origin.z=a,ky.buffer=c,ky.bytesPerRow=d,rs.width=i,rs.height=s,m.copyTextureToBuffer(ts,ky,rs),ts.reset(),ky.reset(),rs.reset();let g=this._getTypedArrayType(u);kn(n,m.finish()),await c.mapAsync(GPUMapMode.READ);let y=c.getMappedRange().slice();return c.destroy(),new g(y)}dispose(){this._samplerCache.clear()}_getDefaultTextureGPU(e){let t=this.defaultTexture[e];if(t===void 0){let r=new ji;r.minFilter=or,r.magFilter=or,this.createTexture(r,{width:1,height:1,format:e}),this.defaultTexture[e]=t=r}return this.backend.get(t).texture}_getDefaultCubeTextureGPU(e){let t=this.defaultCubeTexture[e];if(t===void 0){let r=new Ug;r.minFilter=or,r.magFilter=or,this.createTexture(r,{width:1,height:1,depth:6}),this.defaultCubeTexture[e]=t=r}return this.backend.get(t).texture}_copyCubeMapToTexture(e,t,r){let i=e.images,s=e.mipmaps;for(let a=0;a\\u003c6;a++){let n=i[a],o=e.flipY===!0?vX[a]:a;n.isDataTexture?this._copyBufferToTexture(n.image,t,r,o,e.flipY):this._copyImageToTexture(n,t,r,o,e.flipY,e.premultiplyAlpha);for(let l=0;l\\u003cs.length;l++){let u=s[l].images[a];u.isDataTexture?this._copyBufferToTexture(u.image,t,r,o,e.flipY,0,l+1):this._copyImageToTexture(u,t,r,o,e.flipY,e.premultiplyAlpha,l+1)}}}_copyImageToTexture(e,t,r,i,s,a,n=0){let o=this.backend.device,l=n>0?e.width:r.size.width,u=n>0?e.height:r.size.height;Dy.source=e,Dy.flipY=s,Xd.texture=t,Xd.mipLevel=n,Xd.origin.z=i,Xd.premultipliedAlpha=a,rs.width=l,rs.height=u;try{o.queue.copyExternalImageToTexture(Dy,Xd,rs)}catch{}finally{Dy.reset(),Xd.reset(),rs.reset()}}_getPassUtils(){let e=this._passUtils;return e===null&&(this._passUtils=e=new dX(this.backend.device)),e}_generateMipmaps(e,t=null){this._getPassUtils().generateMipmaps(e,t)}_flipY(e,t,r=0){this._getPassUtils().flipY(e,t,r)}_copyBufferToTexture(e,t,r,i,s,a=0,n=0){let o=this.backend.device,l=e.data,u=this._getBytesPerTexel(r.format),h=e.width*u;ts.texture=t,ts.mipLevel=n,ts.origin.z=i,Co.offset=e.width*e.height*u*a,Co.bytesPerRow=h,rs.width=e.width,rs.height=e.height,o.queue.writeTexture(ts,l,Co,rs),ts.reset(),Co.reset(),rs.reset(),s===!0&&this._flipY(t,r,i)}_copyCompressedBufferToTexture(e,t,r,i=null){let s=this.backend.device,a=this._getBlockData(r.format),n=r.size.depthOrArrayLayers>1,o=i&&i.size>0?i:null;for(let l=0;l\\u003ce.length;l++){let u=e[l],h=u.width,d=u.height,c=n?r.size.depthOrArrayLayers:1,m=Math.ceil(h/a.width)*a.byteLength,g=Math.ceil(d/a.height),y=m*g,b=Math.ceil(h/a.width)*a.width,v=g*a.height;if(o!==null)for(let S of o)pB(s,t,l,S,u,y,m,g,b,v);else for(let S=0;S\\u003cc;S++)pB(s,t,l,S,u,y,m,g,b,v)}}_getBlockData(e){if(e===Z.BC1RGBAUnorm||e===Z.BC1RGBAUnormSRGB)return{byteLength:8,width:4,height:4};if(e===Z.BC2RGBAUnorm||e===Z.BC2RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===Z.BC3RGBAUnorm||e===Z.BC3RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===Z.BC4RUnorm||e===Z.BC4RSnorm)return{byteLength:8,width:4,height:4};if(e===Z.BC5RGUnorm||e===Z.BC5RGSnorm)return{byteLength:16,width:4,height:4};if(e===Z.BC6HRGBUFloat||e===Z.BC6HRGBFloat)return{byteLength:16,width:4,height:4};if(e===Z.BC7RGBAUnorm||e===Z.BC7RGBAUnormSRGB)return{byteLength:16,width:4,height:4};if(e===Z.ETC2RGB8Unorm||e===Z.ETC2RGB8UnormSRGB)return{byteLength:8,width:4,height:4};if(e===Z.ETC2RGB8A1Unorm||e===Z.ETC2RGB8A1UnormSRGB)return{byteLength:8,width:4,height:4};if(e===Z.ETC2RGBA8Unorm||e===Z.ETC2RGBA8UnormSRGB)return{byteLength:16,width:4,height:4};if(e===Z.EACR11Unorm)return{byteLength:8,width:4,height:4};if(e===Z.EACR11Snorm)return{byteLength:8,width:4,height:4};if(e===Z.EACRG11Unorm)return{byteLength:16,width:4,height:4};if(e===Z.EACRG11Snorm)return{byteLength:16,width:4,height:4};if(e===Z.ASTC4x4Unorm||e===Z.ASTC4x4UnormSRGB)return{byteLength:16,width:4,height:4};if(e===Z.ASTC5x4Unorm||e===Z.ASTC5x4UnormSRGB)return{byteLength:16,width:5,height:4};if(e===Z.ASTC5x5Unorm||e===Z.ASTC5x5UnormSRGB)return{byteLength:16,width:5,height:5};if(e===Z.ASTC6x5Unorm||e===Z.ASTC6x5UnormSRGB)return{byteLength:16,width:6,height:5};if(e===Z.ASTC6x6Unorm||e===Z.ASTC6x6UnormSRGB)return{byteLength:16,width:6,height:6};if(e===Z.ASTC8x5Unorm||e===Z.ASTC8x5UnormSRGB)return{byteLength:16,width:8,height:5};if(e===Z.ASTC8x6Unorm||e===Z.ASTC8x6UnormSRGB)return{byteLength:16,width:8,height:6};if(e===Z.ASTC8x8Unorm||e===Z.ASTC8x8UnormSRGB)return{byteLength:16,width:8,height:8};if(e===Z.ASTC10x5Unorm||e===Z.ASTC10x5UnormSRGB)return{byteLength:16,width:10,height:5};if(e===Z.ASTC10x6Unorm||e===Z.ASTC10x6UnormSRGB)return{byteLength:16,width:10,height:6};if(e===Z.ASTC10x8Unorm||e===Z.ASTC10x8UnormSRGB)return{byteLength:16,width:10,height:8};if(e===Z.ASTC10x10Unorm||e===Z.ASTC10x10UnormSRGB)return{byteLength:16,width:10,height:10};if(e===Z.ASTC12x10Unorm||e===Z.ASTC12x10UnormSRGB)return{byteLength:16,width:12,height:10};if(e===Z.ASTC12x12Unorm||e===Z.ASTC12x12UnormSRGB)return{byteLength:16,width:12,height:12}}_convertAddressMode(e){let t=t_.ClampToEdge;return e===to?t=t_.Repeat:e===Qo&&(t=t_.MirrorRepeat),t}_convertFilterMode(e){let t=Ta.Linear;return(e===or||e===RM||e===Gh)&&(t=Ta.Nearest),t}_convertMipmapFilterMode(e){return e===Gh||e===Ia?Ta.Linear:Ta.Nearest}_getBytesPerTexel(e){if(e===Z.R8Unorm||e===Z.R8Snorm||e===Z.R8Uint||e===Z.R8Sint)return 1;if(e===Z.R16Uint||e===Z.R16Sint||e===Z.R16Float||e===Z.RG8Unorm||e===Z.RG8Snorm||e===Z.RG8Uint||e===Z.RG8Sint||e===Z.R16Unorm||e===Z.R16Snorm)return 2;if(e===Z.R32Uint||e===Z.R32Sint||e===Z.R32Float||e===Z.RG16Uint||e===Z.RG16Sint||e===Z.RG16Float||e===Z.RGBA8Unorm||e===Z.RGBA8UnormSRGB||e===Z.RGBA8Snorm||e===Z.RGBA8Uint||e===Z.RGBA8Sint||e===Z.BGRA8Unorm||e===Z.BGRA8UnormSRGB||e===Z.RG16Unorm||e===Z.RG16Snorm||e===Z.RGB9E5UFloat||e===Z.RGB10A2Unorm||e===Z.RG11B10UFloat||e===Z.Depth32Float||e===Z.Depth24Plus||e===Z.Depth24PlusStencil8||e===Z.Depth32FloatStencil8)return 4;if(e===Z.RG32Uint||e===Z.RG32Sint||e===Z.RG32Float||e===Z.RGBA16Uint||e===Z.RGBA16Sint||e===Z.RGBA16Float||e===Z.RGBA16Unorm||e===Z.RGBA16Snorm)return 8;if(e===Z.RGBA32Uint||e===Z.RGBA32Sint||e===Z.RGBA32Float)return 16}_getTypedArrayType(e){if(e===Z.R8Uint)return Uint8Array;if(e===Z.R8Sint)return Int8Array;if(e===Z.R8Unorm)return Uint8Array;if(e===Z.R8Snorm)return Int8Array;if(e===Z.RG8Uint)return Uint8Array;if(e===Z.RG8Sint)return Int8Array;if(e===Z.RG8Unorm)return Uint8Array;if(e===Z.RG8Snorm)return Int8Array;if(e===Z.RGBA8Uint)return Uint8Array;if(e===Z.RGBA8Sint)return Int8Array;if(e===Z.RGBA8Unorm||e===Z.RGBA8UnormSRGB)return Uint8Array;if(e===Z.RGBA8Snorm)return Int8Array;if(e===Z.R16Uint)return Uint16Array;if(e===Z.R16Sint)return Int16Array;if(e===Z.RG16Uint)return Uint16Array;if(e===Z.RG16Sint)return Int16Array;if(e===Z.RGBA16Uint)return Uint16Array;if(e===Z.RGBA16Sint)return Int16Array;if(e===Z.R16Float||e===Z.RG16Float||e===Z.RGBA16Float||e===Z.R16Unorm)return Uint16Array;if(e===Z.R16Snorm)return Int16Array;if(e===Z.RG16Unorm)return Uint16Array;if(e===Z.RG16Snorm)return Int16Array;if(e===Z.RGBA16Unorm)return Uint16Array;if(e===Z.RGBA16Snorm)return Int16Array;if(e===Z.R32Uint)return Uint32Array;if(e===Z.R32Sint)return Int32Array;if(e===Z.R32Float)return Float32Array;if(e===Z.RG32Uint)return Uint32Array;if(e===Z.RG32Sint)return Int32Array;if(e===Z.RG32Float)return Float32Array;if(e===Z.RGBA32Uint)return Uint32Array;if(e===Z.RGBA32Sint)return Int32Array;if(e===Z.RGBA32Float)return Float32Array;if(e===Z.BGRA8Unorm||e===Z.BGRA8UnormSRGB)return Uint8Array;if(e===Z.RGB10A2Unorm||e===Z.RGB9E5UFloat||e===Z.RG11B10UFloat)return Uint32Array;if(e===Z.Depth32Float)return Float32Array;if(e===Z.Depth24Plus||e===Z.Depth24PlusStencil8)return Uint32Array;if(e===Z.Depth32FloatStencil8)return Float32Array}_getDimension(e){let t;return e.is3DTexture||e.isData3DTexture?t=nB.ThreeD:t=nB.TwoD,t}};function l_(e,t){let r=e.format,i=e.type,s=e.normalized,a=e.colorSpace,n=Gt.getTransfer(a),o,l=!1;if(s&&(l=t.features.has(Py.TextureFormatsTier1),l===!1&&Ue(\\\"WebGPURenderer: Unable to use normalized textures without texture-formats-tier1 feature.\\\")),e.isCompressedTexture===!0||e.isCompressedArrayTexture===!0)switch(r){case Yc:case Zc:o=n===Tt?Z.BC1RGBAUnormSRGB:Z.BC1RGBAUnorm;break;case Jc:o=n===Tt?Z.BC2RGBAUnormSRGB:Z.BC2RGBAUnorm;break;case Qc:o=n===Tt?Z.BC3RGBAUnormSRGB:Z.BC3RGBAUnorm;break;case hg:o=Z.BC4RUnorm;break;case dg:o=Z.BC4RSnorm;break;case ep:o=Z.BC5RGUnorm;break;case cg:o=Z.BC5RGSnorm;break;case og:o=n===Tt?Z.BC7RGBAUnormSRGB:Z.BC7RGBAUnorm;break;case lg:o=Z.BC6HRGBFloat;break;case ug:o=Z.BC6HRGBUFloat;break;case Gf:case Vf:o=n===Tt?Z.ETC2RGB8UnormSRGB:Z.ETC2RGB8Unorm;break;case Wf:o=n===Tt?Z.ETC2RGBA8UnormSRGB:Z.ETC2RGBA8Unorm;break;case jf:o=Z.EACR11Unorm;break;case Hf:o=Z.EACR11Snorm;break;case Kc:o=Z.EACRG11Unorm;break;case Xf:o=Z.EACRG11Snorm;break;case $f:o=n===Tt?Z.ASTC4x4UnormSRGB:Z.ASTC4x4Unorm;break;case qf:o=n===Tt?Z.ASTC5x4UnormSRGB:Z.ASTC5x4Unorm;break;case Yf:o=n===Tt?Z.ASTC5x5UnormSRGB:Z.ASTC5x5Unorm;break;case Zf:o=n===Tt?Z.ASTC6x5UnormSRGB:Z.ASTC6x5Unorm;break;case Jf:o=n===Tt?Z.ASTC6x6UnormSRGB:Z.ASTC6x6Unorm;break;case Qf:o=n===Tt?Z.ASTC8x5UnormSRGB:Z.ASTC8x5Unorm;break;case Kf:o=n===Tt?Z.ASTC8x6UnormSRGB:Z.ASTC8x6Unorm;break;case eg:o=n===Tt?Z.ASTC8x8UnormSRGB:Z.ASTC8x8Unorm;break;case tg:o=n===Tt?Z.ASTC10x5UnormSRGB:Z.ASTC10x5Unorm;break;case rg:o=n===Tt?Z.ASTC10x6UnormSRGB:Z.ASTC10x6Unorm;break;case ig:o=n===Tt?Z.ASTC10x8UnormSRGB:Z.ASTC10x8Unorm;break;case sg:o=n===Tt?Z.ASTC10x10UnormSRGB:Z.ASTC10x10Unorm;break;case ag:o=n===Tt?Z.ASTC12x10UnormSRGB:Z.ASTC12x10Unorm;break;case ng:o=n===Tt?Z.ASTC12x12UnormSRGB:Z.ASTC12x12Unorm;break;case pi:o=n===Tt?Z.RGBA8UnormSRGB:Z.RGBA8Unorm;break;default:Ce(\\\"WebGPURenderer: Unsupported texture format.\\\",r)}else switch(r){case pi:switch(i){case cu:o=Z.RGBA8Snorm;break;case pu:o=l?Z.RGBA16Snorm:Z.RGBA16Sint;break;case Ko:o=l?Z.RGBA16Unorm:Z.RGBA16Uint;break;case gr:o=Z.RGBA32Uint;break;case ci:o=Z.RGBA32Sint;break;case Si:o=n===Tt?Z.RGBA8UnormSRGB:Z.RGBA8Unorm;break;case Dt:o=Z.RGBA16Float;break;case Er:o=Z.RGBA32Float;break;default:Ce(\\\"WebGPURenderer: Unsupported texture type with RGBAFormat.\\\",i)}break;case Wh:switch(i){case Of:o=Z.RGB9E5UFloat;break;case Uf:o=Z.RG11B10UFloat;break;default:Ce(\\\"WebGPURenderer: Unsupported texture type with RGBFormat.\\\",i)}break;case io:switch(i){case cu:o=Z.R8Snorm;break;case pu:o=l?Z.R16Snorm:Z.R16Sint;break;case Ko:o=l?Z.R16Unorm:Z.R16Uint;break;case gr:o=Z.R32Uint;break;case ci:o=Z.R32Sint;break;case Si:o=Z.R8Unorm;break;case Dt:o=Z.R16Float;break;case Er:o=Z.R32Float;break;default:Ce(\\\"WebGPURenderer: Unsupported texture type with RedFormat.\\\",i)}break;case ha:switch(i){case cu:o=Z.RG8Snorm;break;case pu:o=l?Z.RG16Snorm:Z.RG16Sint;break;case Ko:o=l?Z.RG16Unorm:Z.RG16Uint;break;case gr:o=Z.RG32Uint;break;case ci:o=Z.RG32Sint;break;case Si:o=Z.RG8Unorm;break;case Dt:o=Z.RG16Float;break;case Er:o=Z.RG32Float;break;default:Ce(\\\"WebGPURenderer: Unsupported texture type with RGFormat.\\\",i)}break;case ua:switch(i){case Ko:o=Z.Depth16Unorm;break;case gr:o=Z.Depth24Plus;break;case Er:o=Z.Depth32Float;break;default:Ce(\\\"WebGPURenderer: Unsupported texture type with DepthFormat.\\\",i)}break;case ln:switch(i){case ro:o=Z.Depth24PlusStencil8;break;case Er:t&&t.features.has(Py.Depth32FloatStencil8)===!1&&Ce('WebGPURenderer: Depth textures with DepthStencilFormat + FloatType can only be used with the \\\"depth32float-stencil8\\\" GPU feature.'),o=Z.Depth32FloatStencil8;break;default:Ce(\\\"WebGPURenderer: Unsupported texture type with DepthStencilFormat.\\\",i)}break;case jh:switch(i){case ci:o=Z.R32Sint;break;case gr:o=Z.R32Uint;break;default:Ce(\\\"WebGPURenderer: Unsupported texture type with RedIntegerFormat.\\\",i)}break;case Hh:switch(i){case ci:o=Z.RG32Sint;break;case gr:o=Z.RG32Uint;break;default:Ce(\\\"WebGPURenderer: Unsupported texture type with RGIntegerFormat.\\\",i)}break;case zf:switch(i){case ci:o=Z.RGBA32Sint;break;case gr:o=Z.RGBA32Uint;break;default:Ce(\\\"WebGPURenderer: Unsupported texture type with RGBAIntegerFormat.\\\",i)}break;default:Ce(\\\"WebGPURenderer: Unsupported texture format.\\\",r)}return o}var TX=/^[fn]*\\\\s*([a-z_0-9]+)?\\\\s*\\\\(([\\\\s\\\\S]*?)\\\\)\\\\s*[\\\\-\\\\>]*\\\\s*([a-z_0-9]+(?:\\u003c[\\\\s\\\\S]+?>)?)/i,SX=/([a-z_0-9]+)\\\\s*:\\\\s*([a-z_0-9]+(?:\\u003c[\\\\s\\\\S]+?>)?)/gi,mB={f32:\\\"float\\\",i32:\\\"int\\\",u32:\\\"uint\\\",bool:\\\"bool\\\",\\\"vec2\\u003cf32>\\\":\\\"vec2\\\",\\\"vec2\\u003ci32>\\\":\\\"ivec2\\\",\\\"vec2\\u003cu32>\\\":\\\"uvec2\\\",\\\"vec2\\u003cbool>\\\":\\\"bvec2\\\",vec2f:\\\"vec2\\\",vec2i:\\\"ivec2\\\",vec2u:\\\"uvec2\\\",vec2b:\\\"bvec2\\\",\\\"vec3\\u003cf32>\\\":\\\"vec3\\\",\\\"vec3\\u003ci32>\\\":\\\"ivec3\\\",\\\"vec3\\u003cu32>\\\":\\\"uvec3\\\",\\\"vec3\\u003cbool>\\\":\\\"bvec3\\\",vec3f:\\\"vec3\\\",vec3i:\\\"ivec3\\\",vec3u:\\\"uvec3\\\",vec3b:\\\"bvec3\\\",\\\"vec4\\u003cf32>\\\":\\\"vec4\\\",\\\"vec4\\u003ci32>\\\":\\\"ivec4\\\",\\\"vec4\\u003cu32>\\\":\\\"uvec4\\\",\\\"vec4\\u003cbool>\\\":\\\"bvec4\\\",vec4f:\\\"vec4\\\",vec4i:\\\"ivec4\\\",vec4u:\\\"uvec4\\\",vec4b:\\\"bvec4\\\",\\\"mat2x2\\u003cf32>\\\":\\\"mat2\\\",mat2x2f:\\\"mat2\\\",\\\"mat3x3\\u003cf32>\\\":\\\"mat3\\\",mat3x3f:\\\"mat3\\\",\\\"mat4x4\\u003cf32>\\\":\\\"mat4\\\",mat4x4f:\\\"mat4\\\",sampler:\\\"sampler\\\",texture_1d:\\\"texture\\\",texture_2d:\\\"texture\\\",texture_2d_array:\\\"texture\\\",texture_multisampled_2d:\\\"cubeTexture\\\",texture_depth_2d:\\\"depthTexture\\\",texture_depth_2d_array:\\\"depthTexture\\\",texture_depth_multisampled_2d:\\\"depthTexture\\\",texture_depth_cube:\\\"depthTexture\\\",texture_depth_cube_array:\\\"depthTexture\\\",texture_3d:\\\"texture3D\\\",texture_cube:\\\"cubeTexture\\\",texture_cube_array:\\\"cubeTexture\\\",texture_storage_1d:\\\"storageTexture\\\",texture_storage_2d:\\\"storageTexture\\\",texture_storage_2d_array:\\\"storageTexture\\\",texture_storage_3d:\\\"storageTexture\\\"},_X=e=>{e=e.trim();let t=e.match(TX);if(t!==null&&t.length===4){let r=t[2],i=[],s=null;for(;(s=SX.exec(r))!==null;)i.push({name:s[1],type:s[2]});let a=[];for(let u=0;u\\u003ci.length;u++){let{name:h,type:d}=i[u],c=d;c.startsWith(\\\"ptr\\\")?c=\\\"pointer\\\":(c.startsWith(\\\"texture\\\")&&(c=d.split(\\\"\\u003c\\\")[0]),c=mB[c]),a.push(new XS(c,h))}let n=e.substring(t[0].length),o=t[3]||\\\"void\\\",l=t[1]!==void 0?t[1]:\\\"\\\";return{type:mB[o]||o,inputs:a,name:l,inputsCode:r,blockCode:n,outputType:o}}else throw new Error(\\\"THREE.WGSLNodeFunction: Function is not a WGSL code.\\\")},wX=class extends YS{constructor(e){let{type:t,inputs:r,name:i,inputsCode:s,blockCode:a,outputType:n}=_X(e);super(t,r,i),this.inputsCode=s,this.blockCode=a,this.outputType=n}getCode(e=this.name){let t=this.outputType!==\\\"void\\\"?\\\"-> \\\"+this.outputType:\\\"\\\";return`fn ${e} ( ${this.inputsCode.trim()} ) ${t}`+this.blockCode}},MX=class extends w3{parseFunction(e){return new wX(e)}},NX={[Fi.READ_ONLY]:\\\"read\\\",[Fi.WRITE_ONLY]:\\\"write\\\",[Fi.READ_WRITE]:\\\"read_write\\\"},fB={[to]:\\\"repeat\\\",[Ti]:\\\"clamp\\\",[Qo]:\\\"mirror\\\"},u_={vertex:Ln.VERTEX,fragment:Ln.FRAGMENT,compute:Ln.COMPUTE},gB={instance:!0,swizzleAssign:!1,storageBuffer:!0},AX={\\\"^^\\\":\\\"tsl_xor\\\"},CX={float:\\\"f32\\\",int:\\\"i32\\\",uint:\\\"u32\\\",bool:\\\"bool\\\",color:\\\"vec3\\u003cf32>\\\",vec2:\\\"vec2\\u003cf32>\\\",ivec2:\\\"vec2\\u003ci32>\\\",uvec2:\\\"vec2\\u003cu32>\\\",bvec2:\\\"vec2\\u003cbool>\\\",vec3:\\\"vec3\\u003cf32>\\\",ivec3:\\\"vec3\\u003ci32>\\\",uvec3:\\\"vec3\\u003cu32>\\\",bvec3:\\\"vec3\\u003cbool>\\\",vec4:\\\"vec4\\u003cf32>\\\",ivec4:\\\"vec4\\u003ci32>\\\",uvec4:\\\"vec4\\u003cu32>\\\",bvec4:\\\"vec4\\u003cbool>\\\",mat2:\\\"mat2x2\\u003cf32>\\\",mat3:\\\"mat3x3\\u003cf32>\\\",mat4:\\\"mat4x4\\u003cf32>\\\"},yB={},lm={tsl_xor:new pr(\\\"fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }\\\"),mod_float:new pr(\\\"fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }\\\"),mod_vec2:new pr(\\\"fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }\\\"),mod_vec3:new pr(\\\"fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }\\\"),mod_vec4:new pr(\\\"fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }\\\"),equals_bool:new pr(\\\"fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }\\\"),equals_bvec2:new pr(\\\"fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2\\u003cbool> { return vec2\\u003cbool>( a.x == b.x, a.y == b.y ); }\\\"),equals_bvec3:new pr(\\\"fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3\\u003cbool> { return vec3\\u003cbool>( a.x == b.x, a.y == b.y, a.z == b.z ); }\\\"),equals_bvec4:new pr(\\\"fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4\\u003cbool> { return vec4\\u003cbool>( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }\\\"),repeatWrapping_float:new pr(\\\"fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }\\\"),mirrorWrapping_float:new pr(\\\"fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }\\\"),clampWrapping_float:new pr(\\\"fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }\\\"),inverse_mat2:new pr(`\\nfn tsl_inverse_mat2( m : mat2x2\\u003cf32> ) -> mat2x2\\u003cf32> {\\n\\n\\tlet det = m[ 0 ][ 0 ] * m[ 1 ][ 1 ] - m[ 0 ][ 1 ] * m[ 1 ][ 0 ];\\n\\n\\treturn mat2x2\\u003cf32>(\\n\\t\\tm[ 1 ][ 1 ], - m[ 0 ][ 1 ],\\n\\t\\t- m[ 1 ][ 0 ], m[ 0 ][ 0 ]\\n\\t) * ( 1.0 / det );\\n\\n}\\n`),inverse_mat3:new pr(`\\nfn tsl_inverse_mat3( m : mat3x3\\u003cf32> ) -> mat3x3\\u003cf32> {\\n\\n\\tlet a00 = m[ 0 ][ 0 ]; let a01 = m[ 0 ][ 1 ]; let a02 = m[ 0 ][ 2 ];\\n\\tlet a10 = m[ 1 ][ 0 ]; let a11 = m[ 1 ][ 1 ]; let a12 = m[ 1 ][ 2 ];\\n\\tlet a20 = m[ 2 ][ 0 ]; let a21 = m[ 2 ][ 1 ]; let a22 = m[ 2 ][ 2 ];\\n\\n\\tlet b01 = a22 * a11 - a12 * a21;\\n\\tlet b11 = - a22 * a10 + a12 * a20;\\n\\tlet b21 = a21 * a10 - a11 * a20;\\n\\n\\tlet det = a00 * b01 + a01 * b11 + a02 * b21;\\n\\n\\treturn mat3x3\\u003cf32>(\\n\\t\\tb01, ( - a22 * a01 + a02 * a21 ), ( a12 * a01 - a02 * a11 ),\\n\\t\\tb11, ( a22 * a00 - a02 * a20 ), ( - a12 * a00 + a02 * a10 ),\\n\\t\\tb21, ( - a21 * a00 + a01 * a20 ), ( a11 * a00 - a01 * a10 )\\n\\t) * ( 1.0 / det );\\n\\n}\\n`),inverse_mat4:new pr(`\\nfn tsl_inverse_mat4( m : mat4x4\\u003cf32> ) -> mat4x4\\u003cf32> {\\n\\n\\tlet a00 = m[ 0 ][ 0 ]; let a01 = m[ 0 ][ 1 ]; let a02 = m[ 0 ][ 2 ]; let a03 = m[ 0 ][ 3 ];\\n\\tlet a10 = m[ 1 ][ 0 ]; let a11 = m[ 1 ][ 1 ]; let a12 = m[ 1 ][ 2 ]; let a13 = m[ 1 ][ 3 ];\\n\\tlet a20 = m[ 2 ][ 0 ]; let a21 = m[ 2 ][ 1 ]; let a22 = m[ 2 ][ 2 ]; let a23 = m[ 2 ][ 3 ];\\n\\tlet a30 = m[ 3 ][ 0 ]; let a31 = m[ 3 ][ 1 ]; let a32 = m[ 3 ][ 2 ]; let a33 = m[ 3 ][ 3 ];\\n\\n\\tlet b00 = a00 * a11 - a01 * a10;\\n\\tlet b01 = a00 * a12 - a02 * a10;\\n\\tlet b02 = a00 * a13 - a03 * a10;\\n\\tlet b03 = a01 * a12 - a02 * a11;\\n\\tlet b04 = a01 * a13 - a03 * a11;\\n\\tlet b05 = a02 * a13 - a03 * a12;\\n\\tlet b06 = a20 * a31 - a21 * a30;\\n\\tlet b07 = a20 * a32 - a22 * a30;\\n\\tlet b08 = a20 * a33 - a23 * a30;\\n\\tlet b09 = a21 * a32 - a22 * a31;\\n\\tlet b10 = a21 * a33 - a23 * a31;\\n\\tlet b11 = a22 * a33 - a23 * a32;\\n\\n\\tlet det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\\n\\n\\treturn mat4x4\\u003cf32>(\\n\\t\\ta11 * b11 - a12 * b10 + a13 * b09,\\n\\t\\ta02 * b10 - a01 * b11 - a03 * b09,\\n\\t\\ta31 * b05 - a32 * b04 + a33 * b03,\\n\\t\\ta22 * b04 - a21 * b05 - a23 * b03,\\n\\t\\ta12 * b08 - a10 * b11 - a13 * b07,\\n\\t\\ta00 * b11 - a02 * b08 + a03 * b07,\\n\\t\\ta32 * b02 - a30 * b05 - a33 * b01,\\n\\t\\ta20 * b05 - a22 * b02 + a23 * b01,\\n\\t\\ta10 * b10 - a11 * b08 + a13 * b06,\\n\\t\\ta01 * b08 - a00 * b10 - a03 * b06,\\n\\t\\ta30 * b04 - a31 * b02 + a33 * b00,\\n\\t\\ta21 * b02 - a20 * b04 - a23 * b00,\\n\\t\\ta11 * b07 - a10 * b09 - a12 * b06,\\n\\t\\ta00 * b09 - a01 * b07 + a02 * b06,\\n\\t\\ta31 * b01 - a30 * b03 - a32 * b00,\\n\\t\\ta20 * b03 - a21 * b01 + a22 * b00\\n\\t) * ( 1.0 / det );\\n\\n}\\n`),biquadraticTexture:new pr(`\\nfn tsl_biquadraticTexture( map : texture_2d\\u003cf32>, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f {\\n\\n\\tlet res = vec2f( iRes );\\n\\n\\tlet uvScaled = coord * res;\\n\\tlet uvWrapping = ( ( uvScaled % res ) + res ) % res;\\n\\n\\t// https://www.shadertoy.com/view/WtyXRy\\n\\n\\tlet uv = uvWrapping - 0.5;\\n\\tlet iuv = floor( uv );\\n\\tlet f = fract( uv );\\n\\n\\tlet rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level );\\n\\tlet rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level );\\n\\tlet rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level );\\n\\tlet rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level );\\n\\n\\treturn mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );\\n\\n}\\n`),biquadraticTextureArray:new pr(`\\nfn tsl_biquadraticTexture_array( map : texture_2d_array\\u003cf32>, coord : vec2f, iRes : vec2u, layer : u32, level : u32 ) -> vec4f {\\n\\n\\tlet res = vec2f( iRes );\\n\\n\\tlet uvScaled = coord * res;\\n\\tlet uvWrapping = ( ( uvScaled % res ) + res ) % res;\\n\\n\\t// https://www.shadertoy.com/view/WtyXRy\\n\\n\\tlet uv = uvWrapping - 0.5;\\n\\tlet iuv = floor( uv );\\n\\tlet f = fract( uv );\\n\\n\\tlet rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, layer, level );\\n\\tlet rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, layer, level );\\n\\tlet rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, layer, level );\\n\\tlet rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, layer, level );\\n\\n\\treturn mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );\\n\\n}\\n`)},RX={dFdx:\\\"dpdx\\\",dFdy:\\\"- dpdy\\\",mod_float:\\\"tsl_mod_float\\\",mod_vec2:\\\"tsl_mod_vec2\\\",mod_vec3:\\\"tsl_mod_vec3\\\",mod_vec4:\\\"tsl_mod_vec4\\\",equals_bool:\\\"tsl_equals_bool\\\",equals_bvec2:\\\"tsl_equals_bvec2\\\",equals_bvec3:\\\"tsl_equals_bvec3\\\",equals_bvec4:\\\"tsl_equals_bvec4\\\",inverse_mat2:\\\"tsl_inverse_mat2\\\",inverse_mat3:\\\"tsl_inverse_mat3\\\",inverse_mat4:\\\"tsl_inverse_mat4\\\",inversesqrt:\\\"inverseSqrt\\\",bitcast:\\\"bitcast\\u003cf32>\\\",floatpack_snorm_2x16:\\\"pack2x16snorm\\\",floatpack_unorm_2x16:\\\"pack2x16unorm\\\",floatpack_float16_2x16:\\\"pack2x16float\\\",floatunpack_snorm_2x16:\\\"unpack2x16snorm\\\",floatunpack_unorm_2x16:\\\"unpack2x16unorm\\\",floatunpack_float16_2x16:\\\"unpack2x16float\\\"},xB=\\\"\\\";(typeof navigator\\u003c\\\"u\\\"&&/Firefox|Deno/g.test(navigator.userAgent))!==!0&&(xB+=`diagnostic( off, derivative_uniformity );\\n`);var EX=class extends S3{constructor(e,t){super(e,t,new MX),this.uniformGroups={},this.uniformGroupsBindings={},this.builtins={},this.directives={},this.scopedArrays=new Map,this.allowEarlyReturns=!0,this.allowGlobalVariables=!0}_generateTextureSample(e,t,r,i,s,a=this.shaderStage){return a===\\\"fragment\\\"?i?s?`textureSample( ${t}, ${t}_sampler, ${r}, ${i}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${r}, ${i} )`:s?`textureSample( ${t}, ${t}_sampler, ${r}, ${s} )`:`textureSample( ${t}, ${t}_sampler, ${r} )`:this.generateTextureSampleLevel(e,t,r,\\\"0\\\",i)}generateTextureSampleLevel(e,t,r,i,s,a){return this.isUnfilterable(e)===!1?s?a?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s}, ${i}, ${a} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s}, ${i} )`:a?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${a} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,r,a,i,s):this.generateTextureLod(e,t,r,s,a,i)}generateWrapFunction(e){let t=`tsl_coord_${fB[e.wrapS]}S_${fB[e.wrapT]}T_${e.is3DTexture||e.isData3DTexture?\\\"3d\\\":\\\"2d\\\"}`,r=yB[t];if(r===void 0){let i=[],s=e.is3DTexture||e.isData3DTexture?\\\"vec3f\\\":\\\"vec2f\\\",a=`fn ${t}( coord : ${s} ) -> ${s} {\\n\\n\\treturn ${s}(\\n`,n=(o,l)=>{o===to?(i.push(lm.repeatWrapping_float),a+=`\\t\\ttsl_repeatWrapping_float( coord.${l} )`):o===Ti?(i.push(lm.clampWrapping_float),a+=`\\t\\ttsl_clampWrapping_float( coord.${l} )`):o===Qo?(i.push(lm.mirrorWrapping_float),a+=`\\t\\ttsl_mirrorWrapping_float( coord.${l} )`):(a+=`\\t\\tcoord.${l}`,Ue(`WebGPURenderer: Unsupported texture wrap type \\\"${o}\\\" for vertex shader.`))};n(e.wrapS,\\\"x\\\"),a+=`,\\n`,n(e.wrapT,\\\"y\\\"),(e.is3DTexture||e.isData3DTexture)&&(a+=`,\\n`,n(e.wrapR,\\\"z\\\")),a+=`\\n\\t);\\n\\n}\\n`,yB[t]=r=new pr(a,i)}return r.build(this),t}generateArrayDeclaration(e,t){return`array\\u003c ${this.getType(e)}, ${t} >`}generateTextureDimension(e,t,r){let i=this.getDataFromNode(e,this.shaderStage,this.cache);i.dimensionsSnippet===void 0&&(i.dimensionsSnippet={});let s=i.dimensionsSnippet[r];if(i.dimensionsSnippet[r]===void 0){let a,n,{primarySamples:o}=this.renderer.backend.utils.getTextureSampleData(e),l=o>1;e.is3DTexture||e.isData3DTexture?n=\\\"vec3\\u003cu32>\\\":n=\\\"vec2\\u003cu32>\\\",l||e.isStorageTexture?a=t:a=`${t}${r?`, u32( ${r} )`:\\\"\\\"}`,s=new x0(new S0(`textureDimensions( ${a} )`,n)),i.dimensionsSnippet[r]=s,(e.isArrayTexture||e.isDataArrayTexture||e.is3DTexture||e.isData3DTexture)&&(i.arrayLayerCount=new x0(new S0(`textureNumLayers(${t})`,\\\"u32\\\"))),e.isTextureCube&&(i.cubeFaceCount=new x0(new S0(\\\"6u\\\",\\\"u32\\\")))}return s.build(this)}generateFilteredTexture(e,t,r,i,s=\\\"0u\\\",a){let n=this.generateWrapFunction(e),o=this.generateTextureDimension(e,t,s);return i&&(r=`${r} + vec2\\u003cf32>(${i}) / ${o}`),a?(this._include(\\\"biquadraticTextureArray\\\"),`tsl_biquadraticTexture_array( ${t}, ${n}( ${r} ), ${o}, u32( ${a} ), u32( ${s} ) )`):(this._include(\\\"biquadraticTexture\\\"),`tsl_biquadraticTexture( ${t}, ${n}( ${r} ), ${o}, u32( ${s} ) )`)}generateTextureLod(e,t,r,i,s,a=\\\"0u\\\"){if(e.isCubeTexture===!0){s&&(r=`${r} + vec3\\u003cf32>(${s})`);let c=e.isDepthTexture?\\\"u32\\\":\\\"f32\\\";return`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${c}( ${a} ) )`}let n=this.generateWrapFunction(e),o=this.generateTextureDimension(e,t,a),l=e.is3DTexture||e.isData3DTexture?\\\"vec3\\\":\\\"vec2\\\",u=l===\\\"vec3\\\"?\\\"vec3\\u003cu32>( 1, 1, 1 )\\\":\\\"vec2\\u003cu32>( 1, 1 )\\\";s&&(r=`${r} + ${l}\\u003cf32>(${s}) / ${l}\\u003cf32>( ${o} )`);let h=`${l}\\u003cf32>( 0 )`,d=`${l}\\u003cf32>( ${o} - ${u} )`;return r=`${l}\\u003cu32>( clamp( floor( ${n}( ${r} ) * ${l}\\u003cf32>( ${o} ) ), ${h}, ${d} ) )`,this.generateTextureLoad(e,t,r,a,i,null)}generateStorageTextureLoad(e,t,r,i,s,a){a&&(r=`${r} + ${a}`);let n;return s?n=`textureLoad( ${t}, ${r}, ${s} )`:n=`textureLoad( ${t}, ${r} )`,n}generateTextureLoad(e,t,r,i,s,a){i===null&&(i=\\\"0u\\\"),a&&(r=`${r} + ${a}`);let n;return s?n=`textureLoad( ${t}, ${r}, ${s}, u32( ${i} ) )`:(n=`textureLoad( ${t}, ${r}, u32( ${i} ) )`,this.renderer.backend.compatibilityMode&&e.isDepthTexture&&(n+=\\\".x\\\")),n}generateTextureStore(e,t,r,i,s){let a;return i?a=`textureStore( ${t}, ${r}, ${i}, ${s} )`:a=`textureStore( ${t}, ${r}, ${s} )`,a}isSampleCompare(e){return e.isDepthTexture===!0&&e.compareFunction!==null&&this.renderer.hasCompatibility(fu.TEXTURE_COMPARE)}isUnfilterable(e){return this.getComponentTypeFromTexture(e)!==\\\"float\\\"||!this.isAvailable(\\\"float32Filterable\\\")&&e.type===Er||this.isSampleCompare(e)===!1&&e.minFilter===or&&e.magFilter===or||this.renderer.backend.utils.getTextureSampleData(e).primarySamples>1}generateTexture(e,t,r,i,s,a=this.shaderStage){let n=null;return this.isUnfilterable(e)?n=this.generateTextureLod(e,t,r,i,s,\\\"0\\\",a):n=this._generateTextureSample(e,t,r,i,s,a),n}generateTextureGrad(e,t,r,i,s,a,n=this.shaderStage){if(n===\\\"fragment\\\")return s?a?`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${s}, ${i[0]}, ${i[1]}, ${a} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${s}, ${i[0]}, ${i[1]} )`:a?`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${i[0]}, ${i[1]}, ${a} )`:`textureSampleGrad( ${t}, ${t}_sampler, ${r}, ${i[0]}, ${i[1]} )`;Ce(`WebGPURenderer: THREE.TextureNode.gradient() does not support ${n} shader.`)}generateTextureCompare(e,t,r,i,s,a,n=this.shaderStage){if(n===\\\"fragment\\\")return e.isDepthTexture===!0&&e.isArrayTexture===!0?a?`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${s}, ${i}, ${a} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${s}, ${i} )`:a?`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${i}, ${a} )`:`textureSampleCompare( ${t}, ${t}_sampler, ${r}, ${i} )`;Ce(`WebGPURenderer: THREE.DepthTexture.compareFunction() does not support ${n} shader.`)}generateTextureGather(e,t,r,i,s,a){let n=e.isDepthTexture===!0?\\\"\\\":`${i}, `;return s?a?`textureGather( ${n}${t}, ${t}_sampler, ${r}, ${s}, ${a} )`:`textureGather( ${n}${t}, ${t}_sampler, ${r}, ${s} )`:a?`textureGather( ${n}${t}, ${t}_sampler, ${r}, ${a} )`:`textureGather( ${n}${t}, ${t}_sampler, ${r})`}generateTextureGatherCompare(e,t,r,i,s,a){return s?a?`textureGatherCompare( ${t}, ${t}_sampler, ${r}, ${s}, ${i}, ${a} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${r}, ${s}, ${i})`:a?`textureGatherCompare( ${t}, ${t}_sampler, ${r}, ${i}, ${a} )`:`textureGatherCompare( ${t}, ${t}_sampler, ${r}, ${i})`}generateTextureLevel(e,t,r,i,s,a){return this.isUnfilterable(e)===!1?s?a?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s}, ${i}, ${a} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${s}, ${i} )`:a?`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i}, ${a} )`:`textureSampleLevel( ${t}, ${t}_sampler, ${r}, ${i} )`:this.isFilteredTexture(e)?this.generateFilteredTexture(e,t,r,a,i,s):this.generateTextureLod(e,t,r,s,a,i)}generateTextureBias(e,t,r,i,s,a,n=this.shaderStage){if(n===\\\"fragment\\\")return s?a?`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${s}, ${i}, ${a} )`:`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${s}, ${i} )`:a?`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${i}, ${a} )`:`textureSampleBias( ${t}, ${t}_sampler, ${r}, ${i} )`;Ce(`WebGPURenderer: THREE.TextureNode.biasNode does not support ${n} shader.`)}getPropertyName(e,t=this.shaderStage){if(e.isNodeVarying===!0&&e.needsInterpolation===!0){if(t===\\\"vertex\\\")return`varyings.${e.name}`}else if(e.isNodeUniform===!0){let r=e.name,i=e.type;return i===\\\"texture\\\"||i===\\\"cubeTexture\\\"||i===\\\"cubeDepthTexture\\\"||i===\\\"storageTexture\\\"||i===\\\"texture3D\\\"?r:i===\\\"buffer\\\"||i===\\\"storageBuffer\\\"||i===\\\"indirectStorageBuffer\\\"?this.isCustomStruct(e)?r:r+\\\".value\\\":e.groupNode.name+\\\".\\\"+r}return super.getPropertyName(e)}getOutputStructName(){return\\\"output\\\"}getFunctionOperator(e){let t=AX[e];return t!==void 0?(this._include(t),t):null}getNodeAccess(e,t){return t!==\\\"compute\\\"?e.isAtomic===!0?(Ue(\\\"WebGPURenderer: Atomic operations are only supported in compute shaders.\\\"),Fi.READ_WRITE):Fi.READ_ONLY:e.access}getStorageAccess(e,t){return NX[this.getNodeAccess(e,t)]}getUniformFromNode(e,t,r,i=null){let s=super.getUniformFromNode(e,t,r,i),a=this.getDataFromNode(e,r,this.globalCache);if(a.uniformGPU===void 0){let n,o=e.groupNode,l=o.name,u=this.getBindGroupArray(l,r);if(t===\\\"texture\\\"||t===\\\"cubeTexture\\\"||t===\\\"cubeDepthTexture\\\"||t===\\\"storageTexture\\\"||t===\\\"texture3D\\\"){let h=null,d=this.getNodeAccess(e,r);if(t===\\\"texture\\\"||t===\\\"storageTexture\\\"?e.value.is3DTexture===!0?h=new QS(s.name,s.node,o,d):h=new Ny(s.name,s.node,o,d):t===\\\"cubeTexture\\\"||t===\\\"cubeDepthTexture\\\"?h=new G3(s.name,s.node,o,d):t===\\\"texture3D\\\"&&(h=new QS(s.name,s.node,o,d)),h.store=e.isStorageTextureNode===!0,h.mipLevel=h.store?e.mipLevel:0,h.setVisibility(u_[r]),e.value.isCubeTexture===!0||this.isUnfilterable(e.value)===!1&&h.store===!1||e.gatherNode!==null){let c=new aX(`${s.name}_sampler`,s.node,o);c.setVisibility(u_[r]),u.push(c,h),n=[c,h]}else u.push(h),n=[h]}else if(t===\\\"buffer\\\"||t===\\\"storageBuffer\\\"||t===\\\"indirectStorageBuffer\\\"){let h=this.getSharedDataFromNode(e),d=h.buffer;if(d===void 0){let c=t===\\\"buffer\\\"?U3:lX;d=new c(e,o),h.buffer=d}d.setVisibility(d.getVisibility()|u_[r]),u.push(d),n=d,s.name=i||\\\"NodeBuffer_\\\"+s.id}else{let h=this.uniformGroups[l];h===void 0&&(h=new z3(l,o),h.setVisibility(Ln.VERTEX|Ln.FRAGMENT|Ln.COMPUTE),this.uniformGroups[l]=h),u.indexOf(h)===-1&&u.push(h),n=this.getNodeUniform(s,t);let d=n.name;h.uniforms.some(c=>c.name===d)||h.addUniform(n)}a.uniformGPU=n}return s}getBuiltin(e,t,r,i=this.shaderStage){let s=this.builtins[i]||(this.builtins[i]=new Map);return s.has(e)===!1&&s.set(e,{name:e,property:t,type:r}),t}hasBuiltin(e,t=this.shaderStage){return this.builtins[t]!==void 0&&this.builtins[t].has(e)}getVertexIndex(){return this.shaderStage===\\\"vertex\\\"?this.getBuiltin(\\\"vertex_index\\\",\\\"vertexIndex\\\",\\\"u32\\\",\\\"attribute\\\"):\\\"vertexIndex\\\"}buildFunctionCode(e){let t=e.layout,r=this.flowShaderNode(e),i=[];for(let a of t.inputs)i.push(a.name+\\\" : \\\"+this.getType(a.type));let s=`fn ${t.name}( ${i.join(\\\", \\\")} ) -> ${this.getType(t.type)} {\\n${r.vars}\\n${r.code}\\n`;return r.result&&(s+=`\\treturn ${r.result};\\n`),s+=`\\n}\\n`,s}getInstanceIndex(){return this.shaderStage===\\\"vertex\\\"?this.getBuiltin(\\\"instance_index\\\",\\\"instanceIndex\\\",\\\"u32\\\",\\\"attribute\\\"):\\\"instanceIndex\\\"}getInvocationLocalIndex(){return this.getBuiltin(\\\"local_invocation_index\\\",\\\"invocationLocalIndex\\\",\\\"u32\\\",\\\"attribute\\\")}getSubgroupSize(){return this.enableSubGroups(),this.getBuiltin(\\\"subgroup_size\\\",\\\"subgroupSize\\\",\\\"u32\\\",\\\"attribute\\\")}getInvocationSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin(\\\"subgroup_invocation_id\\\",\\\"invocationSubgroupIndex\\\",\\\"u32\\\",\\\"attribute\\\")}getSubgroupIndex(){return this.enableSubGroups(),this.getBuiltin(\\\"subgroup_id\\\",\\\"subgroupIndex\\\",\\\"u32\\\",\\\"attribute\\\")}getDrawIndex(){return null}getFrontFacing(){return this.getBuiltin(\\\"front_facing\\\",\\\"isFront\\\",\\\"bool\\\")}getFragCoord(){return this.getBuiltin(\\\"position\\\",\\\"fragCoord\\\",\\\"vec4\\u003cf32>\\\")+\\\".xy\\\"}getFragDepth(){return\\\"output.\\\"+this.getBuiltin(\\\"frag_depth\\\",\\\"depth\\\",\\\"f32\\\",\\\"output\\\")}getClipDistance(){return\\\"varyings.hw_clip_distances\\\"}isFlipY(){return!1}enableDirective(e,t=this.shaderStage){(this.directives[t]||(this.directives[t]=new Set)).add(e)}getDirectives(e){let t=[],r=this.directives[e];if(r!==void 0)for(let i of r)t.push(`enable ${i};`);return t.join(`\\n`)}enableSubGroups(){this.enableDirective(\\\"subgroups\\\")}enableSubgroupsF16(){this.enableDirective(\\\"subgroups-f16\\\")}enableClipDistances(){this.enableDirective(\\\"clip_distances\\\")}enableShaderF16(){this.enableDirective(\\\"f16\\\")}enableDualSourceBlending(){this.enableDirective(\\\"dual_source_blending\\\")}enableHardwareClipping(e){this.enableClipDistances(),this.getBuiltin(\\\"clip_distances\\\",\\\"hw_clip_distances\\\",`array\\u003cf32, ${e} >`,\\\"vertex\\\")}getBuiltins(e){let t=[],r=this.builtins[e];if(r!==void 0)for(let{name:i,property:s,type:a}of r.values())t.push(`@builtin( ${i} ) ${s} : ${a}`);return t.join(`,\\n\\t`)}getScopedArray(e,t,r,i){return this.scopedArrays.has(e)===!1&&this.scopedArrays.set(e,{name:e,scope:t,bufferType:r,bufferCount:i}),e}getScopedArrays(e){if(e!==\\\"compute\\\")return;let t=[];for(let{name:r,scope:i,bufferType:s,bufferCount:a}of this.scopedArrays.values()){let n=this.getType(s);t.push(`var\\u003c${i}> ${r}: array\\u003c ${n}, ${a} >;`)}return t.join(`\\n`)}getAttributes(e){let t=[];if(e===\\\"compute\\\"&&(this.getBuiltin(\\\"global_invocation_id\\\",\\\"globalId\\\",\\\"vec3\\u003cu32>\\\",\\\"attribute\\\"),this.getBuiltin(\\\"workgroup_id\\\",\\\"workgroupId\\\",\\\"vec3\\u003cu32>\\\",\\\"attribute\\\"),this.getBuiltin(\\\"local_invocation_id\\\",\\\"localId\\\",\\\"vec3\\u003cu32>\\\",\\\"attribute\\\"),this.getBuiltin(\\\"num_workgroups\\\",\\\"numWorkgroups\\\",\\\"vec3\\u003cu32>\\\",\\\"attribute\\\"),this.renderer.hasFeature(\\\"subgroups\\\")&&(this.enableDirective(\\\"subgroups\\\",e),this.getBuiltin(\\\"subgroup_size\\\",\\\"subgroupSize\\\",\\\"u32\\\",\\\"attribute\\\"))),e===\\\"vertex\\\"||e===\\\"compute\\\"){let r=this.getBuiltins(\\\"attribute\\\");r&&t.push(r);let i=this.getAttributesArray();for(let s=0,a=i.length;s\\u003ca;s++){let n=i[s],o=n.name,l=this.getType(n.type);t.push(`@location( ${s} ) ${o} : ${l}`)}}return t.join(`,\\n\\t`)}getStructMembers(e){let t=[];for(let r of e.members){let i=e.output?\\\"@location( \\\"+r.index+\\\" ) \\\":\\\"\\\",s=this.getType(r.type);r.atomic&&(s=\\\"atomic\\u003c \\\"+s+\\\" >\\\"),t.push(`\\t${i+r.name} : ${s}`)}return e.output&&t.push(`\\t${this.getBuiltins(\\\"output\\\")}`),t.join(`,\\n`)}getStructs(e){let t=\\\"\\\",r=this.structs[e];if(r.length>0){let i=[];for(let s of r){let a=`struct ${s.name} {\\n`;a+=this.getStructMembers(s),a+=`\\n};`,i.push(a)}t=`\\n`+i.join(`\\n\\n`)+`\\n`}return t}getVar(e,t,r=null,i=\\\"\\\"){let s=`var${i} ${t} : `;return r!==null?s+=this.generateArrayDeclaration(e,r):s+=this.getType(e),s}getVars(e,t=!1){let r=\\\"\\\";t&&(r=\\\"\\u003cprivate>\\\");let i=[],s=this.vars[e];if(s!==void 0)for(let a of s)i.push(`${this.getVar(a.type,a.name,a.count,r)};`);return t?i.join(`\\n`):`\\n\\t${i.join(`\\n\\t`)}\\n`}getVaryings(e){let t=[];if(e===\\\"vertex\\\"&&this.getBuiltin(\\\"position\\\",\\\"builtinClipSpace\\\",\\\"vec4\\u003cf32>\\\",\\\"vertex\\\"),e===\\\"vertex\\\"||e===\\\"fragment\\\"){let s=this.varyings,a=this.vars[e],n=0;for(let o=0;o\\u003cs.length;o++){let l=s[o];if(l.needsInterpolation){let u=`@location( ${n++} )`;if(l.interpolationType){let h=l.interpolationSampling!==null?`, ${l.interpolationSampling} )`:\\\" )\\\";u+=` @interpolate( ${l.interpolationType}${h}`}else/^(int|uint|ivec|uvec)/.test(l.type)&&(u+=\\\" @interpolate(flat, either)\\\");t.push(`${u} ${l.name} : ${this.getType(l.type)}`)}else e===\\\"vertex\\\"&&a.includes(l)===!1&&a.push(l)}}let r=this.getBuiltins(e);r&&t.push(r);let i=t.join(`,\\n\\t`);return e===\\\"vertex\\\"?this._getWGSLStruct(\\\"VaryingsStruct\\\",\\\"\\t\\\"+i):i}isCustomStruct(e){let t=e.value,r=e.node,i=(t.isBufferAttribute||t.isInstancedBufferAttribute)&&r.structTypeNode!==null,s=r.value&&r.value.array&&typeof r.value.itemSize==\\\"number\\\"&&r.value.array.length>r.value.itemSize;return i&&!s}getUniforms(e){let t=this.renderer.backend,r=this.uniforms[e],i=[],s=[],a=[],n={};for(let o of r){let l=o.groupNode.name,u=this.bindingsIndexes[l];if(o.type===\\\"texture\\\"||o.type===\\\"cubeTexture\\\"||o.type===\\\"cubeDepthTexture\\\"||o.type===\\\"storageTexture\\\"||o.type===\\\"texture3D\\\"){let h=o.node,d=h.value;(d.isCubeTexture===!0||this.isUnfilterable(d)===!1&&h.isStorageTextureNode!==!0||h.gatherNode!==null)&&(this.isSampleCompare(d)&&h.compareNode!==null?i.push(`@binding( ${u.binding++} ) @group( ${u.group} ) var ${o.name}_sampler : sampler_comparison;`):i.push(`@binding( ${u.binding++} ) @group( ${u.group} ) var ${o.name}_sampler : sampler;`));let c,m=\\\"\\\",{primarySamples:g}=t.utils.getTextureSampleData(d);if(g>1&&(m=\\\"_multisampled\\\"),d.isCubeTexture===!0&&d.isDepthTexture===!0)c=\\\"texture_depth_cube\\\";else if(d.isCubeTexture===!0)c=\\\"texture_cube\\u003cf32>\\\";else if(d.isDepthTexture===!0)t.compatibilityMode&&d.compareFunction===null?c=`texture${m}_2d\\u003cf32>`:c=`texture_depth${m}_2d${d.isArrayTexture===!0?\\\"_array\\\":\\\"\\\"}`;else if(o.node.isStorageTextureNode===!0){let y=l_(d,t.device),b=this.getStorageAccess(o.node,e),v=o.node.value.is3DTexture,S=o.node.value.isArrayTexture;c=`texture_storage_${v?\\\"3d\\\":`2d${S?\\\"_array\\\":\\\"\\\"}`}\\u003c${y}, ${b}>`}else if(d.isArrayTexture===!0||d.isDataArrayTexture===!0||d.isCompressedArrayTexture===!0)c=\\\"texture_2d_array\\u003cf32>\\\";else if(d.is3DTexture===!0||d.isData3DTexture===!0)c=\\\"texture_3d\\u003cf32>\\\";else{let y=this.getComponentTypeFromTexture(d).charAt(0);c=`texture${m}_2d\\u003c${y}32>`}i.push(`@binding( ${u.binding++} ) @group( ${u.group} ) var ${o.name} : ${c};`)}else if(o.type===\\\"buffer\\\"||o.type===\\\"storageBuffer\\\"||o.type===\\\"indirectStorageBuffer\\\"){let h=o.node,d=this.getType(h.getNodeType(this)),c=h.bufferCount,m=c>0&&o.type===\\\"buffer\\\"?\\\", \\\"+c:\\\"\\\",g=h.isStorageBufferNode?`storage, ${this.getStorageAccess(h,e)}`:\\\"uniform\\\";if(this.isCustomStruct(o))s.push(`@binding( ${u.binding++} ) @group( ${u.group} ) var\\u003c${g}> ${o.name} : ${d};`);else{let y=`\\tvalue : array\\u003c ${h.isAtomic?`atomic\\u003c${d}>`:`${d}`}${m} >`;s.push(this._getWGSLStructBinding(o.name,y,g,u.binding++,u.group))}}else{let h=o.groupNode.name;if(n[h]===void 0){let d=this.uniformGroups[h];if(d!==void 0){let c=[];for(let g of d.uniforms){let y=g.getType(),b=this.getType(this.getVectorType(y));c.push(`\\t${g.name} : ${b}`)}let m=this.uniformGroupsBindings[h];m===void 0&&(m={index:u.binding++,id:u.group},this.uniformGroupsBindings[h]=m),n[h]={index:m.index,id:m.id,snippets:c}}}}}for(let o in n){let l=n[o];a.push(this._getWGSLStructBinding(o,l.snippets.join(`,\\n`),\\\"uniform\\\",l.index,l.id))}return[...i,...s,...a].join(`\\n`)}buildCode(){let e=this.material!==null?{fragment:{},vertex:{}}:{compute:{}};this.sortBindingGroups();for(let t in e){this.shaderStage=t;let r=this.allowGlobalVariables,i=e[t];i.uniforms=this.getUniforms(t),i.attributes=this.getAttributes(t),i.varyings=this.getVaryings(t),i.structs=this.getStructs(t),i.vars=this.getVars(t,r),i.codes=this.getCodes(t),i.directives=this.getDirectives(t),i.scopedArrays=this.getScopedArrays(t);let s=`// code\\n\\n`;s+=this.flowCode[t];let a=this.flowNodes[t],n=a[a.length-1],o=n.outputNode,l=o!==void 0&&o.isOutputStructNode===!0;for(let u of a){let h=this.getFlowData(u),d=u.name;if(d&&(s.length>0&&(s+=`\\n`),s+=`\\t// flow -> ${d}\\n`),s+=`${h.code}\\n\\t`,u===n&&t!==\\\"compute\\\"){if(s+=`// result\\n\\n\\t`,t===\\\"vertex\\\")s+=`varyings.builtinClipSpace = ${h.result};`;else if(t===\\\"fragment\\\")if(l)i.returnType=o.getNodeType(this),i.structs+=\\\"var\\u003cprivate> output : \\\"+i.returnType+\\\";\\\",s+=`return ${h.result};`;else{let c=`\\t@location( 0 ) color: ${this.getType(this.getOutputType())}`,m=this.getBuiltins(\\\"output\\\");m&&(c+=`,\\n\\t`+m),i.returnType=\\\"OutputStruct\\\",i.structs+=this._getWGSLStruct(\\\"OutputStruct\\\",c),i.structs+=`\\nvar\\u003cprivate> output : OutputStruct;`,s+=`output.color = ${this.format(h.result,n.getNodeType(this),this.getOutputType())};\\n\\n\\treturn output;`}}}i.flow=s}if(this.shaderStage=null,this.material!==null)this.vertexShader=this._getWGSLVertexCode(e.vertex),this.fragmentShader=this._getWGSLFragmentCode(e.fragment);else{let t=this.object.workgroupSize;this.computeShader=this._getWGSLComputeCode(e.compute,t)}}getMethod(e,t=null){let r;return t!==null&&(r=this._getWGSLMethod(e+\\\"_\\\"+t)),r===void 0&&(r=this._getWGSLMethod(e)),r||e}getBitcastMethod(e){return`bitcast\\u003c${this.getType(e)}>`}getFloatPackingMethod(e){return this.getMethod(`floatpack_${e}_2x16`)}getFloatUnpackingMethod(e){return this.getMethod(`floatunpack_${e}_2x16`)}getTernary(e,t,r){return`select( ${r}, ${t}, ${e} )`}getType(e){return CX[e]||e}isAvailable(e){let t=gB[e];return t===void 0&&(e===\\\"float32Filterable\\\"?t=this.renderer.hasFeature(\\\"float32-filterable\\\"):e===\\\"clipDistance\\\"&&(t=this.renderer.hasFeature(\\\"clip-distances\\\")),gB[e]=t),t}_getWGSLMethod(e){return lm[e]!==void 0&&this._include(e),RX[e]}_include(e){let t=lm[e];return t.build(this),this.addInclude(t),t}_getWGSLVertexCode(e){return`${this.getSignature()}\\n// directives\\n${e.directives}\\n\\n// structs\\n${e.structs}\\n\\n// uniforms\\n${e.uniforms}\\n\\n// varyings\\n${e.varyings}\\nvar\\u003cprivate> varyings : VaryingsStruct;\\n\\n// vars\\n${e.vars}\\n\\n// codes\\n${e.codes}\\n\\n@vertex\\nfn main( ${e.attributes} ) -> VaryingsStruct {\\n\\n\\t// flow\\n\\t${e.flow}\\n\\n\\treturn varyings;\\n\\n}\\n`}_getWGSLFragmentCode(e){return`${this.getSignature()}\\n// global\\n${xB}\\n\\n// structs\\n${e.structs}\\n\\n// uniforms\\n${e.uniforms}\\n\\n// vars\\n${e.vars}\\n\\n// codes\\n${e.codes}\\n\\n@fragment\\nfn main( ${e.varyings} ) -> ${e.returnType} {\\n\\n\\t// flow\\n\\t${e.flow}\\n\\n}\\n`}_getWGSLComputeCode(e,t){let[r,i,s]=t;return`${this.getSignature()}\\n// directives\\n${e.directives}\\n\\n// system\\nvar\\u003cprivate> instanceIndex : u32;\\n\\n// locals\\n${e.scopedArrays}\\n\\n// structs\\n${e.structs}\\n\\n// uniforms\\n${e.uniforms}\\n\\n// vars\\n${this.allowGlobalVariables?e.vars:\\\"\\\"}\\n\\n// codes\\n${e.codes}\\n\\n@compute @workgroup_size( ${r}, ${i}, ${s} )\\nfn main( ${e.attributes} ) {\\n\\n\\t// local vars\\n\\t${this.allowGlobalVariables?\\\"\\\":e.vars}\\n\\n\\t// system\\n\\tinstanceIndex = globalId.x\\n\\t\\t+ globalId.y * ( ${r} * numWorkgroups.x )\\n\\t\\t+ globalId.z * ( ${r} * numWorkgroups.x ) * ( ${i} * numWorkgroups.y );\\n\\n\\t// flow\\n\\t${e.flow}\\n\\n}\\n`}_getWGSLStruct(e,t){return`\\nstruct ${e} {\\n${t}\\n};`}_getWGSLStructBinding(e,t,r,i=0,s=0){let a=e+\\\"Struct\\\";return`${this._getWGSLStruct(a,t)}\\n@binding( ${i} ) @group( ${s} )\\nvar\\u003c${r}> ${e} : ${a};`}},is=new Wd,h_=new sm,vB=new Map([[Int8Array,[\\\"sint8\\\",\\\"snorm8\\\"]],[Uint8Array,[\\\"uint8\\\",\\\"unorm8\\\"]],[Int16Array,[\\\"sint16\\\",\\\"snorm16\\\"]],[Uint16Array,[\\\"uint16\\\",\\\"unorm16\\\"]],[Int32Array,[\\\"sint32\\\",\\\"snorm32\\\"]],[Uint32Array,[\\\"uint32\\\",\\\"unorm32\\\"]],[Float32Array,[\\\"float32\\\"]]]);typeof Float16Array\\u003c\\\"u\\\"&&vB.set(Float16Array,[\\\"float16\\\"]);var PX=new Map([[sN,[\\\"float16\\\"]]]),BX=new Map([[Int32Array,\\\"sint32\\\"],[Int16Array,\\\"sint32\\\"],[Uint32Array,\\\"uint32\\\"],[Uint16Array,\\\"uint32\\\"],[Float32Array,\\\"float32\\\"]]),IX=class{constructor(e){this.backend=e}createAttribute(e,t){let r=this._getBufferAttribute(e),i=this.backend,s=i.get(r),a=s.buffer;if(a===void 0){let n=i.device,o=r.array;if(e.normalized===!1){if(o.constructor===Int16Array||o.constructor===Int8Array)o=new Int32Array(o);else if((o.constructor===Uint16Array||o.constructor===Uint8Array)&&(o=new Uint32Array(o),t&GPUBufferUsage.INDEX))for(let d=0;d\\u003co.length;d++)o[d]===65535&&(o[d]=4294967295)}r.array=o;let l;if((r.isStorageBufferAttribute||r.isStorageInstancedBufferAttribute)&&r.itemSize===3)l=4;else if(r.itemSize>1&&r.itemSize*o.BYTES_PER_ELEMENT%4!==0){let d=r.itemSize*o.BYTES_PER_ELEMENT;l=Math.floor((d+3)/4)*4/o.BYTES_PER_ELEMENT}if(l!==void 0){let d=r.itemSize,c=new o.constructor(r.count*l);for(let m=0;m\\u003cr.count;m++)c.set(o.subarray(m*d,m*d+d),m*l);(r.isStorageBufferAttribute||r.isStorageInstancedBufferAttribute)&&(r.itemSize=l,r.array=c),o=c,s._itemSize=d,s._paddedItemSize=l}let u=o.byteLength,h=u+(4-u%4)%4;is.label=r.name,is.size=h,is.usage=t,is.mappedAtCreation=!0,a=n.createBuffer(is),is.reset(),new o.constructor(a.getMappedRange()).set(o),a.unmap(),s.buffer=a}}updateAttribute(e){let t=this._getBufferAttribute(e),r=this.backend,i=r.device,s=r.get(t),a=r.get(t).buffer,n=t.array,o=s._itemSize,l=s._paddedItemSize;if(l!==void 0){n=new n.constructor(t.count*l);for(let h=0;h\\u003ct.count;h++)n.set(t.array.subarray(h*o,h*o+o),h*l);(t.isStorageBufferAttribute||t.isStorageInstancedBufferAttribute)&&(t.array=n)}let u=t.updateRanges;if(u.length===0)i.queue.writeBuffer(a,0,n,0);else{let h=ip(n),d=h?1:n.BYTES_PER_ELEMENT;for(let c=0,m=u.length;c\\u003cm;c++){let g=u[c],y,b;if(l!==void 0){let S=Math.floor(g.start/o),T=Math.ceil((g.start+g.count)/o)-S;y=S*l*d,b=T*l*d}else y=g.start*d,b=g.count*d;let v=y*(h?n.BYTES_PER_ELEMENT:1);i.queue.writeBuffer(a,v,n,y,b)}t.clearUpdateRanges()}}createShaderVertexBuffers(e){let t=e.getAttributes(),r=new Map;for(let i=0;i\\u003ct.length;i++){let s=t[i],a=s.array.BYTES_PER_ELEMENT,n=this._getBufferAttribute(s),o=r.get(n);if(o===void 0){let h,d;s.isInterleavedBufferAttribute===!0?(h=s.data.stride*a,d=s.data.isInstancedInterleavedBuffer?Ey.Instance:Ey.Vertex):(h=s.itemSize*a,d=s.isInstancedBufferAttribute?Ey.Instance:Ey.Vertex,s.itemSize>1&&h%4!==0&&(h=Math.floor((h+3)/4)*4)),s.normalized===!1&&(s.array.constructor===Int16Array||s.array.constructor===Uint16Array)&&(h=4),o={arrayStride:h,attributes:[],stepMode:d},r.set(n,o)}let l=this._getVertexFormat(s),u=s.isInterleavedBufferAttribute===!0?s.offset*a:0;o.attributes.push({shaderLocation:i,offset:u,format:l})}return Array.from(r.values())}destroyAttribute(e){let t=this.backend;t.get(this._getBufferAttribute(e)).buffer.destroy(),t.delete(e)}async getArrayBufferAsync(e,t=null,r=0,i=-1){let s=this.backend,a=s.device,n=s.get(this._getBufferAttribute(e)).buffer,o=i===-1?n.size-r:i,l;if(t!==null&&t.isReadbackBuffer){let d=s.get(t);if(t._mapped===!0)throw new Error(\\\"THREE.WebGPUAttributeUtils: ReadbackBuffer must be released before being used again.\\\");if(t._mapped=!0,d.readBufferGPU===void 0){is.label=`${t.name}_readback`,is.size=t.maxByteLength,is.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,l=a.createBuffer(is),is.reset();let c=()=>{t.buffer=null,t._mapped=!1,l.unmap()},m=()=>{t.buffer=null,t._mapped=!1,l.destroy(),s.delete(t),t.removeEventListener(\\\"release\\\",c),t.removeEventListener(\\\"dispose\\\",m)};t.addEventListener(\\\"release\\\",c),t.addEventListener(\\\"dispose\\\",m),d.readBufferGPU=l}else l=d.readBufferGPU}else is.label=`${e.name}_readback`,is.size=o,is.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,l=a.createBuffer(is),is.reset();h_.label=`readback_encoder_${e.name}`;let u=a.createCommandEncoder(h_);h_.reset(),u.copyBufferToBuffer(n,r,l,0,o);let h=u.finish();if(kn(a,h),await l.mapAsync(GPUMapMode.READ,0,o),t===null){let d=l.getMappedRange(0,o).slice();return l.destroy(),d}else{if(t.isReadbackBuffer)return t.buffer=l.getMappedRange(0,o),t;{let d=l.getMappedRange(0,o);return new Uint8Array(t).set(new Uint8Array(d)),l.destroy(),t}}}_getVertexFormat(e){let{itemSize:t,normalized:r}=e,i=e.array.constructor,s=e.constructor,a;if(t===1)a=BX.get(i);else{let n=(PX.get(s)||vB.get(i))[r?1:0];if(n){let o=i.BYTES_PER_ELEMENT*t,l=Math.floor((o+3)/4)*4/i.BYTES_PER_ELEMENT;if(l%1)throw new Error(\\\"THREE.WebGPUAttributeUtils: Bad vertex format item size.\\\");a=`${n}x${l}`}}return a||Ce(\\\"WebGPUAttributeUtils: Vertex format not supported yet.\\\"),a}_getBufferAttribute(e){return e.isInterleavedBufferAttribute&&(e=e.data),e}},Js=new lB,um=new Wd,$d=new a_,FX=class{constructor(e){this.layoutGPU=e,this.usedTimes=0}},LX=class{constructor(e){this.backend=e,this._bindGroupLayoutCache=new Map}createBindingsLayout(e){let t=this.backend,r=t.device,i=t.get(e);if(i.layout)return i.layout.layoutGPU;let s=this._createLayoutEntries(e),a=yd(JSON.stringify(s)),n=this._bindGroupLayoutCache.get(a);return n===void 0&&(n=new FX(r.createBindGroupLayout({entries:s})),this._bindGroupLayoutCache.set(a,n)),n.usedTimes++,i.layout=n,i.layoutKey=a,n.layoutGPU}createBindings(e,t,r,i=0){let{backend:s}=this,a=s.get(e),n=this.createBindingsLayout(e),o;r>0&&(a.groups===void 0&&(a.groups=[],a.versions=[]),a.versions[r]===i&&(o=a.groups[r])),o===void 0&&(o=this.createBindGroup(e,n),r>0&&(a.groups[r]=o,a.versions[r]=i)),a.group=o}updateBinding(e){let t=this.backend,r=t.device,i=e.buffer,s=t.get(e).buffer,a=e.updateRanges;if(a.length===0)r.queue.writeBuffer(s,0,i,0);else{let n=ip(i),o=n?1:i.BYTES_PER_ELEMENT,l=a[0].start;for(let u=0,h=a.length;u\\u003ch;u++){let d=a[u],c=a[u+1],m=d.start+d.count;if(c!==void 0&&c.start===m)continue;let g=l*o,y=(m-l)*o,b=g*(n?i.BYTES_PER_ELEMENT:1);r.queue.writeBuffer(s,b,i,g,y),c!==void 0&&(l=c.start)}}}createBindGroupIndex(e,t){let r=this.backend.device,i=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,s=e[0];um.label=\\\"bindingCameraIndex_\\\"+s,um.size=16,um.usage=i;let a=r.createBuffer(um);um.reset(),r.queue.writeBuffer(a,0,e,0),Js.label=\\\"bindGroupCameraIndex_\\\"+s,Js.layout=t,Js.entries.push({binding:0,resource:{buffer:a}});let n=r.createBindGroup(Js);return Js.reset(),n}createBindGroup(e,t){let r=this.backend,i=r.device,s=0;Js.label=\\\"bindGroup_\\\"+e.name,Js.layout=t;for(let n of e.bindings){if(n.isUniformBuffer){let o=r.get(n);Js.entries.push({binding:s,resource:{buffer:o.buffer}})}else if(n.isStorageBuffer){let o=r.get(n.attribute).buffer;Js.entries.push({binding:s,resource:{buffer:o}})}else if(n.isSampledTexture){let o=r.get(n.texture),l;if(o.externalTexture!==void 0)l=i.importExternalTexture({source:o.externalTexture});else{let u=n.store?1:o.texture.mipLevelCount,h=n.store?n.mipLevel:0,d=`view-${o.texture.width}-${o.texture.height}`;if(o.texture.depthOrArrayLayers>1&&(d+=`-${o.texture.depthOrArrayLayers}`),d+=`-${u}-${h}`,l=o[d],l===void 0){let c=sX.All,m;n.isSampledCubeTexture?m=Oi.Cube:n.texture.isArrayTexture||n.texture.isDataArrayTexture||n.texture.isCompressedArrayTexture?m=Oi.TwoDArray:n.isSampledTexture3D?m=Oi.ThreeD:m=Oi.TwoD,$d.aspect=c,$d.dimension=m,$d.mipLevelCount=u,$d.baseMipLevel=h,l=o[d]=o.texture.createView($d),$d.reset()}}Js.entries.push({binding:s,resource:l})}else if(n.isSampler){let o=r.get(n);Js.entries.push({binding:s,resource:o.sampler})}s++}let a=i.createBindGroup(Js);return Js.reset(),a}_createLayoutEntries(e){let t=[],r=0;for(let i of e.bindings){let s=this.backend,a={binding:r,visibility:i.visibility};if(i.isUniformBuffer||i.isStorageBuffer){let n={};i.isStorageBuffer&&(i.visibility&Ln.COMPUTE&&(i.access===Fi.READ_WRITE||i.access===Fi.WRITE_ONLY)?n.type=sB.Storage:n.type=sB.ReadOnlyStorage),a.buffer=n}else if(i.isSampledTexture&&i.store){let n={};n.format=this.backend.get(i.texture).texture.format;let o=i.access;o===Fi.READ_WRITE?n.access=r_.ReadWrite:o===Fi.WRITE_ONLY?n.access=r_.WriteOnly:n.access=r_.ReadOnly,i.texture.isArrayTexture?n.viewDimension=Oi.TwoDArray:i.texture.is3DTexture&&(n.viewDimension=Oi.ThreeD),a.storageTexture=n}else if(i.isSampledTexture){let n={},{primarySamples:o}=s.utils.getTextureSampleData(i.texture);if(o>1&&(n.multisampled=!0,i.texture.isDepthTexture||(n.sampleType=Zu.UnfilterableFloat)),i.texture.isDepthTexture)s.compatibilityMode&&i.texture.compareFunction===null?n.sampleType=Zu.UnfilterableFloat:n.sampleType=Zu.Depth;else{let l=i.texture.type;l===ci?n.sampleType=Zu.SInt:l===gr?n.sampleType=Zu.UInt:l===Er&&(this.backend.hasFeature(\\\"float32-filterable\\\")?n.sampleType=Zu.Float:n.sampleType=Zu.UnfilterableFloat)}i.isSampledCubeTexture?n.viewDimension=Oi.Cube:i.texture.isArrayTexture||i.texture.isDataArrayTexture||i.texture.isCompressedArrayTexture?n.viewDimension=Oi.TwoDArray:i.isSampledTexture3D&&(n.viewDimension=Oi.ThreeD),a.texture=n}else if(i.isSampler){let n={};i.texture.isDepthTexture&&(i.texture.compareFunction!==null&&i.textureNode.compareNode!==null&&s.hasCompatibility(fu.TEXTURE_COMPARE)?n.type=aB.Comparison:n.type=aB.NonFiltering),a.sampler=n}else Ce(`WebGPUBindingUtils: Unsupported binding \\\"${i}\\\".`);t.push(a),r++}return t}deleteBindGroupData(e){let{backend:t}=this,r=t.get(e);r.layout&&(r.layout.usedTimes--,r.layout.usedTimes===0&&this._bindGroupLayoutCache.delete(r.layoutKey),r.layout=void 0,r.layoutKey=void 0)}dispose(){this._bindGroupLayoutCache.clear()}},kX=class{constructor(e){this.backend=e}getMaxAnisotropy(){return 16}getUniformBufferLimit(){return this.backend.device.limits.maxUniformBufferBindingSize}},DX=class{constructor(){this.label=\\\"\\\",this.layout=null,this.compute=null}reset(){this.label=\\\"\\\",this.layout=null,this.compute=null}},OX=class{constructor(){this.label=\\\"\\\",this.bindGroupLayouts=null}reset(){this.label=\\\"\\\",this.bindGroupLayouts=null}},hm=new DX,qd=new OX,Yd=new uB,Qs=new hB,UX=class{constructor(e){this.backend=e}_getSampleCount(e){return this.backend.utils.getSampleCountRenderContext(e)}createRenderPipeline(e,t){let{object:r,material:i,geometry:s,pipeline:a}=e,{vertexProgram:n,fragmentProgram:o}=a,l=this.backend,u=l.device,h=l.utils,d=l.get(a),c=[];for(let z of e.getBindings()){let H=l.get(z),{layoutGPU:ue}=H.layout;c.push(ue)}let m=l.attributeUtils.createShaderVertexBuffers(e),g;i.blending!==Kn&&(i.blending!==oa||i.transparent!==!1)&&(g=this._getBlending(i));let y={};i.stencilWrite===!0&&(y={compare:this._getStencilCompare(i),failOp:this._getStencilOperation(i.stencilFail),depthFailOp:this._getStencilOperation(i.stencilZFail),passOp:this._getStencilOperation(i.stencilZPass)});let b=this._getColorWriteMask(i),v=[];if(e.context.textures!==null){let z=e.context.textures,H=e.context.mrt;for(let ue=0;ue\\u003cz.length;ue++){let ne=z[ue],re=h.getTextureFormatGPU(ne),ce;if(H!==null)if(this.backend.compatibilityMode!==!0){let ge=H.getBlendMode(ne.name);ge.blending===tv?ce=g:ge.blending!==Kn&&(ce=this._getBlending(ge))}else Et(\\\"WebGPURenderer: Multiple Render Targets (MRT) blending configuration is not fully supported in compatibility mode. The material blending will be used for all render targets.\\\"),ce=g;else ce=g;v.push({format:re,blend:ce,writeMask:b})}}else{let z=h.getCurrentColorFormat(e.context);v.push({format:z,blend:g,writeMask:b})}let S=l.get(n).module,T=l.get(o).module,w=this._getPrimitiveState(r,s,i),N=this._getDepthCompare(i),C=h.getCurrentDepthStencilFormat(e.context),R=this._getSampleCount(e.context);qd.bindGroupLayouts=c;let E=u.createPipelineLayout(qd);qd.reset(),Qs.label=`renderPipeline_${i.name||i.type}_${i.id}`,Qs.vertex=Object.assign({},S,{buffers:m}),Qs.fragment=Object.assign({},T,{targets:v}),Qs.primitive=w,Qs.multisample.count=R,Qs.multisample.alphaToCoverageEnabled=i.alphaToCoverage&&R>1,Qs.layout=E;let P={},I=e.context.depth,O=e.context.stencil;(I===!0||O===!0)&&(I===!0&&(P.format=C,P.depthWriteEnabled=i.depthWrite,P.depthCompare=N),O===!0&&(P.stencilFront=y,P.stencilBack=y,P.stencilReadMask=i.stencilFuncMask,P.stencilWriteMask=i.stencilWriteMask),i.polygonOffset===!0&&w.topology===im.TriangleList&&(P.depthBias=i.polygonOffsetUnits,P.depthBiasSlopeScale=i.polygonOffsetFactor,P.depthBiasClamp=0),Qs.depthStencil=P),u.pushErrorScope(\\\"validation\\\");let L=[{program:n,module:S.module},{program:o,module:T.module}],X=Qs.label;if(t===null)d.pipeline=u.createRenderPipeline(Qs),Qs.reset(),u.popErrorScope().then(z=>{z!==null&&(d.error=!0,Ce(`WebGPURenderer: Render pipeline creation failed (${X}): ${z.message}`),this._reportShaderDiagnostics(L,X))});else{let z=new Promise(async H=>{try{let ue=null,ne=null;try{ne=u.createRenderPipelineAsync(Qs)}catch(ce){ue=ce}if(Qs.reset(),ne!==null)try{d.pipeline=await ne}catch(ce){ue=ce}let re=await u.popErrorScope();if(re!==null||ue!==null){d.error=!0;let ce=re&&re.message||ue&&ue.message||\\\"unknown\\\";Ce(`WebGPURenderer: Async render pipeline creation failed (${X}): ${ce}`),await this._reportShaderDiagnostics(L,X)}}finally{H()}});t.push(z)}}createBundleEncoder(e,t=\\\"renderBundleEncoder\\\"){let r=this.backend,{utils:i,device:s}=r,a=i.getCurrentDepthStencilFormat(e),n=i.getCurrentColorFormats(e),o=this._getSampleCount(e);Yd.label=t,Yd.colorFormats=n,Yd.depthStencilFormat=a,Yd.sampleCount=o;let l=s.createRenderBundleEncoder(Yd);return Yd.reset(),l}createComputePipeline(e,t){let r=this.backend,i=r.device,s=r.get(e.computeProgram).module,a=r.get(e),n=[];for(let h of t){let d=r.get(h),{layoutGPU:c}=d.layout;n.push(c)}let o=e.computeProgram,l=`computePipeline_${o.stage}${o.name?`_${o.name}`:\\\"\\\"}`;i.pushErrorScope(\\\"validation\\\"),qd.bindGroupLayouts=n;let u=i.createPipelineLayout(qd);qd.reset(),hm.label=l,hm.compute=s,hm.layout=u,a.pipeline=i.createComputePipeline(hm),hm.reset(),i.popErrorScope().then(h=>{h!==null&&(a.error=!0,Ce(`WebGPURenderer: Compute pipeline creation failed (${l}): ${h.message}`),this._reportShaderDiagnostics([{program:o,module:s.module}],l))})}async _reportShaderDiagnostics(e,t){for(let{program:r,module:i}of e){let s=await i.getCompilationInfo();if(s.messages.length===0)continue;let a=r.code.split(`\\n`);for(let n of s.messages){let o=n.lineNum>0?` at line ${n.lineNum}${n.linePos>0?`:${n.linePos}`:\\\"\\\"}`:\\\"\\\",l=`WebGPURenderer [${t} / ${r.stage} ${n.type}]${o}: ${n.message}`,u=\\\"\\\";n.lineNum>0&&n.lineNum\\u003c=a.length&&(u=`\\n ${a[n.lineNum-1]}`,n.linePos>0&&(u+=`\\n ${\\\" \\\".repeat(n.linePos-1)}^`)),(n.type===\\\"error\\\"?Ce:Ue)(l+u)}}}_getBlending(e){let t,r,i=e.blending,s=e.blendSrc,a=e.blendDst,n=e.blendEquation;if(i===Uh){let o=e.blendSrcAlpha!==null?e.blendSrcAlpha:s,l=e.blendDstAlpha!==null?e.blendDstAlpha:a,u=e.blendEquationAlpha!==null?e.blendEquationAlpha:n;t={srcFactor:this._getBlendFactor(s),dstFactor:this._getBlendFactor(a),operation:this._getBlendOperation(n)},r={srcFactor:this._getBlendFactor(o),dstFactor:this._getBlendFactor(l),operation:this._getBlendOperation(u)}}else{let o=e.premultipliedAlpha,l=(u,h,d,c)=>{t={srcFactor:u,dstFactor:h,operation:Yu.Add},r={srcFactor:d,dstFactor:c,operation:Yu.Add}};if(o)switch(i){case oa:l(zt.One,zt.OneMinusSrcAlpha,zt.One,zt.OneMinusSrcAlpha);break;case kh:l(zt.One,zt.One,zt.One,zt.One);break;case Dh:l(zt.Zero,zt.OneMinusSrc,zt.Zero,zt.One);break;case Oh:l(zt.Dst,zt.OneMinusSrcAlpha,zt.Zero,zt.One);break}else switch(i){case oa:l(zt.SrcAlpha,zt.OneMinusSrcAlpha,zt.One,zt.OneMinusSrcAlpha);break;case kh:l(zt.SrcAlpha,zt.One,zt.One,zt.One);break;case Dh:Ce(`WebGPURenderer: \\\"SubtractiveBlending\\\" requires \\\"${e.isMaterial?\\\"material\\\":\\\"blendMode\\\"}.premultipliedAlpha = true\\\".`);break;case Oh:Ce(`WebGPURenderer: \\\"MultiplyBlending\\\" requires \\\"${e.isMaterial?\\\"material\\\":\\\"blendMode\\\"}.premultipliedAlpha = true\\\".`);break}}if(t!==void 0&&r!==void 0)return{color:t,alpha:r};Ce(\\\"WebGPURenderer: Invalid blending: \\\",i)}_getBlendFactor(e){let t;switch(e){case Jo:t=zt.Zero;break;case TM:t=zt.One;break;case SM:t=zt.Src;break;case _M:t=zt.OneMinusSrc;break;case $c:t=zt.SrcAlpha;break;case qc:t=zt.OneMinusSrcAlpha;break;case NM:t=zt.Dst;break;case AM:t=zt.OneMinusDst;break;case wM:t=zt.DstAlpha;break;case MM:t=zt.OneMinusDstAlpha;break;case CM:t=zt.SrcAlphaSaturated;break;case EG:t=zt.Constant;break;case PG:t=zt.OneMinusConstant;break;default:Ce(\\\"WebGPURenderer: Blend factor not supported.\\\",e)}return t}_getStencilCompare(e){let t,r=e.stencilFunc;switch(r){case HD:t=Di.Never;break;case gv:t=Di.Always;break;case XD:t=Di.Less;break;case qD:t=Di.LessEqual;break;case $D:t=Di.Equal;break;case JD:t=Di.GreaterEqual;break;case YD:t=Di.Greater;break;case ZD:t=Di.NotEqual;break;default:Ce(\\\"WebGPURenderer: Invalid stencil function.\\\",r)}return t}_getStencilOperation(e){let t;switch(e){case mu:t=Bl.Keep;break;case OD:t=Bl.Zero;break;case UD:t=Bl.Replace;break;case jD:t=Bl.Invert;break;case zD:t=Bl.IncrementClamp;break;case VD:t=Bl.DecrementClamp;break;case GD:t=Bl.IncrementWrap;break;case WD:t=Bl.DecrementWrap;break;default:Ce(\\\"WebGPURenderer: Invalid stencil operation.\\\",t)}return t}_getBlendOperation(e){let t;switch(e){case la:t=Yu.Add;break;case vM:t=Yu.Subtract;break;case bM:t=Yu.ReverseSubtract;break;case MD:t=Yu.Min;break;case ND:t=Yu.Max;break;default:Ce(\\\"WebGPUPipelineUtils: Blend equation not supported.\\\",e)}return t}_getPrimitiveState(e,t,r){let i={},s=this.backend.utils;i.topology=s.getPrimitiveTopology(e,r),t.index!==null&&e.isLine===!0&&e.isLineSegments!==!0&&(i.stripIndexFormat=t.index.array instanceof Uint16Array?Ry.Uint16:Ry.Uint32);let a=r.side===ii;return e.isMesh&&e.matrixWorld.determinantAffine()\\u003c0&&(a=!a),i.frontFace=a===!0?tB.CW:tB.CCW,i.cullMode=r.side===hs?rB.None:rB.Back,i}_getColorWriteMask(e){return e.colorWrite===!0?iB.All:iB.None}_getDepthCompare(e){let t;if(e.depthTest===!1)t=Di.Always;else{let r=this.backend.parameters.reversedDepthBuffer?GM[e.depthFunc]:e.depthFunc;switch(r){case Af:t=Di.Never;break;case Cf:t=Di.Always;break;case Rf:t=Di.Less;break;case zh:t=Di.LessEqual;break;case Ef:t=Di.Equal;break;case Pf:t=Di.GreaterEqual;break;case Bf:t=Di.Greater;break;case If:t=Di.NotEqual;break;default:Ce(\\\"WebGPUPipelineUtils: Invalid depth function.\\\",r)}}return t}},bB=class{constructor(){this.label=\\\"\\\",this.type=void 0,this.count=0}reset(){this.label=\\\"\\\",this.type=void 0,this.count=0}},Dn=new Wd,zX=new sm,dm=new bB,VX=class extends K3{constructor(e,t,r=2048){super(r),this.device=e,this.type=t,dm.label=`queryset_global_timestamp_${t}`,dm.type=\\\"timestamp\\\",dm.count=this.maxQueries,this.querySet=this.device.createQuerySet(dm),dm.reset();let i=this.maxQueries*8;Dn.label=`buffer_timestamp_resolve_${t}`,Dn.size=i,Dn.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,this.resolveBuffer=this.device.createBuffer(Dn),Dn.reset(),Dn.label=`buffer_timestamp_result_${t}`,Dn.size=i,Dn.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ,this.resultBuffer=this.device.createBuffer(Dn),Dn.reset()}allocateQueriesForContext(e){if(!this.trackTimestamp||this.isDisposed)return null;if(this.currentQueryIndex+2>this.maxQueries)return Et(`WebGPUTimestampQueryPool [${this.type}]: Maximum number of queries exceeded, when using trackTimestamp it is necessary to resolves the queries via renderer.resolveTimestampsAsync( THREE.TimestampQuery.${this.type.toUpperCase()} ).`),null;let t=this.currentQueryIndex;return this.currentQueryIndex+=2,this.queryOffsets.set(e,t),t}async resolveQueriesAsync(){if(!this.trackTimestamp||this.currentQueryIndex===0||this.isDisposed)return this.lastValue;if(this.pendingResolve)return this.pendingResolve;this.pendingResolve=this._resolveQueries();try{return await this.pendingResolve}finally{this.pendingResolve=null}}async _resolveQueries(){if(this.isDisposed)return this.lastValue;try{if(this.resultBuffer.mapState!==\\\"unmapped\\\")return this.lastValue;let e=new Map(this.queryOffsets),t=this.currentQueryIndex,r=t*8;this.currentQueryIndex=0,this.queryOffsets.clear();let i=this.device.createCommandEncoder(zX);i.resolveQuerySet(this.querySet,0,t,this.resolveBuffer,0),i.copyBufferToBuffer(this.resolveBuffer,0,this.resultBuffer,0,r);let s=i.finish();if(kn(this.device,s),this.resultBuffer.mapState!==\\\"unmapped\\\")return this.lastValue;if(await this.resultBuffer.mapAsync(GPUMapMode.READ,0,r),this.isDisposed)return this.resultBuffer.mapState===\\\"mapped\\\"&&this.resultBuffer.unmap(),this.lastValue;let a=new BigUint64Array(this.resultBuffer.getMappedRange(0,r)),n={},o=[];for(let[u,h]of e){let d=u.match(/^(.*):f(\\\\d+)$/),c=parseInt(d[2]);o.includes(c)===!1&&o.push(c),n[c]===void 0&&(n[c]=0);let m=a[h],g=a[h+1],y=Number(g-m)/1e6;this.timestamps.set(u,y),n[c]+=y}let l=n[o[o.length-1]];return this.resultBuffer.unmap(),this.lastValue=l,this.frames=o,l}catch(e){return Ce(\\\"Error resolving queries:\\\",e),this.resultBuffer.mapState===\\\"mapped\\\"&&this.resultBuffer.unmap(),this.lastValue}}async dispose(){if(!this.isDisposed){if(this.isDisposed=!0,this.pendingResolve)try{await this.pendingResolve}catch(e){Ce(\\\"Error waiting for pending resolve:\\\",e)}if(this.resultBuffer&&this.resultBuffer.mapState===\\\"mapped\\\")try{this.resultBuffer.unmap()}catch(e){Ce(\\\"Error unmapping buffer:\\\",e)}this.querySet&&(this.querySet.destroy(),this.querySet=null),this.resolveBuffer&&(this.resolveBuffer.destroy(),this.resolveBuffer=null),this.resultBuffer&&(this.resultBuffer.destroy(),this.resultBuffer=null),this.queryOffsets.clear(),this.pendingResolve=null}}},GX=class{constructor(){this.label=\\\"\\\",this.timestampWrites=void 0}reset(){this.label=\\\"\\\",this.timestampWrites=void 0}},Oy=class{constructor(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}reset(){this.view=null,this.depthLoadOp=void 0,this.depthStoreOp=void 0,this.depthClearValue=void 0,this.depthReadOnly=!1,this.stencilLoadOp=void 0,this.stencilStoreOp=void 0,this.stencilClearValue=0,this.stencilReadOnly=!1}},WX=class{constructor(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}reset(){this.querySet=null,this.beginningOfPassWriteIndex=void 0,this.endOfPassWriteIndex=void 0}},Xa={r:0,g:0,b:0,a:1},Ks=new Wd,_s=new sm,Uy=new GX,cm=new bB,zy=new dB,Vy=new WX,Sa=new Fy,On=new Fy,Nr=new a_,Ro=new cB,jX=class extends Y3{constructor(e={}){super(e),this.isWebGPUBackend=!0,this.parameters.alpha=e.alpha===void 0?!0:e.alpha,this.parameters.requiredLimits=e.requiredLimits===void 0?{}:e.requiredLimits,this.compatibilityMode=null,this.device=null,this.defaultRenderPassdescriptor=null,this.utils=new uX(this),this.attributeUtils=new IX(this),this.bindingUtils=new LX(this),this.capabilities=new kX(this),this.pipelineUtils=new UX(this),this.textureUtils=new bX(this),this.occludedResolveCache=new Map;let t=typeof navigator>\\\"u\\\"?!0:/Android/.test(navigator.userAgent)===!1;this._compatibility={[fu.TEXTURE_COMPARE]:t}}async init(e){await super.init(e);let t=this.parameters,r;if(t.device===void 0){let i={powerPreference:t.powerPreference,featureLevel:\\\"compatibility\\\",xrCompatible:e.xr.enabled},s=typeof navigator\\u003c\\\"u\\\"?await navigator.gpu.requestAdapter(i):null;if(s===null)throw new Error(\\\"THREE.WebGPUBackend: Unable to create WebGPU adapter.\\\");let a=Object.values(Py),n=[];for(let l of a)s.features.has(l)&&n.push(l);let o={requiredFeatures:n,requiredLimits:t.requiredLimits};r=await s.requestDevice(o)}else r=t.device;this.compatibilityMode=!r.features.has(\\\"core-features-and-limits\\\"),this.compatibilityMode&&(e._samples=0),r.lost.then(i=>{if(i.reason===\\\"destroyed\\\")return;let s={api:\\\"WebGPU\\\",message:i.message||\\\"Unknown reason\\\",reason:i.reason||null,originalEvent:i};e.onDeviceLost(s)}),r.onuncapturederror=i=>{let s=i.error,a=s&&s.constructor?s.constructor.name:\\\"GPUError\\\",n=s&&s.message||\\\"Unknown uncaptured GPU error\\\";e.onError({api:\\\"WebGPU\\\",type:a,message:n,originalEvent:i})},this.device=r,this.trackTimestamp=this.trackTimestamp&&this.hasFeature(Py.TimestampQuery),this.updateSize()}setXRRenderTargetTextures(e,t,r=null){this.set(e.texture,{texture:t,format:t.format,externalTexture:!0,xrViewDescriptors:r,initialized:!0})}get context(){let e=this.renderer.getCanvasTarget(),t=this.get(e),r=t.context;if(r===void 0){let i=this.parameters;e.isDefaultCanvasTarget===!0&&i.context!==void 0?r=i.context:r=e.domElement.getContext(\\\"webgpu\\\"),\\\"setAttribute\\\"in e.domElement&&e.domElement.setAttribute(\\\"data-engine\\\",\\\"three.js r185 webgpu\\\");let s=i.alpha?\\\"premultiplied\\\":\\\"opaque\\\",a=i.outputType===Dt?\\\"extended\\\":\\\"standard\\\";r.configure({device:this.device,format:this.utils.getPreferredCanvasFormat(),usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,alphaMode:s,toneMapping:{mode:a}}),t.context=r}return r}get coordinateSystem(){return da}get hasTimestamp(){return!0}async getArrayBufferAsync(e,t=null,r=0,i=-1){return await this.attributeUtils.getArrayBufferAsync(e,t,r,i)}getContext(){return this.context}_getDefaultRenderPassDescriptor(){let e=this.renderer,t=e.getCanvasTarget(),r=this.get(t),i=e.currentSamples,s=r.descriptor;if(s===void 0||r.samples!==i){if(s=new nm,s.colorAttachments.push(new am),e.depth===!0||e.stencil===!0){let o=new Oy;o.view=this.textureUtils.getDepthBuffer(e.depth,e.stencil).createView(),s.depthStencilAttachment=o}let n=s.colorAttachments[0];i>0?n.view=this.textureUtils.getColorBuffer().createView():n.resolveTarget=void 0,r.descriptor=s,r.samples=i}let a=s.colorAttachments[0];return i>0?a.resolveTarget=this.context.getCurrentTexture().createView():a.view=this.context.getCurrentTexture().createView(),s}_isRenderCameraDepthArray(e){let t=e.camera;return e.depthTexture&&e.depthTexture.isArrayTexture===!0&&t!==null&&t.isArrayCamera===!0}_hasExternalTexture(e){let t=e.textures;if(t===null)return!1;for(let r=0;r\\u003ct.length;r++)if(this.get(t[r]).externalTexture===!0)return!0;return!1}_createExternalTextureViews(e,t){let r=[],i=e.camera;if(t.xrViewDescriptors&&i!==null&&i.isArrayCamera===!0)for(let s=0;s\\u003ct.xrViewDescriptors.length;s++)r.push({view:t.texture.createView(t.xrViewDescriptors[s]),resolveTarget:void 0,depthSlice:void 0});else r.push({view:t.texture.createView({dimension:Oi.TwoD,baseArrayLayer:e.activeCubeFace,arrayLayerCount:1}),resolveTarget:void 0,depthSlice:void 0});return r}_getRenderPassDescriptor(e,t={}){let r=e.renderTarget,i=this.get(r),s=this._hasExternalTexture(e),a=i.descriptors;(a===void 0||i.width!==r.width||i.height!==r.height||i.samples!==r.samples||s)&&(a={},i.descriptors=a);let n=e.getCacheKey(),o=a[n];if(o===void 0||s){let u=e.textures,h=[],d,c=this._isRenderCameraDepthArray(e);for(let g=0;g\\u003cu.length;g++){let y=this.get(u[g]);if(y.externalTexture===!0){h.push(...this._createExternalTextureViews(e,y));continue}if(Nr.label=`colorAttachment_${g}`,Nr.baseMipLevel=e.activeMipmapLevel,Nr.mipLevelCount=1,Nr.baseArrayLayer=e.activeCubeFace,Nr.arrayLayerCount=1,Nr.dimension=Oi.TwoD,r.isRenderTarget3D)d=e.activeCubeFace,Nr.baseArrayLayer=0,Nr.dimension=Oi.ThreeD;else if(r.isRenderTarget&&u[g].image.depth>1)if(c===!0){let b=e.camera.cameras;for(let v=0;v\\u003cb.length;v++){Nr.baseArrayLayer=v,Nr.arrayLayerCount=1,Nr.dimension=Oi.TwoD;let S=y.texture.createView(Nr);h.push({view:S,resolveTarget:void 0,depthSlice:void 0})}}else Nr.dimension=Oi.TwoDArray;if(c!==!0){let b=y.texture.createView(Nr),v,S;y.msaaTexture!==void 0?(v=y.msaaTexture.createView(),S=b):(v=b,S=void 0),h.push({view:v,resolveTarget:S,depthSlice:d})}Nr.reset()}let m=[];for(let g=0;g\\u003ch.length;g++){let y=h[g],b=new am;b.view=y.view,b.depthSlice=y.depthSlice,b.resolveTarget=y.resolveTarget,m.push(b)}if(o={textureViews:h,colorAttachments:m,descriptor:new nm},e.depth){let g=this.get(e.depthTexture);(e.depthTexture.isArrayTexture||e.depthTexture.isCubeTexture)&&(Nr.dimension=Oi.TwoD,Nr.arrayLayerCount=1,Nr.baseArrayLayer=e.activeCubeFace);let y=new Oy;y.view=g.texture.createView(Nr),o.depthStencilAttachment=y,Nr.reset()}a[n]=o,i.width=r.width,i.height=r.height,i.samples=r.samples,i.activeMipmapLevel=e.activeMipmapLevel,i.activeCubeFace=e.activeCubeFace}let l=o.descriptor;l.reset();for(let u=0;u\\u003co.colorAttachments.length;u++){let h=o.colorAttachments[u],d={r:0,g:0,b:0,a:1};u===0&&t.clearValue&&(d=t.clearValue),h.loadOp=t.loadOp||Kt.Load,h.storeOp=t.storeOp||Ss.Store,h.clearValue=d,l.colorAttachments.push(h)}return o.depthStencilAttachment&&(l.depthStencilAttachment=o.depthStencilAttachment),l}beginRender(e){let t=this.get(e),r=this.device,i=e.occlusionQueryCount,s;i>0&&(t.currentOcclusionQuerySet&&t.currentOcclusionQuerySet.destroy(),t.currentOcclusionQueryBuffer&&t.currentOcclusionQueryBuffer.destroy(),t.currentOcclusionQuerySet=t.occlusionQuerySet,t.currentOcclusionQueryBuffer=t.occlusionQueryBuffer,t.currentOcclusionQueryObjects=t.occlusionQueryObjects,cm.label=`occlusionQuerySet_${e.id}`,cm.type=\\\"occlusion\\\",cm.count=i,s=r.createQuerySet(cm),cm.reset(),t.occlusionQuerySet=s,t.occlusionQueryIndex=0,t.occlusionQueryObjects=new Array(i),t.lastOcclusionObject=null);let a;e.textures===null?a=this._getDefaultRenderPassDescriptor():a=this._getRenderPassDescriptor(e,{loadOp:Kt.Load}),this.initTimestampQuery(un.RENDER,this.getTimestampUID(e),a),a.occlusionQuerySet=s;let n=a.depthStencilAttachment;if(e.textures!==null){let l=a.colorAttachments;for(let u=0;u\\u003cl.length;u++){let h=l[u];e.clearColor?(u===0?h.clearValue=e.clearColorValue:(Xa.r=0,Xa.g=0,Xa.b=0,Xa.a=1,h.clearValue=Xa),h.loadOp=Kt.Clear):h.loadOp=Kt.Load,h.storeOp=Ss.Store}}else{let l=a.colorAttachments[0];e.clearColor?(l.clearValue=e.clearColorValue,l.loadOp=Kt.Clear):l.loadOp=Kt.Load,l.storeOp=Ss.Store}e.depth&&(e.clearDepth?(n.depthClearValue=e.clearDepthValue,n.depthLoadOp=Kt.Clear):n.depthLoadOp=Kt.Load,n.depthStoreOp=Ss.Store),e.stencil&&(e.clearStencil?(n.stencilClearValue=e.clearStencilValue,n.stencilLoadOp=Kt.Clear):n.stencilLoadOp=Kt.Load,n.stencilStoreOp=Ss.Store),_s.label=\\\"renderContext_\\\"+e.id;let o=r.createCommandEncoder(_s);if(_s.reset(),this._isRenderCameraDepthArray(e)===!0){let l=e.camera.cameras;!t.layerDescriptors||t.layerDescriptors.length!==l.length?this._createArrayCameraLayerDescriptors(e,t,a,l):this._updateArrayCameraLayerDescriptors(e,t,l),t.bundleEncoders=[],t.bundleSets=[];for(let u=0;u\\u003cl.length;u++){let h=this.pipelineUtils.createBundleEncoder(e,\\\"renderBundleArrayCamera_\\\"+u),d={attributes:{},bindingGroups:[],pipeline:null,index:null};t.bundleEncoders.push(h),t.bundleSets.push(d)}t.currentPass=null}else{let l=o.beginRenderPass(a);t.currentPass=l,e.viewport&&this.updateViewport(e),e.scissor&&this.updateScissor(e)}t.descriptor=a,t.encoder=o,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.renderBundles=[]}_createArrayCameraLayerDescriptors(e,t,r,i){let s=r.depthStencilAttachment;t.layerDescriptors=[];let a=this.get(e.depthTexture);a.viewCache||(a.viewCache=[]);for(let n=0;n\\u003ci.length;n++){let o=r.colorAttachments[0],l=new am;l.view=r.colorAttachments[n].view,l.depthSlice=o.depthSlice,l.resolveTarget=o.resolveTarget,l.loadOp=o.loadOp,l.storeOp=o.storeOp,l.clearValue=o.clearValue;let u=new nm;if(u.label=r.label,u.occlusionQuerySet=r.occlusionQuerySet,u.timestampWrites=r.timestampWrites,u.colorAttachments.push(l),r.depthStencilAttachment){let h=n;a.viewCache[h]||(Nr.dimension=Oi.TwoD,Nr.baseArrayLayer=n,Nr.arrayLayerCount=1,a.viewCache[h]=a.texture.createView(Nr),Nr.reset());let d=new Oy;d.view=a.viewCache[h],d.depthLoadOp=s.depthLoadOp||Kt.Clear,d.depthStoreOp=s.depthStoreOp||Ss.Store,d.depthClearValue=s.depthClearValue||1,e.stencil&&(d.stencilLoadOp=s.stencilLoadOp,d.stencilStoreOp=s.stencilStoreOp,d.stencilClearValue=s.stencilClearValue),u.depthStencilAttachment=d}else{let h=new Oy;h.view=s.view,h.depthLoadOp=s.depthLoadOp,h.depthStoreOp=s.depthStoreOp,h.depthClearValue=s.depthClearValue,h.depthReadOnly=s.depthReadOnly,h.stencilLoadOp=s.stencilLoadOp,h.stencilStoreOp=s.stencilStoreOp,h.stencilClearValue=s.stencilClearValue,h.stencilReadOnly=s.stencilReadOnly,u.depthStencilAttachment=h}t.layerDescriptors.push(u)}}_updateArrayCameraLayerDescriptors(e,t,r){for(let i=0;i\\u003cr.length;i++){let s=t.layerDescriptors[i];if(s.depthStencilAttachment){let a=s.depthStencilAttachment;e.depth&&(e.clearDepth?(a.depthClearValue=e.clearDepthValue,a.depthLoadOp=Kt.Clear):a.depthLoadOp=Kt.Load),e.stencil&&(e.clearStencil?(a.stencilClearValue=e.clearStencilValue,a.stencilLoadOp=Kt.Clear):a.stencilLoadOp=Kt.Load)}}}finishRender(e){let t=this.get(e),r=e.occlusionQueryCount;t.renderBundles.length>0&&t.currentPass.executeBundles(t.renderBundles),r>t.occlusionQueryIndex&&t.currentPass.endOcclusionQuery();let i=t.encoder;if(this._isRenderCameraDepthArray(e)===!0){let s=[];for(let a=0;a\\u003ct.bundleEncoders.length;a++){let n=t.bundleEncoders[a];s.push(n.finish())}for(let a=0;a\\u003ct.layerDescriptors.length;a++)if(a\\u003cs.length){let n=t.layerDescriptors[a],o=i.beginRenderPass(n);if(e.viewport){let{x:l,y:u,width:h,height:d,minDepth:c,maxDepth:m}=e.viewportValue;o.setViewport(l,u,h,d,c,m)}if(e.scissor){let{x:l,y:u,width:h,height:d}=e.scissorValue;o.setScissorRect(l,u,h,d)}o.executeBundles([s[a]]),o.end()}}else t.currentPass&&t.currentPass.end();if(r>0){let s=r*8,a=this.occludedResolveCache.get(s);a===void 0&&(Ks.size=s,Ks.usage=GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC,a=this.device.createBuffer(Ks),Ks.reset(),this.occludedResolveCache.set(s,a)),Ks.size=s,Ks.usage=GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ;let n=this.device.createBuffer(Ks);Ks.reset(),t.encoder.resolveQuerySet(t.occlusionQuerySet,0,r,a,0),t.encoder.copyBufferToBuffer(a,0,n,0,s),t.occlusionQueryBuffer=n,this.resolveOccludedAsync(e)}if(kn(this.device,t.encoder.finish()),e.textures!==null){let s=e.textures;for(let a=0;a\\u003cs.length;a++){let n=s[a];n.generateMipmaps===!0&&this.textureUtils.generateMipmaps(n)}}}isOccluded(e,t){let r=this.get(e);return r.occluded&&r.occluded.has(t)}async resolveOccludedAsync(e){let t=this.get(e),{currentOcclusionQueryBuffer:r,currentOcclusionQueryObjects:i}=t;if(r&&i){let s=new WeakSet;t.currentOcclusionQueryObjects=null,t.currentOcclusionQueryBuffer=null,await r.mapAsync(GPUMapMode.READ);let a=r.getMappedRange(),n=new BigUint64Array(a);for(let o=0;o\\u003ci.length;o++)n[o]===BigInt(0)&&s.add(i[o]);r.destroy(),t.occluded=s}}updateViewport(e){let{currentPass:t}=this.get(e),{x:r,y:i,width:s,height:a,minDepth:n,maxDepth:o}=e.viewportValue;t.setViewport(r,i,s,a,n,o)}updateScissor(e){let{currentPass:t}=this.get(e),{x:r,y:i,width:s,height:a}=e.scissorValue;t.setScissorRect(r,i,s,a)}getClearColor(){let e=super.getClearColor();return this.renderer.alpha===!0&&(e.r*=e.a,e.g*=e.a,e.b*=e.a),e}clear(e,t,r,i=null){let s=this.device,a=this.renderer,n=[],o,l,u;if(e){let d=this.getClearColor();Xa.r=d.r,Xa.g=d.g,Xa.b=d.b,Xa.a=d.a}if(i===null){l=a.depth,u=a.stencil;let d=this._getDefaultRenderPassDescriptor();if(e){n=d.colorAttachments;let c=n[0];c.clearValue=Xa,c.loadOp=Kt.Clear,c.storeOp=Ss.Store}(l||u)&&(o=d.depthStencilAttachment)}else{l=i.depth,u=i.stencil;let d={loadOp:e?Kt.Clear:Kt.Load,clearValue:e?Xa:void 0};l&&(d.depthLoadOp=t?Kt.Clear:Kt.Load,d.depthClearValue=t?a.getClearDepth():void 0,d.depthStoreOp=Ss.Store),u&&(d.stencilLoadOp=r?Kt.Clear:Kt.Load,d.stencilClearValue=r?a.getClearStencil():void 0,d.stencilStoreOp=Ss.Store);let c=this._getRenderPassDescriptor(i,d);n=c.colorAttachments,o=c.depthStencilAttachment}l&&o&&(t?(o.depthLoadOp=Kt.Clear,o.depthClearValue=a.getClearDepth(),o.depthStoreOp=Ss.Store):(o.depthLoadOp=Kt.Load,o.depthStoreOp=Ss.Store)),u&&o&&(r?(o.stencilLoadOp=Kt.Clear,o.stencilClearValue=a.getClearStencil(),o.stencilStoreOp=Ss.Store):(o.stencilLoadOp=Kt.Load,o.stencilStoreOp=Ss.Store)),_s.label=\\\"clear\\\";let h=s.createCommandEncoder(_s);_s.reset(),h.beginRenderPass({colorAttachments:n,depthStencilAttachment:o}).end(),kn(s,h.finish())}beginCompute(e){let t=this.get(e),r=\\\"computeGroup_\\\"+e.id;Uy.label=r,_s.label=r,this.initTimestampQuery(un.COMPUTE,this.getTimestampUID(e),Uy),t.cmdEncoderGPU=this.device.createCommandEncoder(_s),t.passEncoderGPU=t.cmdEncoderGPU.beginComputePass(Uy),t.currentPipeline=null,_s.reset(),Uy.reset()}compute(e,t,r,i,s=null){let a=this.get(t),n=this.get(e),{passEncoderGPU:o}=n,l=this.get(i).pipeline;n.currentPipeline!==l&&(o.setPipeline(l),n.currentPipeline=l);for(let u=0,h=r.length;u\\u003ch;u++){let d=r[u],c=this.get(d);o.setBindGroup(u,c.group)}if(s===null&&(s=t.dispatchSize||t.count),s&&s.isIndirectStorageBufferAttribute){let u=this.get(s).buffer;o.dispatchWorkgroupsIndirect(u,0);return}if(typeof s==\\\"number\\\"){let u=s;if(a.dispatchSize===void 0||a.count!==u){a.dispatchSize=[0,1,1],a.count=u;let h=t.workgroupSize,d=h[0];for(let g=1;g\\u003ch.length;g++)d*=h[g];let c=Math.ceil(u/d),m=this.device.limits.maxComputeWorkgroupsPerDimension;s=[c,1,1],c>m&&(s[0]=Math.min(c,m),s[1]=Math.ceil(c/m)),a.dispatchSize=s}s=a.dispatchSize}o.dispatchWorkgroups(s[0],s[1]||1,s[2]||1)}finishCompute(e){let t=this.get(e);t.passEncoderGPU.end(),kn(this.device,t.cmdEncoderGPU.finish())}_draw(e,t,r,i,s,a,n,o,l){let{object:u,material:h,context:d}=e,c=e.getIndex(),m=c!==null;l.pipeline!==i&&(o.setPipeline(i),l.pipeline=i);let g=l.bindingGroups;for(let y=0,b=s.length;y\\u003cb;y++){let v=s[y];if(g[y]!==v.id){let S=this.get(v);o.setBindGroup(y,S.group),g[y]=v.id}}if(m===!0&&l.index!==c){let y=this.get(c).buffer,b=c.array instanceof Uint16Array?Ry.Uint16:Ry.Uint32;o.setIndexBuffer(y,b),l.index=c}for(let y=0,b=a.length;y\\u003cb;y++){let v=a[y];if(l.attributes[y]!==v){let S=this.get(v).buffer;o.setVertexBuffer(y,S),l.attributes[y]=v}}if(d.stencil===!0&&h.stencilWrite===!0&&r.currentStencilRef!==h.stencilRef&&(o.setStencilReference(h.stencilRef),r.currentStencilRef=h.stencilRef),u.isBatchedMesh===!0){let y=u._multiDrawStarts,b=u._multiDrawCounts,v=u._multiDrawCount,S=m===!0?c.array.BYTES_PER_ELEMENT:1;h.wireframe&&(S=u.geometry.attributes.position.count>65535?4:2);for(let T=0;T\\u003cv;T++)m===!0?o.drawIndexed(b[T],1,y[T]/S,0,T):o.draw(b[T],1,y[T],T),t.update(u,b[T],1)}else if(m===!0){let{vertexCount:y,instanceCount:b,firstVertex:v}=n,S=e.getIndirect();if(S!==null){let T=this.get(S).buffer,w=e.getIndirectOffset(),N=Array.isArray(w)?w:[w];for(let C=0;C\\u003cN.length;C++)o.drawIndexedIndirect(T,N[C])}else o.drawIndexed(y,b,v,0,0);t.update(u,y,b)}else{let{vertexCount:y,instanceCount:b,firstVertex:v}=n,S=e.getIndirect();if(S!==null){let T=this.get(S).buffer,w=e.getIndirectOffset(),N=Array.isArray(w)?w:[w];for(let C=0;C\\u003cN.length;C++)o.drawIndirect(T,N[C])}else o.draw(y,b,v,0);t.update(u,y,b)}}draw(e,t){let{object:r,context:i,pipeline:s}=e,a=this.get(i),n=this.get(s),o=n.pipeline;if(n.error===!0)return;let l=e.getDrawParameters();if(l===null)return;let u=e.getBindings(),h=e.getVertexBuffers();if(e.camera.isArrayCamera&&e.camera.cameras.length>0){let d=this.get(e.camera),c=e.camera.cameras,m=e.getBindingGroup(\\\"cameraIndex\\\");if(d.indexesGPU===void 0||d.indexesGPU.length!==c.length){let y=this.get(m),b=[],v=new Uint32Array([0,0,0,0]);for(let S=0,T=c.length;S\\u003cT;S++){v[0]=S;let{layoutGPU:w}=y.layout,N=this.bindingUtils.createBindGroupIndex(v,w);b.push(N)}d.indexesGPU=b}let g=this.renderer.getPixelRatio();for(let y=0,b=c.length;y\\u003cb;y++){let v=c[y];if(r.layers.test(v.layers)){let S=v.viewport,T=a.currentPass,w=a.currentSets,N=a.bundleEncoders!==void 0;if(N){let C=a.bundleEncoders[y],R=a.bundleSets[y];T=C,w=R}if(S&&!N&&T.setViewport(Math.floor(S.x*g),Math.floor(S.y*g),Math.floor(S.width*g),Math.floor(S.height*g),i.viewportValue.minDepth,i.viewportValue.maxDepth),m&&d.indexesGPU){let C=u.indexOf(m);T.setBindGroup(C,d.indexesGPU[y]),w.bindingGroups[C]=m.id}this._draw(e,t,a,o,u,h,l,T,w)}}}else if(a.currentPass){if(a.occlusionQuerySet!==void 0){let d=a.lastOcclusionObject;d!==r&&(d!==null&&d.occlusionTest===!0&&(a.currentPass.endOcclusionQuery(),a.occlusionQueryIndex++),r.occlusionTest===!0&&(a.currentPass.beginOcclusionQuery(a.occlusionQueryIndex),a.occlusionQueryObjects[a.occlusionQueryIndex]=r),a.lastOcclusionObject=r)}this._draw(e,t,a,o,u,h,l,a.currentPass,a.currentSets)}}needsRenderUpdate(e){let t=this.get(e),{object:r,material:i}=e,s=this.utils,a=s.getSampleCountRenderContext(e.context),n=s.getCurrentColorSpace(e.context),o=s.getCurrentColorFormat(e.context),l=s.getCurrentDepthStencilFormat(e.context),u=s.getPrimitiveTopology(r,i),h=r.isMesh&&r.matrixWorld.determinantAffine()\\u003c0,d=!1;return(t.material!==i||t.materialVersion!==i.version||t.transparent!==i.transparent||t.blending!==i.blending||t.premultipliedAlpha!==i.premultipliedAlpha||t.blendSrc!==i.blendSrc||t.blendDst!==i.blendDst||t.blendEquation!==i.blendEquation||t.blendSrcAlpha!==i.blendSrcAlpha||t.blendDstAlpha!==i.blendDstAlpha||t.blendEquationAlpha!==i.blendEquationAlpha||t.colorWrite!==i.colorWrite||t.depthWrite!==i.depthWrite||t.depthTest!==i.depthTest||t.depthFunc!==i.depthFunc||t.stencilWrite!==i.stencilWrite||t.stencilFunc!==i.stencilFunc||t.stencilFail!==i.stencilFail||t.stencilZFail!==i.stencilZFail||t.stencilZPass!==i.stencilZPass||t.stencilFuncMask!==i.stencilFuncMask||t.stencilWriteMask!==i.stencilWriteMask||t.side!==i.side||t.alphaToCoverage!==i.alphaToCoverage||t.sampleCount!==a||t.colorSpace!==n||t.colorFormat!==o||t.depthStencilFormat!==l||t.primitiveTopology!==u||t.frontFaceCW!==h||t.clippingContextCacheKey!==e.clippingContextCacheKey)&&(t.material=i,t.materialVersion=i.version,t.transparent=i.transparent,t.blending=i.blending,t.premultipliedAlpha=i.premultipliedAlpha,t.blendSrc=i.blendSrc,t.blendDst=i.blendDst,t.blendEquation=i.blendEquation,t.blendSrcAlpha=i.blendSrcAlpha,t.blendDstAlpha=i.blendDstAlpha,t.blendEquationAlpha=i.blendEquationAlpha,t.colorWrite=i.colorWrite,t.depthWrite=i.depthWrite,t.depthTest=i.depthTest,t.depthFunc=i.depthFunc,t.stencilWrite=i.stencilWrite,t.stencilFunc=i.stencilFunc,t.stencilFail=i.stencilFail,t.stencilZFail=i.stencilZFail,t.stencilZPass=i.stencilZPass,t.stencilFuncMask=i.stencilFuncMask,t.stencilWriteMask=i.stencilWriteMask,t.side=i.side,t.alphaToCoverage=i.alphaToCoverage,t.sampleCount=a,t.colorSpace=n,t.colorFormat=o,t.depthStencilFormat=l,t.primitiveTopology=u,t.frontFaceCW=h,t.clippingContextCacheKey=e.clippingContextCacheKey,d=!0),d}getRenderCacheKey(e){let{object:t,material:r}=e,i=this.utils,s=e.context,a=t.isMesh&&t.matrixWorld.determinantAffine()\\u003c0;return[r.transparent,r.blending,r.premultipliedAlpha,r.blendSrc,r.blendDst,r.blendEquation,r.blendSrcAlpha,r.blendDstAlpha,r.blendEquationAlpha,r.colorWrite,r.depthWrite,r.depthTest,r.depthFunc,r.stencilWrite,r.stencilFunc,r.stencilFail,r.stencilZFail,r.stencilZPass,r.stencilFuncMask,r.stencilWriteMask,r.side,a,i.getSampleCountRenderContext(s),i.getCurrentColorSpace(s),i.getCurrentColorFormat(s),i.getCurrentDepthStencilFormat(s),i.getPrimitiveTopology(t,r),e.getGeometryCacheKey(),e.clippingContextCacheKey].join()}updateSampler(e){return this.textureUtils.updateSampler(e)}destroySampler(e){this.textureUtils.destroySampler(e)}createDefaultTexture(e){return this.textureUtils.createDefaultTexture(e)}createTexture(e,t){this.textureUtils.createTexture(e,t)}updateTexture(e,t){this.textureUtils.updateTexture(e,t)}generateMipmaps(e){this.textureUtils.generateMipmaps(e)}destroyTexture(e,t=!1){this.textureUtils.destroyTexture(e,t)}async copyTextureToBuffer(e,t,r,i,s,a){return this.textureUtils.copyTextureToBuffer(e,t,r,i,s,a)}initTimestampQuery(e,t,r){if(!this.trackTimestamp)return;this.timestampQueryPool[e]||(this.timestampQueryPool[e]=new VX(this.device,e,2048));let i=this.timestampQueryPool[e],s=i.allocateQueriesForContext(t);Vy.querySet=i.querySet,Vy.beginningOfPassWriteIndex=s,Vy.endOfPassWriteIndex=s+1,r.timestampWrites=Vy}createNodeBuilder(e,t){return new EX(e,t)}createProgram(e){let t=this.get(e);zy.label=e.stage+(e.name!==\\\"\\\"?`_${e.name}`:\\\"\\\"),zy.code=e.code,t.module={module:this.device.createShaderModule(zy),entryPoint:\\\"main\\\"},zy.reset()}destroyProgram(e){this.delete(e)}createRenderPipeline(e,t){this.pipelineUtils.createRenderPipeline(e,t)}createComputePipeline(e,t){this.pipelineUtils.createComputePipeline(e,t)}beginBundle(e){let t=this.get(e);t._currentPass=t.currentPass,t._currentSets=t.currentSets,t.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.currentPass=this.pipelineUtils.createBundleEncoder(e)}finishBundle(e,t){let r=this.get(e),i=r.currentPass.finish();this.get(t).bundleGPU=i,r.currentSets=r._currentSets,r.currentPass=r._currentPass}addBundle(e,t){this.get(e).renderBundles.push(this.get(t).bundleGPU)}createUniformBuffer(e){let t=this.get(e);if(t.buffer===void 0){let r=e.byteLength,i=GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,s=[];e.visibility&Ln.VERTEX&&s.push(\\\"vertex\\\"),e.visibility&Ln.FRAGMENT&&s.push(\\\"fragment\\\"),e.visibility&Ln.COMPUTE&&s.push(\\\"compute\\\");let a=`(${s.join(\\\",\\\")})`;Ks.label=`bindingBuffer${e.id}_${e.name}_${a}`,Ks.size=r,Ks.usage=i;let n=this.device.createBuffer(Ks);Ks.reset(),t.buffer=n}}destroyUniformBuffer(e){this.get(e).buffer.destroy(),this.delete(e)}createBindings(e,t,r,i){this.bindingUtils.createBindings(e,t,r,i)}updateBindings(e,t,r,i){this.bindingUtils.createBindings(e,t,r,i)}updateBinding(e){this.bindingUtils.updateBinding(e)}deleteBindGroupData(e){this.bindingUtils.deleteBindGroupData(e)}createIndexAttribute(e){let t=GPUBufferUsage.INDEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST;(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)&&(t|=GPUBufferUsage.STORAGE),this.attributeUtils.createAttribute(e,t)}createAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}createIndirectStorageAttribute(e){this.attributeUtils.createAttribute(e,GPUBufferUsage.STORAGE|GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST)}updateAttribute(e){this.attributeUtils.updateAttribute(e)}destroyAttribute(e){this.attributeUtils.destroyAttribute(e)}updateSize(){this.delete(this.renderer.getCanvasTarget())}hasFeature(e){return oB[e]!==void 0&&(e=oB[e]),this.device.features.has(e)}copyTextureToTexture(e,t,r=null,i=null,s=0,a=0){let n=0,o=0,l=0,u=0,h=0,d=0,c=e.image.width,m=e.image.height,g=1;r!==null&&(r.isBox3===!0?(u=r.min.x,h=r.min.y,d=r.min.z,c=r.max.x-r.min.x,m=r.max.y-r.min.y,g=r.max.z-r.min.z):(u=r.min.x,h=r.min.y,c=r.max.x-r.min.x,m=r.max.y-r.min.y,g=1)),i!==null&&(n=i.x,o=i.y,l=i.z||0),_s.label=\\\"copyTextureToTexture_\\\"+e.id+\\\"_\\\"+t.id;let y=this.device.createCommandEncoder(_s);_s.reset();let b=this.get(e).texture,v=this.get(t).texture;Sa.texture=b,Sa.mipLevel=s,Sa.origin.x=u,Sa.origin.y=h,Sa.origin.z=d,On.texture=v,On.mipLevel=a,On.origin.x=n,On.origin.y=o,On.origin.z=l,Ro.width=c,Ro.height=m,Ro.depthOrArrayLayers=g,y.copyTextureToTexture(Sa,On,Ro),Sa.reset(),On.reset(),Ro.reset(),kn(this.device,y.finish()),a===0&&t.generateMipmaps&&this.textureUtils.generateMipmaps(t)}copyFramebufferToTexture(e,t,r){let i=this.get(t),s=null;t.renderTarget?e.isDepthTexture?s=this.get(t.depthTexture).texture:s=this.get(t.textures[0]).texture:e.isDepthTexture?s=this.textureUtils.getDepthBuffer(t.depth,t.stencil):s=this.context.getCurrentTexture();let a=this.get(e).texture;if(s.format!==a.format){Ce(\\\"WebGPUBackend: copyFramebufferToTexture: Source and destination formats do not match.\\\",s.format,a.format);return}let n;if(i.currentPass?(i.currentPass.end(),n=i.encoder):(_s.label=\\\"copyFramebufferToTexture_\\\"+e.id,n=this.device.createCommandEncoder(_s),_s.reset()),Sa.texture=s,Sa.origin.x=r.x,Sa.origin.y=r.y,On.texture=a,Ro.width=r.z,Ro.height=r.w,n.copyTextureToTexture(Sa,On,Ro),Sa.reset(),On.reset(),Ro.reset(),e.generateMipmaps&&this.textureUtils.generateMipmaps(e,n),i.currentPass){let{descriptor:o}=i;for(let l=0;l\\u003co.colorAttachments.length;l++)o.colorAttachments[l].loadOp=Kt.Load;t.depth&&(o.depthStencilAttachment.depthLoadOp=Kt.Load),t.stencil&&(o.depthStencilAttachment.stencilLoadOp=Kt.Load),i.currentPass=n.beginRenderPass(o),i.currentSets={attributes:{},bindingGroups:[],pipeline:null,index:null},t.viewport&&this.updateViewport(t),t.scissor&&this.updateScissor(t)}else kn(this.device,n.finish())}hasCompatibility(e){return this._compatibility[e]!==void 0?this._compatibility[e]:super.hasCompatibility(e)}dispose(){if(this.bindingUtils.dispose(),this.textureUtils.dispose(),this.occludedResolveCache){for(let e of this.occludedResolveCache.values())e.destroy();this.occludedResolveCache.clear()}if(this.timestampQueryPool)for(let e of Object.values(this.timestampQueryPool))e!==null&&e.dispose();this.parameters.device===void 0&&this.device!==null&&this.device.destroy()}},HX=class extends Xg{constructor(e,t,r,i,s,a){super(e,t,r,i,s,a),this.iesMap=null}copy(e,t){return super.copy(e,t),this.iesMap=e.iesMap,this}},XX=class extends Xg{constructor(e,t,r,i,s,a){super(e,t,r,i,s,a),this.aspect=null}copy(e,t){return super.copy(e,t),this.aspect=e.aspect,this}},$X=class extends C3{constructor(){super(),this.addMaterial(bV,\\\"MeshPhongMaterial\\\"),this.addMaterial(pS,\\\"MeshStandardMaterial\\\"),this.addMaterial(mS,\\\"MeshPhysicalMaterial\\\"),this.addMaterial(pG,\\\"MeshToonMaterial\\\"),this.addMaterial(Pd,\\\"MeshBasicMaterial\\\"),this.addMaterial(xV,\\\"MeshLambertMaterial\\\"),this.addMaterial(uV,\\\"MeshNormalMaterial\\\"),this.addMaterial(fG,\\\"MeshMatcapMaterial\\\"),this.addMaterial(sV,\\\"LineBasicMaterial\\\"),this.addMaterial(nV,\\\"LineDashedMaterial\\\"),this.addMaterial(bG,\\\"PointsMaterial\\\"),this.addMaterial(KE,\\\"SpriteMaterial\\\"),this.addMaterial(wG,\\\"ShadowMaterial\\\"),this.addLight(K9,JO),this.addLight(dH,$g),this.addLight(yH,eU),this.addLight($S,Xg),this.addLight(hH,KO),this.addLight(cH,EN),this.addLight(mH,rU),this.addLight(pH,HX),this.addLight(gH,XX),this.addToneMapping(EP,RD),this.addToneMapping(PP,ED),this.addToneMapping(BP,PD),this.addToneMapping(IP,BD),this.addToneMapping(FP,ID),this.addToneMapping(LP,FD)}},qX=class extends OH{constructor(e={}){let t;e.forceWebGL?t=eB:(t=jX,e.getFallback=()=>(Ue(\\\"WebGPURenderer: WebGPU is not available, running under WebGL2 backend.\\\"),new eB(e)));let r=new t(e);super(r,e),this.library=new $X,this.isWebGPURenderer=!0,typeof __THREE_DEVTOOLS__\\u003c\\\"u\\\"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(\\\"observe\\\",{detail:this}))}},TB=class{constructor(e,t=Ve(0,0,1,1)){this.renderer=e,this.outputNode=t,this.outputColorTransform=!0,this.needsUpdate=!0;let r=new Pt;r.name=\\\"RenderPipeline\\\",this._quadMesh=new Wa(r),this._quadMesh.name=\\\"Render Pipeline\\\",this._context=null,this._toneMapping=e.toneMapping,this._outputColorSpace=e.outputColorSpace}render(){let e=this.renderer;this._update(),this._context.onBeforeRenderPipeline!==null&&this._context.onBeforeRenderPipeline();let t=e.toneMapping,r=e.outputColorSpace;e.toneMapping=eo,e.outputColorSpace=Gt.workingColorSpace;let i=e.xr.enabled;e.xr.enabled=!1,this._quadMesh.render(e),e.xr.enabled=i,e.toneMapping=t,e.outputColorSpace=r,this._context.onAfterRenderPipeline!==null&&this._context.onAfterRenderPipeline()}get context(){return this._context}dispose(){this._quadMesh.material.dispose()}_update(){if(this._toneMapping!==this.renderer.toneMapping&&(this._toneMapping=this.renderer.toneMapping,this.needsUpdate=!0),this._outputColorSpace!==this.renderer.outputColorSpace&&(this._outputColorSpace=this.renderer.outputColorSpace,this.needsUpdate=!0),this.needsUpdate===!0){let e=this._toneMapping,t=this._outputColorSpace,r={renderPipeline:this,onBeforeRenderPipeline:null,onAfterRenderPipeline:null},i=this.outputNode;this.outputColorTransform===!0?(i=i.context(r),i=_0(i,e,t)):(r.toneMapping=e,r.outputColorSpace=t,i=i.context(r)),this._context=r,this._quadMesh.material.fragmentNode=i,this._quadMesh.material.needsUpdate=!0,this.needsUpdate=!1}}async renderAsync(){Et('RenderPipeline: \\\"renderAsync()\\\" has been deprecated. Use \\\"render()\\\" and \\\"await renderer.init();\\\" when creating the renderer.'),await this.renderer.init(),this.render()}},YX=class extends TB{constructor(e,t){Et('PostProcessing: \\\"PostProcessing\\\" has been renamed to \\\"RenderPipeline\\\". Please update your code to use \\\"THREE.RenderPipeline\\\" instead.'),super(e,t)}},d_=class extends ji{constructor(e=1,t=1,r=1){super(),this.isArrayTexture=!1,this.image={width:e,height:t,depth:r},this.magFilter=lr,this.minFilter=lr,this.wrapR=Ti,this.isStorageTexture=!0,this.is3DTexture=!0}setSize(e,t,r){(this.image.width!==e||this.image.height!==t||this.image.depth!==r)&&(this.image.width=e,this.image.height=t,this.image.depth=r,this.dispose())}},ZX=M.BRDF_GGX,JX=M.BRDF_Lambert,QX=M.BasicPointShadowFilter,KX=M.BasicShadowFilter,e$=M.Break,t$=M.Const,r$=M.Continue,i$=M.DFGLUT,s$=M.D_GGX,a$=M.Discard,n$=M.EPSILON,o$=M.F_Schlick,Ir=M.Fn,l$=M.INFINITY,pm=M.If,Gy=M.Loop,u$=M.NodeAccess,h$=M.NodeShaderStage,d$=M.NodeType,c$=M.NodeUpdateType,p$=M.PCFShadowFilter,m$=M.PCFSoftShadowFilter,f$=M.PI,g$=M.PI2,y$=M.TWO_PI,x$=M.HALF_PI,v$=M.PointShadowFilter,b$=M.Return,T$=M.Schlick_to_F0,S$=M.ShaderNode,_$=M.Stack,w$=M.Switch,M$=M.TBNViewMatrix,N$=M.VSMShadowFilter,A$=M.V_GGX_SmithCorrelated,C$=M.Var,R$=M.VarIntent,$a=M.abs,E$=M.acesFilmicToneMapping,P$=M.acos,B$=M.acosh,Wy=M.add,I$=M.addMethodChaining,F$=M.addNodeElement,L$=M.agxToneMapping,k$=M.all,D$=M.alphaT,O$=M.ambientOcclusion,U$=M.and,z$=M.anisotropy,V$=M.anisotropyB,G$=M.anisotropyT,W$=M.any,j$=M.append,H$=M.array,X$=M.asin,$$=M.asinh,q$=M.assign,Y$=M.atan,Z$=M.atanh,J$=M.atomicAdd,Q$=M.atomicAnd,K$=M.atomicFunc,eq=M.atomicLoad,tq=M.atomicMax,rq=M.atomicMin,iq=M.atomicOr,sq=M.atomicStore,aq=M.atomicSub,nq=M.atomicXor,oq=M.attenuationColor,lq=M.attenuationDistance,uq=M.attribute,hq=M.attributeArray,dq=M.backgroundBlurriness,cq=M.backgroundIntensity,pq=M.backgroundRotation,mq=M.batch,fq=M.bentNormalView,gq=M.billboarding,yq=M.bitAnd,xq=M.bitNot,vq=M.bitOr,bq=M.bitXor,Tq=M.bitangentGeometry,Sq=M.bitangentLocal,_q=M.bitangentView,wq=M.bitangentWorld,Mq=M.bitcast,Nq=M.blendBurn,Aq=M.blendColor,Cq=M.blendDodge,Rq=M.blendOverlay,Eq=M.blendScreen,Pq=M.blur,Bq=M.bool,Iq=M.buffer,Fq=M.bufferAttribute,Lq=M.bumpMap,kq=M.builtin,Dq=M.builtinAOContext,Oq=M.builtinShadowContext,Uq=M.bvec2,zq=M.bvec3,Vq=M.bvec4,Gq=M.bypass,Wq=M.cache,jq=M.call,Hq=M.cameraFar,Xq=M.cameraIndex,$q=M.cameraNear,qq=M.cameraNormalMatrix,Yq=M.cameraPosition,Zq=M.cameraProjectionMatrix,Jq=M.cameraProjectionMatrixInverse,Qq=M.cameraViewMatrix,Kq=M.cameraViewport,eY=M.cameraWorldMatrix,tY=M.cbrt,rY=M.cdl,iY=M.ceil,sY=M.checker,aY=M.cineonToneMapping,SB=M.clamp,nY=M.clearcoat,oY=M.clearcoatNormalView,lY=M.clearcoatRoughness,uY=M.clipSpace,hY=M.code,dY=M.color,cY=M.colorSpaceToWorking,pY=M.colorToDirection,mY=M.compute,fY=M.computeKernel,gY=M.computeSkinning,yY=M.context,xY=M.convert,vY=M.convertColorSpace,Ju=M.convertToTexture,bY=M.countLeadingZeros,TY=M.countOneBits,SY=M.countTrailingZeros,_Y=M.cos,wY=M.cosh,MY=M.cross,NY=M.cubeTexture,AY=M.cubeTextureBase,CY=M.dFdx,RY=M.dFdy,EY=M.dashSize,PY=M.debug,BY=M.decrement,IY=M.decrementBefore,FY=M.defaultBuildStages,LY=M.defaultShaderStages,kY=M.defined,DY=M.degrees,OY=M.deltaTime,UY=M.densityFog,zY=M.densityFogFactor,VY=M.depth,GY=M.depthPass,WY=M.determinant,jY=M.difference,HY=M.diffuseColor,XY=M.directPointLight,$Y=M.directionToColor,qY=M.directionToFaceDirection,YY=M.dispersion,ZY=M.distance,JY=M.div,QY=M.dot,KY=M.drawIndex,eZ=M.dynamicBufferAttribute,tZ=M.element,rZ=M.emissive,iZ=M.equal,sZ=M.equirectDirection,aZ=M.equirectUV,_B=M.exp,c_=M.exp2,nZ=M.exponentialHeightFogFactor,oZ=M.expression,lZ=M.faceDirection,uZ=M.faceForward,hZ=M.faceforward,yt=M.float,dZ=M.floatBitsToInt,cZ=M.floatBitsToUint,Zd=M.floor,pZ=M.fog,wB=M.fract,mZ=M.frameGroup,fZ=M.frameId,gZ=M.frontFacing,yZ=M.fwidth,xZ=M.gain,vZ=M.gapSize,bZ=M.getConstNodeType,TZ=M.getCurrentStack,SZ=M.getDirection,_Z=M.getDistanceAttenuation,wZ=M.getGeometryRoughness,MZ=M.getNormalFromDepth,NZ=M.interleavedGradientNoise,AZ=M.vogelDiskSample,CZ=M.getParallaxCorrectNormal,RZ=M.getRoughness,EZ=M.getScreenPosition,PZ=M.getShIrradianceAt,BZ=M.getShadowMaterial,IZ=M.getShadowRenderObjectFunction,FZ=M.getTextureIndex,p_=M.getViewPosition,LZ=M.globalId,kZ=M.glsl,DZ=M.glslFn,OZ=M.grayscale,UZ=M.greaterThan,zZ=M.greaterThanEqual,VZ=M.hash,GZ=M.highpModelNormalViewMatrix,WZ=M.highpModelViewMatrix,jZ=M.hue,HZ=M.increment,XZ=M.incrementBefore,$Z=M.instance,qZ=M.instanceIndex,YZ=M.instancedArray,ZZ=M.instancedBufferAttribute,JZ=M.instancedDynamicBufferAttribute,QZ=M.instancedMesh,Eo=M.int,KZ=M.intBitsToFloat,eJ=M.inverse,tJ=M.inverseSqrt,rJ=M.inversesqrt,iJ=M.invocationLocalIndex,sJ=M.invocationSubgroupIndex,aJ=M.ior,nJ=M.iridescence,oJ=M.iridescenceIOR,lJ=M.iridescenceThickness,ss=M.ivec2,uJ=M.ivec3,hJ=M.ivec4,dJ=M.js,cJ=M.label,pJ=M.length,mJ=M.lengthSq,fJ=M.lessThan,gJ=M.lessThanEqual,yJ=M.lightPosition,xJ=M.lightProjectionUV,vJ=M.lightShadowMatrix,bJ=M.lightTargetDirection,TJ=M.lightTargetPosition,SJ=M.lightViewPosition,_J=M.lightingContext,wJ=M.lights,MJ=M.linearDepth,NJ=M.linearToneMapping,AJ=M.localId,CJ=M.log,RJ=M.log2,MB=M.logarithmicDepthToViewZ,kl=M.luminance,EJ=M.mat2,PJ=M.mat3,NB=M.mat4,BJ=M.matcapUV,IJ=M.materialAO,FJ=M.materialAlphaTest,LJ=M.materialAnisotropy,kJ=M.materialAnisotropyVector,DJ=M.materialAttenuationColor,OJ=M.materialAttenuationDistance,UJ=M.materialClearcoat,zJ=M.materialClearcoatNormal,VJ=M.materialClearcoatRoughness,GJ=M.materialColor,WJ=M.materialDispersion,jJ=M.materialEmissive,HJ=M.materialEnvIntensity,XJ=M.materialEnvRotation,$J=M.materialIOR,qJ=M.materialIridescence,YJ=M.materialIridescenceIOR,ZJ=M.materialIridescenceThickness,JJ=M.materialLightMap,QJ=M.materialLineDashOffset,KJ=M.materialLineDashSize,eQ=M.materialLineGapSize,tQ=M.materialLineScale,rQ=M.materialLineWidth,iQ=M.materialMetalness,sQ=M.materialNormal,aQ=M.materialOpacity,nQ=M.materialPointSize,oQ=M.materialReference,lQ=M.materialReflectivity,uQ=M.materialRefractionRatio,hQ=M.materialRotation,dQ=M.materialRoughness,cQ=M.materialSheen,pQ=M.materialSheenRoughness,mQ=M.materialShininess,fQ=M.materialSpecular,gQ=M.materialSpecularColor,yQ=M.materialSpecularIntensity,xQ=M.materialSpecularStrength,vQ=M.materialThickness,bQ=M.materialTransmission,_t=M.max,TQ=M.maxMipLevel,SQ=M.mediumpModelViewMatrix,_Q=M.metalness,Ar=M.min,Dl=M.mix,wQ=M.mixElement,MQ=M.mod,NQ=M.modelDirection,AQ=M.modelNormalMatrix,CQ=M.modelPosition,RQ=M.modelRadius,EQ=M.modelScale,PQ=M.modelViewMatrix,BQ=M.modelViewPosition,IQ=M.modelViewProjection,FQ=M.modelWorldMatrix,LQ=M.modelWorldMatrixInverse,kQ=M.morphReference,DQ=M.mrt,OQ=M.mul,UQ=M.mx_aastep,zQ=M.mx_add,VQ=M.mx_atan2,GQ=M.mx_cell_noise_float,WQ=M.mx_contrast,jQ=M.mx_divide,HQ=M.mx_fractal_noise_float,XQ=M.mx_fractal_noise_vec2,$Q=M.mx_fractal_noise_vec3,qQ=M.mx_fractal_noise_vec4,YQ=M.mx_frame,ZQ=M.mx_heighttonormal,JQ=M.mx_hsvtorgb,QQ=M.mx_ifequal,KQ=M.mx_ifgreater,eK=M.mx_ifgreatereq,tK=M.mx_invert,rK=M.mx_modulo,iK=M.mx_multiply,sK=M.mx_noise_float,aK=M.mx_noise_vec3,nK=M.mx_noise_vec4,oK=M.mx_place2d,lK=M.mx_power,uK=M.mx_ramp4,hK=M.mx_ramplr,dK=M.mx_ramptb,cK=M.mx_rgbtohsv,pK=M.mx_rotate2d,mK=M.mx_rotate3d,fK=M.mx_safepower,gK=M.mx_separate,yK=M.mx_splitlr,xK=M.mx_splittb,vK=M.mx_srgb_texture_to_lin_rec709,bK=M.mx_subtract,TK=M.mx_timer,SK=M.mx_transform_uv,_K=M.mx_unifiednoise2d,wK=M.mx_unifiednoise3d,MK=M.mx_worley_noise_float,NK=M.mx_worley_noise_vec2,AK=M.mx_worley_noise_vec3,CK=M.negate,RK=M.negateOnBackSide,EK=M.neutralToneMapping,PK=M.nodeArray,BK=M.nodeImmutable,Un=M.nodeObject,IK=M.nodeObjectIntent,FK=M.nodeObjects,LK=M.nodeProxy,kK=M.nodeProxyIntent,DK=M.normalFlat,OK=M.normalGeometry,UK=M.normalLocal,zK=M.normalMap,VK=M.normalView,GK=M.normalViewGeometry,WK=M.normalWorld,jK=M.normalWorldGeometry,HK=M.normalize,XK=M.not,$K=M.notEqual,qK=M.numWorkgroups,YK=M.objectDirection,ZK=M.objectGroup,JK=M.objectPosition,QK=M.objectRadius,KK=M.objectScale,eee=M.objectViewPosition,tee=M.objectWorldMatrix,ree=M.OnBeforeObjectUpdate,iee=M.OnBeforeMaterialUpdate,see=M.OnObjectUpdate,aee=M.OnMaterialUpdate,nee=M.oneMinus,oee=M.or,lee=M.orthographicDepthToViewZ,uee=M.oscSawtooth,hee=M.oscSine,dee=M.oscSquare,cee=M.oscTriangle,pee=M.output,m_=M.outputStruct,mee=M.overloadingFn,fee=M.overrideNode,gee=M.overrideNodes,yee=M.packHalf2x16,xee=M.packSnorm2x16,vee=M.packUnorm2x16,bee=M.packNormalToRGB,Tee=M.parabola,See=M.parallaxDirection,_ee=M.parallaxUV,wee=M.parameter,Mee=M.pass,Qu=M.passTexture,Nee=M.pcurve,Aee=M.perspectiveDepthToViewZ,Cee=M.pmremTexture,Ree=M.pointShadow,Eee=M.pointUV,Pee=M.pointWidth,Bee=M.positionGeometry,Iee=M.positionLocal,Fee=M.positionPrevious,Lee=M.positionView,kee=M.positionViewDirection,Dee=M.positionWorld,Oee=M.positionWorldDirection,Uee=M.posterize,zee=M.pow,Vee=M.pow2,Gee=M.pow3,Wee=M.pow4,AB=M.premultiplyAlpha,mm=M.property,jee=M.radians,Hee=M.rand,Xee=M.range,$ee=M.rangeFog,qee=M.rangeFogFactor,Yee=M.reciprocal,Zee=M.reference,Jee=M.referenceBuffer,Qee=M.reflect,Kee=M.reflectVector,ete=M.reflectView,tte=M.reflector,rte=M.refract,ite=M.refractVector,ste=M.refractView,ate=M.reinhardToneMapping,nte=M.remap,ote=M.remapClamp,lte=M.renderGroup,ute=M.renderOutput,hte=M.rendererReference,dte=M.replaceDefaultUV,cte=M.rotate,pte=M.rotateUV,mte=M.roughness,fte=M.round,gte=M.rtt,yte=M.sRGBTransferEOTF,xte=M.sRGBTransferOETF,vte=M.sample,bte=M.sampler,Tte=M.samplerComparison,f_=M.saturate,Ste=M.saturation,_te=M.screen,wte=M.screenCoordinate,Mte=M.screenDPR,Nte=M.screenSize,Ate=M.screenUV,g_=M.select,Cte=M.setCurrentStack,Rte=M.setName,Ete=M.shaderStages,Pte=M.shadow,Bte=M.shadowPositionWorld,Ite=M.shapeCircle,Fte=M.sharedUniformGroup,Lte=M.sheen,kte=M.sheenRoughness,Dte=M.shiftLeft,Ote=M.shiftRight,Ute=M.shininess,zte=M.sign,Vte=M.sin,Gte=M.sinh,Wte=M.sinc,jte=M.skinning,y_=M.smoothstep,Hte=M.smoothstepElement,Xte=M.specularColor,$te=M.specularF90,qte=M.spherizeUV,Yte=M.split,Zte=M.spritesheetUV,CB=M.sqrt,Jte=M.stack,x_=M.step,Qte=M.stepElement,fm=M.storage,Kte=M.storageBarrier,ere=M.storageTexture,tre=M.storageTexture3D,v_=M.struct,rre=M.sub,ire=M.subgroupAdd,sre=M.subgroupAll,are=M.subgroupAnd,nre=M.subgroupAny,ore=M.subgroupBallot,lre=M.subgroupBroadcast,ure=M.subgroupBroadcastFirst,hre=M.subBuild,dre=M.subgroupElect,cre=M.subgroupExclusiveAdd,pre=M.subgroupExclusiveMul,mre=M.subgroupInclusiveAdd,fre=M.subgroupInclusiveMul,gre=M.subgroupIndex,yre=M.subgroupMax,xre=M.subgroupMin,vre=M.subgroupMul,bre=M.subgroupOr,Tre=M.subgroupShuffle,Sre=M.subgroupShuffleDown,_re=M.subgroupShuffleUp,wre=M.subgroupShuffleXor,Mre=M.subgroupSize,Nre=M.subgroupXor,Are=M.tan,Cre=M.tanh,Rre=M.tangentGeometry,Ere=M.tangentLocal,Pre=M.tangentView,Bre=M.tangentWorld,Ri=M.texture,Ire=M.texture3D,Fre=M.textureBarrier,Lre=M.textureBicubic,kre=M.textureBicubicLevel,Dre=M.textureCubeUV,Ps=M.textureLoad,jy=M.textureSize,Ore=M.textureLevel,Ure=M.textureStore,zre=M.thickness,Vre=M.time,Gre=M.toneMapping,Wre=M.toneMappingExposure,jre=M.toonOutlinePass,Hre=M.transformDirection,Xre=M.transformNormal,$re=M.transformNormalByInverseViewMatrix,qre=M.transformNormalByViewMatrix,Yre=M.transformNormalToView,Zre=M.transformedClearcoatNormalView,Jre=M.transformedNormalView,Qre=M.transformedNormalWorld,Kre=M.transmission,eie=M.transpose,tie=M.triNoise3D,rie=M.triplanarTexture,iie=M.triplanarTextures,sie=M.trunc,RB=M.uint,aie=M.uintBitsToFloat,Fr=M.uniform,Jd=M.uniformArray,nie=M.uniformCubeTexture,oie=M.uniformGroup,lie=M.uniformFlow,uie=M.uniformTexture,hie=M.unpackHalf2x16,die=M.unpackSnorm2x16,cie=M.unpackUnorm2x16,pie=M.unpackRGBToNormal,EB=M.unpremultiplyAlpha,mie=M.userData,_a=M.uv,fie=M.uvec2,gie=M.uvec3,yie=M.uvec4,xie=M.varying,vie=M.varyingProperty,nr=M.vec2,Hy=M.vec3,hr=M.vec4,bie=M.vectorComponents,Xy=M.velocity,Tie=M.vertexColor,Sie=M.vertexIndex,_ie=M.vertexStage,wie=M.vibrance,Mie=M.viewZToLogarithmicDepth,PB=M.viewZToOrthographicDepth,$y=M.viewZToPerspectiveDepth,Nie=M.viewZToReversedOrthographicDepth,Aie=M.viewZToReversedPerspectiveDepth,Cie=M.viewport,Rie=M.viewportCoordinate,Eie=M.viewportDepthTexture,Pie=M.viewportLinearDepth,Bie=M.viewportMipTexture,Iie=M.viewportOpaqueMipTexture,Fie=M.viewportResolution,Lie=M.viewportSafeUV,kie=M.viewportSharedTexture,Die=M.viewportSize,Oie=M.viewportTexture,Uie=M.viewportUV,zie=M.wgsl,Vie=M.wgslFn,Gie=M.workgroupArray,Wie=M.workgroupBarrier,jie=M.workgroupId,Hie=M.workingToColorSpace,Xie=M.xor,Jr=yM,Qd=Object.freeze({transmission:!0,absorption:!0,dispersion:!0,reflections:!0,frost:!0,crystals:!0,grain:!0,cutNormals:!0,surfaceBumps:!0,smudges:!1,micro:!1,ripples:!1,cracks:!1,scatter:!0,clearcoat:!0,shardNormals:!0,shardFrost:!0,shardTransmission:!0,shardReflections:!0,shardSparkle:!0,shardEdges:!0}),$ie=e=>`material${e[0].toUpperCase()}${e.slice(1)}`,qie={shape:{shape:\\\"logo\\\",size:1,tubeRatio:.28,deformAmplitude:0,deformFrequency:.3,segments:512,seed:7,offsetX:0,offsetY:.48,offsetZ:0,logo:{width:2.6,depth:.22,bevelThickness:.06,bevelSize:.05,bevelOffset:0,bevelSegments:13,cornerRadius:.03,curveSegments:58,creaseAngle:40,sdfRes:128}},ice:{ior:1.61,dispersion:.17,thicknessScale:.1,attenuationDistance:3.64,attenuationColor:\\\"#525252\\\",baseRoughness:.095,frost:{scale:1.05,threshold:.61,softness:.36,roughness:.73,diffuse:.57,crystalBump:.62,crystalScale:44},cracks:{largeScale:1.15,warp:.37,warpScale:2.2,coverage:.84,regionScale:1.35,regionCoverage:.52,veinScale:20,veinContrast:1,width:.0175,brightness:.41,darkness:1,refraction:.077,surfaceStrength:.67,steps:21,fineCracks:!0,fineScale:20,fineAmount:.96,fineCoverage:.23,fineNearLarge:1},smudges:{amount:1,coverage:.29,maskScale:3.1,anisotropy:5.5,roughness:.91,whiteness:.5,scale:1.6},bumps:{microBump:1,microScale:70,microCoverage:.4,rippleBump:.45,rippleScale:2.5,maskScale:3.6},crumbleGlow:.16,edgeWhiteness:.5,clearcoat:.15,clearcoatRoughness:.415,envIntensity:1.45,specularIntensity:1.28,interiorScatter:.32},erosion:{resolution:\\\"192\\\",brushRadius:.465,brushSoftness:.23,brushStrength:5.6,brushSpeedRef:3.7,brushNoise:.4,brushNoiseScale:16,throughDepth:.84,cellSnap:1,breakCellScale:2.2,crumbleRate:5.35,crumbleCrackBias:5.7,crumbleDuration:.35,cutThreshold:.46,cutSoftness:.045,edgeWidth:.37,interiorSteps:64,interiorFrost:.1,edgeInset:.175,edgeBump:.48,edgeBumpScale:66},powder:{particleCount:\\\"100k\\\",amount:.09,grainSizeMultiplier:1.5,nearSurfaceFraction:1,nearSurfaceDepth:.5,grainSizes:{tinyDustRatio:.2,smallGrainRatio:.22,mediumClumpRatio:.07,tinyDustSize:.0055,smallGrainSize:.011,mediumClumpSize:.022,largeFragmentSize:.075,sizeJitter:1},grainVariants:6,facetedGrains:!1,minPixelSize:.65,ejectSpeed:.8,minEjectSpeed:.66,ejectSpread:0,ejectTurbulence:0,backwardRatio:.25,clumpSpeedJitter:1,drag:.8,gravity:.895,turbulence:2.4,turbulenceScale:5.85,turbulenceDecay:2.58,clumpCohesion:10,clumpCount:500,settleTime:2.65,settledDrift:.01,tumble:2.5,baseTone:\\\"#999999\\\",wrap:0,fragments:{translucency:1,throughTint:\\\"#212121\\\",fresnelPower:5.2,roughness:0,clearcoat:0,specular:.3,sparkle:.2,sparkleFraction:.6,sparkleSpread:1.08},sprites:{enabled:!0,sizeScale:1.4,tilt:30,normalStrength:.1,frostFromAtlas:1,frostBoost:.15,frostRoughness:.1,edgeLight:3,alphaCut:.6,seeThrough:1},repelFromObject:!0,repelStrength:24,repelRange:1.49,repelRadial:0,repelRadialRange:1.6,maxSpeed:8,lostRadius:30,densityShadowStrength:.6,densityAOStrength:0,densityGrid:\\\"64\\\",densityExtent:10,hazeIntensity:0,hazeSteps:8,inheritRotation:!0,inheritTime:400,strayCount:40,straySpeed:.06,fragmentShadowMap:!1},healing:{healDelay:0,returnAfter:3,waveTime:0,waveReach:1,waveJitter:.3,returnMode:\\\"spring\\\",returnSpring:40,returnDamping:.9,returnRamp:3,returnDrag:.85,returnMaxSpeed:13,landRadius:.2,returnDuration:1,returnCurve:.27,cellRestore:60,cellStragglers:1,growFromEdges:!0,breakup:1,breakupScale:40,alignToSurface:1,alignDistance:.52,landedFade:2,landShrink:.3,depositRadius:3,ghostReturnDistance:0,ghostFlightFraction:.45,healRate:3,healGap:.5,fallbackHeal:.275,refrostTime:4.9,refrostStrength:.17,resetFade:50},fracture:{chunks:600,seed:3,hitPadding:.5,eject:{speed:2.6,spread:.7,spin:5,jitter:.45,backwardRatio:.2},motion:{drag:1.3,angularDrag:1.6,gravity:.3,turbulence:1.2,turbulenceScale:1.4,maxSpeed:10},return:{returnAfter:1.4,returnJitter:.9,idleDelay:.6,spring:14,damping:1,ramp:.5,rotationRate:6,snapDistance:.015},caps:{frost:.85,roughness:.8,grain:.5,darken:.15}},lighting:{key:{color:\\\"#ffffff\\\",intensity:4.6,elevation:80.5,azimuth:72,size:.91,hoverBoost:.3},fill:.19,fillColor:\\\"#ff0000\\\",fillGroundColor:\\\"#d11f1f\\\",rim:3.35,rimColor:\\\"#f0f8ff\\\",rimElevation:89,shadow:{intensity:0,softness:6,samples:1,mapSize:\\\"1024\\\",bias:-6e-4},sway:{amplitude:.15,period:9.5},backdrop:{top:\\\"#2a2a2a\\\",mid:\\\"#050505\\\",bottom:\\\"#030303\\\",centerX:.5,centerY:1.5,radius:.78,falloff:4,noise:3},envSoftbox:.8,envRim:1.3,envFill:.12},camera:{fov:41,distance:9.05,height:1.2,lookAtY:-.15,parallaxRange:1.9,parallaxSmoothing:3,rotateYaw:16.5,rotatePitch:10,rotationLag:.63,baseYaw:0,basePitch:0,idleDelay:4,idleAmplitude:4,idlePeriod:24},post:{dof:{enabled:!1,focusBias:-.43,aperture:4,range:12},bloom:{threshold:3,intensity:.045,radius:.235},monochrome:.52,tonemap:\\\"agx\\\",exposure:1.08,contrast:1.285,blackLift:.01,vignette:{strength:.325,softness:1.175,radius:1.245},grain:{strength:0,size:1,speed:0,shadowWeight:.28},dither:!0,aaMode:\\\"traa\\\",pixelRatioCap:2},performance:{idleSkip:!0,adaptiveSteps:!0,voronoiCells:\\\"27\\\",hazeResolution:\\\"quarter\\\",turbulence:\\\"fast\\\",gpuTimers:!0},debug:{showErosionSlice:!1,erosionSliceZ:.5,showDensityGrid:!1,showHitPoints:!1,colorByState:!1,colorBySize:!1,colorByAge:!1,wireframe:!1,freeze:!1,stats:!0,forceStroke:!1},hero4:{frame:{sameAsMain:!1,distance:13.45,height:1.2,lookAtX:0,lookAtY:.05,fov:29.5,objectX:0,objectY:1.26,baseYaw:0,basePitch:0,rotateYaw:40,rotatePitch:45,parallaxRange:15},type:{line1:\\\"Hard to break.\\\",line2:\\\"Easy to remember.\\\",weight:500,letterSpacing:-.04,lineHeight:.92,lineFrac:.16,sx:0,sy:-.125,depth:1.3,align:\\\"center\\\",uppercase:!1,color:\\\"#f2f2f2\\\"},copy:{brand:\\\"Frost\\\",nav:\\\"Manifesto, Work\\\",cta:\\\"Say hello\\\",wordmark:\\\"Frost\\\",tagline:\\\"A symbol that breaks and returns.\\\",subtitle:\\\"An identity system built to take pressure. Break it, watch it come back, and know exactly what holds.\\\",cta1:\\\"Start a project\\\",cta2:\\\"See the work\\\",cue:\\\"Scroll\\\"},wordmark:{show:!1,wordmarkVw:2.4,weight:600,letterSpacing:.42,sy:-.34},subtitle:{show:!0,sy:-.56,size:15,maxWidth:42},ctas:{show:!0,sy:-.72,gap:14},trigger:{autoSweep:!1,first:2,interval:10,duration:.7,radius:.5,strength:14,cursorErodes:!0,clickResets:!0},style:{textColor:\\\"#f2f2f2\\\",mutedAlpha:.5,showStats:!1}}},wa=(e,t)=>({type:\\\"select\\\",options:t,default:e}),BB=typeof location\\u003c\\\"u\\\"&&new URLSearchParams(location.search).has(\\\"lite\\\"),Yie=[\\\"torus\\\",\\\"sphere\\\",\\\"roundedBox\\\",\\\"pyramid\\\",\\\"icosahedron\\\",\\\"logo\\\"],b_={shape:wa(\\\"torus\\\",Yie),size:[1,.5,1.6,.01],tubeRatio:[.45,.2,.7,.005],deformAmplitude:[.045,0,.2,.001],deformFrequency:[1.1,.3,4,.05],segments:[256,64,512,8],seed:[7,0,999,1],offsetX:[0,-5,5,.01],offsetY:[0,-4,4,.01],offsetZ:[0,-4,4,.01],logo:{_collapsed:!0,width:[2.6,.8,5,.05],depth:[.22,.02,1,.005],bevelThickness:[.06,0,.3,.002],bevelSize:[.05,0,.3,.002],bevelOffset:[0,-.1,.1,.002],bevelSegments:[5,1,16,1],cornerRadius:[.03,0,.15,.001],curveSegments:[24,2,64,1],creaseAngle:[40,0,180,1],sdfRes:[64,32,128,8]}},gm={ior:[1.36,1,2,.005],dispersion:[0,0,.3,.005],thicknessScale:[1,.1,3,.01],attenuationDistance:[.9,.05,5,.01],attenuationColor:\\\"#cfd2d4\\\",baseRoughness:[.05,0,.5,.005],frost:{scale:[1.6,.2,6,.05],threshold:[.5,0,1,.01],softness:[.28,.01,1,.01],roughness:[.65,0,1,.01],diffuse:[.55,0,1,.01],crystalBump:[.12,0,1,.01],crystalScale:[28,4,80,1]},cracks:{largeScale:[1.6,.3,8,.05],warp:[.45,0,1.5,.01],warpScale:[1.4,.2,6,.05],coverage:[.55,0,1,.01],regionScale:[.8,.1,4,.05],regionCoverage:[.7,0,1,.01],veinScale:[5,1,20,.25],veinContrast:[.7,0,1,.01],width:[.004,5e-4,.02,5e-4],brightness:[.4,0,3,.01],darkness:[.5,0,1,.01],refraction:[.02,0,.1,.001],surfaceStrength:[.35,0,1,.01],steps:[14,4,32,1],fineCracks:!0,fineScale:[5.5,2,20,.1],fineAmount:[.45,0,1,.01],fineCoverage:[.35,0,1,.01],fineNearLarge:[.75,0,1,.01]},smudges:{amount:[.6,0,1,.01],coverage:[.55,0,1,.01],maskScale:[1.2,.1,6,.05],anisotropy:[6,1,20,.5],roughness:[.35,0,1,.01],whiteness:[.08,0,.5,.005],scale:[3.2,.5,10,.1]},bumps:{microBump:[.25,0,1,.005],microScale:[60,10,200,1],microCoverage:[.6,0,1,.01],rippleBump:[.3,0,1,.01],rippleScale:[9,2,30,.5],maskScale:[1.5,.1,6,.05]},crumbleGlow:[.15,0,2,.01],edgeWhiteness:[.5,0,1,.01],clearcoat:[.3,0,1,.01],clearcoatRoughness:[.08,0,1,.005],envIntensity:[.55,0,3,.01],specularIntensity:[1,0,2,.01],interiorScatter:[.25,0,1,.01]},T_={resolution:wa(\\\"128\\\",[\\\"64\\\",\\\"96\\\",\\\"128\\\",\\\"192\\\"]),brushRadius:[.28,.05,.8,.005],brushSoftness:[.5,0,1,.01],brushStrength:[2.2,.1,8,.05],brushSpeedRef:[3,.2,12,.1],brushNoise:[.55,0,1,.01],brushNoiseScale:[9,2,30,.5],throughDepth:[1,0,1,.01],cellSnap:[.85,0,1,.01],breakCellScale:[3,.5,8,.1],crumbleRate:[1.6,0,6,.05],crumbleCrackBias:[2.5,0,6,.05],crumbleDuration:[.5,0,2,.01],cutThreshold:[.7,.3,.98,.01],cutSoftness:[.04,.005,.3,.005],edgeWidth:[.35,.05,.8,.01],interiorSteps:[24,8,64,1],interiorFrost:[0,0,1,.01],edgeInset:[.06,0,.3,.005],edgeBump:[.6,0,2,.01],edgeBumpScale:[55,10,160,1]},ym={particleCount:wa(\\\"1M\\\",[\\\"100k\\\",\\\"250k\\\",\\\"500k\\\",\\\"1M\\\",\\\"2M\\\"]),amount:[.3,.02,1,.01],grainSizeMultiplier:[1,.2,4,.05],nearSurfaceFraction:[.6,0,1,.01],nearSurfaceDepth:[.2,.05,.5,.01],grainSizes:{tinyDustRatio:[.7,0,1,.01],smallGrainRatio:[.22,0,1,.01],mediumClumpRatio:[.07,0,1,.01],tinyDustSize:[.0055,.001,.03,5e-4],smallGrainSize:[.011,.002,.05,5e-4],mediumClumpSize:[.022,.005,.1,.001],largeFragmentSize:[.05,.01,.2,.001],sizeJitter:[.45,0,1,.01]},grainVariants:[5,1,6,1],facetedGrains:!1,minPixelSize:[1.5,0,4,.05],ejectSpeed:[1.1,0,4,.01],minEjectSpeed:[1,0,4,.01],ejectSpread:[.5,0,3,.01],ejectTurbulence:[.8,0,4,.01],backwardRatio:[.25,0,1,.01],clumpSpeedJitter:[.5,0,1,.01],drag:[1.4,0,8,.01],gravity:[.12,0,2,.005],turbulence:[.9,0,4,.01],turbulenceScale:[1.8,.2,8,.05],turbulenceDecay:[.6,.05,4,.01],clumpCohesion:[2.4,0,10,.05],clumpCount:[24e3,500,1e5,500],settleTime:[3.2,.3,12,.05],settledDrift:[.012,0,.1,.001],tumble:[2.5,0,12,.05],baseTone:\\\"#dcdcdc\\\",wrap:[.45,0,1,.01],fragments:{translucency:[.6,0,1,.01],throughTint:\\\"#aeb6bb\\\",fresnelPower:[3,.5,8,.1],roughness:[.32,0,1,.01],clearcoat:[.6,0,1,.01],specular:[1,0,3,.01],sparkle:[.6,0,3,.01],sparkleFraction:[.35,0,1,.01],sparkleSpread:[.5,0,1.5,.01]},sprites:{enabled:!0,sizeScale:[1.4,.3,4,.05],tilt:[30,0,70,1],normalStrength:[1,0,2.5,.05],frostFromAtlas:[1,0,1,.01],frostBoost:[.35,0,1.5,.01],frostRoughness:[.7,0,1,.01],edgeLight:[.6,0,3,.01],alphaCut:[.2,.05,.6,.01],seeThrough:[0,0,1,.01]},repelFromObject:!1,repelStrength:[6,0,30,.1],repelRange:[.35,.02,2,.01],repelRadial:[12,0,60,.5],repelRadialRange:[1.6,1,4,.05],maxSpeed:[8,1,40,.1],lostRadius:[30,5,100,1],densityShadowStrength:[.75,0,2,.01],densityAOStrength:[.55,0,2,.01],densityGrid:wa(\\\"64\\\",[\\\"32\\\",\\\"48\\\",\\\"64\\\"]),densityExtent:[4.2,2,10,.1],hazeIntensity:[.22,0,1.5,.005],hazeSteps:[28,8,64,1],inheritRotation:!0,inheritTime:[220,0,1500,10],strayCount:[40,0,200,1],straySpeed:[.06,0,.5,.005],fragmentShadowMap:!0},IB={healDelay:[3.5,0,12,.1],returnAfter:[3,0,20,.1],waveTime:[2,0,8,.05],waveReach:[3,.2,10,.1],waveJitter:[.6,0,3,.05],returnMode:wa(\\\"spring\\\",[\\\"spring\\\",\\\"path\\\"]),returnSpring:[6,.5,40,.1],returnDamping:[.9,.2,2,.01],returnRamp:[.6,0,3,.05],returnDrag:[.25,0,1,.01],returnMaxSpeed:[12,1,60,.5],landRadius:[.03,.005,.2,.005],returnDuration:[2.4,.2,8,.05],returnCurve:[.35,0,1.5,.01],cellRestore:[30,0,60,.5],cellStragglers:[0,0,20,1],growFromEdges:!0,breakup:[.7,0,1,.01],breakupScale:[10,1,40,.5],alignToSurface:[1,0,1,.01],alignDistance:[.6,.05,3,.01],alignCurve:[1,.2,4,.05],landedFade:[.25,0,2,.01],landShrink:[0,0,.3,.005],depositRadius:[.5,0,3,.25],ghostReturnDistance:[0,0,1.5,.01],ghostFlightFraction:[.45,.1,1,.01],healRate:[.6,.02,3,.01],healGap:[.04,0,.5,.01],fallbackHeal:[.15,0,.5,.005],refrostTime:[4,.2,12,.1],refrostStrength:[.3,0,1,.01],resetFade:[400,50,2e3,10]},FB={key:{color:\\\"#ffffff\\\",intensity:[3.2,0,12,.05],elevation:[62,10,89,.5],azimuth:[18,-90,90,.5],size:[1,.2,3,.01],hoverBoost:[.06,0,.3,.005]},fill:[.18,0,1.5,.005],fillColor:\\\"#ffffff\\\",fillGroundColor:\\\"#262626\\\",rim:[.9,0,5,.01],rimColor:\\\"#ffffff\\\",rimElevation:[55,0,89,.5],shadow:{intensity:[1,0,1,.01],softness:[6,0,24,.25],samples:[12,1,32,1],mapSize:wa(\\\"2048\\\",[\\\"1024\\\",\\\"2048\\\",\\\"4096\\\"]),bias:[-6e-4,-.005,.005,1e-4]},sway:{amplitude:[.03,0,.15,.001],period:[12,2,40,.5]},backdrop:{top:\\\"#2a2a2a\\\",mid:\\\"#050505\\\",bottom:\\\"#030303\\\",centerX:[.5,0,1,.005],centerY:[1.02,.5,1.5,.005],radius:[.55,.1,1.5,.005],falloff:[1.6,.5,4,.01],noise:[1,0,3,.05]},envSoftbox:[1,0,3,.01],envRim:[.5,0,3,.01],envFill:[.12,0,1,.005]},LB={fov:[30,15,60,.5],distance:[13.5,4,24,.05],height:[1.2,-3,6,.01],lookAtY:[-.15,-2,2,.01],parallaxRange:[3,0,10,.1],parallaxSmoothing:[.8,.05,3,.01],rotateYaw:[35,0,90,.5],rotatePitch:[10,0,45,.5],rotationLag:[1.2,.05,4,.01],baseYaw:[0,-180,180,.5],basePitch:[0,-90,90,.5],idleDelay:[4,0,15,.1],idleAmplitude:[4,0,15,.1],idlePeriod:[24,4,80,.5]},kB={dof:{enabled:!0,focusBias:[0,-3,3,.01],aperture:[.9,0,4,.01],range:[3,.2,12,.05]},bloom:{threshold:[1.2,0,3,.01],intensity:[.15,0,1.5,.005],radius:[.15,0,1,.005]},monochrome:[1,0,1,.01],tonemap:wa(\\\"agx\\\",[\\\"agx\\\",\\\"aces\\\",\\\"neutral\\\",\\\"linear\\\"]),exposure:[1,.1,4,.01],contrast:[1.08,.6,1.6,.005],blackLift:[.02,0,.1,.001],vignette:{strength:[.2,0,1,.005],softness:[.7,.1,1.5,.005],radius:[.85,.2,1.6,.005]},grain:{strength:[.03,0,.15,.001],size:[1,1,4,1],speed:[1,0,3,.05],shadowWeight:[.8,0,1,.01],backgroundStrength:[0,0,.25,.001],backgroundSize:[2,1,8,1],backgroundSpeed:[0,0,3,.05]},dither:!0,aaMode:wa(\\\"traa\\\",[\\\"traa\\\",\\\"none\\\"]),pixelRatioCap:[2,.5,2,.25]},S_={chunks:[600,40,3e3,10],seed:[3,0,999,1],hitPadding:[.5,0,2,.05],eject:{speed:[2.6,0,10,.05],spread:[.7,0,4,.05],spin:[5,0,20,.1],jitter:[.45,0,1,.01],backwardRatio:[.2,0,1,.01]},motion:{drag:[1.3,0,8,.01],angularDrag:[1.6,0,8,.01],gravity:[.3,0,3,.01],turbulence:[1.2,0,6,.05],turbulenceScale:[1.4,.2,6,.05],maxSpeed:[10,1,40,.1]},return:{returnAfter:[1.4,0,20,.05],returnJitter:[.9,0,5,.05],idleDelay:[.6,0,10,.05],spring:[14,.5,60,.1],damping:[1,.2,2,.01],ramp:[.5,0,3,.05],rotationRate:[6,.5,30,.1],snapDistance:[.015,.002,.2,.001]},caps:{frost:[.85,0,1,.01],roughness:[.8,0,1,.01],grain:[.5,0,2,.01],darken:[.15,0,1,.01]}},__={adaptiveResolution:!0,targetFps:[60,30,120,1],minPixelRatio:[.75,.5,2,.05],sceneResolutionScale:[1,.5,1,.05],dynamicSceneResolution:!0,minSceneResolutionScale:[.35,.25,1,.05],upscaler:wa(\\\"taau\\\",[\\\"taau\\\",\\\"fsr1\\\",\\\"bilinear\\\",\\\"native\\\"]),upscaleSharpness:[.2,0,1,.05],nativePostEffects:!0,idleSkip:!1,adaptiveSteps:!1,voronoiCells:wa(\\\"27\\\",[\\\"27\\\",\\\"8\\\"]),hazeResolution:wa(\\\"full\\\",[\\\"full\\\",\\\"half\\\",\\\"quarter\\\"]),turbulence:wa(\\\"full\\\",[\\\"full\\\",\\\"fast\\\"]),gpuTimers:!0},DB={_collapsed:!0,showErosionSlice:!1,erosionSliceZ:[.5,0,1,.01],showDensityGrid:!1,showHitPoints:!1,colorByState:!1,colorBySize:!1,colorByAge:!1,wireframe:!1,freeze:!1,stepOnce:{type:\\\"action\\\",label:\\\"Step one frame\\\"},stats:!0,forceStroke:!1};function OB(e,t){if(!(!t||typeof t!=\\\"object\\\"))for(let[r,i]of Object.entries(t)){let s=e[r];s===void 0||r.startsWith(\\\"_\\\")||(Array.isArray(s)?typeof i==\\\"number\\\"&&(s[0]=i):s&&typeof s==\\\"object\\\"&&\\\"type\\\"in s?s.type!==\\\"action\\\"&&(s.default=i):s&&typeof s==\\\"object\\\"?OB(s,i):e[r]=i)}}var Zie={shape:b_,ice:gm,erosion:T_,powder:ym,healing:IB,fracture:S_,lighting:FB,camera:LB,post:kB,performance:__,debug:DB};for(let[e,t]of Object.entries(Zie))OB(t,qie[e]);typeof location\\u003c\\\"u\\\"&&new URLSearchParams(location.search).has(\\\"idleskip\\\")&&(__.idleSkip=!0),BB&&(S_.chunks[0]=120),BB&&(b_.segments[0]=96,gm.cracks.steps[0]=6,gm.cracks.fineCracks=!1,gm.dispersion[0]=0,T_.resolution.default=\\\"64\\\",ym.particleCount.default=\\\"100k\\\",ym.densityGrid.default=\\\"32\\\",ym.hazeSteps[0]=8);function Ma(e){let t={};for(let[r,i]of Object.entries(e))if(!r.startsWith(\\\"_\\\"))if(Array.isArray(i))t[r]=i[0];else if(typeof i==\\\"object\\\"&&i!==null&&\\\"type\\\"in i){if(i.type===\\\"action\\\")continue;t[r]=i.default??(i.options?i.options[0]:void 0)}else typeof i==\\\"object\\\"&&i!==null?t[r]=Ma(i):t[r]=i;return t}var le={shape:Ma(b_),ice:{...Ma(gm),features:{...Qd}},erosion:Ma(T_),powder:Ma(ym),healing:Ma(IB),lighting:Ma(FB),camera:Ma(LB),post:Ma(kB),performance:Ma(__),fracture:Ma(S_),debug:Ma(DB),version:0},R0e=new EventTarget,{Fn:Ku,vec3:yr,vec4:w_,float:xr,floor:M_,fract:Ol,dot:Ul,mix:E0e,abs:P0e,max:Jie,min:Qie,sqrt:UB,normalize:Kie,cross:ese,sin:tse,cos:rse,int:zl,If:xm,Loop:qy,mx_noise_float:vm,mx_noise_vec3:B0e,smoothstep:ise,select:I0e}=Jr,Po=Ku(([e])=>{let t=Ol(yr(e).mul(yr(.1031,.103,.0973))).toVar();return t.addAssign(Ul(t,t.yxz.add(33.33))),Ol(t.x.add(t.y).mul(t.z))}),Yy=Ku(([e])=>{let t=Ol(yr(e).mul(yr(.1031,.103,.0973))).toVar();return t.addAssign(Ul(t,t.yxz.add(33.33))),Ol(t.xxy.add(t.yxx).mul(t.zyx))}),N_=Ku(([e])=>{let t=Ol(xr(e).mul(.1031)).toVar();return t.mulAssign(t.add(33.33)),t.mulAssign(t.add(t)),Ol(t)}),ea=(e,t)=>Po(yr(xr(e).mul(1024.7).add(t*3.1),xr(e).mul(2047.3).add(t*7.7+1.3),xr(e).mul(511.1).add(t*13.9+2.9))),ws=e=>vm(e),Na=e=>yr(vm(e),vm(yr(e).yzx.add(yr(17.1,9.7,3.3))),vm(yr(e).zxy.add(yr(31.7,5.9,21.3))));function Bo(e,t,r=2,i=.5){let s=xr(0),a=1,n=0,o=yr(e);for(let l=0;l\\u003ct;l++)s=s.add(vm(o).mul(a)),n+=a,a*=i,o=o.mul(r).add(yr(17.3,9.1,31.7));return s.div(n)}var sse=Ku(([e])=>{let t=xr(.02),r=yr(t,0,0),i=yr(0,t,0),s=yr(0,0,t),a=Na(e.sub(r)),n=Na(e.add(r)),o=Na(e.sub(i)),l=Na(e.add(i)),u=Na(e.sub(s)),h=Na(e.add(s)),d=l.z.sub(o.z).sub(h.y.sub(u.y)),c=h.x.sub(u.x).sub(n.z.sub(a.z)),m=n.y.sub(a.y).sub(l.x.sub(o.x));return yr(d,c,m).div(t.mul(2))}),A_=Ku(([e,t])=>{let r=M_(e).toVar(),i=Ol(e).toVar(),s=xr(8).toVar(),a=yr(0).toVar(),n={start:zl(-1),end:zl(1),condition:\\\"\\u003c=\\\"};return qy(n,n,n,({i:o,j:l,k:u})=>{let h=yr(xr(o),xr(l),xr(u)),d=r.add(h),c=Yy(d.add(t)),m=h.add(c).sub(i),g=Ul(m,m);xm(g.lessThan(s),()=>{s.assign(g),a.assign(d.add(c))})}),w_(a,UB(s))}),ase=Ku(([e,t])=>{let r=M_(yr(e).sub(.5)).toVar(),i=xr(8).toVar(),s=yr(0).toVar(),a={start:zl(0),end:zl(1),condition:\\\"\\u003c=\\\"};return qy(a,a,a,({i:n,j:o,k:l})=>{let u=r.add(yr(xr(n),xr(o),xr(l))),h=u.add(Yy(u.add(t))),d=h.sub(e),c=Ul(d,d);xm(c.lessThan(i),()=>{i.assign(c),s.assign(h)})}),w_(s,UB(i))}),bm=Ku(([e,t,r])=>{let i=M_(e).toVar(),s=Ol(e).toVar(),a=xr(8).toVar(),n=yr(0).toVar(),o=yr(0).toVar(),l={start:zl(-1),end:zl(1),condition:\\\"\\u003c=\\\"};qy(l,l,l,({i:d,j:c,k:m})=>{let g=yr(xr(d),xr(c),xr(m)),y=i.add(g),b=Yy(y.add(t)),v=g.add(b).sub(s),S=Ul(v,v);xm(S.lessThan(a),()=>{a.assign(S),n.assign(v),o.assign(y)})}),a.assign(8);let u=yr(0,0,1).toVar(),h={start:zl(-2),end:zl(2),condition:\\\"\\u003c=\\\"};return qy(h,h,h,({i:d,j:c,k:m})=>{let g=yr(xr(d),xr(c),xr(m)),y=i.add(g),b=Yy(y.add(t)),v=g.add(b).sub(s),S=v.sub(n),T=Po(y.add(o).mul(.731).add(t)).lessThan(r);xm(Ul(S,S).greaterThan(1e-5).and(T),()=>{let w=Kie(S),N=Ul(n.add(v).mul(.5),w);xm(N.lessThan(a),()=>{a.assign(N),u.assign(w)})})}),w_(u,a)}),Zy=(e,t,r)=>ise(xr(t).sub(xr(r).mul(.5)),xr(t).add(xr(r).mul(.5)),e),Jy=(e,t,r)=>{let i=rse(r),s=tse(r);return e.mul(i).add(ese(t,e).mul(s)).add(t.mul(Ul(t,e)).mul(xr(1).sub(i)))},gi=e=>Qie(Jie(e,0),1),Io={headline1:\\\"Hard to|break.\\\",headline2:\\\"Easy to|remember.\\\",textWidth:6.5,fontWeight:\\\"600\\\",letterSpacing:.01,textLineHeight:.95,textDepth:.16,textBevel:.04,textCorner:.008,textMeshDetail:4,logoBreakAt:1.5,formHeadline1At:3.8,headline1BreakAt:10.375,formHeadline2At:12.675,headline2BreakAt:18.5,fadeOutAt:22,turnYaw:180,turnPitch:-41,approach:7,turnYaw2:160,turnPitch2:35,retreat:3.5,zoomIn:5,finalYaw:40,finalPitch:-20,driftYaw:2,driftSway:4,idleYaw:6,shardAmount:.44,strayDust:24,sliceRadius:.6,sliceStrength:21.5,breakDuration:2,finalEjectBoost:2.5,shatterRadius:.45,shatterStrength:32.5,cutThreshold:.3,cutSoftness:.19,edgeWidth:.19,edgeInset:0,brushSoftness:.15,brushNoise:.4,crumbleRate:4.3,crumbleCrackBias:5.1,crumbleDuration:.35,ejectSpeed:.91,ejectSpread:.48,ejectTurbulence:4,drag:0,gravity:0,turbulence:4,turbulenceScale:2.65,turbulenceDecay:3.65,clumpCohesion:.9,followObject:30,settleTime:2.2,settledDrift:1,maxSpeed:26.3,repelStrength:30,repelRange:.97,repelRadial:17.5,repelRadialRange:3.3,tumble:1.05,minPixelSize:.25,grainSizeMultiplier:1.05,spriteSize:1.9,returnGroupStagger:1.35,returnGroupScale:2.55,returnGroupSeed:60765,formSpread:0,waveReach:10,formJitter:2.8,formFill:3,returnSpring:29.9,returnDamping:1.34,returnRamp:.45,returnMaxSpeed:60,alignToSurface:1,alignCurve:3.75,healRate:3,cellRestore:60,landedFade:1.65,refrostTime:10.6,keyColor:\\\"#f0f7ff\\\",keyIntensity:5.05,keyElevation:42,keyAzimuth:-38,keySize:1.25,fill:.18,fillColor:\\\"#cadde9\\\",fillGroundColor:\\\"#172635\\\",rim:2.5,rimColor:\\\"#d9f1ff\\\",rimElevation:20,swayAmplitude:0,swayPeriod:35,envSoftbox:1.1,envRim:1.4,envFill:.22,backdropTop:\\\"#050505\\\",backdropMid:\\\"#050505\\\",backdropBottom:\\\"#050505\\\",backdropCenterX:.73,backdropCenterY:.22,backdropRadius:.8,backdropFalloff:.85,backdropNoise:0,ior:1.675,dispersion:.12,thicknessScale:2.04,attenuationDistance:6.54,attenuationColor:\\\"#d5f4ff\\\",baseRoughness:.31,clearcoat:0,clearcoatRoughness:0,envIntensity:2.04,specularIntensity:1.44,interiorScatter:.09,crumbleGlow:.16,edgeWhiteness:.09,frostScale:.7,frostThreshold:.62,frostSoftness:.24,frostRoughness:.73,frostDiffuse:.11,crystalBump:.01,crystalScale:4,crackLargeScale:2.45,crackWarp:.22,crackWarpScale:2.2,crackCoverage:.19,crackRegionScale:1.8,crackRegionCoverage:.6,veinScale:8,veinContrast:.55,crackWidth:.0025,crackBrightness:.65,crackDarkness:.69,crackRefraction:.076,crackSurfaceStrength:.16,fineScale:18.4,fineAmount:.52,fineCoverage:1,smudgeAmount:.78,smudgeCoverage:.58,smudgeMaskScale:1.85,smudgeAnisotropy:16.5,smudgeRoughness:.75,smudgeWhiteness:.035,smudgeScale:1.3,microBump:.445,microScale:10,microCoverage:.25,rippleBump:.22,rippleScale:23,bumpMaskScale:1.45,baseTone:\\\"#f3fbff\\\",wrap:.47,fragTranslucency:.96,fragThroughTint:\\\"#dff4ff\\\",fragFresnelPower:5,fragRoughness:.09,fragClearcoat:0,fragSpecular:1,sparkle:.4,sparkleFraction:.18,spriteTilt:12,spriteNormal:.15,spriteFrost:.23,spriteFrostBoost:.15,spriteFrostRoughness:.42,spriteEdgeLight:.85,spriteAlphaCut:.6,spriteSeeThrough:1,bloomThreshold:3,bloomIntensity:.04,bloomRadius:1,monochrome:.04,tonemap:\\\"aces\\\",exposure:1,contrast:1.03,blackLift:0,vignetteStrength:.14,vignetteSoftness:1.2,vignetteRadius:1.2,grainStrength:0,quality:\\\"full\\\",upscaler:\\\"fsr1\\\",renderScale:1,erosionResolution:\\\"96\\\",particleCount:\\\"100k\\\",logoUrl:\\\"assets/logo.svg\\\",deformStrength:0,deformScale:.41,deformSeed:7,logoMeshDetail:2,rimAzimuth:-146,rimAngle:26,rimSize:.45,fillReflectionStrength:.3,accentCoolIntensity:3.71,accentCoolReflection:2.31,accentCoolElevation:63,accentCoolAzimuth:22,accentCoolSize:2.65,accentCoolColor:\\\"#ff5900\\\",accentWarmIntensity:2.99,accentWarmReflection:.34,accentWarmElevation:30,accentWarmAzimuth:-30,accentWarmSize:1.2,accentWarmColor:\\\"#75aaff\\\",cameraMode:\\\"original\\\",cameraTrack:\\\"\\\",materialBaseColor:\\\"#ffffff\\\",materialTransmission:!0,materialAbsorption:!0,materialDispersion:!1,materialReflections:!0,materialFrost:!0,materialInteriorFrost:0,materialCrystals:!0,materialGrain:!0,materialGrainAmount:.47,materialGrainScale:150,materialCutNormals:!0,materialMicro:!0,materialRipples:!0,materialSmudges:!0,materialCracks:!0,materialScatter:!0,materialClearcoat:!0,materialShardNormals:!0,materialShardFrost:!0,materialShardTransmission:!0,materialShardReflections:!0,materialShardSparkle:!0,materialShardEdges:!0,materialBacklight:.27,materialInclusionAmount:2,materialInclusionScale:.05,returnNoiseAmount:\\\"2\\\",assemblyFrontDuration:3.2,assemblyOriginX:-.65,assemblyOriginY:.55,assemblyAngle:-35,assemblySpread:.65,assemblyFrontNoise:.35,assemblySpeedVariation:.65,assemblyBend:1.2,assemblySwirl:1.1,assemblyLandingVariation:.8,materialSurfaceBumps:!1,shapeResolution:\\\"256\\\",rendererProfile:\\\"studio\\\"},{max:Aa,float:zB,length:F0e,sqrt:nse,log:ose,select:lse,smoothstep:use,vec3:Qy,dot:VB,abs:hse,cos:GB,sin:WB,clamp:dse,mix:cse}=Jr,Bs={returnGroupStagger:Io.returnGroupStagger,returnGroupScale:Io.returnGroupScale,returnGroupSeed:Io.returnGroupSeed,returnNoiseAmount:2,assemblyFrontDuration:3.2,assemblyOriginX:-.65,assemblyOriginY:.55,assemblyAngle:-35,assemblySpread:.65,assemblyFrontNoise:.35,assemblySpeedVariation:.65,assemblyBend:1.2,assemblySwirl:1.1,assemblyLandingVariation:.8};function pse(e,t,r,i=zB(0)){let s=A_(e.div(Aa(t,.1)),r),a=e.div(Aa(t,.1)).add(Qy(r.mul(.173),r.mul(.317),r.mul(.571))),n=use(.18,.82,ws(a).mul(.5).add(.5));return lse(i.greaterThan(.5),n,Po(s.xyz.add(11.7)))}function mse(e,t,r){let i=nse(Aa(r.springK,.5)),s=e.add(t.div(i)).add(.03);return Aa(zB(2.8),r.springRamp.add(e.div(Aa(r.returnMaxSpeed,1))).add(ose(Aa(s.div(Aa(r.landRadius,.001)),1)).div(Aa(i.mul(r.springDamp),.5))).add(.35))}function C_(e,t){let r=e.div(Aa(t.bound,.001)).sub(Qy(t.frontX,t.frontY,0)),i=t.frontAngle.mul(Math.PI/180),s=VB(r.xy,Qy(GB(i),WB(i),0).xy),a=hse(VB(r.xy,Qy(WB(i).negate(),GB(i),0).xy)),n=Aa(s,0).add(Aa(s.negate(),0).mul(1.4)).div(1.5),o=a.div(1.5),l=ws(e.div(Aa(t.groupScale,.1)).add(t.groupSeed.mul(.173))).mul(.5).add(.5);return dse(cse(n,o,t.frontSpread).add(l.mul(t.frontNoise).mul(.35)),0,1)}var Ui={x:0,y:0,px:0,py:0,inside:!1,lastMoveT:0,moved:!1,clicked:!1,uiHidden:!1,overUi:!1},pt={strokeActive:!1,overObject:!1,lastStrokeT:-1e9,healing:!1,resetRequestedAt:-1,fade:1,sceneFade:1,hoverAmount:0,fps:0,frameMs:0,pixelRatio:1,outputPixelRatio:1,sceneResolutionScale:1,gpuFrames:0,gpuRenderMs:0,gpuComputeMs:0,fieldActive:!0,powderActive:!0,computeMs:0,counts:{active:0,healing:0,dormant:0,total:0},erosion:{max:0,over50:0,over90:0,refrost:0}},Ht={enabled:!1,clickResets:!0,framing:!0,distance:13.5,height:1.2,lookAtX:0,lookAtY:-.15,fov:27,baseYaw:0,basePitch:0,rotateYaw:35,rotatePitch:10,parallaxRange:3,objectX:0,objectY:0,objectZ:0,backdrop:null,shape:null,healSuspended:!1,cursorErodes:!0,hud:!1,cameraOverride:null,cameraProgress:0,logoParams:null},{Fn:R_,uniform:Ky,instancedArray:E_,instanceIndex:fse,uint:e1,ivec3:gse,vec3:P_,vec4:t1,float:r1,If:eh,texture3D:jB,textureStore:yse,clamp:HB,abs:xse,max:i1,min:XB,length:B_,mix:vse,smoothstep:bse,sin:$B}=Jr,Tse=class{constructor(e,t){this.world=e,this.options=t;let r=e.erosion,i=e.powder,s=i.buffers,a=i.u,n=r.res,o=fse;this.start=E_(i.count,\\\"vec4\\\"),this.captureProgress=E_(i.count,\\\"float\\\"),this.returnRadius=E_(i.count,\\\"vec2\\\");let l=jB(r.tex),u=jB(r.cellTex);this.fracture=R_(()=>{let h=gse(o.mod(e1(n)),o.div(e1(n)).mod(e1(n)),o.div(e1(n*n))),d=u.load(h).level(0).toVar(),c=l.load(h).level(0).toVar(),m=HB(xse(d.y.add(d.x.mul(.3))).div(r.bound*1.3).add(d.w.mul(.07)),1e-5,.99999),g=m.greaterThan(this.from).and(m.lessThanEqual(this.to));eh(g,()=>{c.assign(t1(1,0,0,1))}).Else(()=>{c.a.assign(c.a.mul(.5))}),yse(r.scratch,h,c).toWriteOnly()})().compute(n**3,[64]),this.capture=R_(()=>{this.start.element(o).assign(s.pos.element(o)),this.captureProgress.element(o).assign(this.progress),this.returnRadius.element(o).assign(B_(s.pos.element(o).xyz.sub(a.model.mul(t1(s.rest.element(o).xyz,1)).xyz)))})().compute(i.count,[64]),this.guide=R_(()=>{let h=s.pos.element(o),d=s.vel.element(o),c=s.meta.element(o),m=a.model.mul(t1(s.rest.element(o).xyz,1)).xyz,g=c.x;eh(g.greaterThan(4.5),()=>{h.xyz.assign(m),h.w.assign(0),d.xyz.assign(P_(0))}),eh(g.greaterThan(.5).and(g.lessThan(2.5)),()=>{eh(g.lessThan(1.5),()=>{this.start.element(o).assign(h),this.captureProgress.element(o).assign(this.progress),s.heal.element(o).assign(t1(h.xyz,a.time)),this.returnRadius.element(o).assign(B_(h.xyz.sub(m)))});let y=i1(this.captureProgress.element(o),C_(s.rest.element(o).xyz,a).mul(.22)),b=HB(this.progress.sub(y).div(i1(1e-6,r1(1).sub(y))),0,1).toVar();eh(this.progress.greaterThanEqual(.99999),()=>{b.assign(1)});let v=b.mul(b).mul(r1(3).sub(b.mul(2))),S=this.start.element(o).xyz,T=$B(b.mul(Math.PI)).mul(.35),w=vse(S,m,v).add(P_(T.mul($B(c.y.mul(12))),T.mul(.5),T));eh(this.mode.greaterThan(.5),()=>{h.xyz.assign(w)}).Else(()=>{let N=this.returnRadius.element(o),C=h.xyz.sub(m).toVar(),R=B_(C),E=XB(N.y,N.x.mul(r1(1).sub(v))),P=XB(R,E);h.xyz.assign(m.add(C.mul(P.div(i1(R,1e-6))))),N.y.assign(P)}),c.x.assign(2),h.w.assign(i1(h.w,this.start.element(o).w.mul(r1(1).sub(bse(.9,1,b))))),eh(b.greaterThanEqual(.99999),()=>{h.xyz.assign(m),h.w.assign(0),d.xyz.assign(P_(0)),c.x.assign(5)})})})().compute(i.count,[64]),i.beforeIntegrate=()=>{a.strokeDir.value.set(1,-.3,0).normalize(),a.strokeSpeed.value=3,a.rigStrength.value=this.options.mode===\\\"physical\\\"?this.progress.value:this.progress.value>0?1:0,a.returnAfter.value=0,a.heal.value=this.progress.value>0?1:0,a.repel.value=this.progress.value>0?0:1},i.beforeAssembly=()=>{this.capturePending&&(e.renderer.compute(this.capture),this.capturePending=!1),this.assembling&&this.options.mode!==\\\"physical\\\"&&e.renderer.compute(this.guide),this.assembling&&this.newCut&&i.prepareAssembly(e.renderer)},i.assemblyEnabled=!1,a.rigEnabled.value=1,e.onBeforeSimulation=(h,d)=>this.update(h,d)}previousBreak=0;previousAssembly=0;assembling=!1;capturePending=!1;from=Ky(0);to=Ky(0);progress=Ky(0);mode=Ky(0);start;captureProgress;returnRadius;newCut=!1;fracture;capture;guide;sample;target=0;breakLatch=!1;pose(e){let t=this.options.sample(e);this.sample=t,this.world.motionGroup.position.set(t.x,t.y+.05,t.z),this.world.motionGroup.rotation.set(t.rx*Math.PI/180,t.ry*Math.PI/180,t.rz*Math.PI/180,\\\"YXZ\\\"),this.world.objectGroup.quaternion.identity();let r=t.target??0;r!==this.target&&(this.target=r,this.options.retarget?.(r),this.previousBreak=0,this.previousAssembly=0,this.breakLatch=!1,this.assembling=!1,this.capturePending=!1,this.progress.value=0)}reset(){this.target=0,this.breakLatch=!1,this.previousBreak=0,this.previousAssembly=0,this.assembling=!1,this.capturePending=!1,this.world.powder.assemblyEnabled=!1,this.progress.value=0,this.world.powder.restoreThresholds(this.world.renderer)}update(e,t){if(t\\u003c=0)return;let r=this.sample||this.options.sample(e),i=this.world,s=i.powder,a=Math.max(0,Math.min(1,r.breakup/100)),n=Math.max(0,Math.min(1,r.assembly/100));le.performance.idleSkip=!1,i.erosion.u.reconstruct.value=1,this.newCut=a>this.previousBreak,this.options.sequence&&this.newCut&&(this.breakLatch||s.restoreThresholds(i.renderer),this.breakLatch=!0),this.options.sequence&&a===0&&n===0&&(this.breakLatch=!1),this.from.value=this.previousBreak,this.to.value=a,i.renderer.compute(this.fracture),i.erosion.commitAssembly(i.renderer),n>0&&this.previousAssembly\\u003c=0&&!this.breakLatch&&(this.options.sequence||(s.retarget(i.renderer,s.restInit),s.restoreThresholds(i.renderer)),s.assemblyEnabled=!0,this.assembling=!0,this.capturePending=!0,s.u.assemblyEnd.value=1e6,pt.lastStrokeT=e),(n===0||this.breakLatch)&&(this.assembling=!1,s.assemblyEnabled=!1);let o=n>0&&!this.breakLatch;pt.healing=o,this.progress.value=o?n:0,this.mode.value=this.options.mode===\\\"directed\\\"?1:0,s.u.repel.value=o?0:1,this.previousBreak=a,this.previousAssembly=n}dispose(){this.start.value.dispose?.(),this.captureProgress.value.dispose?.(),this.returnRadius.value.dispose?.()}},qB={original:\\\"gpu\\\",lookup:\\\"gpu,materials\\\",mesh:\\\"gpu,mesh,materials\\\",studio:\\\"gpu,fast,environment,materials,aa\\\",matcap:\\\"gpu,matcap,materials,aa\\\"},YB=typeof location>\\\"u\\\"?new URLSearchParams:new URLSearchParams(location.search);function ZB(e){let t=new Set((YB.has(\\\"rewrite\\\")?YB.get(\\\"rewrite\\\"):qB[e]||qB.studio).split(\\\",\\\"));return{gpu:t.has(\\\"gpu\\\"),environment:t.has(\\\"environment\\\"),materials:t.has(\\\"materials\\\"),matcap:t.has(\\\"matcap\\\"),fast:t.has(\\\"fast\\\"),aa:t.has(\\\"aa\\\"),mesh:t.has(\\\"mesh\\\")||t.has(\\\"matcap\\\")||t.has(\\\"fast\\\")}}var qa=ZB(typeof window>\\\"u\\\"?\\\"original\\\":\\\"studio\\\"),th={flags:qa,stages:[],sdf:[],start:performance.now()};typeof window\\u003c\\\"u\\\"&&(window.__rewrite=th);function Sse(e=\\\"studio\\\"){Object.assign(qa,ZB(e)),th.profile=e}var s1=Math.pow(2,-24),Tm=Symbol(\\\"SKIP_GENERATION\\\"),JB={strategy:0,maxDepth:40,targetLeafSize:10,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,verbose:!0,range:null,[Tm]:!1};function Ur(e,t,r){return r.min.x=t[e],r.min.y=t[e+1],r.min.z=t[e+2],r.max.x=t[e+3],r.max.y=t[e+4],r.max.z=t[e+5],r}function I_(e){let t=-1,r=-1/0;for(let i=0;i\\u003c3;i++){let s=e[i+3]-e[i];s>r&&(r=s,t=i)}return t}function QB(e,t){t.set(e)}function KB(e,t,r){let i,s;for(let a=0;a\\u003c3;a++){let n=a+3;i=e[a],s=t[a],r[a]=i\\u003cs?i:s,i=e[n],s=t[n],r[n]=i>s?i:s}}function a1(e,t,r){for(let i=0;i\\u003c3;i++){let s=t[e+2*i],a=t[e+2*i+1],n=s-a,o=s+a;n\\u003cr[i]&&(r[i]=n),o>r[i+3]&&(r[i+3]=o)}}function Sm(e){let t=e[3]-e[0],r=e[4]-e[1],i=e[5]-e[2];return 2*(t*r+r*i+i*t)}function Cr(e,t){return t[e+15]===65535}function Ei(e,t){return t[e+6]}function as(e,t){return t[e+14]}function oi(e){return e+8}function li(e,t){let r=t[e+6];return e+r*8}function F_(e,t){return t[e+7]}function L_(e,t,r,i,s){let a=1/0,n=1/0,o=1/0,l=-1/0,u=-1/0,h=-1/0,d=1/0,c=1/0,m=1/0,g=-1/0,y=-1/0,b=-1/0,v=e.offset||0;for(let S=(t-v)*6,T=(t+r-v)*6;S\\u003cT;S+=6){let w=e[S+0],N=e[S+1],C=w-N,R=w+N;C\\u003ca&&(a=C),R>l&&(l=R),w\\u003cd&&(d=w),w>g&&(g=w);let E=e[S+2],P=e[S+3],I=E-P,O=E+P;I\\u003cn&&(n=I),O>u&&(u=O),E\\u003cc&&(c=E),E>y&&(y=E);let L=e[S+4],X=e[S+5],z=L-X,H=L+X;z\\u003co&&(o=z),H>h&&(h=H),L\\u003cm&&(m=L),L>b&&(b=L)}i[0]=a,i[1]=n,i[2]=o,i[3]=l,i[4]=u,i[5]=h,s[0]=d,s[1]=c,s[2]=m,s[3]=g,s[4]=y,s[5]=b}var Fo=32,_se=(e,t)=>e.candidate-t.candidate,Vl=new Array(Fo).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),n1=new Float32Array(6);function wse(e,t,r,i,s,a){let n=-1,o=0;if(a===0)n=I_(t),n!==-1&&(o=(t[n]+t[n+3])/2);else if(a===1)n=I_(e),n!==-1&&(o=Mse(r,i,s,n));else if(a===2){let l=Sm(e),u=1.25*s,h=r.offset||0,d=(i-h)*6,c=(i+s-h)*6;for(let m=0;m\\u003c3;m++){let g=t[m],y=(t[m+3]-g)/Fo;if(s\\u003cFo/4){let b=[...Vl];b.length=s;let v=0;for(let T=d;T\\u003cc;T+=6,v++){let w=b[v];w.candidate=r[T+2*m],w.count=0;let{bounds:N,leftCacheBounds:C,rightCacheBounds:R}=w;for(let E=0;E\\u003c3;E++)R[E]=1/0,R[E+3]=-1/0,C[E]=1/0,C[E+3]=-1/0,N[E]=1/0,N[E+3]=-1/0;a1(T,r,N)}b.sort(_se);let S=s;for(let T=0;T\\u003cS;T++){let w=b[T];for(;T+1\\u003cS&&b[T+1].candidate===w.candidate;)b.splice(T+1,1),S--}for(let T=d;T\\u003cc;T+=6){let w=r[T+2*m];for(let N=0;N\\u003cS;N++){let C=b[N];w>=C.candidate?a1(T,r,C.rightCacheBounds):(a1(T,r,C.leftCacheBounds),C.count++)}}for(let T=0;T\\u003cS;T++){let w=b[T],N=w.count,C=s-w.count,R=w.leftCacheBounds,E=w.rightCacheBounds,P=0;N!==0&&(P=Sm(R)/l);let I=0;C!==0&&(I=Sm(E)/l);let O=1+1.25*(P*N+I*C);O\\u003cu&&(n=m,u=O,o=w.candidate)}}else{for(let S=0;S\\u003cFo;S++){let T=Vl[S];T.count=0,T.candidate=g+y+S*y;let w=T.bounds;for(let N=0;N\\u003c3;N++)w[N]=1/0,w[N+3]=-1/0}for(let S=d;S\\u003cc;S+=6){let T=~~((r[S+2*m]-g)/y);T>=Fo&&(T=Fo-1);let w=Vl[T];w.count++,a1(S,r,w.bounds)}let b=Vl[Fo-1];QB(b.bounds,b.rightCacheBounds);for(let S=Fo-2;S>=0;S--){let T=Vl[S],w=Vl[S+1];KB(T.bounds,w.rightCacheBounds,T.rightCacheBounds)}let v=0;for(let S=0;S\\u003cFo-1;S++){let T=Vl[S],w=T.count,N=T.bounds,C=Vl[S+1].rightCacheBounds;w!==0&&(v===0?QB(N,n1):KB(N,n1,n1)),v+=w;let R=0,E=0;v!==0&&(R=Sm(n1)/l);let P=s-v;P!==0&&(E=Sm(C)/l);let I=1+1.25*(R*v+E*P);I\\u003cu&&(n=m,u=I,o=T.candidate)}}}}else console.warn(`BVH: Invalid build strategy value ${a} used.`);return{axis:n,pos:o}}function Mse(e,t,r,i){let s=0,a=e.offset;for(let n=t,o=t+r;n\\u003co;n++)s+=e[(n-a)*6+i*2];return s/r}var k_=class{constructor(){this.boundingData=new Float32Array(6)}};function Nse(e,t,r,i,s,a){let n=i,o=i+s-1,l=a.pos,u=a.axis*2,h=r.offset||0;for(;;){for(;n\\u003c=o&&r[(n-h)*6+u]\\u003cl;)n++;for(;n\\u003c=o&&r[(o-h)*6+u]>=l;)o--;if(n\\u003co){for(let d=0;d\\u003ct;d++){let c=e[n*t+d];e[n*t+d]=e[o*t+d],e[o*t+d]=c}for(let d=0;d\\u003c6;d++){let c=n-h,m=o-h,g=r[c*6+d];r[c*6+d]=r[m*6+d],r[m*6+d]=g}n++,o--}else return n}}var e5,o1,D_,t5,Ase=Math.pow(2,32);function O_(e){return\\\"count\\\"in e?1:1+O_(e.left)+O_(e.right)}function Cse(e,t,r){return e5=new Float32Array(r),o1=new Uint32Array(r),D_=new Uint16Array(r),t5=new Uint8Array(r),U_(e,t)}function U_(e,t){let r=e/4,i=e/2,s=\\\"count\\\"in t,a=t.boundingData;for(let n=0;n\\u003c6;n++)e5[r+n]=a[n];if(s)return t.buffer?(t5.set(new Uint8Array(t.buffer),e),e+t.buffer.byteLength):(o1[r+6]=t.offset,D_[i+14]=t.count,D_[i+15]=65535,e+32);{let{left:n,right:o,splitAxis:l}=t,u=e+32,h=U_(u,n),d=e/32,c=h/32-d;if(c>Ase)throw new Error(\\\"MeshBVH: Cannot store relative child node offset greater than 32 bits.\\\");return o1[r+6]=c,o1[r+7]=l,U_(h,o)}}function Rse(e,t,r,i,s,a){let{maxDepth:n,verbose:o,targetLeafSize:l,_strictLeafSize:u=1/0,strategy:h,onProgress:d}=s,c=e.primitiveBuffer,m=e.primitiveBufferStride,g=new Float32Array(6),y=!1,b=new k_;return L_(t,r,i,b.boundingData,g),S(b,r,i,g),b;function v(T){d&&d((T-a.offset)/a.count)}function S(T,w,N,C=null,R=0){!y&&R>=n&&(y=!0,o&&console.warn(`BVH: Max depth of ${n} reached when generating BVH. Consider increasing maxDepth.`));let E=N>u;if(N\\u003c=l&&!E||R>=n)return v(w+N),T.offset=w,T.count=N,T;let P=wse(T.boundingData,C,t,w,N,h),I=P.axis===-1?-1:Nse(c,m,t,w,N,P);if(P.axis===-1||I===w||I===w+N){if(!E)return v(w+N),T.offset=w,T.count=N,T;P.axis=Math.max(0,I_(T.boundingData)),I=w+Math.max(1,Math.floor(N/2))}T.splitAxis=P.axis;let O=new k_,L=w,X=I-w;T.left=O,L_(t,L,X,O.boundingData,g),S(O,L,X,g,R+1);let z=new k_,H=I,ue=N-X;return T.right=z,L_(t,H,ue,z.boundingData,g),S(z,H,ue,g,R+1),T}}function Ese(e,t){let r=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=e.getRootRanges(t.range),s=i[0],a=i[i.length-1],n={offset:s.offset,count:a.offset+a.count-s.offset},o=new Float32Array(6*n.count);o.offset=n.offset,e.computePrimitiveBounds(n.offset,n.count,o),e._roots=i.map(l=>{let u=Rse(e,o,l.offset,l.count,t,n),h=O_(u),d=new r(32*h);return Cse(0,u,d),d})}var z_=class{constructor(e){this._getNewPrimitive=e,this._primitives=[]}getPrimitive(){let e=this._primitives;return e.length===0?this._getNewPrimitive():e.pop()}releasePrimitive(e){this._primitives.push(e)}},Pse=class{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;let e=[],t=null;this.setBuffer=r=>{t&&e.push(t),t=r,this.float32Array=new Float32Array(r),this.uint16Array=new Uint16Array(r),this.uint32Array=new Uint32Array(r)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}},Rr=new Pse,Gl,Kd,ec=[],l1=new z_(()=>new qi);function Bse(e,t,r,i,s,a){Gl=l1.getPrimitive(),Kd=l1.getPrimitive(),ec.push(Gl,Kd),Rr.setBuffer(e._roots[t]);let n=V_(0,e.geometry,r,i,s,a);Rr.clearBuffer(),l1.releasePrimitive(Gl),l1.releasePrimitive(Kd),ec.pop(),ec.pop();let o=ec.length;return o>0&&(Kd=ec[o-1],Gl=ec[o-2]),n}function V_(e,t,r,i,s=null,a=0,n=0){let{float32Array:o,uint16Array:l,uint32Array:u}=Rr,h=e*2;if(Cr(h,l)){let d=Ei(e,u),c=as(h,l);return Ur(e,o,Gl),i(d,c,!1,n,a+e/8,Gl)}else{let d=function(O){let{uint16Array:L,uint32Array:X}=Rr,z=O*2;for(;!Cr(z,L);)O=oi(O),z=O*2;return Ei(O,X)},c=function(O){let{uint16Array:L,uint32Array:X}=Rr,z=O*2;for(;!Cr(z,L);)O=li(O,X),z=O*2;return Ei(O,X)+as(z,L)},m=oi(e),g=li(e,u),y=m,b=g,v,S,T,w;if(s&&(T=Gl,w=Kd,Ur(y,o,T),Ur(b,o,w),v=s(T),S=s(w),S\\u003cv)){y=g,b=m;let O=v;v=S,S=O,T=w}T||(T=Gl,Ur(y,o,T));let N=Cr(y*2,l),C=r(T,N,v,n+1,a+y/8),R;if(C===2){let O=d(y),L=c(y)-O;R=i(O,L,!0,n+1,a+y/8,T)}else R=C&&V_(y,t,r,i,s,a,n+1);if(R)return!0;w=Kd,Ur(b,o,w);let E=Cr(b*2,l),P=r(w,E,S,n+1,a+b/8),I;if(P===2){let O=d(b),L=c(b)-O;I=i(O,L,!0,n+1,a+b/8,w)}else I=P&&V_(b,t,r,i,s,a,n+1);return!!I}}var _m=new Rr.constructor,u1=new Rr.constructor,Wl=new z_(()=>new qi),tc=new qi,rc=new qi,G_=new qi,W_=new qi,j_=!1;function Ise(e,t,r,i){if(j_)throw new Error(\\\"MeshBVH: Recursive calls to bvhcast not supported.\\\");j_=!0;let s=e._roots,a=t._roots,n,o=0,l=0,u=new We().copy(r).invert();for(let h=0,d=s.length;h\\u003cd;h++){_m.setBuffer(s[h]),l=0;let c=Wl.getPrimitive();Ur(0,_m.float32Array,c),c.applyMatrix4(u);for(let m=0,g=a.length;m\\u003cg&&(u1.setBuffer(a[m]),n=Ya(0,0,r,u,i,o,l,0,0,c),u1.clearBuffer(),l+=a[m].byteLength/32,!n);m++);if(Wl.releasePrimitive(c),_m.clearBuffer(),o+=s[h].byteLength/32,n)break}return j_=!1,n}function Ya(e,t,r,i,s,a=0,n=0,o=0,l=0,u=null,h=!1){let d,c;h?(d=u1,c=_m):(d=_m,c=u1);let m=d.float32Array,g=d.uint32Array,y=d.uint16Array,b=c.float32Array,v=c.uint32Array,S=c.uint16Array,T=e*2,w=t*2,N=Cr(T,y),C=Cr(w,S),R=!1;if(C&&N)h?R=s(Ei(t,v),as(t*2,S),Ei(e,g),as(e*2,y),l,n+t/8,o,a+e/8):R=s(Ei(e,g),as(e*2,y),Ei(t,v),as(t*2,S),o,a+e/8,l,n+t/8);else if(C){let E=Wl.getPrimitive();Ur(t,b,E),E.applyMatrix4(r);let P=oi(e),I=li(e,g);Ur(P,m,tc),Ur(I,m,rc);let O=E.intersectsBox(tc),L=E.intersectsBox(rc);R=O&&Ya(t,P,i,r,s,n,a,l,o+1,E,!h)||L&&Ya(t,I,i,r,s,n,a,l,o+1,E,!h),Wl.releasePrimitive(E)}else{let E=oi(t),P=li(t,v);Ur(E,b,G_),Ur(P,b,W_);let I=u.intersectsBox(G_),O=u.intersectsBox(W_);if(I&&O)R=Ya(e,E,r,i,s,a,n,o,l+1,u,h)||Ya(e,P,r,i,s,a,n,o,l+1,u,h);else if(I)if(N)R=Ya(e,E,r,i,s,a,n,o,l+1,u,h);else{let L=Wl.getPrimitive();L.copy(G_).applyMatrix4(r);let X=oi(e),z=li(e,g);Ur(X,m,tc),Ur(z,m,rc);let H=L.intersectsBox(tc),ue=L.intersectsBox(rc);R=H&&Ya(E,X,i,r,s,n,a,l,o+1,L,!h)||ue&&Ya(E,z,i,r,s,n,a,l,o+1,L,!h),Wl.releasePrimitive(L)}else if(O)if(N)R=Ya(e,P,r,i,s,a,n,o,l+1,u,h);else{let L=Wl.getPrimitive();L.copy(W_).applyMatrix4(r);let X=oi(e),z=li(e,g);Ur(X,m,tc),Ur(z,m,rc);let H=L.intersectsBox(tc),ue=L.intersectsBox(rc);R=H&&Ya(P,X,i,r,s,n,a,l,o+1,L,!h)||ue&&Ya(P,z,i,r,s,n,a,l,o+1,L,!h),Wl.releasePrimitive(L)}}return R}var jl=new class{constructor(){let e=null,t=null,r=null,i=!1;this.root=null,this.buffer=null,this.uint32Array=null,this.uint16Array=null,this.setBVH=(a,n)=>{if(i)throw new Error(\\\"BVHTraversalHelper: cannot call setBVH during an active traversal.\\\");this.root=n,this.buffer=e=a._roots[n],this.uint16Array=r=new Uint16Array(e),this.uint32Array=t=new Uint32Array(e)},this.reset=()=>{this.root=null,this.buffer=e=null,this.uint16Array=r=null,this.uint32Array=t=null},this.getRangeStart=a=>{let n=a*2;for(;!Cr(n,r);)a=oi(a),n=a*2;return Ei(a,t)},this.getRangeEnd=a=>{let n=a*2;for(;!Cr(n,r);)a=li(a,t),n=a*2;return Ei(a,t)+as(n,r)};let s=(a,n,o)=>{let l=n*2,u=Cr(l,r);if(!a(o,u,n)&&!u){let h=oi(n),d=li(n,t);s(a,h,o+1),s(a,d,o+1)}};this.traverseBuffer=a=>{if(i)throw new Error(\\\"BVHTraversalHelper: cannot start a traversal during an active traversal.\\\");i=!0;try{s(a,0,0)}finally{i=!1}},this.traverse=a=>{this.traverseBuffer((n,o,l)=>{if(o){let u=l*2,h=t[l+6],d=r[u+14];return a(n,o,new Float32Array(e,l*4,6),h,d)}else{let u=F_(l,t);return a(n,o,new Float32Array(e,l*4,6),u)}})}}},r5=new qi,ic=new Float32Array(6),i5=class{constructor(){this._roots=null,this.primitiveBuffer=null,this.primitiveBufferStride=null}init(e){e={...JB,...e},\\\"maxLeafSize\\\"in e&&(console.warn('BVH: \\\"maxLeafSize\\\" option has been deprecated. Use \\\"targetLeafSize\\\", instead.'),e={...e,targetLeafSize:e.maxLeafSize}),Ese(this,e)}getRootRanges(){throw new Error(\\\"BVH: getRootRanges() not implemented\\\")}writePrimitiveBounds(){throw new Error(\\\"BVH: writePrimitiveBounds() not implemented\\\")}writePrimitiveRangeBounds(e,t,r,i){let s=1/0,a=1/0,n=1/0,o=-1/0,l=-1/0,u=-1/0;for(let h=e,d=e+t;h\\u003cd;h++){this.writePrimitiveBounds(h,ic,0);let[c,m,g,y,b,v]=ic;c\\u003cs&&(s=c),y>o&&(o=y),m\\u003ca&&(a=m),b>l&&(l=b),g\\u003cn&&(n=g),v>u&&(u=v)}return r[i+0]=s,r[i+1]=a,r[i+2]=n,r[i+3]=o,r[i+4]=l,r[i+5]=u,r}computePrimitiveBounds(e,t,r){let i=r.offset||0;for(let s=e,a=e+t;s\\u003ca;s++){this.writePrimitiveBounds(s,ic,0);let[n,o,l,u,h,d]=ic,c=(n+u)/2,m=(o+h)/2,g=(l+d)/2,y=(u-n)/2,b=(h-o)/2,v=(d-l)/2,S=(s-i)*6;r[S+0]=c,r[S+1]=y+(Math.abs(c)+y)*s1,r[S+2]=m,r[S+3]=b+(Math.abs(m)+b)*s1,r[S+4]=g,r[S+5]=v+(Math.abs(g)+v)*s1}return r}shiftPrimitiveOffsets(e){let t=this._indirectBuffer;if(t)for(let r=0,i=t.length;r\\u003ci;r++)t[r]+=e;else{let r=this._roots;for(let i=0;i\\u003cr.length;i++){let s=r[i],a=new Uint32Array(s),n=new Uint16Array(s),o=s.byteLength/32;for(let l=0;l\\u003co;l++){let u=8*l,h=2*u;Cr(h,n)&&(a[u+6]+=e)}}}}traverse(e,t=0){jl.setBVH(this,t),jl.traverse(e),jl.reset()}refit(){let e=this._roots;for(let t=0,r=e.length;t\\u003cr;t++){let i=e[t],s=new Uint32Array(i),a=new Uint16Array(i),n=new Float32Array(i),o=i.byteLength/32;for(let l=o-1;l>=0;l--){let u=l*8,h=u*2;if(Cr(h,a)){let d=Ei(u,s),c=as(h,a);this.writePrimitiveRangeBounds(d,c,ic,0),n.set(ic,u)}else{let d=oi(u),c=li(u,s);for(let m=0;m\\u003c3;m++){let g=n[d+m],y=n[d+m+3],b=n[c+m],v=n[c+m+3];n[u+m]=g\\u003cb?g:b,n[u+m+3]=y>v?y:v}}}}}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(t=>{Ur(0,new Float32Array(t),r5),e.union(r5)}),e}shapecast(e){let{boundsTraverseOrder:t,intersectsBounds:r,intersectsRange:i,intersectsPrimitive:s,scratchPrimitive:a,iterate:n}=e;if(i&&s){let h=i;i=(d,c,m,g,y)=>h(d,c,m,g,y)?!0:n(d,c,this,s,m,g,a)}else i||(s?i=(h,d,c,m)=>n(h,d,this,s,c,m,a):i=(h,d,c)=>c);let o=!1,l=0,u=this._roots;for(let h=0,d=u.length;h\\u003cd;h++){let c=u[h];if(o=Bse(this,h,r,i,t,l),o)break;l+=c.byteLength/32}return o}bvhcast(e,t,r){let{intersectsRanges:i}=r;return Ise(this,e,t,i)}};function Fse(){return typeof SharedArrayBuffer\\u003c\\\"u\\\"}function H_(e){return e.index?e.index.count:e.attributes.position.count}function h1(e){return H_(e)/3}function Lse(e,t=ArrayBuffer){return e>65535?new Uint32Array(new t(4*e)):new Uint16Array(new t(2*e))}function kse(e,t){if(!e.index){let r=e.attributes.position.count,i=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,s=Lse(r,i);e.setIndex(new _i(s,1));for(let a=0;a\\u003cr;a++)s[a]=a}}function Dse(e,t,r){let i=H_(e)/r,s=t||e.drawRange,a=s.start/r,n=(s.start+s.count)/r,o=Math.max(0,a),l=Math.min(i,n)-o;return{offset:Math.floor(o),count:Math.floor(l)}}function Ose(e,t){return e.groups.map(r=>({offset:r.start/t,count:r.count/t}))}function s5(e,t,r){let i=Dse(e,t,r),s=Ose(e,r);if(!s.length)return[i];let a=[],n=i.offset,o=i.offset+i.count,l=H_(e)/r,u=[];for(let c of s){let{offset:m,count:g}=c,y=m,b=isFinite(g)?g:l-m,v=m+b;y\\u003co&&v>n&&(u.push({pos:Math.max(n,y),isStart:!0}),u.push({pos:Math.min(o,v),isStart:!1}))}u.sort((c,m)=>c.pos!==m.pos?c.pos-m.pos:c.type===\\\"end\\\"?-1:1);let h=0,d=null;for(let c of u){let m=c.pos;h!==0&&m!==d&&a.push({offset:d,count:m-d}),h+=c.isStart?1:-1,d=m}return a}function Use(e,t){let r=e[e.length-1],i=r.offset+r.count>2**16,s=e.reduce((u,h)=>u+h.count,0),a=i?4:2,n=t?new SharedArrayBuffer(s*a):new ArrayBuffer(s*a),o=i?new Uint32Array(n):new Uint16Array(n),l=0;for(let u=0;u\\u003ce.length;u++){let{offset:h,count:d}=e[u];for(let c=0;c\\u003cd;c++)o[l+c]=h+c;l+=d}return o}var d1=class extends i5{get indirect(){return!!this._indirectBuffer}get primitiveStride(){return null}get primitiveBufferStride(){return this.indirect?1:this.primitiveStride}set primitiveBufferStride(e){}get primitiveBuffer(){return this.indirect?this._indirectBuffer:this.geometry.index.array}set primitiveBuffer(e){}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error(\\\"BVH: InterleavedBufferAttribute is not supported for the index attribute.\\\")}else throw new Error(\\\"BVH: Only BufferGeometries are supported.\\\");if(t.useSharedArrayBuffer&&!Fse())throw new Error(\\\"BVH: SharedArrayBuffer is not available.\\\");super(),this.geometry=e,this.resolvePrimitiveIndex=t.indirect?r=>this._indirectBuffer[r]:r=>r,this.primitiveBuffer=null,this.primitiveBufferStride=null,this._indirectBuffer=null,t={...JB,...t},t[Tm]||this.init(t)}init(e){let{geometry:t,primitiveStride:r}=this;if(e.indirect){let i=s5(t,e.range,r),s=Use(i,e.useSharedArrayBuffer);this._indirectBuffer=s}else kse(t,e);super.init(e),!t.boundingBox&&e.setBoundingBox&&(t.boundingBox=this.getBoundingBox(new qi))}getRootRanges(e){return this.indirect?[{offset:0,count:this._indirectBuffer.length}]:s5(this.geometry,e,this.primitiveStride)}raycastObject3D(){throw new Error(\\\"BVH: raycastObject3D() not implemented\\\")}},Lo=class{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let r=1/0,i=-1/0;for(let s=0,a=e.length;s\\u003ca;s++){let n=e[s][t];r=n\\u003cr?n:r,i=n>i?n:i}this.min=r,this.max=i}setFromPoints(e,t){let r=1/0,i=-1/0;for(let s=0,a=t.length;s\\u003ca;s++){let n=t[s],o=e.dot(n);r=o\\u003cr?o:r,i=o>i?o:i}this.min=r,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}};Lo.prototype.setFromBox=(function(){let e=new F;return function(t,r){let i=r.min,s=r.max,a=1/0,n=-1/0;for(let o=0;o\\u003c=1;o++)for(let l=0;l\\u003c=1;l++)for(let u=0;u\\u003c=1;u++){e.x=i.x*o+s.x*(1-o),e.y=i.y*l+s.y*(1-l),e.z=i.z*u+s.z*(1-u);let h=t.dot(e);a=Math.min(h,a),n=Math.max(h,n)}this.min=a,this.max=n}})();var zse=(function(){let e=new F,t=new F,r=new F;return function(i,s,a){let n=i.start,o=e,l=s.start,u=t;r.subVectors(n,l),e.subVectors(i.end,i.start),t.subVectors(s.end,s.start);let h=r.dot(u),d=u.dot(o),c=u.dot(u),m=r.dot(o),g=o.dot(o)*c-d*d,y,b;g!==0?y=(h*d-m*c)/g:y=0,b=(h+y*d)/c,a.x=y,a.y=b}})(),X_=(function(){let e=new fe,t=new F,r=new F;return function(i,s,a,n){zse(i,s,e);let o=e.x,l=e.y;if(o>=0&&o\\u003c=1&&l>=0&&l\\u003c=1){i.at(o,a),s.at(l,n);return}else if(o>=0&&o\\u003c=1){l\\u003c0?s.at(0,n):s.at(1,n),i.closestPointToPoint(n,!0,a);return}else if(l>=0&&l\\u003c=1){o\\u003c0?i.at(0,a):i.at(1,a),s.closestPointToPoint(a,!0,n);return}else{let u;o\\u003c0?u=i.start:u=i.end;let h;l\\u003c0?h=s.start:h=s.end;let d=t,c=r;if(i.closestPointToPoint(h,!0,t),s.closestPointToPoint(u,!0,r),d.distanceToSquared(h)\\u003c=c.distanceToSquared(u)){a.copy(d),n.copy(h);return}else{a.copy(u),n.copy(c);return}}}})(),Vse=(function(){let e=new F,t=new F,r=new fn,i=new fo;return function(s,a){let{radius:n,center:o}=s,{a:l,b:u,c:h}=a;if(i.start=l,i.end=u,i.closestPointToPoint(o,!0,e).distanceTo(o)\\u003c=n||(i.start=l,i.end=h,i.closestPointToPoint(o,!0,e).distanceTo(o)\\u003c=n)||(i.start=u,i.end=h,i.closestPointToPoint(o,!0,e).distanceTo(o)\\u003c=n))return!0;let d=a.getPlane(r);if(Math.abs(d.distanceToPoint(o))\\u003c=n){let c=d.projectPoint(o,t);if(a.containsPoint(c))return!0}return!1}})(),Gse=[\\\"x\\\",\\\"y\\\",\\\"z\\\"],ko=1e-15,a5=ko*ko;function Ca(e){return Math.abs(e)\\u003cko}var Ra=class extends $i{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new F),this.satBounds=new Array(4).fill().map(()=>new Lo),this.points=[this.a,this.b,this.c],this.plane=new fn,this.isDegenerateIntoSegment=!1,this.isDegenerateIntoPoint=!1,this.degenerateSegment=new fo,this.needsUpdate=!0}intersectsSphere(e){return Vse(e,this)}update(){let e=this.a,t=this.b,r=this.c,i=this.points,s=this.satAxes,a=this.satBounds,n=s[0],o=a[0];this.getNormal(n),o.setFromPoints(n,i);let l=s[1],u=a[1];l.subVectors(e,t),u.setFromPoints(l,i);let h=s[2],d=a[2];h.subVectors(t,r),d.setFromPoints(h,i);let c=s[3],m=a[3];c.subVectors(r,e),m.setFromPoints(c,i);let g=l.length(),y=h.length(),b=c.length();this.isDegenerateIntoPoint=!1,this.isDegenerateIntoSegment=!1,g\\u003cko?y\\u003cko||b\\u003cko?this.isDegenerateIntoPoint=!0:(this.isDegenerateIntoSegment=!0,this.degenerateSegment.start.copy(e),this.degenerateSegment.end.copy(r)):y\\u003cko?b\\u003cko?this.isDegenerateIntoPoint=!0:(this.isDegenerateIntoSegment=!0,this.degenerateSegment.start.copy(t),this.degenerateSegment.end.copy(e)):b\\u003cko&&(this.isDegenerateIntoSegment=!0,this.degenerateSegment.start.copy(r),this.degenerateSegment.end.copy(t)),this.plane.setFromNormalAndCoplanarPoint(n,e),this.needsUpdate=!1}};Ra.prototype.closestPointToSegment=(function(){let e=new F,t=new F,r=new fo;return function(i,s=null,a=null){let{start:n,end:o}=i,l=this.points,u,h=1/0;for(let d=0;d\\u003c3;d++){let c=(d+1)%3;r.start.copy(l[d]),r.end.copy(l[c]),X_(r,i,e,t),u=e.distanceToSquared(t),u\\u003ch&&(h=u,s&&s.copy(e),a&&a.copy(t))}return this.closestPointToPoint(n,e),u=n.distanceToSquared(e),u\\u003ch&&(h=u,s&&s.copy(e),a&&a.copy(n)),this.closestPointToPoint(o,e),u=o.distanceToSquared(e),u\\u003ch&&(h=u,s&&s.copy(e),a&&a.copy(o)),Math.sqrt(h)}})(),Ra.prototype.intersectsTriangle=(function(){let e=new Ra,t=new Lo,r=new Lo,i=new F,s=new F,a=new F,n=new F,o=new fo,l=new fo,u=new F,h=new fe,d=new fe;function c(T,w,N,C){let R=i;!T.isDegenerateIntoPoint&&!T.isDegenerateIntoSegment?R.copy(T.plane.normal):R.copy(w.plane.normal);let E=T.satBounds,P=T.satAxes;for(let L=1;L\\u003c4;L++){let X=E[L],z=P[L];if(t.setFromPoints(z,w.points),X.isSeparated(t)||(n.copy(R).cross(z),t.setFromPoints(n,T.points),r.setFromPoints(n,w.points),t.isSeparated(r)))return!1}let I=w.satBounds,O=w.satAxes;for(let L=1;L\\u003c4;L++){let X=I[L],z=O[L];if(t.setFromPoints(z,T.points),X.isSeparated(t)||(n.crossVectors(R,z),t.setFromPoints(n,T.points),r.setFromPoints(n,w.points),t.isSeparated(r)))return!1}return N&&(C||console.warn(\\\"ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0.\\\"),N.start.set(0,0,0),N.end.set(0,0,0)),!0}function m(T,w,N,C,R,E,P,I,O,L,X){let z=P/(P-I);L.x=C+(R-C)*z,X.start.subVectors(w,T).multiplyScalar(z).add(T),z=P/(P-O),L.y=C+(E-C)*z,X.end.subVectors(N,T).multiplyScalar(z).add(T)}function g(T,w,N,C,R,E,P,I,O,L,X){if(R>0)m(T.c,T.a,T.b,C,w,N,O,P,I,L,X);else if(E>0)m(T.b,T.a,T.c,N,w,C,I,P,O,L,X);else if(I*O>0||P!=0)m(T.a,T.b,T.c,w,N,C,P,I,O,L,X);else if(I!=0)m(T.b,T.a,T.c,N,w,C,I,P,O,L,X);else if(O!=0)m(T.c,T.a,T.b,C,w,N,O,P,I,L,X);else return!0;return!1}function y(T,w,N,C){let R=w.degenerateSegment,E=T.plane.distanceToPoint(R.start),P=T.plane.distanceToPoint(R.end);return Ca(E)?Ca(P)?c(T,w,N,C):(N&&(N.start.copy(R.start),N.end.copy(R.start)),T.containsPoint(R.start)):Ca(P)?(N&&(N.start.copy(R.end),N.end.copy(R.end)),T.containsPoint(R.end)):T.plane.intersectLine(R,i)!=null?(N&&(N.start.copy(i),N.end.copy(i)),T.containsPoint(i)):!1}function b(T,w,N){let C=w.a;return Ca(T.plane.distanceToPoint(C))&&T.containsPoint(C)?(N&&(N.start.copy(C),N.end.copy(C)),!0):!1}function v(T,w,N){let C=T.degenerateSegment,R=w.a;return C.closestPointToPoint(R,!0,i),R.distanceToSquared(i)\\u003ca5?(N&&(N.start.copy(R),N.end.copy(R)),!0):!1}function S(T,w,N,C){if(T.isDegenerateIntoSegment)if(w.isDegenerateIntoSegment){let R=T.degenerateSegment,E=w.degenerateSegment,P=s,I=a;R.delta(P),E.delta(I);let O=i.subVectors(E.start,R.start),L=P.x*I.y-P.y*I.x;if(Ca(L))return!1;let X=(O.x*I.y-O.y*I.x)/L,z=-(P.x*O.y-P.y*O.x)/L;if(X\\u003c0||X>1||z\\u003c0||z>1)return!1;let H=R.start.z+P.z*X,ue=E.start.z+I.z*z;return Ca(H-ue)?(N&&(N.start.copy(R.start).addScaledVector(P,X),N.end.copy(R.start).addScaledVector(P,X)),!0):!1}else return w.isDegenerateIntoPoint?v(T,w,N):y(w,T,N,C);else{if(T.isDegenerateIntoPoint)return w.isDegenerateIntoPoint?w.a.distanceToSquared(T.a)\\u003ca5?(N&&(N.start.copy(T.a),N.end.copy(T.a)),!0):!1:w.isDegenerateIntoSegment?v(w,T,N):b(w,T,N);if(w.isDegenerateIntoPoint)return b(T,w,N);if(w.isDegenerateIntoSegment)return y(T,w,N,C)}}return function(T,w=null,N=!1){this.needsUpdate&&this.update(),T.isExtendedTriangle?T.needsUpdate&&T.update():(e.copy(T),e.update(),T=e);let C=S(this,T,w,N);if(C!==void 0)return C;let R=this.plane,E=T.plane,P=E.distanceToPoint(this.a),I=E.distanceToPoint(this.b),O=E.distanceToPoint(this.c);Ca(P)&&(P=0),Ca(I)&&(I=0),Ca(O)&&(O=0);let L=P*I,X=P*O;if(L>0&&X>0)return!1;let z=R.distanceToPoint(T.a),H=R.distanceToPoint(T.b),ue=R.distanceToPoint(T.c);Ca(z)&&(z=0),Ca(H)&&(H=0),Ca(ue)&&(ue=0);let ne=z*H,re=z*ue;if(ne>0&&re>0)return!1;s.copy(R.normal),a.copy(E.normal);let ce=s.cross(a),ge=0,ye=Math.abs(ce.x),oe=Math.abs(ce.y);oe>ye&&(ye=oe,ge=1),Math.abs(ce.z)>ye&&(ge=2);let Ae=Gse[ge],Ie=this.a[Ae],Xe=this.b[Ae],at=this.c[Ae],W=T.a[Ae],j=T.b[Ae],G=T.c[Ae];if(g(this,Ie,Xe,at,L,X,P,I,O,h,o))return c(this,T,w,N);if(g(T,W,j,G,ne,re,z,H,ue,d,l))return c(this,T,w,N);if(h.y\\u003ch.x){let ae=h.y;h.y=h.x,h.x=ae,u.copy(o.start),o.start.copy(o.end),o.end.copy(u)}if(d.y\\u003cd.x){let ae=d.y;d.y=d.x,d.x=ae,u.copy(l.start),l.start.copy(l.end),l.end.copy(u)}return h.y\\u003cd.x||d.y\\u003ch.x?!1:(w&&(d.x>h.x?w.start.copy(l.start):w.start.copy(o.start),d.y\\u003ch.y?w.end.copy(l.end):w.end.copy(o.end)),!0)}})(),Ra.prototype.distanceToPoint=(function(){let e=new F;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}})(),Ra.prototype.distanceToTriangle=(function(){let e=new F,t=new F,r=[\\\"a\\\",\\\"b\\\",\\\"c\\\"],i=new fo,s=new fo;return function(a,n=null,o=null){let l=n||o?i:null;if(this.intersectsTriangle(a,l,!0))return(n||o)&&(n&&l.getCenter(n),o&&l.getCenter(o)),0;let u=1/0;for(let h=0;h\\u003c3;h++){let d,c=r[h],m=a[c];this.closestPointToPoint(m,e),d=m.distanceToSquared(e),d\\u003cu&&(u=d,n&&n.copy(e),o&&o.copy(m));let g=this[c];a.closestPointToPoint(g,e),d=g.distanceToSquared(e),d\\u003cu&&(u=d,n&&n.copy(g),o&&o.copy(e))}for(let h=0;h\\u003c3;h++){let d=r[h],c=r[(h+1)%3];i.set(this[d],this[c]);for(let m=0;m\\u003c3;m++){let g=r[m],y=r[(m+1)%3];s.set(a[g],a[y]),X_(i,s,e,t);let b=e.distanceToSquared(t);b\\u003cu&&(u=b,n&&n.copy(e),o&&o.copy(t))}}return Math.sqrt(u)}})();var Ms=class{constructor(e,t,r){this.isOrientedBox=!0,this.min=new F,this.max=new F,this.matrix=new We,this.invMatrix=new We,this.points=new Array(8).fill().map(()=>new F),this.satAxes=new Array(3).fill().map(()=>new F),this.satBounds=new Array(3).fill().map(()=>new Lo),this.alignedSatBounds=new Array(3).fill().map(()=>new Lo),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),r&&this.matrix.copy(r)}set(e,t,r){this.min.copy(e),this.max.copy(t),this.matrix.copy(r),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}};Ms.prototype.update=(function(){return function(){let e=this.matrix,t=this.min,r=this.max,i=this.points;for(let l=0;l\\u003c=1;l++)for(let u=0;u\\u003c=1;u++)for(let h=0;h\\u003c=1;h++){let d=1*l|2*u|4*h,c=i[d];c.x=l?r.x:t.x,c.y=u?r.y:t.y,c.z=h?r.z:t.z,c.applyMatrix4(e)}let s=this.satBounds,a=this.satAxes,n=i[0];for(let l=0;l\\u003c3;l++){let u=a[l],h=s[l],d=1\\u003c\\u003cl,c=i[d];u.subVectors(n,c),h.setFromPoints(u,i)}let o=this.alignedSatBounds;o[0].setFromPointsField(i,\\\"x\\\"),o[1].setFromPointsField(i,\\\"y\\\"),o[2].setFromPointsField(i,\\\"z\\\"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}})(),Ms.prototype.intersectsBox=(function(){let e=new Lo;return function(t){this.needsUpdate&&this.update();let r=t.min,i=t.max,s=this.satBounds,a=this.satAxes,n=this.alignedSatBounds;if(e.min=r.x,e.max=i.x,n[0].isSeparated(e)||(e.min=r.y,e.max=i.y,n[1].isSeparated(e))||(e.min=r.z,e.max=i.z,n[2].isSeparated(e)))return!1;for(let o=0;o\\u003c3;o++){let l=a[o],u=s[o];if(e.setFromBox(l,t),u.isSeparated(e))return!1}return!0}})(),Ms.prototype.intersectsTriangle=(function(){let e=new Ra,t=new Array(3),r=new Lo,i=new Lo,s=new F;return function(a){this.needsUpdate&&this.update(),a.isExtendedTriangle?a.needsUpdate&&a.update():(e.copy(a),e.update(),a=e);let n=this.satBounds,o=this.satAxes;t[0]=a.a,t[1]=a.b,t[2]=a.c;for(let d=0;d\\u003c3;d++){let c=n[d],m=o[d];if(r.setFromPoints(m,t),c.isSeparated(r))return!1}let l=a.satBounds,u=a.satAxes,h=this.points;for(let d=0;d\\u003c3;d++){let c=l[d],m=u[d];if(r.setFromPoints(m,h),c.isSeparated(r))return!1}for(let d=0;d\\u003c3;d++){let c=o[d];for(let m=0;m\\u003c4;m++){let g=u[m];if(s.crossVectors(c,g),r.setFromPoints(s,t),i.setFromPoints(s,h),r.isSeparated(i))return!1}}return!0}})(),Ms.prototype.closestPointToPoint=(function(){return function(e,t){return this.needsUpdate&&this.update(),t.copy(e).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),t}})(),Ms.prototype.distanceToPoint=(function(){let e=new F;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}})(),Ms.prototype.distanceToBox=(function(){let e=[\\\"x\\\",\\\"y\\\",\\\"z\\\"],t=new Array(12).fill().map(()=>new fo),r=new Array(12).fill().map(()=>new fo),i=new F,s=new F;return function(a,n=0,o=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(a))return(o||l)&&(a.getCenter(s),this.closestPointToPoint(s,i),a.closestPointToPoint(i,s),o&&o.copy(i),l&&l.copy(s)),0;let u=n*n,h=a.min,d=a.max,c=this.points,m=1/0;for(let y=0;y\\u003c8;y++){let b=c[y];s.copy(b).clamp(h,d);let v=b.distanceToSquared(s);if(v\\u003cm&&(m=v,o&&o.copy(b),l&&l.copy(s),v\\u003cu))return Math.sqrt(v)}let g=0;for(let y=0;y\\u003c3;y++)for(let b=0;b\\u003c=1;b++)for(let v=0;v\\u003c=1;v++){let S=(y+1)%3,T=(y+2)%3,w=b\\u003c\\u003cS|v\\u003c\\u003cT,N=1\\u003c\\u003cy|b\\u003c\\u003cS|v\\u003c\\u003cT,C=c[w],R=c[N];t[g].set(C,R);let E=e[y],P=e[S],I=e[T],O=r[g],L=O.start,X=O.end;L[E]=h[E],L[P]=b?h[P]:d[P],L[I]=v?h[I]:d[P],X[E]=d[E],X[P]=b?h[P]:d[P],X[I]=v?h[I]:d[P],g++}for(let y=0;y\\u003c=1;y++)for(let b=0;b\\u003c=1;b++)for(let v=0;v\\u003c=1;v++){s.x=y?d.x:h.x,s.y=b?d.y:h.y,s.z=v?d.z:h.z,this.closestPointToPoint(s,i);let S=s.distanceToSquared(i);if(S\\u003cm&&(m=S,o&&o.copy(i),l&&l.copy(s),S\\u003cu))return Math.sqrt(S)}for(let y=0;y\\u003c12;y++){let b=t[y];for(let v=0;v\\u003c12;v++){let S=r[v];X_(b,S,i,s);let T=i.distanceToSquared(s);if(T\\u003cm&&(m=T,o&&o.copy(i),l&&l.copy(s),T\\u003cu))return Math.sqrt(T)}}return Math.sqrt(m)}})();var Wse=class extends z_{constructor(){super(()=>new Ra)}},Ea=new Wse,wm=new F,$_=new F;function jse(e,t,r={},i=0,s=1/0){let a=i*i,n=s*s,o=1/0,l=null;if(e.shapecast({boundsTraverseOrder:h=>(wm.copy(t).clamp(h.min,h.max),wm.distanceToSquared(t)),intersectsBounds:(h,d,c)=>c\\u003co&&c\\u003cn,intersectsTriangle:(h,d)=>{h.closestPointToPoint(t,wm);let c=t.distanceToSquared(wm);return c\\u003co&&($_.copy(wm),o=c,l=d),c\\u003ca}}),o===1/0)return null;let u=Math.sqrt(o);return r.point?r.point.copy($_):r.point=$_.clone(),r.distance=u,r.faceIndex=l,r}var c1=parseInt(\\\"185\\\")>=169,Hse=parseInt(\\\"185\\\")\\u003c=161,rh=new F,ih=new F,sh=new F,p1=new fe,m1=new fe,f1=new fe,n5=new F,o5=new F,l5=new F,Mm=new F;function Xse(e,t,r,i,s,a,n,o){let l;if(a===ii?l=e.intersectTriangle(i,r,t,!0,s):l=e.intersectTriangle(t,r,i,a!==hs,s),l===null)return null;let u=e.origin.distanceTo(s);return u\\u003cn||u>o?null:{distance:u,point:s.clone()}}function u5(e,t,r,i,s,a,n,o,l,u,h){rh.fromBufferAttribute(t,a),ih.fromBufferAttribute(t,n),sh.fromBufferAttribute(t,o);let d=Xse(e,rh,ih,sh,Mm,l,u,h);if(d){if(i){p1.fromBufferAttribute(i,a),m1.fromBufferAttribute(i,n),f1.fromBufferAttribute(i,o),d.uv=new fe;let m=$i.getInterpolation(Mm,rh,ih,sh,p1,m1,f1,d.uv);c1||(d.uv=m)}if(s){p1.fromBufferAttribute(s,a),m1.fromBufferAttribute(s,n),f1.fromBufferAttribute(s,o),d.uv1=new fe;let m=$i.getInterpolation(Mm,rh,ih,sh,p1,m1,f1,d.uv1);c1||(d.uv1=m),Hse&&(d.uv2=d.uv1)}if(r){n5.fromBufferAttribute(r,a),o5.fromBufferAttribute(r,n),l5.fromBufferAttribute(r,o),d.normal=new F;let m=$i.getInterpolation(Mm,rh,ih,sh,n5,o5,l5,d.normal);d.normal.dot(e.direction)>0&&d.normal.multiplyScalar(-1),c1||(d.normal=m)}let c={a,b:n,c:o,normal:new F,materialIndex:0};if($i.getNormal(rh,ih,sh,c.normal),d.face=c,d.faceIndex=a,c1){let m=new F;$i.getBarycoord(Mm,rh,ih,sh,m),d.barycoord=m}}return d}function h5(e){return e&&e.isMaterial?e.side:e}function g1(e,t,r,i,s,a,n){let o=i*3,l=o+0,u=o+1,h=o+2,{index:d,groups:c}=e;e.index&&(l=d.getX(l),u=d.getX(u),h=d.getX(h));let{position:m,normal:g,uv:y,uv1:b}=e.attributes;if(Array.isArray(t)){let v=i*3;for(let S=0,T=c.length;S\\u003cT;S++){let{start:w,count:N,materialIndex:C}=c[S];if(v>=w&&v\\u003cw+N){let R=h5(t[C]),E=u5(r,m,g,y,b,l,u,h,R,a,n);if(E)if(E.faceIndex=i,E.face.materialIndex=C,s)s.push(E);else return E}}}else{let v=h5(t),S=u5(r,m,g,y,b,l,u,h,v,a,n);if(S)if(S.faceIndex=i,S.face.materialIndex=0,s)s.push(S);else return S}return null}function ui(e,t,r,i){let s=e.a,a=e.b,n=e.c,o=t,l=t+1,u=t+2;r&&(o=r.getX(o),l=r.getX(l),u=r.getX(u)),s.x=i.getX(o),s.y=i.getY(o),s.z=i.getZ(o),a.x=i.getX(l),a.y=i.getY(l),a.z=i.getZ(l),n.x=i.getX(u),n.y=i.getY(u),n.z=i.getZ(u)}function $se(e,t,r,i,s,a,n,o){let{geometry:l,_indirectBuffer:u}=e;for(let h=i,d=i+s;h\\u003cd;h++)g1(l,t,r,h,a,n,o)}function qse(e,t,r,i,s,a,n){let{geometry:o,_indirectBuffer:l}=e,u=1/0,h=null;for(let d=i,c=i+s;d\\u003cc;d++){let m;m=g1(o,t,r,d,null,a,n),m&&m.distance\\u003cu&&(h=m,u=m.distance)}return h}function Yse(e,t,r,i,s,a,n){let{geometry:o}=r,{index:l}=o,u=o.attributes.position;for(let h=e,d=t+e;h\\u003cd;h++){let c;if(c=h,ui(n,c*3,l,u),n.needsUpdate=!0,i(n,c,s,a))return!0}return!1}function Zse(e,t=null){t&&Array.isArray(t)&&(t=new Set(t));let r=e.geometry,i=r.index?r.index.array:null,s=r.attributes.position,a,n,o,l,u=0,h=e._roots;for(let c=0,m=h.length;c\\u003cm;c++)a=h[c],n=new Uint32Array(a),o=new Uint16Array(a),l=new Float32Array(a),d(0,u),u+=a.byteLength;function d(c,m,g=!1){let y=c*2;if(Cr(y,o)){let b=Ei(c,n),v=as(y,o),S=1/0,T=1/0,w=1/0,N=-1/0,C=-1/0,R=-1/0;for(let E=3*b,P=3*(b+v);E\\u003cP;E++){let I=i[E],O=s.getX(I),L=s.getY(I),X=s.getZ(I);O\\u003cS&&(S=O),O>N&&(N=O),L\\u003cT&&(T=L),L>C&&(C=L),X\\u003cw&&(w=X),X>R&&(R=X)}return l[c+0]!==S||l[c+1]!==T||l[c+2]!==w||l[c+3]!==N||l[c+4]!==C||l[c+5]!==R?(l[c+0]=S,l[c+1]=T,l[c+2]=w,l[c+3]=N,l[c+4]=C,l[c+5]=R,!0):!1}else{let b=oi(c),v=li(c,n),S=g,T=!1,w=!1;if(t){if(!S){let I=b/8+m/32,O=v/8+m/32;T=t.has(I),w=t.has(O),S=!T&&!w}}else T=!0,w=!0;let N=S||T,C=S||w,R=!1;N&&(R=d(b,m,S));let E=!1;C&&(E=d(v,m,S));let P=R||E;if(P)for(let I=0;I\\u003c3;I++){let O=b+I,L=v+I,X=l[O],z=l[O+3],H=l[L],ue=l[L+3];l[c+I]=X\\u003cH?X:H,l[c+I+3]=z>ue?z:ue}return P}}}function Hl(e,t,r,i,s){let a,n,o,l,u,h,d=1/r.direction.x,c=1/r.direction.y,m=1/r.direction.z,g=r.origin.x,y=r.origin.y,b=r.origin.z,v=t[e],S=t[e+3],T=t[e+1],w=t[e+3+1],N=t[e+2],C=t[e+3+2];return d>=0?(a=(v-g)*d,n=(S-g)*d):(a=(S-g)*d,n=(v-g)*d),c>=0?(o=(T-y)*c,l=(w-y)*c):(o=(w-y)*c,l=(T-y)*c),a>l||o>n||((o>a||isNaN(a))&&(a=o),(l\\u003cn||isNaN(n))&&(n=l),m>=0?(u=(N-b)*m,h=(C-b)*m):(u=(C-b)*m,h=(N-b)*m),a>h||u>n)?!1:((u>a||a!==a)&&(a=u),(h\\u003cn||n!==n)&&(n=h),a\\u003c=s&&n>=i)}function Jse(e,t,r,i,s,a,n,o){let{geometry:l,_indirectBuffer:u}=e;for(let h=i,d=i+s;h\\u003cd;h++){let c=u?u[h]:h;g1(l,t,r,c,a,n,o)}}function Qse(e,t,r,i,s,a,n){let{geometry:o,_indirectBuffer:l}=e,u=1/0,h=null;for(let d=i,c=i+s;d\\u003cc;d++){let m;m=g1(o,t,r,l?l[d]:d,null,a,n),m&&m.distance\\u003cu&&(h=m,u=m.distance)}return h}function Kse(e,t,r,i,s,a,n){let{geometry:o}=r,{index:l}=o,u=o.attributes.position;for(let h=e,d=t+e;h\\u003cd;h++){let c;if(c=r.resolveTriangleIndex(h),ui(n,c*3,l,u),n.needsUpdate=!0,i(n,c,s,a))return!0}return!1}function eae(e,t,r,i,s,a,n){Rr.setBuffer(e._roots[t]),q_(0,e,r,i,s,a,n),Rr.clearBuffer()}function q_(e,t,r,i,s,a,n){let{float32Array:o,uint16Array:l,uint32Array:u}=Rr,h=e*2;if(Cr(h,l)){let d=Ei(e,u),c=as(h,l);$se(t,r,i,d,c,s,a,n)}else{let d=oi(e);Hl(d,o,i,a,n)&&q_(d,t,r,i,s,a,n);let c=li(e,u);Hl(c,o,i,a,n)&&q_(c,t,r,i,s,a,n)}}var tae=[\\\"x\\\",\\\"y\\\",\\\"z\\\"];function rae(e,t,r,i,s,a){Rr.setBuffer(e._roots[t]);let n=Y_(0,e,r,i,s,a);return Rr.clearBuffer(),n}function Y_(e,t,r,i,s,a){let{float32Array:n,uint16Array:o,uint32Array:l}=Rr,u=e*2;if(Cr(u,o)){let h=Ei(e,l),d=as(u,o);return qse(t,r,i,h,d,s,a)}else{let h=F_(e,l),d=tae[h],c=i.direction[d]>=0,m,g;c?(m=oi(e),g=li(e,l)):(m=li(e,l),g=oi(e));let y=Hl(m,n,i,s,a)?Y_(m,t,r,i,s,a):null;if(y){let v=y.point[d];if(c?v\\u003c=n[g+h]:v>=n[g+h+3])return y}let b=Hl(g,n,i,s,a)?Y_(g,t,r,i,s,a):null;return y&&b?y.distance\\u003c=b.distance?y:b:y||b||null}}var y1=new qi,sc=new Ra,ac=new Ra,Nm=new We,d5=new Ms,x1=new Ms;function iae(e,t,r,i){Rr.setBuffer(e._roots[t]);let s=Z_(0,e,r,i);return Rr.clearBuffer(),s}function Z_(e,t,r,i,s=null){let{float32Array:a,uint16Array:n,uint32Array:o}=Rr,l=e*2;if(s===null&&(r.boundingBox||r.computeBoundingBox(),d5.set(r.boundingBox.min,r.boundingBox.max,i),s=d5),Cr(l,n)){let u=t.geometry,h=u.index,d=u.attributes.position,c=r.index,m=r.attributes.position,g=Ei(e,o),y=as(l,n);if(Nm.copy(i).invert(),r.boundsTree)return Ur(e,a,x1),x1.matrix.copy(Nm),x1.needsUpdate=!0,r.boundsTree.shapecast({intersectsBounds:b=>x1.intersectsBox(b),intersectsTriangle:b=>{b.a.applyMatrix4(i),b.b.applyMatrix4(i),b.c.applyMatrix4(i),b.needsUpdate=!0;for(let v=g*3,S=(y+g)*3;v\\u003cS;v+=3)if(ui(ac,v,h,d),ac.needsUpdate=!0,b.intersectsTriangle(ac))return!0;return!1}});{let b=h1(r);for(let v=g*3,S=(y+g)*3;v\\u003cS;v+=3){ui(sc,v,h,d),sc.a.applyMatrix4(Nm),sc.b.applyMatrix4(Nm),sc.c.applyMatrix4(Nm),sc.needsUpdate=!0;for(let T=0,w=b*3;T\\u003cw;T+=3)if(ui(ac,T,c,m),ac.needsUpdate=!0,sc.intersectsTriangle(ac))return!0}}}else{let u=oi(e),h=li(e,o);return Ur(u,a,y1),!!(s.intersectsBox(y1)&&Z_(u,t,r,i,s)||(Ur(h,a,y1),s.intersectsBox(y1)&&Z_(h,t,r,i,s)))}}var v1=new We,J_=new Ms,Am=new Ms,sae=new F,aae=new F,nae=new F,oae=new F;function lae(e,t,r,i={},s={},a=0,n=1/0){t.boundingBox||t.computeBoundingBox(),J_.set(t.boundingBox.min,t.boundingBox.max,r),J_.needsUpdate=!0;let o=e.geometry,l=o.attributes.position,u=o.index,h=t.attributes.position,d=t.index,c=Ea.getPrimitive(),m=Ea.getPrimitive(),g=sae,y=aae,b=null,v=null;s&&(b=nae,v=oae);let S=1/0,T=null,w=null;return v1.copy(r).invert(),Am.matrix.copy(v1),e.shapecast({boundsTraverseOrder:N=>J_.distanceToBox(N),intersectsBounds:(N,C,R)=>R\\u003cS&&R\\u003cn?(C&&(Am.min.copy(N.min),Am.max.copy(N.max),Am.needsUpdate=!0),!0):!1,intersectsRange:(N,C)=>{if(t.boundsTree)return t.boundsTree.shapecast({boundsTraverseOrder:R=>Am.distanceToBox(R),intersectsBounds:(R,E,P)=>P\\u003cS&&P\\u003cn,intersectsRange:(R,E)=>{for(let P=R,I=R+E;P\\u003cI;P++){ui(m,3*P,d,h),m.a.applyMatrix4(r),m.b.applyMatrix4(r),m.c.applyMatrix4(r),m.needsUpdate=!0;for(let O=N,L=N+C;O\\u003cL;O++){ui(c,3*O,u,l),c.needsUpdate=!0;let X=c.distanceToTriangle(m,g,b);if(X\\u003cS&&(y.copy(g),v&&v.copy(b),S=X,T=O,w=P),X\\u003ca)return!0}}}});{let R=h1(t);for(let E=0,P=R;E\\u003cP;E++){ui(m,3*E,d,h),m.a.applyMatrix4(r),m.b.applyMatrix4(r),m.c.applyMatrix4(r),m.needsUpdate=!0;for(let I=N,O=N+C;I\\u003cO;I++){ui(c,3*I,u,l),c.needsUpdate=!0;let L=c.distanceToTriangle(m,g,b);if(L\\u003cS&&(y.copy(g),v&&v.copy(b),S=L,T=I,w=E),L\\u003ca)return!0}}}}}),Ea.releasePrimitive(c),Ea.releasePrimitive(m),S===1/0?null:(i.point?i.point.copy(y):i.point=y.clone(),i.distance=S,i.faceIndex=T,s&&(s.point?s.point.copy(v):s.point=v.clone(),s.point.applyMatrix4(v1),y.applyMatrix4(v1),s.distance=y.sub(s.point).length(),s.faceIndex=w),i)}function uae(e,t=null){t&&Array.isArray(t)&&(t=new Set(t));let r=e.geometry,i=r.index?r.index.array:null,s=r.attributes.position,a,n,o,l,u=0,h=e._roots;for(let c=0,m=h.length;c\\u003cm;c++)a=h[c],n=new Uint32Array(a),o=new Uint16Array(a),l=new Float32Array(a),d(0,u),u+=a.byteLength;function d(c,m,g=!1){let y=c*2;if(Cr(y,o)){let b=Ei(c,n),v=as(y,o),S=1/0,T=1/0,w=1/0,N=-1/0,C=-1/0,R=-1/0;for(let E=b,P=b+v;E\\u003cP;E++){let I=3*e.resolveTriangleIndex(E);for(let O=0;O\\u003c3;O++){let L=I+O;L=i?i[L]:L;let X=s.getX(L),z=s.getY(L),H=s.getZ(L);X\\u003cS&&(S=X),X>N&&(N=X),z\\u003cT&&(T=z),z>C&&(C=z),H\\u003cw&&(w=H),H>R&&(R=H)}}return l[c+0]!==S||l[c+1]!==T||l[c+2]!==w||l[c+3]!==N||l[c+4]!==C||l[c+5]!==R?(l[c+0]=S,l[c+1]=T,l[c+2]=w,l[c+3]=N,l[c+4]=C,l[c+5]=R,!0):!1}else{let b=oi(c),v=li(c,n),S=g,T=!1,w=!1;if(t){if(!S){let I=b/8+m/32,O=v/8+m/32;T=t.has(I),w=t.has(O),S=!T&&!w}}else T=!0,w=!0;let N=S||T,C=S||w,R=!1;N&&(R=d(b,m,S));let E=!1;C&&(E=d(v,m,S));let P=R||E;if(P)for(let I=0;I\\u003c3;I++){let O=b+I,L=v+I,X=l[O],z=l[O+3],H=l[L],ue=l[L+3];l[c+I]=X\\u003cH?X:H,l[c+I+3]=z>ue?z:ue}return P}}}function hae(e,t,r,i,s,a,n){Rr.setBuffer(e._roots[t]),Q_(0,e,r,i,s,a,n),Rr.clearBuffer()}function Q_(e,t,r,i,s,a,n){let{float32Array:o,uint16Array:l,uint32Array:u}=Rr,h=e*2;if(Cr(h,l)){let d=Ei(e,u),c=as(h,l);Jse(t,r,i,d,c,s,a,n)}else{let d=oi(e);Hl(d,o,i,a,n)&&Q_(d,t,r,i,s,a,n);let c=li(e,u);Hl(c,o,i,a,n)&&Q_(c,t,r,i,s,a,n)}}var dae=[\\\"x\\\",\\\"y\\\",\\\"z\\\"];function cae(e,t,r,i,s,a){Rr.setBuffer(e._roots[t]);let n=K_(0,e,r,i,s,a);return Rr.clearBuffer(),n}function K_(e,t,r,i,s,a){let{float32Array:n,uint16Array:o,uint32Array:l}=Rr,u=e*2;if(Cr(u,o)){let h=Ei(e,l),d=as(u,o);return Qse(t,r,i,h,d,s,a)}else{let h=F_(e,l),d=dae[h],c=i.direction[d]>=0,m,g;c?(m=oi(e),g=li(e,l)):(m=li(e,l),g=oi(e));let y=Hl(m,n,i,s,a)?K_(m,t,r,i,s,a):null;if(y){let v=y.point[d];if(c?v\\u003c=n[g+h]:v>=n[g+h+3])return y}let b=Hl(g,n,i,s,a)?K_(g,t,r,i,s,a):null;return y&&b?y.distance\\u003c=b.distance?y:b:y||b||null}}var b1=new qi,nc=new Ra,oc=new Ra,Cm=new We,c5=new Ms,T1=new Ms;function pae(e,t,r,i){Rr.setBuffer(e._roots[t]);let s=ew(0,e,r,i);return Rr.clearBuffer(),s}function ew(e,t,r,i,s=null){let{float32Array:a,uint16Array:n,uint32Array:o}=Rr,l=e*2;if(s===null&&(r.boundingBox||r.computeBoundingBox(),c5.set(r.boundingBox.min,r.boundingBox.max,i),s=c5),Cr(l,n)){let u=t.geometry,h=u.index,d=u.attributes.position,c=r.index,m=r.attributes.position,g=Ei(e,o),y=as(l,n);if(Cm.copy(i).invert(),r.boundsTree)return Ur(e,a,T1),T1.matrix.copy(Cm),T1.needsUpdate=!0,r.boundsTree.shapecast({intersectsBounds:b=>T1.intersectsBox(b),intersectsTriangle:b=>{b.a.applyMatrix4(i),b.b.applyMatrix4(i),b.c.applyMatrix4(i),b.needsUpdate=!0;for(let v=g,S=y+g;v\\u003cS;v++)if(ui(oc,3*t.resolveTriangleIndex(v),h,d),oc.needsUpdate=!0,b.intersectsTriangle(oc))return!0;return!1}});{let b=h1(r);for(let v=g,S=y+g;v\\u003cS;v++){let T=t.resolveTriangleIndex(v);ui(nc,3*T,h,d),nc.a.applyMatrix4(Cm),nc.b.applyMatrix4(Cm),nc.c.applyMatrix4(Cm),nc.needsUpdate=!0;for(let w=0,N=b*3;w\\u003cN;w+=3)if(ui(oc,w,c,m),oc.needsUpdate=!0,nc.intersectsTriangle(oc))return!0}}}else{let u=oi(e),h=li(e,o);return Ur(u,a,b1),!!(s.intersectsBox(b1)&&ew(u,t,r,i,s)||(Ur(h,a,b1),s.intersectsBox(b1)&&ew(h,t,r,i,s)))}}var S1=new We,tw=new Ms,Rm=new Ms,mae=new F,fae=new F,gae=new F,yae=new F;function xae(e,t,r,i={},s={},a=0,n=1/0){t.boundingBox||t.computeBoundingBox(),tw.set(t.boundingBox.min,t.boundingBox.max,r),tw.needsUpdate=!0;let o=e.geometry,l=o.attributes.position,u=o.index,h=t.attributes.position,d=t.index,c=Ea.getPrimitive(),m=Ea.getPrimitive(),g=mae,y=fae,b=null,v=null;s&&(b=gae,v=yae);let S=1/0,T=null,w=null;return S1.copy(r).invert(),Rm.matrix.copy(S1),e.shapecast({boundsTraverseOrder:N=>tw.distanceToBox(N),intersectsBounds:(N,C,R)=>R\\u003cS&&R\\u003cn?(C&&(Rm.min.copy(N.min),Rm.max.copy(N.max),Rm.needsUpdate=!0),!0):!1,intersectsRange:(N,C)=>{if(t.boundsTree){let R=t.boundsTree;return R.shapecast({boundsTraverseOrder:E=>Rm.distanceToBox(E),intersectsBounds:(E,P,I)=>I\\u003cS&&I\\u003cn,intersectsRange:(E,P)=>{for(let I=E,O=E+P;I\\u003cO;I++){let L=R.resolveTriangleIndex(I);ui(m,3*L,d,h),m.a.applyMatrix4(r),m.b.applyMatrix4(r),m.c.applyMatrix4(r),m.needsUpdate=!0;for(let X=N,z=N+C;X\\u003cz;X++){let H=e.resolveTriangleIndex(X);ui(c,3*H,u,l),c.needsUpdate=!0;let ue=c.distanceToTriangle(m,g,b);if(ue\\u003cS&&(y.copy(g),v&&v.copy(b),S=ue,T=X,w=I),ue\\u003ca)return!0}}}})}else{let R=h1(t);for(let E=0,P=R;E\\u003cP;E++){ui(m,3*E,d,h),m.a.applyMatrix4(r),m.b.applyMatrix4(r),m.c.applyMatrix4(r),m.needsUpdate=!0;for(let I=N,O=N+C;I\\u003cO;I++){let L=e.resolveTriangleIndex(I);ui(c,3*L,u,l),c.needsUpdate=!0;let X=c.distanceToTriangle(m,g,b);if(X\\u003cS&&(y.copy(g),v&&v.copy(b),S=X,T=I,w=E),X\\u003ca)return!0}}}}}),Ea.releasePrimitive(c),Ea.releasePrimitive(m),S===1/0?null:(i.point?i.point.copy(y):i.point=y.clone(),i.distance=S,i.faceIndex=T,s&&(s.point?s.point.copy(v):s.point=v.clone(),s.point.applyMatrix4(S1),y.applyMatrix4(S1),s.distance=y.sub(s.point).length(),s.faceIndex=w),i)}function p5(e,t,r){return e===null?null:(e.point.applyMatrix4(t.matrixWorld),e.distance=e.point.distanceTo(r.ray.origin),e.object=t,e)}var _1=new Ms,w1=new ld,m5=new F,f5=new We,g5=new F,rw=[\\\"getX\\\",\\\"getY\\\",\\\"getZ\\\"],M1=class hM extends d1{static serialize(t,r={}){r={cloneBuffers:!0,...r};let i=t.geometry,s=t._roots,a=t._indirectBuffer,n=i.getIndex(),o={version:1,roots:null,index:null,indirectBuffer:null};return r.cloneBuffers?(o.roots=s.map(l=>l.slice()),o.index=n?n.array.slice():null,o.indirectBuffer=a?a.slice():null):(o.roots=s,o.index=n?n.array:null,o.indirectBuffer=a),o}static deserialize(t,r,i={}){i={setIndex:!0,indirect:!!t.indirectBuffer,...i};let{index:s,roots:a,indirectBuffer:n}=t;t.version||(console.warn(\\\"MeshBVH.deserialize: Serialization format has been changed and will be fixed up. It is recommended to regenerate any stored serialized data.\\\"),l(a));let o=new hM(r,{...i,[Tm]:!0});if(o._roots=a,o._indirectBuffer=n||null,i.setIndex){let u=r.getIndex();if(u===null){let h=new _i(t.index,1,!1);r.setIndex(h)}else u.array!==s&&(u.array.set(s),u.needsUpdate=!0)}return o;function l(u){for(let h=0;h\\u003cu.length;h++){let d=u[h],c=new Uint32Array(d),m=new Uint16Array(d);for(let g=0,y=d.byteLength/32;g\\u003cy;g++){let b=8*g,v=2*b;Cr(v,m)||(c[b+6]=c[b+6]/8-g)}}}}get primitiveStride(){return 3}get resolveTriangleIndex(){return this.resolvePrimitiveIndex}constructor(t,r={}){r.maxLeafTris&&(console.warn('MeshBVH: \\\"maxLeafTris\\\" option has been deprecated. Use \\\"targetLeafSize\\\", instead.'),r={...r,targetLeafSize:r.maxLeafTris}),super(t,r)}shiftTriangleOffsets(t){return super.shiftPrimitiveOffsets(t)}writePrimitiveBounds(t,r,i){let s=this.geometry,a=this._indirectBuffer,n=s.attributes.position,o=s.index?s.index.array:null,l=(a?a[t]:t)*3,u=l+0,h=l+1,d=l+2;o&&(u=o[u],h=o[h],d=o[d]);for(let c=0;c\\u003c3;c++){let m=n[rw[c]](u),g=n[rw[c]](h),y=n[rw[c]](d),b=m;g\\u003cb&&(b=g),y\\u003cb&&(b=y);let v=m;g>v&&(v=g),y>v&&(v=y),r[i+c]=b,r[i+c+3]=v}return r}computePrimitiveBounds(t,r,i){let s=this.geometry,a=this._indirectBuffer,n=s.attributes.position,o=s.index?s.index.array:null,l=n.normalized;if(t\\u003c0||r+t-i.offset>i.length/6)throw new Error(\\\"MeshBVH: compute triangle bounds range is invalid.\\\");let u=n.array,h=n.offset||0,d=3;n.isInterleavedBufferAttribute&&(d=n.data.stride);let c=[\\\"getX\\\",\\\"getY\\\",\\\"getZ\\\"],m=i.offset;for(let g=t,y=t+r;g\\u003cy;g++){let b=(a?a[g]:g)*3,v=(g-m)*6,S=b+0,T=b+1,w=b+2;o&&(S=o[S],T=o[T],w=o[w]),l||(S=S*d+h,T=T*d+h,w=w*d+h);for(let N=0;N\\u003c3;N++){let C,R,E;l?(C=n[c[N]](S),R=n[c[N]](T),E=n[c[N]](w)):(C=u[S+N],R=u[T+N],E=u[w+N]);let P=C;R\\u003cP&&(P=R),E\\u003cP&&(P=E);let I=C;R>I&&(I=R),E>I&&(I=E);let O=(I-P)/2,L=N*2;i[v+L+0]=P+O,i[v+L+1]=O+(Math.abs(P)+O)*s1}}return i}raycastObject3D(t,r,i=[]){let{material:s}=t;if(s===void 0)return;f5.copy(t.matrixWorld).invert(),w1.copy(r.ray).applyMatrix4(f5),g5.setFromMatrixScale(t.matrixWorld),m5.copy(w1.direction).multiply(g5);let a=m5.length(),n=r.near/a,o=r.far/a;if(r.firstHitOnly===!0){let l=this.raycastFirst(w1,s,n,o);l=p5(l,t,r),l&&i.push(l)}else{let l=this.raycast(w1,s,n,o);for(let u=0,h=l.length;u\\u003ch;u++){let d=p5(l[u],t,r);d&&i.push(d)}}return i}refit(t=null){return(this.indirect?uae:Zse)(this,t)}raycast(t,r=Cs,i=0,s=1/0){let a=this._roots,n=[],o=this.indirect?hae:eae;for(let l=0,u=a.length;l\\u003cu;l++)o(this,l,r,t,n,i,s);return n}raycastFirst(t,r=Cs,i=0,s=1/0){let a=this._roots,n=null,o=this.indirect?cae:rae;for(let l=0,u=a.length;l\\u003cu;l++){let h=o(this,l,r,t,i,s);h!=null&&(n==null||h.distance\\u003cn.distance)&&(n=h)}return n}intersectsGeometry(t,r){let i=!1,s=this._roots,a=this.indirect?pae:iae;for(let n=0,o=s.length;n\\u003co&&(i=a(this,n,t,r),!i);n++);return i}shapecast(t){let r=Ea.getPrimitive(),i=super.shapecast({...t,intersectsPrimitive:t.intersectsTriangle,scratchPrimitive:r,iterate:this.indirect?Kse:Yse});return Ea.releasePrimitive(r),i}bvhcast(t,r,i){let{intersectsRanges:s,intersectsTriangles:a}=i,n=Ea.getPrimitive(),o=this.geometry.index,l=this.geometry.attributes.position,u=this.indirect?g=>{let y=this.resolveTriangleIndex(g);ui(n,y*3,o,l)}:g=>{ui(n,g*3,o,l)},h=Ea.getPrimitive(),d=t.geometry.index,c=t.geometry.attributes.position,m=t.indirect?g=>{let y=t.resolveTriangleIndex(g);ui(h,y*3,d,c)}:g=>{ui(h,g*3,d,c)};if(a){if(!(t instanceof hM))throw new Error('MeshBVH: \\\"intersectsTriangles\\\" callback can only be used with another MeshBVH.');let g=(y,b,v,S,T,w,N,C)=>{for(let R=v,E=v+S;R\\u003cE;R++){m(R),h.a.applyMatrix4(r),h.b.applyMatrix4(r),h.c.applyMatrix4(r),h.needsUpdate=!0;for(let P=y,I=y+b;P\\u003cI;P++)if(u(P),n.needsUpdate=!0,a(n,h,P,R,T,w,N,C))return!0}return!1};if(s){let y=s;s=function(b,v,S,T,w,N,C,R){return y(b,v,S,T,w,N,C,R)?!0:g(b,v,S,T,w,N,C,R)}}else s=g}return super.bvhcast(t,r,{intersectsRanges:s})}intersectsBox(t,r){return _1.set(t.min,t.max,r),_1.needsUpdate=!0,this.shapecast({intersectsBounds:i=>_1.intersectsBox(i),intersectsTriangle:i=>_1.intersectsTriangle(i)})}intersectsSphere(t){return this.shapecast({intersectsBounds:r=>t.intersectsBox(r),intersectsTriangle:r=>r.intersectsSphere(t)})}closestPointToGeometry(t,r,i={},s={},a=0,n=1/0){return(this.indirect?xae:lae)(this,t,r,i,s,a,n)}closestPointToPoint(t,r={},i=0,s=1/0){return jse(this,t,r,i,s)}},y5=new F,x5=new F,v5=new F,Do=new ld,b5=new We,ah=new F,iw=new F,vae=[\\\"x\\\",\\\"y\\\",\\\"z\\\"],N1=parseInt(\\\"185\\\")>=169,bae=parseInt(\\\"185\\\")\\u003c=161,A1=new fe,C1=new fe,R1=new fe,T5=new F,S5=new F,_5=new F,Tae=class extends d1{get primitiveStride(){return 3}constructor(e,t={}){if(!e.isMesh)throw new Error(\\\"SkinnedMeshBVH: First argument must be a Mesh.\\\");super(e.geometry,{...t,[Tm]:!0}),this.mesh=e,t[Tm]||this.init(t)}writePrimitiveBounds(e,t,r){let{mesh:i,geometry:s}=this,a=this._indirectBuffer,n=s.index?s.index.array:null,o=(a?a[e]:e)*3,l=o+0,u=o+1,h=o+2;n&&(l=n[l],u=n[u],h=n[h]),i.getVertexPosition(l,y5),i.getVertexPosition(u,x5),i.getVertexPosition(h,v5);for(let d=0;d\\u003c3;d++){let c=vae[d],m=y5[c],g=x5[c],y=v5[c],b=m;g\\u003cb&&(b=g),y\\u003cb&&(b=y);let v=m;g>v&&(v=g),y>v&&(v=y),t[r+d]=b,t[r+d+3]=v}return t}shapecast(e){let t=new Ra;return super.shapecast({...e,intersectsPrimitive:e.intersectsTriangle,scratchPrimitive:t,iterate:Sae})}raycastObject3D(e,t,r=[]){let{material:i}=e;if(i===void 0)return;let{matrixWorld:s}=e,{firstHitOnly:a}=t;b5.copy(s).invert(),Do.copy(t.ray).applyMatrix4(b5);let n=null,o=1/0;return this.shapecast({boundsTraverseOrder:l=>l.distanceToPoint(Do.origin),intersectsBounds:l=>{if(a){if(!Do.intersectBox(l,iw))return 0;let u;return l.containsPoint(Do.origin)?u=0:(iw.applyMatrix4(s),u=t.ray.origin.distanceTo(iw)),u\\u003co?1:0}else return Do.intersectsBox(l)?1:0},intersectsTriangle:(l,u)=>{let h=null;if(i.side===Cs?h=Do.intersectTriangle(l.a,l.b,l.c,!0,ah):i.side===ii?h=Do.intersectTriangle(l.c,l.b,l.a,!0,ah):h=Do.intersectTriangle(l.a,l.b,l.c,!1,ah),!h)return;h=h.clone().applyMatrix4(s);let d=t.ray.origin.distanceTo(h);if(d>=t.near&&d\\u003c=t.far){if(a&&d>=o)return;let{geometry:c}=this,{index:m}=c,g=this.resolvePrimitiveIndex(u),y=g*3,b=y+0,v=y+1,S=y+2;m&&(b=m.array[b],v=m.array[v],S=m.array[S]);let T={distance:d,point:h.clone(),object:e,uv:null,uv1:null,normal:null,face:{a:b,b:v,c:S,normal:$i.getNormal(l.a,l.b,l.c,new F),materialIndex:0},faceIndex:g};if(N1){let R=new F;$i.getBarycoord(ah,l.a,l.b,l.c,R),T.barycoord=R}let w=c.attributes.uv,N=c.attributes.uv1,C=c.attributes.normal;if(w){A1.fromBufferAttribute(w,b),C1.fromBufferAttribute(w,v),R1.fromBufferAttribute(w,S),T.uv=new fe;let R=$i.getInterpolation(ah,l.a,l.b,l.c,A1,C1,R1,T.uv);N1||(T.uv=R)}if(N){A1.fromBufferAttribute(N,b),C1.fromBufferAttribute(N,v),R1.fromBufferAttribute(N,S),T.uv1=new fe;let R=$i.getInterpolation(ah,l.a,l.b,l.c,A1,C1,R1,T.uv1);N1||(T.uv1=R),bae&&(T.uv2=T.uv1)}if(C){T5.fromBufferAttribute(C,b),S5.fromBufferAttribute(C,v),_5.fromBufferAttribute(C,S),T.normal=new F;let R=$i.getInterpolation(ah,l.a,l.b,l.c,T5,S5,_5,T.normal);T.normal.dot(Do.direction)>0&&T.normal.multiplyScalar(-1),N1||(T.normal=R)}o=T.distance,n=T,a||r.push(T)}}}),a&&n&&r.push(n),r}};function Sae(e,t,r,i,s,a,n){let{mesh:o,geometry:l}=r,u=l.index?l.index.array:null;for(let h=e,d=t+e;h\\u003cd;h++){let c=r.resolvePrimitiveIndex(h),m=3*c+0,g=3*c+1,y=3*c+2;if(u&&(m=u[m],g=u[g],y=u[y]),o.getVertexPosition(m,n.a),o.getVertexPosition(g,n.b),o.getVertexPosition(y,n.c),n.needsUpdate=!0,i(n,h,s,a))return!0}return!1}var E1=new Cl({min:\\\"array\\u003cf32, 3>\\\",max:\\\"array\\u003cf32, 3>\\\"},\\\"BVHBoundingBox\\\");E1.getLength=()=>6;var P1=new Cl({bounds:\\\"BVHBoundingBox\\\",rightChildOrTriangleOffset:\\\"uint\\\",splitAxisOrTriangleCount:\\\"uint\\\"},\\\"BVHNode\\\");P1.getLength=()=>E1.getLength()+2;var _ae=new Cl({matrixWorld:\\\"mat4x4f\\\",inverseMatrixWorld:\\\"mat4x4f\\\",visible:\\\"uint\\\",_alignment0:\\\"uint\\\",_alignment1:\\\"uint\\\",_alignment2:\\\"uint\\\"},\\\"TransformStruct\\\"),Xl=new Cl({origin:\\\"vec3f\\\",direction:\\\"vec3f\\\"},\\\"Ray\\\"),lc=new Cl({indices:\\\"vec4u\\\",normal:\\\"vec3f\\\",didHit:\\\"bool\\\",barycoord:\\\"vec3f\\\",objectIndex:\\\"uint\\\",side:\\\"float\\\",dist:\\\"float\\\"},\\\"IntersectionResult\\\"),Em=new Cl({faceIndices:\\\"vec4u\\\",closestPoint:\\\"vec3f\\\",found:\\\"bool\\\",barycoord:\\\"vec3f\\\",objectIndex:\\\"uint\\\",faceNormal:\\\"vec3f\\\",side:\\\"float\\\",distanceSq:\\\"float\\\"},\\\"PointQueryResult\\\"),wae=class extends Ke{static get type(){return\\\"ProxyCallNode\\\"}constructor(e,t){super(),this.proxyNode=e,this.params=t}setup(){return this.proxyNode.proxyNode.call(...this.params)}},w5=class{get isNode(){return!0}get proxyNode(){let{proxyObject:e,proxyProperty:t}=this,r=t.split(\\\".\\\"),i=e;for(let s=0,a=r.length;s\\u003ca;s++)i=i?.[r[s]];return i&&\\\"functionNode\\\"in i?i.functionNode:i??null}constructor(e,t=null){return this.proxyObject=t,this.proxyProperty=e,new Proxy(this,{get(r,i){if(i in r)return Reflect.get(r,i);{let s=r.proxyNode;if(!s)return;let a=Reflect.get(s,i);return typeof a==\\\"function\\\"?a.bind(s):a}},set(r,i,s){if(i in r)return Reflect.set(r,i,s);throw new Error(\\\"NodeProxy: Cannot set members of proxied nodes.\\\")}})}},Mae=(...e)=>new w5(...e),Nae=(...e)=>{let t=new w5(...e),r=(...i)=>new wae(t,i);return M.nodeProxyConstructor(r,t)},$l=new Wt,zn=new Wt;function Aae(e,t){let r=e?e.array:null,i=new Uint32Array(t.length*3);for(let s=0,a=t.length;s\\u003ca;s++){let n=3*s,o=3*t[s];for(let l=0;l\\u003c3;l++)i[n+l]=r?r[o+l]:o+l}return i}function M5(e,t,r,i){let s=new Uint32Array(i),a=new Float32Array(i);e._roots.forEach(n=>{let o=new Uint16Array(n),l=new Uint32Array(n);for(let u=0,h=n.byteLength/32;u\\u003ch;u++){let d=u*8,c=d*2,m=r*8,g=new Float32Array(n,u*32,6);if(u===0)for(let y=0;y\\u003c3;y++){let b=g[y+0],v=g[y+3];b>v?(a[m+y+0]=1,a[m+y+3]=-1):(a[m+y+0]=b,a[m+y+3]=v)}else a.set(g,m);if(t===null){r++;continue}if(Cr(c,o)){let y=l[d+6],b=o[c+14],{transformSlot:v,nodeOffset:S}=b===0?{transformSlot:0,nodeOffset:0}:t[y];if(v>16777215)throw new Error(`packBVHBufferUtils: transform slot ${v} exceeds the 24-bit TLAS leaf limit.`);s[m+6]=S,s[m+7]=4278190080|v&16777215}else s[m+6]=l[d+6],s[m+7]=l[d+7];r++}})}function Cae(e,t){return N5(new Uint16Array(e),new Uint32Array(e),t)}function N5(e,t,r){if(Cr(r*8*2,e))return 1;let i=t[r*8+6];return i+N5(e,t,r+i)}function A5(e,t=0){let r=new Uint16Array(e),i=new Uint32Array(e),s=0;return a(t*8,1),s;function a(n,o){let l=n,u=n*2;if(Cr(u,r))s=Math.max(o,s);else{let h=li(l,i),d=oi(l);a(d,o+1),a(h,o+1)}}}function Rae(e,t,r,i,s,a){let n=new Uint16Array(a),o=new Uint32Array(a),l=new Float32Array(a),u=new Uint16Array(e),h=new Uint32Array(e);for(let d=0;d\\u003cr;d++){let c=t+d,m=c*8,g=m*2,y=s*8,b=y*2,v=new Float32Array(e,c*32,6);if(d===0)for(let S=0;S\\u003c3;S++){let T=v[S+0],w=v[S+3];T>w?(l[y+S+0]=1,l[y+S+3]=-1):(l[y+S+0]=T,l[y+S+3]=w)}else l.set(v,y);Cr(g,u)?(o[y+6]=h[m+6]+i,n[b+14]=u[g+14],n[b+15]=65535):(o[y+6]=h[m+6],o[y+7]=h[m+7]),s++}}function Eae(e,t,r,i,s){let{geometry:a}=e,{start:n,count:o,vertexStart:l}=t;if(e.indirect){let u=Aae(a.index,e._indirectBuffer);for(let h=0;h\\u003cu.length;h++)s[h+i]=u[h]-l+r}else if(a.index)for(let u=0;u\\u003co;u++)s[u+i]=a.index.getX(u+n)-l+r;else for(let u=0;u\\u003co;u++)s[u+i]=u+n+r}function Pae(e,t,r,i,s,a){let{geometry:n,mesh:o=null}=e,{vertexStart:l,vertexCount:u}=t,h=new Float32Array(i),d=s.getLength();s.membersLayout.forEach(({name:c},m)=>{let g=n.attributes[c];a.getDefaultAttributeValue(c,$l);for(let y=0;y\\u003cu;y++){if(g){switch(zn.fromBufferAttribute(g,y+l),g.itemSize){case 1:zn.y=$l.y,zn.z=$l.z,zn.w=$l.w;break;case 2:zn.z=$l.z,zn.w=$l.w;break;case 3:zn.w=$l.w;break}o&&(c===\\\"position\\\"||c===\\\"normal\\\"||c===\\\"tangent\\\")&&o.applyBoneTransform(y+l,zn)}else zn.copy($l);zn.toArray(h,(r+y)*d+m*4)}})}var Bae=class extends Ke{constructor(e){super(),this.literal=e}build(){return this.literal}},sw=class extends Ke{constructor(e,t=\\\"property\\\"){super(),this.node=e,this.output=t}build(e){return this.node.build(e,this.output)}};function Iae(e){return e.isNode?new sw(e):null}function C5(e){let t=[];for(let r of e)if(Array.isArray(r))for(let i of r){let s=Iae(i);s&&t.push(s)}return t}function R5(e,t){return e.map(r=>(r&&!r.isNode&&r instanceof Function&&(r=r(t)),r&&r.isNode?(r.setup(t),r.isWGSLTagCodeNode?new sw(r,\\\"inline\\\"):new sw(r)):r))}function aw(e,t,r){let i=\\\"\\\";for(let s=0,a=e.length;s\\u003ca;s++)if(i+=e[s],s\\u003ct.length){let n=t[s];Array.isArray(n)||(typeof n==\\\"string\\\"||typeof n==\\\"number\\\"?i+=String(n):i+=n.build(r))}return i}var Fae=class extends AS{static get type(){return\\\"WGSLTagFnNode\\\"}constructor(e,t,r=\\\"wgsl\\\"){super(\\\"\\\",C5(t),r),this.isWGSLTagFnNode=!0,this.tokens=e,this.args=t}setup(e){super.setup(e),this._normalizedArgs=R5(this.args,e)}getNodeFunction(e){let{tokens:t,_normalizedArgs:r}=this,i=e.getDataFromNode(this),s=i.nodeFunction;if(s===void 0){let a=\\\"\\\";for(let n=0,o=t.length;n\\u003co;n++)if(a+=t[n],n\\u003cr.length){let l=r[n];Array.isArray(l)||(typeof l==\\\"string\\\"||typeof l==\\\"number\\\"?a+=String(l):l.isStructLayoutNode?a+=l.getNodeType(e):l.isStruct?a+=l.layout.getNodeType(e):a+=\\\"_arg\\\"+n)}a=a.replace(/\\\\/\\\\/.+[\\\\n\\\\r]/g,\\\"\\\"),s=e.parser.parseFunction(a),i.nodeFunction=s}return s}generate(e,t){let r=super.generate(e,t),{_normalizedArgs:i}=this,s=aw(this.tokens,i,e),{type:a}=this.getNodeFunction(e),n=e.getCodeFromNode(this,a);return n.code=s.replace(/\\\\/\\\\/.+[\\\\n\\\\r]/g,\\\"\\\").replace(/->\\\\s*void/,\\\"\\\").trim(),r}},Lae=class extends pr{static get type(){return\\\"WGSLTagCodeNode\\\"}constructor(e,t,r=\\\"wgsl\\\"){super(\\\"\\\",C5(t),r),this.isWGSLTagCodeNode=!0,this.tokens=e,this.args=t}setup(e){super.setup(e),this._normalizedArgs=R5(this.args,e)}build(e,t){return t===\\\"inline\\\"?aw(this.tokens,this._normalizedArgs,e):super.build(e,t)}generate(e){super.generate(e);let t=e.getCodeFromNode(this,this.getNodeType(e));return t.code=aw(this.tokens,this._normalizedArgs,e),t.code}},kae=e=>{let t=(...r)=>{if(r.length===1&&r[0]&&typeof r[0]==\\\"object\\\"&&!r[0].isNode){let i=r[0];for(let s in i)typeof i[s]==\\\"string\\\"&&(i[s]=new Bae(i[s]))}return e.call(...r)};return M.nodeProxyConstructor(t,e)},Pi=(e,...t)=>kae(new Fae(e,t)),uc=(e,...t)=>new Lae(e,t),nw=RB(60);function Dae(e,t){let{name:r=`bvh_shapecast_fn_${Math.random().toString(36).substring(2,7)}`,shapeStruct:i,resultStruct:s=null,prefixFn:a=null,boundsOrderFn:n=null,intersectsBoundsFn:o,intersectRangeFn:l,transformShapeFn:u=null,transformResultFn:h=null,resetShapeFn:d=null}=t,{nodes:c,transforms:m}=e.storage,g=\\\"\\\";a&&(g=uc`${a}();`);let y=\\\"\\\";h&&(y=uc`${h}( result, objectIndex );`);let b=\\\"\\\";u&&(b=uc`${u}( &localShape, objectIndex );`);let v=\\\"\\\";d&&(v=uc`${d}( objectIndex );`);let S=\\\"\\\";n&&(S=uc`\\n\\t\\t\\tlet leftToRight = ${n}( localShape, splitAxis, node );\\n\\t\\t\\tc1 = select( rightIndex, leftIndex, leftToRight );\\n\\t\\t\\tc2 = select( leftIndex, rightIndex, leftToRight );\\n\\t\\t`);let T=s?uc`result: ptr\\u003cfunction, ${s}>`:\\\"\\\",w=s?\\\"result\\\":\\\"\\\",N=Pi`\\n\\t\\t// fn\\n\\t\\tfn ${r}( shape: ${i}, ${T} ) -> bool {\\n\\n\\t\\t\\t${g}\\n\\n\\t\\t\\tvar didHit = false;\\n\\n\\t\\t\\tvar isTLAS = true;\\n\\t\\t\\tvar pointer: i32 = 0;\\n\\t\\t\\tvar stack: array\\u003cu32, ${nw}>;\\n\\t\\t\\tstack[ 0 ] = 0u;\\n\\n\\t\\t\\tvar blasDidHit: bool = false;\\n\\t\\t\\tvar objectIndex: u32 = 0;\\n\\t\\t\\tvar localShape: ${i} = shape;\\n\\n\\t\\t\\t// the stack depth the current cluster's BLAS drains back down to once it is complete\\n\\t\\t\\tvar tlasReset: i32 = 0;\\n\\n\\t\\t\\tloop {\\n\\n\\t\\t\\t\\t// The cluster's BLAS has drained back to its TLAS leaf. Finalize the cluster that\\n\\t\\t\\t\\t// was just traversed and resume the TLAS.\\n\\t\\t\\t\\tif ( ! isTLAS && tlasReset == pointer ) {\\n\\n\\t\\t\\t\\t\\tif ( blasDidHit ) {\\n\\n\\t\\t\\t\\t\\t\\tblasDidHit = false;\\n\\t\\t\\t\\t\\t\\tdidHit = true;\\n\\t\\t\\t\\t\\t\\t${y}\\n\\n\\t\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\t\\t${v}\\n\\n\\t\\t\\t\\t\\tobjectIndex = 0;\\n\\t\\t\\t\\t\\tisTLAS = true;\\n\\t\\t\\t\\t\\tlocalShape = shape;\\n\\n\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\t// check if we've finished all nodes on the stack (or overrun the stack)\\n\\t\\t\\t\\tif ( pointer \\u003c 0 || pointer >= i32( ${nw} ) ) {\\n\\n\\t\\t\\t\\t\\tbreak;\\n\\n\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\tlet nodeIndex = stack[ pointer ];\\n\\t\\t\\t\\tlet node = ${c}[ nodeIndex ];\\n\\t\\t\\t\\tpointer = pointer - 1;\\n\\n\\t\\t\\t\\t// skip the node if we don't intersect the bounds\\n\\t\\t\\t\\tif ( ${o}( localShape, node.bounds, ${w} ) == 0u ) {\\n\\n\\t\\t\\t\\t\\tcontinue;\\n\\n\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\tlet infoX = node.splitAxisOrTriangleCount;\\n\\t\\t\\t\\tlet infoY = node.rightChildOrTriangleOffset;\\n\\t\\t\\t\\tlet isLeaf = ( infoX & 0xffff0000u ) != 0u;\\n\\n\\t\\t\\t\\tif ( isLeaf ) {\\n\\n\\t\\t\\t\\t\\tif ( isTLAS ) {\\n\\n\\t\\t\\t\\t\\t\\t// the leaf encodes the placement / transform slot in the low 24 bits of infoX\\n\\t\\t\\t\\t\\t\\t// and the cluster subtree's absolute node offset in infoY, which is pushed\\n\\t\\t\\t\\t\\t\\t// directly as the BLAS entry node. Each TLAS leaf references one cluster.\\n\\t\\t\\t\\t\\t\\tobjectIndex = infoX & 0x00ffffffu;\\n\\n\\t\\t\\t\\t\\t\\tlet transform = ${m}[ objectIndex ];\\n\\t\\t\\t\\t\\t\\tif ( transform.visible != 0u ) {\\n\\n\\t\\t\\t\\t\\t\\t\\ttlasReset = pointer;\\n\\t\\t\\t\\t\\t\\t\\tisTLAS = false;\\n\\t\\t\\t\\t\\t\\t\\tblasDidHit = false;\\n\\n\\t\\t\\t\\t\\t\\t\\t// Transform shape into object local space\\n\\t\\t\\t\\t\\t\\t\\tlocalShape = shape;\\n\\t\\t\\t\\t\\t\\t\\t${b}\\n\\n\\t\\t\\t\\t\\t\\t\\tpointer = pointer + 1;\\n\\t\\t\\t\\t\\t\\t\\tstack[ pointer ] = infoY;\\n\\n\\t\\t\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\t\\t} else {\\n\\n\\t\\t\\t\\t\\t\\tlet count = infoX & 0x0000ffffu;\\n\\t\\t\\t\\t\\t\\tlet offset = infoY;\\n\\t\\t\\t\\t\\t\\tblasDidHit = ${l}( localShape, offset, count, ${w} ) || blasDidHit;\\n\\n\\t\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\t} else {\\n\\n\\t\\t\\t\\t\\tlet leftIndex = nodeIndex + 1u;\\n\\t\\t\\t\\t\\tlet splitAxis = infoX & 0x0000ffffu;\\n\\t\\t\\t\\t\\tlet rightIndex = nodeIndex + infoY;\\n\\n\\t\\t\\t\\t\\tvar c1 = rightIndex;\\n\\t\\t\\t\\t\\tvar c2 = leftIndex;\\n\\t\\t\\t\\t\\t${S}\\n\\n\\t\\t\\t\\t\\tpointer = pointer + 1;\\n\\t\\t\\t\\t\\tstack[ pointer ] = c2;\\n\\n\\t\\t\\t\\t\\tpointer = pointer + 1;\\n\\t\\t\\t\\t\\tstack[ pointer ] = c1;\\n\\n\\t\\t\\t\\t}\\n\\n\\t\\t\\t}\\n\\n\\t\\t\\treturn didHit;\\n\\n\\t\\t}\\n\\t`;return N.outputType=s,N.functionName=r,N}var Oae=Pi`\\n\\t// fn\\n\\tfn closestPointToTriangle(\\n\\t\\tp: vec3f,\\n\\t\\tv0: vec3f,\\n\\t\\tv1: vec3f,\\n\\t\\tv2: vec3f\\n\\t) -> vec3f {\\n\\n\\t\\tlet v10 = v1 - v0;\\n\\t\\tlet v21 = v2 - v1;\\n\\t\\tlet v02 = v0 - v2;\\n\\t\\tlet p0 = p - v0;\\n\\t\\tlet p1 = p - v1;\\n\\t\\tlet p2 = p - v2;\\n\\n\\t\\tlet nor = cross( v10, v02 );\\n\\t\\tlet q = cross( nor, p0 );\\n\\t\\tlet d = 1.0 / dot( nor, nor );\\n\\t\\tvar u = d * dot( q, v02 );\\n\\t\\tvar v = d * dot( q, v10 );\\n\\t\\tvar w = 1.0 - u - v;\\n\\n\\t\\tif ( u \\u003c 0.0 ) {\\n\\n\\t\\t\\tw = clamp( dot( p2, v02 ) / dot( v02, v02 ), 0.0, 1.0 );\\n\\t\\t\\tu = 0.0;\\n\\t\\t\\tv = 1.0 - w;\\n\\n\\t\\t} else if ( v \\u003c 0.0 ) {\\n\\n\\t\\t\\tu = clamp( dot( p0, v10 ) / dot( v10, v10 ), 0.0, 1.0 );\\n\\t\\t\\tv = 0.0;\\n\\t\\t\\tw = 1.0 - u;\\n\\n\\t\\t} else if ( w \\u003c 0.0 ) {\\n\\n\\t\\t\\tv = clamp( dot( p1, v21 ) / dot( v21, v21 ), 0.0, 1.0 );\\n\\t\\t\\tw = 0.0;\\n\\t\\t\\tu = 1.0 - v;\\n\\n\\t\\t}\\n\\n\\t\\treturn vec3f( w, u, v );\\n\\n\\t}\\n`,Uae=Pi`\\n\\t// fn\\n\\tfn intersectRayTriangle( ray: ${Xl}, a: vec3f, b: vec3f, c: vec3f, threshold: f32 ) -> ${lc} {\\n\\n\\t\\tconst DET_EPSILON = 1e-15;\\n\\n\\t\\tvar result: ${lc};\\n\\t\\tresult.didHit = false;\\n\\n\\t\\tlet edge1 = b - a;\\n\\t\\tlet edge2 = c - a;\\n\\t\\tlet n = cross( edge1, edge2 );\\n\\n\\t\\tlet det = - dot( ray.direction, n );\\n\\t\\tif ( abs( det ) \\u003c DET_EPSILON ) {\\n\\n\\t\\t\\treturn result;\\n\\n\\t\\t}\\n\\n\\t\\tlet invdet = 1.0 / det;\\n\\n\\t\\tlet AO = ray.origin - a;\\n\\t\\tlet DAO = cross( AO, ray.direction );\\n\\n\\t\\tlet u = dot( edge2, DAO ) * invdet;\\n\\t\\tif ( u \\u003c 0.0 || u > 1.0 ) {\\n\\n\\t\\t\\treturn result;\\n\\n\\t\\t}\\n\\n\\t\\tlet v = - dot( edge1, DAO ) * invdet;\\n\\t\\tif ( v \\u003c 0.0 || u + v > 1.0 ) {\\n\\n\\t\\t\\treturn result;\\n\\n\\t\\t}\\n\\n\\t\\tlet t = dot( AO, n ) * invdet;\\n\\t\\tlet w = 1.0 - u - v;\\n\\t\\tif ( t \\u003c threshold ) {\\n\\n\\t\\t\\treturn result;\\n\\n\\t\\t}\\n\\n\\t\\tresult.didHit = true;\\n\\t\\tresult.barycoord = vec3f( w, u, v );\\n\\t\\tresult.dist = t;\\n\\t\\tresult.side = sign( det );\\n\\t\\tresult.normal = result.side * normalize( n );\\n\\n\\t\\treturn result;\\n\\n\\t}\\n`,L0e=Pi`\\n\\t// fn\\n\\tfn ndcToCameraRay( ndc: vec2f, inverseModelViewProjection: mat4x4f ) -> ${Xl} {\\n\\n\\t\\tvar homogeneous = vec4f();\\n\\t\\tvar ray: ${Xl};\\n\\n\\t\\thomogeneous = inverseModelViewProjection * vec4f( ndc, 0.0, 1.0 );\\n\\t\\tray.origin = homogeneous.xyz / homogeneous.w;\\n\\n\\t\\thomogeneous = inverseModelViewProjection * vec4f( ndc, 1.0, 1.0 );\\n\\t\\tray.direction = ( homogeneous.xyz / homogeneous.w ) - ray.origin;\\n\\n\\t\\treturn ray;\\n\\n\\t}\\n`;function zae(e){let{index:t,attributes:r,transforms:i}=e.storage,s=yt(1).toVar(`bvh_rayScalar_${Math.random().toString(36).substring(2,7)}`);return e.getShapecastFn({name:\\\"bvh_RaycastFirstHit\\\",shapeStruct:Xl,resultStruct:lc,boundsOrderFn:Pi`\\n\\t\\t\\tfn getBoundsOrder( ray: ${Xl}, splitAxis: u32, node: ${P1} ) -> bool {\\n\\n\\t\\t\\t\\treturn ray.direction[ splitAxis ] >= 0.0;\\n\\n\\t\\t\\t}\\n\\t\\t`,intersectsBoundsFn:Pi`\\n\\t\\t\\tfn rayIntersectsBounds( ray: ${Xl}, bounds: ${E1}, result: ptr\\u003cfunction, ${lc}> ) -> u32 {\\n\\n\\t\\t\\t\\tlet boundsMin = vec3( bounds.min[0], bounds.min[1], bounds.min[2] );\\n\\t\\t\\t\\tlet boundsMax = vec3( bounds.max[0], bounds.max[1], bounds.max[2] );\\n\\n\\t\\t\\t\\tlet invDir = 1.0 / ray.direction;\\n\\t\\t\\t\\tlet tMinPlane = ( boundsMin - ray.origin ) * invDir;\\n\\t\\t\\t\\tlet tMaxPlane = ( boundsMax - ray.origin ) * invDir;\\n\\n\\t\\t\\t\\tlet tMinHit = vec3f(\\n\\t\\t\\t\\t\\tmin( tMinPlane.x, tMaxPlane.x ),\\n\\t\\t\\t\\t\\tmin( tMinPlane.y, tMaxPlane.y ),\\n\\t\\t\\t\\t\\tmin( tMinPlane.z, tMaxPlane.z )\\n\\t\\t\\t\\t);\\n\\n\\t\\t\\t\\tlet tMaxHit = vec3f(\\n\\t\\t\\t\\t\\tmax( tMinPlane.x, tMaxPlane.x ),\\n\\t\\t\\t\\t\\tmax( tMinPlane.y, tMaxPlane.y ),\\n\\t\\t\\t\\t\\tmax( tMinPlane.z, tMaxPlane.z )\\n\\t\\t\\t\\t);\\n\\n\\t\\t\\t\\tlet t0 = max( max( tMinHit.x, tMinHit.y ), tMinHit.z );\\n\\t\\t\\t\\tlet t1 = min( min( tMaxHit.x, tMaxHit.y ), tMaxHit.z );\\n\\n\\t\\t\\t\\tlet dist = max( t0, 0.0 );\\n\\t\\t\\t\\tif ( t1 \\u003c dist ) {\\n\\n\\t\\t\\t\\t\\treturn 0u;\\n\\n\\t\\t\\t\\t} else if ( result.didHit && dist * ${s} >= result.dist ) {\\n\\n\\t\\t\\t\\t\\treturn 0u;\\n\\n\\t\\t\\t\\t} else {\\n\\n\\t\\t\\t\\t\\treturn 1u;\\n\\n\\t\\t\\t\\t}\\n\\n\\t\\t\\t}\\n\\n\\t\\t`,intersectRangeFn:Pi`\\n\\t\\t\\tfn intersectRange( ray: ${Xl}, offset: u32, count: u32, result: ptr\\u003cfunction, ${lc}> ) -> bool {\\n\\n\\t\\t\\t\\tvar didHit = false;\\n\\t\\t\\t\\tfor ( var ti = offset; ti \\u003c offset + count; ti = ti + 1u ) {\\n\\n\\t\\t\\t\\t\\tlet i0 = ${t}[ ti * 3u ];\\n\\t\\t\\t\\t\\tlet i1 = ${t}[ ti * 3u + 1u ];\\n\\t\\t\\t\\t\\tlet i2 = ${t}[ ti * 3u + 2u ];\\n\\n\\t\\t\\t\\t\\tlet a = ${r}[ i0 ].position.xyz;\\n\\t\\t\\t\\t\\tlet b = ${r}[ i1 ].position.xyz;\\n\\t\\t\\t\\t\\tlet c = ${r}[ i2 ].position.xyz;\\n\\n\\t\\t\\t\\t\\tvar triResult = ${Uae}( ray, a, b, c, 0.0 );\\n\\t\\t\\t\\t\\ttriResult.dist *= ${s};\\n\\t\\t\\t\\t\\tif ( triResult.didHit && ( ! result.didHit || triResult.dist \\u003c result.dist ) ) {\\n\\n\\t\\t\\t\\t\\t\\tresult.didHit = true;\\n\\t\\t\\t\\t\\t\\tresult.dist = triResult.dist;\\n\\t\\t\\t\\t\\t\\tresult.normal = triResult.normal;\\n\\t\\t\\t\\t\\t\\tresult.side = triResult.side;\\n\\t\\t\\t\\t\\t\\tresult.barycoord = triResult.barycoord;\\n\\t\\t\\t\\t\\t\\tresult.indices = vec4u( i0, i1, i2, ti );\\n\\n\\t\\t\\t\\t\\t\\tdidHit = true;\\n\\n\\t\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\treturn didHit;\\n\\n\\t\\t\\t}\\n\\t\\t`,transformShapeFn:Pi`\\n\\t\\t\\tfn transformRay( ray: ptr\\u003cfunction, ${Xl}>, objectIndex: u32 ) -> void {\\n\\n\\t\\t\\t\\tlet toLocal = ${i}[ objectIndex ].inverseMatrixWorld;\\n\\t\\t\\t\\tray.origin = ( toLocal * vec4f( ray.origin, 1.0 ) ).xyz;\\n\\t\\t\\t\\tray.direction = ( toLocal * vec4f( ray.direction, 0.0 ) ).xyz;\\n\\n\\t\\t\\t\\tlet len = length( ray.direction );\\n\\t\\t\\t\\tray.direction /= len;\\n\\t\\t\\t\\t${s} = 1.0 / len;\\n\\n\\t\\t\\t}\\n\\t\\t`,transformResultFn:Pi`\\n\\t\\t\\tfn transformResult( hit: ptr\\u003cfunction, ${lc}>, objectIndex: u32 ) -> void {\\n\\n\\t\\t\\t\\tlet toLocal = ${i}[ objectIndex ].inverseMatrixWorld;\\n\\t\\t\\t\\thit.normal = normalize( ( transpose( toLocal ) * vec4f( hit.normal, 0.0 ) ).xyz );\\n\\t\\t\\t\\thit.objectIndex = objectIndex;\\n\\n\\t\\t\\t}\\n\\t\\t`,resetShapeFn:Pi`\\n\\t\\t\\tfn resetRayScalar( objectIndex: u32 ) -> void {\\n\\n\\t\\t\\t\\t${s} = 1.0;\\n\\n\\t\\t\\t}\\n\\t\\t`})}function Vae(e){let{storage:t,structs:r}=e,i=r.attributes.membersLayout.map(({name:s})=>`result.${s} = a0.${s} * barycoord.x + a1.${s} * barycoord.y + a2.${s} * barycoord.z;`).join(`\\n`);return Pi`\\n\\t\\t// fn\\n\\t\\tfn bvh_sampleTrianglePoint( barycoord: vec3f, indices: vec3u ) -> ${r.attributes} {\\n\\n\\t\\t\\tvar result: ${r.attributes};\\n\\t\\t\\tvar a0 = ${t.attributes}[ indices.x ];\\n\\t\\t\\tvar a1 = ${t.attributes}[ indices.y ];\\n\\t\\t\\tvar a2 = ${t.attributes}[ indices.z ];\\n\\t\\t\\t${i}\\n\\t\\t\\treturn result;\\n\\n\\t\\t}\\n\\t`}function Gae(e){let{index:t,attributes:r,transforms:i}=e.storage,s=NB().toVar(\\\"bvh_toWorldMat\\\");return e.getShapecastFn({name:\\\"bvh_ClosestPointToPoint\\\",shapeStruct:\\\"vec3f\\\",resultStruct:Em,boundsOrderFn:Pi`\\n\\t\\t\\tfn cppBoundsOrder( shape: vec3f, splitAxis: u32, node: ${P1} ) -> bool {\\n\\n\\t\\t\\t\\tlet toWorld = ${s};\\n\\n\\t\\t\\t\\t// get center\\n\\t\\t\\t\\tlet bMin = vec3f( node.bounds.min[ 0 ], node.bounds.min[ 1 ], node.bounds.min[ 2 ] );\\n\\t\\t\\t\\tlet bMax = vec3f( node.bounds.max[ 0 ], node.bounds.max[ 1 ], node.bounds.max[ 2 ] );\\n\\t\\t\\t\\tlet center = bMin * 0.5 + bMax * 0.5;\\n\\n\\t\\t\\t\\t// determine the order in world space\\n\\t\\t\\t\\tlet worldCenter = ( toWorld * vec4f( center, 1.0 ) ).xyz;\\n\\t\\t\\t\\tlet worldAxis = normalize( toWorld[ splitAxis ].xyz );\\n\\t\\t\\t\\treturn dot( shape - worldCenter, worldAxis ) \\u003c= 0.0;\\n\\n\\t\\t\\t}\\n\\t\\t`,intersectsBoundsFn:Pi`\\n\\t\\t\\tfn cppIntersectsBounds( shape: vec3f, bounds: ${E1}, result: ptr\\u003cfunction, ${Em}> ) -> u32 {\\n\\n\\t\\t\\t\\t// return 1u;\\n\\t\\t\\t\\t// we need to check this no matter what if the result has not been found yet\\n\\t\\t\\t\\tif ( ! result.found ) {\\n\\n\\t\\t\\t\\t\\treturn 1u;\\n\\n\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\tlet toWorld = ${s};\\n\\n\\t\\t\\t\\t// transform to world space\\n\\t\\t\\t\\tlet bMin = vec3f( bounds.min[ 0 ], bounds.min[ 1 ], bounds.min[ 2 ] );\\n\\t\\t\\t\\tlet bMax = vec3f( bounds.max[ 0 ], bounds.max[ 1 ], bounds.max[ 2 ] );\\n\\t\\t\\t\\tlet center = ( bMin + bMax ) * 0.5;\\n\\t\\t\\t\\tlet halfExtent = ( bMax - bMin ) * 0.5;\\n\\t\\t\\t\\tlet worldCenter = ( toWorld * vec4f( center, 1.0 ) ).xyz;\\n\\t\\t\\t\\tlet worldHalfExtent =\\n\\t\\t\\t\\t\\tabs( toWorld[ 0 ].xyz ) * halfExtent.x +\\n\\t\\t\\t\\t abs( toWorld[ 1 ].xyz ) * halfExtent.y +\\n\\t\\t\\t\\t abs( toWorld[ 2 ].xyz ) * halfExtent.z;\\n\\t\\t\\t\\tlet worldMin = worldCenter - worldHalfExtent;\\n\\t\\t\\t\\tlet worldMax = worldCenter + worldHalfExtent;\\n\\n\\t\\t\\t\\t// intersect if the distance to the bounds is not bigger than the already found\\n\\t\\t\\t\\tlet d = shape - clamp( shape, worldMin, worldMax );\\n\\t\\t\\t\\treturn select( 0u, 1u, dot( d, d ) \\u003c result.distanceSq );\\n\\n\\t\\t\\t}\\n\\t\\t`,intersectRangeFn:Pi`\\n\\t\\t\\tfn cppIntersectsRange( shape: vec3f, offset: u32, count: u32, result: ptr\\u003cfunction, ${Em}> ) -> bool {\\n\\n\\t\\t\\t\\tvar didHit = false;\\n\\t\\t\\t\\tlet toWorld = ${s};\\n\\n\\t\\t\\t\\tfor ( var i = offset; i \\u003c offset + count; i ++ ) {\\n\\n\\t\\t\\t\\t\\t// transform the triangle to world space\\n\\t\\t\\t\\t\\tlet i0 = ${t}[ i * 3u + 0u ];\\n\\t\\t\\t\\t\\tlet i1 = ${t}[ i * 3u + 1u ];\\n\\t\\t\\t\\t\\tlet i2 = ${t}[ i * 3u + 2u ];\\n\\t\\t\\t\\t\\tlet a = ( toWorld * vec4f( ${r}[ i0 ].position.xyz, 1.0 ) ).xyz;\\n\\t\\t\\t\\t\\tlet b = ( toWorld * vec4f( ${r}[ i1 ].position.xyz, 1.0 ) ).xyz;\\n\\t\\t\\t\\t\\tlet c = ( toWorld * vec4f( ${r}[ i2 ].position.xyz, 1.0 ) ).xyz;\\n\\n\\t\\t\\t\\t\\tlet barycoord = ${Oae}( shape, a, b, c );\\n\\t\\t\\t\\t\\tlet closestPoint = barycoord.x * a + barycoord.y * b + barycoord.z * c;\\n\\t\\t\\t\\t\\tlet delta = shape - closestPoint;\\n\\t\\t\\t\\t\\tlet distSq = dot( delta, delta );\\n\\n\\t\\t\\t\\t\\t// copy the content over\\n\\t\\t\\t\\t\\tif ( ! result.found || distSq \\u003c result.distanceSq ) {\\n\\n\\t\\t\\t\\t\\t\\tlet normal = normalize( cross( a - b, b - c ) );\\n\\n\\t\\t\\t\\t\\t\\tresult.closestPoint = closestPoint;\\n\\t\\t\\t\\t\\t\\tresult.barycoord = barycoord;\\n\\t\\t\\t\\t\\t\\tresult.distanceSq = distSq;\\n\\t\\t\\t\\t\\t\\tresult.faceNormal = normal;\\n\\t\\t\\t\\t\\t\\tresult.side = sign( dot( normal, delta ) );\\n\\t\\t\\t\\t\\t\\tresult.faceIndices = vec4u( i0, i1, i2, i );\\n\\t\\t\\t\\t\\t\\tresult.found = true;\\n\\t\\t\\t\\t\\t\\tdidHit = true;\\n\\n\\t\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\t}\\n\\n\\t\\t\\t\\treturn didHit;\\n\\n\\t\\t\\t}\\n\\t\\t`,resetShapeFn:Pi`\\n\\t\\t\\t\\tfn cppResetShape( objectIndex: u32 ) -> void {\\n\\n\\t\\t\\t\\t\\t// node bounds are transformed by \\\"toWorld\\\" during the bounds tests. Only the\\n\\t\\t\\t\\t\\t// object-local BLAS bounds need the object's world matrix - the top-level bounds\\n\\t\\t\\t\\t\\t// are already in world space - so restore identity before top-level traversal resumes.\\n\\t\\t\\t\\t\\t${s} = mat4x4f(\\n\\t\\t\\t\\t\\t\\t1.0, 0.0, 0.0, 0.0,\\n\\t\\t\\t\\t\\t\\t0.0, 1.0, 0.0, 0.0,\\n\\t\\t\\t\\t\\t\\t0.0, 0.0, 1.0, 0.0,\\n\\t\\t\\t\\t\\t\\t0.0, 0.0, 0.0, 1.0\\n\\t\\t\\t\\t\\t);\\n\\n\\t\\t\\t\\t}\\n\\t\\t\\t`,transformShapeFn:Pi`\\n\\t\\t\\tfn cppTransformShape( shape: ptr\\u003cfunction, vec3f>, objectIndex: u32 ) -> void {\\n\\n\\t\\t\\t\\t${s} = ${i}[ objectIndex ].matrixWorld;\\n\\n\\t\\t\\t}\\n\\t\\t`,transformResultFn:Pi`\\n\\t\\t\\tfn cppTransformResult( result: ptr\\u003cfunction, ${Em}>, objectIndex: u32 ) -> void {\\n\\n\\t\\t\\t\\tresult.objectIndex = objectIndex;\\n\\n\\t\\t\\t}\\n\\t\\t`})}var Pm=24,ow=(1\\u003c\\u003cPm)-1,E5=31-Pm,Wae=(1\\u003c\\u003cE5)-1,lw=new We,uw=new qi,Bm=new We,jae=class extends i5{constructor(e,t){super(),t={getBVH:(a,n)=>{throw new Error(\\\"ClusteredBVH: getBVH callback must be provided \\\")},shouldCluster:a=>a.isSkinnedMesh||a.isInstancedMesh||a.isBatchedMesh,primitiveLimit:64,matrixWorld:Array.isArray(e)?new We:e.matrixWorld,includeInstances:!0,_strictLeafSize:1,...t};let r=Array.from(B5(e)),i=Math.ceil(Math.log2(r.length)),s=(1\\u003c\\u003ci)-1;this.objects=r,this.getBVH=t.getBVH,this.shouldCluster=t.shouldCluster,this.includeInstances=t.includeInstances,this.primitiveLimit=t.primitiveLimit,this.matrixWorld=t.matrixWorld,this.bvhMap=new WeakMap,this.idBits=i,this.idMask=s,this.primitiveBufferStride=2,this.init(t)}init(e){let t=0,{objects:r,bvhMap:i,matrixWorld:s}=this;lw.copy(s).invert(),r.forEach(a=>{let n=[];for(let o=0,l=this._getInstanceCount(a);o\\u003cl;o++){let u=this.getBVH(a,o);n.push(u),u&&(t+=this.shouldCluster(a)?u._roots.length:this._countRelevantLeafNodes(u))}i.set(a,n)}),this.primitiveBuffer=new Uint32Array(t*2),this._fillPrimitiveBuffer(this.primitiveBuffer),super.init(e)}getRootRanges(){return[{offset:0,count:this.primitiveBuffer.length/this.primitiveBufferStride}]}refit(...e){lw.copy(this.matrixWorld).invert(),super.refit(...e)}writePrimitiveBounds(e,t,r){let{primitiveBuffer:i,bvhMap:s,objects:a}=this,n=i[2*e+0],o=i[2*e+1],l=a[this.getObjectId(n)],u=this.getInstanceId(n),h=s.get(l)[u],d=this.getBVHRootIndex(o),c=this.getBVHNodeIndex(o);l.isInstancedMesh||l.isBatchedMesh?(l.getMatrixAt(u,Bm),Bm.premultiply(l.matrixWorld)):Bm.copy(l.matrixWorld),Bm.premultiply(lw),Ur(c,new Float32Array(h._roots[d]),uw),uw.applyMatrix4(Bm);let{min:m,max:g}=uw;t[r+0]=m.x,t[r+1]=m.y,t[r+2]=m.z,t[r+3]=g.x,t[r+4]=g.y,t[r+5]=g.z}getInstanceId(e){let{idMask:t,idBits:r}=this;return(e&~t)>>>r}getObjectId(e){let{idMask:t}=this;return e&t}getBVHRootIndex(e){return e>>>Pm}getBVHNodeIndex(e){return(e&ow)*8}_getInstanceCount(e){let{includeInstances:t}=this;return e.isInstancedMesh&&t?e.count:e.isBatchedMesh&&t?e.instanceCount:1}_fillPrimitiveBuffer(e){let{objects:t,bvhMap:r,idBits:i,primitiveLimit:s}=this,a=0,n=(o,l,u,h)=>{if(h>ow)throw new Error(`ClusteredBVH: cluster node index ${h} exceeds the ${Pm}-bit packing limit and cannot be represented.`);if(u>Wae)throw new Error(`ClusteredBVH: bvh root index ${u} exceeds the ${E5}-bit packing limit and cannot be represented.`);e[2*a+0]=o\\u003c\\u003ci|l,e[2*a+1]=u\\u003c\\u003cPm|h&ow,a++};t.forEach((o,l)=>{r.get(o).forEach((u,h)=>{if(u)if(this.shouldCluster(o))for(let d=0,c=u._roots.length;d\\u003cc;d++)n(h,l,d,0);else P5(u,s,(d,c)=>{n(h,l,d,c/8)})})})}_countRelevantLeafNodes(e){let{primitiveLimit:t}=this,r=0;return P5(e,t,(i,s,a,n)=>{r++,n&&a>=t&&console.warn(`ClusteredBVH: a leaf node with ${a} primitives exceeds the cluster primitive limit of ${t} and cannot be subdivided further.`)}),r}};function P5(e,t,r){let i=e._roots.length;for(let s=0;s\\u003ci;s++)jl.setBVH(e,s),jl.traverseBuffer((a,n,o)=>{let l=jl.getRangeStart(o),u=jl.getRangeEnd(o)-l;return u\\u003ct||n?(r(s,o,u,n),!0):!1});jl.reset()}function B5(e,t=new Set){return Array.isArray(e)?e.forEach(r=>B5(r,t)):e.traverse(r=>{r.isMesh&&t.add(r)}),t}var nh=new We,B1=new We,Hae={start:0,count:0,vertexStart:0,vertexCount:0};function Xae(e){let t=e;for(;t;){if(t.visible===!1)return!1;t=t.parent}return!0}function I5(e){return e._roots.reduce((t,r)=>t+r.byteLength,0)}function F5(e,t){return`${e}_${t}`}var $ae=class{constructor(e,t={}){let{attributes:r={position:\\\"vec4f\\\"},autogenerateBvh:i=!0}=t;Array.isArray(e)||(e=[e]),e=e.map(s=>{if(s.isObject3D)return s;if(s.isBufferGeometry)return new Mi(s);if(s instanceof d1){let a=new Mi;return a.geometry.boundsTree=s,a}}),this._bvhCache=new Map,this.autogenerateBvh=i,this.attributes=r,this.objects=e,this.bvh=null,this.storage=new hw,this.structs=new hw({transform:_ae}),this.fns=new hw({raycastFirstHit:zae(this),closestPointToPoint:Gae(this),sampleTrianglePoint:null},Nae)}getRootObject(){let{objects:e}=this;if(e.isObject3D)return e;Array.isArray(e)||(e=[e]),e=e.map(r=>{if(r.isObject3D)return r;if(r.isBufferGeometry)return new Mi(r);if(r instanceof d1){let i=new Mi;return i.geometry.boundsTree=r,i}});let t=new pn;return t.children=e,t}getShapecastFn(e){return Dae(this,e)}update(){let e=this.getRootObject(),t=0;e.traverse(z=>{z.isMesh&&t++}),this.bvh=new jae(e,{strategy:2,getBVH:(z,H)=>this.getBVH(z,H,Hae),primitiveLimit:t\\u003c3?1/0:64}),this.dispose();let{attributes:r,structs:i,bvh:s}=this,a=[],n=[],o=new Map,l=I5(s),u=0,h=0,d=[],c=0,m=this._getTransformMap(s),{primitiveBuffer:g,primitiveBufferStride:y}=s;for(let z=0,H=g.length;z\\u003cH;z+=y){let ue=g[z],ne=g[z+1],re=s.objects[s.getObjectId(ue)],ce=s.getInstanceId(ue),ge={start:0,count:0,vertexStart:0,vertexCount:0},ye=this.getBVH(re,ce,ge);if(!ye)throw new Error(\\\"BVHComputeData: BVH not found.\\\");let oe=a.find(W=>W.bvh===ye);oe||(oe={index:a.length,bvh:ye,range:ge,geometryOffset:0},u+=oe.range.count,h+=oe.range.vertexCount,a.push(oe));let Ae=s.getBVHRootIndex(ne),Ie=s.getBVHNodeIndex(ne)/8,Xe=`${oe.index}_${Ae}_${Ie}`,at=o.get(Xe);if(at===void 0){let W=Cae(ye._roots[Ae],Ie);at={data:oe,root:Ae,node:Ie,size:W,base:0},o.set(Xe,at),n.push(at),l+=W*32,c=Math.max(c,A5(ye._roots[Ae],Ie))}d.push({transformSlot:m.get(F5(ue,Ae)).slot,subtree:at})}if(A5(s._roots[0])+c-1>nw.value)throw new Error(\\\"BVHComputeData: BVH depth overruns the compute stack depth.\\\");let b=Math.max(m.size,2);u=Math.max(u,2),h=Math.max(h,2);let v=new Cl(r,\\\"bvh_GeometryStruct\\\"),S=0,T=0,w=new Uint32Array(u),N=new ArrayBuffer(h*v.getLength()*4),C=new ArrayBuffer(l);a.forEach(z=>{z.geometryOffset=T/3,z.bvh.indirect||(z.geometryOffset-=z.range.start/3),Eae(z.bvh,z.range,S,T,w),Pae(z.bvh,z.range,S,N,v,this),T+=z.range.count,S+=z.range.vertexCount});let R=I5(s)/32;n.forEach(z=>{z.base=R,Rae(z.data.bvh._roots[z.root],z.node,z.size,z.data.geometryOffset,R,C),R+=z.size}),d.forEach(z=>z.nodeOffset=z.subtree.base),M5(s,d,0,C);let E=new ArrayBuffer(i.transform.getLength()*b*4),P=fm(new $p(new Uint32Array(C),1),P1).toReadOnly().setName(\\\"bvh_nodes\\\"),I=new $p(new Uint32Array(E),1),O=fm(I,i.transform).toReadOnly().setName(\\\"bvh_transforms\\\"),L=fm(new $p(w,1),\\\"uint\\\").toReadOnly().setName(\\\"bvh_index\\\"),X=fm(new $p(new Uint32Array(N),v.getLength()),v).toReadOnly().setName(\\\"bvh_attributes\\\");this.storage.transforms=O,this.storage.nodes=P,this.storage.index=L,this.storage.attributes=X,this.structs.attributes=v,B1.copy(s.matrixWorld).invert(),m.forEach(z=>{this.writeTransformData(z,B1,z.slot,E)}),this.fns.sampleTrianglePoint=Vae(this),this._bvhCache.clear()}updateTransforms(){let{bvh:e,storage:t}=this;e.refit();let r=t.nodes.proxyNode.value;M5(e,null,0,r.array.buffer),r.needsUpdate=!0;let i=t.transforms.proxyNode.value,s=i.array.buffer;B1.copy(e.matrixWorld).invert(),this._getTransformMap(e).forEach(a=>{this.writeTransformData(a,B1,a.slot,s)}),i.needsUpdate=!0}writeTransformData(e,t,r,i){let{structs:s}=this,a=new Float32Array(i),n=new Uint32Array(i),{object:o,instanceId:l}=e;o.isInstancedMesh||o.isBatchedMesh?(o.getMatrixAt(l,nh),nh.premultiply(o.matrixWorld)):nh.copy(o.matrixWorld),nh.premultiply(t),nh.toArray(a,r*s.transform.getLength()),nh.invert(),nh.toArray(a,r*s.transform.getLength()+16);let u=Xae(o);o.isBatchedMesh&&(u=u&&o.getVisibleAt(l)),n[r*s.transform.getLength()+32]=u?1:0}getBVH(e,t,r){let{autogenerateBvh:i,_bvhCache:s}=this,a=null;if(e.boundsTree||e.isSkinnedMesh){let n=e.geometry;if(r.count=n.index?n.index.count:n.attributes.position.count,r.vertexCount=n.attributes.position.count,a=e.boundsTree||null,a===null&&i){let o=e.uuid;a=s.get(o)||new Tae(e),s.set(o,a)}}else if(e.isBatchedMesh){let n=e.getGeometryIdAt(t),o=e.getGeometryRangeAt(n);if(Object.assign(r,o),a=e.boundsTrees[n]||null,a===null&&i){let l=`batched_${e.geometry.uuid}_${o.start}_${o.count}`;a=s.get(l)||new M1(e.geometry,{range:{...r}}),s.set(l,a)}}else{let n=e.geometry;if(r.count=n.index?n.index.count:n.attributes.position.count,r.vertexCount=n.attributes.position.count,a=e.geometry.boundsTree||null,a===null&&i){let o=n.uuid;a=s.get(o)||new M1(n),s.set(o,a)}}return a}getDefaultAttributeValue(e,t){switch(e){case\\\"position\\\":case\\\"color\\\":t.set(1,1,1,1);break;default:t.set(0,0,0,0)}return t}dispose(){let{storage:e}=this;for(let t in e)e[t].value?.dispose()}_getTransformMap(e){let{primitiveBuffer:t,primitiveBufferStride:r}=e,i=new Map;for(let s=0,a=t.length;s\\u003ca;s+=r){let n=t[s],o=e.getBVHRootIndex(t[s+1]),l=F5(n,o);if(i.has(l))continue;let u=i.size,h=e.objects[e.getObjectId(n)],d=e.getInstanceId(n);i.set(l,{object:h,instanceId:d,compositeId:n,root:o,slot:u})}return i}},hw=class{constructor(e={},t=Mae){let r={};return new Proxy({...e},{get(i,s){return r[s]||(r[s]=t(s,i)),r[s]},set(i,s,a){return i[s]=a,!0}})}},qae=yD(vD(),1),oh=qae.default,I1=1e6;function L5(e,t=24){let r=[];for(let l of e)for(let[u,h]of[l,...l.holes].entries()){let d=h.getPoints(t).map(c=>({X:Math.round(c.x*I1),Y:Math.round(c.y*I1)}));d.length\\u003c3||(oh.Clipper.Orientation(d)!==(u===0)&&d.reverse(),r.push(d))}let i=new oh.Clipper;i.StrictlySimple=!0,i.AddPaths(r,oh.PolyType.ptSubject,!0);let s=new oh.PolyTree;i.Execute(oh.ClipType.ctUnion,s,oh.PolyFillType.pftNonZero,oh.PolyFillType.pftNonZero);let a=[],n=l=>l.Contour().map(u=>new fe(u.X/I1,u.Y/I1)),o=l=>{for(let u of l.Childs()){if(!u.IsHole()){let h=new cp(n(u));h.holes=u.Childs().filter(d=>d.IsHole()).map(d=>new po(n(d))),a.push(h)}o(u)}};return o(s),a}var Im=ds,k5=class aD extends Tp{constructor(t){super(t),this.defaultDPI=90,this.defaultUnit=\\\"px\\\"}load(t,r,i,s){let a=this,n=new $O(a.manager);n.setPath(a.path),n.setRequestHeader(a.requestHeader),n.setWithCredentials(a.withCredentials),n.load(t,function(o){try{r(a.parse(o))}catch(l){s?s(l):console.error(l),a.manager.itemError(t)}},i,s)}parse(t){let r=this;function i(W,j){if(W.nodeType!==1)return;W.hasAttribute(\\\"filter\\\")&&console.warn(\\\"THREE.SVGLoader: Filters are not supported.\\\");let G=N(W),ae=!1,be=null;switch(W.nodeName){case\\\"svg\\\":j=y(W,j);break;case\\\"style\\\":a(W);break;case\\\"g\\\":j=y(W,j);break;case\\\"path\\\":j=y(W,j),W.hasAttribute(\\\"d\\\")&&(be=s(W));break;case\\\"rect\\\":j=y(W,j),be=l(W);break;case\\\"polygon\\\":j=y(W,j),be=u(W);break;case\\\"polyline\\\":j=y(W,j),be=h(W);break;case\\\"circle\\\":j=y(W,j),be=d(W);break;case\\\"ellipse\\\":j=y(W,j),be=c(W);break;case\\\"line\\\":j=y(W,j),be=m(W);break;case\\\"defs\\\":ae=!0;break;case\\\"use\\\":j=y(W,j);let $=(W.getAttributeNS(\\\"http://www.w3.org/1999/xlink\\\",\\\"href\\\")||\\\"\\\").substring(1),U=W.viewportElement.getElementById($);U?i(U,j):console.warn(\\\"SVGLoader: 'use node' references non-existent node id: \\\"+$);break;default:}if(be){j.fill!==void 0&&j.fill!==\\\"none\\\"&&!j.fill.startsWith(\\\"url\\\")&&be.color.setStyle(j.fill,Im),E(be,Xe),H.push(be);let $=Object.assign({},j);$.strokeWidth=j.strokeWidth*X(Xe),be.userData={node:W,style:$,transform:Xe.clone(),gradients:ne}}let Be=W.childNodes;for(let $=0;$\\u003cBe.length;$++){let U=Be[$];ae&&U.nodeName!==\\\"style\\\"&&U.nodeName!==\\\"defs\\\"||i(U,j)}G&&(re.pop(),re.length>0?Xe.copy(re[re.length-1]):Xe.identity())}function s(W){let j=new nl,G=new fe,ae=new fe,be=new fe,Be=!0,$=!1,U=W.getAttribute(\\\"d\\\");if(U===\\\"\\\"||U===\\\"none\\\")return null;let J=U.match(/[a-df-z][^a-df-z]*/gi);for(let q=0,se=J.length;q\\u003cse;q++){let pe=J[q],Te=pe.charAt(0),we=pe.slice(1).trim();Be===!0&&($=!0,Be=!1);let ie;switch(Te){case\\\"M\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V+=2)G.x=ie[V+0],G.y=ie[V+1],ae.x=G.x,ae.y=G.y,V===0?j.moveTo(G.x,G.y):j.lineTo(G.x,G.y),V===0&&be.copy(G);break;case\\\"H\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V++)G.x=ie[V],ae.x=G.x,ae.y=G.y,j.lineTo(G.x,G.y),V===0&&$===!0&&be.copy(G);break;case\\\"V\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V++)G.y=ie[V],ae.x=G.x,ae.y=G.y,j.lineTo(G.x,G.y),V===0&&$===!0&&be.copy(G);break;case\\\"L\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V+=2)G.x=ie[V+0],G.y=ie[V+1],ae.x=G.x,ae.y=G.y,j.lineTo(G.x,G.y),V===0&&$===!0&&be.copy(G);break;case\\\"C\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V+=6)j.bezierCurveTo(ie[V+0],ie[V+1],ie[V+2],ie[V+3],ie[V+4],ie[V+5]),ae.x=ie[V+2],ae.y=ie[V+3],G.x=ie[V+4],G.y=ie[V+5],V===0&&$===!0&&be.copy(G);break;case\\\"S\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V+=4)j.bezierCurveTo(b(G.x,ae.x),b(G.y,ae.y),ie[V+0],ie[V+1],ie[V+2],ie[V+3]),ae.x=ie[V+0],ae.y=ie[V+1],G.x=ie[V+2],G.y=ie[V+3],V===0&&$===!0&&be.copy(G);break;case\\\"Q\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V+=4)j.quadraticCurveTo(ie[V+0],ie[V+1],ie[V+2],ie[V+3]),ae.x=ie[V+0],ae.y=ie[V+1],G.x=ie[V+2],G.y=ie[V+3],V===0&&$===!0&&be.copy(G);break;case\\\"T\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V+=2){let tt=b(G.x,ae.x),Je=b(G.y,ae.y);j.quadraticCurveTo(tt,Je,ie[V+0],ie[V+1]),ae.x=tt,ae.y=Je,G.x=ie[V+0],G.y=ie[V+1],V===0&&$===!0&&be.copy(G)}break;case\\\"A\\\":ie=v(we,[3,4],7);for(let V=0,Oe=ie.length;V\\u003cOe;V+=7){if(ie[V+5]==G.x&&ie[V+6]==G.y)continue;let tt=G.clone();G.x=ie[V+5],G.y=ie[V+6],ae.x=G.x,ae.y=G.y,n(j,ie[V],ie[V+1],ie[V+2],ie[V+3],ie[V+4],tt,G),V===0&&$===!0&&be.copy(G)}break;case\\\"m\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V+=2)G.x+=ie[V+0],G.y+=ie[V+1],ae.x=G.x,ae.y=G.y,V===0?j.moveTo(G.x,G.y):j.lineTo(G.x,G.y),V===0&&be.copy(G);break;case\\\"h\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V++)G.x+=ie[V],ae.x=G.x,ae.y=G.y,j.lineTo(G.x,G.y),V===0&&$===!0&&be.copy(G);break;case\\\"v\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V++)G.y+=ie[V],ae.x=G.x,ae.y=G.y,j.lineTo(G.x,G.y),V===0&&$===!0&&be.copy(G);break;case\\\"l\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V+=2)G.x+=ie[V+0],G.y+=ie[V+1],ae.x=G.x,ae.y=G.y,j.lineTo(G.x,G.y),V===0&&$===!0&&be.copy(G);break;case\\\"c\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V+=6)j.bezierCurveTo(G.x+ie[V+0],G.y+ie[V+1],G.x+ie[V+2],G.y+ie[V+3],G.x+ie[V+4],G.y+ie[V+5]),ae.x=G.x+ie[V+2],ae.y=G.y+ie[V+3],G.x+=ie[V+4],G.y+=ie[V+5],V===0&&$===!0&&be.copy(G);break;case\\\"s\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V+=4)j.bezierCurveTo(b(G.x,ae.x),b(G.y,ae.y),G.x+ie[V+0],G.y+ie[V+1],G.x+ie[V+2],G.y+ie[V+3]),ae.x=G.x+ie[V+0],ae.y=G.y+ie[V+1],G.x+=ie[V+2],G.y+=ie[V+3],V===0&&$===!0&&be.copy(G);break;case\\\"q\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V+=4)j.quadraticCurveTo(G.x+ie[V+0],G.y+ie[V+1],G.x+ie[V+2],G.y+ie[V+3]),ae.x=G.x+ie[V+0],ae.y=G.y+ie[V+1],G.x+=ie[V+2],G.y+=ie[V+3],V===0&&$===!0&&be.copy(G);break;case\\\"t\\\":ie=v(we);for(let V=0,Oe=ie.length;V\\u003cOe;V+=2){let tt=b(G.x,ae.x),Je=b(G.y,ae.y);j.quadraticCurveTo(tt,Je,G.x+ie[V+0],G.y+ie[V+1]),ae.x=tt,ae.y=Je,G.x=G.x+ie[V+0],G.y=G.y+ie[V+1],V===0&&$===!0&&be.copy(G)}break;case\\\"a\\\":ie=v(we,[3,4],7);for(let V=0,Oe=ie.length;V\\u003cOe;V+=7){if(ie[V+5]==0&&ie[V+6]==0)continue;let tt=G.clone();G.x+=ie[V+5],G.y+=ie[V+6],ae.x=G.x,ae.y=G.y,n(j,ie[V],ie[V+1],ie[V+2],ie[V+3],ie[V+4],tt,G),V===0&&$===!0&&be.copy(G)}break;case\\\"Z\\\":case\\\"z\\\":j.currentPath.autoClose=!0,j.currentPath.curves.length>0&&(G.copy(be),j.currentPath.currentPoint.copy(G),Be=!0);break;default:console.warn(pe)}$=!1}return j}function a(W){if(!(!W.sheet||!W.sheet.cssRules||!W.sheet.cssRules.length))for(let j=0;j\\u003cW.sheet.cssRules.length;j++){let G=W.sheet.cssRules[j];if(G.type!==1)continue;let ae=G.selectorText.split(/,/gm).filter(Boolean).map(be=>be.trim());for(let be=0;be\\u003cae.length;be++){let Be=Object.fromEntries(Object.entries(G.style).filter(([,$])=>$!==\\\"\\\"));ue[ae[be]]=Object.assign(ue[ae[be]]||{},Be)}}}function n(W,j,G,ae,be,Be,$,U){if(j==0||G==0){W.lineTo(U.x,U.y);return}ae=ae*Math.PI/180,j=Math.abs(j),G=Math.abs(G);let J=($.x-U.x)/2,q=($.y-U.y)/2,se=Math.cos(ae)*J+Math.sin(ae)*q,pe=-Math.sin(ae)*J+Math.cos(ae)*q,Te=j*j,we=G*G,ie=se*se,V=pe*pe,Oe=ie/Te+V/we;if(Oe>1){let Rt=Math.sqrt(Oe);j=Rt*j,G=Rt*G,Te=j*j,we=G*G}let tt=Te*V+we*ie,Je=(Te*we-tt)/tt,ct=Math.sqrt(Math.max(0,Je));be===Be&&(ct=-ct);let _e=ct*j*pe/G,nt=-ct*G*se/j,dt=Math.cos(ae)*_e-Math.sin(ae)*nt+($.x+U.x)/2,ft=Math.sin(ae)*_e+Math.cos(ae)*nt+($.y+U.y)/2,Fe=o(1,0,(se-_e)/j,(pe-nt)/G),it=o((se-_e)/j,(pe-nt)/G,(-se-_e)/j,(-pe-nt)/G)%(Math.PI*2);W.currentPath.absellipse(dt,ft,j,G,Fe,Fe+it,Be===0,ae)}function o(W,j,G,ae){let be=W*G+j*ae,Be=Math.sqrt(W*W+j*j)*Math.sqrt(G*G+ae*ae),$=Math.acos(Math.max(-1,Math.min(1,be/Be)));return W*ae-j*G\\u003c0&&($=-$),$}function l(W){let j=w(W.getAttribute(\\\"x\\\")||0),G=w(W.getAttribute(\\\"y\\\")||0),ae=w(W.getAttribute(\\\"rx\\\")||W.getAttribute(\\\"ry\\\")||0),be=w(W.getAttribute(\\\"ry\\\")||W.getAttribute(\\\"rx\\\")||0),Be=w(W.getAttribute(\\\"width\\\")),$=w(W.getAttribute(\\\"height\\\")),U=1-.551915024494,J=new nl;return J.moveTo(j+ae,G),J.lineTo(j+Be-ae,G),(ae!==0||be!==0)&&J.bezierCurveTo(j+Be-ae*U,G,j+Be,G+be*U,j+Be,G+be),J.lineTo(j+Be,G+$-be),(ae!==0||be!==0)&&J.bezierCurveTo(j+Be,G+$-be*U,j+Be-ae*U,G+$,j+Be-ae,G+$),J.lineTo(j+ae,G+$),(ae!==0||be!==0)&&J.bezierCurveTo(j+ae*U,G+$,j,G+$-be*U,j,G+$-be),J.lineTo(j,G+be),(ae!==0||be!==0)&&J.bezierCurveTo(j,G+be*U,j+ae*U,G,j+ae,G),J}function u(W){function j(Be,$,U){let J=w($),q=w(U);be===0?ae.moveTo(J,q):ae.lineTo(J,q),be++}let G=/([+-]?\\\\d*\\\\.?\\\\d+(?:e[+-]?\\\\d+)?)(?:,|\\\\s)([+-]?\\\\d*\\\\.?\\\\d+(?:e[+-]?\\\\d+)?)/g,ae=new nl,be=0;return W.getAttribute(\\\"points\\\").replace(G,j),ae.currentPath.autoClose=!0,ae}function h(W){function j(Be,$,U){let J=w($),q=w(U);be===0?ae.moveTo(J,q):ae.lineTo(J,q),be++}let G=/([+-]?\\\\d*\\\\.?\\\\d+(?:e[+-]?\\\\d+)?)(?:,|\\\\s)([+-]?\\\\d*\\\\.?\\\\d+(?:e[+-]?\\\\d+)?)/g,ae=new nl,be=0;return W.getAttribute(\\\"points\\\").replace(G,j),ae.currentPath.autoClose=!1,ae}function d(W){let j=w(W.getAttribute(\\\"cx\\\")||0),G=w(W.getAttribute(\\\"cy\\\")||0),ae=w(W.getAttribute(\\\"r\\\")||0),be=new po;be.absarc(j,G,ae,0,Math.PI*2);let Be=new nl;return Be.subPaths.push(be),Be}function c(W){let j=w(W.getAttribute(\\\"cx\\\")||0),G=w(W.getAttribute(\\\"cy\\\")||0),ae=w(W.getAttribute(\\\"rx\\\")||0),be=w(W.getAttribute(\\\"ry\\\")||0),Be=new po;Be.absellipse(j,G,ae,be,0,Math.PI*2);let $=new nl;return $.subPaths.push(Be),$}function m(W){let j=w(W.getAttribute(\\\"x1\\\")||0),G=w(W.getAttribute(\\\"y1\\\")||0),ae=w(W.getAttribute(\\\"x2\\\")||0),be=w(W.getAttribute(\\\"y2\\\")||0),Be=new nl;return Be.moveTo(j,G),Be.lineTo(ae,be),Be.currentPath.autoClose=!1,Be}function g(W){let j=\\\"http://www.w3.org/1999/xlink\\\",G=W.querySelectorAll(\\\"linearGradient, radialGradient\\\"),ae=[\\\"x1\\\",\\\"y1\\\",\\\"x2\\\",\\\"y2\\\",\\\"cx\\\",\\\"cy\\\",\\\"r\\\",\\\"fx\\\",\\\"fy\\\",\\\"gradientUnits\\\",\\\"gradientTransform\\\",\\\"spreadMethod\\\"],be={};for(let $ of G){let U=$.getAttribute(\\\"id\\\");if(!U)continue;let J={type:$.nodeName===\\\"radialGradient\\\"?\\\"radialGradient\\\":\\\"linearGradient\\\",attrs:{},stops:null,href:null},q=$.getAttributeNS(j,\\\"href\\\")||$.getAttribute(\\\"href\\\")||\\\"\\\";q.startsWith(\\\"#\\\")&&(J.href=q.substring(1));for(let pe of ae)$.hasAttribute(pe)&&(J.attrs[pe]=$.getAttribute(pe));let se=$.querySelectorAll(\\\"stop\\\");if(se.length>0){J.stops=[];for(let pe of se){let Te=pe.getAttribute(\\\"stop-color\\\");!Te&&pe.style&&(Te=pe.style[\\\"stop-color\\\"]),Te||(Te=\\\"#000\\\");let we=pe.getAttribute(\\\"stop-opacity\\\");(we===null||we===\\\"\\\")&&pe.style&&(we=pe.style[\\\"stop-opacity\\\"]),we=we===null||we===\\\"\\\"||we===void 0?1:Math.max(0,Math.min(1,parseFloat(we)));let ie=Math.max(0,Math.min(1,parseFloat(pe.getAttribute(\\\"offset\\\")||\\\"0\\\")));J.stops.push({offset:ie,color:Te,opacity:we})}}be[U]=J}function Be($,U){let J=be[$];if(!J||U.has($))return J;if(U.add($),J.href&&be[J.href]){let q=Be(J.href,U);if(q){J.stops||(J.stops=q.stops);for(let se in q.attrs)se in J.attrs||(J.attrs[se]=q.attrs[se])}}return J}for(let $ in be)Be($,new Set);for(let $ in be){let U=function(Te){return typeof Te!=\\\"string\\\"?0:Te.endsWith(\\\"%\\\")?parseFloat(Te)/100:w(Te)},J=be[$],q=J.attrs,se=q.gradientUnits===\\\"userSpaceOnUse\\\"?\\\"userSpaceOnUse\\\":\\\"objectBoundingBox\\\",pe={type:J.type,gradientUnits:se,spreadMethod:q.spreadMethod===\\\"reflect\\\"||q.spreadMethod===\\\"repeat\\\"?q.spreadMethod:\\\"pad\\\",gradientTransform:null,stops:(J.stops||[]).slice().sort((Te,we)=>Te.offset-we.offset)};if(q.gradientTransform&&(pe.gradientTransform=new Dr,R(q.gradientTransform,pe.gradientTransform)),J.type===\\\"linearGradient\\\")pe.x1=q.x1!==void 0?U(q.x1):0,pe.y1=q.y1!==void 0?U(q.y1):0,pe.x2=q.x2!==void 0?U(q.x2):se===\\\"objectBoundingBox\\\"?1:0,pe.y2=q.y2!==void 0?U(q.y2):0;else{let Te=se===\\\"objectBoundingBox\\\"?.5:0,we=se===\\\"objectBoundingBox\\\"?.5:0;pe.cx=q.cx!==void 0?U(q.cx):Te,pe.cy=q.cy!==void 0?U(q.cy):Te,pe.r=q.r!==void 0?U(q.r):we,pe.fx=q.fx!==void 0?U(q.fx):pe.cx,pe.fy=q.fy!==void 0?U(q.fy):pe.cy}ne[$]=pe}}function y(W,j){j=Object.assign({},j);let G={};if(W.hasAttribute(\\\"class\\\")){let $=W.getAttribute(\\\"class\\\").split(/\\\\s/).filter(Boolean).map(U=>U.trim());for(let U=0;U\\u003c$.length;U++)G=Object.assign(G,ue[\\\".\\\"+$[U]])}W.hasAttribute(\\\"id\\\")&&(G=Object.assign(G,ue[\\\"#\\\"+W.getAttribute(\\\"id\\\")]));function ae($,U,J){J===void 0&&(J=function(q){return q}),W.hasAttribute($)&&(j[U]=J(W.getAttribute($))),G[U]&&(j[U]=J(G[U])),W.style&&W.style[$]!==\\\"\\\"&&(j[U]=J(W.style[$]))}function be($){return Math.max(0,Math.min(1,w($)))}function Be($){return Math.max(0,w($))}return ae(\\\"fill\\\",\\\"fill\\\"),ae(\\\"fill-opacity\\\",\\\"fillOpacity\\\",be),ae(\\\"fill-rule\\\",\\\"fillRule\\\"),ae(\\\"opacity\\\",\\\"opacity\\\",be),ae(\\\"stroke\\\",\\\"stroke\\\"),ae(\\\"stroke-opacity\\\",\\\"strokeOpacity\\\",be),ae(\\\"stroke-width\\\",\\\"strokeWidth\\\",Be),ae(\\\"stroke-linejoin\\\",\\\"strokeLineJoin\\\"),ae(\\\"stroke-linecap\\\",\\\"strokeLineCap\\\"),ae(\\\"stroke-miterlimit\\\",\\\"strokeMiterLimit\\\",Be),ae(\\\"visibility\\\",\\\"visibility\\\"),j}function b(W,j){return W-(j-W)}function v(W,j,G){if(typeof W!=\\\"string\\\")throw new TypeError(\\\"Invalid input: \\\"+typeof W);let ae={SEPARATOR:/[ \\\\t\\\\r\\\\n\\\\,.\\\\-+]/,WHITESPACE:/[ \\\\t\\\\r\\\\n]/,DIGIT:/[\\\\d]/,SIGN:/[-+]/,POINT:/\\\\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},be=0,Be=1,$=2,U=3,J=be,q=!0,se=\\\"\\\",pe=\\\"\\\",Te=[];function we(tt,Je,ct){let _e=new SyntaxError('Unexpected character \\\"'+tt+'\\\" at index '+Je+\\\".\\\");throw _e.partial=ct,_e}function ie(){se!==\\\"\\\"&&(pe===\\\"\\\"?Te.push(Number(se)):Te.push(Number(se)*Math.pow(10,Number(pe)))),se=\\\"\\\",pe=\\\"\\\"}let V,Oe=W.length;for(let tt=0;tt\\u003cOe;tt++){if(V=W[tt],Array.isArray(j)&&j.includes(Te.length%G)&&ae.FLAGS.test(V)){J=Be,se=V,ie();continue}if(J===be){if(ae.WHITESPACE.test(V))continue;if(ae.DIGIT.test(V)||ae.SIGN.test(V)){J=Be,se=V;continue}if(ae.POINT.test(V)){J=$,se=V;continue}ae.COMMA.test(V)&&(q&&we(V,tt,Te),q=!0)}if(J===Be){if(ae.DIGIT.test(V)){se+=V;continue}if(ae.POINT.test(V)){se+=V,J=$;continue}if(ae.EXP.test(V)){J=U;continue}ae.SIGN.test(V)&&se.length===1&&ae.SIGN.test(se[0])&&we(V,tt,Te)}if(J===$){if(ae.DIGIT.test(V)){se+=V;continue}if(ae.EXP.test(V)){J=U;continue}ae.POINT.test(V)&&se[se.length-1]===\\\".\\\"&&we(V,tt,Te)}if(J===U){if(ae.DIGIT.test(V)){pe+=V;continue}if(ae.SIGN.test(V)){if(pe===\\\"\\\"){pe+=V;continue}pe.length===1&&ae.SIGN.test(pe)&&we(V,tt,Te)}}ae.WHITESPACE.test(V)?(ie(),J=be,q=!1):ae.COMMA.test(V)?(ie(),J=be,q=!0):ae.SIGN.test(V)?(ie(),J=Be,se=V):ae.POINT.test(V)?(ie(),J=$,se=V):we(V,tt,Te)}return ie(),Te}let S=[\\\"mm\\\",\\\"cm\\\",\\\"in\\\",\\\"pt\\\",\\\"pc\\\",\\\"px\\\"],T={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:72/6,pc:1,px:-1},px:{px:1}};function w(W){let j=\\\"px\\\";if(typeof W==\\\"string\\\"||W instanceof String)for(let ae=0,be=S.length;ae\\u003cbe;ae++){let Be=S[ae];if(W.endsWith(Be)){j=Be,W=W.substring(0,W.length-Be.length);break}}let G;return j===\\\"px\\\"&&r.defaultUnit!==\\\"px\\\"?G=T.in[r.defaultUnit]/r.defaultDPI:(G=T[j][r.defaultUnit],G\\u003c0&&(G=T[j].in*r.defaultDPI)),G*parseFloat(W)}function N(W){if(!(W.hasAttribute(\\\"transform\\\")||W.nodeName===\\\"use\\\"&&(W.hasAttribute(\\\"x\\\")||W.hasAttribute(\\\"y\\\"))))return null;let j=C(W);return re.length>0&&j.premultiply(re[re.length-1]),Xe.copy(j),re.push(j),j}function C(W){let j=new Dr;if(W.nodeName===\\\"use\\\"&&(W.hasAttribute(\\\"x\\\")||W.hasAttribute(\\\"y\\\"))){let G=w(W.getAttribute(\\\"x\\\")||0),ae=w(W.getAttribute(\\\"y\\\")||0);j.makeTranslation(G,ae)}return W.hasAttribute(\\\"transform\\\")&&R(W.getAttribute(\\\"transform\\\"),j),j}function R(W,j){let G=ce,ae=W.split(\\\")\\\");for(let be=ae.length-1;be>=0;be--){let Be=ae[be].trim();if(Be===\\\"\\\")continue;let $=Be.indexOf(\\\"(\\\"),U=Be.length;if($>0&&$\\u003cU){let J=Be.slice(0,$),q=v(Be.slice($+1));switch(G.identity(),J){case\\\"translate\\\":if(q.length>=1){let se=q[0],pe=0;q.length>=2&&(pe=q[1]),G.makeTranslation(se,pe)}break;case\\\"rotate\\\":if(q.length>=1){let se=0,pe=0,Te=0;se=q[0]*Math.PI/180,q.length>=3&&(pe=q[1],Te=q[2]),ge.makeTranslation(-pe,-Te),ye.makeRotation(se),oe.multiplyMatrices(ye,ge),ge.makeTranslation(pe,Te),G.multiplyMatrices(ge,oe)}break;case\\\"scale\\\":if(q.length>=1){let se=q[0],pe=se;q.length>=2&&(pe=q[1]),G.makeScale(se,pe)}break;case\\\"skewX\\\":q.length===1&&G.set(1,Math.tan(q[0]*Math.PI/180),0,0,1,0,0,0,1);break;case\\\"skewY\\\":q.length===1&&G.set(1,0,0,Math.tan(q[0]*Math.PI/180),1,0,0,0,1);break;case\\\"matrix\\\":q.length===6&&G.set(q[0],q[2],q[4],q[1],q[3],q[5],0,0,1);break}j.premultiply(G)}}return j}function E(W,j){function G($){Ie.set($.x,$.y,1).applyMatrix3(j),$.set(Ie.x,Ie.y)}function ae($){let U=$.xRadius,J=$.yRadius,q=Math.cos($.aRotation),se=Math.sin($.aRotation),pe=new F(U*q,U*se,0),Te=new F(-J*se,J*q,0),we=pe.applyMatrix3(j),ie=Te.applyMatrix3(j),V=ce.set(we.x,ie.x,0,we.y,ie.y,0,0,0,1),Oe=ge.copy(V).invert(),tt=ye.copy(Oe).transpose().multiply(Oe).elements,Je=z(tt[0],tt[1],tt[4]),ct=Math.sqrt(Je.rt1),_e=Math.sqrt(Je.rt2);if($.xRadius=1/ct,$.yRadius=1/_e,$.aRotation=Math.atan2(Je.sn,Je.cs),!(($.aEndAngle-$.aStartAngle)%(2*Math.PI)\\u003cNumber.EPSILON)){let nt=ge.set(ct,0,0,0,_e,0,0,0,1),dt=ye.set(Je.cs,Je.sn,0,-Je.sn,Je.cs,0,0,0,1),ft=nt.multiply(dt).multiply(V),Fe=it=>{let{x:Rt,y:Ft}=new F(Math.cos(it),Math.sin(it),0).applyMatrix3(ft);return Math.atan2(Ft,Rt)};$.aStartAngle=Fe($.aStartAngle),$.aEndAngle=Fe($.aEndAngle),P(j)&&($.aClockwise=!$.aClockwise)}}function be($){let U=O(j),J=L(j);$.xRadius*=U,$.yRadius*=J;let q=U>Number.EPSILON?Math.atan2(j.elements[1],j.elements[0]):Math.atan2(-j.elements[3],j.elements[4]);$.aRotation+=q,P(j)&&($.aStartAngle*=-1,$.aEndAngle*=-1,$.aClockwise=!$.aClockwise)}let Be=W.subPaths;for(let $=0,U=Be.length;$\\u003cU;$++){let J=Be[$].curves;for(let q=0;q\\u003cJ.length;q++){let se=J[q];se.isLineCurve?(G(se.v1),G(se.v2)):se.isCubicBezierCurve?(G(se.v0),G(se.v1),G(se.v2),G(se.v3)):se.isQuadraticBezierCurve?(G(se.v0),G(se.v1),G(se.v2)):se.isEllipseCurve&&(Ae.set(se.aX,se.aY),G(Ae),se.aX=Ae.x,se.aY=Ae.y,I(j)?ae(se):be(se))}}}function P(W){let j=W.elements;return j[0]*j[4]-j[1]*j[3]\\u003c0}function I(W){let j=W.elements,G=j[0]*j[3]+j[1]*j[4];if(G===0)return!1;let ae=O(W),be=L(W);return Math.abs(G/(ae*be))>Number.EPSILON}function O(W){let j=W.elements;return Math.sqrt(j[0]*j[0]+j[1]*j[1])}function L(W){let j=W.elements;return Math.sqrt(j[3]*j[3]+j[4]*j[4])}function X(W){let j=W.elements,G=j[0]*j[4]-j[1]*j[3];return Math.sqrt(Math.abs(G))}function z(W,j,G){let ae,be,Be,$,U,J=W+G,q=W-G,se=Math.sqrt(q*q+4*j*j);return J>0?(ae=.5*(J+se),U=1/ae,be=W*U*G-j*U*j):J\\u003c0?be=.5*(J-se):(ae=.5*se,be=-.5*se),q>0?Be=q+se:Be=q-se,Math.abs(Be)>2*Math.abs(j)?(U=-2*j/Be,$=1/Math.sqrt(1+U*U),Be=U*$):Math.abs(j)===0?(Be=1,$=0):(U=-.5*Be/j,Be=1/Math.sqrt(1+U*U),$=U*Be),q>0&&(U=Be,Be=-$,$=U),{rt1:ae,rt2:be,cs:Be,sn:$}}let H=[],ue={},ne={},re=[],ce=new Dr,ge=new Dr,ye=new Dr,oe=new Dr,Ae=new fe,Ie=new F,Xe=new Dr,at=new DOMParser().parseFromString(t,\\\"image/svg+xml\\\");return g(at),i(at.documentElement,{fill:\\\"#000\\\",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:\\\"miter\\\",strokeLineCap:\\\"butt\\\",strokeMiterLimit:4}),{paths:H,gradients:ne,xml:at.documentElement}}static createFillMaterial(t){let r=t.userData.style;if(r.fill===void 0||r.fill===\\\"none\\\")return null;let i=t.color,s=null,a=D5.exec(r.fill);if(a){let o=t.userData.gradients&&t.userData.gradients[a[1]];s=Yae(o,t)}let n=new mn({opacity:r.fillOpacity*(r.opacity||1),transparent:!0,side:hs,depthWrite:!1});return s!==null?n.map=s:n.color=i,n}static createStrokeMaterial(t){let r=t.userData.style;return r.stroke===void 0||r.stroke===\\\"none\\\"?null:(D5.test(r.stroke)&&console.warn(\\\"THREE.SVGLoader: Gradient strokes are not supported.\\\"),new mn({color:new gt().setStyle(r.stroke,Im),opacity:r.strokeOpacity*(r.opacity||1),transparent:!0,side:hs,depthWrite:!1}))}static createShapes(t){return console.warn(\\\"SVGLoader: createShapes() is deprecated. Use shapePath.toShapes() instead.\\\"),t.toShapes()}static getStrokeStyle(t,r,i,s,a){return t=t!==void 0?t:1,r=r!==void 0?r:\\\"#000\\\",i=i!==void 0?i:\\\"miter\\\",s=s!==void 0?s:\\\"butt\\\",a=a!==void 0?a:4,{strokeColor:r,strokeWidth:t,strokeLineJoin:i,strokeLineCap:s,strokeMiterLimit:a}}static pointsToStroke(t,r,i,s){let a=[],n=[],o=[];if(aD.pointsToStrokeWithBuffers(t,r,i,s,a,n,o)===0)return null;let l=new ps;return l.setAttribute(\\\"position\\\",new tr(a,3)),l.setAttribute(\\\"normal\\\",new tr(n,3)),l.setAttribute(\\\"uv\\\",new tr(o,2)),l}static pointsToStrokeWithBuffers(t,r,i,s,a,n,o,l){let u=new fe,h=new fe,d=new fe,c=new fe,m=new fe,g=new fe,y=new fe,b=new fe,v=new fe,S=new fe,T=new fe,w=new fe,N=new fe,C=new fe,R=new fe,E=new fe,P=new fe;i=i!==void 0?i:12,s=s!==void 0?s:.001,l=l!==void 0?l:0,t=$(t);let I=t.length;if(I\\u003c2)return 0;let O=t[0].equals(t[I-1]),L,X=t[0],z,H=r.strokeWidth/2,ue=1/(I-1),ne=0,re,ce,ge,ye,oe=!1,Ae=0,Ie=l*3,Xe=l*2;at(t[0],t[1],u).multiplyScalar(H),b.copy(t[0]).sub(u),v.copy(t[0]).add(u),S.copy(b),T.copy(v);for(let U=1;U\\u003cI;U++){L=t[U],U===I-1?O?z=t[1]:z=void 0:z=t[U+1];let J=u;if(at(X,L,J),d.copy(J).multiplyScalar(H),w.copy(L).sub(d),N.copy(L).add(d),re=ne+ue,ce=!1,z!==void 0){at(L,z,h),d.copy(h).multiplyScalar(H),C.copy(L).sub(d),R.copy(L).add(d),ge=!0,d.subVectors(z,X),J.dot(d)\\u003c0&&(ge=!1),U===1&&(oe=ge),d.subVectors(z,L),d.normalize();let q=Math.abs(J.dot(d));if(q>Number.EPSILON){let se=H/q;d.multiplyScalar(-se),c.subVectors(L,X),m.copy(c).setLength(se).add(d),E.copy(m).negate();let pe=m.length(),Te=c.length();c.divideScalar(Te),g.subVectors(z,L);let we=g.length();if(g.divideScalar(we),c.dot(E)\\u003cTe&&g.dot(E)\\u003cwe&&(ce=!0),P.copy(m).add(L),E.add(L),ce){let ie=ge?v:b,V=(P.x-ie.x)*(E.y-ie.y)-(P.y-ie.y)*(E.x-ie.x);(ge&&V\\u003c0||!ge&&V>0)&&E.copy(ie)}switch(ye=!1,ce?ge?(R.copy(E),N.copy(E)):(C.copy(E),w.copy(E)):G(),r.strokeLineJoin){case\\\"bevel\\\":ae(ge,ce,re);break;case\\\"round\\\":be(ge,ce),ge?j(L,w,C,re,0):j(L,R,N,re,1);break;default:let ie=H*r.strokeMiterLimit/pe;if(ie\\u003c1)if(r.strokeLineJoin!==\\\"miter-clip\\\"){ae(ge,ce,re);break}else be(ge,ce),ge?(g.subVectors(P,w).multiplyScalar(ie).add(w),y.subVectors(P,C).multiplyScalar(ie).add(C),W(w,re,0),W(g,re,0),W(L,re,.5),W(L,re,.5),W(g,re,0),W(y,re,0),W(L,re,.5),W(y,re,0),W(C,re,0)):(g.subVectors(P,N).multiplyScalar(ie).add(N),y.subVectors(P,R).multiplyScalar(ie).add(R),W(N,re,1),W(g,re,1),W(L,re,.5),W(L,re,.5),W(g,re,1),W(y,re,1),W(L,re,.5),W(y,re,1),W(R,re,1));else ce?(ge?(W(v,ne,1),W(b,ne,0),W(P,re,0),W(v,ne,1),W(P,re,0),W(E,re,1)):(W(v,ne,1),W(b,ne,0),W(P,re,1),W(b,ne,0),W(E,re,0),W(P,re,1)),ge?C.copy(P):R.copy(P)):ge?(W(w,re,0),W(P,re,0),W(L,re,.5),W(L,re,.5),W(P,re,0),W(C,re,0)):(W(N,re,1),W(P,re,1),W(L,re,.5),W(L,re,.5),W(P,re,1),W(R,re,1)),ye=!0;break}}else G()}else G();!O&&U===I-1&&Be(t[0],S,T,ge,!0,ne),ne=re,X=L,b.copy(C),v.copy(R)}if(!O)Be(L,w,N,ge,!1,re);else if(ce&&a){let U=P,J=E;oe!==ge&&(U=E,J=P),ge?(ye||oe)&&(J.toArray(a,0),J.toArray(a,9),ye&&U.toArray(a,3)):(ye||!oe)&&(J.toArray(a,3),J.toArray(a,9),ye&&U.toArray(a,0))}if(a){let U=[new fe,new fe,new fe],J=l*3;for(let q=J;q\\u003cIe;q+=9)U[0].set(a[q],a[q+1]),U[1].set(a[q+3],a[q+4]),U[2].set(a[q+6],a[q+7]),dd.area(U)\\u003c0&&(a[q+3]=U[0].x,a[q+4]=U[0].y)}return Ae;function at(U,J,q){return q.subVectors(J,U),q.set(-q.y,q.x).normalize()}function W(U,J,q){a&&(a[Ie]=U.x,a[Ie+1]=U.y,a[Ie+2]=0,n&&(n[Ie]=0,n[Ie+1]=0,n[Ie+2]=1),Ie+=3,o&&(o[Xe]=J,o[Xe+1]=q,Xe+=2)),Ae+=3}function j(U,J,q,se,pe){u.copy(J).sub(U).normalize(),h.copy(q).sub(U).normalize();let Te=Math.PI,we=u.dot(h);Math.abs(we)\\u003c1&&(Te=Math.abs(Math.acos(we))),Te/=i,d.copy(J);for(let ie=0,V=i-1;ie\\u003cV;ie++)c.copy(d).rotateAround(U,Te),W(d,se,pe),W(c,se,pe),W(U,se,.5),d.copy(c);W(d,se,pe),W(q,se,pe),W(U,se,.5)}function G(){W(v,ne,1),W(b,ne,0),W(w,re,0),W(v,ne,1),W(w,re,0),W(N,re,1)}function ae(U,J,q){J?U?(W(v,ne,1),W(b,ne,0),W(w,re,0),W(v,ne,1),W(w,re,0),W(E,re,1),W(w,q,0),W(C,q,0),W(E,q,.5)):(W(v,ne,1),W(b,ne,0),W(N,re,1),W(b,ne,0),W(E,re,0),W(N,re,1),W(N,q,1),W(E,q,0),W(R,q,1)):U?(W(w,q,0),W(C,q,0),W(L,q,.5)):(W(N,q,1),W(R,q,0),W(L,q,.5))}function be(U,J){J&&(U?(W(v,ne,1),W(b,ne,0),W(w,re,0),W(v,ne,1),W(w,re,0),W(E,re,1),W(w,ne,0),W(L,re,.5),W(E,re,1),W(L,re,.5),W(C,ne,0),W(E,re,1)):(W(v,ne,1),W(b,ne,0),W(N,re,1),W(b,ne,0),W(E,re,0),W(N,re,1),W(N,ne,1),W(E,re,0),W(L,re,.5),W(L,re,.5),W(E,re,0),W(R,ne,1)))}function Be(U,J,q,se,pe,Te){switch(r.strokeLineCap){case\\\"round\\\":pe?j(U,q,J,Te,.5):j(U,J,q,Te,.5);break;case\\\"square\\\":if(pe)u.subVectors(J,U),h.set(u.y,-u.x),d.addVectors(u,h).add(U),c.subVectors(h,u).add(U),se?(d.toArray(a,3),c.toArray(a,0),c.toArray(a,9)):(d.toArray(a,3),o[7]===1?c.toArray(a,9):d.toArray(a,9),c.toArray(a,0));else{u.subVectors(q,U),h.set(u.y,-u.x),d.addVectors(u,h).add(U),c.subVectors(h,u).add(U);let we=a.length;se?(d.toArray(a,we-3),c.toArray(a,we-6),c.toArray(a,we-12)):(c.toArray(a,we-6),d.toArray(a,we-3),c.toArray(a,we-12))}break;default:break}}function $(U){let J=!1;for(let se=1,pe=U.length-1;se\\u003cpe;se++)if(U[se].distanceTo(U[se+1])\\u003cs){J=!0;break}if(!J)return U;let q=[];q.push(U[0]);for(let se=1,pe=U.length-1;se\\u003cpe;se++)U[se].distanceTo(U[se+1])>=s&&q.push(U[se]);return q.push(U[U.length-1]),q}}},D5=/^\\\\s*url\\\\(\\\\s*(?:[\\\"']\\\\s*)?#([^)'\\\"\\\\s]+)(?:\\\\s*[\\\"'])?\\\\s*\\\\)\\\\s*$/;function Yae(e,t,r=256){if(!e||!Array.isArray(e.stops)||e.stops.length===0)return null;let i=t.userData.transform,s=e.gradientUnits===\\\"objectBoundingBox\\\",a=null;if(s&&(a=Zae(t,i),a===null))return null;function n(d,c,m){m.set(d,c,1),e.gradientTransform&&m.applyMatrix3(e.gradientTransform),s&&m.set(a.minX+m.x*a.width,a.minY+m.y*a.height,1),i&&m.applyMatrix3(i)}let o=document.createElement(\\\"canvas\\\"),l;if(e.type===\\\"linearGradient\\\"){o.width=r,o.height=1;let d=o.getContext(\\\"2d\\\"),c=d.createLinearGradient(0,0,r,0);O5(c,e.stops),d.fillStyle=c,d.fillRect(0,0,r,1);let m=new F,g=new F;n(e.x1,e.y1,m),n(e.x2,e.y2,g);let y=g.x-m.x,b=g.y-m.y,v=y*y+b*b||1e-20,S=y/v,T=b/v,w=-(S*m.x+T*m.y);l=new Dr().set(S,T,w,0,0,.5,0,0,1)}else{let d=e.cx,c=e.cy,m=e.fx,g=e.fy,y=e.r;if(e.gradientTransform){let R=new F;R.set(d,c,1).applyMatrix3(e.gradientTransform),d=R.x,c=R.y,R.set(m,g,1).applyMatrix3(e.gradientTransform),m=R.x,g=R.y}if(s&&(d=a.minX+d*a.width,c=a.minY+c*a.height,m=a.minX+m*a.width,g=a.minY+g*a.height,y=y*Math.sqrt((a.width*a.width+a.height*a.height)/2)),y\\u003c=0)return null;o.width=r,o.height=r;let b=o.getContext(\\\"2d\\\"),v=d-y,S=c-y,T=2*y,w=r/T;b.setTransform(w,0,0,w,-v*w,-S*w);let N=b.createRadialGradient(m,g,0,d,c,y);O5(N,e.stops),b.fillStyle=N,b.fillRect(v,S,T,T);let C=i?i.clone().invert():new Dr;l=new Dr().set(1/T,0,-v/T,0,1/T,-S/T,0,0,1).multiply(C)}let u=new j4(o);u.colorSpace=Im,u.flipY=!1,u.matrixAutoUpdate=!1,u.matrix=l;let h=e.spreadMethod===\\\"reflect\\\"?Qo:e.spreadMethod===\\\"repeat\\\"?to:Ti;return u.wrapS=h,u.wrapT=h,u}function Zae(e,t){let r=t?t.clone().invert():null,i=new fe,s=new ob;for(let a of e.subPaths)for(let n of a.getPoints())i.copy(n),r&&i.applyMatrix3(r),s.expandByPoint(i);return s.isEmpty()?null:{minX:s.min.x,minY:s.min.y,width:s.max.x-s.min.x,height:s.max.y-s.min.y}}function O5(e,t){let r=new gt;for(let i of t){let s=i.color;if(i.opacity\\u003c1){r.setStyle(i.color,Im);let a=/rgb\\\\(([^)]+)\\\\)/.exec(r.getStyle(Im));a&&(s=`rgba(${a[1]},${i.opacity})`)}e.addColorStop(Math.max(0,Math.min(1,i.offset)),s)}}function U5(e,t=1e-4){t=Math.max(t,Number.EPSILON);let r={},i=e.getIndex(),s=e.getAttribute(\\\"position\\\"),a=i?i.count:s.count,n=0,o=Object.keys(e.attributes),l={},u={},h=[],d=[\\\"getX\\\",\\\"getY\\\",\\\"getZ\\\",\\\"getW\\\"],c=[\\\"setX\\\",\\\"setY\\\",\\\"setZ\\\",\\\"setW\\\"];for(let S=0,T=o.length;S\\u003cT;S++){let w=o[S],N=e.attributes[w];l[w]=new N.constructor(new N.array.constructor(N.count*N.itemSize),N.itemSize,N.normalized);let C=e.morphAttributes[w];C&&(u[w]||(u[w]=[]),C.forEach((R,E)=>{let P=new R.array.constructor(R.count*R.itemSize);u[w][E]=new R.constructor(P,R.itemSize,R.normalized)}))}let m=t*.5,g=Math.log10(1/t),y=Math.pow(10,g),b=m*y;for(let S=0;S\\u003ca;S++){let T=i?i.getX(S):S,w=\\\"\\\";for(let N=0,C=o.length;N\\u003cC;N++){let R=o[N],E=e.getAttribute(R),P=E.itemSize;for(let I=0;I\\u003cP;I++)w+=`${~~(E[d[I]](T)*y+b)},`}if(w in r)h.push(r[w]);else{for(let N=0,C=o.length;N\\u003cC;N++){let R=o[N],E=e.getAttribute(R),P=e.morphAttributes[R],I=E.itemSize,O=l[R],L=u[R];for(let X=0;X\\u003cI;X++){let z=d[X],H=c[X];if(O[H](n,E[z](T)),P)for(let ue=0,ne=P.length;ue\\u003cne;ue++)L[ue][H](n,P[ue][z](T))}}r[w]=n,h.push(n),n++}}let v=e.clone();for(let S in e.attributes){let T=l[S];if(v.setAttribute(S,new T.constructor(T.array.slice(0,n*T.itemSize),T.itemSize,T.normalized)),S in u)for(let w=0;w\\u003cu[S].length;w++){let N=u[S][w];v.morphAttributes[S][w]=new N.constructor(N.array.slice(0,n*N.itemSize),N.itemSize,N.normalized)}}return v.setIndex(h),v}function z5(e,t=Math.PI/3){let r=e.index?e.toNonIndexed():e,i=r.attributes.position,s=i.count,a;if(i.isBufferAttribute===!0&&i.itemSize===3&&i.normalized===!1)a=i.array;else{a=new Float64Array(s*3);for(let w=0;w\\u003cs;w++)a[3*w+0]=i.getX(w),a[3*w+1]=i.getY(w),a[3*w+2]=i.getZ(w)}let n=Math.cos(t),o=(1+1e-10)*100,l=s/3,u=new Float64Array(l*3);for(let w=0;w\\u003cl;w++){let N=9*w,C=a[N+0],R=a[N+1],E=a[N+2],P=a[N+3],I=a[N+4],O=a[N+5],L=a[N+6],X=a[N+7],z=a[N+8],H=L-P,ue=X-I,ne=z-O,re=C-P,ce=R-I,ge=E-O,ye=ue*ge-ne*ce,oe=ne*re-H*ge,Ae=H*ce-ue*re,Ie=1/(Math.sqrt(ye*ye+oe*oe+Ae*Ae)||1);u[3*w+0]=ye*Ie,u[3*w+1]=oe*Ie,u[3*w+2]=Ae*Ie}let h=new Int32Array(s),d=new Int32Array(s*3),c=1;for(;c\\u003cs*2;)c\\u003c\\u003c=1;let m=c-1,g=new Int32Array(c),y=0;for(let w=0;w\\u003cs;w++){let N=3*w,C=~~(a[N+0]*o),R=~~(a[N+1]*o),E=~~(a[N+2]*o),P=(Math.imul(C,73856093)^Math.imul(R,19349663)^Math.imul(E,83492791))&m;for(;;){let I=g[P];if(I===0){let L=3*y;d[L+0]=C,d[L+1]=R,d[L+2]=E,g[P]=y+1,h[w]=y++;break}let O=3*(I-1);if(d[O+0]===C&&d[O+1]===R&&d[O+2]===E){h[w]=I-1;break}P=P+1&m}}let b=new Int32Array(y+1);for(let w=0;w\\u003cs;w++)b[h[w]+1]++;for(let w=0;w\\u003cy;w++)b[w+1]+=b[w];let v=new Int32Array(s),S=b.slice(0,y);for(let w=0;w\\u003cl;w++){let N=3*w;v[S[h[N+0]]++]=w,v[S[h[N+1]]++]=w,v[S[h[N+2]]++]=w}let T=new Float32Array(s*3);for(let w=0;w\\u003cl;w++){let N=3*w,C=u[N+0],R=u[N+1],E=u[N+2];for(let P=0;P\\u003c3;P++){let I=N+P,O=h[I],L=0,X=0,z=0;for(let ue=b[O],ne=b[O+1];ue\\u003cne;ue++){let re=3*v[ue],ce=u[re+0],ge=u[re+1],ye=u[re+2];C*ce+R*ge+E*ye>n&&(L+=ce,X+=ge,z+=ye)}let H=1/(Math.sqrt(L*L+X*X+z*z)||1);T[3*I+0]=L*H,T[3*I+1]=X*H,T[3*I+2]=z*H}}return r.setAttribute(\\\"normal\\\",new _i(T,3,!1)),r}var Jae={width:2.6,depth:.22,bevelThickness:.06,bevelSize:.05,bevelOffset:0,bevelSegments:5,curveSegments:24,cornerRadius:.03,creaseAngle:40,sdfRes:64};function V5(e,t){e=e.filter((a,n)=>n===0||a.distanceToSquared(e[n-1])>1e-18),e.length>1&&e[0].distanceToSquared(e[e.length-1])\\u003c1e-18&&(e=e.slice(0,-1));let r=e.length,i=new po;if(t\\u003c=0||r\\u003c3){i.moveTo(e[0].x,e[0].y);for(let a=1;a\\u003cr;a++)i.lineTo(e[a].x,e[a].y);return i.closePath(),i}let s=[];for(let a=0;a\\u003cr;a++){let n=e[a],o=e[(a-1+r)%r],l=e[(a+1)%r],u=o.clone().sub(n),h=l.clone().sub(n),d=u.length(),c=h.length();if(d\\u003c1e-9||c\\u003c1e-9)continue;let m=Math.acos(Bt.clamp(u.dot(h)/(d*c),-1,1))\\u003cBt.degToRad(168),g=Math.min(t,d*.45,c*.45);s.push({a:n.clone().addScaledVector(u.normalize(),m?g:0),c:n,b:n.clone().addScaledVector(h.normalize(),m?g:0),sharp:m})}return s.forEach((a,n)=>{n===0?i.moveTo(a.a.x,a.a.y):i.lineTo(a.a.x,a.a.y),a.sharp&&i.quadraticCurveTo(a.c.x,a.c.y,a.b.x,a.b.y)}),i.closePath(),i}async function Qae(e,t={}){let r={...Jae,...t},i=await fetch(e).then(d=>d.ok?d.text():Promise.reject(new Error(\\\"no logo\\\"))),s=new k5().parse(i),a=[];for(let d of s.paths)a.push(...d.toShapes(!0));if(!a.length)return[];let n=new ob;for(let d of a)for(let c of d.getPoints(8))n.expandByPoint(c);let o=n.getSize(new fe),l=n.getCenter(new fe),u=r.width/Math.max(o.x,o.y),h=d=>new fe((d.x-l.x)*u,-(d.y-l.y)*u);return a.map(d=>{let c=new cp(d.getPoints(r.curveSegments).map(h));return c.holes=d.holes.map(m=>new po(m.getPoints(r.curveSegments).map(h))),c})}function G5(e,t,r){let i=t.cornerRadius*r,s=L5(e,t.curveSegments).map(l=>{let u=V5(l.getPoints(t.curveSegments),i),h=new cp(u.getPoints(t.curveSegments));return h.holes=l.holes.map(d=>V5(d.getPoints(t.curveSegments),i)),h}),a=L5(s,t.curveSegments),n=t.bevelThickness>0||t.bevelSize>0,o=new wO(a,{depth:t.depth*r,bevelEnabled:n,bevelThickness:t.bevelThickness*r,bevelSize:t.bevelSize*r,bevelOffset:t.bevelOffset*r,bevelSegments:Math.max(1,Math.round(t.bevelSegments)),curveSegments:Math.max(2,Math.round(t.curveSegments))});if(o.center(),o=U5(o,1e-5),o=z5(o,Bt.degToRad(t.creaseAngle)),o.computeBoundingBox(),t.bevelThickness>0&&t.bevelSize>0){let l=o.getAttribute(\\\"position\\\"),u=o.getAttribute(\\\"normal\\\"),{min:h,max:d}=o.boundingBox,c=Math.max((d.z-h.z)*1e-6,1e-8);for(let m=0;m\\u003cl.count;m++){let g=l.getZ(m);Math.abs(g-h.z)\\u003c=c?u.setXYZ(m,0,0,-1):Math.abs(g-d.z)\\u003c=c&&u.setXYZ(m,0,0,1)}u.needsUpdate=!0}return o}function Fm(e){e.boundingBox||e.computeBoundingBox();let t=new F;return e.boundingBox.getSize(t).multiplyScalar(.5),t}function F1(e,t,r,i,s=r){let a=r,n={value:s},o=new T4(e,t,t,t);return o.format=io,o.type=Er,o.minFilter=o.magFilter=lr,o.wrapS=o.wrapT=o.wrapR=Ti,o.needsUpdate=!0,{texture:o,res:t,bound:r,range:a,thickness:i,data:e,sample:(l,u,h)=>{let d=n.value,c=(l/(2*d)+.5)*t-.5,m=(u/(2*d)+.5)*t-.5,g=(h/(2*d)+.5)*t-.5,y=Math.max(0,Math.min(t-2,Math.floor(c))),b=Math.max(0,Math.min(t-2,Math.floor(m))),v=Math.max(0,Math.min(t-2,Math.floor(g))),S=Math.max(0,Math.min(1,c-y)),T=Math.max(0,Math.min(1,m-b)),w=Math.max(0,Math.min(1,g-v)),N=(z,H,ue)=>e[z+H*t+ue*t*t],C=N(y,b,v)*(1-S)+N(y+1,b,v)*S,R=N(y,b+1,v)*(1-S)+N(y+1,b+1,v)*S,E=N(y,b,v+1)*(1-S)+N(y+1,b,v+1)*S,P=N(y,b+1,v+1)*(1-S)+N(y+1,b+1,v+1)*S,I=C*(1-T)+R*T,O=E*(1-T)+P*T,L=Math.abs(l)>d||Math.abs(u)>d||Math.abs(h)>d,X=(I*(1-w)+O*w)*2*a-a;return L?Math.max(X,Math.hypot(Math.max(Math.abs(l)-d,0),Math.max(Math.abs(u)-d,0),Math.max(Math.abs(h)-d,0))):X},sampleDomain:n}}function Kae(e,t,r,i=t){let s=Fm(e),a=Math.min(s.x,s.y,s.z),n=new M1(e),o=Math.max(16,Math.round(r)),l=new Float32Array(o*o*o),u=new F,h=t,d=2*i/o,c=Math.min(h,Math.max(a*2.5,d*14)),m=e.boundingBox,g=c*c,y={},b=new ld(new F,new F(0,0,1)),v=new Uint8Array(o);for(let S=0;S\\u003co;S++)for(let T=0;T\\u003co;T++){let w=((T+.5)/o-.5)*2*i+d*.013,N=((S+.5)/o-.5)*2*i+d*.017;b.origin.set(w,N,-i-1);let C=n.raycast(b,hs).map(P=>({z:P.distance-i-1,delta:P.face.normal.z\\u003c0?1:-1})).sort((P,I)=>P.z-I.z),R=0,E=0;for(let P=0;P\\u003co;P++){let I=((P+.5)/o-.5)*2*i;for(;R\\u003cC.length&&C[R].z\\u003cI;)E+=C[R++].delta;v[P]=+(E!==0)}for(let P=0;P\\u003co;P++){u.set(((T+.5)/o-.5)*2*i,((S+.5)/o-.5)*2*i,((P+.5)/o-.5)*2*i);let I=Math.max(m.min.x-u.x,0,u.x-m.max.x),O=Math.max(m.min.y-u.y,0,u.y-m.max.y),L=Math.max(m.min.z-u.z,0,u.z-m.max.z),X=I*I+O*O+L*L>g?null:n.closestPointToPoint(u,y,0,c),z=X?X.distance:h;v[P]&&(z=-z),l[T+S*o+P*o*o]=Math.min(1,Math.max(0,(z+h)/(2*h)))}}return F1(l,o,t,a,i)}var{Fn:ene,instanceIndex:tne,uint:L1,vec3:k1,float:W5,If:rne,dot:ine,max:j5,instancedArray:sne,uniform:ane}=Jr;async function nne(e,t,r,i,s){let a=performance.now(),n=Fm(t),o=Math.min(n.x,n.y,n.z),l=Math.max(16,Math.round(i)),u=r,h=2*s/l,d=Math.min(u,Math.max(o*2.5,h*14)),c=new M1(t);t.boundsTree=c;let m=new $ae(t);m.update();let g=performance.now(),y=Pi`\\n fn frostClosest(p:vec3f,cap:f32)->f32 {\\n var hit:${Em};\\n hit.found=true; hit.distanceSq=cap*cap;\\n let found=${m.fns.closestPointToPoint}(p,&hit);\\n return select(-1.0,sqrt(hit.distanceSq),found);\\n }`,b=sne(l*l*l,\\\"float\\\"),v=ane(0,\\\"uint\\\"),S=t.boundingBox,T=k1(S.min.x,S.min.y,S.min.z),w=k1(S.max.x,S.max.y,S.max.z),N=8,C=l*l*N,R=ene(()=>{let re=tne.add(v),ce=re.mod(L1(l)),ge=re.div(L1(l)).mod(L1(l)),ye=re.div(L1(l*l)),oe=k1(ce,ge,ye).add(.5).div(l).sub(.5).mul(2*s).toVar(),Ae=j5(j5(T.sub(oe),oe.sub(w)),k1(0)),Ie=W5(-1).toVar();rne(ine(Ae,Ae).lessThanEqual(d*d),()=>{Ie.assign(y(oe,W5(d)))}),b.element(re).assign(Ie)})().compute(C,[64]);for(let re=0;re\\u003cl*l*l;re+=C)v.value=re,e.compute(R),await e.backend.device.queue.onSubmittedWorkDone();let E=new Float32Array(await e.getArrayBufferAsync(b.value)),P=performance.now(),I=0,O=0,L=0,X=0,z=173,H=new F;for(let re=0;re\\u003c2048;re++){z=Math.imul(z,1664525)+1013904223>>>0;let ce=z%(l*l*l),ge=ce%l,ye=Math.floor(ce/l)%l,oe=Math.floor(ce/(l*l));H.set(((ge+.5)/l-.5)*2*s,((ye+.5)/l-.5)*2*s,((oe+.5)/l-.5)*2*s);let Ae=c.closestPointToPoint(H,{},0,d);if(Ae&&Ae.distance\\u003c=d&&E[ce]>=0){let Ie=Math.abs(Ae.distance-E[ce]);I=Math.max(I,Ie),O+=Ie*Ie,L++}else!!(Ae&&Ae.distance\\u003c=d)!=E[ce]>=0&&X++}let ue=new ld(new F,new F(0,0,1));for(let re=0;re\\u003cl;re++)for(let ce=0;ce\\u003cl;ce++){let ge=((ce+.5)/l-.5)*2*s+h*.013,ye=((re+.5)/l-.5)*2*s+h*.017;ue.origin.set(ge,ye,-s-1);let oe=c.raycast(ue,hs).map(Xe=>({z:Xe.distance-s-1,delta:Xe.face.normal.z\\u003c0?1:-1})).sort((Xe,at)=>Xe.z-at.z),Ae=0,Ie=0;for(let Xe=0;Xe\\u003cl;Xe++){let at=((Xe+.5)/l-.5)*2*s;for(;Ae\\u003coe.length&&oe[Ae].z\\u003cat;)Ie+=oe[Ae++].delta;let W=ce+re*l+Xe*l*l,j=E[W]>=0?E[W]:u;Ie!==0&&(j=-j),E[W]=Math.min(1,Math.max(0,(j+u)/(2*u)))}}let ne=performance.now();return th.sdf.push({n:l,triangles:t.index.count/3,packMs:g-a,gpuMs:P-g,signMs:ne-P,totalMs:ne-a,audit:{samples:2048,compared:L,maxDistanceError:I,rmsDistanceError:Math.sqrt(O/Math.max(1,L)),missing:X}}),m.dispose(),b.value.dispose(),R.dispose(),F1(E,l,r,o,s)}var{Fn:one,vec3:lne,vec4:H5,float:k0e,uint:D1,uniform:O1,instanceIndex:une,uvec3:hne,ivec3:D0e,texture3D:dne,textureStore:cne,dot:X5,abs:pne}=Jr,mne=class{constructor(e,t,r,i=128){this.renderer=e,this.bound=t,this.seed=r,this.res=i;for(let s=0;s\\u003c2;s++){let a=new d_(i,i,i);a.type=Er,a.format=pi,a.minFilter=a.magFilter=or;let n=O1(new F),o=O1(1),l=O1(.5),u=O1(r+s*7),h=one(()=>{let d=une,c=hne(d.mod(D1(i)),d.div(D1(i)).mod(D1(i)),d.div(D1(i*i))),m=lne(c).add(.5).div(i).sub(.5).mul(o.mul(2)).add(n).toVar(),g=bm(m,u,l).toVar();cne(a,c,H5(g.xyz,X5(g.xyz,m).add(g.w))).toWriteOnly()})().compute(i**3,[64]);this.entries.push({tex:a,center:n,extent:o,coverage:l,s:u,kernel:h})}this.update()}signature=\\\"\\\";entries=[];update(){let e=le.ice.cracks,t=JSON.stringify([e.largeScale,e.fineScale,e.warp,e.coverage,e.fineCoverage,this.seed]);if(t===this.signature)return;this.signature=t;let r=new F(this.seed*.731,this.seed*.137,this.seed*.529),i=e.fineScale/e.largeScale,s=this.entries[0],a=this.entries[1];s.center.value.copy(r).multiplyScalar(.37),s.extent.value=this.bound*e.largeScale+Math.abs(e.warp)*2+.1,s.coverage.value=e.coverage,a.center.value.copy(s.center.value).multiplyScalar(i).add(r),a.extent.value=s.extent.value*i,a.coverage.value=e.fineCoverage;for(let n of this.entries)this.renderer.compute(n.kernel);th.materialPlanes={res:this.res,bytes:2*this.res**3*16,builds:(th.materialPlanes?.builds||0)+1}}sample(e,t=!1){let r=this.entries[+t],i=e.sub(r.center).div(r.extent.mul(2)).add(.5),s=dne(r.tex).sample(i).level(0).toVar();return H5(s.xyz,pne(s.w.sub(X5(s.xyz,e))))}dispose(){for(let e of this.entries)e.tex.dispose(),e.kernel.dispose()}},{pass:fne,mrt:gne,vec4:$5,positionLocal:yne,normalLocal:xne}=Jr;function vne(e,t){let r=new bg,i=new Pd;i.side=Cs,i.toneMapped=!1;let s=new Mi(e,i);s.frustumCulled=!1,s.matrixAutoUpdate=!1,r.add(s);let a=fne(r,t,{type:Er,samples:0});a.setMRT(gne({output:$5(yne,1),normal:$5(xne,0)}));let n=a.getTextureNode(\\\"output\\\"),o=a.getTextureNode(\\\"normal\\\"),l=a.getTextureNode(\\\"depth\\\");for(let u of[\\\"output\\\",\\\"normal\\\"]){let h=a.getTexture(u);h.minFilter=h.magFilter=or,h.generateMipmaps=!1}return{surfacePass:a,position:n,normal:o,depth:l,mesh:s,material:i,update(u,h){s.geometry=u.geometry,s.matrix.copy(u.matrixWorld),s.matrixWorld.copy(u.matrixWorld),s.visible=u.visible,a.setResolutionScale(h)},dispose(){a.dispose(),i.dispose()}}}function bne(e,t=1024){let r=new Float32Array(t*t*4),i=e.image.data,s=e.image.width,a=e.image.height,n=le.ice,o=n.ior,l=((o-1)/(o+1))**2,u=new gt(n.attenuationColor),h=[u.r,u.g,u.b],d=(m,g,y,b)=>{let v=((Math.atan2(y,m)/(2*Math.PI)+.5)%1+1)%1,S=Math.asin(Math.max(-1,Math.min(1,g)))/Math.PI+.5,T=v*s-.5,w=S*a-.5,N=Math.floor(T),C=Math.floor(w),R=T-N,E=w-C,P=(I,O)=>i[(Math.max(0,Math.min(a-1,O))*s+(I+s)%s)*4+b];return(P(N,C)*(1-R)+P(N+1,C)*R)*(1-E)+(P(N,C+1)*(1-R)+P(N+1,C+1)*R)*E};for(let m=0;m\\u003ct;m++)for(let g=0;g\\u003ct;g++){let y=(g+.5)/t*2-1,b=(m+.5)/t*2-1,v=y*y+b*b;if(v>=1){let ce=.99999/Math.sqrt(v);y*=ce,b*=ce}let S=Math.sqrt(Math.max(1e-8,1-y*y-b*b)),T=1/o,w=T*S-Math.sqrt(1-T*T*(1-S*S)),N=w*y,C=w*b,R=-T+w*S,E=-2*(y*N+b*C+S*R),P=y+N*E,I=b+C*E,O=S+R*E,L=N*P+C*I+R*O,X=1-o*o*(1-L*L),z=l+(1-l)*(1-S)**5,H=o*L-Math.sqrt(Math.max(0,X)),ue=o*N-H*P,ne=o*C-H*I,re=o*R-H*O;for(let ce=0;ce\\u003c3;ce++){let ge=Math.pow(h[ce],E*n.thicknessScale/Math.max(n.attenuationDistance,.01));r[(g+m*t)*4+ce]=d(2*S*y,2*S*b,2*S*S-1,ce)*z+d(ue,ne,re,ce)*(1-z)*(n.backlight??.4)*ge}r[(g+m*t)*4+3]=1}let c=new kg(r,t,t,pi,Er);return c.colorSpace=Xh,c.minFilter=c.magFilter=lr,c.needsUpdate=!0,c}var ta={t:0,dt:.016666666666666666,frame:0,paused:!1,stepRequested:!1,_last:performance.now()/1e3,tick(e=performance.now()/1e3){let t=Math.min(.05,Math.max(0,e-this._last));if(this._last=e,this.paused&&!this.stepRequested){this.dt=0;return}this.stepRequested=!1,this.dt=this.paused?.016666666666666666:t,this.t+=this.dt,this.frame++}},Oo=(e,t,r,i)=>r\\u003c=0?t:e+(t-e)*(1-Math.exp(-i/r));function Lm(e){let t=e*1664525+1013904223>>>0;return()=>{t=t+1831565813>>>0;let r=t;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),((r^r>>>14)>>>0)/4294967296}}var{Fn:Tne,vec2:U1,vec3:q5,vec4:Sne,float:O0e,uniform:ql,screenUV:Y5,screenSize:Z5,mix:J5,pow:_ne,smoothstep:dw,fract:U0e,sin:wne,dot:Mne,length:Q5,max:Nne}=Jr;function z1(e,t){let r=Z5.x.div(Z5.y),i=U1(t.x.sub(e.uCenter.x).mul(r),t.y.sub(e.uCenter.y)),s=Q5(i).div(e.uRadius),a=_ne(dw(0,1,s),e.uFalloff),n=dw(0,1,t.y.oneMinus().mul(1.15)),o=dw(.35,1.3,Q5(U1(t.x.sub(.5).mul(r),t.y.sub(.5)))),l=J5(e.uTop,e.uMid,a);return J5(l,e.uBottom,n.mul(o).mul(.85))}function Ane(){let e=ql(new gt(\\\"#2a2a2a\\\")),t=ql(new gt(\\\"#050505\\\")),r=ql(new gt(\\\"#030303\\\")),i=ql(new fe(.5,1.02)),s=ql(.55),a=ql(1.6),n=ql(1),o=ql(0),l={uTop:e,uMid:t,uBottom:r,uCenter:i,uRadius:s,uFalloff:a,uNoise:n,uTime:o};return{node:Tne(()=>{let u=z1(l,Y5).toVar(),h=Y5,d=Po(q5(h.mul(U1(37,21)),o.mul(.37))),c=wne(Mne(h,U1(5.3,7.1)).add(o.mul(.05))).mul(.5).add(.5).sub(.5).mul(1/255).mul(n).add(d.sub(.5).mul(1/255).mul(n));return Sne(Nne(u.add(q5(c)),0),1)})(),uniforms:l}}function Cne(e=1024,t=512){let r=new Float32Array(e*t*4),i=new kg(r,e,t,pi,Er);i.mapping=kf,i.colorSpace=Xh,i.wrapS=to,i.wrapT=Ti,i.minFilter=i.magFilter=lr;let s=(o,l,u)=>{let h=Math.max(0,Math.min(1,(u-o)/(l-o)));return h*h*(3-2*h)},a=Array.from({length:e*t},(o,l)=>{let u=(l%e+.5)/e,h=(Math.floor(l/e)+.5)/t,d=(u-.5)*Math.PI*2,c=(h-.5)*Math.PI;return new F(Math.cos(c)*Math.cos(d),Math.sin(c),Math.cos(c)*Math.sin(d))});function n(o){let l=(c,m,g,y,b,v)=>{let S=Bt.degToRad(g),T=Bt.degToRad(y),w=new F(Math.cos(S)*Math.sin(T),Math.sin(S),Math.cos(S)*Math.cos(T)),N=new F().crossVectors(new F(0,1,0),w).normalize(),C=new F().crossVectors(w,N);return{color:new gt(c),power:m,normal:w,right:N,up:C,w:b,h:v}},u=[l(o.key.color,o.envSoftbox*5,o.key.elevation,o.key.azimuth,.42*o.key.size,.65*o.key.size),l(o.rimColor,o.envRim*6,o.rimElevation,o.rimAzimuth,.1*o.rimSize,.9*o.rimSize),l(o.accentCool.color,o.accentCool.reflection*4,o.accentCool.elevation,o.accentCool.azimuth,.13*o.accentCool.size,.75*o.accentCool.size),l(o.accentWarm.color,o.accentWarm.reflection*4,o.accentWarm.elevation,o.accentWarm.azimuth,.2*o.accentWarm.size,.7*o.accentWarm.size)],h=new gt(o.fillColor),d=new gt(o.fillGroundColor);a.forEach((c,m)=>{let g=s(-.3,.8,c.y),y=o.envFill*.055,b=(d.r*(1-g)+h.r*g)*y,v=(d.g*(1-g)+h.g*g)*y,S=(d.b*(1-g)+h.b*g)*y;for(let T of u){let w=c.dot(T.normal);if(w\\u003c=0)continue;let N=Math.abs(c.dot(T.right)/w),C=Math.abs(c.dot(T.up)/w),R=(1-s(T.w*.45,T.w,N))*(1-s(T.h*.45,T.h,C)),E=T.power*R;b+=T.color.r*E,v+=T.color.g*E,S+=T.color.b*E}r.set([b,v,S,1],m*4)}),i.needsUpdate=!0,i.needsPMREMUpdate=!0}return{texture:i,update:n}}var Rne=class{key=new $g(16777215,3);fill=new EN(16777215,0,.2);rim=new Xg(16777215,1,0,Math.PI/3,1,0);accentCool=new $g(13098495,.35);accentWarm=new $g(16768964,.22);group=new pn;mapSize=0;settingsVersion=-1;constructor(){this.key.castShadow=!0,this.key.shadow.camera.left=-5.5,this.key.shadow.camera.right=5.5,this.key.shadow.camera.top=5.5,this.key.shadow.camera.bottom=-5.5,this.key.shadow.camera.near=2,this.key.shadow.camera.far=30,this.key.target.position.set(0,0,0),this.rim.target.position.set(0,0,0),this.group.add(this.key,this.key.target,this.fill,this.rim,this.rim.target,this.accentCool,this.accentCool.target,this.accentWarm,this.accentWarm.target)}update(e,t){let r=le.lighting,i=Math.sin(e*2*Math.PI/Math.max(1,r.sway.period))*r.sway.amplitude,s=Math.sin(e*2*Math.PI/Math.max(1,r.sway.period)*.61+.8)*r.sway.amplitude,a=Bt.degToRad(r.key.elevation+s*40),n=Bt.degToRad(r.key.azimuth+i*60),o=12;this.key.position.set(Math.cos(a)*Math.sin(n)*o,Math.sin(a)*o,Math.cos(a)*Math.cos(n)*o),this.key.intensity=r.key.intensity*(1+r.key.hoverBoost*t);let l=Bt.degToRad(r.rimElevation),u=Bt.degToRad(r.rimAzimuth??180);this.rim.position.set(Math.cos(l)*Math.sin(u)*10,Math.sin(l)*10,Math.cos(l)*Math.cos(u)*10);for(let[h,d]of[[this.accentCool,r.accentCool],[this.accentWarm,r.accentWarm]]){if(!d)continue;let c=Bt.degToRad(d.elevation),m=Bt.degToRad(d.azimuth);h.position.set(Math.cos(c)*Math.sin(m)*12,Math.sin(c)*12,Math.cos(c)*Math.cos(m)*12),h.color.set(d.color),h.intensity=d.intensity}if(le.version!==this.settingsVersion){this.settingsVersion=le.version,this.key.color.set(r.key.color),this.fill.intensity=r.fill,this.fill.color.set(r.fillColor),this.fill.groundColor.set(r.fillGroundColor),this.rim.color.set(r.rimColor),this.rim.intensity=r.rim*40,this.rim.angle=Bt.degToRad(r.rimAngle??65),this.rim.penumbra=1,this.rim.decay=1.2,this.rim.distance=60;let h=this.key.shadow;h.radius=r.shadow.softness,h.blurSamples=Math.round(r.shadow.samples),h.bias=r.shadow.bias,h.intensity=r.shadow.intensity;let d=parseInt(r.shadow.mapSize,10);d!==this.mapSize&&(this.mapSize=d,h.mapSize.set(d,d),h.map&&(h.map.dispose(),h.map=null),h.needsUpdate=!0)}}},K5=class{yaw=0;pitch=0;parYaw=0;parPitch=0;idleBlend=0;lookAt=new F;base=new F;spherical=new gU;update(e,t,r,i){let s=Ht.enabled&&Ht.framing,a=le.camera,n=s?Ht:a,o=r-Ui.lastMoveT>a.idleDelay;this.idleBlend=Oo(this.idleBlend,o?1:0,o?1.5:.6,i);let l=Ui.inside?Ui.x:0,u=Ui.inside?Ui.y:0,h=2*Math.PI/Math.max(1,a.idlePeriod),d=Math.sin(r*h)*a.idleAmplitude,c=Math.sin(r*h*1.37+1.1)*a.idleAmplitude*.5,m=Bt.degToRad(n.baseYaw+Bt.lerp(l*n.rotateYaw,d,this.idleBlend)),g=Bt.degToRad(n.basePitch+Bt.lerp(-u*n.rotatePitch,c,this.idleBlend));this.yaw=Oo(this.yaw,m,a.rotationLag*.35,i),this.pitch=Oo(this.pitch,g,a.rotationLag*.35,i),t.rotation.set(this.pitch,this.yaw,0,\\\"YXZ\\\");let y=Bt.degToRad(n.parallaxRange);if(this.parYaw=Oo(this.parYaw,-l*y,a.parallaxSmoothing*.35,i),this.parPitch=Oo(this.parPitch,u*y*.6,a.parallaxSmoothing*.35,i),this.lookAt.set(s?Ht.lookAtX:0,n.lookAtY,0),Ht.cameraOverride){Ht.cameraOverride(e);return}let b=this.base.set(0,n.height,n.distance).sub(this.lookAt),v=this.spherical.setFromVector3(b);v.theta+=this.parYaw,v.phi=Bt.clamp(v.phi+this.parPitch,.1,Math.PI-.1),e.position.setFromSpherical(v).add(this.lookAt),e.lookAt(this.lookAt),e.fov!==n.fov&&(e.fov=n.fov,e.updateProjectionMatrix())}},{Fn:z0e,vec2:Ene,vec3:lh,float:Pne,length:hc,max:Za,min:Bne,abs:V1,dot:Ine,sqrt:V0e,clamp:G0e,sign:W0e,select:Fne,texture3D:Lne}=Jr,eI=(()=>{let e=(1+Math.sqrt(5))/2,t=[],r=(i,s,a)=>{let n=Math.hypot(i,s,a);t.push([i/n,s/n,a/n])};for(let i of[-1,1])for(let s of[-1,1])for(let a of[-1,1])r(i,s,a);for(let i of[-1,1])for(let s of[-1,1])r(0,i/e,s*e),r(i/e,s*e,0),r(i*e,0,s/e);return t})();function cw(e,t,r,i){let s=t,a=t*r;switch(e){case\\\"torus\\\":return{name:e,size:t,tubeRatio:r,bound:(s+a)*1.12,thickness:a,sdf:(n,o,l)=>{let u=Math.hypot(n,o)-s;return Math.hypot(u,l)-a},sdfNode:n=>hc(Ene(hc(n.xy).sub(s),n.z)).sub(a)};case\\\"sphere\\\":{let n=t*1.15;return{name:e,size:t,tubeRatio:r,bound:n*1.15,thickness:n,sdf:(o,l,u)=>Math.hypot(o,l,u)-n,sdfNode:o=>hc(o).sub(n)}}case\\\"roundedBox\\\":{let n=t*.92,o=t*.22;return{name:e,size:t,tubeRatio:r,bound:(n+o)*1.12,thickness:n,sdf:(l,u,h)=>{let d=Math.abs(l)-n+o,c=Math.abs(u)-n+o,m=Math.abs(h)-n*.55+o,g=Math.max(d,0),y=Math.max(c,0),b=Math.max(m,0);return Math.hypot(g,y,b)+Math.min(Math.max(d,c,m),0)-o},sdfNode:l=>{let u=V1(l).sub(lh(n-o,n-o,n*.55-o));return hc(Za(u,0)).add(Bne(Za(u.x,Za(u.y,u.z)),0)).sub(o)}}}case\\\"pyramid\\\":{let n=t*1.05,o=t*1.5,l=t*.06,u=n/Math.hypot(n,o),h=o/Math.hypot(n,o),d=-o*.4;return{name:e,size:t,tubeRatio:r,bound:Math.max(n,o)*1.25,thickness:n*.6,sdf:(c,m,g)=>{m-=d;let y=Math.abs(c),b=Math.abs(g),v=Math.max(y*h+m*u-o*u,b*h+m*u-o*u),S=-m;return Math.max(v,S)-l},sdfNode:c=>{let m=lh(c.x,c.y.sub(d),c.z),g=V1(m.x),y=V1(m.z),b=Za(g.mul(h).add(m.y.mul(u)).sub(o*u),y.mul(h).add(m.y.mul(u)).sub(o*u));return Za(b,m.y.negate()).sub(l)}}}case\\\"icosahedron\\\":{let n=t*1.05,o=t*.05;return{name:e,size:t,tubeRatio:r,bound:n*1.3,thickness:n*.8,sdf:(l,u,h)=>{let d=-1/0;for(let c of eI)d=Math.max(d,l*c[0]+u*c[1]+h*c[2]);return d-n-o},sdfNode:l=>{let u=Pne(-100);for(let h of eI)u=Za(u,Ine(l,lh(h[0],h[1],h[2])));return u.sub(n+o)}}}case\\\"logo\\\":{let n=i,o=t,l=n.sampleBoundNode??=Jr.uniform(n.sampleDomain.value);return{name:e,size:t,tubeRatio:r,bound:n.bound*o,thickness:n.thickness*o,voxelSize:l.mul(2*o/n.res),sdf:(u,h,d)=>n.sample(u/o,h/o,d/o)*o,sdfNode:u=>{let h=l.mul(o),d=u.div(h.mul(2)).add(.5),c=Lne(n.texture,d).r.mul(n.range*2).sub(n.range).mul(o),m=Za(V1(u).sub(h),0);return Fne(Za(m.x,Za(m.y,m.z)).greaterThan(0),Za(c,hc(m)),c)}}}}}function tI(e,t,r,i,s=.001){let a=e.sdf(t+s,r,i)-e.sdf(t-s,r,i),n=e.sdf(t,r+s,i)-e.sdf(t,r-s,i),o=e.sdf(t,r,i+s)-e.sdf(t,r,i-s),l=Math.hypot(a,n,o)||1;return[a/l,n/l,o/l]}var G1=(e,t,r=.002)=>{let i=lh(r,0,0),s=lh(0,r,0),a=lh(0,0,r),n=lh(e.sdfNode(t.add(i)).sub(e.sdfNode(t.sub(i))),e.sdfNode(t.add(s)).sub(e.sdfNode(t.sub(s))),e.sdfNode(t.add(a)).sub(e.sdfNode(t.sub(a))));return n.div(Za(hc(n),1e-6))};function kne(e,t,r,i=60,s){let a=0,n=t.x,o=t.y,l=t.z,u=!1;for(let m=0;m\\u003c160;m++){n=r.x*a+t.x,o=r.y*a+t.y,l=r.z*a+t.z;let g=e.sdf(n,o,l);if(g\\u003c.0015){u=!0;break}if(a+=Math.max(g,.002),a>i)break}if(!u)return null;let h=a,d=s??{entry:new F,exit:new F,tEntry:0,tExit:0};d.entry.set(n,o,l);let c=a+.004;for(let m=0;m\\u003c200;m++){n=r.x*c+t.x,o=r.y*c+t.y,l=r.z*c+t.z;let g=e.sdf(n,o,l);if(g>.0015||(c+=Math.max(-g,.004),c-a>e.bound*4))break}return d.exit.set(r.x*c+t.x,r.y*c+t.y,r.z*c+t.z),d.tEntry=h,d.tExit=c,d}function rI(e,t,r,i,s,a){let n=new Float32Array(t*3),o=new Float32Array(t),l=a?a[0]:e.bound,u=a?a[1]:e.bound,h=a?a[2]:e.bound,d=e.bound,c=e.thickness*i,m=Math.round(t*r),g=0,y=0;for(;g\\u003ct&&y\\u003ct*400;){y++;let b=(s()*2-1)*l,v=(s()*2-1)*u,S=(s()*2-1)*h,T=e.sdf(b,v,S);if(T>=0)continue;let w=-T,N=g\\u003cm;y\\u003ct*60&&(N&&w>c||!N&&w\\u003c=c)||(n[g*3]=b,n[g*3+1]=v,n[g*3+2]=S,o[g]=Math.min(1,w/e.thickness),g++)}if(g!==t)throw new Error(`Frost: sampled only ${g}/${t} interior homes; check shape bounds and SDF`);return{positions:n,depths:o,count:g}}function W1(e,t,r=4){let i=e.attributes.position,s=new Float32Array(i.count*3);for(let a=0;a\\u003ci.count;a++){let n=i.getX(a),o=i.getY(a),l=i.getZ(a);for(let h=0;h\\u003cr;h++){let d=t.sdf(n,o,l),c=tI(t,n,o,l);n-=c[0]*d,o-=c[1]*d,l-=c[2]*d}let u=tI(t,n,o,l,.004);i.setXYZ(a,n,o,l),s[a*3]=u[0],s[a*3+1]=u[1],s[a*3+2]=u[2]}return i.needsUpdate=!0,e.setAttribute(\\\"normal\\\",new _i(s,3)),e}function Dne(e,t,r){let i=e.size,s=e.size*e.tubeRatio;switch(e.name){case\\\"torus\\\":return new NN(i,s,Math.max(24,Math.round(t*.4)),t);case\\\"sphere\\\":return W1(new eb(1,t,Math.round(t*.6)),e,2);case\\\"roundedBox\\\":{let a=Math.max(8,Math.round(t/4)),n=e.size*.92,o=new Wv(2*n,2*n,2*n*.55,a,a,Math.max(4,Math.round(a*.55))),l=o.attributes.position;for(let u=0;u\\u003cl.count;u++){let h=l.getX(u),d=l.getY(u),c=l.getZ(u),m=Math.hypot(h,d,c)||1,g=.35;l.setXYZ(u,h*(1-g)+h/m*n*g,d*(1-g)+d/m*n*g,c*(1-g)+c/m*n*g)}return W1(o,e,6)}case\\\"pyramid\\\":{let a=new Gg(e.size*1.4,6);return W1(a,e,8)}case\\\"icosahedron\\\":{let a=new Gg(e.size*1.2,6);return W1(a,e,6)}case\\\"logo\\\":{let a=(r??new NN(i,s,64,t)).clone();return r?a.scale(e.size,e.size,e.size):a.computeVertexNormals(),a}}}function One(e,t,r=!1){let i=[];for(let s=0;s\\u003ce;s++){if(r){i.push(Une(s,t));continue}let a=s%3===2,n=a?new MN(1,1):new Gg(1,s%2),o=n.attributes.position,l=.7+t()*.6,u=.7+t()*.6,h=a?.35+t()*.3:.7+t()*.6,d=t()*100;for(let c=0;c\\u003co.count;c++){let m=o.getX(c),g=o.getY(c),y=o.getZ(c),b=1+.28*Math.sin(d+m*5.1+g*3.7)*Math.cos(d*.7+y*4.3+m*2.2);o.setXYZ(c,m*b*l,g*b*u,y*b*h)}n.computeVertexNormals(),i.push(n)}return i}function Une(e,t){let r=e%3,i=r===0?new Gg(1,0):r===1?new AO(1,0):new MN(1,0),s=i.attributes.position,a=.55+t()*.9,n=.55+t()*.9,o=.25+t()*.4,l=new Map;for(let h=0;h\\u003cs.count;h++){let d=s.getX(h),c=s.getY(h),m=s.getZ(h),g=`${d.toFixed(4)},${c.toFixed(4)},${m.toFixed(4)}`,y=l.get(g);y||(y=[(t()-.5)*.5,(t()-.5)*.5,(t()-.5)*.5],l.set(g,y)),s.setXYZ(h,(d+y[0])*a,(c+y[1])*n,(m+y[2])*o)}let u=i.index?i.toNonIndexed():i;return u.computeVertexNormals(),u}var pw=new Wa,iI=new fe,mw,zne=class extends rr{static get type(){return\\\"TRAANode\\\"}constructor(e,t,r,i){super(\\\"vec4\\\"),this.isTRAANode=!0,this.updateBeforeType=ut.FRAME,this.beautyNode=e,this.depthNode=t,this.velocityNode=r,this.camera=i,this.depthThreshold=5e-4,this.edgeDepthDiff=.001,this.maxVelocityLength=128,this.useSubpixelCorrection=!0,this._jitterIndex=0,this._invSize=Fr(new fe),this._historyRenderTarget=new er(1,1,{depthBuffer:!1,type:Dt,depthTexture:new fs}),this._historyRenderTarget.texture.name=\\\"TRAANode.history\\\",this._resolveRenderTarget=new er(1,1,{depthBuffer:!1,type:Dt}),this._resolveRenderTarget.texture.name=\\\"TRAANode.resolve\\\",this._resolveMaterial=new Pt,this._resolveMaterial.name=\\\"TRAA.resolve\\\",this._textureNode=Qu(this,this._resolveRenderTarget.texture),this._originalProjectionMatrix=new We,this._cameraNearFar=Fr(new fe),this._cameraWorldMatrix=Fr(new We),this._cameraWorldMatrixInverse=Fr(new We),this._cameraProjectionMatrixInverse=Fr(new We),this._previousCameraWorldMatrix=Fr(new We),this._previousCameraProjectionMatrixInverse=Fr(new We),this._previousDepthNode=Ri(new fs(1,1)),this._needsPostProcessingSync=!1,this._velocityNode=null}getTextureNode(){return this._textureNode}setSize(e,t){this._historyRenderTarget.setSize(e,t),this._resolveRenderTarget.setSize(e,t),this._invSize.value.set(1/e,1/t)}setViewOffset(e,t){this.camera.updateProjectionMatrix(),this._originalProjectionMatrix.copy(this.camera.projectionMatrix),this._velocityNode.setProjectionMatrix(this._originalProjectionMatrix);let r={fullWidth:e,fullHeight:t,offsetX:0,offsetY:0,width:e,height:t},i=aI[this._jitterIndex];this.camera.setViewOffset(r.fullWidth,r.fullHeight,r.offsetX+i[0]-.5,r.offsetY+i[1]-.5,r.width,r.height)}clearViewOffset(){this.camera.clearViewOffset(),this._velocityNode.setProjectionMatrix(null),this._jitterIndex++,this._jitterIndex=this._jitterIndex%(aI.length-1)}updateBefore(e){let{renderer:t}=e;this._previousCameraWorldMatrix.value.copy(this._cameraWorldMatrix.value),this._previousCameraProjectionMatrixInverse.value.copy(this._cameraProjectionMatrixInverse.value),this._cameraNearFar.value.set(this.camera.near,this.camera.far),this._cameraWorldMatrix.value.copy(this.camera.matrixWorld),this._cameraWorldMatrixInverse.value.copy(this.camera.matrixWorldInverse),this._cameraProjectionMatrixInverse.value.copy(this.camera.projectionMatrixInverse);let r=this.beautyNode.isRTTNode?this.beautyNode.renderTarget:this.beautyNode.passNode.renderTarget,i=r.texture.width,s=r.texture.height;this._needsPostProcessingSync===!0&&(this.setViewOffset(i,s),this._needsPostProcessingSync=!1),mw=Es.resetRendererState(t,mw);let a=this._historyRenderTarget.width!==i||this._historyRenderTarget.height!==s;this.setSize(i,s),a===!0&&(t.initRenderTarget(this._historyRenderTarget),t.initRenderTarget(this._resolveRenderTarget),t.copyTextureToTexture(r.texture,this._historyRenderTarget.texture)),t.setRenderTarget(this._resolveRenderTarget),pw.material=this._resolveMaterial,pw.name=\\\"TRAA\\\",pw.render(t),t.setRenderTarget(null),t.copyTextureToTexture(this._resolveRenderTarget.texture,this._historyRenderTarget.texture);let n=t.getDrawingBufferSize(iI);if(this._historyRenderTarget.height===n.height&&this._historyRenderTarget.width===n.width){let o=this.depthNode.value;t.copyTextureToTexture(o,this._historyRenderTarget.depthTexture),this._previousDepthNode.value=this._historyRenderTarget.depthTexture}Es.restoreRendererState(t,mw)}setup(e){let t=e.context.renderPipeline;t&&(this._needsPostProcessingSync=!0,t.context.onBeforeRenderPipeline=()=>{let c=e.renderer.getDrawingBufferSize(iI);this.setViewOffset(c.width,c.height)},t.context.onAfterRenderPipeline=()=>{this.clearViewOffset()}),e.renderer.reversedDepthBuffer===!0&&(this._historyRenderTarget.depthTexture.type=Er),e.context.velocity!==void 0?this._velocityNode=e.context.velocity:this._velocityNode=Xy;let r=c=>{let{x:m,y:g}=this._cameraNearFar,y=MB(c,m,g);return $y(y,m,g)},i=v_({closestDepth:\\\"float\\\",closestPositionTexel:\\\"vec2\\\",farthestDepth:\\\"float\\\"}),s=Ir(([c])=>{let m=yt(2).toVar(),g=nr(0).toVar(),y=yt(-1).toVar();for(let b=-1;b\\u003c=1;++b)for(let v=-1;v\\u003c=1;++v){let S=c.add(nr(b,v)).toVar(),T=this.depthNode.load(S).r;e.renderer.reversedDepthBuffer&&(T=T.oneMinus()),e.renderer.logarithmicDepthBuffer&&(T=r(T)),T=T.toVar(),pm(T.lessThan(m),()=>{m.assign(T),g.assign(S)}),pm(T.greaterThan(y),()=>{y.assign(T)})}return i(m,g,y)}),a=c=>{let m=this._previousDepthNode.sample(c).r;e.renderer.logarithmicDepthBuffer&&(m=r(m));let g=p_(c,m,this._previousCameraProjectionMatrixInverse),y=this._previousCameraWorldMatrix.mul(hr(g,1)).xyz,b=this._cameraWorldMatrixInverse.mul(hr(y,1)).z;return this.camera.isOrthographicCamera?PB(b,this._cameraNearFar.x,this._cameraNearFar.y):$y(b,this._cameraNearFar.x,this._cameraNearFar.y)},n=Ir(([c,m,g,y])=>{let b=y.rgb.add(g.rgb).mul(.5),v=y.rgb.sub(g.rgb).mul(.5).add(1e-7),S=m.sub(hr(b,c.a)),T=S.xyz.div(v).abs(),w=_t(T.x,T.y,T.z);return w.greaterThan(1).select(hr(b,c.a).add(S.div(w)),m)}).setLayout({name:\\\"clipAABB\\\",type:\\\"vec4\\\",inputs:[{name:\\\"currentColor\\\",type:\\\"vec4\\\"},{name:\\\"historyColor\\\",type:\\\"vec4\\\"},{name:\\\"minColor\\\",type:\\\"vec4\\\"},{name:\\\"maxColor\\\",type:\\\"vec4\\\"}]}),o=Ir(([c,m,g,y])=>{let b=[[-1,-1],[-1,1],[1,-1],[1,1],[1,0],[0,-1],[0,1],[-1,0]],v=m.toVar(),S=m.pow2().toVar();for(let[E,P]of b){let I=this.beautyNode.offset(ss(E,P)).load(c).max(0);v.addAssign(I),S.addAssign(I.pow2())}let T=yt(b.length+1),w=v.div(T),N=S.div(T).sub(w.pow2()).max(0).sqrt().mul(y),C=w.sub(N),R=w.add(N);return n(w.clamp(C,R),g,C,R)}),l=Ir(([c,m])=>{let g=c.mul(m).fract().abs(),y=_t(g,g.oneMinus());return y.x.mul(y.y).oneMinus().div(.75)}).setLayout({name:\\\"subpixelCorrection\\\",type:\\\"float\\\",inputs:[{name:\\\"velocityUV\\\",type:\\\"vec2\\\"},{name:\\\"textureSize\\\",type:\\\"ivec2\\\"}]}),u=Ir(([c,m,g])=>{let y=g.oneMinus(),b=c.mul(yt(1).div(_t(c.r,c.g,c.b).add(1))),v=m.mul(yt(1).div(_t(m.r,m.g,m.b).add(1))),S=kl(b.rgb),T=kl(v.rgb);return g.mulAssign(yt(1).div(S.add(1))),y.mulAssign(yt(1).div(T.add(1))),Wy(c.mul(g),m.mul(y)).div(_t(g.add(y),1e-5)).toVar()}),h=Ri(this._historyRenderTarget.texture),d=Ir(()=>{let c=_a(),m=this.beautyNode.size(),g=c.mul(m),y=s(g),b=y.get(\\\"closestDepth\\\"),v=y.get(\\\"closestPositionTexel\\\"),S=y.get(\\\"farthestDepth\\\"),T=this.velocityNode.load(v).xy.mul(nr(.5,-.5)),w=c.sub(T),N=a(w),C=w.greaterThanEqual(0).all().and(w.lessThanEqual(1).all()),R=S.sub(b).greaterThan(this.edgeDepthDiff),E=b.sub(N).greaterThan(this.depthThreshold),P=C.and(R.or(E.not())),I=this.beautyNode.sample(c),O=h.sample(c.sub(T)),L=c.sub(w).mul(m).length().div(this.maxVelocityLength).saturate(),X=yt(.05).toVar();this.useSubpixelCorrection&&X.addAssign(l(T,m).mul(.25)),X.assign(P.select(X.add(L).saturate(),1));let z=Dl(.5,1,L.oneMinus().pow2()),H=o(g,I,O,z);return u(I,H,X)});return this._resolveMaterial.colorNode=d(),this._textureNode}dispose(){this._historyRenderTarget.dispose(),this._resolveRenderTarget.dispose(),this._resolveMaterial.dispose()}};function sI(e,t){let r=1,i=0;for(;e>0;)r/=t,i+=r*(e%t),e=Math.floor(e/t);return i}var aI=Array.from({length:32},(e,t)=>[sI(t+1,2),sI(t+1,3)]),Vne=(e,t,r,i)=>new zne(Ju(e),t,r,i),dc=new Wa,Gne=new fe,fw,Wne=class extends rr{static get type(){return\\\"TAAUNode\\\"}constructor(e,t,r,i){super(\\\"vec4\\\"),this.isTAAUNode=!0,this.updateBeforeType=ut.FRAME,this.beautyNode=e,this.depthNode=t,this.velocityNode=r,this.camera=i,this.depthThreshold=5e-4,this.edgeDepthDiff=.001,this.maxVelocityLength=128,this.currentFrameWeight=.025,this._jitterIndex=0,this._jitterOffset=Fr(new fe),this._historyRenderTarget=new er(1,1,{depthBuffer:!1,type:Dt,count:2}),this._historyRenderTarget.textures[0].name=\\\"TAAUNode.history.color\\\",this._historyRenderTarget.textures[1].name=\\\"TAAUNode.history.lock\\\",this._resolveRenderTarget=new er(1,1,{depthBuffer:!1,type:Dt}),this._resolveRenderTarget.texture.name=\\\"TAAUNode.resolve\\\",this._previousDepthRenderTarget=new er(1,1,{depthBuffer:!1,depthTexture:new fs}),this._previousDepthRenderTarget.depthTexture.name=\\\"TAAUNode.previousDepth\\\",this._resolveMaterial=new Pt,this._resolveMaterial.name=\\\"TAAU.resolve\\\",this._seedMaterial=new Pt,this._seedMaterial.name=\\\"TAAU.seed\\\",this._textureNode=Qu(this,this._resolveRenderTarget.texture),this._originalProjectionMatrix=new We,this._cameraNearFar=Fr(new fe),this._cameraWorldMatrix=Fr(new We),this._cameraWorldMatrixInverse=Fr(new We),this._cameraProjectionMatrixInverse=Fr(new We),this._previousCameraWorldMatrix=Fr(new We),this._previousCameraProjectionMatrixInverse=Fr(new We),this._previousDepthNode=Ri(this._previousDepthRenderTarget.depthTexture),this._needsPostProcessingSync=!1}getTextureNode(){return this._textureNode}setSize(e,t){this._historyRenderTarget.setSize(e,t),this._resolveRenderTarget.setSize(e,t)}setViewOffset(e,t){this.camera.updateProjectionMatrix(),this._originalProjectionMatrix.copy(this.camera.projectionMatrix),Xy.setProjectionMatrix(this._originalProjectionMatrix);let r=oI[this._jitterIndex],i=r[0]-.5,s=r[1]-.5;this._jitterOffset.value.set(i,s),this.camera.setViewOffset(e,t,i,s,e,t)}clearViewOffset(){this.camera.clearViewOffset(),Xy.setProjectionMatrix(null),this._jitterIndex++,this._jitterIndex=this._jitterIndex%(oI.length-1)}updateBefore(e){let{renderer:t}=e;this._previousCameraWorldMatrix.value.copy(this._cameraWorldMatrix.value),this._previousCameraProjectionMatrixInverse.value.copy(this._cameraProjectionMatrixInverse.value),this._cameraNearFar.value.set(this.camera.near,this.camera.far),this._cameraWorldMatrix.value.copy(this.camera.matrixWorld),this._cameraWorldMatrixInverse.value.copy(this.camera.matrixWorldInverse),this._cameraProjectionMatrixInverse.value.copy(this.camera.projectionMatrixInverse);let r=this.beautyNode.isRTTNode?this.beautyNode.renderTarget:this.beautyNode.passNode.renderTarget,i=r.texture.width,s=r.texture.height,a=t.getDrawingBufferSize(Gne),n=a.width,o=a.height;fw=Es.resetRendererState(t,fw);let l=this._historyRenderTarget.width!==n||this._historyRenderTarget.height!==o;this.setSize(n,o),l===!0&&(t.initRenderTarget(this._historyRenderTarget),t.initRenderTarget(this._resolveRenderTarget),t.setRenderTarget(this._historyRenderTarget),dc.material=this._seedMaterial,dc.name=\\\"TAAU.seed\\\",dc.render(t),t.setRenderTarget(null)),this._needsPostProcessingSync===!0&&(this.setViewOffset(i,s),this._needsPostProcessingSync=!1),t.setRenderTarget(this._resolveRenderTarget),dc.material=this._resolveMaterial,dc.name=\\\"TAAU\\\",dc.render(t),t.setRenderTarget(null),t.copyTextureToTexture(this._resolveRenderTarget.texture,this._historyRenderTarget.texture);let u=this.depthNode.value,h=u.image!==null&&u.image!==void 0?u.image.width:0,d=u.image!==null&&u.image!==void 0?u.image.height:0;if(h>0&&d>0){(this._previousDepthRenderTarget.width!==h||this._previousDepthRenderTarget.height!==d)&&(this._previousDepthRenderTarget.setSize(h,d),t.initRenderTarget(this._previousDepthRenderTarget));let c=this._previousDepthRenderTarget.depthTexture;t.copyTextureToTexture(u,c),this._previousDepthNode.value=c}Es.restoreRendererState(t,fw)}setup(e){let t=e.context.renderPipeline;t&&(this._needsPostProcessingSync=!0,t.context.onBeforeRenderPipeline=()=>{let m=this.beautyNode.isRTTNode?this.beautyNode.renderTarget:this.beautyNode.passNode.renderTarget,g=m.texture.width,y=m.texture.height;this.setViewOffset(g,y)},t.context.onAfterRenderPipeline=()=>{this.clearViewOffset()});let r=v_({closestDepth:\\\"float\\\",closestPositionTexel:\\\"vec2\\\",farthestDepth:\\\"float\\\"}),i=Ir(([m])=>{let g=yt(2).toVar(),y=nr(0).toVar(),b=yt(-1).toVar();for(let v=-1;v\\u003c=1;++v)for(let S=-1;S\\u003c=1;++S){let T=m.add(nr(v,S)).toVar(),w=this.depthNode.load(T).r.toVar();pm(w.lessThan(g),()=>{g.assign(w),y.assign(T)}),pm(w.greaterThan(b),()=>{b.assign(w)})}return r(g,y,b)}),s=m=>{let g=this._previousDepthNode.sample(m).r,y=p_(m,g,this._previousCameraProjectionMatrixInverse),b=this._previousCameraWorldMatrix.mul(hr(y,1)).xyz,v=this._cameraWorldMatrixInverse.mul(hr(b,1)).z;return $y(v,this._cameraNearFar.x,this._cameraNearFar.y)},a=Ir(([m,g,y,b])=>{let v=b.rgb.add(y.rgb).mul(.5),S=b.rgb.sub(y.rgb).mul(.5).add(1e-7),T=g.sub(hr(v,m.a)),w=T.xyz.div(S).abs(),N=_t(w.x,w.y,w.z);return N.greaterThan(1).select(hr(v,m.a).add(T.div(N)),g)}).setLayout({name:\\\"clipAABB\\\",type:\\\"vec4\\\",inputs:[{name:\\\"currentColor\\\",type:\\\"vec4\\\"},{name:\\\"historyColor\\\",type:\\\"vec4\\\"},{name:\\\"minColor\\\",type:\\\"vec4\\\"},{name:\\\"maxColor\\\",type:\\\"vec4\\\"}]}),n=Ir(([m,g,y])=>{let b=y.oneMinus(),v=m.mul(yt(1).div(_t(m.r,m.g,m.b).add(1))),S=g.mul(yt(1).div(_t(g.r,g.g,g.b).add(1))),T=kl(v.rgb),w=kl(S.rgb);return y.mulAssign(yt(1).div(T.add(1))),b.mulAssign(yt(1).div(w.add(1))),Wy(m.mul(y),g.mul(b)).div(_t(y.add(b),1e-5)).toVar()}),o=Ri(this._historyRenderTarget.textures[0]),l=Ri(this._historyRenderTarget.textures[1]),u=mm(\\\"vec4\\\"),h=mm(\\\"vec4\\\"),d=m_(u,h),c=Ir(()=>{let m=_a(),g=this.beautyNode.size(),y=nr(g),b=m.mul(y),v=b.sub(nr(.5).add(this._jitterOffset)).round(),S=ss(v),T=i(v),w=T.get(\\\"closestDepth\\\"),N=T.get(\\\"closestPositionTexel\\\"),C=T.get(\\\"farthestDepth\\\"),R=this.velocityNode.load(N).xy.mul(nr(.5,-.5)),E=m.sub(R),P=s(E),I=E.greaterThanEqual(0).all().and(E.lessThanEqual(1).all()),O=C.sub(w).greaterThan(this.edgeDepthDiff),L=w.sub(P).greaterThan(this.depthThreshold),X=I.and(O.or(L.not())),z=hr(0).toVar(),H=yt(0).toVar(),ue=hr(0).toVar(),ne=hr(0).toVar(),re=[[-1,-1],[0,-1],[1,-1],[-1,0],[0,0],[1,0],[-1,1],[0,1],[1,1]];for(let[Te,we]of re){let ie=S.add(ss(Te,we)),V=nr(ie).add(nr(.5).add(this._jitterOffset)),Oe=b.sub(V),tt=Oe.dot(Oe),Je=_B(tt.mul(-2.29)),ct=this.beautyNode.load(ie).max(0);z.addAssign(ct.mul(Je)),H.addAssign(Je),ue.addAssign(ct),ne.addAssign(ct.pow2())}let ce=z.div(H.max(1e-5)),ge=yt(re.length),ye=ue.div(ge),oe=m.sub(E).mul(y).length().div(this.maxVelocityLength).saturate(),Ae=Dl(.5,1,oe.oneMinus().pow2()),Ie=ne.div(ge).sub(ye.pow2()).max(0).sqrt().mul(Ae),Xe=ye.sub(Ie),at=ye.add(Ie),W=o.sample(E),j=a(ye.clamp(Xe,at),W,Xe,at),G=kl(ce.rgb),ae=kl(ye.rgb).toConst(),be=G.sub(ae).abs().div(ae).smoothstep(0,.2),Be=w.sub(P).abs().greaterThan(this.depthThreshold),$=I.and(Be.not()).select(be,yt(0)),U=L.select(0,.5),J=_t($,l.r.mul(U)).saturate(),q=Dl(j,W,J),se=yt(this.currentFrameWeight).toVar();se.assign(X.select(se.add(oe).saturate(),1));let pe=n(ce,q,se);return u.assign(pe),h.assign(J),hr(0)});return this._resolveMaterial.colorNode=c(),this._resolveMaterial.outputNode=d,this._seedMaterial.colorNode=Ir(()=>(u.assign(this.beautyNode.sample(_a())),h.assign(0),hr(0)))(),this._seedMaterial.outputNode=d,this._textureNode}dispose(){this._historyRenderTarget.dispose(),this._resolveRenderTarget.dispose(),this._previousDepthRenderTarget.dispose(),this._resolveMaterial.dispose(),this._seedMaterial.dispose()}};function nI(e,t){let r=1,i=0;for(;e>0;)r/=t,i+=r*(e%t),e=Math.floor(e/t);return i}var oI=Array.from({length:32},(e,t)=>[nI(t+1,2),nI(t+1,3)]),jne=(e,t,r,i)=>new Wne(Ju(e),t,r,i),cc=new Wa,gw=new fe,yw,Hne=class extends rr{static get type(){return\\\"FSR1Node\\\"}constructor(e,t=.2,r=!1){super(\\\"vec4\\\"),this.textureNode=e,this.sharpness=Un(t),this.denoise=Un(r),this._easuRT=new er(1,1,{depthBuffer:!1,type:Dt}),this._easuRT.texture.name=\\\"FSR1Node.easu\\\",this._rcasRT=new er(1,1,{depthBuffer:!1,type:Dt}),this._rcasRT.texture.name=\\\"FSR1Node.rcas\\\",this._textureNode=Qu(this,this._rcasRT.texture),this._easuMaterial=null,this._rcasMaterial=null,this.updateBeforeType=ut.FRAME}setSize(e,t){this._easuRT.setSize(e,t),this._rcasRT.setSize(e,t)}updateBefore(e){let{renderer:t}=e;yw=Es.resetRendererState(t,yw),t.getDrawingBufferSize(gw),this.setSize(gw.x,gw.y),t.setRenderTarget(this._easuRT),cc.material=this._easuMaterial,cc.name=\\\"FSR1 [ EASU Pass ]\\\",cc.render(t),t.setRenderTarget(this._rcasRT),cc.material=this._rcasMaterial,cc.name=\\\"FSR1 [ RCAS Pass ]\\\",cc.render(t),Es.restoreRendererState(t,yw)}getTextureNode(){return this._textureNode}setup(e){let t=this.textureNode,r=t.value,i=(c,m,g,y,b,v,S,T)=>{let w=S.sub(v).toConst(),N=v.sub(b).toConst(),C=S.sub(b).toConst(),R=_t($a(w),$a(N)).toConst(),E=f_($a(C).div(_t(R,yt(1/65536)))).toConst();c.x.addAssign(C.mul(g)),m.addAssign(E.mul(E).mul(g));let P=T.sub(v).toConst(),I=v.sub(y).toConst(),O=T.sub(y).toConst(),L=_t($a(P),$a(I)).toConst(),X=f_($a(O).div(_t(L,yt(1/65536)))).toConst();c.y.addAssign(O.mul(g)),m.addAssign(X.mul(X).mul(g))},s=(c,m,g,y,b,v,S,T)=>{let w=g.x.mul(y.x).add(g.y.mul(y.y)).toConst(),N=g.x.mul(y.y).negate().add(g.y.mul(y.x)).toConst(),C=w.mul(b.x).toConst(),R=N.mul(b.y).toConst(),E=Ar(C.mul(C).add(R.mul(R)),S).toConst(),P=E.mul(2/5).sub(1).toConst(),I=E.mul(v).sub(1).toConst(),O=P.mul(P).mul(25/16).sub(25/16-1).mul(I.mul(I)).toConst();c.addAssign(T.mul(O)),m.addAssign(O)},a=Ir(()=>{let c=_a(),m=nr(jy(t)),g=c.mul(m).sub(.5).toConst(),y=Zd(g).toConst(),b=wB(g).toConst(),v=ss(Eo(y.x),Eo(y.y)).toConst(),S=(Je,ct)=>Ps(r,v.add(ss(Je,ct))),T=S(0,-1),w=S(1,-1),N=S(-1,0),C=S(0,0),R=S(1,0),E=S(2,0),P=S(-1,1),I=S(0,1),O=S(1,1),L=S(2,1),X=S(0,2),z=S(1,2),H=Je=>Je.r.mul(.5).add(Je.g).add(Je.b.mul(.5)),ue=H(T),ne=H(w),re=H(N),ce=H(C),ge=H(R),ye=H(E),oe=H(P),Ae=H(I),Ie=H(O),Xe=H(L),at=H(X),W=H(z),j=nr(0).toVar(),G=yt(0).toVar(),ae=yt(1).sub(b.x).mul(yt(1).sub(b.y)).toConst(),be=b.x.mul(yt(1).sub(b.y)).toConst(),Be=yt(1).sub(b.x).mul(b.y).toConst(),$=b.x.mul(b.y).toConst();i(j,G,ae,ue,re,ce,ge,Ae),i(j,G,be,ne,ce,ge,ye,Ie),i(j,G,Be,ce,oe,Ae,Ie,at),i(j,G,$,ge,Ae,Ie,Xe,W);let U=j.x.mul(j.x).add(j.y.mul(j.y)).toConst(),J=U.lessThan(1/32768).toConst(),q=yt(1).div(CB(_t(U,yt(1/32768)))).toConst();j.x.assign(g_(J,yt(1),j.x)),j.mulAssign(g_(J,yt(1),q)),G.assign(G.mul(.5)),G.mulAssign(G);let se=j.x.mul(j.x).add(j.y.mul(j.y)).div(_t($a(j.x),$a(j.y))).toConst(),pe=nr(yt(1).add(se.sub(1).mul(G)),yt(1).sub(G.mul(.5))).toConst(),Te=yt(.5).add(yt(1/4-.04-.5).mul(G)).toConst(),we=yt(1).div(Te).toConst(),ie=hr(0).toVar(),V=yt(0).toVar();s(ie,V,nr(0,-1).sub(b),j,pe,Te,we,T),s(ie,V,nr(1,-1).sub(b),j,pe,Te,we,w),s(ie,V,nr(-1,0).sub(b),j,pe,Te,we,N),s(ie,V,nr(0,0).sub(b),j,pe,Te,we,C),s(ie,V,nr(1,0).sub(b),j,pe,Te,we,R),s(ie,V,nr(2,0).sub(b),j,pe,Te,we,E),s(ie,V,nr(-1,1).sub(b),j,pe,Te,we,P),s(ie,V,nr(0,1).sub(b),j,pe,Te,we,I),s(ie,V,nr(1,1).sub(b),j,pe,Te,we,O),s(ie,V,nr(2,1).sub(b),j,pe,Te,we,L),s(ie,V,nr(0,2).sub(b),j,pe,Te,we,X),s(ie,V,nr(1,2).sub(b),j,pe,Te,we,z),ie.divAssign(V);let Oe=Ar(Ar(C,R),Ar(I,O)).toConst(),tt=_t(_t(C,R),_t(I,O)).toConst();return SB(ie,Oe,tt)}),n=this._easuRT.texture,o=Ir(()=>{let c=_a(),m=nr(jy(Ps(n))),g=ss(Eo(Zd(c.x.mul(m.x))),Eo(Zd(c.y.mul(m.y)))).toConst(),y=Ps(n,g),b=Ps(n,g.add(ss(0,-1))),v=Ps(n,g.add(ss(-1,0))),S=Ps(n,g.add(ss(1,0))),T=Ps(n,g.add(ss(0,1))),w=Ae=>Ae.g.add(Ae.b.add(Ae.r).mul(.5)),N=w(b),C=w(v),R=w(y),E=w(S),P=w(T),I=c_(this.sharpness.negate()).toConst(),O=Ar(Ar(b.rgb,v.rgb),Ar(S.rgb,T.rgb)).toConst(),L=_t(_t(b.rgb,v.rgb),_t(S.rgb,T.rgb)).toConst(),X=yt(.25-1/16).toConst(),z=Ar(O,y.rgb).div(L.mul(4)).toConst(),H=Hy(1).sub(_t(L,y.rgb)).div(O.mul(4).sub(4)).toConst(),ue=_t(z.negate(),H).toConst(),ne=_t(X.negate(),Ar(_t(ue.r,_t(ue.g,ue.b)),yt(0))).mul(I).toConst(),re=N.add(C).add(E).add(P).mul(.25).sub(R).toConst(),ce=_t(_t(N,C),_t(R,_t(E,P))).sub(Ar(Ar(N,C),Ar(R,Ar(E,P)))).toConst(),ge=yt(1).sub($a(re).div(_t(ce,yt(1/65536))).saturate().mul(.5)).toConst(),ye=this.denoise.equal(!0).select(ne.mul(ge),ne).toConst(),oe=b.rgb.add(v.rgb).add(S.rgb).add(T.rgb).mul(ye).add(y.rgb).div(ye.mul(4).add(1)).toConst();return hr(oe,y.a)}),l=e.getSharedContext(),u=this._easuMaterial||(this._easuMaterial=new Pt);u.fragmentNode=a().context(l),u.name=\\\"FSR1_EASU\\\",u.needsUpdate=!0;let h=this._rcasMaterial||(this._rcasMaterial=new Pt);h.fragmentNode=o().context(l),h.name=\\\"FSR1_RCAS\\\",h.needsUpdate=!0;let d=e.getNodeProperties(this);return d.textureNode=t,this._textureNode}dispose(){this._easuRT.dispose(),this._rcasRT.dispose(),this._easuMaterial!==null&&this._easuMaterial.dispose(),this._rcasMaterial!==null&&this._rcasMaterial.dispose()}},Xne=(e,t,r)=>new Hne(Ju(e),t,r),xw=new Wa,vw=new fe,bw,$ne=class extends rr{static get type(){return\\\"SharpenNode\\\"}constructor(e,t=.2,r=!1){super(\\\"vec4\\\"),this.isSharpenNode=!0,this.textureNode=e,this.sharpness=Un(t),this.denoise=Un(r),this._renderTarget=new er(1,1,{depthBuffer:!1,type:Dt}),this._renderTarget.texture.name=\\\"SharpenNode.output\\\",this._textureNode=Qu(this,this._renderTarget.texture),this._material=null,this.updateBeforeType=ut.FRAME}setSize(e,t){this._renderTarget.setSize(e,t)}updateBefore(e){let{renderer:t}=e;bw=Es.resetRendererState(t,bw),t.getDrawingBufferSize(vw),this.setSize(vw.x,vw.y),t.setRenderTarget(this._renderTarget),xw.material=this._material,xw.name=\\\"Sharpen [ RCAS ]\\\",xw.render(t),Es.restoreRendererState(t,bw)}getTextureNode(){return this._textureNode}setup(e){let t=this.textureNode,r=t.value,i=Ir(()=>{let o=_a(),l=jy(Ps(r)),u=ss(Eo(Zd(o.x.mul(l.x))),Eo(Zd(o.y.mul(l.y)))).toConst(),h=Ps(r,u),d=Ps(r,u.add(ss(0,-1))),c=Ps(r,u.add(ss(-1,0))),m=Ps(r,u.add(ss(1,0))),g=Ps(r,u.add(ss(0,1))),y=re=>re.g.add(re.b.add(re.r).mul(.5)),b=y(d),v=y(c),S=y(h),T=y(m),w=y(g),N=c_(this.sharpness.negate()).toConst(),C=Ar(Ar(d.rgb,c.rgb),Ar(m.rgb,g.rgb)).toConst(),R=_t(_t(d.rgb,c.rgb),_t(m.rgb,g.rgb)).toConst(),E=yt(.25-1/16).toConst(),P=Ar(C,h.rgb).div(R.mul(4)).toConst(),I=Hy(1).sub(_t(R,h.rgb)).div(C.mul(4).sub(4)).toConst(),O=_t(P.negate(),I).toConst(),L=_t(E.negate(),Ar(_t(O.r,_t(O.g,O.b)),yt(0))).mul(N).toConst(),X=b.add(v).add(T).add(w).mul(.25).sub(S).toConst(),z=_t(_t(b,v),_t(S,_t(T,w))).sub(Ar(Ar(b,v),Ar(S,Ar(T,w)))).toConst(),H=yt(1).sub($a(X).div(_t(z,yt(1/65536))).saturate().mul(.5)).toConst(),ue=this.denoise.equal(!0).select(L.mul(H),L).toConst(),ne=d.rgb.add(c.rgb).add(m.rgb).add(g.rgb).mul(ue).add(h.rgb).div(ue.mul(4).add(1)).toConst();return hr(ne,h.a)}),s=e.getSharedContext(),a=this._material||(this._material=new Pt);a.fragmentNode=i().context(s),a.name=\\\"Sharpen_RCAS\\\",a.needsUpdate=!0;let n=e.getNodeProperties(this);return n.textureNode=t,this._textureNode}dispose(){this._renderTarget.dispose(),this._material!==null&&this._material.dispose()}},qne=(e,t,r)=>new $ne(Ju(e),t,r),km=new Wa,Tw,Yne=class extends rr{static get type(){return\\\"GaussianBlurNode\\\"}constructor(e,t=null,r=4,i={}){super(\\\"vec4\\\"),this.textureNode=e,this.directionNode=t,this.sigma=r,this._invSize=Fr(new fe),this._passDirection=Fr(new fe),this._horizontalRT=new er(1,1,{depthBuffer:!1}),this._horizontalRT.texture.name=\\\"GaussianBlurNode.horizontal\\\",this._verticalRT=new er(1,1,{depthBuffer:!1}),this._verticalRT.texture.name=\\\"GaussianBlurNode.vertical\\\",this._textureNode=Qu(this,this._verticalRT.texture),this._textureNode.uvNode=e.uvNode,this._material=null,this.updateBeforeType=ut.FRAME,this.resolutionScale=i.resolutionScale||1,this.premultipliedAlpha=i.premultipliedAlpha||!1,this.isGaussianBlurNode=!0}setSize(e,t){e=Math.max(Math.round(e*this.resolutionScale),1),t=Math.max(Math.round(t*this.resolutionScale),1),this._invSize.value.set(1/e,1/t),this._horizontalRT.setSize(e,t),this._verticalRT.setSize(e,t)}updateBefore(e){let{renderer:t}=e;Tw=Es.resetRendererState(t,Tw);let r=this.textureNode,i=r.value,s=r.value;km.material=this._material,this.setSize(i.image.width,i.image.height);let a=i.type;this._horizontalRT.texture.type=a,this._verticalRT.texture.type=a,t.setRenderTarget(this._horizontalRT),this._passDirection.value.set(1,0),km.name=\\\"Gaussian Blur [ Horizontal Pass ]\\\",km.render(t),r.value=this._horizontalRT.texture,t.setRenderTarget(this._verticalRT),this._passDirection.value.set(0,1),km.name=\\\"Gaussian Blur [ Vertical Pass ]\\\",km.render(t),r.value=s,Es.restoreRendererState(t,Tw)}getTextureNode(){return this._textureNode}setup(e){let t=this.textureNode,r=_a(),i=nr(this.directionNode||1),s,a;this.premultipliedAlpha?(s=u=>AB(t.sample(u)),a=u=>EB(u)):(s=u=>t.sample(u),a=u=>u);let n=Ir(()=>{let u=3+2*this.sigma,h=this._getCoefficients(u),d=this._invSize,c=i.mul(this._passDirection),m=hr(s(r).mul(h[0])).toVar();for(let g=1;g\\u003cu;g++){let y=yt(g),b=yt(h[g]),v=nr(c.mul(d.mul(y))).toVar(),S=s(r.add(v)),T=s(r.sub(v));m.addAssign(S.add(T).mul(b))}return a(m)}),o=this._material||(this._material=new Pt);o.fragmentNode=n().context(e.getSharedContext()),o.name=\\\"Gaussian_blur\\\",o.needsUpdate=!0;let l=e.getNodeProperties(this);return l.textureNode=t,this._textureNode}dispose(){this._horizontalRT.dispose(),this._verticalRT.dispose(),this._material!==null&&this._material.dispose()}_getCoefficients(e){let t=[],r=e/3;for(let i=0;i\\u003ce;i++)t.push(.39894*Math.exp(-.5*i*i/(r*r))/r);return t}get resolution(){return console.warn('THREE.GaussianBlurNode: The \\\"resolution\\\" property has been renamed to \\\"resolutionScale\\\" and is now of type `number`.'),new fe(this.resolutionScale,this.resolutionScale)}set resolution(e){console.warn('THREE.GaussianBlurNode: The \\\"resolution\\\" property has been renamed to \\\"resolutionScale\\\" and is now of type `number`.'),this.resolutionScale=e.x}},Zne=(e,t,r,i={})=>new Yne(Ju(e),t,r,i),Qr=new Wa,Sw,Jne=class extends rr{static get type(){return\\\"DepthOfFieldNode\\\"}constructor(e,t,r,i,s){super(\\\"vec4\\\"),this.textureNode=e,this.viewZNode=t,this.focusDistanceNode=r,this.focalLengthNode=i,this.bokehScaleNode=s,this._invSize=Fr(new fe),this._CoCRT=new er(1,1,{depthBuffer:!1,type:Dt,format:io,count:2}),this._CoCRT.textures[0].name=\\\"DepthOfField.NearField\\\",this._CoCRT.textures[1].name=\\\"DepthOfField.FarField\\\",this._CoCBlurredRT=new er(1,1,{depthBuffer:!1,type:Dt,format:io}),this._CoCBlurredRT.texture.name=\\\"DepthOfField.NearFieldBlurred\\\",this._blur64RT=new er(1,1,{depthBuffer:!1,type:Dt}),this._blur64RT.texture.name=\\\"DepthOfField.Blur64\\\",this._blur16NearRT=new er(1,1,{depthBuffer:!1,type:Dt}),this._blur16NearRT.texture.name=\\\"DepthOfField.Blur16Near\\\",this._blur16FarRT=new er(1,1,{depthBuffer:!1,type:Dt}),this._blur16FarRT.texture.name=\\\"DepthOfField.Blur16Far\\\",this._compositeRT=new er(1,1,{depthBuffer:!1,type:Dt}),this._compositeRT.texture.name=\\\"DepthOfField.Composite\\\",this._CoCMaterial=new Pt,this._CoCBlurredMaterial=new Pt,this._blur64Material=new Pt,this._blur16Material=new Pt,this._compositeMaterial=new Pt,this._textureNode=Ri(this._compositeRT.texture),this._CoCTextureNode=Ri(this._CoCRT.texture),this._blur64TextureNode=Ri(this._blur64RT.texture),this._blur16NearTextureNode=Ri(this._blur16NearRT.texture),this._blur16FarTextureNode=Ri(this._blur16FarRT.texture),this.updateBeforeType=ut.FRAME}setSize(e,t){this._invSize.value.set(1/e,1/t),this._CoCRT.setSize(e,t),this._compositeRT.setSize(e,t);let r=Math.round(e/2),i=Math.round(t/2);this._CoCBlurredRT.setSize(r,i),this._blur64RT.setSize(r,i),this._blur16NearRT.setSize(r,i),this._blur16FarRT.setSize(r,i)}getTextureNode(){return this._textureNode}updateBefore(e){let{renderer:t}=e,r=this.textureNode.value;this.setSize(r.image.width,r.image.height),Sw=Es.resetRendererState(t,Sw),t.setClearColor(0,0),Qr.material=this._CoCMaterial,t.setRenderTarget(this._CoCRT),Qr.name=\\\"DoF [ CoC ]\\\",Qr.render(t),this._CoCTextureNode.value=this._CoCRT.textures[0],Qr.material=this._CoCBlurredMaterial,t.setRenderTarget(this._CoCBlurredRT),Qr.name=\\\"DoF [ CoC Blur ]\\\",Qr.render(t),this._CoCTextureNode.value=this._CoCBlurredRT.texture,Qr.material=this._blur64Material,t.setRenderTarget(this._blur64RT),Qr.name=\\\"DoF [ Blur64 Near ]\\\",Qr.render(t),Qr.material=this._blur16Material,t.setRenderTarget(this._blur16NearRT),Qr.name=\\\"DoF [ Blur16 Near ]\\\",Qr.render(t),this._CoCTextureNode.value=this._CoCRT.textures[1],Qr.material=this._blur64Material,t.setRenderTarget(this._blur64RT),Qr.name=\\\"DoF [ Blur64 Far ]\\\",Qr.render(t),Qr.material=this._blur16Material,t.setRenderTarget(this._blur16FarRT),Qr.name=\\\"DoF [ Blur16 Far ]\\\",Qr.render(t),Qr.material=this._compositeMaterial,t.setRenderTarget(this._compositeRT),Qr.name=\\\"DoF [ Composite ]\\\",Qr.render(t),Es.restoreRendererState(t,Sw)}setup(e){let t=this._generateKernels(),r=mm(\\\"float\\\"),i=mm(\\\"float\\\"),s=m_(r,i),a=Ir(()=>{let d=this.viewZNode.negate().sub(this.focusDistanceNode),c=y_(0,this.focalLengthNode,d.abs());return r.assign(x_(d,0).mul(c)),i.assign(x_(0,d).mul(c)),yt(0)});this._CoCMaterial.colorNode=a().context(e.getSharedContext()),this._CoCMaterial.outputNode=s,this._CoCMaterial.needsUpdate=!0,this._CoCBlurredMaterial.colorNode=Zne(this._CoCTextureNode,1,2),this._CoCBlurredMaterial.needsUpdate=!0;let n=Jd(t.points64),o=Ir(()=>{let d=Hy(),c=_a(),m=this._CoCTextureNode.sample(c).r,g=this._invSize.mul(this.bokehScaleNode).mul(m);return Gy(64,({i:y})=>{let b=c.add(g.mul(n.element(y))),v=this.textureNode.sample(b);d.addAssign(v.rgb)}),d.divAssign(64),hr(d,m)});this._blur64Material.fragmentNode=o().context(e.getSharedContext()),this._blur64Material.needsUpdate=!0;let l=Jd(t.points16),u=Ir(()=>{let d=_a(),c=this._blur64TextureNode.sample(d).toVar(),m=c.rgb,g=c.a,y=this._invSize.mul(this.bokehScaleNode).mul(g);return Gy(16,({i:b})=>{let v=d.add(y.mul(l.element(b))),S=this._blur64TextureNode.sample(v);m.assign(_t(S.rgb,m))}),hr(m,g)});this._blur16Material.fragmentNode=u().context(e.getSharedContext()),this._blur16Material.needsUpdate=!0;let h=Ir(()=>{let d=_a(),c=this._blur16NearTextureNode.sample(d),m=this._blur16FarTextureNode.sample(d),g=this.textureNode.sample(d),y=Ar(c.a,.5).mul(2),b=Ar(m.a,.5).mul(2),v=hr(0,0,0,1).toVar();return v.rgb=Dl(g.rgb,m.rgb,b),v.rgb=Dl(v.rgb,c.rgb,y),v});return this._compositeMaterial.fragmentNode=h().context(e.getSharedContext()),this._compositeMaterial.needsUpdate=!0,this._textureNode}_generateKernels(){let e=2.39996323,t=80,r=[],i=[],s=0,a=0;for(let n=0;n\\u003ct;n++){let o=n*e,l=Math.sqrt(n)/Math.sqrt(t),u=new fe(l*Math.cos(o),l*Math.sin(o));n%5===0?(i[a]=u,a++):(r[s]=u,s++)}return{points16:i,points64:r}}dispose(){this._CoCRT.dispose(),this._CoCBlurredRT.dispose(),this._blur64RT.dispose(),this._blur16NearRT.dispose(),this._blur16FarRT.dispose(),this._compositeRT.dispose(),this._CoCMaterial.dispose(),this._CoCBlurredMaterial.dispose(),this._blur64Material.dispose(),this._blur16Material.dispose(),this._compositeMaterial.dispose()}},Qne=(e,t,r=1,i=1,s=1)=>new Jne(Ju(e),Un(t),Un(r),Un(i),Un(s)),Ja=new Wa,Kne=new fe,eoe=new fe(1,0),toe=new fe(0,1),_w,roe=Ir(({input:e,threshold:t,smoothWidth:r})=>{let i=kl(e.rgb),s=y_(t,t.add(r),i);return Dl(hr(0),e,s)}),ioe=class extends rr{static get type(){return\\\"BloomNode\\\"}constructor(e,t=1,r=0,i=0){super(\\\"vec4\\\"),this.inputNode=e,this.strength=t.isNode?t:Fr(t),this.radius=r.isNode?r:Fr(r),this.threshold=i.isNode?i:Fr(i),this.smoothWidth=Fr(.01),this._resolutionScale=.5,this.highPassFn=roe,this._renderTargetsHorizontal=[],this._renderTargetsVertical=[],this._nMips=5,this._renderTargetBright=new er(1,1,{depthBuffer:!1,type:Dt}),this._renderTargetBright.texture.name=\\\"UnrealBloomPass.bright\\\",this._renderTargetBright.texture.generateMipmaps=!1;for(let s=0;s\\u003cthis._nMips;s++){let a=new er(1,1,{depthBuffer:!1,type:Dt});a.texture.name=\\\"UnrealBloomPass.h\\\"+s,a.texture.generateMipmaps=!1,this._renderTargetsHorizontal.push(a);let n=new er(1,1,{depthBuffer:!1,type:Dt});n.texture.name=\\\"UnrealBloomPass.v\\\"+s,n.texture.generateMipmaps=!1,this._renderTargetsVertical.push(n)}this._compositeMaterial=null,this._highPassFilterMaterial=null,this._separableBlurMaterials=[],this._textureNodeBright=Ri(this._renderTargetBright.texture),this._textureNodeBlur0=Ri(this._renderTargetsVertical[0].texture),this._textureNodeBlur1=Ri(this._renderTargetsVertical[1].texture),this._textureNodeBlur2=Ri(this._renderTargetsVertical[2].texture),this._textureNodeBlur3=Ri(this._renderTargetsVertical[3].texture),this._textureNodeBlur4=Ri(this._renderTargetsVertical[4].texture),this._textureOutput=Qu(this,this._renderTargetsHorizontal[0].texture),this.updateBeforeType=ut.FRAME}getTextureNode(){return this._textureOutput}setResolutionScale(e){return this._resolutionScale=e,this}getResolutionScale(){return this._resolutionScale}setSize(e,t){let r=Math.floor(e*this._resolutionScale),i=Math.floor(t*this._resolutionScale);this._renderTargetBright.setSize(r,i);for(let s=0;s\\u003cthis._nMips;s++)this._renderTargetsHorizontal[s].setSize(r,i),this._renderTargetsVertical[s].setSize(r,i),this._separableBlurMaterials[s].invSize.value.set(1/r,1/i),r=Math.floor(r/2),i=Math.floor(i/2)}updateBefore(e){let{renderer:t}=e;_w=Es.resetRendererState(t,_w);let r=t.getDrawingBufferSize(Kne);this.setSize(r.width,r.height),t.setRenderTarget(this._renderTargetBright),Ja.material=this._highPassFilterMaterial,Ja.name=\\\"Bloom [ High Pass ]\\\",Ja.render(t);let i=this._renderTargetBright;for(let s=0;s\\u003cthis._nMips;s++)Ja.material=this._separableBlurMaterials[s],this._separableBlurMaterials[s].colorTexture.value=i.texture,this._separableBlurMaterials[s].direction.value=eoe,t.setRenderTarget(this._renderTargetsHorizontal[s]),Ja.name=`Bloom [ Blur Horizontal - ${s} ]`,Ja.render(t),this._separableBlurMaterials[s].colorTexture.value=this._renderTargetsHorizontal[s].texture,this._separableBlurMaterials[s].direction.value=toe,t.setRenderTarget(this._renderTargetsVertical[s]),Ja.name=`Bloom [ Blur Vertical - ${s} ]`,Ja.render(t),i=this._renderTargetsVertical[s];t.setRenderTarget(this._renderTargetsHorizontal[0]),Ja.material=this._compositeMaterial,Ja.name=\\\"Bloom [ Composite ]\\\",Ja.render(t),Es.restoreRendererState(t,_w)}setup(e){this._highPassFilterMaterial=this._highPassFilterMaterial||new Pt,this._highPassFilterMaterial.fragmentNode=this.highPassFn({input:this.inputNode,threshold:this.threshold,smoothWidth:this.smoothWidth}).context(e.getSharedContext()),this._highPassFilterMaterial.name=\\\"Bloom_highPass\\\",this._highPassFilterMaterial.needsUpdate=!0;let t=[6,10,14,18,22];for(let n=0;n\\u003cthis._nMips;n++)this._separableBlurMaterials.push(this._getSeparableBlurMaterial(e,t[n]));let r=Jd([1,.8,.6,.4,.2]),i=Jd([new F(1,1,1),new F(1,1,1),new F(1,1,1),new F(1,1,1),new F(1,1,1)]),s=Ir(([n,o])=>{let l=yt(1.2).sub(n);return Dl(n,l,o)}).setLayout({name:\\\"lerpBloomFactor\\\",type:\\\"float\\\",inputs:[{name:\\\"factor\\\",type:\\\"float\\\"},{name:\\\"radius\\\",type:\\\"float\\\"}]}),a=Ir(()=>{let n=s(r.element(0),this.radius).mul(hr(i.element(0),1)).mul(this._textureNodeBlur0),o=s(r.element(1),this.radius).mul(hr(i.element(1),1)).mul(this._textureNodeBlur1),l=s(r.element(2),this.radius).mul(hr(i.element(2),1)).mul(this._textureNodeBlur2),u=s(r.element(3),this.radius).mul(hr(i.element(3),1)).mul(this._textureNodeBlur3),h=s(r.element(4),this.radius).mul(hr(i.element(4),1)).mul(this._textureNodeBlur4);return n.add(o).add(l).add(u).add(h).mul(this.strength)});return this._compositeMaterial=this._compositeMaterial||new Pt,this._compositeMaterial.fragmentNode=a().context(e.getSharedContext()),this._compositeMaterial.name=\\\"Bloom_comp\\\",this._compositeMaterial.needsUpdate=!0,this._textureOutput}dispose(){for(let e=0;e\\u003cthis._renderTargetsHorizontal.length;e++)this._renderTargetsHorizontal[e].dispose();for(let e=0;e\\u003cthis._renderTargetsVertical.length;e++)this._renderTargetsVertical[e].dispose();this._renderTargetBright.dispose(),this._highPassFilterMaterial!==null&&this._highPassFilterMaterial.dispose(),this._compositeMaterial!==null&&this._compositeMaterial.dispose();for(let e=0;e\\u003cthis._separableBlurMaterials.length;e++)this._separableBlurMaterials[e].dispose()}_getSeparableBlurMaterial(e,t){let r=[],i=t/3;for(let c=0;c\\u003ct;c++)r.push(.39894*Math.exp(-.5*c*c/(i*i))/i);let s=Ri(null),a=Jd(r),n=Fr(new fe),o=Fr(new fe(.5,.5)),l=_a(),u=c=>s.sample(c),h=Ir(()=>{let c=u(l).rgb.mul(a.element(0)).toVar();return Gy({start:Eo(1),end:Eo(t),type:\\\"int\\\",condition:\\\"\\u003c\\\"},({i:m})=>{let g=yt(m),y=a.element(m),b=o.mul(n).mul(g),v=u(l.add(b)).rgb,S=u(l.sub(b)).rgb;c.addAssign(Wy(v,S).mul(y))}),hr(c,1)}),d=new Pt;return d.fragmentNode=h().context(e.getSharedContext()),d.name=\\\"Bloom_separable\\\",d.needsUpdate=!0,d.colorTexture=s,d.direction=o,d.invSize=n,d}},soe=(e,t,r,i)=>new ioe(Un(e),t,r,i),pc={NONE:\\\"none\\\",FRAME:\\\"frame\\\",RENDER:\\\"render\\\",OBJECT:\\\"object\\\"},aoe=[\\\"fragment\\\",\\\"vertex\\\"],j0e=[...aoe,\\\"compute\\\"],j1=[\\\"x\\\",\\\"y\\\",\\\"z\\\",\\\"w\\\"],lI=0,uI=1,hI=2,dI=3,cI=4,pI=5,mI=6,fI=7,noe=\\\"\\\",Qa=\\\"srgb\\\",gI=\\\"srgb-linear\\\",yI=\\\"linear\\\",ww=\\\"srgb\\\",uh=2e3,Mw=2001,xI={},H1=null;function vI(e){let t=e[0];if(typeof t==\\\"string\\\"&&t.startsWith(\\\"TSL:\\\")){let r=e[1];r&&r.isStackTrace?e[0]+=\\\" \\\"+r.getLocation():e[1]='Stack trace not available. Enable \\\"THREE.Node.captureStackTrace\\\" to capture stack traces.'}return e}function ns(...e){e=vI(e);let t=\\\"THREE.\\\"+e.shift();if(H1)H1(\\\"warn\\\",t,...e);else{let r=e[0];r&&r.isStackTrace?console.warn(r.getError(t)):console.warn(t,...e)}}function Uo(...e){e=vI(e);let t=\\\"THREE.\\\"+e.shift();if(H1)H1(\\\"error\\\",t,...e);else{let r=e[0];r&&r.isStackTrace?console.error(r.getError(t)):console.error(t,...e)}}function Dm(...e){let t=e.join(\\\" \\\");t in xI||(xI[t]=!0,ns(...e))}var H0e={[lI]:uI,[hI]:mI,[cI]:fI,[dI]:pI,[uI]:lI,[mI]:hI,[fI]:cI,[pI]:dI},os=[\\\"00\\\",\\\"01\\\",\\\"02\\\",\\\"03\\\",\\\"04\\\",\\\"05\\\",\\\"06\\\",\\\"07\\\",\\\"08\\\",\\\"09\\\",\\\"0a\\\",\\\"0b\\\",\\\"0c\\\",\\\"0d\\\",\\\"0e\\\",\\\"0f\\\",\\\"10\\\",\\\"11\\\",\\\"12\\\",\\\"13\\\",\\\"14\\\",\\\"15\\\",\\\"16\\\",\\\"17\\\",\\\"18\\\",\\\"19\\\",\\\"1a\\\",\\\"1b\\\",\\\"1c\\\",\\\"1d\\\",\\\"1e\\\",\\\"1f\\\",\\\"20\\\",\\\"21\\\",\\\"22\\\",\\\"23\\\",\\\"24\\\",\\\"25\\\",\\\"26\\\",\\\"27\\\",\\\"28\\\",\\\"29\\\",\\\"2a\\\",\\\"2b\\\",\\\"2c\\\",\\\"2d\\\",\\\"2e\\\",\\\"2f\\\",\\\"30\\\",\\\"31\\\",\\\"32\\\",\\\"33\\\",\\\"34\\\",\\\"35\\\",\\\"36\\\",\\\"37\\\",\\\"38\\\",\\\"39\\\",\\\"3a\\\",\\\"3b\\\",\\\"3c\\\",\\\"3d\\\",\\\"3e\\\",\\\"3f\\\",\\\"40\\\",\\\"41\\\",\\\"42\\\",\\\"43\\\",\\\"44\\\",\\\"45\\\",\\\"46\\\",\\\"47\\\",\\\"48\\\",\\\"49\\\",\\\"4a\\\",\\\"4b\\\",\\\"4c\\\",\\\"4d\\\",\\\"4e\\\",\\\"4f\\\",\\\"50\\\",\\\"51\\\",\\\"52\\\",\\\"53\\\",\\\"54\\\",\\\"55\\\",\\\"56\\\",\\\"57\\\",\\\"58\\\",\\\"59\\\",\\\"5a\\\",\\\"5b\\\",\\\"5c\\\",\\\"5d\\\",\\\"5e\\\",\\\"5f\\\",\\\"60\\\",\\\"61\\\",\\\"62\\\",\\\"63\\\",\\\"64\\\",\\\"65\\\",\\\"66\\\",\\\"67\\\",\\\"68\\\",\\\"69\\\",\\\"6a\\\",\\\"6b\\\",\\\"6c\\\",\\\"6d\\\",\\\"6e\\\",\\\"6f\\\",\\\"70\\\",\\\"71\\\",\\\"72\\\",\\\"73\\\",\\\"74\\\",\\\"75\\\",\\\"76\\\",\\\"77\\\",\\\"78\\\",\\\"79\\\",\\\"7a\\\",\\\"7b\\\",\\\"7c\\\",\\\"7d\\\",\\\"7e\\\",\\\"7f\\\",\\\"80\\\",\\\"81\\\",\\\"82\\\",\\\"83\\\",\\\"84\\\",\\\"85\\\",\\\"86\\\",\\\"87\\\",\\\"88\\\",\\\"89\\\",\\\"8a\\\",\\\"8b\\\",\\\"8c\\\",\\\"8d\\\",\\\"8e\\\",\\\"8f\\\",\\\"90\\\",\\\"91\\\",\\\"92\\\",\\\"93\\\",\\\"94\\\",\\\"95\\\",\\\"96\\\",\\\"97\\\",\\\"98\\\",\\\"99\\\",\\\"9a\\\",\\\"9b\\\",\\\"9c\\\",\\\"9d\\\",\\\"9e\\\",\\\"9f\\\",\\\"a0\\\",\\\"a1\\\",\\\"a2\\\",\\\"a3\\\",\\\"a4\\\",\\\"a5\\\",\\\"a6\\\",\\\"a7\\\",\\\"a8\\\",\\\"a9\\\",\\\"aa\\\",\\\"ab\\\",\\\"ac\\\",\\\"ad\\\",\\\"ae\\\",\\\"af\\\",\\\"b0\\\",\\\"b1\\\",\\\"b2\\\",\\\"b3\\\",\\\"b4\\\",\\\"b5\\\",\\\"b6\\\",\\\"b7\\\",\\\"b8\\\",\\\"b9\\\",\\\"ba\\\",\\\"bb\\\",\\\"bc\\\",\\\"bd\\\",\\\"be\\\",\\\"bf\\\",\\\"c0\\\",\\\"c1\\\",\\\"c2\\\",\\\"c3\\\",\\\"c4\\\",\\\"c5\\\",\\\"c6\\\",\\\"c7\\\",\\\"c8\\\",\\\"c9\\\",\\\"ca\\\",\\\"cb\\\",\\\"cc\\\",\\\"cd\\\",\\\"ce\\\",\\\"cf\\\",\\\"d0\\\",\\\"d1\\\",\\\"d2\\\",\\\"d3\\\",\\\"d4\\\",\\\"d5\\\",\\\"d6\\\",\\\"d7\\\",\\\"d8\\\",\\\"d9\\\",\\\"da\\\",\\\"db\\\",\\\"dc\\\",\\\"dd\\\",\\\"de\\\",\\\"df\\\",\\\"e0\\\",\\\"e1\\\",\\\"e2\\\",\\\"e3\\\",\\\"e4\\\",\\\"e5\\\",\\\"e6\\\",\\\"e7\\\",\\\"e8\\\",\\\"e9\\\",\\\"ea\\\",\\\"eb\\\",\\\"ec\\\",\\\"ed\\\",\\\"ee\\\",\\\"ef\\\",\\\"f0\\\",\\\"f1\\\",\\\"f2\\\",\\\"f3\\\",\\\"f4\\\",\\\"f5\\\",\\\"f6\\\",\\\"f7\\\",\\\"f8\\\",\\\"f9\\\",\\\"fa\\\",\\\"fb\\\",\\\"fc\\\",\\\"fd\\\",\\\"fe\\\",\\\"ff\\\"],bI=1234567,TI=Math.PI/180,SI=180/Math.PI;function ooe(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,r=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(os[e&255]+os[e>>8&255]+os[e>>16&255]+os[e>>24&255]+\\\"-\\\"+os[t&255]+os[t>>8&255]+\\\"-\\\"+os[t>>16&15|64]+os[t>>24&255]+\\\"-\\\"+os[r&63|128]+os[r>>8&255]+\\\"-\\\"+os[r>>16&255]+os[r>>24&255]+os[i&255]+os[i>>8&255]+os[i>>16&255]+os[i>>24&255]).toLowerCase()}function sr(e,t,r){return Math.max(t,Math.min(r,e))}function Nw(e,t){return(e%t+t)%t}function loe(e,t,r,i,s){return i+(e-t)*(s-i)/(r-t)}function uoe(e,t,r){return e!==t?(r-e)/(t-e):0}function Om(e,t,r){return(1-r)*e+r*t}function hoe(e,t,r,i){return Om(e,t,1-Math.exp(-r*i))}function doe(e,t=1){return t-Math.abs(Nw(e,t*2)-t)}function coe(e,t,r){return e\\u003c=t?0:e>=r?1:(e=(e-t)/(r-t),e*e*(3-2*e))}function poe(e,t,r){return e\\u003c=t?0:e>=r?1:(e=(e-t)/(r-t),e*e*e*(e*(e*6-15)+10))}function moe(e,t){return e+Math.floor(Math.random()*(t-e+1))}function foe(e,t){return e+Math.random()*(t-e)}function goe(e){return e*(.5-Math.random())}function yoe(e){e!==void 0&&(bI=e);let t=bI+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function xoe(e){return e*TI}function voe(e){return e*SI}function boe(e){return(e&e-1)===0&&e!==0}function Toe(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Soe(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function _oe(e,t,r,i,s){let a=Math.cos,n=Math.sin,o=a(r/2),l=n(r/2),u=a((t+i)/2),h=n((t+i)/2),d=a((t-i)/2),c=n((t-i)/2),m=a((i-t)/2),g=n((i-t)/2);switch(s){case\\\"XYX\\\":e.set(o*h,l*d,l*c,o*u);break;case\\\"YZY\\\":e.set(l*c,o*h,l*d,o*u);break;case\\\"ZXZ\\\":e.set(l*d,l*c,o*h,o*u);break;case\\\"XZX\\\":e.set(o*h,l*g,l*m,o*u);break;case\\\"YXY\\\":e.set(l*m,o*h,l*g,o*u);break;case\\\"ZYZ\\\":e.set(l*g,l*m,o*h,o*u);break;default:ns(\\\"MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: \\\"+s)}}function woe(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error(\\\"THREE.MathUtils: Invalid component type.\\\")}}function Moe(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw new Error(\\\"THREE.MathUtils: Invalid component type.\\\")}}var Noe={DEG2RAD:TI,RAD2DEG:SI,generateUUID:ooe,clamp:sr,euclideanModulo:Nw,mapLinear:loe,inverseLerp:uoe,lerp:Om,damp:hoe,pingpong:doe,smoothstep:coe,smootherstep:poe,randInt:moe,randFloat:foe,randFloatSpread:goe,seededRandom:yoe,degToRad:xoe,radToDeg:voe,isPowerOfTwo:boe,ceilPowerOfTwo:Toe,floorPowerOfTwo:Soe,setQuaternionFromProperEuler:_oe,normalize:Moe,denormalize:woe},X1=class nD{static{nD.prototype.isMatrix3=!0}constructor(t,r,i,s,a,n,o,l,u){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,r,i,s,a,n,o,l,u)}set(t,r,i,s,a,n,o,l,u){let h=this.elements;return h[0]=t,h[1]=s,h[2]=o,h[3]=r,h[4]=a,h[5]=l,h[6]=i,h[7]=n,h[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let r=this.elements,i=t.elements;return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],this}extractBasis(t,r,i){return t.setFromMatrix3Column(this,0),r.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let r=t.elements;return this.set(r[0],r[4],r[8],r[1],r[5],r[9],r[2],r[6],r[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,r){let i=t.elements,s=r.elements,a=this.elements,n=i[0],o=i[3],l=i[6],u=i[1],h=i[4],d=i[7],c=i[2],m=i[5],g=i[8],y=s[0],b=s[3],v=s[6],S=s[1],T=s[4],w=s[7],N=s[2],C=s[5],R=s[8];return a[0]=n*y+o*S+l*N,a[3]=n*b+o*T+l*C,a[6]=n*v+o*w+l*R,a[1]=u*y+h*S+d*N,a[4]=u*b+h*T+d*C,a[7]=u*v+h*w+d*R,a[2]=c*y+m*S+g*N,a[5]=c*b+m*T+g*C,a[8]=c*v+m*w+g*R,this}multiplyScalar(t){let r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=t,r[4]*=t,r[7]*=t,r[2]*=t,r[5]*=t,r[8]*=t,this}determinant(){let t=this.elements,r=t[0],i=t[1],s=t[2],a=t[3],n=t[4],o=t[5],l=t[6],u=t[7],h=t[8];return r*n*h-r*o*u-i*a*h+i*o*l+s*a*u-s*n*l}invert(){let t=this.elements,r=t[0],i=t[1],s=t[2],a=t[3],n=t[4],o=t[5],l=t[6],u=t[7],h=t[8],d=h*n-o*u,c=o*l-h*a,m=u*a-n*l,g=r*d+i*c+s*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);let y=1/g;return t[0]=d*y,t[1]=(s*u-h*i)*y,t[2]=(o*i-s*n)*y,t[3]=c*y,t[4]=(h*r-s*l)*y,t[5]=(s*a-o*r)*y,t[6]=m*y,t[7]=(i*l-u*r)*y,t[8]=(n*r-i*a)*y,this}transpose(){let t,r=this.elements;return t=r[1],r[1]=r[3],r[3]=t,t=r[2],r[2]=r[6],r[6]=t,t=r[5],r[5]=r[7],r[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let r=this.elements;return t[0]=r[0],t[1]=r[3],t[2]=r[6],t[3]=r[1],t[4]=r[4],t[5]=r[7],t[6]=r[2],t[7]=r[5],t[8]=r[8],this}setUvTransform(t,r,i,s,a,n,o){let l=Math.cos(a),u=Math.sin(a);return this.set(i*l,i*u,-i*(l*n+u*o)+n+t,-s*u,s*l,-s*(-u*n+l*o)+o+r,0,0,1),this}scale(t,r){return Dm(\\\"Matrix3: .scale() is deprecated. Use .makeScale() instead.\\\"),this.premultiply(Aw.makeScale(t,r)),this}rotate(t){return Dm(\\\"Matrix3: .rotate() is deprecated. Use .makeRotation() instead.\\\"),this.premultiply(Aw.makeRotation(-t)),this}translate(t,r){return Dm(\\\"Matrix3: .translate() is deprecated. Use .makeTranslation() instead.\\\"),this.premultiply(Aw.makeTranslation(t,r)),this}makeTranslation(t,r){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,r,0,0,1),this}makeRotation(t){let r=Math.cos(t),i=Math.sin(t);return this.set(r,-i,0,i,r,0,0,0,1),this}makeScale(t,r){return this.set(t,0,0,0,r,0,0,0,1),this}equals(t){let r=this.elements,i=t.elements;for(let s=0;s\\u003c9;s++)if(r[s]!==i[s])return!1;return!0}fromArray(t,r=0){for(let i=0;i\\u003c9;i++)this.elements[i]=t[i+r];return this}toArray(t=[],r=0){let i=this.elements;return t[r]=i[0],t[r+1]=i[1],t[r+2]=i[2],t[r+3]=i[3],t[r+4]=i[4],t[r+5]=i[5],t[r+6]=i[6],t[r+7]=i[7],t[r+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}},Aw=new X1,_I=new X1().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),wI=new X1().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Aoe(){let e={enabled:!0,workingColorSpace:gI,spaces:{},convert:function(s,a,n){return this.enabled===!1||a===n||!a||!n||(this.spaces[a].transfer===ww&&(s.r=mc(s.r),s.g=mc(s.g),s.b=mc(s.b)),this.spaces[a].primaries!==this.spaces[n].primaries&&(s.applyMatrix3(this.spaces[a].toXYZ),s.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===ww&&(s.r=fc(s.r),s.g=fc(s.g),s.b=fc(s.b))),s},workingToColorSpace:function(s,a){return this.convert(s,this.workingColorSpace,a)},colorSpaceToWorking:function(s,a){return this.convert(s,a,this.workingColorSpace)},getPrimaries:function(s){return this.spaces[s].primaries},getTransfer:function(s){return s===noe?yI:this.spaces[s].transfer},getToneMappingMode:function(s){return this.spaces[s].outputColorSpaceConfig.toneMappingMode||\\\"standard\\\"},getLuminanceCoefficients:function(s,a=this.workingColorSpace){return s.fromArray(this.spaces[a].luminanceCoefficients)},define:function(s){Object.assign(this.spaces,s)},_getMatrix:function(s,a,n){return s.copy(this.spaces[a].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(s){return this.spaces[s].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(s=this.workingColorSpace){return this.spaces[s].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(s,a){return Dm(\\\"ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().\\\"),e.workingToColorSpace(s,a)},toWorkingColorSpace:function(s,a){return Dm(\\\"ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().\\\"),e.colorSpaceToWorking(s,a)}},t=[.64,.33,.3,.6,.15,.06],r=[.2126,.7152,.0722],i=[.3127,.329];return e.define({[gI]:{primaries:t,whitePoint:i,transfer:yI,toXYZ:_I,fromXYZ:wI,luminanceCoefficients:r,workingColorSpaceConfig:{unpackColorSpace:Qa},outputColorSpaceConfig:{drawingBufferColorSpace:Qa}},[Qa]:{primaries:t,whitePoint:i,transfer:ww,toXYZ:_I,fromXYZ:wI,luminanceCoefficients:r,outputColorSpaceConfig:{drawingBufferColorSpace:Qa}}}),e}var Ka=Aoe();function mc(e){return e\\u003c.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}function fc(e){return e\\u003c.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}var MI={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Yl={h:0,s:0,l:0},$1={h:0,s:0,l:0};function Cw(e,t,r){return r\\u003c0&&(r+=1),r>1&&(r-=1),r\\u003c.16666666666666666?e+(t-e)*6*r:r\\u003c.5?t:r\\u003c.6666666666666666?e+(t-e)*6*(.6666666666666666-r):e}var Rw=class{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){let i=e;i&&i.isColor?this.copy(i):typeof i==\\\"number\\\"?this.setHex(i):typeof i==\\\"string\\\"&&this.setStyle(i)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Qa){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ka.colorSpaceToWorking(this,t),this}setRGB(e,t,r,i=Ka.workingColorSpace){return this.r=e,this.g=t,this.b=r,Ka.colorSpaceToWorking(this,i),this}setHSL(e,t,r,i=Ka.workingColorSpace){if(e=Nw(e,1),t=sr(t,0,1),r=sr(r,0,1),t===0)this.r=this.g=this.b=r;else{let s=r\\u003c=.5?r*(1+t):r+t-r*t,a=2*r-s;this.r=Cw(a,s,e+1/3),this.g=Cw(a,s,e),this.b=Cw(a,s,e-1/3)}return Ka.colorSpaceToWorking(this,i),this}setStyle(e,t=Qa){function r(s){s!==void 0&&parseFloat(s)\\u003c1&&ns(\\\"Color: Alpha component of \\\"+e+\\\" will be ignored.\\\")}let i;if(i=/^(\\\\w+)\\\\(([^\\\\)]*)\\\\)/.exec(e)){let s,a=i[1],n=i[2];switch(a){case\\\"rgb\\\":case\\\"rgba\\\":if(s=/^\\\\s*(\\\\d+)\\\\s*,\\\\s*(\\\\d+)\\\\s*,\\\\s*(\\\\d+)\\\\s*(?:,\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\s*)?$/.exec(n))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\\\\s*(\\\\d+)\\\\%\\\\s*,\\\\s*(\\\\d+)\\\\%\\\\s*,\\\\s*(\\\\d+)\\\\%\\\\s*(?:,\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\s*)?$/.exec(n))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case\\\"hsl\\\":case\\\"hsla\\\":if(s=/^\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\s*,\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\%\\\\s*,\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\%\\\\s*(?:,\\\\s*(\\\\d*\\\\.?\\\\d+)\\\\s*)?$/.exec(n))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:ns(\\\"Color: Unknown color model \\\"+e)}}else if(i=/^\\\\#([A-Fa-f\\\\d]+)$/.exec(e)){let s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);ns(\\\"Color: Invalid hex color \\\"+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Qa){let r=MI[e.toLowerCase()];return r!==void 0?this.setHex(r,t):ns(\\\"Color: Unknown color \\\"+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=mc(e.r),this.g=mc(e.g),this.b=mc(e.b),this}copyLinearToSRGB(e){return this.r=fc(e.r),this.g=fc(e.g),this.b=fc(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Qa){return Ka.workingToColorSpace(ls.copy(this),e),Math.round(sr(ls.r*255,0,255))*65536+Math.round(sr(ls.g*255,0,255))*256+Math.round(sr(ls.b*255,0,255))}getHexString(e=Qa){return(\\\"000000\\\"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ka.workingColorSpace){Ka.workingToColorSpace(ls.copy(this),t);let r=ls.r,i=ls.g,s=ls.b,a=Math.max(r,i,s),n=Math.min(r,i,s),o,l,u=(n+a)/2;if(n===a)o=0,l=0;else{let h=a-n;switch(l=u\\u003c=.5?h/(a+n):h/(2-a-n),a){case r:o=(i-s)/h+(i\\u003cs?6:0);break;case i:o=(s-r)/h+2;break;case s:o=(r-i)/h+4;break}o/=6}return e.h=o,e.s=l,e.l=u,e}getRGB(e,t=Ka.workingColorSpace){return Ka.workingToColorSpace(ls.copy(this),t),e.r=ls.r,e.g=ls.g,e.b=ls.b,e}getStyle(e=Qa){Ka.workingToColorSpace(ls.copy(this),e);let t=ls.r,r=ls.g,i=ls.b;return e!==Qa?`color(${e} ${t.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,t,r){return this.getHSL(Yl),this.setHSL(Yl.h+e,Yl.s+t,Yl.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(Yl),e.getHSL($1);let r=Om(Yl.h,$1.h,t),i=Om(Yl.s,$1.s,t),s=Om(Yl.l,$1.l,t);return this.setHSL(r,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,r=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*r+s[6]*i,this.g=s[1]*t+s[4]*r+s[7]*i,this.b=s[2]*t+s[5]*r+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},ls=new Rw;Rw.NAMES=MI;var Coe=class oD{static{oD.prototype.isMatrix2=!0}constructor(t,r,i,s){this.elements=[1,0,0,1],t!==void 0&&this.set(t,r,i,s)}identity(){return this.set(1,0,0,1),this}fromArray(t,r=0){for(let i=0;i\\u003c4;i++)this.elements[i]=t[i+r];return this}set(t,r,i,s){let a=this.elements;return a[0]=t,a[2]=r,a[1]=i,a[3]=s,this}},Roe=class{constructor(e=0,t=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=i}static slerpFlat(e,t,r,i,s,a,n){let o=r[i+0],l=r[i+1],u=r[i+2],h=r[i+3],d=s[a+0],c=s[a+1],m=s[a+2],g=s[a+3];if(h!==g||o!==d||l!==c||u!==m){let y=o*d+l*c+u*m+h*g;y\\u003c0&&(d=-d,c=-c,m=-m,g=-g,y=-y);let b=1-n;if(y\\u003c.9995){let v=Math.acos(y),S=Math.sin(v);b=Math.sin(b*v)/S,n=Math.sin(n*v)/S,o=o*b+d*n,l=l*b+c*n,u=u*b+m*n,h=h*b+g*n}else{o=o*b+d*n,l=l*b+c*n,u=u*b+m*n,h=h*b+g*n;let v=1/Math.sqrt(o*o+l*l+u*u+h*h);o*=v,l*=v,u*=v,h*=v}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,r,i,s,a){let n=r[i],o=r[i+1],l=r[i+2],u=r[i+3],h=s[a],d=s[a+1],c=s[a+2],m=s[a+3];return e[t]=n*m+u*h+o*c-l*d,e[t+1]=o*m+u*d+l*h-n*c,e[t+2]=l*m+u*c+n*d-o*h,e[t+3]=u*m-n*h-o*d-l*c,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let r=e._x,i=e._y,s=e._z,a=e._order,n=Math.cos,o=Math.sin,l=n(r/2),u=n(i/2),h=n(s/2),d=o(r/2),c=o(i/2),m=o(s/2);switch(a){case\\\"XYZ\\\":this._x=d*u*h+l*c*m,this._y=l*c*h-d*u*m,this._z=l*u*m+d*c*h,this._w=l*u*h-d*c*m;break;case\\\"YXZ\\\":this._x=d*u*h+l*c*m,this._y=l*c*h-d*u*m,this._z=l*u*m-d*c*h,this._w=l*u*h+d*c*m;break;case\\\"ZXY\\\":this._x=d*u*h-l*c*m,this._y=l*c*h+d*u*m,this._z=l*u*m+d*c*h,this._w=l*u*h-d*c*m;break;case\\\"ZYX\\\":this._x=d*u*h-l*c*m,this._y=l*c*h+d*u*m,this._z=l*u*m-d*c*h,this._w=l*u*h+d*c*m;break;case\\\"YZX\\\":this._x=d*u*h+l*c*m,this._y=l*c*h+d*u*m,this._z=l*u*m-d*c*h,this._w=l*u*h-d*c*m;break;case\\\"XZY\\\":this._x=d*u*h-l*c*m,this._y=l*c*h-d*u*m,this._z=l*u*m+d*c*h,this._w=l*u*h+d*c*m;break;default:ns(\\\"Quaternion: .setFromEuler() encountered an unknown order: \\\"+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,r=t[0],i=t[4],s=t[8],a=t[1],n=t[5],o=t[9],l=t[2],u=t[6],h=t[10],d=r+n+h;if(d>0){let c=.5/Math.sqrt(d+1);this._w=.25/c,this._x=(u-o)*c,this._y=(s-l)*c,this._z=(a-i)*c}else if(r>n&&r>h){let c=2*Math.sqrt(1+r-n-h);this._w=(u-o)/c,this._x=.25*c,this._y=(i+a)/c,this._z=(s+l)/c}else if(n>h){let c=2*Math.sqrt(1+n-r-h);this._w=(s-l)/c,this._x=(i+a)/c,this._y=.25*c,this._z=(o+u)/c}else{let c=2*Math.sqrt(1+h-r-n);this._w=(a-i)/c,this._x=(s+l)/c,this._y=(o+u)/c,this._z=.25*c}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r\\u003c1e-8?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(sr(this.dot(e),-1,1)))}rotateTowards(e,t){let r=this.angleTo(e);if(r===0)return this;let i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let r=e._x,i=e._y,s=e._z,a=e._w,n=t._x,o=t._y,l=t._z,u=t._w;return this._x=r*u+a*n+i*l-s*o,this._y=i*u+a*o+s*n-r*l,this._z=s*u+a*l+r*o-i*n,this._w=a*u-r*n-i*o-s*l,this._onChangeCallback(),this}slerp(e,t){let r=e._x,i=e._y,s=e._z,a=e._w,n=this.dot(e);n\\u003c0&&(r=-r,i=-i,s=-s,a=-a,n=-n);let o=1-t;if(n\\u003c.9995){let l=Math.acos(n),u=Math.sin(l);o=Math.sin(o*l)/u,t=Math.sin(t*l)/u,this._x=this._x*o+r*t,this._y=this._y*o+i*t,this._z=this._z*o+s*t,this._w=this._w*o+a*t,this._onChangeCallback()}else this._x=this._x*o+r*t,this._y=this._y*o+i*t,this._z=this._z*o+s*t,this._w=this._w*o+a*t,this.normalize();return this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Zl=class lD{static{lD.prototype.isVector3=!0}constructor(t=0,r=0,i=0){this.x=t,this.y=r,this.z=i}set(t,r,i){return i===void 0&&(i=this.z),this.x=t,this.y=r,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;break;default:throw new Error(\\\"THREE.Vector3: index is out of range: \\\"+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error(\\\"THREE.Vector3: index is out of range: \\\"+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this.z=t.z+r.z,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this.z+=t.z*r,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this.z=t.z-r.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,r){return this.x=t.x*r.x,this.y=t.y*r.y,this.z=t.z*r.z,this}applyEuler(t){return this.applyQuaternion(NI.setFromEuler(t))}applyAxisAngle(t,r){return this.applyQuaternion(NI.setFromAxisAngle(t,r))}applyMatrix3(t){let r=this.x,i=this.y,s=this.z,a=t.elements;return this.x=a[0]*r+a[3]*i+a[6]*s,this.y=a[1]*r+a[4]*i+a[7]*s,this.z=a[2]*r+a[5]*i+a[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let r=this.x,i=this.y,s=this.z,a=t.elements,n=1/(a[3]*r+a[7]*i+a[11]*s+a[15]);return this.x=(a[0]*r+a[4]*i+a[8]*s+a[12])*n,this.y=(a[1]*r+a[5]*i+a[9]*s+a[13])*n,this.z=(a[2]*r+a[6]*i+a[10]*s+a[14])*n,this}applyQuaternion(t){let r=this.x,i=this.y,s=this.z,a=t.x,n=t.y,o=t.z,l=t.w,u=2*(n*s-o*i),h=2*(o*r-a*s),d=2*(a*i-n*r);return this.x=r+l*u+n*d-o*h,this.y=i+l*h+o*u-a*d,this.z=s+l*d+a*h-n*u,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let r=this.x,i=this.y,s=this.z,a=t.elements;return this.x=a[0]*r+a[4]*i+a[8]*s,this.y=a[1]*r+a[5]*i+a[9]*s,this.z=a[2]*r+a[6]*i+a[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,r){return this.x=sr(this.x,t.x,r.x),this.y=sr(this.y,t.y,r.y),this.z=sr(this.z,t.z,r.z),this}clampScalar(t,r){return this.x=sr(this.x,t,r),this.y=sr(this.y,t,r),this.z=sr(this.z,t,r),this}clampLength(t,r){let i=this.length();return this.divideScalar(i||1).multiplyScalar(sr(i,t,r))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this.z+=(t.z-this.z)*r,this}lerpVectors(t,r,i){return this.x=t.x+(r.x-t.x)*i,this.y=t.y+(r.y-t.y)*i,this.z=t.z+(r.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,r){let i=t.x,s=t.y,a=t.z,n=r.x,o=r.y,l=r.z;return this.x=s*l-a*o,this.y=a*n-i*l,this.z=i*o-s*n,this}projectOnVector(t){let r=t.lengthSq();if(r===0)return this.set(0,0,0);let i=t.dot(this)/r;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Ew.copy(this).projectOnVector(t),this.sub(Ew)}reflect(t){return this.sub(Ew.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let r=Math.sqrt(this.lengthSq()*t.lengthSq());if(r===0)return Math.PI/2;let i=this.dot(t)/r;return Math.acos(sr(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let r=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return r*r+i*i+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,r,i){let s=Math.sin(r)*t;return this.x=s*Math.sin(i),this.y=Math.cos(r)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,r,i){return this.x=t*Math.sin(r),this.y=i,this.z=t*Math.cos(r),this}setFromMatrixPosition(t){let r=t.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this}setFromMatrixScale(t){let r=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=r,this.y=i,this.z=s,this}setFromMatrixColumn(t,r){return this.fromArray(t.elements,r*4)}setFromMatrix3Column(t,r){return this.fromArray(t.elements,r*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this.z=t[r+2],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t[r+2]=this.z,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this.z=t.getZ(r),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,r=Math.random()*2-1,i=Math.sqrt(1-r*r);return this.x=i*Math.cos(t),this.y=r,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Ew=new Zl,NI=new Roe,AI=class dM{static{dM.prototype.isMatrix4=!0}constructor(t,r,i,s,a,n,o,l,u,h,d,c,m,g,y,b){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,r,i,s,a,n,o,l,u,h,d,c,m,g,y,b)}set(t,r,i,s,a,n,o,l,u,h,d,c,m,g,y,b){let v=this.elements;return v[0]=t,v[4]=r,v[8]=i,v[12]=s,v[1]=a,v[5]=n,v[9]=o,v[13]=l,v[2]=u,v[6]=h,v[10]=d,v[14]=c,v[3]=m,v[7]=g,v[11]=y,v[15]=b,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new dM().fromArray(this.elements)}copy(t){let r=this.elements,i=t.elements;return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],this}copyPosition(t){let r=this.elements,i=t.elements;return r[12]=i[12],r[13]=i[13],r[14]=i[14],this}setFromMatrix3(t){let r=t.elements;return this.set(r[0],r[3],r[6],0,r[1],r[4],r[7],0,r[2],r[5],r[8],0,0,0,0,1),this}extractBasis(t,r,i){return this.determinantAffine()===0?(t.set(1,0,0),r.set(0,1,0),i.set(0,0,1),this):(t.setFromMatrixColumn(this,0),r.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(t,r,i){return this.set(t.x,r.x,i.x,0,t.y,r.y,i.y,0,t.z,r.z,i.z,0,0,0,0,1),this}extractRotation(t){if(t.determinantAffine()===0)return this.identity();let r=this.elements,i=t.elements,s=1/gc.setFromMatrixColumn(t,0).length(),a=1/gc.setFromMatrixColumn(t,1).length(),n=1/gc.setFromMatrixColumn(t,2).length();return r[0]=i[0]*s,r[1]=i[1]*s,r[2]=i[2]*s,r[3]=0,r[4]=i[4]*a,r[5]=i[5]*a,r[6]=i[6]*a,r[7]=0,r[8]=i[8]*n,r[9]=i[9]*n,r[10]=i[10]*n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromEuler(t){let r=this.elements,i=t.x,s=t.y,a=t.z,n=Math.cos(i),o=Math.sin(i),l=Math.cos(s),u=Math.sin(s),h=Math.cos(a),d=Math.sin(a);if(t.order===\\\"XYZ\\\"){let c=n*h,m=n*d,g=o*h,y=o*d;r[0]=l*h,r[4]=-l*d,r[8]=u,r[1]=m+g*u,r[5]=c-y*u,r[9]=-o*l,r[2]=y-c*u,r[6]=g+m*u,r[10]=n*l}else if(t.order===\\\"YXZ\\\"){let c=l*h,m=l*d,g=u*h,y=u*d;r[0]=c+y*o,r[4]=g*o-m,r[8]=n*u,r[1]=n*d,r[5]=n*h,r[9]=-o,r[2]=m*o-g,r[6]=y+c*o,r[10]=n*l}else if(t.order===\\\"ZXY\\\"){let c=l*h,m=l*d,g=u*h,y=u*d;r[0]=c-y*o,r[4]=-n*d,r[8]=g+m*o,r[1]=m+g*o,r[5]=n*h,r[9]=y-c*o,r[2]=-n*u,r[6]=o,r[10]=n*l}else if(t.order===\\\"ZYX\\\"){let c=n*h,m=n*d,g=o*h,y=o*d;r[0]=l*h,r[4]=g*u-m,r[8]=c*u+y,r[1]=l*d,r[5]=y*u+c,r[9]=m*u-g,r[2]=-u,r[6]=o*l,r[10]=n*l}else if(t.order===\\\"YZX\\\"){let c=n*l,m=n*u,g=o*l,y=o*u;r[0]=l*h,r[4]=y-c*d,r[8]=g*d+m,r[1]=d,r[5]=n*h,r[9]=-o*h,r[2]=-u*h,r[6]=m*d+g,r[10]=c-y*d}else if(t.order===\\\"XZY\\\"){let c=n*l,m=n*u,g=o*l,y=o*u;r[0]=l*h,r[4]=-d,r[8]=u*h,r[1]=c*d+y,r[5]=n*h,r[9]=m*d-g,r[2]=g*d-m,r[6]=o*h,r[10]=y*d+c}return r[3]=0,r[7]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Eoe,t,Poe)}lookAt(t,r,i){let s=this.elements;return ra.subVectors(t,r),ra.lengthSq()===0&&(ra.z=1),ra.normalize(),Jl.crossVectors(i,ra),Jl.lengthSq()===0&&(Math.abs(i.z)===1?ra.x+=1e-4:ra.z+=1e-4,ra.normalize(),Jl.crossVectors(i,ra)),Jl.normalize(),q1.crossVectors(ra,Jl),s[0]=Jl.x,s[4]=q1.x,s[8]=ra.x,s[1]=Jl.y,s[5]=q1.y,s[9]=ra.y,s[2]=Jl.z,s[6]=q1.z,s[10]=ra.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,r){let i=t.elements,s=r.elements,a=this.elements,n=i[0],o=i[4],l=i[8],u=i[12],h=i[1],d=i[5],c=i[9],m=i[13],g=i[2],y=i[6],b=i[10],v=i[14],S=i[3],T=i[7],w=i[11],N=i[15],C=s[0],R=s[4],E=s[8],P=s[12],I=s[1],O=s[5],L=s[9],X=s[13],z=s[2],H=s[6],ue=s[10],ne=s[14],re=s[3],ce=s[7],ge=s[11],ye=s[15];return a[0]=n*C+o*I+l*z+u*re,a[4]=n*R+o*O+l*H+u*ce,a[8]=n*E+o*L+l*ue+u*ge,a[12]=n*P+o*X+l*ne+u*ye,a[1]=h*C+d*I+c*z+m*re,a[5]=h*R+d*O+c*H+m*ce,a[9]=h*E+d*L+c*ue+m*ge,a[13]=h*P+d*X+c*ne+m*ye,a[2]=g*C+y*I+b*z+v*re,a[6]=g*R+y*O+b*H+v*ce,a[10]=g*E+y*L+b*ue+v*ge,a[14]=g*P+y*X+b*ne+v*ye,a[3]=S*C+T*I+w*z+N*re,a[7]=S*R+T*O+w*H+N*ce,a[11]=S*E+T*L+w*ue+N*ge,a[15]=S*P+T*X+w*ne+N*ye,this}multiplyScalar(t){let r=this.elements;return r[0]*=t,r[4]*=t,r[8]*=t,r[12]*=t,r[1]*=t,r[5]*=t,r[9]*=t,r[13]*=t,r[2]*=t,r[6]*=t,r[10]*=t,r[14]*=t,r[3]*=t,r[7]*=t,r[11]*=t,r[15]*=t,this}determinant(){let t=this.elements,r=t[0],i=t[4],s=t[8],a=t[12],n=t[1],o=t[5],l=t[9],u=t[13],h=t[2],d=t[6],c=t[10],m=t[14],g=t[3],y=t[7],b=t[11],v=t[15],S=l*m-u*c,T=o*m-u*d,w=o*c-l*d,N=n*m-u*h,C=n*c-l*h,R=n*d-o*h;return r*(y*S-b*T+v*w)-i*(g*S-b*N+v*C)+s*(g*T-y*N+v*R)-a*(g*w-y*C+b*R)}determinantAffine(){let t=this.elements,r=t[0],i=t[4],s=t[8],a=t[1],n=t[5],o=t[9],l=t[2],u=t[6],h=t[10];return r*(n*h-o*u)-i*(a*h-o*l)+s*(a*u-n*l)}transpose(){let t=this.elements,r;return r=t[1],t[1]=t[4],t[4]=r,r=t[2],t[2]=t[8],t[8]=r,r=t[6],t[6]=t[9],t[9]=r,r=t[3],t[3]=t[12],t[12]=r,r=t[7],t[7]=t[13],t[13]=r,r=t[11],t[11]=t[14],t[14]=r,this}setPosition(t,r,i){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=r,s[14]=i),this}invert(){let t=this.elements,r=t[0],i=t[1],s=t[2],a=t[3],n=t[4],o=t[5],l=t[6],u=t[7],h=t[8],d=t[9],c=t[10],m=t[11],g=t[12],y=t[13],b=t[14],v=t[15],S=r*o-i*n,T=r*l-s*n,w=r*u-a*n,N=i*l-s*o,C=i*u-a*o,R=s*u-a*l,E=h*y-d*g,P=h*b-c*g,I=h*v-m*g,O=d*b-c*y,L=d*v-m*y,X=c*v-m*b,z=S*X-T*L+w*O+N*I-C*P+R*E;if(z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let H=1/z;return t[0]=(o*X-l*L+u*O)*H,t[1]=(s*L-i*X-a*O)*H,t[2]=(y*R-b*C+v*N)*H,t[3]=(c*C-d*R-m*N)*H,t[4]=(l*I-n*X-u*P)*H,t[5]=(r*X-s*I+a*P)*H,t[6]=(b*w-g*R-v*T)*H,t[7]=(h*R-c*w+m*T)*H,t[8]=(n*L-o*I+u*E)*H,t[9]=(i*I-r*L-a*E)*H,t[10]=(g*C-y*w+v*S)*H,t[11]=(d*w-h*C-m*S)*H,t[12]=(o*P-n*O-l*E)*H,t[13]=(r*O-i*P+s*E)*H,t[14]=(y*T-g*N-b*S)*H,t[15]=(h*N-d*T+c*S)*H,this}scale(t){let r=this.elements,i=t.x,s=t.y,a=t.z;return r[0]*=i,r[4]*=s,r[8]*=a,r[1]*=i,r[5]*=s,r[9]*=a,r[2]*=i,r[6]*=s,r[10]*=a,r[3]*=i,r[7]*=s,r[11]*=a,this}getMaxScaleOnAxis(){let t=this.elements,r=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(r,i,s))}makeTranslation(t,r,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,r,0,0,1,i,0,0,0,1),this}makeRotationX(t){let r=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,r,-i,0,0,i,r,0,0,0,0,1),this}makeRotationY(t){let r=Math.cos(t),i=Math.sin(t);return this.set(r,0,i,0,0,1,0,0,-i,0,r,0,0,0,0,1),this}makeRotationZ(t){let r=Math.cos(t),i=Math.sin(t);return this.set(r,-i,0,0,i,r,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,r){let i=Math.cos(r),s=Math.sin(r),a=1-i,n=t.x,o=t.y,l=t.z,u=a*n,h=a*o;return this.set(u*n+i,u*o-s*l,u*l+s*o,0,u*o+s*l,h*o+i,h*l-s*n,0,u*l-s*o,h*l+s*n,a*l*l+i,0,0,0,0,1),this}makeScale(t,r,i){return this.set(t,0,0,0,0,r,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,r,i,s,a,n){return this.set(1,i,a,0,t,1,n,0,r,s,1,0,0,0,0,1),this}compose(t,r,i){let s=this.elements,a=r._x,n=r._y,o=r._z,l=r._w,u=a+a,h=n+n,d=o+o,c=a*u,m=a*h,g=a*d,y=n*h,b=n*d,v=o*d,S=l*u,T=l*h,w=l*d,N=i.x,C=i.y,R=i.z;return s[0]=(1-(y+v))*N,s[1]=(m+w)*N,s[2]=(g-T)*N,s[3]=0,s[4]=(m-w)*C,s[5]=(1-(c+v))*C,s[6]=(b+S)*C,s[7]=0,s[8]=(g+T)*R,s[9]=(b-S)*R,s[10]=(1-(c+y))*R,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,r,i){let s=this.elements;t.x=s[12],t.y=s[13],t.z=s[14];let a=this.determinantAffine();if(a===0)return i.set(1,1,1),r.identity(),this;let n=gc.set(s[0],s[1],s[2]).length(),o=gc.set(s[4],s[5],s[6]).length(),l=gc.set(s[8],s[9],s[10]).length();a\\u003c0&&(n=-n),en.copy(this);let u=1/n,h=1/o,d=1/l;return en.elements[0]*=u,en.elements[1]*=u,en.elements[2]*=u,en.elements[4]*=h,en.elements[5]*=h,en.elements[6]*=h,en.elements[8]*=d,en.elements[9]*=d,en.elements[10]*=d,r.setFromRotationMatrix(en),i.x=n,i.y=o,i.z=l,this}makePerspective(t,r,i,s,a,n,o=uh,l=!1){let u=this.elements,h=2*a/(r-t),d=2*a/(i-s),c=(r+t)/(r-t),m=(i+s)/(i-s),g,y;if(l)g=a/(n-a),y=n*a/(n-a);else if(o===uh)g=-(n+a)/(n-a),y=-2*n*a/(n-a);else if(o===Mw)g=-n/(n-a),y=-n*a/(n-a);else throw new Error(\\\"THREE.Matrix4.makePerspective(): Invalid coordinate system: \\\"+o);return u[0]=h,u[4]=0,u[8]=c,u[12]=0,u[1]=0,u[5]=d,u[9]=m,u[13]=0,u[2]=0,u[6]=0,u[10]=g,u[14]=y,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(t,r,i,s,a,n,o=uh,l=!1){let u=this.elements,h=2/(r-t),d=2/(i-s),c=-(r+t)/(r-t),m=-(i+s)/(i-s),g,y;if(l)g=1/(n-a),y=n/(n-a);else if(o===uh)g=-2/(n-a),y=-(n+a)/(n-a);else if(o===Mw)g=-1/(n-a),y=-a/(n-a);else throw new Error(\\\"THREE.Matrix4.makeOrthographic(): Invalid coordinate system: \\\"+o);return u[0]=h,u[4]=0,u[8]=0,u[12]=c,u[1]=0,u[5]=d,u[9]=0,u[13]=m,u[2]=0,u[6]=0,u[10]=g,u[14]=y,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(t){let r=this.elements,i=t.elements;for(let s=0;s\\u003c16;s++)if(r[s]!==i[s])return!1;return!0}fromArray(t,r=0){for(let i=0;i\\u003c16;i++)this.elements[i]=t[i+r];return this}toArray(t=[],r=0){let i=this.elements;return t[r]=i[0],t[r+1]=i[1],t[r+2]=i[2],t[r+3]=i[3],t[r+4]=i[4],t[r+5]=i[5],t[r+6]=i[6],t[r+7]=i[7],t[r+8]=i[8],t[r+9]=i[9],t[r+10]=i[10],t[r+11]=i[11],t[r+12]=i[12],t[r+13]=i[13],t[r+14]=i[14],t[r+15]=i[15],t}},gc=new Zl,en=new AI,Eoe=new Zl(0,0,0),Poe=new Zl(1,1,1),Jl=new Zl,q1=new Zl,ra=new Zl,Boe=class uD{static{uD.prototype.isVector2=!0}constructor(t=0,r=0){this.x=t,this.y=r}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,r){return this.x=t,this.y=r,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;default:throw new Error(\\\"THREE.Vector2: index is out of range: \\\"+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error(\\\"THREE.Vector2: index is out of range: \\\"+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let r=this.x,i=this.y,s=t.elements;return this.x=s[0]*r+s[3]*i+s[6],this.y=s[1]*r+s[4]*i+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,r){return this.x=sr(this.x,t.x,r.x),this.y=sr(this.y,t.y,r.y),this}clampScalar(t,r){return this.x=sr(this.x,t,r),this.y=sr(this.y,t,r),this}clampLength(t,r){let i=this.length();return this.divideScalar(i||1).multiplyScalar(sr(i,t,r))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let r=Math.sqrt(this.lengthSq()*t.lengthSq());if(r===0)return Math.PI/2;let i=this.dot(t)/r;return Math.acos(sr(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let r=this.x-t.x,i=this.y-t.y;return r*r+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this}lerpVectors(t,r,i){return this.x=t.x+(r.x-t.x)*i,this.y=t.y+(r.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this}rotateAround(t,r){let i=Math.cos(r),s=Math.sin(r),a=this.x-t.x,n=this.y-t.y;return this.x=a*i-n*s+t.x,this.y=a*s+n*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Ioe=class hD{static{hD.prototype.isVector4=!0}constructor(t=0,r=0,i=0,s=1){this.x=t,this.y=r,this.z=i,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,r,i,s){return this.x=t,this.y=r,this.z=i,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,r){switch(t){case 0:this.x=r;break;case 1:this.y=r;break;case 2:this.z=r;break;case 3:this.w=r;break;default:throw new Error(\\\"THREE.Vector4: index is out of range: \\\"+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error(\\\"THREE.Vector4: index is out of range: \\\"+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,r){return this.x=t.x+r.x,this.y=t.y+r.y,this.z=t.z+r.z,this.w=t.w+r.w,this}addScaledVector(t,r){return this.x+=t.x*r,this.y+=t.y*r,this.z+=t.z*r,this.w+=t.w*r,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,r){return this.x=t.x-r.x,this.y=t.y-r.y,this.z=t.z-r.z,this.w=t.w-r.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let r=this.x,i=this.y,s=this.z,a=this.w,n=t.elements;return this.x=n[0]*r+n[4]*i+n[8]*s+n[12]*a,this.y=n[1]*r+n[5]*i+n[9]*s+n[13]*a,this.z=n[2]*r+n[6]*i+n[10]*s+n[14]*a,this.w=n[3]*r+n[7]*i+n[11]*s+n[15]*a,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let r=Math.sqrt(1-t.w*t.w);return r\\u003c1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/r,this.y=t.y/r,this.z=t.z/r),this}setAxisAngleFromRotationMatrix(t){let r,i,s,a,n=t.elements,o=n[0],l=n[4],u=n[8],h=n[1],d=n[5],c=n[9],m=n[2],g=n[6],y=n[10];if(Math.abs(l-h)\\u003c.01&&Math.abs(u-m)\\u003c.01&&Math.abs(c-g)\\u003c.01){if(Math.abs(l+h)\\u003c.1&&Math.abs(u+m)\\u003c.1&&Math.abs(c+g)\\u003c.1&&Math.abs(o+d+y-3)\\u003c.1)return this.set(1,0,0,0),this;r=Math.PI;let v=(o+1)/2,S=(d+1)/2,T=(y+1)/2,w=(l+h)/4,N=(u+m)/4,C=(c+g)/4;return v>S&&v>T?v\\u003c.01?(i=0,s=.707106781,a=.707106781):(i=Math.sqrt(v),s=w/i,a=N/i):S>T?S\\u003c.01?(i=.707106781,s=0,a=.707106781):(s=Math.sqrt(S),i=w/s,a=C/s):T\\u003c.01?(i=.707106781,s=.707106781,a=0):(a=Math.sqrt(T),i=N/a,s=C/a),this.set(i,s,a,r),this}let b=Math.sqrt((g-c)*(g-c)+(u-m)*(u-m)+(h-l)*(h-l));return Math.abs(b)\\u003c.001&&(b=1),this.x=(g-c)/b,this.y=(u-m)/b,this.z=(h-l)/b,this.w=Math.acos((o+d+y-1)/2),this}setFromMatrixPosition(t){let r=t.elements;return this.x=r[12],this.y=r[13],this.z=r[14],this.w=r[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,r){return this.x=sr(this.x,t.x,r.x),this.y=sr(this.y,t.y,r.y),this.z=sr(this.z,t.z,r.z),this.w=sr(this.w,t.w,r.w),this}clampScalar(t,r){return this.x=sr(this.x,t,r),this.y=sr(this.y,t,r),this.z=sr(this.z,t,r),this.w=sr(this.w,t,r),this}clampLength(t,r){let i=this.length();return this.divideScalar(i||1).multiplyScalar(sr(i,t,r))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,r){return this.x+=(t.x-this.x)*r,this.y+=(t.y-this.y)*r,this.z+=(t.z-this.z)*r,this.w+=(t.w-this.w)*r,this}lerpVectors(t,r,i){return this.x=t.x+(r.x-t.x)*i,this.y=t.y+(r.y-t.y)*i,this.z=t.z+(r.z-t.z)*i,this.w=t.w+(r.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,r=0){return this.x=t[r],this.y=t[r+1],this.z=t[r+2],this.w=t[r+3],this}toArray(t=[],r=0){return t[r]=this.x,t[r+1]=this.y,t[r+2]=this.z,t[r+3]=this.w,t}fromBufferAttribute(t,r){return this.x=t.getX(r),this.y=t.getY(r),this.z=t.getZ(r),this.w=t.getW(r),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},Foe=[/^StackTrace\\\\.js$/,/^TSLCore\\\\.js$/,/^.*Node\\\\.js$/,/^three\\\\.webgpu.*\\\\.js$/];function Loe(e){let t=/(?:at\\\\s+(.+?)\\\\s+\\\\()?(?:(.+?)@)?([^@\\\\s()]+):(\\\\d+):(\\\\d+)/;return e.split(`\\n`).map(r=>{let i=r.match(t);if(!i)return null;let s=i[1]||i[2]||\\\"\\\",a=i[3].split(\\\"?\\\")[0],n=parseInt(i[4],10),o=parseInt(i[5],10),l=a.split(\\\"/\\\").pop();return{fn:s,file:l,line:n,column:o}}).filter(r=>r&&!Foe.some(i=>i.test(r.file)))}var koe=class{constructor(e=null){this.isStackTrace=!0,this.stack=Loe(e||new Error().stack)}getLocation(){if(this.stack.length===0)return\\\"[Unknown location]\\\";let e=this.stack[0],t=e.fn;return`${t?`\\\"${t}()\\\" at `:\\\"\\\"}\\\"${e.file}:${e.line}\\\"`}getError(e){if(this.stack.length===0)return e;let t=this.stack.map(r=>{let i=`${r.file}:${r.line}:${r.column}`;return r.fn?` at ${r.fn} (${i})`:` at ${i}`}).join(`\\n`);return`${e}\\n${t}`}},hh=koe;function Pw(e,t=0){let r=3735928559^t,i=1103547991^t;if(Array.isArray(e))for(let s=0,a;s\\u003ce.length;s++)a=e[s],r=Math.imul(r^a,2654435761),i=Math.imul(i^a,1597334677);else for(let s=0,a;s\\u003ce.length;s++)a=e.charCodeAt(s),r=Math.imul(r^a,2654435761),i=Math.imul(i^a,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&i)+(r>>>0)}var Doe=e=>Pw(e),Ooe=e=>Pw(e),Uoe=(...e)=>Pw(e);function Bw(e){if(e==null)return null;let t=typeof e;return e.isNode===!0?\\\"node\\\":t===\\\"number\\\"?\\\"float\\\":t===\\\"boolean\\\"?\\\"bool\\\":t===\\\"string\\\"?\\\"string\\\":t===\\\"function\\\"?\\\"shader\\\":e.isVector2===!0?\\\"vec2\\\":e.isVector3===!0?\\\"vec3\\\":e.isVector4===!0?\\\"vec4\\\":e.isMatrix2===!0?\\\"mat2\\\":e.isMatrix3===!0?\\\"mat3\\\":e.isMatrix4===!0?\\\"mat4\\\":e.isColor===!0?\\\"color\\\":e instanceof ArrayBuffer?\\\"ArrayBuffer\\\":null}function CI(e,...t){let r=e?e.slice(-4):void 0;return t.length===1&&(r===\\\"vec2\\\"?t=[t[0],t[0]]:r===\\\"vec3\\\"?t=[t[0],t[0],t[0]]:r===\\\"vec4\\\"&&(t=[t[0],t[0],t[0],t[0]])),e===\\\"color\\\"?new Rw(...t):r===\\\"vec2\\\"?new Boe(...t):r===\\\"vec3\\\"?new Zl(...t):r===\\\"vec4\\\"?new Ioe(...t):r===\\\"mat2\\\"?new Coe(...t):r===\\\"mat3\\\"?new X1(...t):r===\\\"mat4\\\"?new AI(...t):e===\\\"bool\\\"?t[0]||!1:e===\\\"float\\\"||e===\\\"int\\\"||e===\\\"uint\\\"?t[0]||0:e===\\\"string\\\"?t[0]||\\\"\\\":e===\\\"ArrayBuffer\\\"?Voe(t[0]):null}function zoe(e){let t=\\\"\\\",r=new Uint8Array(e);for(let i=0;i\\u003cr.length;i++)t+=String.fromCharCode(r[i]);return btoa(t)}function Voe(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0)).buffer}var Goe=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){let r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){let r=this._listeners;if(r===void 0)return;let i=r[e];if(i!==void 0){let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let r=t[e.type];if(r!==void 0){e.target=this;let i=r.slice(0);for(let s=0,a=i.length;s\\u003ca;s++)i[s].call(this,e);e.target=null}}},Woe={analyze:\\\"setup\\\",generate:\\\"analyze\\\"},joe=0,RI=class dD extends Goe{static get type(){return\\\"Node\\\"}constructor(t=null){super(),this.nodeType=t,this.updateType=pc.NONE,this.updateBeforeType=pc.NONE,this.updateAfterType=pc.NONE,this.version=0,this.name=\\\"\\\",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=joe++,this.stackTrace=null,dD.captureStackTrace===!0&&(this.stackTrace=new hh)}set needsUpdate(t){t===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Noe.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(t,r){return this.updateType=r,this.update=t.bind(this),this}onFrameUpdate(t){return this.onUpdate(t,pc.FRAME)}onRenderUpdate(t){return this.onUpdate(t,pc.RENDER)}onObjectUpdate(t){return this.onUpdate(t,pc.OBJECT)}onReference(t){return this.updateReference=t.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:t}of this._getChildren())yield t}dispose(){this.dispatchEvent({type:\\\"dispose\\\"})}traverse(t){t(this);for(let r of this.getChildren())r.traverse(t)}_getChildren(t=new Set){let r=[];t.add(this);for(let i of Object.getOwnPropertyNames(this)){let s=this[i];if(!(i.startsWith(\\\"_\\\")===!0||t.has(s))){if(Array.isArray(s)===!0)for(let a=0;a\\u003cs.length;a++){let n=s[a];n&&n.isNode===!0&&r.push({property:i,index:a,childNode:n})}else if(s&&s.isNode===!0)r.push({property:i,childNode:s});else if(s&&Object.getPrototypeOf(s)===Object.prototype)for(let a in s){if(a.startsWith(\\\"_\\\")===!0)continue;let n=s[a];n&&n.isNode===!0&&r.push({property:i,index:a,childNode:n})}}}return r}getCacheKey(t=!1,r=null){if(t=t||this.version!==this._cacheKeyVersion,t===!0||this._cacheKey===null){r===null&&(r=new Set);let i=[];for(let{property:s,childNode:a}of this._getChildren(r))i.push(Doe(s.slice(0,-4)),a.getCacheKey(t,r));this._cacheKey=Uoe(Ooe(i),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}getHash(){return String(this.id)}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(t){let r=this.getNodeType(t);return t.getElementType(r)}getMemberType(){return\\\"void\\\"}getNodeType(t,r=null){let i=t.getDataFromNode(this),s;return r!==null?(i.typeFromOutput=i.typeFromOutput||{},s=i.typeFromOutput[r],s===void 0&&(s=this.generateNodeType(t,r),i.typeFromOutput[r]=s)):(s=i.type,s===void 0&&(s=this.generateNodeType(t),i.type=s)),s}generateNodeType(t,r=null){let i=t.getNodeProperties(this);return i.outputNode?i.outputNode.getNodeType(t,r):this.nodeType}getShared(t){let r=this.getHash(t),i=t.getNodeFromHash(r),s=null;if(i&&i!==this)s=i;else if(t.context.overrideNodes){let a=t.context.overrideNodes.get(this);if(a){let n=t.getDataFromNode(this);n.isOverwritten!==!0?(n.isOverwritten=!0,s=a(t).overrideNode(this,null),n.sharedNode=s):s=n.sharedNode}}return s||this}getArrayCount(){return null}setup(t){let r=t.getNodeProperties(this),i=0;for(let s of this.getChildren())r[\\\"node\\\"+i++]=s;return r.outputNode||null}analyze(t,r=null){let i=t.increaseUsage(this);if(this.parents===!0){let s=t.getDataFromNode(this,\\\"any\\\");s.stages=s.stages||{},s.stages[t.shaderStage]=s.stages[t.shaderStage]||[],s.stages[t.shaderStage].push(r)}if(i===1){let s=t.getNodeProperties(this);for(let a of Object.values(s))a&&a.isNode===!0&&a.build(t,this)}}generate(t,r){let{outputNode:i}=t.getNodeProperties(this);if(i&&i.isNode===!0)return i.build(t,r)}updateBefore(){ns(\\\"Abstract function.\\\")}updateAfter(){ns(\\\"Abstract function.\\\")}update(){ns(\\\"Abstract function.\\\")}before(t){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(t),this}build(t,r=null){let i=this.getShared(t);if(this!==i)return i.build(t,r);if(this._beforeNodes!==null){let l=this._beforeNodes;this._beforeNodes=null;for(let u of l)u.build(t,r);this._beforeNodes=l}let s=t.getDataFromNode(this);s.buildStages=s.buildStages||{},s.buildStages[t.buildStage]=!0;let a=Woe[t.buildStage];if(a&&s.buildStages[a]!==!0){let l=t.getBuildStage();t.setBuildStage(a),this.build(t),t.setBuildStage(l)}t.addChain(this);let n=null,o=t.getBuildStage();if(o===\\\"setup\\\"){t.addNode(this),this.updateReference(t);let l=t.getNodeProperties(this);if(l.initialized!==!0){l.initialized=!0,l.outputNode=this.setup(t)||l.outputNode||null;for(let u of Object.values(l))if(u&&u.isNode===!0){if(u.parents===!0){let h=t.getNodeProperties(u);h.parents=h.parents||[],h.parents.push(this)}u.build(t)}t.addSequentialNode(this)}n=l.outputNode}else if(o===\\\"analyze\\\")this.analyze(t,r);else if(o===\\\"generate\\\"){if(this.generate.length\\u003c2){let l=this.getNodeType(t),u=t.getDataFromNode(this);n=u.snippet,n===void 0?u.generated===void 0?(u.generated=!0,n=this.generate(t)||\\\"\\\",u.snippet=n):(ns(\\\"Node: Recursion detected.\\\",this),n=\\\"/* Recursion detected. */\\\"):u.flowCodes!==void 0&&t.context.nodeBlock!==void 0&&t.addFlowCodeHierarchy(this,t.context.nodeBlock),n=t.format(n,l,r)}else n=this.generate(t,r)||\\\"\\\";n===\\\"\\\"&&r!==null&&r!==\\\"void\\\"&&r!==\\\"OutputType\\\"&&(Uo(`TSL: Invalid generated code, expected a \\\"${r}\\\".`),n=t.generateConst(r))}return t.removeChain(this),n}getSerializeChildren(){return this._getChildren()}serialize(t){let r=this.getSerializeChildren(),i={};for(let{property:s,index:a,childNode:n}of r)a!==void 0?(i[s]===void 0&&(i[s]=Number.isInteger(a)?[]:{}),i[s][a]=n.toJSON(t.meta).uuid):i[s]=n.toJSON(t.meta).uuid;Object.keys(i).length>0&&(t.inputNodes=i)}deserialize(t){if(t.inputNodes!==void 0){let r=t.meta.nodes;for(let i in t.inputNodes)if(Array.isArray(t.inputNodes[i])){let s=[];for(let a of t.inputNodes[i])s.push(r[a]);this[i]=s}else if(typeof t.inputNodes[i]==\\\"object\\\"){let s={};for(let a in t.inputNodes[i]){let n=t.inputNodes[i][a];s[a]=r[n]}this[i]=s}else{let s=t.inputNodes[i];this[i]=r[s]}}}toJSON(t){let{uuid:r,type:i}=this,s=t===void 0||typeof t==\\\"string\\\";s&&(t={textures:{},images:{},nodes:{}});let a=t.nodes[r];a===void 0&&(a={uuid:r,type:i,meta:t,metadata:{version:4.7,type:\\\"Node\\\",generator:\\\"Node.toJSON\\\"}},s!==!0&&(t.nodes[a.uuid]=a),this.serialize(a),delete a.meta);function n(o){let l=[];for(let u in o){let h=o[u];delete h.metadata,l.push(h)}return l}if(s){let o=n(t.textures),l=n(t.images),u=n(t.nodes);o.length>0&&(a.textures=o),l.length>0&&(a.images=l),u.length>0&&(a.nodes=u)}return a}};RI.captureStackTrace=!1;var Hr=RI,Hoe=class extends Hr{static get type(){return\\\"TempNode\\\"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()===\\\"generate\\\"){let r=e.getVectorType(this.getNodeType(e,t)),i=e.getDataFromNode(this);if(i.propertyName!==void 0)return e.format(i.propertyName,r,t);if(r!==\\\"void\\\"&&t!==\\\"void\\\"&&this.hasDependencies(e)){let s=super.build(e,r),a=e.getVarFromNode(this,null,r),n=e.getPropertyName(a);return e.addLineFlowCode(`${n} = ${s}`,this),i.snippet=s,i.propertyName=n,e.format(i.propertyName,r,t)}}return super.build(e,t)}},Um=Hoe,Xoe=class extends Hr{static get type(){return\\\"ArrayElementNode\\\"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){let t=this.indexNode.getNodeType(e),r=this.node.build(e),i=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:\\\"uint\\\");return`${r}[ ${i} ]`}},EI=Xoe,$oe=class extends Hr{static get type(){return\\\"ConvertNode\\\"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){let t=this.node.getNodeType(e),r=null;for(let i of this.convertTo.split(\\\"|\\\"))(r===null||e.getTypeLength(t)===e.getTypeLength(i))&&(r=i);return r}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let r=this.node,i=this.getNodeType(e),s=r.build(e,i);return e.format(s,i,t)}},PI=$oe,qoe=class extends Um{static get type(){return\\\"JoinNode\\\"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,r)=>t+e.getTypeLength(r.getNodeType(e)),0))}generate(e,t){let r=this.getNodeType(e),i=e.getTypeLength(r),s=this.nodes,a=e.getComponentType(r),n=[],o=0;for(let u of s){if(o>=i){Uo(`TSL: Length of parameters exceeds maximum length of function '${r}()' type.`,this.stackTrace);break}let h=u.getNodeType(e),d=e.getTypeLength(h),c;if(o+d>i&&(Uo(`TSL: Length of '${r}()' data exceeds maximum length of output type.`,this.stackTrace),d=i-o,h=e.getTypeFromLength(d)),o+=d,c=u.build(e,h),e.getComponentType(h)!==a){let m=e.getTypeFromLength(d,a);c=e.format(c,h,m)}n.push(c)}let l=`${e.getType(r)}( ${n.join(\\\", \\\")} )`;return e.format(l,r,t)}},Yoe=qoe,Zoe=j1.join(\\\"\\\"),Joe=class extends Hr{static get type(){return\\\"SplitNode\\\"}constructor(e,t=\\\"x\\\"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(j1.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){let r=this.node,i=e.getTypeLength(r.getNodeType(e)),s=null;if(i>1){let a=null;this.getVectorLength()>=i&&(a=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let n=r.build(e,a);this.components.length===i&&this.components===Zoe.slice(0,this.components.length)?s=e.format(n,a,t):s=e.format(`${n}.${this.components}`,this.getNodeType(e),t)}else s=r.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},Qoe=Joe,Koe=class extends Um{static get type(){return\\\"SetNode\\\"}constructor(e,t,r){super(),this.sourceNode=e,this.components=t,this.targetNode=r}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:r,targetNode:i}=this,s=this.getNodeType(e),a=e.getComponentType(i.getNodeType(e)),n=e.getTypeFromLength(r.length,a),o=i.build(e,n),l=t.build(e,s),u=e.getTypeLength(s),h=[];for(let d=0;d\\u003cu;d++){let c=j1[d];c===r[0]?(h.push(o),d+=r.length-1):h.push(l+\\\".\\\"+c)}return`${e.getType(s)}( ${h.join(\\\", \\\")} )`}},ele=Koe,tle=class extends Um{static get type(){return\\\"FlipNode\\\"}constructor(e,t){super(),this.sourceNode=e,this.components=t}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:r}=this,i=this.getNodeType(e),s=r.build(e),a=e.getVarFromNode(this),n=e.getPropertyName(a);e.addLineFlowCode(n+\\\" = \\\"+s,this);let o=e.getTypeLength(i),l=[],u=0;for(let h=0;h\\u003co;h++){let d=j1[h];d===t[u]?(l.push(\\\"1.0 - \\\"+(n+\\\".\\\"+d)),u++):l.push(n+\\\".\\\"+d)}return`${e.getType(i)}( ${l.join(\\\", \\\")} )`}},rle=tle,ile=class extends Hr{static get type(){return\\\"InputNode\\\"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}generateNodeType(){return this.nodeType===null?Bw(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=Bw(this.value),e.nodeType=this.nodeType,e.valueType===\\\"ArrayBuffer\\\"&&(e.value=zoe(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?CI(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){ns(\\\"Abstract function.\\\")}},sle=ile,BI=/float|u?int/,ale=class extends sle{static get type(){return\\\"ConstNode\\\"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let r=this.getNodeType(e);return BI.test(r)&&BI.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),r,t)}},Vn=ale,nle=class extends Hr{static get type(){return\\\"MemberNode\\\"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!==\\\"void\\\"}generateNodeType(e){return this.hasMember(e)===!1?\\\"float\\\":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return\\\"float\\\";let r=this.getNodeType(e);return e.getStructTypeNode(r).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){ns(`TSL: Member \\\"${this.property}\\\" does not exist in struct.`,this.stackTrace);let t=this.getNodeType(e);return e.generateConst(t)}return this.structNode.build(e)+\\\".\\\"+this.property}},ole=nle,Y1=null,Iw=new Map;function Re(e,t){if(Iw.has(e)){ns(`TSL: Redefinition of method chaining '${e}'.`);return}if(typeof t!=\\\"function\\\")throw new Error(`THREE.TSL: Node element ${e} is not a function`);Iw.set(e,t),e!==\\\"assign\\\"&&(Hr.prototype[e]=function(...r){return this.isStackNode?this.addToStack(t(...r)):t(this,...r)},Hr.prototype[e+\\\"Assign\\\"]=function(...r){return this.isStackNode?this.assign(r[0],t(...r)):this.assign(t(this,...r))})}var lle=e=>e.replace(/r|s/g,\\\"x\\\").replace(/g|t/g,\\\"y\\\").replace(/b|p/g,\\\"z\\\").replace(/a|q/g,\\\"w\\\"),II=e=>lle(e).split(\\\"\\\").sort().join(\\\"\\\");Hr.prototype.assign=function(...e){if(this.isStackNode!==!0)return Y1!==null?Y1.assign(this,...e):Uo(\\\"TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().\\\",new hh),this;{let t=Iw.get(\\\"assign\\\");return this.addToStack(t(...e))}},Hr.prototype.toVarIntent=function(){return this},Hr.prototype.get=function(e){return new ole(this,e)};var zm={};function Z1(e,t,r){zm[e]=zm[t]=zm[r]={get(){this._cache=this._cache||{};let n=this._cache[e];return n===void 0&&(n=new Qoe(this,e),this._cache[e]=n),n},set(n){this[e].assign(zi(n))}};let i=e.toUpperCase(),s=t.toUpperCase(),a=r.toUpperCase();Hr.prototype[\\\"set\\\"+i]=Hr.prototype[\\\"set\\\"+s]=Hr.prototype[\\\"set\\\"+a]=function(n){let o=II(e);return new ele(this,o,zi(n))},Hr.prototype[\\\"flip\\\"+i]=Hr.prototype[\\\"flip\\\"+s]=Hr.prototype[\\\"flip\\\"+a]=function(){let n=II(e);return new rle(this,n)}}var Gn=[\\\"x\\\",\\\"y\\\",\\\"z\\\",\\\"w\\\"],Wn=[\\\"r\\\",\\\"g\\\",\\\"b\\\",\\\"a\\\"],jn=[\\\"s\\\",\\\"t\\\",\\\"p\\\",\\\"q\\\"];for(let e=0;e\\u003c4;e++){let t=Gn[e],r=Wn[e],i=jn[e];Z1(t,r,i);for(let s=0;s\\u003c4;s++){t=Gn[e]+Gn[s],r=Wn[e]+Wn[s],i=jn[e]+jn[s],Z1(t,r,i);for(let a=0;a\\u003c4;a++){t=Gn[e]+Gn[s]+Gn[a],r=Wn[e]+Wn[s]+Wn[a],i=jn[e]+jn[s]+jn[a],Z1(t,r,i);for(let n=0;n\\u003c4;n++)t=Gn[e]+Gn[s]+Gn[a]+Gn[n],r=Wn[e]+Wn[s]+Wn[a]+Wn[n],i=jn[e]+jn[s]+jn[a]+jn[n],Z1(t,r,i)}}}for(let e=0;e\\u003c32;e++)zm[e]={get(){this._cache=this._cache||{};let t=this._cache[e];return t===void 0&&(t=new EI(this,new Vn(e,\\\"uint\\\")),this._cache[e]=t),t},set(t){this[e].assign(zi(t))}};Object.defineProperties(Hr.prototype,zm);var ule=function(e,t=null){let r=Bw(e);return r===\\\"node\\\"?e:t===null&&(r===\\\"float\\\"||r===\\\"boolean\\\")||r&&r!==\\\"shader\\\"&&r!==\\\"string\\\"?zi(Dw(e,t)):r===\\\"shader\\\"?e.isFn?e:dh(e):e},hle=function(e,t=null){for(let r in e)e[r]=zi(e[r],t);return e},dle=function(e,t=null){let r=e.length;for(let i=0;i\\u003cr;i++)e[i]=zi(e[i],t);return e},FI=function(e,t=null,r=null,i=null){function s(h){return i!==null?(h=zi(Object.assign(h,i)),i.intent===!0&&(h=h.toVarIntent())):h=zi(h),h}let a,n=t,o,l;function u(h){let d;return n?d=/[a-z]/i.test(n)?n+\\\"()\\\":n:d=e.type,o!==void 0&&h.length\\u003co?(Uo(`TSL: \\\"${d}\\\" parameter length is less than minimum required.`,new hh),h.concat(new Array(o-h.length).fill(0))):l!==void 0&&h.length>l?(Uo(`TSL: \\\"${d}\\\" parameter length exceeds limit.`,new hh),h.slice(0,l)):h}return t===null?a=(...h)=>s(new e(...Ow(u(h)))):r!==null?(r=zi(r),a=(...h)=>s(new e(t,...Ow(u(h)),r))):a=(...h)=>s(new e(t,...Ow(u(h)))),a.setParameterLength=(...h)=>(h.length===1?o=l=h[0]:h.length===2&&([o,l]=h),a),a.setName=h=>(n=h,a),a},cle=class extends Hr{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,rawInputs:r}=this,i=e.getNodeProperties(t),s=e.getClosestSubBuild(t.subBuilds)||\\\"\\\",a=s||\\\"default\\\";if(i[a])return i[a];let n=e.subBuildFn,o=e.fnCall;e.subBuildFn=s,e.fnCall=this;let l=null;if(t.layout){if(r){let d=t.layout.inputs;if(LI(r)){let c=r;for(let m=0;m\\u003cd.length;m++){let g=c[m];g&&g.isNode&&g.build(e)}}else{let c=r[0];for(let m of d){let g=c[m.name];g&&g.isNode&&g.build(e)}}}let u=e.buildFunctionNode(t);e.addInclude(u);let h=r?ple(r):null;l=u.call(h)}else{let u=new Proxy(e,{get:(g,y,b)=>{let v;return Symbol.iterator===y?v=function*(){yield void 0}:v=Reflect.get(g,y,b),v}}),h=r?mle(r):null,d=Array.isArray(r)?r.length>0:r!==null,c=t.jsFunc,m=d||c.length>1?c(h,u):c(u);l=zi(m)}return e.subBuildFn=n,e.fnCall=o,t.once&&(i[a]=l),l}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),r=e.getSubBuildOutput(this);return t[r]=t[r]||this.setupOutput(e),t[r].subBuild=e.getClosestSubBuild(this),t[r]}build(e,t=null){let r=null,i=e.getBuildStage(),s=e.getNodeProperties(this),a=e.getSubBuildOutput(this),n=this.getOutputNode(e),o=e.fnCall;if(e.fnCall=this,i===\\\"setup\\\"){let l=e.getSubBuildProperty(\\\"initialized\\\",this);if(s[l]!==!0&&(s[l]=!0,s[a]=this.getOutputNode(e),s[a].build(e),this.shaderNode.subBuilds))for(let u of e.chaining){let h=e.getDataFromNode(u,\\\"any\\\");h.subBuilds=h.subBuilds||new Set;for(let d of this.shaderNode.subBuilds)h.subBuilds.add(d)}r=s[a]}else i===\\\"analyze\\\"?n.build(e,t):i===\\\"generate\\\"&&(r=n.build(e,t)||\\\"\\\");return e.fnCall=o,r}};function LI(e){return e[0]&&(e[0].isNode||Object.getPrototypeOf(e[0])!==Object.prototype)}function ple(e){let t;return OI(e),LI(e)?t=[...e]:t=e[0],t}function mle(e){let t=0;return OI(e),new Proxy(e,{get:(r,i,s)=>{let a;if(i===\\\"length\\\")return a=e.length,a;if(Symbol.iterator===i)a=function*(){for(let n of e)yield zi(n)};else{if(e.length>0)if(Object.getPrototypeOf(e[0])===Object.prototype){let n=e[0];n[i]===void 0?a=n[t++]:a=Reflect.get(n,i,s)}else e[0]instanceof Hr&&(e[i]===void 0?a=e[t++]:a=Reflect.get(e,i,s));else a=Reflect.get(r,i,s);a=zi(a)}return a}})}var fle=class extends Hr{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new cle(this,e)}setup(){return this.call()}},gle=[!1,!0],yle=[0,1,2,3],xle=[-1,-2],kI=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],Fw=new Map;for(let e of gle)Fw.set(e,new Vn(e));var Lw=new Map;for(let e of yle)Lw.set(e,new Vn(e,\\\"uint\\\"));var kw=new Map([...Lw].map(e=>new Vn(e.value,\\\"int\\\")));for(let e of xle)kw.set(e,new Vn(e,\\\"int\\\"));var J1=new Map([...kw].map(e=>new Vn(e.value)));for(let e of kI)J1.set(e,new Vn(e));for(let e of kI)J1.set(-e,new Vn(-e));var Q1={bool:Fw,uint:Lw,ints:kw,float:J1},DI=new Map([...Fw,...J1]),Dw=(e,t)=>DI.has(e)?DI.get(e):e.isNode===!0?e:new Vn(e,t),hi=function(e,t=null){return(...r)=>{for(let s of r)if(s===void 0)return Uo(`TSL: Invalid parameter for the type \\\"${e}\\\".`,new hh),new Vn(0,e);if((r.length===0||![\\\"bool\\\",\\\"float\\\",\\\"int\\\",\\\"uint\\\"].includes(e)&&r.every(s=>{let a=typeof s;return a!==\\\"object\\\"&&a!==\\\"function\\\"}))&&(r=[CI(e,...r)]),r.length===1&&t!==null&&t.has(r[0]))return K1(t.get(r[0]));if(r.length===1){let s=Dw(r[0],e);return s.nodeType===e?K1(s):K1(new PI(s,e))}let i=r.map(s=>Dw(s));return K1(new Yoe(i,e))}};function vle(e,t){return new fle(e,t)}var zi=(e,t=null)=>ule(e,t),K1=(e,t=null)=>zi(e,t).toVarIntent(),OI=(e,t=null)=>new hle(e,t),Ow=(e,t=null)=>new dle(e,t),ble=(e,t=null,r=null,i=null)=>new FI(e,t,r,i),qe=(e,t=null,r=null,i={})=>new FI(e,t,r,{...i,intent:!0}),Tle=0,Sle=class extends Hr{constructor(e,t=null){super();let r=null;t!==null&&(typeof t==\\\"object\\\"?r=t.return:(typeof t==\\\"string\\\"?r=t:Uo(\\\"TSL: Invalid layout type.\\\",new hh),t=null)),this.shaderNode=new vle(e,r),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){let t=this.shaderNode.nodeType;if(typeof e.inputs!=\\\"object\\\"){let r={name:\\\"fn\\\"+Tle++,type:t,inputs:[]};for(let i in e)i!==\\\"return\\\"&&r.inputs.push({name:i,type:e[i]});e=r}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||\\\"float\\\"}call(...e){let t=this.shaderNode.call(e);return this.shaderNode.nodeType===\\\"void\\\"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){let t=this.getNodeType(e);return Uo('TSL: \\\"Fn()\\\" was declared but not invoked. Try calling it like \\\"Fn()( ...params )\\\".',this.stackTrace),e.generateConst(t)}};function dh(e,t=null){let r=new Sle(e,t);return new Proxy(()=>{},{apply(i,s,a){return r.call(...a)},get(i,s,a){return Reflect.get(r,s,a)},set(i,s,a,n){return Reflect.set(r,s,a,n)}})}function UI(e){return Y1&&Y1.addToStack(e),e}Re(\\\"toStack\\\",UI);var _le=new hi(\\\"color\\\"),Vm=new hi(\\\"float\\\",Q1.float),Uw=new hi(\\\"int\\\",Q1.ints),wle=new hi(\\\"uint\\\",Q1.uint),Mle=new hi(\\\"bool\\\",Q1.bool),zI=new hi(\\\"vec2\\\"),Nle=new hi(\\\"ivec2\\\"),Ale=new hi(\\\"uvec2\\\"),Cle=new hi(\\\"bvec2\\\"),ex=new hi(\\\"vec3\\\"),Rle=new hi(\\\"ivec3\\\"),Ele=new hi(\\\"uvec3\\\"),Ple=new hi(\\\"bvec3\\\"),tx=new hi(\\\"vec4\\\"),Ble=new hi(\\\"ivec4\\\"),Ile=new hi(\\\"uvec4\\\"),Fle=new hi(\\\"bvec4\\\"),Lle=new hi(\\\"mat2\\\"),kle=new hi(\\\"mat3\\\"),Dle=new hi(\\\"mat4\\\");Re(\\\"toColor\\\",_le),Re(\\\"toFloat\\\",Vm),Re(\\\"toInt\\\",Uw),Re(\\\"toUint\\\",wle),Re(\\\"toBool\\\",Mle),Re(\\\"toVec2\\\",zI),Re(\\\"toIVec2\\\",Nle),Re(\\\"toUVec2\\\",Ale),Re(\\\"toBVec2\\\",Cle),Re(\\\"toVec3\\\",ex),Re(\\\"toIVec3\\\",Rle),Re(\\\"toUVec3\\\",Ele),Re(\\\"toBVec3\\\",Ple),Re(\\\"toVec4\\\",tx),Re(\\\"toIVec4\\\",Ble),Re(\\\"toUVec4\\\",Ile),Re(\\\"toBVec4\\\",Fle),Re(\\\"toMat2\\\",Lle),Re(\\\"toMat3\\\",kle),Re(\\\"toMat4\\\",Dle);var Ole=ble(EI).setParameterLength(2),Ule=(e,t)=>new PI(zi(e),t);Re(\\\"element\\\",Ole),Re(\\\"convert\\\",Ule),Re(\\\"append\\\",e=>(ns(\\\"TSL: .append() has been renamed to .toStack().\\\",new hh),UI(e)));var zle={\\\"==\\\":\\\"equal\\\",\\\"!=\\\":\\\"notEqual\\\",\\\"\\u003c\\\":\\\"lessThan\\\",\\\">\\\":\\\"greaterThan\\\",\\\"\\u003c=\\\":\\\"lessThanEqual\\\",\\\">=\\\":\\\"greaterThanEqual\\\",\\\"%\\\":\\\"mod\\\"},Kr=class cM extends Um{static get type(){return\\\"OperatorNode\\\"}constructor(t,r,i,...s){if(super(),s.length>0){let a=new cM(t,r,i);for(let n=0;n\\u003cs.length-1;n++)a=new cM(t,a,s[n]);r=a,i=s[s.length-1]}this.op=t,this.aNode=r,this.bNode=i,this.isOperatorNode=!0}getOperatorMethod(t,r){return t.getMethod(zle[this.op],r)}generateNodeType(t,r=null){let i=this.op,s=this.aNode,a=this.bNode,n=s.getNodeType(t),o=a?a.getNodeType(t):null;if(n===\\\"void\\\"||o===\\\"void\\\")return r||\\\"void\\\";if(i===\\\"%\\\")return n;if(i===\\\"~\\\"||i===\\\"&\\\"||i===\\\"|\\\"||i===\\\"^\\\"||i===\\\">>\\\"||i===\\\"\\u003c\\u003c\\\")return t.getIntegerType(n);if(i===\\\"&&\\\"||i===\\\"||\\\"||i===\\\"^^\\\")return\\\"bool\\\";if(i===\\\"!\\\"){let l=t.getTypeLength(n);return l>1?`bvec${l}`:\\\"bool\\\"}else if(i===\\\"==\\\"||i===\\\"!=\\\"||i===\\\"\\u003c\\\"||i===\\\">\\\"||i===\\\"\\u003c=\\\"||i===\\\">=\\\"){let l=Math.max(t.getTypeLength(n),t.getTypeLength(o));return l>1?`bvec${l}`:\\\"bool\\\"}else{if(t.isMatrix(n)){if(o===\\\"float\\\")return n;if(t.isVector(o))return t.getVectorFromMatrix(n);if(t.isMatrix(o))return n}else if(t.isMatrix(o)){if(n===\\\"float\\\")return o;if(t.isVector(n))return t.getVectorFromMatrix(o)}return t.getTypeLength(o)>t.getTypeLength(n)?o:n}}generate(t,r){let i=this.op,{aNode:s,bNode:a}=this,n=this.getNodeType(t,r),o=null,l=null;n!==\\\"void\\\"?(o=s.getNodeType(t),l=a?a.getNodeType(t):null,i===\\\"\\u003c\\\"||i===\\\">\\\"||i===\\\"\\u003c=\\\"||i===\\\">=\\\"||i===\\\"==\\\"||i===\\\"!=\\\"?t.isVector(o)?l=o:t.isVector(l)?o=l:o!==l&&(o=l=\\\"float\\\"):i===\\\">>\\\"||i===\\\"\\u003c\\u003c\\\"?(o=n,l=t.changeComponentType(l,\\\"uint\\\")):i===\\\"%\\\"?(o=n,l=t.isInteger(o)&&t.isInteger(l)?l:o):t.isMatrix(o)?l===\\\"float\\\"?l=\\\"float\\\":t.isVector(l)?l=t.getVectorFromMatrix(o):t.isMatrix(l)||(o=l=n):t.isMatrix(l)?o===\\\"float\\\"?o=\\\"float\\\":t.isVector(o)?o=t.getVectorFromMatrix(l):o=l=n:o=l=n):o=l=n;let u=s.build(t,o),h=a?a.build(t,l):null,d=t.getFunctionOperator(i);if(r!==\\\"void\\\"){let c=t.renderer.coordinateSystem===uh;if(i===\\\"==\\\"||i===\\\"!=\\\"||i===\\\"\\u003c\\\"||i===\\\">\\\"||i===\\\"\\u003c=\\\"||i===\\\">=\\\")return c?t.isVector(o)?t.format(`${this.getOperatorMethod(t,r)}( ${u}, ${h} )`,n,r):t.format(`( ${u} ${i} ${h} )`,n,r):t.format(`( ${u} ${i} ${h} )`,n,r);if(i===\\\"%\\\")return t.isInteger(l)?t.format(`( ${u} % ${h} )`,n,r):t.format(`${this.getOperatorMethod(t,n)}( ${u}, ${h} )`,n,r);if(i===\\\"!\\\")return c&&t.isVector(o)?t.format(`not( ${u} )`,r):t.format(`( ${i} ${u} )`,o,r);if(i===\\\"~\\\")return t.format(`( ${i} ${u} )`,o,r);if(d)return t.format(`${d}( ${u}, ${h} )`,n,r);if(t.isMatrix(o)&&l===\\\"float\\\")return t.format(`( ${h} ${i} ${u} )`,n,r);if(o===\\\"float\\\"&&t.isMatrix(l))return t.format(`${u} ${i} ${h}`,n,r);{let m=`( ${u} ${i} ${h} )`;return!c&&n===\\\"bool\\\"&&t.isVector(o)&&t.isVector(l)&&(m=`all${m}`),t.format(m,n,r)}}else if(o!==\\\"void\\\")return d?t.format(`${d}( ${u}, ${h} )`,n,r):t.isMatrix(o)&&l===\\\"float\\\"?t.format(`${h} ${i} ${u}`,n,r):t.format(`${u} ${i} ${h}`,n,r)}serialize(t){super.serialize(t),t.op=this.op}deserialize(t){super.deserialize(t),this.op=t.op}},Vle=qe(Kr,\\\"+\\\").setParameterLength(2,1/0).setName(\\\"add\\\"),zw=qe(Kr,\\\"-\\\").setParameterLength(2,1/0).setName(\\\"sub\\\"),ch=qe(Kr,\\\"*\\\").setParameterLength(2,1/0).setName(\\\"mul\\\"),VI=qe(Kr,\\\"/\\\").setParameterLength(2,1/0).setName(\\\"div\\\"),GI=qe(Kr,\\\"%\\\").setParameterLength(2).setName(\\\"mod\\\"),Gle=qe(Kr,\\\"==\\\").setParameterLength(2).setName(\\\"equal\\\"),Wle=qe(Kr,\\\"!=\\\").setParameterLength(2).setName(\\\"notEqual\\\"),jle=qe(Kr,\\\"\\u003c\\\").setParameterLength(2).setName(\\\"lessThan\\\"),Hle=qe(Kr,\\\">\\\").setParameterLength(2).setName(\\\"greaterThan\\\"),Xle=qe(Kr,\\\"\\u003c=\\\").setParameterLength(2).setName(\\\"lessThanEqual\\\"),$le=qe(Kr,\\\">=\\\").setParameterLength(2).setName(\\\"greaterThanEqual\\\"),qle=qe(Kr,\\\"&&\\\").setParameterLength(2,1/0).setName(\\\"and\\\"),Yle=qe(Kr,\\\"||\\\").setParameterLength(2,1/0).setName(\\\"or\\\"),Zle=qe(Kr,\\\"!\\\").setParameterLength(1).setName(\\\"not\\\"),Jle=qe(Kr,\\\"^^\\\").setParameterLength(2).setName(\\\"xor\\\"),Qle=qe(Kr,\\\"&\\\").setParameterLength(2).setName(\\\"bitAnd\\\"),Kle=qe(Kr,\\\"~\\\").setParameterLength(1).setName(\\\"bitNot\\\"),eue=qe(Kr,\\\"|\\\").setParameterLength(2).setName(\\\"bitOr\\\"),tue=qe(Kr,\\\"^\\\").setParameterLength(2).setName(\\\"bitXor\\\"),rue=qe(Kr,\\\"\\u003c\\u003c\\\").setParameterLength(2).setName(\\\"shiftLeft\\\"),iue=qe(Kr,\\\">>\\\").setParameterLength(2).setName(\\\"shiftRight\\\"),sue=dh(([e])=>(e.addAssign(1),e)),aue=dh(([e])=>(e.subAssign(1),e)),nue=dh(([e])=>{let t=Uw(e).toConst();return e.addAssign(1),t}),oue=dh(([e])=>{let t=Uw(e).toConst();return e.subAssign(1),t});Re(\\\"add\\\",Vle),Re(\\\"sub\\\",zw),Re(\\\"mul\\\",ch),Re(\\\"div\\\",VI),Re(\\\"mod\\\",GI),Re(\\\"equal\\\",Gle),Re(\\\"notEqual\\\",Wle),Re(\\\"lessThan\\\",jle),Re(\\\"greaterThan\\\",Hle),Re(\\\"lessThanEqual\\\",Xle),Re(\\\"greaterThanEqual\\\",$le),Re(\\\"and\\\",qle),Re(\\\"or\\\",Yle),Re(\\\"not\\\",Zle),Re(\\\"xor\\\",Jle),Re(\\\"bitAnd\\\",Qle),Re(\\\"bitNot\\\",Kle),Re(\\\"bitOr\\\",eue),Re(\\\"bitXor\\\",tue),Re(\\\"shiftLeft\\\",rue),Re(\\\"shiftRight\\\",iue),Re(\\\"incrementBefore\\\",sue),Re(\\\"decrementBefore\\\",aue),Re(\\\"increment\\\",nue),Re(\\\"decrement\\\",oue);var de=class _r extends Um{static get type(){return\\\"MathNode\\\"}constructor(t,r,i=null,s=null){if(super(),(t===_r.MAX||t===_r.MIN)&&arguments.length>3){let a=new _r(t,r,i);for(let n=3;n\\u003carguments.length-1;n++)a=new _r(t,a,arguments[n]);r=a,i=arguments[arguments.length-1],s=null}this.method=t,this.aNode=r,this.bNode=i,this.cNode=s,this.isMathNode=!0}getInputType(t){let r=this.aNode.getNodeType(t),i=this.bNode?this.bNode.getNodeType(t):null,s=this.cNode?this.cNode.getNodeType(t):null,a=t.isMatrix(r)?0:t.getTypeLength(r),n=t.isMatrix(i)?0:t.getTypeLength(i),o=t.isMatrix(s)?0:t.getTypeLength(s);return a>n&&a>o?r:n>o?i:o>a?s:r}generateNodeType(t){let r=this.method;return r===_r.LENGTH||r===_r.DISTANCE||r===_r.DOT?\\\"float\\\":r===_r.CROSS?\\\"vec3\\\":r===_r.ALL||r===_r.ANY?\\\"bool\\\":r===_r.EQUALS?t.changeComponentType(this.aNode.getNodeType(t),\\\"bool\\\"):this.getInputType(t)}setup(t){let{aNode:r,bNode:i,method:s}=this,a=null;if(s===_r.ONE_MINUS)a=zw(1,r);else if(s===_r.RECIPROCAL)a=VI(1,r);else if(s===_r.DIFFERENCE)a=Vw(zw(r,i));else if(s===_r.TRANSFORM_DIRECTION){let n,o;t.isMatrix(r.getNodeType(t))?(n=r,o=i):(n=i,o=r),a=rx(ch(n,tx(ex(o),0)).xyz)}return a!==null?a:super.setup(t)}generate(t,r){if(t.getNodeProperties(this).outputNode)return super.generate(t,r);let i=this.method,s=this.getNodeType(t),a=this.getInputType(t),n=this.aNode,o=this.bNode,l=this.cNode,u=t.renderer.coordinateSystem;if(i===_r.NEGATE)return t.format(\\\"( - \\\"+n.build(t,a)+\\\" )\\\",s,r);{let h=[];return i===_r.CROSS?h.push(n.build(t,s),o.build(t,s)):u===uh&&i===_r.STEP?h.push(n.build(t,t.getTypeLength(n.getNodeType(t))===1?\\\"float\\\":a),o.build(t,a)):u===uh&&(i===_r.MIN||i===_r.MAX)?h.push(n.build(t,a),o.build(t,t.getTypeLength(o.getNodeType(t))===1?\\\"float\\\":a)):i===_r.REFRACT?h.push(n.build(t,a),o.build(t,a),l.build(t,\\\"float\\\")):i===_r.MIX?h.push(n.build(t,a),o.build(t,a),l.build(t,t.getTypeLength(l.getNodeType(t))===1?\\\"float\\\":a)):(u===Mw&&i===_r.ATAN&&o!==null&&(i=\\\"atan2\\\"),t.shaderStage!==\\\"fragment\\\"&&(i===_r.DFDX||i===_r.DFDY)&&(ns(`TSL: '${i}' is not supported in the ${t.shaderStage} stage.`,this.stackTrace),i=\\\"/*\\\"+i+\\\"*/\\\"),h.push(n.build(t,a)),o!==null&&h.push(o.build(t,a)),l!==null&&h.push(l.build(t,a))),t.format(`${t.getMethod(i,s)}( ${h.join(\\\", \\\")} )`,s,r)}}serialize(t){super.serialize(t),t.method=this.method}deserialize(t){super.deserialize(t),this.method=t.method}};de.ALL=\\\"all\\\",de.ANY=\\\"any\\\",de.RADIANS=\\\"radians\\\",de.DEGREES=\\\"degrees\\\",de.EXP=\\\"exp\\\",de.EXP2=\\\"exp2\\\",de.LOG=\\\"log\\\",de.LOG2=\\\"log2\\\",de.SQRT=\\\"sqrt\\\",de.INVERSE_SQRT=\\\"inversesqrt\\\",de.FLOOR=\\\"floor\\\",de.CEIL=\\\"ceil\\\",de.NORMALIZE=\\\"normalize\\\",de.FRACT=\\\"fract\\\",de.SIN=\\\"sin\\\",de.SINH=\\\"sinh\\\",de.COS=\\\"cos\\\",de.COSH=\\\"cosh\\\",de.TAN=\\\"tan\\\",de.TANH=\\\"tanh\\\",de.ASIN=\\\"asin\\\",de.ASINH=\\\"asinh\\\",de.ACOS=\\\"acos\\\",de.ACOSH=\\\"acosh\\\",de.ATAN=\\\"atan\\\",de.ATANH=\\\"atanh\\\",de.ABS=\\\"abs\\\",de.SIGN=\\\"sign\\\",de.LENGTH=\\\"length\\\",de.NEGATE=\\\"negate\\\",de.ONE_MINUS=\\\"oneMinus\\\",de.DFDX=\\\"dFdx\\\",de.DFDY=\\\"dFdy\\\",de.ROUND=\\\"round\\\",de.RECIPROCAL=\\\"reciprocal\\\",de.TRUNC=\\\"trunc\\\",de.FWIDTH=\\\"fwidth\\\",de.TRANSPOSE=\\\"transpose\\\",de.DETERMINANT=\\\"determinant\\\",de.INVERSE=\\\"inverse\\\",de.EQUALS=\\\"equals\\\",de.MIN=\\\"min\\\",de.MAX=\\\"max\\\",de.STEP=\\\"step\\\",de.REFLECT=\\\"reflect\\\",de.DISTANCE=\\\"distance\\\",de.DIFFERENCE=\\\"difference\\\",de.DOT=\\\"dot\\\",de.CROSS=\\\"cross\\\",de.POW=\\\"pow\\\",de.TRANSFORM_DIRECTION=\\\"transformDirection\\\",de.MIX=\\\"mix\\\",de.CLAMP=\\\"clamp\\\",de.REFRACT=\\\"refract\\\",de.SMOOTHSTEP=\\\"smoothstep\\\",de.FACEFORWARD=\\\"faceforward\\\";var lue=Vm(Math.PI),X0e=Vm(Math.PI*2),$0e=Vm(Math.PI*2),q0e=Vm(Math.PI*.5),uue=qe(de,de.ALL).setParameterLength(1),hue=qe(de,de.ANY).setParameterLength(1),due=qe(de,de.RADIANS).setParameterLength(1),cue=qe(de,de.DEGREES).setParameterLength(1),pue=qe(de,de.EXP).setParameterLength(1),mue=qe(de,de.EXP2).setParameterLength(1),fue=qe(de,de.LOG).setParameterLength(1),gue=qe(de,de.LOG2).setParameterLength(1),yue=qe(de,de.SQRT).setParameterLength(1),xue=qe(de,de.INVERSE_SQRT).setParameterLength(1),vue=qe(de,de.FLOOR).setParameterLength(1),bue=qe(de,de.CEIL).setParameterLength(1),rx=qe(de,de.NORMALIZE).setParameterLength(1),WI=qe(de,de.FRACT).setParameterLength(1),jI=qe(de,de.SIN).setParameterLength(1),Tue=qe(de,de.SINH).setParameterLength(1),Sue=qe(de,de.COS).setParameterLength(1),_ue=qe(de,de.COSH).setParameterLength(1),wue=qe(de,de.TAN).setParameterLength(1),Mue=qe(de,de.TANH).setParameterLength(1),Nue=qe(de,de.ASIN).setParameterLength(1),Aue=qe(de,de.ASINH).setParameterLength(1),Cue=qe(de,de.ACOS).setParameterLength(1),Rue=qe(de,de.ACOSH).setParameterLength(1),Eue=qe(de,de.ATAN).setParameterLength(1,2),Pue=qe(de,de.ATANH).setParameterLength(1),Vw=qe(de,de.ABS).setParameterLength(1),HI=qe(de,de.SIGN).setParameterLength(1),Bue=qe(de,de.LENGTH).setParameterLength(1),Iue=qe(de,de.NEGATE).setParameterLength(1),Fue=qe(de,de.ONE_MINUS).setParameterLength(1),Lue=qe(de,de.DFDX).setParameterLength(1),kue=qe(de,de.DFDY).setParameterLength(1),Due=qe(de,de.ROUND).setParameterLength(1),Oue=qe(de,de.RECIPROCAL).setParameterLength(1),Uue=qe(de,de.TRUNC).setParameterLength(1),zue=qe(de,de.FWIDTH).setParameterLength(1),Vue=qe(de,de.TRANSPOSE).setParameterLength(1),Gue=qe(de,de.DETERMINANT).setParameterLength(1),Wue=qe(de,de.INVERSE).setParameterLength(1),jue=qe(de,de.MIN).setParameterLength(2,1/0),Hue=qe(de,de.MAX).setParameterLength(2,1/0),Xue=qe(de,de.STEP).setParameterLength(2),$ue=qe(de,de.REFLECT).setParameterLength(2),que=qe(de,de.DISTANCE).setParameterLength(2),Yue=qe(de,de.DIFFERENCE).setParameterLength(2),Gw=qe(de,de.DOT).setParameterLength(2),Zue=qe(de,de.CROSS).setParameterLength(2),XI=qe(de,de.POW).setParameterLength(2),Jue=e=>ch(e,e),Que=e=>ch(e,e,e),Kue=e=>ch(e,e,e,e),ehe=qe(de,de.TRANSFORM_DIRECTION).setParameterLength(2),the=(e,t)=>rx(ch(t,tx(ex(e),0)).xyz),rhe=(e,t)=>rx(tx(ex(e),0).mul(t).xyz),ihe=e=>ch(HI(e),XI(Vw(e),1/3)),she=e=>Gw(e,e),$I=qe(de,de.MIX).setParameterLength(3),qI=(e,t=0,r=1)=>new de(de.CLAMP,zi(e),zi(t),zi(r)),ahe=e=>qI(e),nhe=qe(de,de.REFRACT).setParameterLength(3),ohe=qe(de,de.SMOOTHSTEP).setParameterLength(3),lhe=qe(de,de.FACEFORWARD).setParameterLength(3),uhe=dh(([e])=>{let t=43758.5453,r=Gw(e.xy,zI(12.9898,78.233)),i=GI(r,lue);return WI(jI(i).mul(t))}),hhe=(e,t,r)=>$I(t,r,e),dhe=(e,t,r)=>ohe(t,r,e),che=(e,t)=>Xue(t,e);Re(\\\"all\\\",uue),Re(\\\"any\\\",hue),Re(\\\"radians\\\",due),Re(\\\"degrees\\\",cue),Re(\\\"exp\\\",pue),Re(\\\"exp2\\\",mue),Re(\\\"log\\\",fue),Re(\\\"log2\\\",gue),Re(\\\"sqrt\\\",yue),Re(\\\"inverseSqrt\\\",xue),Re(\\\"floor\\\",vue),Re(\\\"ceil\\\",bue),Re(\\\"normalize\\\",rx),Re(\\\"fract\\\",WI),Re(\\\"sin\\\",jI),Re(\\\"sinh\\\",Tue),Re(\\\"cos\\\",Sue),Re(\\\"cosh\\\",_ue),Re(\\\"tan\\\",wue),Re(\\\"tanh\\\",Mue),Re(\\\"asin\\\",Nue),Re(\\\"asinh\\\",Aue),Re(\\\"acos\\\",Cue),Re(\\\"acosh\\\",Rue),Re(\\\"atan\\\",Eue),Re(\\\"atanh\\\",Pue),Re(\\\"abs\\\",Vw),Re(\\\"sign\\\",HI),Re(\\\"length\\\",Bue),Re(\\\"lengthSq\\\",she),Re(\\\"negate\\\",Iue),Re(\\\"oneMinus\\\",Fue),Re(\\\"dFdx\\\",Lue),Re(\\\"dFdy\\\",kue),Re(\\\"round\\\",Due),Re(\\\"reciprocal\\\",Oue),Re(\\\"trunc\\\",Uue),Re(\\\"fwidth\\\",zue),Re(\\\"min\\\",jue),Re(\\\"max\\\",Hue),Re(\\\"step\\\",che),Re(\\\"reflect\\\",$ue),Re(\\\"distance\\\",que),Re(\\\"dot\\\",Gw),Re(\\\"cross\\\",Zue),Re(\\\"pow\\\",XI),Re(\\\"pow2\\\",Jue),Re(\\\"pow3\\\",Que),Re(\\\"pow4\\\",Kue),Re(\\\"transformDirection\\\",ehe),Re(\\\"transformNormalByViewMatrix\\\",the),Re(\\\"transformNormalByInverseViewMatrix\\\",rhe),Re(\\\"mix\\\",hhe),Re(\\\"clamp\\\",qI),Re(\\\"refract\\\",nhe),Re(\\\"smoothstep\\\",dhe),Re(\\\"faceForward\\\",lhe),Re(\\\"difference\\\",Yue),Re(\\\"saturate\\\",ahe),Re(\\\"cbrt\\\",ihe),Re(\\\"transpose\\\",Vue),Re(\\\"determinant\\\",Gue),Re(\\\"inverse\\\",Wue),Re(\\\"rand\\\",uhe);var phe=dh(([e])=>{let t=e.pow(.41666).mul(1.055).sub(.055),r=e.mul(12.92),i=e.lessThanEqual(.0031308);return $I(t,r,i)}).setLayout({name:\\\"sRGBTransferOETF\\\",type:\\\"vec3\\\",inputs:[{name:\\\"color\\\",type:\\\"vec3\\\"}]}),{rtt:YI,Fn:mhe,pass:fhe,mrt:ghe,output:yhe,velocity:xhe,vec2:ix,vec3:zo,vec4:vhe,float:yc,uniform:Lr,texture:sx,screenUV:ZI,screenCoordinate:ax,screenSize:JI,mix:Ww,luminance:QI,smoothstep:jw,length:bhe,max:KI,clamp:Hw,agxToneMapping:The,acesFilmicToneMapping:She,neutralToneMapping:_he,linearToneMapping:whe,floor:eF,step:Mhe}=Jr;function Nhe(e){let t={exposure:Lr(1),contrast:Lr(1.08),blackLift:Lr(.02),monochrome:Lr(1),vignette:Lr(.2),vignetteSoft:Lr(.7),vignetteRadius:Lr(.85),grain:Lr(.03),grainSize:Lr(1),grainSeed:Lr(new fe),grainShadow:Lr(.8),bgGrain:Lr(0),bgGrainSize:Lr(2),bgGrainSeed:Lr(new fe),dither:Lr(1),focus:Lr(12.4),focusRange:Lr(3),aperture:Lr(.9),bloomStrength:Lr(.15),bloomRadius:Lr(.15),bloomThreshold:Lr(1.2),sceneFade:Lr(1),hazeIntensity:Lr(.22),upscaleSharpness:Lr(.2)},r=new(TB??YX)(e.renderer);r.outputColorTransform=!1;let i={aa:\\\"\\\",tonemap:\\\"\\\",dof:!0,haze:!1,upscaler:\\\"\\\",sharpen:!1},s=null,a=null,n=-1,o=null,l=1,u=-1,h=[];function d(v){i={...v};let S=h,T=[],w=L=>(L&&typeof L.dispose==\\\"function\\\"&&T.push(L),L);s=w(fhe(e.scene,e.camera,{type:Dt,samples:0})),s.setMRT(ghe({output:yhe,velocity:xhe}));let N=s.getTextureNode(\\\"output\\\"),C=s.getTextureNode(\\\"depth\\\"),R=s.getTextureNode(\\\"velocity\\\"),E=s.getViewZNode(),P;a=null,v.upscaler===\\\"taau\\\"?P=a=w(jne(N,C,R,e.camera)):(P=v.aa===\\\"traa\\\"?a=w(Vne(N,C,R,e.camera)):N,v.upscaler===\\\"fsr1\\\"?P=w(Xne(P,yc(2).sub(t.upscaleSharpness.mul(2)),!0)):v.upscaler===\\\"bilinear\\\"&&(P=w(YI(P)))),v.sharpen&&(v.upscaler===\\\"taau\\\"||v.upscaler===\\\"bilinear\\\")&&(P=w(qne(P,yc(2).sub(t.upscaleSharpness.mul(2)),!0))),o=null,e.haze&&v.haze&&(o=w(YI(e.haze(C,E))),o.setResolutionScale(l),P=P.add(o.mul(t.hazeIntensity))),v.dof&&(P=w(Qne(P,E,t.focus,t.focusRange,t.aperture)));let I=w(soe(P,t.bloomStrength,t.bloomRadius,t.bloomThreshold));I.smoothWidth.value=.35,P=P.add(I);let O=mhe(()=>{let L=zo(P).mul(t.sceneFade).toVar(),X=QI(L);L.assign(Ww(L,zo(X),t.monochrome));let z=v.tonemap===\\\"aces\\\"?She(L,t.exposure):v.tonemap===\\\"neutral\\\"?_he(L,t.exposure):v.tonemap===\\\"linear\\\"?whe(L,t.exposure):The(L,t.exposure),H=Hw(zo(z),0,1).toVar(),ue=yc(.18);H.assign(Hw(ue.add(H.sub(ue).mul(t.contrast)),0,1));let ne=H.mul(H).mul(yc(3).sub(H.mul(2)));H.assign(Ww(H,ne,Hw(t.contrast.sub(1).mul(1.5),0,.6))),H.assign(H.mul(t.blackLift.oneMinus()).add(t.blackLift));let re=JI.x.div(JI.y),ce=ix(ZI.x.sub(.5).mul(re),ZI.y.sub(.5)),ge=bhe(ce).div(t.vignetteRadius),ye=jw(yc(1).sub(t.vignetteSoft),1.0001,ge).mul(t.vignette);H.assign(H.mul(ye.oneMinus()));let oe=zo(phe(H)).toVar(),Ae=eF(ax.xy.div(t.grainSize)).div(64).add(t.grainSeed),Ie=sx(e.blueNoise,Ae).r.sub(.5),Xe=sx(e.blueNoise,Ae.add(ix(.37,.61))).r.sub(.5),at=Ie.add(Xe),W=QI(oe),j=Ww(yc(1),jw(1,.05,W),t.grainShadow),G=t.grain.mul(j).mul(jw(0,.08,W).mul(.85).add(.15));oe.addAssign(zo(at.mul(G)));let ae=Mhe(.9999995,C.r),be=eF(ax.xy.div(KI(t.bgGrainSize,1))),Be=Po(zo(be,t.bgGrainSeed.x.mul(97))),$=Po(zo(be.add(ix(17.3,5.1)),t.bgGrainSeed.y.mul(53)));oe.addAssign(zo(Be.add($).sub(1).mul(t.bgGrain).mul(ae)));let U=sx(e.blueNoise,ax.xy.div(64).add(t.grainSeed.yx)).r.sub(.5),J=sx(e.blueNoise,ax.xy.div(64).add(ix(.5,.25)).add(t.grainSeed)).r.sub(.5);return oe.addAssign(zo(U.add(J).mul(t.dither).div(255))),vhe(KI(oe,0),1)})();r.outputNode=O,r.needsUpdate=!0,h=T;for(let L of S)L.dispose()}d({aa:e.initial?.aaMode??\\\"traa\\\",tonemap:e.initial?.tonemap??\\\"agx\\\",dof:e.initial?.dof.enabled??!0,haze:!!e.haze&&(e.initialHaze??!0),upscaler:e.initialPerformance?.nativePostEffects?e.initialPerformance.upscaler:\\\"native\\\",sharpen:!!e.initialPerformance?.nativePostEffects&&!!e.initialPerformance.upscaleSharpness&&(e.initialPerformance.upscaler===\\\"taau\\\"||e.initialPerformance.upscaler===\\\"bilinear\\\")});function c(v,S,T,w,N,C,R){let E=!!e.haze&&N!==0,P=S.nativePostEffects?S.upscaler:\\\"native\\\",I=S.nativePostEffects&&S.upscaleSharpness>0&&(P===\\\"taau\\\"||P===\\\"bilinear\\\");(R!==u||E!==i.haze)&&(u=R,(v.aaMode!==i.aa||v.tonemap!==i.tonemap||v.dof.enabled!==i.dof||E!==i.haze||P!==i.upscaler||I!==i.sharpen)&&d({aa:v.aaMode,tonemap:v.tonemap,dof:v.dof.enabled,haze:E,upscaler:P,sharpen:I}),t.exposure.value=v.exposure,t.contrast.value=v.contrast,t.blackLift.value=v.blackLift,t.monochrome.value=v.monochrome,t.vignette.value=v.vignette.strength,t.vignetteSoft.value=v.vignette.softness,t.vignetteRadius.value=v.vignette.radius,t.grain.value=v.grain.strength,t.grainSize.value=v.grain.size,t.grainShadow.value=v.grain.shadowWeight,t.bgGrain.value=v.grain.backgroundStrength,t.bgGrainSize.value=v.grain.backgroundSize,t.dither.value=v.dither?1:0,t.focusRange.value=v.dof.range,t.aperture.value=v.dof.aperture,t.bloomStrength.value=v.bloom.intensity,t.bloomRadius.value=v.bloom.radius,t.bloomThreshold.value=v.bloom.threshold,t.upscaleSharpness.value=S.upscaleSharpness);let O=v.grain.backgroundSpeed>0?Math.floor(C*24*v.grain.backgroundSpeed):0;t.bgGrainSeed.value.set(O*.7548776662%1+.1,O*.5698402909%1+.1);let L=v.grain.speed>0?Math.floor(C*24*v.grain.speed):0;t.grainSeed.value.set(L*.7548776662%1,L*.5698402909%1),t.focus.value=T+v.dof.focusBias,t.sceneFade.value=w,t.hazeIntensity.value=N}function m(v){v!==l&&(l=v,o&&o.setResolutionScale(v))}function g(v){s&&s.setResolutionScale(v)}function y(v){a&&(a._jitterIndex=(v%31+31)%31,v!==n+1&&a._historyRenderTarget.setSize(1,1)),n=v}function b(){for(let v of h)v.dispose();h=[],r.dispose()}return{post:r,uniforms:t,update:c,setHazeResolution:m,setSceneResolution:g,setFrame:y,dispose:b,get scenePass(){return s}}}var{normalize:Xw,cross:tF,select:Ahe,abs:Che,vec3:rF,texture:Rhe,equirectUV:Ehe,pmremTexture:Phe}=Jr;function $w(e,t,r,i){if(qa.environment)return Phe(e,r,i).rgb.mul(t);let s=Xw(r),a=Xw(tF(s,Ahe(Che(s.y).lessThan(.95),rF(0,1,0),rF(1,0,0)))),n=tF(s,a),o=i.mul(i).mul(.32),l=u=>Rhe(e,Ehe(Xw(u))).level(0).rgb;return l(s).mul(.4).add(l(s.add(a.mul(o))).mul(.15)).add(l(s.sub(a.mul(o))).mul(.15)).add(l(s.add(n.mul(o))).mul(.15)).add(l(s.sub(n.mul(o))).mul(.15)).mul(t)}var{normalize:iF,mat3:Bhe,vec3:Ihe,float:nx,dot:sF,select:Fhe,pow:aF,clamp:Lhe,reflect:khe,refract:Dhe,exp:Ohe,log:Uhe,max:qw}=Jr;function zhe({ray:e,normal:t,environment:r,u:i,f:s,roughness:a,path:n}){let o=Fhe(sF(t,e).greaterThan(0),t.negate(),t),l=qw(i.ior,1.001),u=g=>iF(Bhe(i.model).mul(g)),h=g=>$w(r,i.envStrength,u(g),a),d=aF(l.sub(1).div(l.add(1)),2),c=d.add(nx(1).sub(d).mul(aF(nx(1).sub(Lhe(sF(o,e.negate()),0,1)),5))),m=Ohe(Uhe(qw(i.attColor,Ihe(.001))).mul(n.mul(i.thicknessScale).div(qw(i.attDist,.01))).mul(s.absorption));return{reflected:h(khe(e,o)).mul(c).mul(s.reflections),transmitted:h(iF(Dhe(e,o,nx(1).div(l)))).mul(nx(1).sub(c)).mul(i.backlight).mul(m)}}var{Fn:Hn,vec3:tn,vec4:Gm,float:Ns,uniform:mr,uniformArray:Vhe,instanceIndex:ox,texture3D:xc,textureStore:vc,uvec3:Ghe,ivec3:$t,int:nF,uint:kr,If:Vi,Loop:oF,max:Vo,min:ph,length:Whe,dot:lF,clamp:bc,smoothstep:lx,mix:uF,abs:Y0e,select:Wm,instancedArray:jhe,atomicAdd:hF,atomicMax:dF,atomicStore:jm,atomicLoad:ux}=Jr,Tc=12,hx=class Kx{constructor(t,r,i,s,a,n,o,l){if(this.renderer=t,this.shape=r,this.cellOffset=o,this.flightOffset=l,this.atomics=a,this.healOffset=n,!Number.isInteger(n))throw new Error(\\\"ErosionField: healOffset must be an integer\\\");this.res=i,this.bound=r.bound,this.u.seed.value=s;let u=()=>{let h=new d_(i,i,i);return h.type=Dt,h.format=pi,h.minFilter=lr,h.magFilter=lr,h.wrapS=h.wrapT=h.wrapR=Ti,h.generateMipmaps=!1,h};this.tex=u(),this.scratch=u(),this.crackTex=u(),this.cellTex=u(),this.texNode=xc(this.tex),this.buildComputes()}static extraShell=0;res;bound;tex;scratch;crackTex;cellTex;u={reconstruct:mr(0),dt:mr(0),time:mr(0),heal:mr(0),healRate:mr(.6),healGap:mr(.12),fallbackHeal:mr(.04),fallbackOn:mr(0),refrostTime:mr(4),cellRestore:mr(30),growEdges:mr(1),breakup:mr(.7),breakupScale:mr(10),crumbleRate:mr(1.6),crumbleCrackBias:mr(2.5),crumbleUntil:mr(-1),brushNoise:mr(.55),brushNoiseScale:mr(9),brushSoftness:mr(.5),segCount:mr(0),seed:mr(0),crackScale:mr(2.2),crackWarp:mr(.45),crackWarpScale:mr(1.4),crackCoverage:mr(.55),breakScale:mr(3),cellSnap:mr(.85)};segments=Vhe(Array.from({length:Tc*2},()=>new Wt));stepNode;copyNode;cellClearNode;flightClearNode;clearNode;fillNode;healClearNode;bakeNode;statsNode;statsClearNode;statsBuf;statsPending=!1;stats={max:0,over50:0,over90:0,refrost:0};statsReadT=-1;statsIssuedT=-1;baked=!1;skipBake=!1;texNode;lastCrackSig=\\\"\\\";settingsVersion=-1;atomics;healOffset;cellOffset;flightOffset;uvw(t){return tn(t).div(this.bound*2).add(.5)}sample(t){return this.texNode.sample(this.uvw(t)).level(0)}sampleCrack(t){return xc(this.crackTex).sample(this.uvw(t)).level(0)}static warpDomain(t,r,i,s){return tn(t).mul(i).add(tn(r).mul(s))}buildComputes(){let t=this.res,r=t*t*t,i=this.bound,s=this.u,a=i*2/t,n=Math.max(a*1.5,Kx.extraShell),o=ox,l=()=>{let g=o.mod(kr(t)),y=o.div(kr(t)).mod(kr(t)),b=o.div(kr(t*t));return Ghe(g,y,b)},u=g=>tn(g).add(.5).div(t).sub(.5).mul(i*2),h=xc(this.tex),d=xc(this.scratch),c=xc(this.crackTex),m=xc(this.cellTex);this.stepNode=Hn(()=>{let g=l(),y=u(g).toVar(),b=this.shape.sdfNode(y).toVar(),v=h.load($t(g)).level(0).toVar(),S=v.r.toVar(),T=v.g.toVar(),w=v.b.toVar(),N=Vo(0,v.a.sub(s.dt.div(.2))).toVar(),C=c.load($t(g)).level(0).w,R=ws(y.mul(s.breakupScale).add(s.seed.mul(1.7).add(11))).mul(.5).add(.5),E=uF(Ns(1),Ns(.15).add(gi(R).mul(1.7)),s.breakup).toVar();Vi(s.time.lessThan(s.crumbleUntil),()=>{let ne=Ns(0).toVar(),re=[$t(1,0,0),$t(-1,0,0),$t(0,1,0),$t(0,-1,0),$t(0,0,1),$t(0,0,-1)];for(let oe of re){let Ae=bc($t(g).add(oe),$t(0),$t(t-1));ne.assign(Vo(ne,h.load(Ae).level(0).r))}let ce=lx(.02,-.02,b),ge=s.crumbleRate.mul(Ns(1).add(C.mul(s.crumbleCrackBias))).mul(ce),ye=ne.mul(.92).sub(.06);Vi(ye.greaterThan(S),()=>{S.assign(ph(ye,S.add(ye.sub(S).mul(gi(ge.mul(s.dt))))))})});let P=m.load($t(g)).level(0).toVar();oF({start:nF(0),end:nF(s.segCount),type:\\\"int\\\",condition:\\\"\\u003c\\\"},({i:ne})=>{let re=this.segments.element(ne.mul(2)),ce=this.segments.element(ne.mul(2).add(1)),ge=re.xyz,ye=ce.xyz,oe=re.w,Ae=ce.w,Ie=ye.sub(ge),Xe=$=>{let U=bc(lF($.sub(ge),Ie).div(Vo(lF(Ie,Ie),1e-6)),0,1);return Whe($.sub(ge.add(Ie.mul(U))))},at=ws(y.mul(s.brushNoiseScale).add(s.seed)).mul(.5).add(ws(y.mul(s.brushNoiseScale.mul(2.7)).add(s.seed.add(3.1))).mul(.25)),W=oe.mul(Ns(1).add(at.mul(s.brushNoise))),j=W.mul(Ns(1).sub(s.brushSoftness)),G=lx(W,j,Xe(y)),ae=oe.mul(Ns(1).add(P.w.sub(.5).mul(s.brushNoise).mul(.6))),be=lx(ae,ae.mul(Ns(1).sub(s.brushSoftness)),Xe(P.xyz)),Be=uF(G,be,s.cellSnap);S.assign(ph(1,S.add(Be.mul(Ae).mul(s.dt)))),Vi(Be.greaterThan(.02),()=>{N.assign(1)})});let I=kr(this.healOffset).add(o),O=Ns(ux(this.atomics.element(I))).toVar(),L=kr(bc(P.w.mul(65535),0,65535)),X=ux(this.atomics.element(kr(this.flightOffset).add(L))).equal(kr(0));Vi(O.greaterThan(.5).and(X.or(s.reconstruct.greaterThan(.5))),()=>{jm(this.atomics.element(I),kr(0)),T.assign(ph(1,T.add(S.mul(2.5)))),S.assign(0),w.assign(1)});let z=kr(bc(P.w.mul(65535),0,65535)),H=Ns(ux(this.atomics.element(kr(this.cellOffset).add(z)))),ue=ux(this.atomics.element(kr(this.flightOffset).add(z))).equal(kr(0));Vi(H.greaterThan(.5).and(S.greaterThan(0)),()=>{w.assign(2)}),Vi(w.greaterThan(1.5).and(S.greaterThan(0)).and(ue).and(s.reconstruct.lessThan(.5)),()=>{let ne=Ns(1).toVar();Vi(s.growEdges.greaterThan(.5),()=>{ne.assign(0);let re=[$t(1,0,0),$t(-1,0,0),$t(0,1,0),$t(0,-1,0),$t(0,0,1),$t(0,0,-1)];for(let ce of re){let ge=bc($t(g).add(ce),$t(0),$t(t-1));Vi(h.load(ge).level(0).r.lessThan(.5),()=>{ne.assign(1)})}}),Vi(ne.greaterThan(.5),()=>{let re=S,ce=Vo(0,S.sub(s.cellRestore.mul(E).mul(s.dt)));T.assign(ph(1,T.add(re.sub(ce).mul(2.5)))),S.assign(ce)})}),Vi(s.heal.greaterThan(.5).and(ue.or(s.reconstruct.greaterThan(.5))),()=>{let ne=Ns(8).toVar(),re=Ns(0).toVar(),ce=[$t(1,0,0),$t(-1,0,0),$t(0,1,0),$t(0,-1,0),$t(0,0,1),$t(0,0,-1)];for(let oe of ce){let Ae=bc($t(g).add(oe),$t(0),$t(t-1)),Ie=h.load(Ae).level(0);Vi(Ie.b.greaterThan(.5),()=>{ne.assign(ph(ne,Ie.r)),re.assign(1)})}let ge=s.reconstruct.greaterThan(.5),ye=Wm(ge,Wm(ne.lessThan(.05),Ns(0),Ns(1)),ne.add(s.healGap));Vi(re.greaterThan(.5).and(ye.lessThan(S)),()=>{let oe=Wm(ge,Vo(s.cellRestore.mul(s.fallbackHeal),s.healRate),s.healRate),Ae=Vo(ye,S.sub(oe.mul(E).mul(s.dt)));T.assign(ph(1,T.add(S.sub(Ae).mul(3)))),S.assign(Ae),Vi(Ae.lessThanEqual(ye.add(.001)),()=>{w.assign(1)})}),Vi(s.fallbackOn.greaterThan(.5).and(ge.not()),()=>{let oe=Vo(0,S.sub(s.fallbackHeal.mul(E).mul(s.dt)));T.assign(ph(1,T.add(S.sub(oe).mul(3)))),S.assign(oe)})}),Vi(S.greaterThan(v.r.add(5e-4)),()=>{w.assign(0)}),T.assign(Vo(0,T.sub(s.dt.mul(E).div(Vo(s.refrostTime,.01))))),S.assign(Wm(b.greaterThan(n),0,S)),vc(this.scratch,g,Gm(S,T,w,N)).toWriteOnly()})().compute(r,[64]),this.cellClearNode=Hn(()=>{jm(this.atomics.element(kr(this.cellOffset).add(ox)),kr(0))})().compute(65536,[64]),this.flightClearNode=Hn(()=>{jm(this.atomics.element(kr(this.flightOffset).add(ox)),kr(0))})().compute(65536,[64]),this.copyNode=Hn(()=>{let g=l(),y=d.load($t(g)).level(0);vc(this.tex,g,y).toWriteOnly()})().compute(r,[64]),this.statsBuf=jhe(4,\\\"uint\\\").toAtomic(),this.statsClearNode=Hn(()=>{oF(4,({i:g})=>{jm(this.statsBuf.element(g),kr(0))})})().compute(1,[1]),this.statsNode=Hn(()=>{let g=l(),y=h.load($t(g)).level(0),b=y.r;dF(this.statsBuf.element(0),kr(b.mul(65535))),dF(this.statsBuf.element(3),kr(y.g.mul(65535))),Vi(b.greaterThan(.5),()=>{hF(this.statsBuf.element(1),kr(1))}),Vi(b.greaterThan(.9),()=>{hF(this.statsBuf.element(2),kr(1))})})().compute(r,[64]),this.clearNode=Hn(()=>{let g=l();vc(this.tex,g,Gm(0)).toWriteOnly()})().compute(r,[64]),this.fillNode=Hn(()=>{let g=l(),y=this.shape.sdfNode(u(g));vc(this.tex,g,Gm(Wm(y.greaterThan(n),0,1),0,0,0)).toWriteOnly()})().compute(r,[64]),this.healClearNode=Hn(()=>{jm(this.atomics.element(kr(this.healOffset).add(ox)),kr(0))})().compute(r,[64]),this.bakeNode=Hn(()=>{let g=l(),y=u(g).toVar(),b=y.mul(s.crackWarpScale).add(s.seed.mul(.11)),v=tn(ws(b).mul(.6).add(ws(b.mul(2.1).add(tn(7.3,1.9,4.4))).mul(.4)),ws(b.add(tn(13.7,5.1,9.9))).mul(.6).add(ws(b.mul(2.1).add(tn(2.2,8.8,6.1))).mul(.4)),ws(b.add(tn(3.3,17.1,12.5))).mul(.6).add(ws(b.mul(2.1).add(tn(9.7,4.4,1.1))).mul(.4))),S=Kx.warpDomain(y,v,s.crackScale,s.crackWarp),T=bm(S,s.seed,s.crackCoverage).w.div(s.crackScale),w=lx(a*2.5,0,T),N=Po(tn(g)).mul(.15);vc(this.crackTex,g,Gm(v,gi(w.add(N.mul(w))))).toWriteOnly();let C=Kx.warpDomain(y,v,s.breakScale,s.crackWarp),R=A_(C,s.seed.add(3)),E=R.xyz.sub(v.mul(s.crackWarp)).div(s.breakScale);vc(this.cellTex,g,Gm(E,Po(R.xyz.add(s.seed)))).toWriteOnly()})().compute(r,[64])}clear(t){t.compute(this.clearNode),t.compute(this.cellClearNode),t.compute(this.flightClearNode)}rebake(t,r){let i=this.u,s=le.erosion,a=le.ice.cracks;i.crackScale.value=a.largeScale,i.crackWarp.value=a.warp,i.crackWarpScale.value=a.warpScale,i.crackCoverage.value=a.coverage,i.breakScale.value=s.breakCellScale;let n=`${a.largeScale}|${a.warp}|${a.warpScale}|${a.coverage}|${s.breakCellScale}`;(!this.baked||n!==this.lastCrackSig)&&!this.skipBake&&t.compute(this.bakeNode),this.lastCrackSig=n,this.baked=!0,i.reconstruct.value=r?1:0,t.compute(r?this.fillNode:this.clearNode),t.compute(this.cellClearNode),t.compute(this.flightClearNode),t.compute(this.healClearNode),this.crumbleUntil=-1,i.crumbleUntil.value=-1}readStats(t,r=0){this.statsPending||(this.statsPending=!0,this.statsIssuedT=r,t.compute(this.statsClearNode),t.compute(this.statsNode),t.getArrayBufferAsync(this.statsBuf.value).then(i=>{let s=new Uint32Array(i);this.stats.max=s[0]/65535,this.stats.over50=s[1],this.stats.over90=s[2],this.stats.refrost=s[3]/65535,this.statsReadT=this.statsIssuedT,this.statsPending=!1}).catch(()=>{this.statsPending=!1}))}crumbleUntil=-1;step(t,r,i,s,a,n=!0){let o=le.erosion,l=le.healing,u=this.u;if(u.dt.value=Math.min(i,1/30),u.time.value=r,le.version!==this.settingsVersion){this.settingsVersion=le.version;let d=le.ice.cracks,c=`${d.largeScale}|${d.warp}|${d.warpScale}|${d.coverage}|${o.breakCellScale}`;(!this.baked||c!==this.lastCrackSig)&&(u.crackScale.value=d.largeScale,u.crackWarp.value=d.warp,u.crackWarpScale.value=d.warpScale,u.crackCoverage.value=d.coverage,u.breakScale.value=o.breakCellScale,this.skipBake||t.compute(this.bakeNode),this.baked||t.compute(this.clearNode),this.baked=!0,this.lastCrackSig=c),u.healRate.value=l.healRate,u.healGap.value=l.healGap,u.fallbackHeal.value=l.fallbackHeal,u.refrostTime.value=l.refrostTime,u.cellRestore.value=l.cellRestore,u.growEdges.value=l.growFromEdges?1:0,u.breakup.value=l.breakup,u.breakupScale.value=l.breakupScale,u.crumbleRate.value=o.crumbleRate,u.crumbleCrackBias.value=o.crumbleCrackBias,u.brushNoise.value=o.brushNoise,u.brushNoiseScale.value=o.brushNoiseScale,u.cellSnap.value=o.cellSnap,u.brushSoftness.value=Math.max(o.brushSoftness,.02)}a>0&&(pt.lastStrokeT=r,u.crumbleUntil.value=r+o.crumbleDuration,this.crumbleUntil=r+o.crumbleDuration);let h=r-pt.lastStrokeT>l.healDelay;if(pt.healing=h,u.heal.value=h?1:0,u.fallbackOn.value=r-pt.lastStrokeT>l.healDelay+l.waveTime+l.waveJitter+Math.max(l.returnDuration,l.returnAfter)+1?1:0,u.segCount.value=a,a>0){let d=this.segments.array;for(let c=0;c\\u003ca*2;c++)d[c].copy(s[c])}!n||u.reconstruct.value>.5||(t.compute(this.stepNode),t.compute(this.cellClearNode),t.compute(this.copyNode))}commitAssembly(t){t.compute(this.copyNode)}dispose(){this.tex.dispose(),this.scratch.dispose(),this.crackTex.dispose(),this.cellTex.dispose()}},Hm=\\\"photographic\\\",{Fn:Hhe,vec2:Xhe,vec3:Xn,vec4:dx,float:Pa,int:Z0e,Loop:cF,If:Yw,Break:pF,normalize:Xm,length:mF,max:Sc,min:$he,abs:fF,dot:cx,pow:Zw,exp:qhe,log:Yhe,mix:J0e,clamp:px,refract:gF,reflect:Jw,select:mx,mat3:yF,texture:Q0e,equirectUV:K0e,cameraViewMatrix:xF,cameraProjectionMatrix:Zhe,cross:Jhe}=Jr;function Qhe(e){let{shape:t,erosion:r,p:i,ray:s,normal:a,environment:n,backdrop:o,u:l,f:u,roughness:h}=e,d=t.bound,c=Math.max(.001,d/1500),m=oe=>Xm(yF(l.model).mul(oe)),g=(oe,Ae)=>$w(n,l.envStrength,oe,Ae),y=oe=>{let Ae=t.voxelSize?t.voxelSize.mul(.75):Pa(d/240),Ie=Xn(t.sdfNode(oe.add(Xn(Ae,0,0))).sub(t.sdfNode(oe.sub(Xn(Ae,0,0)))),t.sdfNode(oe.add(Xn(0,Ae,0))).sub(t.sdfNode(oe.sub(Xn(0,Ae,0)))),t.sdfNode(oe.add(Xn(0,0,Ae))).sub(t.sdfNode(oe.sub(Xn(0,0,Ae)))));return Ie.div(Sc(mF(Ie),1e-5))},b=Sc(l.ior,1.001),v=mx(cx(a,s).greaterThan(0),a.negate(),a),S=Xm(gF(s,v,Pa(1).div(b))),T=Hhe(()=>{let oe=Pa(c*2).toVar(),Ae=Pa(0).toVar();return cF(64,()=>{let Ie=i.add(S.mul(oe)),Xe=t.sdfNode(Ie),at=r.sample(Ie).r;Yw(oe.greaterThan(c*4).and(Xe.greaterThan(0).or(at.greaterThan(l.cutThreshold))),()=>{pF()}),Ae.assign(oe),oe.addAssign(px(fF(Xe).mul(.7),c,d/12)),Yw(oe.greaterThan(d*2),()=>{pF()})}),cF(5,()=>{let Ie=Ae.add(oe).mul(.5),Xe=i.add(S.mul(Ie));Yw(t.sdfNode(Xe).lessThan(0).and(r.sample(Xe).r.lessThan(l.cutThreshold)),()=>{Ae.assign(Ie)}).Else(()=>{oe.assign(Ie)})}),dx(i.add(S.mul(oe)),oe)})(),w=y(T.xyz),N=mx(cx(w,S).lessThan(0),w.negate(),w),C=gF(S,N.negate(),b),R=mF(C).lessThan(1e-4),E=mx(R,Jw(S,N),C),P=l.model.mul(dx(T.xyz,1)).xyz,I=oe=>{let Ae=m(oe),Ie=xF.mul(dx(P,1)).xyz,Xe=yF(xF).mul(Ae),at=Pa(-35).sub(Ie.z).div($he(Xe.z,-.001)),W=Ie.add(Xe.mul(px(at,0,150))),j=Zhe.mul(dx(W,1)),G=Xhe(j.x.div(Sc(j.w,.001)).mul(.5).add(.5),j.y.div(Sc(j.w,.001)).mul(-.5).add(.5));return z1(o,px(G,0,1)).add(g(Ae,h).mul(l.backlight))},O=l.dispersion.mul(u.dispersion).mul(.025),L=Xm(Jhe(S,N).add(Xn(1e-5,0,0))),X=Xn(I(Xm(E.add(L.mul(O)))).r,I(E).g,I(Xm(E.sub(L.mul(O)))).b),z=Zw(b.sub(1).div(b.add(1)),2),H=z.add(Pa(1).sub(z).mul(Zw(Pa(1).sub(px(cx(v,s.negate()),0,1)),5))).mul(u.reflections),ue=mx(R,Pa(1),z.add(Pa(1).sub(z).mul(Zw(Pa(1).sub(fF(cx(N,S))),5)))),ne=T.w.mul(l.thicknessScale),re=qhe(Yhe(Sc(l.attColor,Xn(.001))).mul(ne.div(Sc(l.attDist,.01))).mul(u.absorption)),ce=g(m(Jw(s,v)),h),ge=g(m(Jw(S,N)),h),ye=X.mul(Pa(1).sub(ue)).add(ge.mul(ue)).mul(re);return{reflected:ce.mul(H),transmitted:ye.mul(Pa(1).sub(H)),distance:ne}}var{Fn:Khe,Loop:ede,int:vF,exp:tde,clamp:rde,vec2:$m,vec3:ide,float:fx,texture:Qw,abs:sde,pow:Kw,max:ade,smoothstep:nde}=Jr;function e2(e,t,r,i,s=fx(0)){if(!e)return fx(0);let a=Kw(sde(r),ide(6)),n=a.div(ade(a.x.add(a.y).add(a.z),.001)),o=(l,u)=>$m(l.x.mul(.932).sub(l.y.mul(.362)),l.x.mul(.362).add(l.y.mul(.932))).mul(i).add(u).add($m(s.mul(.217),s.mul(.371)));return Qw(e,o(t.yz,$m(.317,.173))).r.mul(n.x).add(Qw(e,o(t.zx,$m(.619,.431))).r.mul(n.y)).add(Qw(e,o(t.xy,$m(0))).r.mul(n.z))}function ode(e,t,r,i,s){let a=Zy(Bo(e.mul(r).add(t.mul(2)),3).mul(.5).add(.5),i,s),n=Bo(e.mul(r.mul(32)).add(t.mul(3.1)),3).mul(.5).add(.5);return Kw(a,1.5).mul(nde(.3,.69,n))}function bF(e,t,r,i,s,a,n){return Khe(()=>{let o=fx(0).toVar();return ede({start:vF(0),end:vF(3),type:\\\"int\\\",condition:\\\"\\u003c\\\"},({i:l})=>{let u=fx(l).add(.5).div(3),h=t.add(i.mul(s).mul(u));o.addAssign(Kw(e2(e,h,r,a,u),1.6).mul(tde(u.mul(-.7))))}),rde(o.div(3).mul(n),0,.45)})()}var{Fn:lde,If:ude,vec3:TF,vec4:SF,float:Ql,dot:hde,smoothstep:_c,normalize:dde,clamp:cde,dFdx:pde,dFdy:mde,length:_F,max:fde}=Jr;function wF(e){let t=Lm(e+11);return[0,1,2].map(()=>{let r=new F(t()*2-1,t()*2-1,t()*2-1).normalize();return TF(r.x,r.y,r.z)})}function MF(e,t,r,i,s,a,n,o=!1){let l=ne=>o?Ql(1).sub(_c(.35,1.25,fde(_F(pde(e.mul(ne))),_F(mde(e.mul(ne)))))):Ql(1),u=ode(e,r,a.frostScale,a.frostThreshold,a.frostSoftness),h=gi(u.add(a.interiorFrost)).mul(n.frost),d=(ne,re)=>ne.sub(re.mul(hde(ne,re)).mul(Ql(1).sub(Ql(1).div(a.smudgeAniso)))),c=SF(ws(d(e.mul(a.smudgeScale),i[0]).add(r.mul(3))),ws(d(e.mul(a.smudgeScale),i[1]).add(r.mul(4))),ws(d(e.mul(a.smudgeScale),i[2]).add(r.mul(5))),ws(e.mul(a.smudgeScale.mul(1.7)).add(r.mul(7)))),m=_c(.45,.85,c.x.mul(.5).add(.5)).add(_c(.45,.85,c.y.mul(.5).add(.5))).add(_c(.45,.85,c.z.mul(.5).add(.5))),g=_c(.6,.72,c.w.mul(.5).add(.5)),y=TF(Bo(e.mul(a.smudgeMaskScale).add(r.mul(21)),2).mul(.5).add(.5),Bo(e.mul(a.bumpMaskScale).add(r.mul(27)),2).mul(.5).add(.5),Bo(e.mul(a.regionScale).add(r.mul(33)),2).mul(.5).add(.5)),b=Zy(y.x,Ql(1).sub(a.smudgeCoverage),.35),v=Zy(y.y,Ql(1).sub(a.microCoverage),.35),S=Zy(y.z,Ql(1).sub(a.regionCoverage),.45),T=gi(m.div(3).add(g.mul(.6)).mul(a.smudgeAmount).mul(b)).mul(n.smudges),w=s.sampleCrack(e),N=hx.warpDomain(e,w.xyz,a.crackLarge,a.crackWarp).add(r.mul(.37)),C=lde(()=>{let ne=SF(0,0,1,1).toVar();return ude(n.cracks.greaterThan(.5),()=>{ne.assign(s.materialPlanes?s.materialPlanes.sample(N):bm(N,a.seed,a.crackCoverage))}),ne})(),R=C.w.div(a.crackLarge),E=Ql(1).sub(a.veinContrast.mul(Bo(e.mul(a.veinScale).add(r.mul(41)),2).mul(.5).add(.5))),P=_c(a.crackWidth.mul(5),0,R).mul(a.surfaceCrack).mul(S).mul(E).mul(n.cracks),I=gi(t.y.mul(.5).add(.5)),O=Na(e.mul(a.crystalScale).add(r)).mul(a.crystalBump).mul(.6).mul(n.crystals).mul(l(a.crystalScale)),L=Na(e.mul(a.edgeBumpScale).add(r.mul(13))).mul(a.edgeBump).mul(.5).mul(n.grain).mul(l(a.edgeBumpScale)),X=Na(e.mul(a.microScale).add(r.mul(5))).mul(a.microBump).mul(v).mul(n.micro).mul(l(a.microScale)),z=Na(e.mul(a.rippleScale).add(r.mul(9))).mul(a.rippleBump).mul(I).mul(n.ripples).mul(l(a.rippleScale)),H=O.add(L).sub(X).sub(z).sub(C.xyz.mul(P).mul(.6)),ue=dde(t.add(H.mul(n.surfaceBumps)));return{frost:h,smudge:T,surfCrack:P,nSurface:ue,regionMask:S,roughness:cde(a.baseRough.add(h.mul(a.frostRough)).add(T.mul(a.smudgeRough)).add(P.mul(.12)),.015,.8)}}var{Fn:Kl,vec3:ei,vec4:$n,float:yi,uniform:je,varying:gde,texture:yde,vec2:gx,positionLocal:xde,normalLocal:NF,cameraPosition:vde,transformNormalToView:AF,normalize:yx,dot:bde,length:wc,max:As,min:xx,abs:CF,pow:eye,exp:Tde,mix:vx,smoothstep:mh,clamp:qm,reflect:tye,select:RF,If:fh,Loop:EF,Break:PF,int:BF,output:t2,screenUV:r2}=Jr,Sde=0,i2=-1;function s2(e){i2=e}function _de({shape:e,erosion:t,seed:r,environment:i,fractureDetail:s,backdrop:a,meshEntry:n,glassMatcap:o,voronoiCells:l=\\\"27\\\"}){let u=l===\\\"8\\\"?ase:A_,h=Lm(r+11),d={model:je(new We),envStrength:je(1),backlight:je(.4),inclusionAmount:je(.3),inclusionScale:je(.4),baseColor:je(new gt(\\\"#f8f8f8\\\")),ior:je(1.36),dispersion:je(.02),thicknessScale:je(1),attDist:je(.9),attColor:je(new gt(\\\"#cfd2d4\\\")),baseRough:je(.05),frostScale:je(1.6),frostThreshold:je(.5),frostSoftness:je(.28),frostRough:je(.65),frostDiffuse:je(.55),crystalBump:je(.12),crystalScale:je(28),crackLarge:je(1.6),crackWarp:je(.45),crackCoverage:je(.55),regionScale:je(.8),regionCoverage:je(.7),veinScale:je(5),veinContrast:je(.7),crackFine:je(5.5),crackFineAmount:je(.45),fineCoverage:je(.35),fineNearLarge:je(.75),crackWidth:je(.004),crackBright:je(.4),crackDark:je(.5),crackRefr:je(.02),surfaceCrack:je(.35),crackSteps:je(14),smudgeAmount:je(.6),smudgeCoverage:je(.55),smudgeMaskScale:je(1.2),smudgeAniso:je(6),smudgeRough:je(.35),smudgeWhite:je(.08),smudgeScale:je(3.2),microBump:je(.25),microScale:je(60),microCoverage:je(.6),rippleBump:je(.3),rippleScale:je(9),bumpMaskScale:je(1.5),clearcoat:je(.3),clearcoatRough:je(.08),specularIntensity:je(1),interiorScatter:je(.25),deformAmp:je(.045),deformFreq:je(1.1),seed:je(r),edgeWidth:je(.35),edgeInset:je(.06),edgeBump:je(.6),edgeBumpScale:je(55),refrostStrength:je(1),cutThreshold:je(.7),cutSoft:je(.04),interiorSteps:je(24),interiorFrost:je(0),crumbleGlow:je(.15),edgeWhite:je(.5),lightDir:je(new F(0,1,0)),modelInv:je(new We),jitter:je(new fe),adaptiveSteps:je(0),powderTone:je(new gt(\\\"#dcdcdc\\\")),keyIntensity:je(3.2),keyColor:je(new gt(\\\"#ffffff\\\")),hover:je(0)},c=Object.fromEntries(Object.keys(Qd).map(V=>[V,je(Number(Qd[V]))])),m=ei(r*.731,r*.137,r*.529),g=wF(r),y=qa.matcap?new Pd:new mS,b=new F,v=new si,S=-1;y.side=ii,y.transparent=!1,y.metalness=0,y.transmission=1;let T=V=>Bo(V.mul(d.deformFreq).add(m),3).mul(d.deformAmp),w=V=>mh(d.cutThreshold.sub(d.edgeWidth),d.cutThreshold.sub(d.edgeWidth.mul(.15)),V),N=Kl(()=>{let V=xde,Oe=NF,tt=T(V),Je=t.sample(V).r,ct=w(Je),_e=t.sampleCrack(V).w.mul(d.surfaceCrack).mul(c.cracks).mul(c.surfaceBumps).mul(.012);return V.add(Oe.mul(tt.sub(ct.mul(d.edgeInset)).sub(_e)))})();y.positionNode=N;let C=gde(N),R=d.modelInv.mul($n(vde,1)).xyz,E=yx(C.sub(R)),P=d.lightDir,I=n?.position.sample(r2),O=n?.normal.sample(r2).xyz,L=n?n.depth.sample(r2).r.lessThan(.999999).and(t.sample(I.xyz).r.lessThan(d.cutThreshold)):null,X=Kl(()=>{let V=R,Oe=it=>RF(it.greaterThanEqual(0),yi(1),yi(-1)).div(As(CF(it),1e-6)),tt=ei(Oe(E.x),Oe(E.y),Oe(E.z)),Je=ei(-e.bound).sub(V).mul(tt),ct=ei(e.bound).sub(V).mul(tt),_e=xx(Je,ct),nt=As(Je,ct),dt=As(As(_e.x,As(_e.y,_e.z)),0),ft=xx(xx(nt.x,xx(nt.y,nt.z)),wc(C.sub(R))),Fe=$n(C,-1).toVar();return n&&fh(L,()=>{Fe.assign($n(I.xyz,wc(I.xyz.sub(R))))}),fh(ft.greaterThan(dt).and(Fe.w.lessThan(0)),()=>{let it=yi(2*t.bound/t.res),Rt=e.voxelSize??it,Ft=Rt.mul(.4),Ze=dt.toVar();EF(192,()=>{fh(Ze.greaterThan(ft),()=>{PF()});let ht=V.add(E.mul(Ze)),Yt=e.sdfNode(ht);fh(Yt.lessThanEqual(.001).and(t.sample(ht).r.lessThan(d.cutThreshold)),()=>{Fe.assign($n(ht,Ze)),PF()}),Ze.addAssign(As(Yt.sub(Ft).mul(.7),Rt.mul(.35)))}),fh(Fe.w.lessThan(0).and(t.sample(C).r.lessThan(d.cutThreshold)),()=>{Fe.assign($n(C,ft))})}),Fe})(),z=X.w,H=X.xyz,ue=.02,ne=ei(t.sample(H.add(ei(ue,0,0))).r.sub(t.sample(H.sub(ei(ue,0,0))).r),t.sample(H.add(ei(0,ue,0))).r.sub(t.sample(H.sub(ei(0,ue,0))).r),t.sample(H.add(ei(0,0,ue))).r.sub(t.sample(H.sub(ei(0,0,ue))).r)),re=wc(ne),ce=e.voxelSize?e.voxelSize.mul(.75):yi(ue),ge=ei(e.sdfNode(H.add(ei(ce,0,0))).sub(e.sdfNode(H.sub(ei(ce,0,0)))),e.sdfNode(H.add(ei(0,ce,0))).sub(e.sdfNode(H.sub(ei(0,ce,0)))),e.sdfNode(H.add(ei(0,0,ce))).sub(e.sdfNode(H.sub(ei(0,0,ce))))),ye=()=>RF(wc(ge).greaterThan(1e-5),ge.div(As(wc(ge),1e-5)),NF.negate()),oe=n?Kl(()=>{let V=ei(0).toVar();return fh(L,()=>V.assign(yx(O))).Else(()=>V.assign(ye())),V})():ye(),Ae=yx(vx(oe,ne.div(As(re,1e-5)),mh(.02,.15,re).mul(c.cutNormals))),Ie=H,{frost:Xe,smudge:at,surfCrack:W,nSurface:j,regionMask:G,roughness:ae}=MF(Ie,Ae,m,g,t,d,c,qa.aa);y.normalNode=AF(j.negate());let be=wc(C.sub(H)),Be=Kl(()=>{let V=yi(0).toVar(),Oe=qm(d.crackSteps.div(4).floor(),2,6).toVar();EF({start:BF(0),end:BF(Oe),type:\\\"int\\\",condition:\\\"\\u003c\\\"},({i:Je})=>{let ct=yi(Je).add(.5).div(Oe),_e=H.add(E.mul(be).mul(ct)).toVar(),nt=t.sampleCrack(_e),dt=hx.warpDomain(_e,nt.xyz,d.crackLarge,d.crackWarp).add(m.mul(.37)),ft=t.materialPlanes?t.materialPlanes.sample(dt):bm(dt,d.seed,d.crackCoverage),Fe=As(d.crackWidth.mul(d.crackLarge),.001),it=yi(1).sub(mh(Fe,Fe.mul(2.5),ft.w)),Rt=yi(1).sub(d.veinContrast.mul(Bo(_e.mul(d.veinScale).add(m.mul(41)),2).mul(.5).add(.5))),Ft=t.materialPlanes?t.materialPlanes.sample(dt.mul(d.crackFine.div(d.crackLarge)).add(m),!0):bm(dt.mul(d.crackFine.div(d.crackLarge)).add(m),d.seed.add(7),d.fineCoverage),Ze=As(d.crackWidth.mul(d.crackFine).mul(.35),.001),ht=yi(1).sub(mh(Ze,Ze.mul(2.5),Ft.w)),Yt=vx(yi(1),yi(1).sub(mh(.03,.25,ft.w)),d.fineNearLarge),Tr=mh(.24,.68,Bo(_e.mul(38).add(m),2).mul(.5).add(.5)),Gi=it.mul(Tr).add(ht.mul(d.crackFineAmount).mul(Yt)),na=mh(.85,.35,t.sample(_e).r),lu=CF(bde(ft.xyz,P)).mul(.6).add(.4);V.addAssign(Gi.mul(Rt).mul(G).mul(na).mul(lu).mul(Tde(ct.mul(be).div(As(d.attDist,.01)).negate())))});let tt=qm(V.div(Oe),0,1);return $n(tt.mul(d.crackBright),yi(1).sub(tt.mul(d.crackDark).mul(.15)),0,0)})(),$=Kl(()=>{let V=$n(0,1,0,0).toVar();return fh(c.cracks.greaterThan(.5),()=>{V.assign(Be)}),V})(),U=As(be.mul(d.thicknessScale),.001),J=(V,Oe)=>e2(s,V,Ae,d.inclusionScale,Oe),q=Hm===\\\"photographic\\\"?bF(s,Ie,Ae,E,be,d.inclusionScale,d.inclusionAmount).mul(c.scatter):yi(0),se=qm(Xe.mul(d.frostDiffuse).add(at.mul(d.smudgeWhite)).add(q.mul(.65)),0,.65),pe=Hm===\\\"photographic\\\"?J(Ie,yi(0)).mul(c.frost):yi(0);y.roughnessNode=qm(ae.add(pe.mul(.22)),.015,.8),y.iorNode=d.ior,y.dispersionNode=d.dispersion.mul(c.dispersion),y.thicknessNode=U,y.attenuationDistanceNode=As(d.attDist,.01),y.attenuationColorNode=vx(ei(1),d.attColor,c.absorption),y.colorNode=d.baseColor,y.clearcoatNode=d.clearcoat.mul(c.clearcoat),y.clearcoatRoughnessNode=d.clearcoatRough,y.specularIntensityNode=d.specularIntensity.mul(c.reflections);let Te=$.x.add(W.mul(.3)).mul(d.keyIntensity).mul(.3),we=se.mul(d.interiorScatter).mul(c.scatter);if(y.emissiveNode=d.keyColor.mul(Te.add(we.mul(.3))),qa.matcap){let V=yx(AF(j)),Oe=V.xy.mul(.495).add(.5),tt=ae.mul(ae).mul(.06),Je=_e=>yde(o,qm(_e,.002,.998)).rgb,ct=Je(Oe).mul(.4).add(Je(Oe.add(gx(tt,0))).mul(.15)).add(Je(Oe.sub(gx(tt,0))).mul(.15)).add(Je(Oe.add(gx(0,tt))).mul(.15)).add(Je(Oe.sub(gx(0,tt))).mul(.15)).mul(d.envStrength);y.outputNode=Kl(()=>{z.lessThan(0).discard();let _e=As(se,yi(1).sub(c.transmission)),nt=d.baseColor.mul(ct.mul(.5).add(ei(.2)).mul(d.keyIntensity));return $n(vx(ct.mul($.y),nt,_e).add(d.keyColor.mul(Te)).add(d.keyColor.mul(q.mul(d.backlight).mul(.8))),1)})()}else if(Hm===\\\"physical\\\")y.transmissionNode=c.transmission.mul(yi(1).sub(se)),y.outputNode=Kl(()=>(z.lessThan(0).discard(),$n(t2.rgb.mul($.y),t2.a)))();else{let V=qa.fast?zhe({ray:E,normal:j,environment:i,u:d,f:c,roughness:ae,path:be}):Qhe({shape:e,erosion:t,p:Ie,ray:E,normal:j,environment:i,backdrop:a,u:d,f:c,roughness:ae});y.transmission=0,y.transmissionNode=null,y.outputNode=Kl(()=>{z.lessThan(0).discard();let Oe=V.reflected.add(V.transmitted.mul($.y)),tt=As(se,yi(1).sub(c.transmission)),Je=Oe.mul(yi(1).sub(tt)).add(t2.rgb.mul(tt)),ct=d.keyColor.mul(q.mul(d.backlight).mul(.8));return $n(Je.add(ct).add(d.keyColor.mul(Te)),1)})()}function ie(V,Oe,tt,Je){if(le.version!==S){S=le.version;let _e=le.ice,nt=le.erosion,dt=le.shape,ft=le.healing;for(let it of Object.keys(c))c[it].value=Number(_e.features?.[it]??Qd[it]);d.baseColor.value.set(_e.baseColor??\\\"#ffffff\\\"),d.envStrength.value=_e.envIntensity,d.backlight.value=_e.backlight??.4,d.inclusionAmount.value=_e.inclusionAmount??.3,d.inclusionScale.value=_e.inclusionScale??.4,d.ior.value=_e.ior,d.dispersion.value=_e.dispersion,d.thicknessScale.value=_e.thicknessScale,d.attDist.value=_e.attenuationDistance,d.attColor.value.set(_e.attenuationColor),d.baseRough.value=_e.baseRoughness,d.frostScale.value=_e.frost.scale,d.frostThreshold.value=_e.frost.threshold,d.frostSoftness.value=_e.frost.softness,d.frostRough.value=_e.frost.roughness,d.frostDiffuse.value=_e.frost.diffuse,d.crystalBump.value=_e.frost.crystalBump,d.crystalScale.value=_e.frost.crystalScale;let Fe=_e.cracks;d.crackLarge.value=Fe.largeScale,d.crackWarp.value=Fe.warp,d.crackCoverage.value=Fe.coverage,d.regionScale.value=Fe.regionScale,d.regionCoverage.value=Fe.regionCoverage,d.veinScale.value=Fe.veinScale,d.veinContrast.value=Fe.veinContrast,d.crackFine.value=Fe.fineScale,d.crackFineAmount.value=Fe.fineAmount,d.fineCoverage.value=Fe.fineCoverage,d.fineNearLarge.value=Fe.fineNearLarge,d.crackWidth.value=Fe.width,d.crackBright.value=Fe.brightness,d.crackDark.value=Fe.darkness,d.crackRefr.value=Fe.refraction,d.surfaceCrack.value=Fe.surfaceStrength,d.crackSteps.value=Fe.steps,d.adaptiveSteps.value=le.performance.adaptiveSteps?1:0,d.smudgeAmount.value=_e.smudges.amount,d.smudgeCoverage.value=_e.smudges.coverage,d.smudgeMaskScale.value=_e.smudges.maskScale,d.smudgeAniso.value=_e.smudges.anisotropy,d.smudgeRough.value=_e.smudges.roughness,d.smudgeWhite.value=_e.smudges.whiteness,d.smudgeScale.value=_e.smudges.scale,d.microBump.value=_e.bumps.microBump,d.microScale.value=_e.bumps.microScale,d.microCoverage.value=_e.bumps.microCoverage,d.rippleBump.value=_e.bumps.rippleBump,d.rippleScale.value=_e.bumps.rippleScale,d.bumpMaskScale.value=_e.bumps.maskScale,d.clearcoat.value=_e.clearcoat,d.clearcoatRough.value=_e.clearcoatRoughness,d.specularIntensity.value=_e.specularIntensity,d.interiorScatter.value=_e.interiorScatter,d.deformAmp.value=dt.deformAmplitude,d.deformFreq.value=dt.deformFrequency,d.edgeWidth.value=nt.edgeWidth,d.cutThreshold.value=nt.cutThreshold,d.cutSoft.value=nt.cutSoftness,d.edgeInset.value=nt.edgeInset,d.interiorSteps.value=nt.interiorSteps,d.interiorFrost.value=nt.interiorFrost,d.crumbleGlow.value=_e.crumbleGlow,d.edgeWhite.value=_e.edgeWhiteness,d.edgeBump.value=nt.edgeBump,d.edgeBumpScale.value=nt.edgeBumpScale,d.refrostStrength.value=ft.refrostStrength,d.powderTone.value.set(le.powder.baseTone),d.keyIntensity.value=le.lighting.key.intensity,d.keyColor.value.set(le.lighting.key.color)}b.copy(tt.position).sub(tt.target.position).normalize(),Je.getWorldQuaternion(v).invert(),d.lightDir.value.copy(b.applyQuaternion(v)),d.model.value.copy(Je.matrixWorld),d.modelInv.value.copy(Je.matrixWorld).invert();let ct=i2>=0?i2:++Sde;d.jitter.value.set(ct*.7548776662%1,ct*.5698402909%1)}return{material:y,uniforms:d,features:c,update:ie}}var wde=typeof window\\u003c\\\"u\\\"&&window.__frostAssetBase||\\\"assets/\\\",a2=e=>wde+e,Mde=\\\"https://static.heygen.ai/hyperframes-oss/registry-assets/122961c82d240e47.png\\\",Ym=4,Nde=[[.8035,.94],[.94,.8055],[.7254,.94],[.94,.8764],[.94,.9233],[.7478,.94],[.94,.8079],[.6781,.94],[.94,.8965],[.94,.8612],[.7025,.94],[.8094,.94],[.94,.903],[.8238,.94],[.94,.7249],[.8374,.94]],{Fn:Zm,instancedArray:n2,instanceIndex:Ade,uint:Is,int:IF,float:Jm,ivec3:gh,vec3:FF,vec4:LF,If:Qm,Loop:Cde,atomicStore:Rde,atomicLoad:Ede,atomicMin:Pde,clamp:kF,floor:Bde,length:DF,dot:Ide,select:Fde,texture3D:Lde,textureStore:kde}=Jr,Km=32,OF=e=>4*e/Km,bx=4294967295,Dde=class{constructor(e,t,r,i){this.erosion=e;let s=Km,a=s**3,n=Ade,o=e.bound,l=(T,w)=>gh(T.mod(Is(w)),T.div(Is(w)).mod(Is(w)),T.div(Is(w*w))),u=T=>Is(T.x).add(Is(T.y).mul(Is(s))).add(Is(T.z).mul(Is(s*s))),h=T=>kF(gh(Bde(T.div(2*o).add(.5).mul(s))),gh(0),gh(s-1)),d=T=>FF(T).add(.5).div(s).sub(.5).mul(2*o),c=Zm(()=>{Rde(this.seeds.element(n),Is(bx))})().compute(a,[64]),m=Zm(()=>{let T=r.meta.element(n).x;Qm(T.greaterThan(.5).and(T.lessThan(2.5)),()=>{Pde(this.seeds.element(u(h(r.rest.element(n).xyz))),Is(n))})})().compute(t,[64]),g=Zm(()=>{this.owners[0].element(n).assign(Ede(this.seeds.element(n)))})().compute(a,[64]);this.prepareNodes=[c,m,g];let y=0;for(let T of[16,8,4,2,1,1]){let w=this.owners[y],N=this.owners[1-y];this.prepareNodes.push(Zm(()=>{let C=l(n,s).toVar(),R=d(C).toVar(),E=Is(bx).toVar(),P=Jm(1e30).toVar(),I={start:IF(-1),end:IF(1),condition:\\\"\\u003c=\\\"};Cde(I,I,I,({i:O,j:L,k:X})=>{let z=kF(C.add(gh(O,L,X).mul(T)),gh(0),gh(s-1)),H=w.element(u(z)).toVar();Qm(H.notEqual(Is(bx)),()=>{let ue=r.rest.element(H).xyz.sub(R),ne=Ide(ue,ue).toVar();Qm(ne.lessThan(P).or(ne.equal(P).and(H.lessThan(E))),()=>{E.assign(H),P.assign(ne)})})}),N.element(n).assign(E)})().compute(a,[64])),y=1-y}let b=this.owners[y],v=e.res,S=Lde(e.tex);this.updateNode=Zm(()=>{let T=l(n,v).toVar(),w=FF(T).add(.5).div(v).sub(.5).mul(2*o).toVar(),N=b.element(u(h(w))).toVar(),C=S.load(T).level(0).toVar().r.toVar();Qm(N.notEqual(Is(bx)),()=>{let R=r.rest.element(N).xyz.toVar(),E=i.model.mul(LF(R,1)).xyz,P=DF(r.pos.element(N).xyz.sub(E)),I=r.meta.element(N).x,O=DF(w.sub(R)),L=i.landRadius.add(Jm(OF(o)).div(Jm(1).add(O.div(2*o/s)))),X=I.greaterThan(1.5).and(I.lessThan(2.5)).or(I.greaterThan(4.5)).or(I.lessThan(.5));Qm(X.and(P.lessThanEqual(L)),()=>{C.assign(0)})}),kde(e.scratch,T,LF(C,0,Fde(C.lessThan(.5),Jm(1),Jm(0)),0)).toWriteOnly()})().compute(v**3,[64])}seeds=n2(Km**3,\\\"uint\\\").toAtomic();owners=[n2(Km**3,\\\"uint\\\"),n2(Km**3,\\\"uint\\\")];prepareNodes;updateNode;prepare(e){for(let t of this.prepareNodes)e.compute(t)}update(e){e.compute(this.updateNode),this.erosion.commitAssembly(e)}dispose(){for(let e of[this.seeds,...this.owners])e.value.dispose?.()}},{refract:Ode,log:Ude,output:o2,attribute:zde,positionView:Vde,reflect:Gde,vec2:UF,Fn:Go,vec3:vr,vec4:xi,float:De,uniform:Se,instancedArray:Mc,storage:ef,instanceIndex:Tx,If:Nt,Loop:Sx,int:yh,uint:vt,uvec3:Wde,ivec3:br,atomicAdd:Nc,atomicSub:jde,atomicLoad:Hde,atomicStore:zF,max:Xt,min:Wo,abs:Ac,dot:xh,length:Bi,normalize:Fs,exp:vh,mix:ti,smoothstep:jo,clamp:Ls,select:qt,floor:bh,fract:rye,sin:tf,cos:l2,sqrt:VF,texture3D:u2,textureStore:Xde,positionLocal:h2,normalLocal:$de,transformNormalToView:GF,varying:eu,cameraPosition:qde,screenUV:_x,mat3:Cc,mat4:iye,pow:Th,Break:sye,Continue:aye,cross:rf,step:WF,negate:nye,uv:Yde,texture:Zde,uniformArray:Jde,cameraViewMatrix:Qde}=Jr,d2=null;function Kde(){if(!d2){let e=new tb().load(Mde);e.flipY=!1,e.colorSpace=Fa,e.wrapS=e.wrapT=Ti,e.minFilter=Ia,e.magFilter=lr,e.generateMipmaps=!0,e.anisotropy=4,d2=e}return d2}var Ho=0,ece=1,jF=2,tce=3,rce=4,HF=5,ice=class{constructor(e){this.o=e;let{count:t,strays:r,rand:i,shape:s}=e;this.total=t+r;let a=this.total,n=le.powder,o=rI(s,t,n.nearSurfaceFraction,n.nearSurfaceDepth,i),l=new Float32Array(a*4),u=new Float32Array(a*4),h=new Float32Array(a*4),d=new Float32Array(a*4),c=new Float32Array(a*4),m=[n.grainSizes.tinyDustRatio,n.grainSizes.smallGrainRatio,n.grainSizes.mediumClumpRatio,.01],g=m.reduce((R,E)=>R+E,0),y=[m[0]/g,(m[0]+m[1])/g,(m[0]+m[1]+m[2])/g],b=Math.cbrt(8*s.bound**3/Math.max(100,e.clumpCount)),v=Math.ceil(s.bound/b)+1,S=v*2+1,T=new Map;for(let R=0;R\\u003ct;R++){let E=R*3,P=R*4,I=o.positions[E],O=o.positions[E+1],L=o.positions[E+2],X=o.depths[R],z=i(),H=z\\u003cy[0]?0:z\\u003cy[1]?1:z\\u003cy[2]?2:3;H===3&&X>.2&&(H=2);let ue=Math.floor(I/b)+v,ne=Math.floor(O/b)+v,re=Math.floor(L/b)+v,ce=ue+ne*S+re*S*S,ge=T.get(ce);ge===void 0&&(ge=R,T.set(ce,R)),h[P]=I,h[P+1]=O,h[P+2]=L,h[P+3]=.35+i()*.4,l[P]=I,l[P+1]=O,l[P+2]=L,d[P]=Ho,d[P+1]=i(),d[P+2]=H,d[P+3]=ge}for(let R=0;R\\u003cr;R++){let E=t+R,P=i()*Math.PI*2,I=s.name===\\\"torus\\\"?(s.size-s.size*s.tubeRatio)*(.15+i()*.75):s.bound*(1.05+i()*.35),O=Math.cos(P)*I,L=Math.sin(P)*I,X=(i()-.5)*s.thickness*1.2,z=E*4;h[z]=O,h[z+1]=L,h[z+2]=X,h[z+3]=2,l[z]=O,l[z+1]=L,l[z+2]=X,l[z+3]=.01,u[z+3]=i()*10,d[z]=tce,d[z+1]=i(),d[z+2]=i()\\u003c.8?0:1,d[z+3]=E}this.count=t,this.restInit=h.slice();let w=this.buffers;w.pos=Mc(l,\\\"vec4\\\"),w.vel=Mc(u,\\\"vec4\\\"),w.rest=Mc(h,\\\"vec4\\\"),w.meta=Mc(d,\\\"vec4\\\"),w.heal=Mc(c,\\\"vec4\\\"),w.leaders=Mc(a,\\\"vec4\\\");let N=e.variants,C=e.densityRes;w.atomics=e.atomics,this.densityTex=new d_(C,C,C),this.densityTex.type=Dt,this.densityTex.format=pi,this.densityTex.minFilter=this.densityTex.magFilter=lr,this.densityTex.wrapS=this.densityTex.wrapT=this.densityTex.wrapR=Ti,this.u.bound.value=s.bound,this.u.holeRadius.value=s.name===\\\"torus\\\"?s.size-s.size*s.tubeRatio:s.bound,e.enabled!==!1&&(this.buildCompute(),this.assembly=new Dde(e.erosion,t,w,this.u),this.buildMeshes(),e.scene.add(this.group)),this.prevModel.copy(e.objectGroup.matrixWorld)}total;count;restInit;meshes=[];group=new pn;densityTex;assembly;assemblyEnabled=!0;beforeIntegrate;beforeAssembly;buffers={};nodes={};material;prevModel=new We;inversePrevModel=new We;statsTimer=0;densityDirty=!0;fragmentShadowMap=!0;settingsVersion=-1;u={rigEnabled:Se(0),rigStrength:Se(1),surfaceFrost:Se(1),surfaceDetail:Se(1),dt:Se(0),time:Se(0),model:Se(new We),previousModel:Se(new We),modelDelta:Se(new We),normalMat:Se(new Dr),strokeDir:Se(new F(1,0,0)),strokeSpeed:Se(0),heal:Se(0),ejectSpeed:Se(1.1),ejectSpread:Se(.5),ejectTurb:Se(.8),backwardRatio:Se(.25),clumpJitter:Se(.5),drag:Se(1.4),gravity:Se(.12),turbulence:Se(.9),turbScale:Se(1.8),turbDecay:Se(.6),cohesion:Se(2.4),settleTime:Se(3.2),settledDrift:Se(.012),tumble:Se(2.5),returnDuration:Se(2.4),returnCurve:Se(.35),inherit:Se(1),inheritTime:Se(.22),straySpeed:Se(.06),fade:Se(1),sizeMul:Se(1),amount:Se(.3),dustScale:Se(.0055),grainScale:Se(.011),clumpScale:Se(.022),fragmentScale:Se(.05),sizeJitter:Se(.45),densityExtent:Se(4.2),densityScale:Se(.03),shadowStrength:Se(.75),aoStrength:Se(.55),lightDir:Se(new F(0,1,0)),tone:Se(new gt(\\\"#dcdcdc\\\")),wrap:Se(.45),keyIntensity:Se(3.2),keyColor:Se(new gt(\\\"#ffffff\\\")),colorByState:Se(0),colorBySize:Se(0),colorByAge:Se(0),camPos:Se(new F),invProj:Se(new We),camWorld:Se(new We),hazeSteps:Se(28),strayBase:Se(1),holeRadius:Se(.55),bound:Se(1.5),fieldActive:Se(1),hazeOn:Se(1),waveTime:Se(2),waveJitter:Se(.6),minEject:Se(1),minPixel:Se(1.5),pixelWorld:Se(.001),ghostDist:Se(0),ghostFrac:Se(.45),waveReach:Se(3),depositRadius:Se(2),returnMode:Se(1),springK:Se(6),springDamp:Se(.9),springRamp:Se(.6),landRadius:Se(.03),returnAfter:Se(3),maxSpeed:Se(8),returnDrag:Se(.25),returnMaxSpeed:Se(12),lostRadius:Se(30),stragglers:Se(0),spriteSee:Se(0),frontDuration:Se(3.2),frontX:Se(-.65),frontY:Se(.55),frontAngle:Se(-35),frontSpread:Se(.65),frontNoise:Se(.35),speedVariation:Se(.65),pathBend:Se(1.2),pathSwirl:Se(1.1),landingVariation:Se(.8),groupNoise:Se(2),assemblyEnd:Se(0),groupStagger:Se(0),groupScale:Se(.65),groupSeed:Se(7),alignAmt:Se(1),alignDist:Se(.6),alignCurve:Se(1),landedFade:Se(.25),landShrink:Se(0),translucency:Se(.6),throughTint:Se(new gt(\\\"#aeb6bb\\\")),fresnelPower:Se(3),fragRough:Se(.32),fragClearcoat:Se(.6),fragSpecular:Se(1),sparkle:Se(.6),sparkleFraction:Se(.35),sparkleSpread:Se(.5),lightDirView:Se(new F(0,1,0)),spriteSize:Se(1.4),spriteTilt:Se(.5),spriteNormal:Se(1),spriteFrost:Se(1),spriteFrostBoost:Se(.35),spriteFrostRough:Se(.7),spriteEdge:Se(.6),spriteCut:Se(.2),repel:Se(0),repelStrength:Se(6),repelRange:Se(.35),repelRadial:Se(12),repelRadialRange:Se(1.6),modelInv:Se(new We)};buildCompute(){let{count:e,shape:t,erosion:r,variants:i}=this.o,s=this.total,a=this.u,n=this.buffers,o=this.o.densityRes,l=Tx,u=this.o.countersOffset,h=this.o.healOffset,d=this.o.cellOffset,c=this.o.flightOffset,m=this.o.fieldRes,g=u2(r.cellTex),y=I=>n.atomics.element(vt(u).add(vt(I))),b=I=>n.atomics.element(I),v=I=>n.atomics.element(vt(h).add(I)),S=I=>qt(I.lessThan(.5),a.dustScale,qt(I.lessThan(1.5),a.grainScale,qt(I.lessThan(2.5),a.clumpScale,a.fragmentScale))),T=I=>qt(I.lessThan(.5),vt(1),qt(I.lessThan(1.5),vt(2),qt(I.lessThan(2.5),vt(5),vt(12))));this.nodes.snapshotLeaders=Go(()=>{n.leaders.element(l).assign(xi(n.pos.element(l).xyz,n.meta.element(l).x))})().compute(s,[64]);let w=I=>{let O=Ls(I,0,1);return qt(O.lessThan(.5),Th(2,O.mul(20).sub(10)).div(2),De(2).sub(Th(2,O.mul(-20).add(10))).div(2))};this.nodes.resetCounters=Go(()=>{Sx(8,({i:I})=>{zF(y(I),vt(0))})})().compute(1,[1]);let N=this.o.turbulence===\\\"fast\\\"?I=>rf(Na(I),Na(I.add(vr(31.7,11.3,57.9)))).mul(1.6):I=>sse(I),C=I=>I.div(Xt(Bi(I),1e-6)),R=(I,O)=>Go(()=>{let L=I,X=n.pos.element(L),z=n.vel.element(L),H=n.rest.element(L),ue=n.meta.element(L),ne=n.heal.element(L),re=ue.x.toVar(),ce=ue.y.toVar(),ge=ue.z.toVar(),ye=ue.w.toVar(),oe=X.xyz.toVar(),Ae=X.w.toVar(),Ie=z.xyz.toVar(),Xe=z.w.toVar(),at=H.xyz.toVar(),W=H.w.toVar(),j=ea(ce,1).toVar(),G=ea(ce,2).toVar(),ae=ea(ce,3).toVar(),be=S(ge).mul(De(1).sub(a.sizeJitter.mul(.5)).add(a.sizeJitter.mul(j))).mul(a.sizeMul).toVar(),Be=a.model.mul(xi(at,1)).xyz.toVar(),$=C(a.normalMat.mul(G1(t,at,.004))).toVar(),U=a.model.mul(xi(0,0,0,1)).xyz.toVar(),J=r.sample(at).toVar(),q=J.r.toVar(),se=J.a.greaterThan(.01),pe=N_(ce.mul(211.7).add(5)).lessThan(a.amount),Te=ne.w.greaterThan(.5),we=()=>{let _e=br(bh(r.uvw(at).mul(De(m)))),nt=g.load(Ls(_e,br(0),br(m-1))).level(0).w;return vt(Ls(nt.mul(65535),0,65535))},ie=()=>{Nc(n.atomics.element(vt(c).add(we())),vt(1))},V=_e=>{let nt=we().toVar(),dt=jde(n.atomics.element(vt(c).add(nt)),vt(1)).toVar();Nt(_e.and(dt.lessThanEqual(vt(1).add(vt(a.stragglers)))),()=>{Nc(n.atomics.element(vt(d).add(nt)),vt(1))})},Oe=()=>{let _e=at.add(this.o.erosion.bound).div(this.o.erosion.bound*2).mul(De(m)),nt=br(bh(_e)).toVar(),dt=a.depositRadius.toVar(),ft=yh(dt.ceil()).toVar(),Fe={start:ft.negate(),end:ft,condition:\\\"\\u003c=\\\"};Sx(Fe,Fe,Fe,({i:it,j:Rt,k:Ft})=>{let Ze=nt.add(br(it,Rt,Ft)),ht=De(it.mul(it).add(Rt.mul(Rt)).add(Ft.mul(Ft))).lessThanEqual(dt.mul(dt).add(.01));Nt(ht.and(Ze.x.greaterThanEqual(0)).and(Ze.y.greaterThanEqual(0)).and(Ze.z.greaterThanEqual(0)).and(Ze.x.lessThan(m)).and(Ze.y.lessThan(m)).and(Ze.z.lessThan(m)),()=>{let Yt=vt(Ze.x).add(vt(Ze.y).mul(vt(m))).add(vt(Ze.z).mul(vt(m*m)));Nc(v(Yt),vt(1))})})},tt=()=>{let _e=Bi(oe.sub(Be)),nt=Ls(_e.div(a.waveReach),0,1).mul(a.waveTime),dt=r.u.reconstruct.greaterThan(.5).and(a.groupNoise.greaterThan(.5)),ft=qt(dt,ae.mul(a.waveJitter).mul(.04),ae.mul(a.waveJitter)),Fe=nt.add(ft),it=a.groupNoise.greaterThan(1.5),Rt=De(0).toVar();return Nt(r.u.reconstruct.greaterThan(.5).and(a.groupStagger.greaterThan(0).or(it)),()=>{let Ft=qt(a.returnMode.greaterThan(.5),mse(_e,Bi(Ie),a),a.returnDuration.add(.2)),Ze=Xt(0,a.assemblyEnd.sub(a.time).sub(Fe).sub(Ft));Rt.assign(Wo(qt(it,a.frontDuration,a.groupStagger),Ze).mul(qt(a.rigEnabled.greaterThan(.5),C_(at,a),Xt(0,W.sub(2)))))}),a.time.add(nt).add(ft).add(Rt)},Je=()=>a.time.add(j.mul(a.waveTime)).add(ae.mul(a.waveJitter)),ct=()=>{let _e=Be,nt=$,dt=n.meta.element(vt(ye)).y,ft=De(1).sub(a.clumpJitter.mul(.5)).add(a.clumpJitter.mul(N_(dt.mul(77.7)))),Fe=qt(N_(dt.mul(31.3).add(1)).lessThan(a.backwardRatio),De(-1),De(1)),it=Xt(a.strokeSpeed,a.minEject),Rt=a.strokeDir.mul(Fe),Ft=N(_e.mul(a.turbScale).add(a.time.mul(.2))),Ze=Rt.mul(it.mul(a.ejectSpeed).mul(ft)).add(nt.mul(a.ejectSpread).mul(De(.5).add(G)).mul(it.mul(.4))).add(Ft.mul(a.ejectTurb).mul(it.mul(.25)).mul(ae.add(.5))),ht=qt(ge.greaterThan(2.5),De(.35),De(1));Ie.assign(Ze.mul(ht)),oe.assign(_e.add(nt.mul(.002))),Xe.assign(0),Ae.assign(be),re.assign(ece),ne.w.assign(0),ie()};Nt(re.lessThan(.5),()=>{Nt(a.fieldActive.greaterThan(.5),()=>{Nt(q.greaterThan(W),()=>{Nt(pe,()=>{ct()}).Else(()=>{re.assign(rce),ne.w.assign(0)})})})}).ElseIf(re.lessThan(1.5),()=>{Xe.addAssign(a.dt);let _e=jo(a.settleTime.mul(.45),a.settleTime,Xe),nt=N(oe.mul(a.turbScale).add(a.time.mul(.15))).mul(a.turbulence).mul(vh(Xe.mul(a.turbDecay).negate())),dt=n.leaders.element(vt(ye)),ft=dt.w,Fe=qt(ft.greaterThan(.5).and(ft.lessThan(1.5)),dt.xyz.sub(oe).mul(a.cohesion).mul(De(1).sub(_e)),vr(0)),it=vr(0).toVar();Nt(a.repel.greaterThan(.5),()=>{let Ze=a.modelInv.mul(xi(oe,1)).xyz.toVar(),ht=t.sdfNode(Ze).toVar();Nt(ht.lessThan(a.repelRange),()=>{let Gi=gi(De(1).sub(ht.div(a.repelRange))),na=C(a.normalMat.mul(G1(t,Ze,.004)));it.assign(na.mul(a.repelStrength).mul(Gi.mul(Gi)))});let Yt=oe.sub(U),Tr=Bi(Yt).div(a.bound.mul(a.repelRadialRange));Nt(Tr.lessThan(1),()=>{let Gi=De(1).sub(Tr.mul(Tr)),na=C(Yt.add(vr(j.sub(.5),G.sub(.5),ae.sub(.5)).mul(.05)));it.addAssign(na.mul(a.repelRadial).mul(Gi.mul(Gi)))})}),Ie.addAssign(nt.add(Fe).add(it).add(vr(0,a.gravity.negate(),0)).mul(a.dt)),Ie.mulAssign(vh(a.drag.mul(a.dt).negate())),Ie.mulAssign(De(1).sub(_e.mul(Wo(1,a.dt.mul(3))))),oe.addAssign(Ie.mul(a.dt)),oe.addAssign(N(oe.mul(.9).add(a.time.mul(.05))).mul(a.settledDrift).mul(_e).mul(a.dt)),Nt(a.inherit.greaterThan(.5).and(Xe.lessThan(a.inheritTime)),()=>{let Ze=De(1).sub(jo(a.inheritTime.mul(.75),Xt(a.inheritTime,.001),Xe));oe.assign(ti(oe,a.modelDelta.mul(xi(oe,1)).xyz,Ze)),Ie.assign(ti(Ie,Cc(a.modelDelta).mul(Ie),Ze))});let Rt=Bi(Ie);Nt(Rt.greaterThan(a.maxSpeed),()=>{Ie.mulAssign(a.maxSpeed.div(Rt))});let Ft=a.returnAfter.greaterThan(.001).and(Xe.greaterThan(a.returnAfter));Nt(a.heal.greaterThan(.5).or(Ft),()=>{Nt(Te.not(),()=>{ne.w.assign(tt())}),Nt(ne.w.greaterThan(.5).and(a.time.greaterThanEqual(ne.w)),()=>{re.assign(jF),ne.xyz.assign(oe),ne.w.assign(a.time)})}).Else(()=>{ne.w.assign(0)})}).ElseIf(re.lessThan(2.5),()=>{let _e=ne.w.lessThan(-.5),nt=qt(_e,Xe,ne.w).toVar();Nt(_e.not(),()=>{Xe.addAssign(a.dt)});let dt=ne.xyz,ft=Be,Fe=$;Nt(a.returnMode.greaterThan(.5),()=>{let it=a.time.sub(nt),Rt=jo(0,Xt(a.springRamp,.001),it),Ft=a.inherit.mul(De(1).sub(Rt)).mul(De(1).sub(jo(a.inheritTime.mul(.75),Xt(a.inheritTime,.001),Xe)));oe.assign(ti(oe,a.modelDelta.mul(xi(oe,1)).xyz,Ft)),Ie.assign(ti(Ie,Cc(a.modelDelta).mul(Ie),Ft));let Ze=ft.sub(oe),ht=Bi(Ze).toVar(),Yt=qt(r.u.reconstruct.greaterThan(.5).and(a.groupNoise.greaterThan(1.5)),De(1),De(0)),Tr=ti(De(1),ti(De(.55),De(1.8),j),a.speedVariation.mul(Yt)),Gi=a.springK.mul(a.rigStrength).mul(Tr.mul(Tr)).mul(Rt),na=VF(a.springK.mul(a.rigStrength)).mul(Tr).mul(2).mul(a.springDamp).mul(Rt),lu=Bi(ft.sub(dt)),uu=Ls(ht.div(Xt(lu,.05)),0,1),Ch=De(1).sub(jo(.5,2.4,it.mul(Tr))),Fc=C(rf(Fe,vr(G,ae,j).sub(.5)).add(.001)),Lc=rf(Fe,Fc),Rh=it.mul(a.pathSwirl).mul(G.mul(2).sub(1)).add(ae.mul(6.283185)),kc=Fc.mul(l2(Rh)).add(Lc.mul(tf(Rh))).add(Fe.mul(G.sub(.5))).mul(Wo(lu,3)).mul(a.pathBend).mul(.5).mul(uu.mul(.3).add(tf(uu.mul(Math.PI)).mul(.7))).mul(Ch).mul(Yt),xf=a.previousModel.mul(xi(at,1)).xyz,Eh=ft.sub(xf).div(Xt(a.dt,1e-5)),Ph=Ze.add(kc).mul(Gi).sub(Ie.sub(Eh).mul(na)).add(vr(0,a.gravity.negate().mul(De(1).sub(Rt)),0));Ie.addAssign(Ph.mul(a.dt)),Ie.mulAssign(vh(a.drag.mul(a.returnDrag).mul(a.dt).negate()));let Dc=Bi(Ie),Oc=a.returnMaxSpeed.mul(Tr);Nt(Dc.greaterThan(Oc),()=>{Ie.mulAssign(Oc.div(Dc))});let Uc=Ie.mul(a.dt),vf=Bi(Uc);oe.addAssign(qt(vf.greaterThan(ht),Ze,Uc)),Ae.assign(be.mul(qt(a.landShrink.greaterThan(.001),gi(ht.div(Xt(a.landShrink,.001))),De(1))).mul(qt(_e,jo(0,.25,it),De(1))));let bf=ht.lessThan(a.landRadius);Nt(bf,()=>{Nt(_e.not(),()=>{V(se.not().and(r.u.reconstruct.lessThan(.5))),Nt(se.not().and(r.u.reconstruct.lessThan(.5)),()=>{Oe()})}),re.assign(qt(_e,De(Ho),De(HF))),oe.assign(ft),Ie.assign(vr(0)),ne.w.assign(0),Ae.assign(qt(_e.or(r.u.reconstruct.greaterThan(.5)),De(0),be))})}).Else(()=>{let it=Ls(a.time.sub(nt).div(Xt(a.returnDuration,.05)),0,1).toVar(),Rt=Ls(a.time.sub(a.dt).sub(nt).div(Xt(a.returnDuration,.05)),0,1),Ft=w(it),Ze=ti(dt,ft,.5).add(Fe.mul(a.returnCurve).mul(Bi(ft.sub(dt))).mul(.5)).add(vr(G,ae,j).sub(.5).mul(a.returnCurve).mul(.4)),ht=ti(dt,Ze,Ft),Yt=ti(Ze,ft,Ft);oe.assign(ti(ht,Yt,Ft));let Tr=qt(_e,jo(De(1).sub(a.ghostFrac),De(1).sub(a.ghostFrac).add(.08),it),De(1));Ae.assign(be.mul(De(1).sub(jo(.82,1,it))).mul(Tr)),Nt(Rt.lessThan(.85).and(it.greaterThanEqual(.85)).and(_e.not()),()=>{V(se.not().and(r.u.reconstruct.lessThan(.5))),Nt(se.not().and(r.u.reconstruct.lessThan(.5)),()=>{Oe()})}),Nt(it.greaterThanEqual(1),()=>{re.assign(qt(_e,De(Ho),De(HF))),oe.assign(ft),ne.w.assign(0)})}),Nt(r.u.reconstruct.greaterThan(.5).and(_e.not()),()=>{let it=qt(a.groupNoise.greaterThan(1.5),a.landingVariation,De(0)),Rt=De(OF(r.bound)).mul(ti(De(1),ti(De(.35),De(1.65),G),it)),Ft=jo(a.landRadius,Xt(a.landRadius.add(.001),Rt),Bi(ft.sub(oe)));Ae.assign(be.mul(Th(Ft,ti(De(1),ti(De(.45),De(2.2),ae),it)))),Nt(re.greaterThan(4.5),()=>{H.w.assign(2)})})}).ElseIf(re.lessThan(3.5),()=>{let _e=a.time.mul(a.straySpeed).mul(De(.5).add(j)).add(ce.mul(6.2831)),nt=Bi(at.xy),dt=at.z.add(tf(a.time.mul(.3).add(ce.mul(12))).mul(.05)),ft=vr(l2(_e).mul(nt),tf(_e).mul(nt),dt);oe.assign(a.model.mul(xi(ft,1)).xyz),Ae.assign(S(ge).mul(.9).mul(a.sizeMul)),Xe.assign(Xe.add(a.dt))}).ElseIf(re.lessThan(4.5),()=>{Nt(a.heal.greaterThan(.5),()=>{Nt(Te.not(),()=>{ne.w.assign(Je().add(a.returnDuration.mul(De(1).sub(a.ghostFrac))))}),Nt(ne.w.greaterThan(.5).and(a.time.greaterThanEqual(ne.w)),()=>{Nt(a.ghostDist.greaterThan(.001),()=>{let _e=$,nt=C(rf(_e,vr(j.sub(.5),G.sub(.5),ae.sub(.5)).add(.001))),dt=Be.add(_e.mul(a.ghostDist).mul(De(.4).add(j.mul(.6)))).add(nt.mul(a.ghostDist).mul(G.sub(.5)).mul(.8));ne.xyz.assign(dt),ne.w.assign(-1),oe.assign(dt),Xe.assign(a.time.sub(a.returnDuration.mul(De(1).sub(a.ghostFrac)))),Ae.assign(0),re.assign(jF)}).Else(()=>{re.assign(Ho),ne.w.assign(0)})})}).Else(()=>{ne.w.assign(0)})}).Else(()=>{oe.assign(Be),Nt(r.u.reconstruct.greaterThan(.5),()=>{re.assign(Ho),ne.w.assign(0),Ae.assign(0)}).ElseIf(q.lessThan(W),()=>{Nt(ne.w.lessThan(.5),()=>{ne.w.assign(a.time)});let _e=gi(a.time.sub(ne.w).div(Xt(a.landedFade,.01)));Ae.assign(be.mul(De(1).sub(_e))),Nt(_e.greaterThanEqual(1),()=>{re.assign(Ho),ne.w.assign(0),Ae.assign(0)})}).Else(()=>{Ae.assign(be),ne.w.assign(0),Nt(se.and(a.fieldActive.greaterThan(.5)),()=>{ct()})})}),Nt(re.greaterThan(.5).and(re.lessThan(2.5)),()=>{let _e=Ac(oe.x).lessThan(1e30).and(Ac(oe.y).lessThan(1e30)).and(Ac(oe.z).lessThan(1e30)).and(Ac(Ie.x).lessThan(1e30)).and(Ac(Ie.y).lessThan(1e30)).and(Ac(Ie.z).lessThan(1e30)),nt=Bi(oe.sub(U)).greaterThan(a.lostRadius);Nt(_e.not().or(nt),()=>{oe.assign(Be.add($.mul(.05))),Ie.assign(vr(0))})}),X.xyz.assign(oe),X.w.assign(Ae),z.xyz.assign(Ie),z.w.assign(Xe),ue.x.assign(re),Nt(re.greaterThan(.5).and(re.lessThan(3.5)).or(re.greaterThan(4.5)),()=>{let _e=vt(bh(ce.mul(1e3))).mod(vt(i));Nc(y(_e),vt(1));let nt=oe.add(a.densityExtent).div(a.densityExtent.mul(2)).mul(De(o)),dt=br(bh(nt));Nt(dt.x.greaterThanEqual(0).and(dt.y.greaterThanEqual(0)).and(dt.z.greaterThanEqual(0)).and(dt.x.lessThan(o)).and(dt.y.lessThan(o)).and(dt.z.lessThan(o)),()=>{let ft=vt(dt.x).add(vt(dt.y).mul(vt(o))).add(vt(dt.z).mul(vt(o*o)));Nc(b(ft),T(ge))})})})().compute(O,[64]);this.nodes.update=R(Tx,s),this.nodes.updateStrays=this.o.strays>0?R(Tx.add(vt(e)),this.o.strays):null;let E=()=>Wde(l.mod(vt(o)),l.div(vt(o)).mod(vt(o)),l.div(vt(o*o))),P=I=>{let O=Ls(br(I),br(0),br(o-1)),L=vt(O.x).add(vt(O.y).mul(vt(o))).add(vt(O.z).mul(vt(o*o)));return De(Hde(b(L))).mul(a.densityScale)};this.nodes.resolve=Go(()=>{let I=E(),O=P(br(I)).toVar(),L=De(1).sub(vh(O.negate())),X=a.lightDir.mul(De(o)).div(a.densityExtent.mul(2)).toVar(),z=De(0).toVar(),H=vr(I).add(.5).toVar();Sx(6,()=>{H.addAssign(X.mul(.9)),z.addAssign(P(br(bh(H))))});let ue=vh(z.mul(.9).negate()),ne=P(br(I).add(br(1,0,0))).add(P(br(I).add(br(-1,0,0)))).add(P(br(I).add(br(0,1,0)))).add(P(br(I).add(br(0,-1,0)))).add(P(br(I).add(br(0,0,1)))).add(P(br(I).add(br(0,0,-1)))),re=De(1).sub(vh(ne.div(6).add(O).mul(1.2).negate()));Xde(this.densityTex,I,xi(L,ue,re,1)).toWriteOnly()})().compute(o*o*o,[64]),this.nodes.clearDensity=Go(()=>{zF(b(l),vt(0))})().compute(o*o*o,[64]),this.nodes.retargetCount=Go(()=>{let I=n.meta.element(l),O=n.rest.element(l),L=n.pos.element(l),X=I.x.toVar();Nt(X.greaterThan(4.5),()=>{I.x.assign(Ho),L.w.assign(0),n.heal.element(l).assign(xi(0)),X.assign(Ho)}),Nt(X.greaterThan(.5).and(X.lessThan(2.5)),()=>{Nt(r.u.reconstruct.greaterThan(.5).and(a.groupStagger.greaterThan(0).or(a.groupNoise.greaterThan(1.5))),()=>{O.w.assign(De(2).add(qt(a.groupNoise.greaterThan(1.5),C_(O.xyz,a),pse(O.xyz,a.groupScale,a.groupSeed,a.groupNoise))))});let z=br(bh(r.uvw(O.xyz).mul(De(m)))),H=g.load(Ls(z,br(0),br(m-1))).level(0).w;Nc(n.atomics.element(vt(c).add(vt(Ls(H.mul(65535),0,65535)))),vt(1))}).ElseIf(X.lessThan(.5).or(X.greaterThan(3.5).and(X.lessThan(4.5))),()=>{O.w.assign(2)})})().compute(s,[64]),this.nodes.reset=Go(()=>{let I=n.meta.element(l),O=n.vel.element(l),L=n.pos.element(l),X=n.rest.element(l);Nt(I.x.lessThan(2.5).or(I.x.greaterThan(3.5)),()=>{I.x.assign(Ho),O.assign(xi(0)),L.assign(xi(X.xyz,0)),n.heal.element(l).assign(xi(0))})})().compute(s,[64])}buildMeshes(){let{variants:e,rand:t}=this.o,r=this.total,i=this.u,s=this.buffers,a=le.powder.sprites,n=!!a.enabled,o=n?Array.from({length:e},()=>new Kv(2,2)):One(e,t,le.powder.facetedGrains),l=n?Kde():null,u=n?Jde(Nde.map(b=>new fe(b[0],b[1]))):null,h=ef(s.pos.value,\\\"vec4\\\",r).toReadOnly(),d=ef(s.vel.value,\\\"vec4\\\",r).toReadOnly(),c=ef(s.meta.value,\\\"vec4\\\",r).toReadOnly(),m=ef(s.rest.value,\\\"vec4\\\",r).toReadOnly(),g=ef(s.heal.value,\\\"vec4\\\",r).toReadOnly(),y=u2(this.densityTex);for(let b=0;b\\u003ce;b++){let v=new iU().copy(o[b]);v.instanceCount=Math.max(0,Math.ceil((r-b)/e));let S=new mS;S.metalness=0,S.side=hs,S.forceSinglePass=!0;let T=Tx.mul(vt(e)).add(vt(b)),w=h.element(T),N=d.element(T),C=c.element(T),R=C.y,E=C.z,P=C.x,I=N.w,O=Fs(vr(ea(R,11),ea(R,12),ea(R,13)).sub(.5)),L=ea(R,14).mul(6.2831).add(I.mul(i.tumble).mul(De(.4).add(ea(R,15)))),X=Bi(w.xyz.sub(qde)),z=P.greaterThan(.5).and(P.lessThan(3.5)).or(P.greaterThan(4.5)),H=qt(z.and(w.w.greaterThan(1e-5)),Xt(w.w,X.mul(i.pixelWorld).mul(i.minPixel)),De(0)).mul(i.fade),ue=w.xyz.add(i.densityExtent).div(i.densityExtent.mul(2)),ne=eu(y.sample(ue).level(0)),re=ti(De(1),ne.g,i.shadowStrength),ce=De(1).sub(ne.b.mul(i.aoStrength)),ge,ye=this.o.iceUniforms,oe=this.o.iceFeatures,Ae={...oe,surfaceBumps:De(1),frost:oe.frost.mul(oe.shardFrost),crystals:oe.crystals.mul(oe.shardNormals),grain:oe.grain.mul(oe.shardNormals),micro:oe.micro.mul(oe.shardNormals),ripples:oe.ripples.mul(oe.shardNormals)},Ie=G1(this.o.shape,m.element(T).xyz,.02),Xe=eu(xi(qt(Bi(Ie).greaterThan(.001),Ie,vr(0,0,1)),H)),at=Xe.xyz,W=eu(m.element(T).xyz.add(zde(\\\"position\\\",\\\"vec3\\\").mul(H))),j=vr(this.o.seed*.731,this.o.seed*.137,this.o.seed*.529),G=MF(W,at,j,wF(this.o.seed),this.o.erosion,ye,Ae),ae=G.frost,be=Hm===\\\"photographic\\\"?bF(this.o.fractureDetail,W,at,at.negate(),Xe.w,ye.inclusionScale,ye.inclusionAmount).mul(i.surfaceDetail):De(0),Be=Fs(Vde.negate()),$,U,J=De(0),q=De(1);if(n){let Ze=yh(bh(ea(R,31).mul(Ym*Ym))),ht=u.element(Ze),Yt=qt(ea(R,32).lessThan(.5),De(-1),De(1)),Tr=qt(ea(R,33).lessThan(.5),De(-1),De(1)),Gi=ea(R,34).mul(i.spriteTilt),na=ea(R,35).mul(6.2831),lu=vr(l2(na),tf(na),0),uu=vi=>Jy(Jy(vi,vr(0,0,1),L),lu,Gi),Ch=uu(vr(Yt,0,0)),Fc=uu(vr(0,0,1)),Lc=m.element(T),Rh=i.model.mul(xi(Lc.xyz,1)).xyz,kc=i.normalMat.mul(G1(this.o.shape,Lc.xyz,.004)),xf=kc.div(Xt(Bi(kc),1e-6)),Eh=Fs(Cc(Qde).mul(xf).add(vr(0,0,1e-4))),Ph=qt(Eh.z.lessThan(0),Eh.negate(),Eh),Dc=P.greaterThan(1.5).and(P.lessThan(2.5)),Oc=P.greaterThan(4.5),Uc=Bi(Rh.sub(w.xyz)),vf=g.element(T),bf=Xt(Bi(Rh.sub(vf.xyz)),.05),Y2=gi(De(1).sub(Uc.div(bf))),Wx=qt(Oc,De(1),qt(Dc,Th(Y2,i.alignCurve),De(0))).mul(i.alignAmt),Z2=Fs(Ch.sub(Ph.mul(xh(Ch,Ph))).add(vr(1e-4,0,0))),zc=Fs(ti(Fc,Ph,Wx)),jx=Fs(ti(Ch,Z2,Wx)),Tf=Fs(jx.sub(zc.mul(xh(jx,zc)))),Hx=rf(zc,Tf).mul(Yt.mul(Tr)),J2=Tf.mul(h2.x.mul(ht.x).mul(Yt)).add(Hx.mul(h2.y.mul(ht.y).mul(Tr))).mul(H).mul(i.spriteSize);S.positionNode=w.xyz.add(Cc(i.camWorld).mul(J2));let Xx=eu(Tf),$x=eu(Hx),hu=eu(zc),Bh=eu(xi(De(Ze),Yt,Tr,R)),Q2=Bh.x,K2=Bh.y,eM=Bh.z;ge=Bh.w;let Vc=Yde(),tM=ti(Vc.x,De(1).sub(Vc.x),WF(K2,0)),du=ti(Vc.y,De(1).sub(Vc.y),WF(eM,0)),Sf=yh(Q2.add(.5)),rM=De(Sf.mod(yh(Ym))),iM=De(Sf.div(yh(Ym))),qx=u.element(Sf),sM=UF(rM.add(.5).add(tM.sub(.5).mul(qx.x)),iM.add(.5).add(du.sub(.5).mul(qx.y))).div(Ym),_f=Zde(l,sM),Gc=_f.rg.mul(2).sub(1).mul(i.spriteNormal),aM=VF(gi(De(1).sub(xh(Gc,Gc))));$=Fs(Xx.mul(Gc.x).add($x.mul(Gc.y)).add(hu.mul(aM)));let wf=G.nSurface.sub(at);if($=Fs($.add(Xx.mul(wf.x)).add($x.mul(wf.y)).add(hu.mul(wf.z))),S.normalNode=$,S.maskNode=_f.a.greaterThan(i.spriteCut),J=Ls(ae.mul(ye.frostDiffuse).add(G.smudge.mul(ye.smudgeWhite)).add(be.mul(.65)),0,.65),q=gi(_f.a.sub(.35).div(.65)),a.seeThrough>0){S.transparent=!0,S.depthWrite=!1;let vi=Th(gi(De(1).sub(gi(xh($,Be)))),i.fresnelPower),nM=ti(De(.42),De(.85),J).add(vi.mul(.45)).add(De(1).sub(q).mul(.18));S.opacityNode=ti(De(1),gi(nM),i.spriteSee.mul(oe.transmission).mul(oe.shardTransmission))}U=gi(xh($,i.lightDirView).add(i.wrap).div(De(1).add(i.wrap)))}else{ge=eu(R);let Ze=Jy(h2.mul(H),O,L);S.positionNode=w.xyz.add(Ze);let ht=Jy($de,O,L);S.normalNode=GF(ht),$=Fs(GF(ht)),U=gi(xh(Fs(ht),i.lightDir).add(i.wrap).div(De(1).add(i.wrap)))}n||(J=Ls(ae.mul(ye.frostDiffuse).add(G.smudge.mul(ye.smudgeWhite)).add(be.mul(.65)),0,.65));let se=Th(ye.ior.sub(1).div(ye.ior.add(1)),2),pe=se.add(De(1).sub(se).mul(Th(gi(De(1).sub(gi(xh($,Be)))),5))),Te=Hm===\\\"photographic\\\"?e2(this.o.fractureDetail,W,at,ye.inclusionScale).mul(Ae.frost):De(0),we=Ls(G.roughness.add(Te.mul(.22)),.015,.8);S.roughnessNode=we,S.iorNode=ye.ior,S.clearcoatNode=ye.clearcoat.mul(oe.clearcoat).mul(oe.shardReflections),S.clearcoatRoughnessNode=ye.clearcoatRough,S.specularIntensityNode=ye.specularIntensity.mul(oe.reflections).mul(oe.shardReflections);let ie=oe.reflections.mul(oe.shardReflections),V=oe.transmission.mul(oe.shardTransmission),Oe=Ze=>Fs(Cc(i.camWorld).mul(Ze)),tt=Ze=>$w(this.o.environment,ye.envStrength,Ze,we),Je=Be.negate(),ct=Ode(Je,$,De(1).div(Xt(ye.ior,1.001))),_e=Xt(Xe.w.mul(q).mul(ye.thicknessScale),.001),nt=vh(Ude(Xt(ye.attColor,vr(.001))).mul(_e.div(Xt(ye.attDist,.01))).mul(oe.absorption)),dt=Ls(_x.add(ct.xy.sub(Je.xy).mul(_e).mul(.08)),0,1),ft=z1(this.o.backdrop,dt).add(tt(Oe(ct)).mul(ye.backlight)).mul(nt),Fe=tt(Oe(Gde(Je,$))).mul(pe).mul(ie).mul(ye.specularIntensity),it=Xt(J,De(1).sub(V)),Rt=ye.keyColor.mul(G.surfCrack.mul(ye.crackBright).mul(.3).add(be.mul(ye.backlight).mul(.8))).mul(oe.scatter);S.colorNode=ye.baseColor,S.emissiveNode=ye.keyColor.mul(it.mul(ye.interiorScatter).mul(.3)).mul(oe.scatter),S.outputNode=Go(()=>{let Ze=Fe.add(ft.mul(De(1).sub(pe.mul(ie)))).mul(De(1).sub(it)).add(o2.rgb.mul(it)).add(Rt),ht=Xt(o2.a,.001),Yt=z1(this.o.backdrop,_x);return xi(Xt(Ze.sub(Yt.mul(De(1).sub(ht))),vr(0)).div(ht),o2.a)})();let Ft=new Mi(v,S);Ft.frustumCulled=!1,Ft.castShadow=!0,Ft.receiveShadow=!0,this.meshes.push(Ft),this.group.add(Ft),b===0&&(this.material=S)}}hazeNode(e,t,r){let i=this.u,s=u2(this.densityTex);return Go(()=>{let a=_x.mul(2).sub(1),n=UF(a.x,a.y.negate()),o=i.invProj.mul(xi(n.x,n.y,1,1)),l=o.xyz.div(o.w),u=Fs(l),h=Fs(Cc(i.camWorld).mul(u)),d=i.camPos,c=i.densityExtent,m=vr(1).div(h),g=c.negate().sub(d).mul(m),y=c.sub(d).mul(m),b=Xt(Xt(Wo(g.x,y.x),Wo(g.y,y.y)),Wo(g.z,y.z)),v=Wo(Wo(Xt(g.x,y.x),Xt(g.y,y.y)),Xt(g.z,y.z)),S=De(1).div(Xt(u.z.negate(),1e-4)),T=t.negate().mul(S),w=Wo(v,T),N=De(0).toVar();Nt(w.greaterThan(Xt(b,0)).and(i.hazeOn.greaterThan(.5)),()=>{let R=Xt(b,0),E=Xt(i.hazeSteps,4),P=w.sub(R).div(E),I=Po(vr(_x.mul(1234),i.time)).mul(P),O=R.add(I).toVar();Sx({start:yh(0),end:yh(E),type:\\\"int\\\",condition:\\\"\\u003c\\\"},()=>{let L=d.add(h.mul(O)).add(c).div(c.mul(2)),X=s.sample(L).level(0);N.addAssign(X.r.mul(X.g).mul(P)),O.addAssign(P)})});let C=i.tone.mul(i.keyColor).mul(i.keyIntensity).mul(N).mul(.35);return xi(C,0)})()}step(e,t,r,i,s,a){let n=le.powder,o=le.healing,l=this.u;l.fieldActive.value=a.fieldActive?1:0,l.hazeOn.value=a.powderActive?1:0,l.dt.value=Math.min(r,1/30),l.time.value=t;let u=this.o.objectGroup.matrixWorld;if(l.model.value.copy(u),l.previousModel.value.copy(this.prevModel),l.normalMat.value.getNormalMatrix(u),l.modelDelta.value.copy(u).multiply(this.inversePrevModel.copy(this.prevModel).invert()),this.prevModel.copy(u),l.strokeDir.value.copy(i.strokeDir),l.strokeSpeed.value=i.strokeSpeed,l.heal.value=pt.healing?1:0,l.fade.value=pt.fade,l.lightDir.value.copy(s.position).sub(s.target.position).normalize(),l.modelInv.value.copy(u).invert(),le.version!==this.settingsVersion){this.settingsVersion=le.version,l.ejectSpeed.value=n.ejectSpeed,l.ejectSpread.value=n.ejectSpread,l.ejectTurb.value=n.ejectTurbulence,l.backwardRatio.value=n.backwardRatio,l.clumpJitter.value=n.clumpSpeedJitter,l.drag.value=n.drag,l.gravity.value=n.gravity,l.turbulence.value=n.turbulence,l.turbScale.value=n.turbulenceScale,l.turbDecay.value=n.turbulenceDecay,l.cohesion.value=n.clumpCohesion,l.settleTime.value=n.settleTime,l.settledDrift.value=n.settledDrift,l.tumble.value=n.tumble,l.returnDuration.value=o.returnDuration,l.returnCurve.value=o.returnCurve,l.inherit.value=n.inheritRotation?1:0,l.inheritTime.value=n.inheritTime/1e3,l.straySpeed.value=n.straySpeed,l.dustScale.value=n.grainSizes.tinyDustSize,l.grainScale.value=n.grainSizes.smallGrainSize,l.clumpScale.value=n.grainSizes.mediumClumpSize,l.fragmentScale.value=n.grainSizes.largeFragmentSize,l.sizeJitter.value=n.grainSizes.sizeJitter,l.sizeMul.value=n.grainSizeMultiplier,l.amount.value=n.amount,l.minEject.value=n.minEjectSpeed,l.minPixel.value=n.minPixelSize,l.waveTime.value=o.waveTime,l.waveJitter.value=o.waveJitter,l.ghostDist.value=o.ghostReturnDistance,l.ghostFrac.value=o.ghostFlightFraction,l.waveReach.value=o.waveReach,l.depositRadius.value=o.depositRadius,l.returnMode.value=o.returnMode===\\\"spring\\\"?1:0,l.springK.value=o.returnSpring,l.springDamp.value=o.returnDamping,l.springRamp.value=o.returnRamp,l.landRadius.value=o.landRadius,l.returnAfter.value=o.returnAfter,l.maxSpeed.value=n.maxSpeed,l.returnDrag.value=o.returnDrag,l.returnMaxSpeed.value=o.returnMaxSpeed,l.lostRadius.value=n.lostRadius,l.stragglers.value=o.cellStragglers,l.spriteSee.value=n.sprites.seeThrough,l.alignAmt.value=o.alignToSurface,l.alignDist.value=o.alignDistance,l.alignCurve.value=o.alignCurve??1,l.landedFade.value=o.landedFade,l.landShrink.value=o.landShrink,l.densityExtent.value=n.densityExtent,l.shadowStrength.value=n.densityShadowStrength,l.aoStrength.value=n.densityAOStrength,l.densityScale.value=.02*(this.o.densityRes/64)**3*(1e6/this.total)**.5,l.tone.value.set(n.baseTone),l.wrap.value=n.wrap,l.keyIntensity.value=le.lighting.key.intensity,l.keyColor.value.set(le.lighting.key.color);let h=n.fragments;l.translucency.value=h.translucency,l.throughTint.value.set(h.throughTint),l.fresnelPower.value=h.fresnelPower,l.fragRough.value=h.roughness,l.fragClearcoat.value=h.clearcoat,l.fragSpecular.value=h.specular,l.sparkle.value=h.sparkle,l.sparkleFraction.value=h.sparkleFraction,l.sparkleSpread.value=h.sparkleSpread;let d=n.sprites;l.spriteSize.value=d.sizeScale,l.spriteTilt.value=Bt.degToRad(d.tilt),l.spriteNormal.value=d.normalStrength,l.spriteFrost.value=d.frostFromAtlas,l.spriteFrostBoost.value=d.frostBoost,l.spriteFrostRough.value=d.frostRoughness,l.spriteEdge.value=d.edgeLight,l.spriteCut.value=d.alphaCut;let c=le.ice.features;if(l.surfaceFrost.value=Number(c.shardFrost&&c.frost),l.surfaceDetail.value=Number(c.shardFrost&&c.scatter),c.shardNormals||(l.spriteNormal.value=0),c.shardFrost||(l.spriteFrost.value=0,l.spriteFrostBoost.value=0),c.shardTransmission||(l.translucency.value=0,l.spriteSee.value=0),c.shardReflections||(l.fragSpecular.value=0,l.fragClearcoat.value=0),c.shardSparkle||(l.sparkle.value=0),c.shardEdges||(l.spriteEdge.value=0),l.repel.value=n.repelFromObject?1:0,l.repelStrength.value=n.repelStrength,l.repelRange.value=n.repelRange,l.repelRadial.value=n.repelRadial,l.repelRadialRange.value=n.repelRadialRange,l.colorByState.value=le.debug.colorByState?1:0,l.colorBySize.value=le.debug.colorBySize?1:0,l.colorByAge.value=le.debug.colorByAge?1:0,l.hazeSteps.value=n.hazeSteps,n.fragmentShadowMap!==this.fragmentShadowMap){this.fragmentShadowMap=n.fragmentShadowMap;for(let m of this.meshes)m.castShadow=n.fragmentShadowMap}}if(this.beforeIntegrate?.(),!(r\\u003c=0)&&(e.compute(this.nodes.resetCounters),a.powderActive||a.fieldActive||!this.nodes.updateStrays?(e.compute(this.nodes.snapshotLeaders),e.compute(this.nodes.update),e.compute(this.nodes.resolve),e.compute(this.nodes.clearDensity),this.densityDirty=!0):(e.compute(this.nodes.updateStrays),this.densityDirty&&(e.compute(this.nodes.resolve),e.compute(this.nodes.clearDensity),this.densityDirty=!1)),this.beforeAssembly?.(),this.assemblyEnabled&&this.o.erosion.u.reconstruct.value>.5&&a.fieldActive&&this.assembly?.update(e),this.statsTimer+=r,this.statsTimer>.5&&(le.debug.stats||le.performance.idleSkip))){this.statsTimer=0;let h=this.o.countersOffset;e.getArrayBufferAsync(this.buffers.atomics.value,null,h*4,64).then(d=>{let c=new Uint32Array(d),m=0;for(let g=0;g\\u003cthis.o.variants;g++)m+=c[g];pt.counts.total=this.total,pt.counts.active=Math.max(0,m-this.o.strays),pt.counts.dormant=Math.max(0,this.total-m)}).catch(()=>{})}}updateCamera(e,t){this.u.pixelWorld.value=2*Math.tan(Bt.degToRad(e.fov/2))/Math.max(1,t),this.u.lightDirView.value.copy(this.u.lightDir.value).transformDirection(e.matrixWorldInverse),this.u.camPos.value.copy(e.position),this.u.invProj.value.copy(e.projectionMatrixInverse),this.u.camWorld.value.copy(e.matrixWorld)}reset(e){e.compute(this.nodes.reset)}syncModel(){this.prevModel.copy(this.o.objectGroup.matrixWorld)}retarget(e,t){let r=this.buffers.rest.value;r.array.set(t),this.upload(e,r),this.u.groupNoise.value=Number(le.healing.returnNoiseAmount??2),this.u.frontDuration.value=Number(le.healing.assemblyFrontDuration??Bs.assemblyFrontDuration),this.u.frontX.value=Number(le.healing.assemblyOriginX??Bs.assemblyOriginX),this.u.frontY.value=Number(le.healing.assemblyOriginY??Bs.assemblyOriginY),this.u.frontAngle.value=Number(le.healing.assemblyAngle??Bs.assemblyAngle),this.u.frontSpread.value=Number(le.healing.assemblySpread??Bs.assemblySpread),this.u.frontNoise.value=Number(le.healing.assemblyFrontNoise??Bs.assemblyFrontNoise),this.u.speedVariation.value=Number(le.healing.assemblySpeedVariation??Bs.assemblySpeedVariation),this.u.pathBend.value=Number(le.healing.assemblyBend??Bs.assemblyBend),this.u.pathSwirl.value=Number(le.healing.assemblySwirl??Bs.assemblySwirl),this.u.landingVariation.value=Number(le.healing.assemblyLandingVariation??Bs.assemblyLandingVariation),this.u.groupStagger.value=le.healing.returnGroupStagger??Bs.returnGroupStagger,this.u.groupScale.value=le.healing.returnGroupScale??Bs.returnGroupScale,this.u.groupSeed.value=le.healing.returnGroupSeed??Bs.returnGroupSeed,e.compute(this.nodes.retargetCount),this.o.erosion.u.reconstruct.value>.5&&this.assembly?.prepare(e)}prepareAssembly(e){this.assembly?.prepare(e)}restoreThresholds(e){let t=this.buffers.rest.value,r=t.array;for(let i=3;i\\u003cr.length;i+=4)r[i]=this.restInit[i];this.upload(e,t)}upload(e,t){t.needsUpdate=!0;let r=e.backend,i=r?.get?.(t);i?.buffer&&r.device&&r.device.queue.writeBuffer(i.buffer,0,t.array.buffer,t.array.byteOffset,t.array.byteLength)}dispose(){this.o.scene.remove(this.group);for(let e of this.meshes)e.geometry.dispose(),e.material.dispose();this.densityTex.dispose(),this.assembly?.dispose();for(let e of Object.keys(this.buffers)){let t=this.buffers[e];t?.value?.dispose&&t.value.dispose?.()}}},wx=4,sce=typeof location\\u003c\\\"u\\\"&&new URLSearchParams(location.search).has(\\\"stroke\\\"),ace=typeof location\\u003c\\\"u\\\"?parseInt(new URLSearchParams(location.search).get(\\\"strokeFrames\\\")||\\\"1000000\\\",10):1e6,nce=typeof location\\u003c\\\"u\\\"?parseInt(new URLSearchParams(location.search).get(\\\"strokeStart\\\")||\\\"0\\\",10):0,XF=class{constructor(e,t,r,i,s,a){this.shape=e,this.objectGroup=t,this.camera=r,this.erosion=i,this.powder=s,this.onReset=a}strokeSegments=Array.from({length:Tc*2},()=>new Wt);strokeCount=0;strokeVel=new F;strokeDir=new F(1,.4,0).normalize();strokeSpeed=0;hitEntry=new F;hitExit=new F;hasHit=!1;prevEntry=new F;prevExit=new F;prevEntryWorld=new F;prevHit=!1;prevX=0;prevY=0;scripted=[];scrollP=-1;scrollPath={from:new F(-1,-.6,0),to:new F(1,.6,0)};ray=new ld;inv=new We;tmp=new F;objectRayOrigin=new F;objectRayDirection=new F;workA=new F;workB=new F;workDirection=new F;velocity=new F;rayHit={entry:new F,exit:new F,tEntry:0,tExit:0};resetDone=!0;sweep(e={}){let t=this.shape.bound,r=e.from??[-1,-.55,0],i=e.to??[1,.55,0];this.scripted.push({kind:\\\"sweep\\\",from:new F(r[0]*t,r[1]*t,r[2]*t),to:new F(i[0]*t,i[1]*t,i[2]*t),t0:-1,delay:e.delay??0,duration:e.duration??.7,radius:e.radius??le.erosion.brushRadius,strength:e.strength??le.erosion.brushStrength*1.5,through:e.through??!0,prevT:0})}front(e){let t=this.shape.bound,[r,i]=e.from,[s,a]=e.to,n=s-r,o=a-i,l=Math.hypot(n,o)||1,u=n/l*.5,h=o/l*.5;this.scripted.push({kind:\\\"front\\\",from:new F((r-u)*t,(i-h)*t,0),to:new F((s+u)*t,(a+h)*t,0),normal:new F(-o/l,n/l,0),reach:(e.reach??1.3)*t,t0:-1,delay:e.delay??0,duration:e.duration??1.5,radius:e.radius??le.erosion.brushRadius,strength:e.strength??le.erosion.brushStrength*1.5,through:!0,prevT:0})}clearScripted(){this.scripted.length=0}burst(e,t,r,i=.18){let s=new We().copy(this.objectGroup.matrixWorld).invert(),a=e.clone().applyMatrix4(s);this.scripted.push({from:a,to:a.clone(),t0:-1,delay:0,duration:i,radius:t,strength:r,through:!1,prevT:0});let n=new F().setFromMatrixPosition(this.objectGroup.matrixWorld),o=e.clone().sub(n);o.lengthSq()\\u003c1e-6&&o.set(0,1,0),this.strokeDir.copy(o.normalize()),this.strokeSpeed=le.erosion.brushSpeedRef*1.5}sweepTo(e){this.scrollP=Math.max(0,Math.min(1,e))}pushScripted(e,t){if(this.scripted.length===0)return!1;let r=!1;for(let i of this.scripted){if(i.t0\\u003c0&&(i.t0=e+i.delay),e\\u003ci.t0)continue;let s=Math.min(1,(e-i.t0)/Math.max(.01,i.duration)),a=this.shape.bound;if(i.kind===\\\"front\\\"){let u=y=>1-(1-y)*(1-y),h=i.reach*u(i.prevT),d=i.reach*u(s),c=Math.max(i.radius,(d-h)*1.5),m=this.shape.thickness,g=m\\u003c=c*.9?[0]:[-m,0,m];if(this.strokeCount+g.length*2>Tc)break;for(let y of[1,-1]){let b=this.workA.copy(i.from).addScaledVector(i.normal,y*d),v=this.workB.copy(i.to).addScaledVector(i.normal,y*d);for(let S of g)this.strokeSegments[this.strokeCount*2].set(b.x,b.y,S,c),this.strokeSegments[this.strokeCount*2+1].set(v.x,v.y,S,i.strength),this.strokeCount++}this.strokeSpeed=Math.max(this.strokeSpeed,i.reach/i.duration*.6),i.prevT=s,r=!0;continue}let n=this.workA.copy(i.from).lerp(i.to,i.prevT),o=this.workB.copy(i.from).lerp(i.to,s),l=i.through?3:1;if(this.strokeCount+l>Tc)break;for(let u=0;u\\u003cl;u++){let h=i.through?-a+2*a*(u+.5)/l:0;this.strokeSegments[this.strokeCount*2].set(n.x,n.y,i.through?h-a/l:n.z,i.radius),this.strokeSegments[this.strokeCount*2+1].set(o.x,o.y,i.through?h+a/l:o.z,i.strength),this.strokeCount++}if(i.from.distanceToSquared(i.to)>1e-6){let u=this.workDirection.copy(i.to).sub(i.from).transformDirection(this.objectGroup.matrixWorld);this.strokeDir.copy(u.normalize()),this.strokeSpeed=Math.max(this.strokeSpeed,i.from.distanceTo(i.to)/i.duration*.6)}i.prevT=s,r=!0}return this.scripted=this.scripted.filter(i=>i.prevT\\u003c1),r}pushScroll(e){if(this.scrollP\\u003c0)return!1;let t=this.scrollP;if(this.prevScrollP\\u003c0)return this.prevScrollP=t,!1;let r=t-this.prevScrollP;if(Math.abs(r)\\u003c5e-4)return!1;let i=this.shape.bound,s=this.workA.copy(this.scrollPath.from).lerp(this.scrollPath.to,this.prevScrollP).multiplyScalar(i),a=this.workB.copy(this.scrollPath.from).lerp(this.scrollPath.to,t).multiplyScalar(i);if(r>0){for(let o=0;o\\u003c3&&this.strokeCount\\u003cTc;o++){let l=-i+2*i*(o+.5)/3;this.strokeSegments[this.strokeCount*2].set(s.x,s.y,l-i/3,le.erosion.brushRadius),this.strokeSegments[this.strokeCount*2+1].set(a.x,a.y,l+i/3,le.erosion.brushStrength*2.5),this.strokeCount++}let n=this.workDirection.copy(a).sub(s).transformDirection(this.objectGroup.matrixWorld);n.lengthSq()>1e-8&&this.strokeDir.copy(n.normalize()),this.strokeSpeed=Math.max(this.strokeSpeed,Math.min(6,Math.abs(r)*2*i/Math.max(e,1/120)))}return this.prevScrollP=t,r>0}prevScrollP=-1;update(e,t){this.strokeCount=0;let r=le.erosion;if(pt.resetRequestedAt>=0){let n=(e-pt.resetRequestedAt)/Math.max(.05,le.healing.resetFade/1e3);pt.fade=Math.max(0,1-n),n>=1&&(this.erosion&&this.erosion.clear(this.erosion.renderer),this.powder&&this.erosion&&this.powder.reset(this.erosion.renderer),this.onReset?.(),pt.resetRequestedAt=-1,pt.lastStrokeT=-1e9,pt.fade=1)}else pt.fade=Oo(pt.fade,1,.15,t);let i=Ui.x!==this.prevX||Ui.y!==this.prevY,s=null;if(Ui.inside){this.tmp.set(Ui.x,Ui.y,.5).unproject(this.camera),this.ray.origin.copy(this.camera.position),this.ray.direction.copy(this.tmp).sub(this.camera.position).normalize(),this.inv.copy(this.objectGroup.matrixWorld).invert();let n=this.objectRayOrigin.copy(this.ray.origin).applyMatrix4(this.inv),o=this.objectRayDirection.copy(this.ray.direction).transformDirection(this.inv);s=kne(this.shape,n,o,60,this.rayHit)}pt.overObject=!!s,this.hasHit=!!s,s&&(this.hitEntry.copy(s.entry).applyMatrix4(this.objectGroup.matrixWorld),this.hitExit.copy(s.exit).applyMatrix4(this.objectGroup.matrixWorld));let a=!1;if(t>0&&this.pushScripted(e,t)&&(a=!0),t>0&&this.pushScroll(t)&&(a=!0),(!Ht.enabled||Ht.cursorErodes)&&s&&this.prevHit&&i&&t>0&&this.strokeCount+wx\\u003c=Tc){let n=this.hitEntry,o=this.velocity.copy(n).sub(this.prevEntryWorld).divideScalar(t),l=o.length();if(l>.02){a=!0,this.strokeVel.lerp(o,.5),this.strokeSpeed=Oo(this.strokeSpeed,Math.min(l,r.brushSpeedRef*3),.08,t),this.strokeVel.lengthSq()>1e-6&&this.strokeDir.copy(this.strokeVel).normalize();let u=Bt.clamp(l/r.brushSpeedRef,.12,2.5),h=r.brushStrength*u,d=r.brushRadius*(.72+.28*Math.min(1,u));for(let c=0;c\\u003cwx;c++){let m=c/(wx-1)*r.throughDepth,g=this.strokeCount+c;this.strokeSegments[g*2].set(Bt.lerp(this.prevEntry.x,this.prevExit.x,m),Bt.lerp(this.prevEntry.y,this.prevExit.y,m),Bt.lerp(this.prevEntry.z,this.prevExit.z,m),d),this.strokeSegments[g*2+1].set(Bt.lerp(s.entry.x,s.exit.x,m),Bt.lerp(s.entry.y,s.exit.y,m),Bt.lerp(s.entry.z,s.exit.z,m),h)}this.strokeCount+=wx}}if((le.debug.forceStroke||sce&&ta.frame>=nce&&ta.frame\\u003cace)&&t>0){let n=e*.25%1,o=this.shape.bound*.9,l=-o+n*2*o,u=-o*.7+n*1.4*o,h=l+.15,d=u+.1;this.strokeSegments[0].set(l,u,-o,r.brushRadius),this.strokeSegments[1].set(h,d,o,r.brushStrength),this.strokeCount=1,this.strokeDir.set(1,.7,0).normalize(),this.strokeSpeed=r.brushSpeedRef,a=!0}a||(this.strokeSpeed=Oo(this.strokeSpeed,0,1.2,t)),pt.strokeActive=a,Ht.enabled&&Ht.healSuspended&&(pt.lastStrokeT=e),s&&(this.prevEntry.copy(s.entry),this.prevExit.copy(s.exit),this.prevEntryWorld.copy(this.hitEntry)),this.prevHit=!!s,this.prevX=Ui.x,this.prevY=Ui.y,this.resetDone}},{vec3:oce,vec4:$F,uniform:lce,uv:uce,texture3D:hce,float:oye}=Jr,dce=class{constructor(e,t,r){this.camera=e;let i=(a,n)=>{let o=new Pd,l=hce(a).sample(oce(uce(),this.uSlice)).level(0);o.colorNode=n===\\\"erosion\\\"?$F(l.r,l.r.mul(.6).add(l.g.mul(.8)),l.r.mul(.6),1):$F(l.r.mul(2),l.g,l.b,1),o.depthTest=!1,o.depthWrite=!1,o.transparent=!1;let u=new Mi(new Kv(1,1),o);return u.renderOrder=1e3,u.frustumCulled=!1,u};this.erosionQuad=i(t.tex,\\\"erosion\\\"),this.densityQuad=i(r.densityTex,\\\"density\\\");let s=new eb(.03,12,8);this.hitEntry=new Mi(s,new Pd({color:\\\"#ff4040\\\"})),this.hitExit=new Mi(s,new Pd({color:\\\"#40a0ff\\\"})),this.group.add(this.hitEntry,this.hitExit),e.add(this.erosionQuad,this.densityQuad)}group=new pn;erosionQuad;densityQuad;hitEntry;hitExit;uSlice=lce(.5);update(e){let t=le.debug;this.uSlice.value=t.erosionSliceZ;let r=this.camera,i=3,s=2*i*Math.tan(Bt.degToRad(r.fov/2)),a=s*r.aspect,n=s*.28;this.erosionQuad.visible=t.showErosionSlice,this.erosionQuad.scale.set(n,n,1),this.erosionQuad.position.set(-a/2+n*.6,-s/2+n*.6,-i),this.densityQuad.visible=t.showDensityGrid,this.densityQuad.scale.set(n,n,1),this.densityQuad.position.set(-a/2+n*(t.showErosionSlice?1.75:.6),-s/2+n*.6,-i);let o=t.showHitPoints&&e.hasHit;this.hitEntry.visible=o,this.hitExit.visible=o,o&&(this.hitEntry.position.copy(e.hitEntry),this.hitExit.position.copy(e.hitExit))}dispose(){this.camera.remove(this.erosionQuad,this.densityQuad),this.erosionQuad.geometry.dispose(),this.densityQuad.geometry.dispose(),this.erosionQuad.material.dispose(),this.densityQuad.material.dispose()}},cce=class{ratio=0;frameMs=0;frames=0;lastAdjust=0;update(e,t,r,i,s,a,n){let o=Math.max(.5,Math.min(r||1,i)),l=Math.min(o,Math.max(.5,n));(!this.ratio||!s)&&(this.ratio=o),this.ratio=Math.min(o,Math.max(l,this.ratio));let u=Math.min(50,Math.max(1,t));if(this.frameMs=this.frames===0?u:this.frameMs+(u-this.frameMs)*.08,this.frames++,!s||this.frames\\u003c45||e-this.lastAdjust\\u003c.5)return this.ratio;let h=1e3/Math.max(30,a),d=this.ratio;if(this.frameMs>h*1.08&&this.ratio>l){let c=this.ratio*Math.sqrt(h/this.frameMs)*.98;d=Math.min(this.ratio-.05,c),d=Math.floor(d*20)/20}else this.frameMs\\u003ch*.82&&this.ratio\\u003co&&(d=Math.ceil((this.ratio+.05)*20)/20);return d=Math.min(o,Math.max(l,d)),d!==this.ratio&&(this.ratio=d,this.frameMs=h,this.lastAdjust=e),this.ratio}updateScene(e,t,r,i,s,a,n,o,l,u){let h=Math.max(.5,Math.min(r||1,i)),d=Math.max(.25,Math.min(1,o)),c=Math.max(.5,h*d),m=h*Math.max(.25,Math.min(d,l)),g=Math.min(c,Math.max(.5,n,m)),y=this.update(e,t,c,c,s,a,g);return{sourceRatio:y,outputRatio:u?h:y,sceneScale:u?y/h:1}}},pce=()=>({logoId:mce,shape:Ht.enabled&&Ht.shape?Ht.shape:le.shape.shape,seed:le.shape.seed,particleCount:le.powder.particleCount,resolution:le.erosion.resolution,densityGrid:le.powder.densityGrid,size:le.shape.size,tubeRatio:le.shape.tubeRatio,segments:le.shape.segments,variants:le.powder.grainVariants,faceted:le.powder.facetedGrains,sprites:le.powder.sprites.enabled,spriteBlend:le.powder.sprites.seeThrough>0,strays:le.powder.strayCount,clumps:le.powder.clumpCount,dispersion:!0,voronoiCells:le.performance.voronoiCells,turbulence:le.performance.turbulence}),mce=0,Xo=new Set(typeof location\\u003c\\\"u\\\"?[...new URLSearchParams(location.search).keys()]:[]),qF=65536,fce={\\\"100k\\\":1e5,\\\"250k\\\":25e4,\\\"500k\\\":5e5,\\\"1M\\\":1e6,\\\"2M\\\":2e6},gce=class{constructor(e,t,r,i,s,a){this.renderer=e,this.scene=t,this.camera=r,this.blueNoise=i,this.logo=s,this.fractureDetail=a,this.motionGroup.add(this.objectGroup),t.add(this.motionGroup,this.lights.group,r),t.backgroundNode=this.backdrop.node,t.environment=this.env.texture,this.build(),this.post=Nhe({scene:t,camera:r,renderer:e,blueNoise:i,haze:(n,o)=>this.powder.hazeNode(n,o,r),initial:le.post,initialPerformance:le.performance,initialHaze:le.powder.hazeIntensity!==0})}motionGroup=new pn;objectGroup=new pn;backdrop=Ane();env=Cne();lights=new Rne;rig=new K5;post;shape;mesh;meshEntry;glassMatcap;materialPlanes;ice;erosion;powder;interaction;debugViews;pixelRatio=0;frozenByDial=!1;statsTimer=0;buildCount=0;timersPending=!1;fieldMaybeNonZero=!0;lastActivityT=0;idleState(e){let t=this.interaction.strokeCount>0;t&&(this.fieldMaybeNonZero=!0,this.lastActivityT=e);let r=this.erosion.stats;this.fieldMaybeNonZero&&this.erosion.statsReadT>pt.lastStrokeT+.6&&r.max\\u003c.002&&r.refrost\\u003c.002&&(this.fieldMaybeNonZero=!1);let i=pt.healing&&this.fieldMaybeNonZero,s=this.fieldMaybeNonZero&&r.refrost>.002,a=!le.performance.idleSkip||t||e\\u003cthis.erosion.crumbleUntil||i||s,n=!le.performance.idleSkip||a||pt.counts.active>0||e-this.lastActivityT\\u003c1.5||pt.resetRequestedAt>=0;return pt.fieldActive=a,pt.powderActive=n,{fieldActive:a,powderActive:n}}envSig=\\\"\\\";backdropSig=\\\"\\\";frameTimes=new Float64Array(30);frameTimeSum=0;frameTimeCount=0;frameTimeIndex=0;lastFrameStart=0;gpuPending=!1;gpuTimerLast=-1/0;renderSize=new fe;adaptiveResolution=new cce;offscreenRT=Xo.has(\\\"offscreen\\\")?new er(16,16,{depthBuffer:!1,type:Si,format:pi}):null;build(){this.buildCount++;let e=pce(),t=Lm(e.seed+1),r=Ht.enabled&&Ht.shape?Ht.shape:le.shape.shape,i=r===\\\"logo\\\"&&!this.logo?\\\"torus\\\":r;this.shape=cw(i,e.size,e.tubeRatio,this.logo?.sdf);let s=Dne(this.shape,e.segments,this.logo?.geometry),a=parseInt(e.densityGrid,10),n=parseInt(e.resolution,10),o=a*a*a,l=o+16,u=l+n*n*n,h=u+qF,d=Jr.instancedArray(h+qF,\\\"uint\\\").toAtomic();if(this.erosion=new hx(this.renderer,this.shape,n,e.seed,d,l,u,h),qa.materials&&(this.materialPlanes=new mne(this.renderer,this.shape.bound,e.seed),this.erosion.materialPlanes=this.materialPlanes),this.erosion.skipBake=Xo.has(\\\"nobake\\\"),qa.mesh&&(this.meshEntry=vne(s,this.camera)),qa.matcap&&(this.env.update(le.lighting),this.glassMatcap=bne(this.env.texture)),this.ice=_de({meshEntry:this.meshEntry,glassMatcap:this.glassMatcap,shape:this.shape,erosion:this.erosion,seed:e.seed,blueNoise:this.blueNoise,environment:this.env.texture,fractureDetail:this.fractureDetail,backdrop:this.backdrop.uniforms,dispersion:e.dispersion,voronoiCells:e.voronoiCells}),Xo.has(\\\"noice\\\")){let c=new pS;c.roughness=.3,c.color.set(\\\"#bbbbbb\\\"),this.ice.material=c}this.meshEntry&&(this.meshEntry.material.positionNode=this.ice.material.positionNode),this.mesh=new Mi(s,this.ice.material),this.mesh.castShadow=!0,this.mesh.receiveShadow=!0,this.mesh.frustumCulled=!1,this.objectGroup.add(this.mesh),this.powder=new ice({enabled:!Xo.has(\\\"nopowder\\\"),renderer:this.renderer,scene:this.scene,shape:this.shape,erosion:this.erosion,seed:e.seed,rand:t,count:fce[e.particleCount]??1e6,variants:e.variants,strays:e.strays,densityRes:a,clumpCount:e.clumps,objectGroup:this.objectGroup,turbulence:e.turbulence,atomics:d,countersOffset:o,healOffset:l,cellOffset:u,flightOffset:h,fieldRes:n,backdrop:this.backdrop.uniforms,fractureDetail:this.fractureDetail,iceUniforms:this.ice.uniforms,iceFeatures:this.ice.features,environment:this.env.texture}),this.interaction=new XF(this.shape,this.objectGroup,this.camera,this.erosion,this.powder),this.debugViews=new dce(this.camera,this.erosion,this.powder),this.scene.add(this.debugViews.group)}disposeBuilt(){this.materialPlanes?.dispose(),this.materialPlanes=void 0,this.meshEntry?.dispose(),this.meshEntry=void 0,this.glassMatcap?.dispose(),this.glassMatcap=void 0,this.debugViews.dispose(),this.scene.remove(this.debugViews.group),this.objectGroup.remove(this.mesh),this.mesh.geometry.dispose(),this.ice.material.dispose(),this.erosion.dispose(),this.powder.dispose()}rebuild(){this.disposeBuilt(),this.build(),this.post.post.needsUpdate=!0}updateEnvironment(){let e=le.lighting,t=JSON.stringify([e.envSoftbox,e.envRim,e.envFill,e.key,e.fill,e.fillColor,e.fillGroundColor,e.fillReflectionStrength,e.rimColor,e.rimElevation,e.rimAzimuth,e.rimSize,e.accentCool,e.accentWarm]);t!==this.envSig&&(this.envSig=t,this.env.update(e)),this.scene.environmentIntensity=le.ice.envIntensity}updateBackdrop(e){let t=le.lighting.backdrop,r=Ht.enabled?Ht.backdrop:null,i=this.backdrop.uniforms,s=r?.top??t.top,a=r?.mid??t.mid,n=r?.bottom??t.bottom,o=r?.centerX??t.centerX,l=r?.centerY??t.centerY,u=r?.radius??t.radius,h=r?.falloff??t.falloff,d=`${s}|${a}|${n}|${o}|${l}|${u}|${h}|${t.noise}`;d!==this.backdropSig&&(this.backdropSig=d,i.uTop.value.set(s),i.uMid.value.set(a),i.uBottom.value.set(n),i.uCenter.value.set(o,l),i.uRadius.value=u,i.uFalloff.value=h,i.uNoise.value=t.noise),i.uTime.value=e}onBeforeRender=null;onBeforeSimulation=null;onObjectTransform=null;onCameraTransform=null;frame(e,t,r=!0){ta.t=e,ta.dt=t,ta.frame++;let i=e*1e3,s=1e3/le.performance.targetFps,a=!Xo.has(\\\"nopost\\\")&&le.performance.nativePostEffects&&le.performance.upscaler!==\\\"native\\\",n=this.adaptiveResolution.updateScene(e,s,window.devicePixelRatio||1,le.post.pixelRatioCap,le.performance.adaptiveResolution&&le.performance.dynamicSceneResolution,le.performance.targetFps,le.performance.minPixelRatio,le.performance.sceneResolutionScale,le.performance.minSceneResolutionScale,a);if(pt.pixelRatio=n.sourceRatio,pt.outputPixelRatio=n.outputRatio,pt.sceneResolutionScale=n.sceneScale,n.outputRatio!==this.pixelRatio||this.renderer.getPixelRatio()!==n.outputRatio){this.pixelRatio=n.outputRatio,this.renderer.setPixelRatio(n.outputRatio);let h=this.renderer.getSize(this.renderSize);this.renderer.setSize(h.x,h.y,!1)}this.onCameraTransform||this.rig.update(this.camera,this.objectGroup,e,t),Ht.enabled&&Ht.framing?this.motionGroup.position.set(Ht.objectX,Ht.objectY,Ht.objectZ):this.motionGroup.position.set(le.shape.offsetX,le.shape.offsetY,le.shape.offsetZ),this.objectGroup.position.set(0,0,0),this.onObjectTransform&&this.onObjectTransform(e),this.motionGroup.updateMatrixWorld(!0),this.onCameraTransform?.(e),this.updateEnvironment(),this.updateBackdrop(e),pt.hoverAmount=Oo(pt.hoverAmount,pt.overObject?1:0,.4/3,t),this.lights.update(e,pt.hoverAmount),this.interaction.update(e,t),this.onBeforeSimulation?.(e,t),this.debugViews.update(this.interaction),Xo.has(\\\"noice\\\")||(this.ice.update(e,t,this.lights.key,this.objectGroup),this.ice.uniforms.hover.value=pt.hoverAmount);let o=performance.now(),l=this.idleState(e);if(t>0&&(Xo.has(\\\"noerosion\\\")||this.erosion.step(this.renderer,e,t,this.interaction.strokeSegments,this.interaction.strokeCount,l.fieldActive)),Xo.has(\\\"nopowder\\\")||this.powder.step(this.renderer,e,t,this.interaction,this.lights.key,l),pt.computeMs=performance.now()-o,le.debug.stats||le.performance.idleSkip){this.statsTimer+=Math.max(t,1/120);let h=this.fieldMaybeNonZero?.25:.4;(this.statsTimer>h||this.offscreenRT)&&(this.statsTimer=0,this.erosion.readStats(this.renderer,e),pt.erosion=this.erosion.stats)}this.camera.updateMatrixWorld(),this.onBeforeRender&&this.onBeforeRender(e),this.powder.updateCamera(this.camera,this.renderer.getSize(this.renderSize).y*n.sourceRatio);let u=this.camera.position.distanceTo(this.rig.lookAt);if(this.post.update(le.post,le.performance,u,pt.sceneFade,le.powder.hazeIntensity,e,le.version),this.materialPlanes?.update(),this.post.setSceneResolution(n.sceneScale),this.meshEntry?.update(this.mesh,n.sceneScale),this.mesh.material.wireframe=le.debug.wireframe,this.offscreenRT){let h=this.renderer.getSize(this.renderSize),d=this.renderer.getPixelRatio(),c=Math.max(1,Math.floor(h.x*d)),m=Math.max(1,Math.floor(h.y*d));(this.offscreenRT.width!==c||this.offscreenRT.height!==m)&&this.offscreenRT.setSize(c,m),this.renderer.setRenderTarget(this.offscreenRT)}if(this.post.setHazeResolution(le.performance.hazeResolution===\\\"quarter\\\"?.25:le.performance.hazeResolution===\\\"half\\\"?.5:1),r&&(this.renderer._nodes.nodeFrame.update(),this.post.setFrame(Math.round(e*60)),Xo.has(\\\"nopost\\\")?this.renderer.render(this.scene,this.camera):this.post.post.render()),this.offscreenRT&&this.renderer.setRenderTarget(null),le.performance.gpuTimers&&!this.timersPending&&e-this.gpuTimerLast>=.25){let h=this.renderer;h.backend?.trackTimestamp&&(this.timersPending=!0,this.gpuTimerLast=e,Promise.all([h.resolveTimestampsAsync(\\\"render\\\"),h.resolveTimestampsAsync(\\\"compute\\\")]).then(()=>{pt.gpuRenderMs=h.info.render.timestamp||0,pt.gpuComputeMs=h.info.compute.timestamp||0,this.timersPending=!1}).catch(()=>{this.timersPending=!1}))}if(this.offscreenRT&&!this.gpuPending){let h=this.renderer.backend?.device?.queue;h?.onSubmittedWorkDone&&(this.gpuPending=!0,h.onSubmittedWorkDone().then(()=>{pt.gpuFrames++,this.gpuPending=!1}).catch(()=>{this.gpuPending=!1}))}}resetSim(){this.erosion.clear(this.renderer),this.erosion.crumbleUntil=-1,this.erosion.u.crumbleUntil.value=-1,this.powder.reset(this.renderer),this.interaction=new XF(this.shape,this.objectGroup,this.camera,this.erosion,this.powder),this.rig=new K5,this.mesh.visible=!0,pt.strokeActive=!1,pt.overObject=!1,pt.lastStrokeT=-1e9,pt.healing=!1,pt.resetRequestedAt=-1,pt.fade=1,pt.sceneFade=1,pt.hoverAmount=0,pt.fieldActive=!0,pt.powderActive=!0,this.fieldMaybeNonZero=!0,this.lastActivityT=0,this.statsTimer=0,ta.t=0,ta.dt=1/60,ta.frame=0,ta.paused=!1}async dumpShader(){return this.renderer.debug.getShaderAsync(this.scene,this.camera,this.mesh)}async readback(){if(!this.offscreenRT)return null;let e=this.offscreenRT,t=e.width,r=e.height,i=await this.renderer.readRenderTargetPixelsAsync(e,0,0,t,r),s=i.length>=Math.ceil(t*4/256)*256*r?Math.ceil(t*4/256)*256:t*4,a=0,n=0,o=document.createElement(\\\"canvas\\\");o.width=t,o.height=r;let l=o.getContext(\\\"2d\\\"),u=l.createImageData(t,r);for(let h=0;h\\u003cr;h++)for(let d=0;d\\u003ct;d++){let c=h*s+d*4,m=(h*t+d)*4;u.data[m]=i[c],u.data[m+1]=i[c+1],u.data[m+2]=i[c+2],u.data[m+3]=255;let g=.2126*i[c]+.7152*i[c+1]+.0722*i[c+2];a+=g,g>n&&(n=g)}return l.putImageData(u,0,0),{mean:a/(t*r),max:n,png:o.toDataURL(\\\"image/png\\\"),w:t,h:r}}dispose(){this.disposeBuilt(),this.post.dispose(),this.scene.remove(this.motionGroup,this.lights.group),this.scene.backgroundNode=null,this.scene.environment=null,this.env.texture.dispose(),this.fractureDetail?.dispose()}},Mx={ice:{ior:1.445,dispersion:.155,thicknessScale:2.41,attenuationDistance:4.47,attenuationColor:\\\"#524c4c\\\",baseRoughness:.5,frost:{scale:.2,threshold:1,softness:.36,roughness:0,diffuse:.56,crystalBump:.37,crystalScale:67},cracks:{largeScale:8,warp:0,warpScale:2.2,coverage:.01,regionScale:1.35,regionCoverage:0,veinScale:20,veinContrast:.57,width:.0175,brightness:.25,darkness:1,refraction:.008,surfaceStrength:0,steps:21,fineCracks:!0,fineScale:10.4,fineAmount:0,fineCoverage:.45,fineNearLarge:1},smudges:{amount:0,coverage:.29,maskScale:3.1,anisotropy:5.5,roughness:.02,whiteness:.035,scale:.5},bumps:{microBump:.32,microScale:121,microCoverage:.76,rippleBump:.45,rippleScale:2.5,maskScale:3.6},crumbleGlow:.16,edgeWhiteness:.09,clearcoat:0,clearcoatRoughness:.085,envIntensity:.28,specularIntensity:.65,interiorScatter:.05},performance:{adaptiveResolution:!0,targetFps:60,minPixelRatio:.75,sceneResolutionScale:1,dynamicSceneResolution:!0,minSceneResolutionScale:.35,upscaler:\\\"taau\\\",upscaleSharpness:.2,nativePostEffects:!0,idleSkip:!0,adaptiveSteps:!0,voronoiCells:\\\"27\\\",hazeResolution:\\\"quarter\\\",turbulence:\\\"fast\\\",gpuTimers:!0},lighting:{key:{color:\\\"#ffffff\\\",intensity:12,elevation:62,azimuth:-10.5,size:3,hoverBoost:.3},fill:1.5,fillColor:\\\"#ffffff\\\",fillGroundColor:\\\"#07a4a6\\\",rim:5,rimColor:\\\"#0b82ea\\\",rimElevation:9.5,shadow:{intensity:0,softness:6,samples:1,mapSize:\\\"1024\\\",bias:-6e-4},sway:{amplitude:.118,period:35},backdrop:{top:\\\"#212121\\\",mid:\\\"#171717\\\",bottom:\\\"#030303\\\",centerX:.19,centerY:1.5,radius:.78,falloff:4,noise:0},envSoftbox:1.22,envRim:2.43,envFill:1,rimAzimuth:-180,rimAngle:81,rimSize:2.05,fillReflectionStrength:2,accentCool:{intensity:4,reflection:3,elevation:25,azimuth:-65,size:2.85,color:\\\"#c7ddff\\\"},accentWarm:{intensity:3.64,reflection:3,elevation:34,azimuth:127,size:3,color:\\\"#ff0000\\\"}},post:{dof:{enabled:!1,focusBias:-.43,aperture:4,range:12},bloom:{threshold:.28,intensity:0,radius:.11},monochrome:0,tonemap:\\\"aces\\\",exposure:1.3,contrast:1.15,blackLift:0,vignette:{strength:.325,softness:1.175,radius:1.11},grain:{strength:0,size:1,speed:0,shadowWeight:.28,backgroundStrength:.035,backgroundSize:2,backgroundSpeed:0},dither:!0,aaMode:\\\"traa\\\",pixelRatioCap:2}},yce=()=>({version:1,name:\\\"Untitled shot\\\",orientation:\\\"target\\\",anchorSpace:\\\"local\\\",objectMotion:\\\"existing\\\",keys:[]});function c2(e){if(e==null||e===\\\"\\\")return yce();let t=typeof e==\\\"string\\\"?JSON.parse(e):e;if(t?.version!==1||!Array.isArray(t.keys)||t.keys.length>64)throw Error(\\\"Camera track must be version 1 with at most 64 keys.\\\");let r=(o,l,u)=>{if(!l.includes(o))throw Error(\\\"Invalid \\\"+u);return o},i=(o,l,u,h)=>{if(typeof o!=\\\"number\\\"||!Number.isFinite(o)||o\\u003cl||o>u)throw Error(\\\"Invalid \\\"+h);return o},s=(o,l,u)=>{if(!Array.isArray(o)||o.length!==l)throw Error(\\\"Invalid \\\"+u);return o.map(h=>i(h,-1e4,1e4,u))},a={version:1,name:String(t.name||\\\"Untitled shot\\\").slice(0,100),orientation:r(t.orientation,[\\\"target\\\",\\\"free\\\"],\\\"orientation\\\"),anchorSpace:r(t.anchorSpace,[\\\"world\\\",\\\"local\\\"],\\\"anchor space\\\"),objectMotion:r(t.objectMotion,[\\\"existing\\\",\\\"stationary\\\"],\\\"object motion\\\"),keys:t.keys.map(o=>{let l=s(o.quaternion,4,\\\"quaternion\\\");if(Math.abs(Math.hypot(...l)-1)>.001)throw Error(\\\"Camera quaternion must be normalized.\\\");return{id:String(o.id).slice(0,100),time:i(o.time,0,120,\\\"key time\\\"),position:s(o.position,3,\\\"position\\\"),target:s(o.target,3,\\\"target\\\"),quaternion:l,fov:i(o.fov,5,120,\\\"FOV\\\"),zoom:i(o.zoom,.1,10,\\\"zoom\\\"),roll:i(o.roll,-720,720,\\\"roll\\\"),ease:r(o.ease,[\\\"flow\\\",\\\"linear\\\",\\\"ease-in-out\\\"],\\\"ease\\\")}}).sort((o,l)=>o.time-l.time)},n=new Set;for(let o=0;o\\u003ca.keys.length;o++){let l=a.keys[o];if(!l.id||n.has(l.id))throw Error(\\\"Camera key IDs must be unique.\\\");if(n.add(l.id),o&&l.time-a.keys[o-1].time\\u003c.004166666666666667)throw Error(\\\"Camera keys need distinct times (at least 1/240 second apart).\\\")}return a}function xce(){let e=new gs(29.5,1.7777777777777777,.5,80);return e.position.set(0,1.2,13.45),e.lookAt(0,.05,0),e.updateMatrixWorld(),e}function YF(e,t,r=new We){let i=e.keys;if(!i.length){let g=xce();return{position:g.position,quaternion:g.quaternion,target:new F(0,.05,0),fov:29.5,zoom:1,roll:0}}t=Math.max(i[0].time,Math.min(i.at(-1).time,t));let s=0;for(;s\\u003ci.length-2&&i[s+1].time\\u003ct;)s++;let a=i[s],n=i[Math.min(s+1,i.length-1)],o=n.time-a.time,l=o>0?(t-a.time)/o:0,u=a.ease===\\\"ease-in-out\\\"?l*l*(3-2*l):l,h=g=>{if(!o)return g(a);if(a.ease!==\\\"flow\\\")return Bt.lerp(g(a),g(n),u);let y=i[Math.max(0,s-1)],b=i[Math.min(i.length-1,s+2)],v=(g(n)-g(y))/Math.max(n.time-y.time,1e-6),S=(g(b)-g(a))/Math.max(b.time-a.time,1e-6);return(2*u**3-3*u*u+1)*g(a)+(u**3-2*u*u+u)*o*v+(-2*u**3+3*u*u)*g(n)+(u**3-u*u)*o*S},d=new F(...[0,1,2].map(g=>h(y=>y.position[g]))),c=new F(...[0,1,2].map(g=>h(y=>y.target[g])));e.anchorSpace===\\\"local\\\"&&c.applyMatrix4(r);let m=e.orientation===\\\"target\\\"?new si().setFromRotationMatrix(new We().lookAt(d,c,new F(0,1,0))):new si(...a.quaternion).slerp(new si(...n.quaternion),u);return m.multiply(new si().setFromAxisAngle(new F(0,0,1),Bt.degToRad(h(g=>g.roll)))),{position:d,quaternion:m,target:c,roll:h(g=>g.roll),fov:Bt.clamp(h(g=>g.fov),5,120),zoom:Bt.clamp(h(g=>g.zoom),.1,10)}}function vce(e,t,r,i,s){let a=YF(t,r,i);return e.position.copy(a.position),e.quaternion.copy(a.quaternion),e.fov=a.fov,e.zoom=a.zoom,e.updateProjectionMatrix(),e.updateMatrixWorld(!0),s.copy(a.target),a}var bce=e=>Math.max(0,Math.min(1,e));function p2(e,t){let r=l=>(l=bce(l),l*l*l*(l*(l*6-15)+10)),i=(l,u)=>l\\u003c=u?r(l/Math.max(u,1e-6)):1-r((l-u)/Math.max(1-u,1e-6)),s=[{t0:e.logoBreak-.65,tBreakEnd:e.form1,t1:e.form1+2.8,yaw:t.turnYaw,pitch:t.turnPitch,z:t.approach,keep:!1},{t0:e.break1-.65,tBreakEnd:e.form2,t1:e.form2+2.8,yaw:t.turnYaw2,pitch:t.turnPitch2,z:-t.retreat,keep:!1},{t0:e.break2-.65,tBreakEnd:e.fadeOut+1.5,t1:e.fadeOut+1.5,yaw:t.finalYaw,pitch:t.finalPitch,z:t.approach+t.zoomIn,keep:!0}];function a(l){let u=0,h=0,d=0;for(let c of s){let m=(l-c.t0)/Math.max(c.t1-c.t0,1e-6);if(m\\u003c=0)continue;u+=c.yaw*r(m);let g=(c.tBreakEnd-c.t0)/Math.max(c.t1-c.t0,1e-6),y=c.keep?r(m):i(m,g);h+=c.pitch*y,d+=c.z*y}return{yaw:u,pitch:h,z:d}}let n=l=>t.driftYaw*l,o=l=>t.idleYaw*Math.sin(2*Math.PI*l/9);return function(l){let u=a(l),h=t.driftSway*Math.sin(2*Math.PI*l/11);return{yaw:u.yaw+n(l)+o(l),pitch:u.pitch+h,z:u.z+.0875*t.driftSway*Math.sin(2*Math.PI*l/11)}}}var Tce=(e,t)=>e\\u003ct.form1?0:e\\u003ct.form2?1:2;function Sce(e,t,r,i=Tce(e,t),s=!1){let a=p2(t,r),n=a(e),o=d=>{let c=a(d);return new si().setFromEuler(new cn(c.pitch*Math.PI/180,c.yaw*Math.PI/180,0,\\\"YXZ\\\"))},l=s?new si:o(e),u=s||i===0?new si:o((i===1?t.form1:t.form2)+2.8).invert(),h=new F(0,.05,s?0:n.z);return{rotation:l,facing:u,position:h,matrix:new We().compose(h,l.clone().multiply(u),new F(1,1,1))}}var{lerp:Sh}=Bt,us=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180];for(let e=0;e\\u003c256;e++)us[256+e]=us[e];function m2(e){return e*e*e*(e*(e*6-15)+10)}function tu(e,t,r,i){let s=e&15,a=s\\u003c8?t:r,n=s\\u003c4?r:s==12||s==14?t:i;return((s&1)==0?a:-a)+((s&2)==0?n:-n)}var _ce=class{noise(e,t,r){let i=Math.floor(e),s=Math.floor(t),a=Math.floor(r),n=i&255,o=s&255,l=a&255;e-=i,t-=s,r-=a;let u=e-1,h=t-1,d=r-1,c=m2(e),m=m2(t),g=m2(r),y=us[n]+o,b=us[y]+l,v=us[y+1]+l,S=us[n+1]+o,T=us[S]+l,w=us[S+1]+l;return Sh(Sh(Sh(tu(us[b],e,t,r),tu(us[T],u,t,r),c),Sh(tu(us[v],e,h,r),tu(us[w],u,h,r),c),m),Sh(Sh(tu(us[b+1],e,t,d),tu(us[T+1],u,t,d),c),Sh(tu(us[v+1],e,h,d),tu(us[w+1],u,h,d),c),m),g)}},wce=Io.textMeshDetail;function f2(e){return typeof e==\\\"number\\\"&&Number.isFinite(e)?Math.max(1,Math.min(4,Math.round(e))):wce}function Mce(e,t){let r=f2(t);return{maxEdge:e/(2*r),extraTriangles:16e4*r}}function Nce(e,t,r,i){let s=[],a=new Map,n=[],o=r*r,l=t.length/3+i,u=t.length/3,h=(v,S)=>v\\u003cS?`${v}:${S}`:`${S}:${v}`,d=(v,S)=>v.length2>S.length2||v.length2===S.length2&&(v.a\\u003cS.a||v.a===S.a&&v.b\\u003cS.b);function c(v){let S=n.length;for(n.push(v);S>0;){let T=S-1>>1;if(!d(v,n[T]))break;n[S]=n[T],S=T}n[S]=v}function m(){let v=n[0],S=n.pop();if(n.length){let T=0;for(;T*2+1\\u003cn.length;){let w=T*2+1;if(w+1\\u003cn.length&&d(n[w+1],n[w])&&w++,!d(n[w],S))break;n[T]=n[w],T=w}n[T]=S}return v}function g(v,S,T){let w=s.length;s.push([v,S,T]);for(let[N,C]of[[v,S],[S,T],[T,v]]){let R=h(N,C),E=a.get(R);if(!E){let P=e[N*3]-e[C*3],I=e[N*3+1]-e[C*3+1],O=e[N*3+2]-e[C*3+2];E={a:Math.min(N,C),b:Math.max(N,C),length2:P*P+I*I+O*O,faces:new Set},a.set(R,E),E.length2>o&&c(E)}E.faces.add(w)}}function y(v){let S=s[v];s[v]=null;for(let T=0;T\\u003c3;T++){let w=h(S[T],S[(T+1)%3]),N=a.get(w);N.faces.delete(v),N.faces.size||a.delete(w)}}for(let v=0;v\\u003ct.length;v+=3)g(t[v],t[v+1],t[v+2]);for(;n.length&&u\\u003cl;){let v=m();if(a.get(h(v.a,v.b))!==v)continue;let S=[...v.faces];if(u+S.length>l)continue;let T=e.length/3;e.push((e[v.a*3]+e[v.b*3])/2,(e[v.a*3+1]+e[v.b*3+1])/2,(e[v.a*3+2]+e[v.b*3+2])/2);let w=S.map(N=>s[N]);for(let N of S)y(N);for(let N of w){let C=N.findIndex((I,O)=>h(I,N[(O+1)%3])===h(v.a,v.b)),R=N[C],E=N[(C+1)%3],P=N[(C+2)%3];g(R,T,P),g(T,E,P)}u+=S.length}let b=[];for(let v of s)v&&b.push(v[0],v[1],v[2]);return b}function Ace(e,t){let r=[];for(let u=0;u\\u003ct.length;u+=3){let[h,d,c]=t.slice(u,u+3);h!==d&&d!==c&&c!==h&&r.push(h,d,c)}let i=new Map;for(let u=0;u\\u003cr.length;u+=3)for(let[h,d]of[[r[u],r[u+1]],[r[u+1],r[u+2]],[r[u+2],r[u]]]){let c=h\\u003cd?`${h}:${d}`:`${d}:${h}`,m=i.get(c);m?m.count++:i.set(c,{a:h,b:d,count:1})}let s=new Set;for(let u of i.values())u.count===1&&(s.add(u.a),s.add(u.b));let a=1e-5,n=new Map,o=new Map;for(let u of[...s].sort((h,d)=>h-d)){let h=e[u*3],d=e[u*3+1],c=e[u*3+2],m=Math.floor(h/a),g=Math.floor(d/a),y=Math.floor(c/a),b=u;for(let v=-1;v\\u003c=1;v++)for(let S=-1;S\\u003c=1;S++)for(let T=-1;T\\u003c=1;T++)for(let w of n.get(`${m+v}:${g+S}:${y+T}`)||[])Math.hypot(h-e[w*3],d-e[w*3+1],c-e[w*3+2])\\u003c=a&&(b=Math.min(b,w));if(o.set(u,b),b===u){let v=`${m}:${g}:${y}`,S=n.get(v)||[];S.push(u),n.set(v,S)}}let l=[];for(let u=0;u\\u003cr.length;u+=3){let[h,d,c]=r.slice(u,u+3).map(m=>o.get(m)??m);h!==d&&d!==c&&c!==h&&l.push(h,d,c)}return l}var Cce=Io.logoMeshDetail;function g2(e){return typeof e==\\\"number\\\"&&Number.isFinite(e)?Math.max(1,Math.min(4,Math.round(e))):Cce}function Rce(e,t){e.computeBoundingBox();let r=e.boundingBox,i=Math.max(r.max.x-r.min.x,r.max.y-r.min.y,r.max.z-r.min.z,.001),s=g2(t);return{maxEdge:i/(32*s),extraTriangles:16e4*s}}var ZF=Object.freeze({strength:Io.deformStrength,scale:Io.deformScale,seed:Io.deformSeed});function JF(e){if(!Number.isFinite(e)||e\\u003c.001||e>.5)throw new RangeError(`Noise feature size ${e} is outside 0.001\\\\u20130.5. Edit this value to load the preset; other settings have not been changed.`);return e}function Nx(e){let t=(r,i,s)=>{let a=e?.[r];return typeof a==\\\"number\\\"&&Number.isFinite(a)?Math.max(i,Math.min(s,a)):ZF[r]};return{strength:t(\\\"strength\\\",0,.08),scale:JF(e?.scale??ZF.scale),seed:Math.round(t(\\\"seed\\\",0,65535))}}function Ece(e){let{strength:t,scale:r,seed:i}=Nx(e),s=new _ce,a=Lm(i),n=Array.from({length:3},()=>[a()*256,a()*256,a()*256]);function o(l,u,h){let d=n[h],c=l/r+d[0],m=u/r+d[1],g=d[2],y=0,b=1;for(let v=0;v\\u003c3;v++)y+=b*s.noise(c,m,g),c=c*2+17.3,m=m*2+9.1,g=g*2+31.7,b*=.5;return y/1.75}return(l,u,h)=>t===0?[l,u,h]:(l+=t*o(u,h,0),u+=t*o(h,l,1),h+=t*o(l,u,2),[l,u,h])}function Pce(e,t,r){let i=t,s=t.length/3+6e3,a=r*r,n=(o,l)=>o\\u003cl?`${o}:${l}`:`${l}:${o}`;for(let o=0;o\\u003c8;o++){let l=new Map,u=0;for(let d=0;d\\u003ci.length;d+=3){let c=i[d],m=i[d+1],g=i[d+2];for(let[y,b]of[[c,m],[m,g],[g,c]]){let v=e[y*3]-e[b*3],S=e[y*3+1]-e[b*3+1],T=e[y*3+2]-e[b*3+2];v*v+S*S+T*T>a&&(l.set(n(y,b),-1),u++)}}if(!l.size||i.length/3+u>s)break;for(let[d]of l){let[c,m]=d.split(\\\":\\\").map(Number),g=e.length/3;e.push((e[c*3]+e[m*3])/2,(e[c*3+1]+e[m*3+1])/2,(e[c*3+2]+e[m*3+2])/2),l.set(d,g)}let h=[];for(let d=0;d\\u003ci.length;d+=3){let c=i[d],m=i[d+1],g=i[d+2],y=l.get(n(c,m)),b=l.get(n(m,g)),v=l.get(n(g,c));y!==void 0&&b!==void 0&&v!==void 0?h.push(c,y,v,y,m,b,v,b,g,y,b,v):y!==void 0&&b!==void 0?h.push(m,b,y,c,y,g,y,b,g):b!==void 0&&v!==void 0?h.push(g,v,b,m,b,c,b,v,c):v!==void 0&&y!==void 0?h.push(c,y,v,g,v,m,v,y,m):y!==void 0?h.push(c,y,g,y,m,g):b!==void 0?h.push(m,b,c,b,g,c):v!==void 0?h.push(g,v,m,v,c,m):h.push(c,m,g)}i=h}return i}function Bce(e,t,r=40,i,s){let a=Nx(t);if(a.strength===0)return e;let n=e.clone();for(let y of Object.keys(n.attributes))y!==\\\"position\\\"&&n.deleteAttribute(y);n.clearGroups();let o=U5(n,1e-7);n.dispose();let l=Array.from(o.getAttribute(\\\"position\\\").array),u=Array.from(o.index.array);o.dispose();let h=i!==void 0?Mce(a.scale,i):s!==void 0?Rce(e,s):null,d=h?Nce(l,Ace(l,u),h.maxEdge,h.extraTriangles):Pce(l,u,a.scale*.3),c=Ece(a);for(let y=0;y\\u003cl.length;y+=3){let b=c(l[y],l[y+1],l[y+2]);l[y]=b[0],l[y+1]=b[1],l[y+2]=b[2]}let m=new ps;m.setAttribute(\\\"position\\\",new tr(l,3)),m.setIndex(d);let g=z5(m,Bt.degToRad(r));return g!==m&&m.dispose(),g.center(),g.computeBoundingBox(),g.computeBoundingSphere(),g}var QF=1.5,Ice=Object.freeze({logoBreak:1.5,form1:3.8,break1:10.375,form2:12.675,break2:18.5,fadeOut:22}),y2=e=>e.fadeOut+QF;function Fce(e,t){let r=.3+t+.6,i=e.logoBreak,s=Math.max(e.form1,i+r),a=Math.max(e.break1,s+2.8+.65),n=Math.max(e.form2,a+r),o=Math.max(e.break2,n+2.8+.65),l=Math.max(e.fadeOut,o+r);return{logoBreak:i,form1:s,break1:a,form2:n,break2:o,fadeOut:l}}String.prototype.codePointAt||(function(){var e=(function(){try{var r={},i=Object.defineProperty,s=i(r,r,r)&&i}catch{}return s})(),t=function(r){if(this==null)throw TypeError();var i=String(this),s=i.length,a=r?Number(r):0;if(a!=a&&(a=0),!(a\\u003c0||a>=s)){var n=i.charCodeAt(a),o;return n>=55296&&n\\u003c=56319&&s>a+1&&(o=i.charCodeAt(a+1),o>=56320&&o\\u003c=57343)?(n-55296)*1024+o-56320+65536:n}};e?e(String.prototype,\\\"codePointAt\\\",{value:t,configurable:!0,writable:!0}):String.prototype.codePointAt=t})();var x2=0,KF=-3;function sf(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function Lce(e,t){this.source=e,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new sf,this.dtree=new sf}var eL=new sf,tL=new sf,v2=new Uint8Array(30),b2=new Uint16Array(30),rL=new Uint8Array(30),iL=new Uint16Array(30),kce=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sL=new sf,qn=new Uint8Array(320);function aL(e,t,r,i){var s,a;for(s=0;s\\u003cr;++s)e[s]=0;for(s=0;s\\u003c30-r;++s)e[s+r]=s/r|0;for(a=i,s=0;s\\u003c30;++s)t[s]=a,a+=1\\u003c\\u003ce[s]}function Dce(e,t){var r;for(r=0;r\\u003c7;++r)e.table[r]=0;for(e.table[7]=24,e.table[8]=152,e.table[9]=112,r=0;r\\u003c24;++r)e.trans[r]=256+r;for(r=0;r\\u003c144;++r)e.trans[24+r]=r;for(r=0;r\\u003c8;++r)e.trans[168+r]=280+r;for(r=0;r\\u003c112;++r)e.trans[176+r]=144+r;for(r=0;r\\u003c5;++r)t.table[r]=0;for(t.table[5]=32,r=0;r\\u003c32;++r)t.trans[r]=r}var nL=new Uint16Array(16);function T2(e,t,r,i){var s,a;for(s=0;s\\u003c16;++s)e.table[s]=0;for(s=0;s\\u003ci;++s)e.table[t[r+s]]++;for(e.table[0]=0,a=0,s=0;s\\u003c16;++s)nL[s]=a,a+=e.table[s];for(s=0;s\\u003ci;++s)t[r+s]&&(e.trans[nL[t[r+s]]++]=s)}function Oce(e){e.bitcount--||(e.tag=e.source[e.sourceIndex++],e.bitcount=7);var t=e.tag&1;return e.tag>>>=1,t}function Yn(e,t,r){if(!t)return r;for(;e.bitcount\\u003c24;)e.tag|=e.source[e.sourceIndex++]\\u003c\\u003ce.bitcount,e.bitcount+=8;var i=e.tag&65535>>>16-t;return e.tag>>>=t,e.bitcount-=t,i+r}function S2(e,t){for(;e.bitcount\\u003c24;)e.tag|=e.source[e.sourceIndex++]\\u003c\\u003ce.bitcount,e.bitcount+=8;var r=0,i=0,s=0,a=e.tag;do i=2*i+(a&1),a>>>=1,++s,r+=t.table[s],i-=t.table[s];while(i>=0);return e.tag=a,e.bitcount-=s,t.trans[r+i]}function Uce(e,t,r){var i,s,a,n,o,l;for(i=Yn(e,5,257),s=Yn(e,5,1),a=Yn(e,4,4),n=0;n\\u003c19;++n)qn[n]=0;for(n=0;n\\u003ca;++n){var u=Yn(e,3,0);qn[kce[n]]=u}for(T2(sL,qn,0,19),o=0;o\\u003ci+s;){var h=S2(e,sL);switch(h){case 16:var d=qn[o-1];for(l=Yn(e,2,3);l;--l)qn[o++]=d;break;case 17:for(l=Yn(e,3,3);l;--l)qn[o++]=0;break;case 18:for(l=Yn(e,7,11);l;--l)qn[o++]=0;break;default:qn[o++]=h;break}}T2(t,qn,0,i),T2(r,qn,i,s)}function oL(e,t,r){for(;;){var i=S2(e,t);if(i===256)return x2;if(i\\u003c256)e.dest[e.destLen++]=i;else{var s,a,n,o;for(i-=257,s=Yn(e,v2[i],b2[i]),a=S2(e,r),n=e.destLen-Yn(e,rL[a],iL[a]),o=n;o\\u003cn+s;++o)e.dest[e.destLen++]=e.dest[o]}}}function zce(e){for(var t,r,i;e.bitcount>8;)e.sourceIndex--,e.bitcount-=8;if(t=e.source[e.sourceIndex+1],t=256*t+e.source[e.sourceIndex],r=e.source[e.sourceIndex+3],r=256*r+e.source[e.sourceIndex+2],t!==(~r&65535))return KF;for(e.sourceIndex+=4,i=t;i;--i)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,x2}function Vce(e,t){var r=new Lce(e,t),i,s,a;do{switch(i=Oce(r),s=Yn(r,2,0),s){case 0:a=zce(r);break;case 1:a=oL(r,eL,tL);break;case 2:Uce(r,r.ltree,r.dtree),a=oL(r,r.ltree,r.dtree);break;default:a=KF}if(a!==x2)throw new Error(\\\"Data error\\\")}while(!i);return r.destLen\\u003cr.dest.length?typeof r.dest.slice==\\\"function\\\"?r.dest.slice(0,r.destLen):r.dest.subarray(0,r.destLen):r.dest}Dce(eL,tL),aL(v2,b2,4,3),aL(rL,iL,2,1),v2[28]=0,b2[28]=258;var Gce=Vce;function Rc(e,t,r,i,s){return Math.pow(1-s,3)*e+3*Math.pow(1-s,2)*s*t+3*(1-s)*Math.pow(s,2)*r+Math.pow(s,3)*i}function $o(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}$o.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},$o.prototype.addPoint=function(e,t){typeof e==\\\"number\\\"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),e\\u003cthis.x1&&(this.x1=e),e>this.x2&&(this.x2=e)),typeof t==\\\"number\\\"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),t\\u003cthis.y1&&(this.y1=t),t>this.y2&&(this.y2=t))},$o.prototype.addX=function(e){this.addPoint(e,null)},$o.prototype.addY=function(e){this.addPoint(null,e)},$o.prototype.addBezier=function(e,t,r,i,s,a,n,o){var l=[e,t],u=[r,i],h=[s,a],d=[n,o];this.addPoint(e,t),this.addPoint(n,o);for(var c=0;c\\u003c=1;c++){var m=6*l[c]-12*u[c]+6*h[c],g=-3*l[c]+9*u[c]-9*h[c]+3*d[c],y=3*u[c]-3*l[c];if(g===0){if(m===0)continue;var b=-y/m;0\\u003cb&&b\\u003c1&&(c===0&&this.addX(Rc(l[c],u[c],h[c],d[c],b)),c===1&&this.addY(Rc(l[c],u[c],h[c],d[c],b)));continue}var v=Math.pow(m,2)-4*y*g;if(!(v\\u003c0)){var S=(-m+Math.sqrt(v))/(2*g);0\\u003cS&&S\\u003c1&&(c===0&&this.addX(Rc(l[c],u[c],h[c],d[c],S)),c===1&&this.addY(Rc(l[c],u[c],h[c],d[c],S)));var T=(-m-Math.sqrt(v))/(2*g);0\\u003cT&&T\\u003c1&&(c===0&&this.addX(Rc(l[c],u[c],h[c],d[c],T)),c===1&&this.addY(Rc(l[c],u[c],h[c],d[c],T)))}}},$o.prototype.addQuad=function(e,t,r,i,s,a){var n=e+.6666666666666666*(r-e),o=t+2/3*(i-t),l=n+1/3*(s-e),u=o+1/3*(a-t);this.addBezier(e,t,n,o,l,u,s,a)};function di(){this.commands=[],this.fill=\\\"black\\\",this.stroke=null,this.strokeWidth=1}di.prototype.moveTo=function(e,t){this.commands.push({type:\\\"M\\\",x:e,y:t})},di.prototype.lineTo=function(e,t){this.commands.push({type:\\\"L\\\",x:e,y:t})},di.prototype.curveTo=di.prototype.bezierCurveTo=function(e,t,r,i,s,a){this.commands.push({type:\\\"C\\\",x1:e,y1:t,x2:r,y2:i,x:s,y:a})},di.prototype.quadTo=di.prototype.quadraticCurveTo=function(e,t,r,i){this.commands.push({type:\\\"Q\\\",x1:e,y1:t,x:r,y:i})},di.prototype.close=di.prototype.closePath=function(){this.commands.push({type:\\\"Z\\\"})},di.prototype.extend=function(e){if(e.commands)e=e.commands;else if(e instanceof $o){var t=e;this.moveTo(t.x1,t.y1),this.lineTo(t.x2,t.y1),this.lineTo(t.x2,t.y2),this.lineTo(t.x1,t.y2),this.close();return}Array.prototype.push.apply(this.commands,e)},di.prototype.getBoundingBox=function(){for(var e=new $o,t=0,r=0,i=0,s=0,a=0;a\\u003cthis.commands.length;a++){var n=this.commands[a];switch(n.type){case\\\"M\\\":e.addPoint(n.x,n.y),t=i=n.x,r=s=n.y;break;case\\\"L\\\":e.addPoint(n.x,n.y),i=n.x,s=n.y;break;case\\\"Q\\\":e.addQuad(i,s,n.x1,n.y1,n.x,n.y),i=n.x,s=n.y;break;case\\\"C\\\":e.addBezier(i,s,n.x1,n.y1,n.x2,n.y2,n.x,n.y),i=n.x,s=n.y;break;case\\\"Z\\\":i=t,s=r;break;default:throw new Error(\\\"Unexpected path command \\\"+n.type)}}return e.isEmpty()&&e.addPoint(0,0),e},di.prototype.draw=function(e){e.beginPath();for(var t=0;t\\u003cthis.commands.length;t+=1){var r=this.commands[t];r.type===\\\"M\\\"?e.moveTo(r.x,r.y):r.type===\\\"L\\\"?e.lineTo(r.x,r.y):r.type===\\\"C\\\"?e.bezierCurveTo(r.x1,r.y1,r.x2,r.y2,r.x,r.y):r.type===\\\"Q\\\"?e.quadraticCurveTo(r.x1,r.y1,r.x,r.y):r.type===\\\"Z\\\"&&e.closePath()}this.fill&&(e.fillStyle=this.fill,e.fill()),this.stroke&&(e.strokeStyle=this.stroke,e.lineWidth=this.strokeWidth,e.stroke())},di.prototype.toPathData=function(e){e=e!==void 0?e:2;function t(n){return Math.round(n)===n?\\\"\\\"+Math.round(n):n.toFixed(e)}function r(){for(var n=arguments,o=\\\"\\\",l=0;l\\u003carguments.length;l+=1){var u=n[l];u>=0&&l>0&&(o+=\\\" \\\"),o+=t(u)}return o}for(var i=\\\"\\\",s=0;s\\u003cthis.commands.length;s+=1){var a=this.commands[s];a.type===\\\"M\\\"?i+=\\\"M\\\"+r(a.x,a.y):a.type===\\\"L\\\"?i+=\\\"L\\\"+r(a.x,a.y):a.type===\\\"C\\\"?i+=\\\"C\\\"+r(a.x1,a.y1,a.x2,a.y2,a.x,a.y):a.type===\\\"Q\\\"?i+=\\\"Q\\\"+r(a.x1,a.y1,a.x,a.y):a.type===\\\"Z\\\"&&(i+=\\\"Z\\\")}return i},di.prototype.toSVG=function(e){var t='\\u003cpath d=\\\"';return t+=this.toPathData(e),t+='\\\"',this.fill&&this.fill!==\\\"black\\\"&&(this.fill===null?t+=' fill=\\\"none\\\"':t+=' fill=\\\"'+this.fill+'\\\"'),this.stroke&&(t+=' stroke=\\\"'+this.stroke+'\\\" stroke-width=\\\"'+this.strokeWidth+'\\\"'),t+=\\\"/>\\\",t},di.prototype.toDOMElement=function(e){var t=this.toPathData(e),r=document.createElementNS(\\\"http://www.w3.org/2000/svg\\\",\\\"path\\\");return r.setAttribute(\\\"d\\\",t),r};function lL(e){throw new Error(e)}function uL(e,t){e||lL(t)}var bt={fail:lL,argument:uL,assert:uL},hL=32768,dL=2147483648,Ec={},He={},wt={};function rn(e){return function(){return e}}He.BYTE=function(e){return bt.argument(e>=0&&e\\u003c=255,\\\"Byte value should be between 0 and 255.\\\"),[e]},wt.BYTE=rn(1),He.CHAR=function(e){return[e.charCodeAt(0)]},wt.CHAR=rn(1),He.CHARARRAY=function(e){typeof e>\\\"u\\\"&&(e=\\\"\\\",console.warn(\\\"Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name.\\\"));for(var t=[],r=0;r\\u003ce.length;r+=1)t[r]=e.charCodeAt(r);return t},wt.CHARARRAY=function(e){return typeof e>\\\"u\\\"?0:e.length},He.USHORT=function(e){return[e>>8&255,e&255]},wt.USHORT=rn(2),He.SHORT=function(e){return e>=hL&&(e=-(2*hL-e)),[e>>8&255,e&255]},wt.SHORT=rn(2),He.UINT24=function(e){return[e>>16&255,e>>8&255,e&255]},wt.UINT24=rn(3),He.ULONG=function(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]},wt.ULONG=rn(4),He.LONG=function(e){return e>=dL&&(e=-(2*dL-e)),[e>>24&255,e>>16&255,e>>8&255,e&255]},wt.LONG=rn(4),He.FIXED=He.ULONG,wt.FIXED=wt.ULONG,He.FWORD=He.SHORT,wt.FWORD=wt.SHORT,He.UFWORD=He.USHORT,wt.UFWORD=wt.USHORT,He.LONGDATETIME=function(e){return[0,0,0,0,e>>24&255,e>>16&255,e>>8&255,e&255]},wt.LONGDATETIME=rn(8),He.TAG=function(e){return bt.argument(e.length===4,\\\"Tag should be exactly 4 ASCII characters.\\\"),[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]},wt.TAG=rn(4),He.Card8=He.BYTE,wt.Card8=wt.BYTE,He.Card16=He.USHORT,wt.Card16=wt.USHORT,He.OffSize=He.BYTE,wt.OffSize=wt.BYTE,He.SID=He.USHORT,wt.SID=wt.USHORT,He.NUMBER=function(e){return e>=-107&&e\\u003c=107?[e+139]:e>=108&&e\\u003c=1131?(e=e-108,[(e>>8)+247,e&255]):e>=-1131&&e\\u003c=-108?(e=-e-108,[(e>>8)+251,e&255]):e>=-32768&&e\\u003c=32767?He.NUMBER16(e):He.NUMBER32(e)},wt.NUMBER=function(e){return He.NUMBER(e).length},He.NUMBER16=function(e){return[28,e>>8&255,e&255]},wt.NUMBER16=rn(3),He.NUMBER32=function(e){return[29,e>>24&255,e>>16&255,e>>8&255,e&255]},wt.NUMBER32=rn(5),He.REAL=function(e){var t=e.toString(),r=/\\\\.(\\\\d*?)(?:9{5,20}|0{5,20})\\\\d{0,2}(?:e(.+)|$)/.exec(t);if(r){var i=parseFloat(\\\"1e\\\"+((r[2]?+r[2]:0)+r[1].length));t=(Math.round(e*i)/i).toString()}for(var s=\\\"\\\",a=0,n=t.length;a\\u003cn;a+=1){var o=t[a];o===\\\"e\\\"?s+=t[++a]===\\\"-\\\"?\\\"c\\\":\\\"b\\\":o===\\\".\\\"?s+=\\\"a\\\":o===\\\"-\\\"?s+=\\\"e\\\":s+=o}s+=s.length&1?\\\"f\\\":\\\"ff\\\";for(var l=[30],u=0,h=s.length;u\\u003ch;u+=2)l.push(parseInt(s.substr(u,2),16));return l},wt.REAL=function(e){return He.REAL(e).length},He.NAME=He.CHARARRAY,wt.NAME=wt.CHARARRAY,He.STRING=He.CHARARRAY,wt.STRING=wt.CHARARRAY,Ec.UTF8=function(e,t,r){for(var i=[],s=r,a=0;a\\u003cs;a++,t+=1)i[a]=e.getUint8(t);return String.fromCharCode.apply(null,i)},Ec.UTF16=function(e,t,r){for(var i=[],s=r/2,a=0;a\\u003cs;a++,t+=2)i[a]=e.getUint16(t);return String.fromCharCode.apply(null,i)},He.UTF16=function(e){for(var t=[],r=0;r\\u003ce.length;r+=1){var i=e.charCodeAt(r);t[t.length]=i>>8&255,t[t.length]=i&255}return t},wt.UTF16=function(e){return e.length*2};var _2={\\\"x-mac-croatian\\\":\\\"\\\\xC4\\\\xC5\\\\xC7\\\\xC9\\\\xD1\\\\xD6\\\\xDC\\\\xE1\\\\xE0\\\\xE2\\\\xE4\\\\xE3\\\\xE5\\\\xE7\\\\xE9\\\\xE8\\\\xEA\\\\xEB\\\\xED\\\\xEC\\\\xEE\\\\xEF\\\\xF1\\\\xF3\\\\xF2\\\\xF4\\\\xF6\\\\xF5\\\\xFA\\\\xF9\\\\xFB\\\\xFC\\\\u2020\\\\xB0\\\\xA2\\\\xA3\\\\xA7\\\\u2022\\\\xB6\\\\xDF\\\\xAE\\\\u0160\\\\u2122\\\\xB4\\\\xA8\\\\u2260\\\\u017D\\\\xD8\\\\u221E\\\\xB1\\\\u2264\\\\u2265\\\\u2206\\\\xB5\\\\u2202\\\\u2211\\\\u220F\\\\u0161\\\\u222B\\\\xAA\\\\xBA\\\\u03A9\\\\u017E\\\\xF8\\\\xBF\\\\xA1\\\\xAC\\\\u221A\\\\u0192\\\\u2248\\\\u0106\\\\xAB\\\\u010C\\\\u2026\\\\xA0\\\\xC0\\\\xC3\\\\xD5\\\\u0152\\\\u0153\\\\u0110\\\\u2014\\\\u201C\\\\u201D\\\\u2018\\\\u2019\\\\xF7\\\\u25CA\\\\uF8FF\\\\xA9\\\\u2044\\\\u20AC\\\\u2039\\\\u203A\\\\xC6\\\\xBB\\\\u2013\\\\xB7\\\\u201A\\\\u201E\\\\u2030\\\\xC2\\\\u0107\\\\xC1\\\\u010D\\\\xC8\\\\xCD\\\\xCE\\\\xCF\\\\xCC\\\\xD3\\\\xD4\\\\u0111\\\\xD2\\\\xDA\\\\xDB\\\\xD9\\\\u0131\\\\u02C6\\\\u02DC\\\\xAF\\\\u03C0\\\\xCB\\\\u02DA\\\\xB8\\\\xCA\\\\xE6\\\\u02C7\\\",\\\"x-mac-cyrillic\\\":\\\"\\\\u0410\\\\u0411\\\\u0412\\\\u0413\\\\u0414\\\\u0415\\\\u0416\\\\u0417\\\\u0418\\\\u0419\\\\u041A\\\\u041B\\\\u041C\\\\u041D\\\\u041E\\\\u041F\\\\u0420\\\\u0421\\\\u0422\\\\u0423\\\\u0424\\\\u0425\\\\u0426\\\\u0427\\\\u0428\\\\u0429\\\\u042A\\\\u042B\\\\u042C\\\\u042D\\\\u042E\\\\u042F\\\\u2020\\\\xB0\\\\u0490\\\\xA3\\\\xA7\\\\u2022\\\\xB6\\\\u0406\\\\xAE\\\\xA9\\\\u2122\\\\u0402\\\\u0452\\\\u2260\\\\u0403\\\\u0453\\\\u221E\\\\xB1\\\\u2264\\\\u2265\\\\u0456\\\\xB5\\\\u0491\\\\u0408\\\\u0404\\\\u0454\\\\u0407\\\\u0457\\\\u0409\\\\u0459\\\\u040A\\\\u045A\\\\u0458\\\\u0405\\\\xAC\\\\u221A\\\\u0192\\\\u2248\\\\u2206\\\\xAB\\\\xBB\\\\u2026\\\\xA0\\\\u040B\\\\u045B\\\\u040C\\\\u045C\\\\u0455\\\\u2013\\\\u2014\\\\u201C\\\\u201D\\\\u2018\\\\u2019\\\\xF7\\\\u201E\\\\u040E\\\\u045E\\\\u040F\\\\u045F\\\\u2116\\\\u0401\\\\u0451\\\\u044F\\\\u0430\\\\u0431\\\\u0432\\\\u0433\\\\u0434\\\\u0435\\\\u0436\\\\u0437\\\\u0438\\\\u0439\\\\u043A\\\\u043B\\\\u043C\\\\u043D\\\\u043E\\\\u043F\\\\u0440\\\\u0441\\\\u0442\\\\u0443\\\\u0444\\\\u0445\\\\u0446\\\\u0447\\\\u0448\\\\u0449\\\\u044A\\\\u044B\\\\u044C\\\\u044D\\\\u044E\\\",\\\"x-mac-gaelic\\\":\\\"\\\\xC4\\\\xC5\\\\xC7\\\\xC9\\\\xD1\\\\xD6\\\\xDC\\\\xE1\\\\xE0\\\\xE2\\\\xE4\\\\xE3\\\\xE5\\\\xE7\\\\xE9\\\\xE8\\\\xEA\\\\xEB\\\\xED\\\\xEC\\\\xEE\\\\xEF\\\\xF1\\\\xF3\\\\xF2\\\\xF4\\\\xF6\\\\xF5\\\\xFA\\\\xF9\\\\xFB\\\\xFC\\\\u2020\\\\xB0\\\\xA2\\\\xA3\\\\xA7\\\\u2022\\\\xB6\\\\xDF\\\\xAE\\\\xA9\\\\u2122\\\\xB4\\\\xA8\\\\u2260\\\\xC6\\\\xD8\\\\u1E02\\\\xB1\\\\u2264\\\\u2265\\\\u1E03\\\\u010A\\\\u010B\\\\u1E0A\\\\u1E0B\\\\u1E1E\\\\u1E1F\\\\u0120\\\\u0121\\\\u1E40\\\\xE6\\\\xF8\\\\u1E41\\\\u1E56\\\\u1E57\\\\u027C\\\\u0192\\\\u017F\\\\u1E60\\\\xAB\\\\xBB\\\\u2026\\\\xA0\\\\xC0\\\\xC3\\\\xD5\\\\u0152\\\\u0153\\\\u2013\\\\u2014\\\\u201C\\\\u201D\\\\u2018\\\\u2019\\\\u1E61\\\\u1E9B\\\\xFF\\\\u0178\\\\u1E6A\\\\u20AC\\\\u2039\\\\u203A\\\\u0176\\\\u0177\\\\u1E6B\\\\xB7\\\\u1EF2\\\\u1EF3\\\\u204A\\\\xC2\\\\xCA\\\\xC1\\\\xCB\\\\xC8\\\\xCD\\\\xCE\\\\xCF\\\\xCC\\\\xD3\\\\xD4\\\\u2663\\\\xD2\\\\xDA\\\\xDB\\\\xD9\\\\u0131\\\\xDD\\\\xFD\\\\u0174\\\\u0175\\\\u1E84\\\\u1E85\\\\u1E80\\\\u1E81\\\\u1E82\\\\u1E83\\\",\\\"x-mac-greek\\\":\\\"\\\\xC4\\\\xB9\\\\xB2\\\\xC9\\\\xB3\\\\xD6\\\\xDC\\\\u0385\\\\xE0\\\\xE2\\\\xE4\\\\u0384\\\\xA8\\\\xE7\\\\xE9\\\\xE8\\\\xEA\\\\xEB\\\\xA3\\\\u2122\\\\xEE\\\\xEF\\\\u2022\\\\xBD\\\\u2030\\\\xF4\\\\xF6\\\\xA6\\\\u20AC\\\\xF9\\\\xFB\\\\xFC\\\\u2020\\\\u0393\\\\u0394\\\\u0398\\\\u039B\\\\u039E\\\\u03A0\\\\xDF\\\\xAE\\\\xA9\\\\u03A3\\\\u03AA\\\\xA7\\\\u2260\\\\xB0\\\\xB7\\\\u0391\\\\xB1\\\\u2264\\\\u2265\\\\xA5\\\\u0392\\\\u0395\\\\u0396\\\\u0397\\\\u0399\\\\u039A\\\\u039C\\\\u03A6\\\\u03AB\\\\u03A8\\\\u03A9\\\\u03AC\\\\u039D\\\\xAC\\\\u039F\\\\u03A1\\\\u2248\\\\u03A4\\\\xAB\\\\xBB\\\\u2026\\\\xA0\\\\u03A5\\\\u03A7\\\\u0386\\\\u0388\\\\u0153\\\\u2013\\\\u2015\\\\u201C\\\\u201D\\\\u2018\\\\u2019\\\\xF7\\\\u0389\\\\u038A\\\\u038C\\\\u038E\\\\u03AD\\\\u03AE\\\\u03AF\\\\u03CC\\\\u038F\\\\u03CD\\\\u03B1\\\\u03B2\\\\u03C8\\\\u03B4\\\\u03B5\\\\u03C6\\\\u03B3\\\\u03B7\\\\u03B9\\\\u03BE\\\\u03BA\\\\u03BB\\\\u03BC\\\\u03BD\\\\u03BF\\\\u03C0\\\\u03CE\\\\u03C1\\\\u03C3\\\\u03C4\\\\u03B8\\\\u03C9\\\\u03C2\\\\u03C7\\\\u03C5\\\\u03B6\\\\u03CA\\\\u03CB\\\\u0390\\\\u03B0\\\\xAD\\\",\\\"x-mac-icelandic\\\":\\\"\\\\xC4\\\\xC5\\\\xC7\\\\xC9\\\\xD1\\\\xD6\\\\xDC\\\\xE1\\\\xE0\\\\xE2\\\\xE4\\\\xE3\\\\xE5\\\\xE7\\\\xE9\\\\xE8\\\\xEA\\\\xEB\\\\xED\\\\xEC\\\\xEE\\\\xEF\\\\xF1\\\\xF3\\\\xF2\\\\xF4\\\\xF6\\\\xF5\\\\xFA\\\\xF9\\\\xFB\\\\xFC\\\\xDD\\\\xB0\\\\xA2\\\\xA3\\\\xA7\\\\u2022\\\\xB6\\\\xDF\\\\xAE\\\\xA9\\\\u2122\\\\xB4\\\\xA8\\\\u2260\\\\xC6\\\\xD8\\\\u221E\\\\xB1\\\\u2264\\\\u2265\\\\xA5\\\\xB5\\\\u2202\\\\u2211\\\\u220F\\\\u03C0\\\\u222B\\\\xAA\\\\xBA\\\\u03A9\\\\xE6\\\\xF8\\\\xBF\\\\xA1\\\\xAC\\\\u221A\\\\u0192\\\\u2248\\\\u2206\\\\xAB\\\\xBB\\\\u2026\\\\xA0\\\\xC0\\\\xC3\\\\xD5\\\\u0152\\\\u0153\\\\u2013\\\\u2014\\\\u201C\\\\u201D\\\\u2018\\\\u2019\\\\xF7\\\\u25CA\\\\xFF\\\\u0178\\\\u2044\\\\u20AC\\\\xD0\\\\xF0\\\\xDE\\\\xFE\\\\xFD\\\\xB7\\\\u201A\\\\u201E\\\\u2030\\\\xC2\\\\xCA\\\\xC1\\\\xCB\\\\xC8\\\\xCD\\\\xCE\\\\xCF\\\\xCC\\\\xD3\\\\xD4\\\\uF8FF\\\\xD2\\\\xDA\\\\xDB\\\\xD9\\\\u0131\\\\u02C6\\\\u02DC\\\\xAF\\\\u02D8\\\\u02D9\\\\u02DA\\\\xB8\\\\u02DD\\\\u02DB\\\\u02C7\\\",\\\"x-mac-inuit\\\":\\\"\\\\u1403\\\\u1404\\\\u1405\\\\u1406\\\\u140A\\\\u140B\\\\u1431\\\\u1432\\\\u1433\\\\u1434\\\\u1438\\\\u1439\\\\u1449\\\\u144E\\\\u144F\\\\u1450\\\\u1451\\\\u1455\\\\u1456\\\\u1466\\\\u146D\\\\u146E\\\\u146F\\\\u1470\\\\u1472\\\\u1473\\\\u1483\\\\u148B\\\\u148C\\\\u148D\\\\u148E\\\\u1490\\\\u1491\\\\xB0\\\\u14A1\\\\u14A5\\\\u14A6\\\\u2022\\\\xB6\\\\u14A7\\\\xAE\\\\xA9\\\\u2122\\\\u14A8\\\\u14AA\\\\u14AB\\\\u14BB\\\\u14C2\\\\u14C3\\\\u14C4\\\\u14C5\\\\u14C7\\\\u14C8\\\\u14D0\\\\u14EF\\\\u14F0\\\\u14F1\\\\u14F2\\\\u14F4\\\\u14F5\\\\u1505\\\\u14D5\\\\u14D6\\\\u14D7\\\\u14D8\\\\u14DA\\\\u14DB\\\\u14EA\\\\u1528\\\\u1529\\\\u152A\\\\u152B\\\\u152D\\\\u2026\\\\xA0\\\\u152E\\\\u153E\\\\u1555\\\\u1556\\\\u1557\\\\u2013\\\\u2014\\\\u201C\\\\u201D\\\\u2018\\\\u2019\\\\u1558\\\\u1559\\\\u155A\\\\u155D\\\\u1546\\\\u1547\\\\u1548\\\\u1549\\\\u154B\\\\u154C\\\\u1550\\\\u157F\\\\u1580\\\\u1581\\\\u1582\\\\u1583\\\\u1584\\\\u1585\\\\u158F\\\\u1590\\\\u1591\\\\u1592\\\\u1593\\\\u1594\\\\u1595\\\\u1671\\\\u1672\\\\u1673\\\\u1674\\\\u1675\\\\u1676\\\\u1596\\\\u15A0\\\\u15A1\\\\u15A2\\\\u15A3\\\\u15A4\\\\u15A5\\\\u15A6\\\\u157C\\\\u0141\\\\u0142\\\",\\\"x-mac-ce\\\":\\\"\\\\xC4\\\\u0100\\\\u0101\\\\xC9\\\\u0104\\\\xD6\\\\xDC\\\\xE1\\\\u0105\\\\u010C\\\\xE4\\\\u010D\\\\u0106\\\\u0107\\\\xE9\\\\u0179\\\\u017A\\\\u010E\\\\xED\\\\u010F\\\\u0112\\\\u0113\\\\u0116\\\\xF3\\\\u0117\\\\xF4\\\\xF6\\\\xF5\\\\xFA\\\\u011A\\\\u011B\\\\xFC\\\\u2020\\\\xB0\\\\u0118\\\\xA3\\\\xA7\\\\u2022\\\\xB6\\\\xDF\\\\xAE\\\\xA9\\\\u2122\\\\u0119\\\\xA8\\\\u2260\\\\u0123\\\\u012E\\\\u012F\\\\u012A\\\\u2264\\\\u2265\\\\u012B\\\\u0136\\\\u2202\\\\u2211\\\\u0142\\\\u013B\\\\u013C\\\\u013D\\\\u013E\\\\u0139\\\\u013A\\\\u0145\\\\u0146\\\\u0143\\\\xAC\\\\u221A\\\\u0144\\\\u0147\\\\u2206\\\\xAB\\\\xBB\\\\u2026\\\\xA0\\\\u0148\\\\u0150\\\\xD5\\\\u0151\\\\u014C\\\\u2013\\\\u2014\\\\u201C\\\\u201D\\\\u2018\\\\u2019\\\\xF7\\\\u25CA\\\\u014D\\\\u0154\\\\u0155\\\\u0158\\\\u2039\\\\u203A\\\\u0159\\\\u0156\\\\u0157\\\\u0160\\\\u201A\\\\u201E\\\\u0161\\\\u015A\\\\u015B\\\\xC1\\\\u0164\\\\u0165\\\\xCD\\\\u017D\\\\u017E\\\\u016A\\\\xD3\\\\xD4\\\\u016B\\\\u016E\\\\xDA\\\\u016F\\\\u0170\\\\u0171\\\\u0172\\\\u0173\\\\xDD\\\\xFD\\\\u0137\\\\u017B\\\\u0141\\\\u017C\\\\u0122\\\\u02C7\\\",macintosh:\\\"\\\\xC4\\\\xC5\\\\xC7\\\\xC9\\\\xD1\\\\xD6\\\\xDC\\\\xE1\\\\xE0\\\\xE2\\\\xE4\\\\xE3\\\\xE5\\\\xE7\\\\xE9\\\\xE8\\\\xEA\\\\xEB\\\\xED\\\\xEC\\\\xEE\\\\xEF\\\\xF1\\\\xF3\\\\xF2\\\\xF4\\\\xF6\\\\xF5\\\\xFA\\\\xF9\\\\xFB\\\\xFC\\\\u2020\\\\xB0\\\\xA2\\\\xA3\\\\xA7\\\\u2022\\\\xB6\\\\xDF\\\\xAE\\\\xA9\\\\u2122\\\\xB4\\\\xA8\\\\u2260\\\\xC6\\\\xD8\\\\u221E\\\\xB1\\\\u2264\\\\u2265\\\\xA5\\\\xB5\\\\u2202\\\\u2211\\\\u220F\\\\u03C0\\\\u222B\\\\xAA\\\\xBA\\\\u03A9\\\\xE6\\\\xF8\\\\xBF\\\\xA1\\\\xAC\\\\u221A\\\\u0192\\\\u2248\\\\u2206\\\\xAB\\\\xBB\\\\u2026\\\\xA0\\\\xC0\\\\xC3\\\\xD5\\\\u0152\\\\u0153\\\\u2013\\\\u2014\\\\u201C\\\\u201D\\\\u2018\\\\u2019\\\\xF7\\\\u25CA\\\\xFF\\\\u0178\\\\u2044\\\\u20AC\\\\u2039\\\\u203A\\\\uFB01\\\\uFB02\\\\u2021\\\\xB7\\\\u201A\\\\u201E\\\\u2030\\\\xC2\\\\xCA\\\\xC1\\\\xCB\\\\xC8\\\\xCD\\\\xCE\\\\xCF\\\\xCC\\\\xD3\\\\xD4\\\\uF8FF\\\\xD2\\\\xDA\\\\xDB\\\\xD9\\\\u0131\\\\u02C6\\\\u02DC\\\\xAF\\\\u02D8\\\\u02D9\\\\u02DA\\\\xB8\\\\u02DD\\\\u02DB\\\\u02C7\\\",\\\"x-mac-romanian\\\":\\\"\\\\xC4\\\\xC5\\\\xC7\\\\xC9\\\\xD1\\\\xD6\\\\xDC\\\\xE1\\\\xE0\\\\xE2\\\\xE4\\\\xE3\\\\xE5\\\\xE7\\\\xE9\\\\xE8\\\\xEA\\\\xEB\\\\xED\\\\xEC\\\\xEE\\\\xEF\\\\xF1\\\\xF3\\\\xF2\\\\xF4\\\\xF6\\\\xF5\\\\xFA\\\\xF9\\\\xFB\\\\xFC\\\\u2020\\\\xB0\\\\xA2\\\\xA3\\\\xA7\\\\u2022\\\\xB6\\\\xDF\\\\xAE\\\\xA9\\\\u2122\\\\xB4\\\\xA8\\\\u2260\\\\u0102\\\\u0218\\\\u221E\\\\xB1\\\\u2264\\\\u2265\\\\xA5\\\\xB5\\\\u2202\\\\u2211\\\\u220F\\\\u03C0\\\\u222B\\\\xAA\\\\xBA\\\\u03A9\\\\u0103\\\\u0219\\\\xBF\\\\xA1\\\\xAC\\\\u221A\\\\u0192\\\\u2248\\\\u2206\\\\xAB\\\\xBB\\\\u2026\\\\xA0\\\\xC0\\\\xC3\\\\xD5\\\\u0152\\\\u0153\\\\u2013\\\\u2014\\\\u201C\\\\u201D\\\\u2018\\\\u2019\\\\xF7\\\\u25CA\\\\xFF\\\\u0178\\\\u2044\\\\u20AC\\\\u2039\\\\u203A\\\\u021A\\\\u021B\\\\u2021\\\\xB7\\\\u201A\\\\u201E\\\\u2030\\\\xC2\\\\xCA\\\\xC1\\\\xCB\\\\xC8\\\\xCD\\\\xCE\\\\xCF\\\\xCC\\\\xD3\\\\xD4\\\\uF8FF\\\\xD2\\\\xDA\\\\xDB\\\\xD9\\\\u0131\\\\u02C6\\\\u02DC\\\\xAF\\\\u02D8\\\\u02D9\\\\u02DA\\\\xB8\\\\u02DD\\\\u02DB\\\\u02C7\\\",\\\"x-mac-turkish\\\":\\\"\\\\xC4\\\\xC5\\\\xC7\\\\xC9\\\\xD1\\\\xD6\\\\xDC\\\\xE1\\\\xE0\\\\xE2\\\\xE4\\\\xE3\\\\xE5\\\\xE7\\\\xE9\\\\xE8\\\\xEA\\\\xEB\\\\xED\\\\xEC\\\\xEE\\\\xEF\\\\xF1\\\\xF3\\\\xF2\\\\xF4\\\\xF6\\\\xF5\\\\xFA\\\\xF9\\\\xFB\\\\xFC\\\\u2020\\\\xB0\\\\xA2\\\\xA3\\\\xA7\\\\u2022\\\\xB6\\\\xDF\\\\xAE\\\\xA9\\\\u2122\\\\xB4\\\\xA8\\\\u2260\\\\xC6\\\\xD8\\\\u221E\\\\xB1\\\\u2264\\\\u2265\\\\xA5\\\\xB5\\\\u2202\\\\u2211\\\\u220F\\\\u03C0\\\\u222B\\\\xAA\\\\xBA\\\\u03A9\\\\xE6\\\\xF8\\\\xBF\\\\xA1\\\\xAC\\\\u221A\\\\u0192\\\\u2248\\\\u2206\\\\xAB\\\\xBB\\\\u2026\\\\xA0\\\\xC0\\\\xC3\\\\xD5\\\\u0152\\\\u0153\\\\u2013\\\\u2014\\\\u201C\\\\u201D\\\\u2018\\\\u2019\\\\xF7\\\\u25CA\\\\xFF\\\\u0178\\\\u011E\\\\u011F\\\\u0130\\\\u0131\\\\u015E\\\\u015F\\\\u2021\\\\xB7\\\\u201A\\\\u201E\\\\u2030\\\\xC2\\\\xCA\\\\xC1\\\\xCB\\\\xC8\\\\xCD\\\\xCE\\\\xCF\\\\xCC\\\\xD3\\\\xD4\\\\uF8FF\\\\xD2\\\\xDA\\\\xDB\\\\xD9\\\\uF8A0\\\\u02C6\\\\u02DC\\\\xAF\\\\u02D8\\\\u02D9\\\\u02DA\\\\xB8\\\\u02DD\\\\u02DB\\\\u02C7\\\"};Ec.MACSTRING=function(e,t,r,i){var s=_2[i];if(s!==void 0){for(var a=\\\"\\\",n=0;n\\u003cr;n++){var o=e.getUint8(t+n);o\\u003c=127?a+=String.fromCharCode(o):a+=s[o&127]}return a}};var Ax=typeof WeakMap==\\\"function\\\"&&new WeakMap,Cx,Wce=function(e){if(!Cx){Cx={};for(var t in _2)Cx[t]=new String(t)}var r=Cx[e];if(r!==void 0){if(Ax){var i=Ax.get(r);if(i!==void 0)return i}var s=_2[e];if(s!==void 0){for(var a={},n=0;n\\u003cs.length;n++)a[s.charCodeAt(n)]=n+128;return Ax&&Ax.set(r,a),a}}};He.MACSTRING=function(e,t){var r=Wce(t);if(r!==void 0){for(var i=[],s=0;s\\u003ce.length;s++){var a=e.charCodeAt(s);if(a>=128&&(a=r[a],a===void 0))return;i[s]=a}return i}},wt.MACSTRING=function(e,t){var r=He.MACSTRING(e,t);return r!==void 0?r.length:0};function w2(e){return e>=-128&&e\\u003c=127}function jce(e,t,r){for(var i=0,s=e.length;t\\u003cs&&i\\u003c64&&e[t]===0;)++t,++i;return r.push(128|i-1),t}function Hce(e,t,r){for(var i=0,s=e.length,a=t;a\\u003cs&&i\\u003c64;){var n=e[a];if(!w2(n)||n===0&&a+1\\u003cs&&e[a+1]===0)break;++a,++i}r.push(i-1);for(var o=t;o\\u003ca;++o)r.push(e[o]+256&255);return a}function Xce(e,t,r){for(var i=0,s=e.length,a=t;a\\u003cs&&i\\u003c64;){var n=e[a];if(n===0||w2(n)&&a+1\\u003cs&&w2(e[a+1]))break;++a,++i}r.push(64|i-1);for(var o=t;o\\u003ca;++o){var l=e[o];r.push(l+65536>>8&255,l+256&255)}return a}He.VARDELTAS=function(e){for(var t=0,r=[];t\\u003ce.length;){var i=e[t];i===0?t=jce(e,t,r):i>=-128&&i\\u003c=127?t=Hce(e,t,r):t=Xce(e,t,r)}return r},He.INDEX=function(e){for(var t=1,r=[t],i=[],s=0;s\\u003ce.length;s+=1){var a=He.OBJECT(e[s]);Array.prototype.push.apply(i,a),t+=a.length,r.push(t)}if(i.length===0)return[0,0];for(var n=[],o=1+Math.floor(Math.log(t)/Math.log(2))/8|0,l=[void 0,He.BYTE,He.USHORT,He.UINT24,He.ULONG][o],u=0;u\\u003cr.length;u+=1){var h=l(r[u]);Array.prototype.push.apply(n,h)}return Array.prototype.concat(He.Card16(e.length),He.OffSize(o),n,i)},wt.INDEX=function(e){return He.INDEX(e).length},He.DICT=function(e){for(var t=[],r=Object.keys(e),i=r.length,s=0;s\\u003ci;s+=1){var a=parseInt(r[s],0),n=e[a];t=t.concat(He.OPERAND(n.value,n.type)),t=t.concat(He.OPERATOR(a))}return t},wt.DICT=function(e){return He.DICT(e).length},He.OPERATOR=function(e){return e\\u003c1200?[e]:[12,e-1200]},He.OPERAND=function(e,t){var r=[];if(Array.isArray(t))for(var i=0;i\\u003ct.length;i+=1)bt.argument(e.length===t.length,\\\"Not enough arguments given for type\\\"+t),r=r.concat(He.OPERAND(e[i],t[i]));else if(t===\\\"SID\\\")r=r.concat(He.NUMBER(e));else if(t===\\\"offset\\\")r=r.concat(He.NUMBER32(e));else if(t===\\\"number\\\")r=r.concat(He.NUMBER(e));else if(t===\\\"real\\\")r=r.concat(He.REAL(e));else throw new Error(\\\"Unknown operand type \\\"+t);return r},He.OP=He.BYTE,wt.OP=wt.BYTE;var Rx=typeof WeakMap==\\\"function\\\"&&new WeakMap;He.CHARSTRING=function(e){if(Rx){var t=Rx.get(e);if(t!==void 0)return t}for(var r=[],i=e.length,s=0;s\\u003ci;s+=1){var a=e[s];r=r.concat(He[a.type](a.value))}return Rx&&Rx.set(e,r),r},wt.CHARSTRING=function(e){return He.CHARSTRING(e).length},He.OBJECT=function(e){var t=He[e.type];return bt.argument(t!==void 0,\\\"No encoding function for type \\\"+e.type),t(e.value)},wt.OBJECT=function(e){var t=wt[e.type];return bt.argument(t!==void 0,\\\"No sizeOf function for type \\\"+e.type),t(e.value)},He.TABLE=function(e){for(var t=[],r=e.fields.length,i=[],s=[],a=0;a\\u003cr;a+=1){var n=e.fields[a],o=He[n.type];bt.argument(o!==void 0,\\\"No encoding function for field type \\\"+n.type+\\\" (\\\"+n.name+\\\")\\\");var l=e[n.name];l===void 0&&(l=n.value);var u=o(l);n.type===\\\"TABLE\\\"?(s.push(t.length),t=t.concat([0,0]),i.push(u)):t=t.concat(u)}for(var h=0;h\\u003ci.length;h+=1){var d=s[h],c=t.length;bt.argument(c\\u003c65536,\\\"Table \\\"+e.tableName+\\\" too big.\\\"),t[d]=c>>8,t[d+1]=c&255,t=t.concat(i[h])}return t},wt.TABLE=function(e){for(var t=0,r=e.fields.length,i=0;i\\u003cr;i+=1){var s=e.fields[i],a=wt[s.type];bt.argument(a!==void 0,\\\"No sizeOf function for field type \\\"+s.type+\\\" (\\\"+s.name+\\\")\\\");var n=e[s.name];n===void 0&&(n=s.value),t+=a(n),s.type===\\\"TABLE\\\"&&(t+=2)}return t},He.RECORD=He.TABLE,wt.RECORD=wt.TABLE,He.LITERAL=function(e){return e},wt.LITERAL=function(e){return e.length};function Ii(e,t,r){if(t.length&&(t[0].name!==\\\"coverageFormat\\\"||t[0].value===1))for(var i=0;i\\u003ct.length;i+=1){var s=t[i];this[s.name]=s.value}if(this.tableName=e,this.fields=t,r)for(var a=Object.keys(r),n=0;n\\u003ca.length;n+=1){var o=a[n],l=r[o];this[o]!==void 0&&(this[o]=l)}}Ii.prototype.encode=function(){return He.TABLE(this)},Ii.prototype.sizeOf=function(){return wt.TABLE(this)};function af(e,t,r){r===void 0&&(r=t.length);var i=new Array(t.length+1);i[0]={name:e+\\\"Count\\\",type:\\\"USHORT\\\",value:r};for(var s=0;s\\u003ct.length;s++)i[s+1]={name:e+s,type:\\\"USHORT\\\",value:t[s]};return i}function M2(e,t,r){var i=t.length,s=new Array(i+1);s[0]={name:e+\\\"Count\\\",type:\\\"USHORT\\\",value:i};for(var a=0;a\\u003ci;a++)s[a+1]={name:e+a,type:\\\"TABLE\\\",value:r(t[a],a)};return s}function nf(e,t,r){var i=t.length,s=[];s[0]={name:e+\\\"Count\\\",type:\\\"USHORT\\\",value:i};for(var a=0;a\\u003ci;a++)s=s.concat(r(t[a],a));return s}function Ex(e){e.format===1?Ii.call(this,\\\"coverageTable\\\",[{name:\\\"coverageFormat\\\",type:\\\"USHORT\\\",value:1}].concat(af(\\\"glyph\\\",e.glyphs))):e.format===2?Ii.call(this,\\\"coverageTable\\\",[{name:\\\"coverageFormat\\\",type:\\\"USHORT\\\",value:2}].concat(nf(\\\"rangeRecord\\\",e.ranges,function(t){return[{name:\\\"startGlyphID\\\",type:\\\"USHORT\\\",value:t.start},{name:\\\"endGlyphID\\\",type:\\\"USHORT\\\",value:t.end},{name:\\\"startCoverageIndex\\\",type:\\\"USHORT\\\",value:t.index}]}))):bt.assert(!1,\\\"Coverage format must be 1 or 2.\\\")}Ex.prototype=Object.create(Ii.prototype),Ex.prototype.constructor=Ex;function Px(e){Ii.call(this,\\\"scriptListTable\\\",nf(\\\"scriptRecord\\\",e,function(t,r){var i=t.script,s=i.defaultLangSys;return bt.assert(!!s,\\\"Unable to write GSUB: script \\\"+t.tag+\\\" has no default language system.\\\"),[{name:\\\"scriptTag\\\"+r,type:\\\"TAG\\\",value:t.tag},{name:\\\"script\\\"+r,type:\\\"TABLE\\\",value:new Ii(\\\"scriptTable\\\",[{name:\\\"defaultLangSys\\\",type:\\\"TABLE\\\",value:new Ii(\\\"defaultLangSys\\\",[{name:\\\"lookupOrder\\\",type:\\\"USHORT\\\",value:0},{name:\\\"reqFeatureIndex\\\",type:\\\"USHORT\\\",value:s.reqFeatureIndex}].concat(af(\\\"featureIndex\\\",s.featureIndexes)))}].concat(nf(\\\"langSys\\\",i.langSysRecords,function(a,n){var o=a.langSys;return[{name:\\\"langSysTag\\\"+n,type:\\\"TAG\\\",value:a.tag},{name:\\\"langSys\\\"+n,type:\\\"TABLE\\\",value:new Ii(\\\"langSys\\\",[{name:\\\"lookupOrder\\\",type:\\\"USHORT\\\",value:0},{name:\\\"reqFeatureIndex\\\",type:\\\"USHORT\\\",value:o.reqFeatureIndex}].concat(af(\\\"featureIndex\\\",o.featureIndexes)))}]})))}]}))}Px.prototype=Object.create(Ii.prototype),Px.prototype.constructor=Px;function Bx(e){Ii.call(this,\\\"featureListTable\\\",nf(\\\"featureRecord\\\",e,function(t,r){var i=t.feature;return[{name:\\\"featureTag\\\"+r,type:\\\"TAG\\\",value:t.tag},{name:\\\"feature\\\"+r,type:\\\"TABLE\\\",value:new Ii(\\\"featureTable\\\",[{name:\\\"featureParams\\\",type:\\\"USHORT\\\",value:i.featureParams}].concat(af(\\\"lookupListIndex\\\",i.lookupListIndexes)))}]}))}Bx.prototype=Object.create(Ii.prototype),Bx.prototype.constructor=Bx;function Ix(e,t){Ii.call(this,\\\"lookupListTable\\\",M2(\\\"lookup\\\",e,function(r){var i=t[r.lookupType];return bt.assert(!!i,\\\"Unable to write GSUB lookup type \\\"+r.lookupType+\\\" tables.\\\"),new Ii(\\\"lookupTable\\\",[{name:\\\"lookupType\\\",type:\\\"USHORT\\\",value:r.lookupType},{name:\\\"lookupFlag\\\",type:\\\"USHORT\\\",value:r.lookupFlag}].concat(M2(\\\"subtable\\\",r.subtables,i)))}))}Ix.prototype=Object.create(Ii.prototype),Ix.prototype.constructor=Ix;var rt={Table:Ii,Record:Ii,Coverage:Ex,ScriptList:Px,FeatureList:Bx,LookupList:Ix,ushortList:af,tableList:M2,recordList:nf};function cL(e,t){return e.getUint8(t)}function Fx(e,t){return e.getUint16(t,!1)}function $ce(e,t){return e.getInt16(t,!1)}function N2(e,t){return e.getUint32(t,!1)}function pL(e,t){var r=e.getInt16(t,!1),i=e.getUint16(t+2,!1);return r+i/65535}function qce(e,t){for(var r=\\\"\\\",i=t;i\\u003ct+4;i+=1)r+=String.fromCharCode(e.getInt8(i));return r}function Yce(e,t,r){for(var i=0,s=0;s\\u003cr;s+=1)i\\u003c\\u003c=8,i+=e.getUint8(t+s);return i}function Zce(e,t,r){for(var i=[],s=t;s\\u003cr;s+=1)i.push(e.getUint8(s));return i}function Jce(e){for(var t=\\\"\\\",r=0;r\\u003ce.length;r+=1)t+=String.fromCharCode(e[r]);return t}var Qce={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function ve(e,t){this.data=e,this.offset=t,this.relativeOffset=0}ve.prototype.parseByte=function(){var e=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},ve.prototype.parseChar=function(){var e=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},ve.prototype.parseCard8=ve.prototype.parseByte,ve.prototype.parseUShort=function(){var e=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},ve.prototype.parseCard16=ve.prototype.parseUShort,ve.prototype.parseSID=ve.prototype.parseUShort,ve.prototype.parseOffset16=ve.prototype.parseUShort,ve.prototype.parseShort=function(){var e=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},ve.prototype.parseF2Dot14=function(){var e=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,e},ve.prototype.parseULong=function(){var e=N2(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},ve.prototype.parseOffset32=ve.prototype.parseULong,ve.prototype.parseFixed=function(){var e=pL(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},ve.prototype.parseString=function(e){var t=this.data,r=this.offset+this.relativeOffset,i=\\\"\\\";this.relativeOffset+=e;for(var s=0;s\\u003ce;s++)i+=String.fromCharCode(t.getUint8(r+s));return i},ve.prototype.parseTag=function(){return this.parseString(4)},ve.prototype.parseLongDateTime=function(){var e=N2(this.data,this.offset+this.relativeOffset+4);return e-=2082844800,this.relativeOffset+=8,e},ve.prototype.parseVersion=function(e){var t=Fx(this.data,this.offset+this.relativeOffset),r=Fx(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,e===void 0&&(e=4096),t+r/e/10},ve.prototype.skip=function(e,t){t===void 0&&(t=1),this.relativeOffset+=Qce[e]*t},ve.prototype.parseULongList=function(e){e===void 0&&(e=this.parseULong());for(var t=new Array(e),r=this.data,i=this.offset+this.relativeOffset,s=0;s\\u003ce;s++)t[s]=r.getUint32(i),i+=4;return this.relativeOffset+=e*4,t},ve.prototype.parseOffset16List=ve.prototype.parseUShortList=function(e){e===void 0&&(e=this.parseUShort());for(var t=new Array(e),r=this.data,i=this.offset+this.relativeOffset,s=0;s\\u003ce;s++)t[s]=r.getUint16(i),i+=2;return this.relativeOffset+=e*2,t},ve.prototype.parseShortList=function(e){for(var t=new Array(e),r=this.data,i=this.offset+this.relativeOffset,s=0;s\\u003ce;s++)t[s]=r.getInt16(i),i+=2;return this.relativeOffset+=e*2,t},ve.prototype.parseByteList=function(e){for(var t=new Array(e),r=this.data,i=this.offset+this.relativeOffset,s=0;s\\u003ce;s++)t[s]=r.getUint8(i++);return this.relativeOffset+=e,t},ve.prototype.parseList=function(e,t){t||(t=e,e=this.parseUShort());for(var r=new Array(e),i=0;i\\u003ce;i++)r[i]=t.call(this);return r},ve.prototype.parseList32=function(e,t){t||(t=e,e=this.parseULong());for(var r=new Array(e),i=0;i\\u003ce;i++)r[i]=t.call(this);return r},ve.prototype.parseRecordList=function(e,t){t||(t=e,e=this.parseUShort());for(var r=new Array(e),i=Object.keys(t),s=0;s\\u003ce;s++){for(var a={},n=0;n\\u003ci.length;n++){var o=i[n],l=t[o];a[o]=l.call(this)}r[s]=a}return r},ve.prototype.parseRecordList32=function(e,t){t||(t=e,e=this.parseULong());for(var r=new Array(e),i=Object.keys(t),s=0;s\\u003ce;s++){for(var a={},n=0;n\\u003ci.length;n++){var o=i[n],l=t[o];a[o]=l.call(this)}r[s]=a}return r},ve.prototype.parseStruct=function(e){if(typeof e==\\\"function\\\")return e.call(this);for(var t=Object.keys(e),r={},i=0;i\\u003ct.length;i++){var s=t[i],a=e[s];r[s]=a.call(this)}return r},ve.prototype.parseValueRecord=function(e){if(e===void 0&&(e=this.parseUShort()),e!==0){var t={};return e&1&&(t.xPlacement=this.parseShort()),e&2&&(t.yPlacement=this.parseShort()),e&4&&(t.xAdvance=this.parseShort()),e&8&&(t.yAdvance=this.parseShort()),e&16&&(t.xPlaDevice=void 0,this.parseShort()),e&32&&(t.yPlaDevice=void 0,this.parseShort()),e&64&&(t.xAdvDevice=void 0,this.parseShort()),e&128&&(t.yAdvDevice=void 0,this.parseShort()),t}},ve.prototype.parseValueRecordList=function(){for(var e=this.parseUShort(),t=this.parseUShort(),r=new Array(t),i=0;i\\u003ct;i++)r[i]=this.parseValueRecord(e);return r},ve.prototype.parsePointer=function(e){var t=this.parseOffset16();if(t>0)return new ve(this.data,this.offset+t).parseStruct(e)},ve.prototype.parsePointer32=function(e){var t=this.parseOffset32();if(t>0)return new ve(this.data,this.offset+t).parseStruct(e)},ve.prototype.parseListOfLists=function(e){for(var t=this.parseOffset16List(),r=t.length,i=this.relativeOffset,s=new Array(r),a=0;a\\u003cr;a++){var n=t[a];if(n===0){s[a]=void 0;continue}if(this.relativeOffset=n,e){for(var o=this.parseOffset16List(),l=new Array(o.length),u=0;u\\u003co.length;u++)this.relativeOffset=n+o[u],l[u]=e.call(this);s[a]=l}else s[a]=this.parseUShortList()}return this.relativeOffset=i,s},ve.prototype.parseCoverage=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort(),r=this.parseUShort();if(t===1)return{format:1,glyphs:this.parseUShortList(r)};if(t===2){for(var i=new Array(r),s=0;s\\u003cr;s++)i[s]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:i}}throw new Error(\\\"0x\\\"+e.toString(16)+\\\": Coverage format must be 1 or 2.\\\")},ve.prototype.parseClassDef=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()};if(t===2)return{format:2,ranges:this.parseRecordList({start:ve.uShort,end:ve.uShort,classId:ve.uShort})};throw new Error(\\\"0x\\\"+e.toString(16)+\\\": ClassDef format must be 1 or 2.\\\")},ve.list=function(e,t){return function(){return this.parseList(e,t)}},ve.list32=function(e,t){return function(){return this.parseList32(e,t)}},ve.recordList=function(e,t){return function(){return this.parseRecordList(e,t)}},ve.recordList32=function(e,t){return function(){return this.parseRecordList32(e,t)}},ve.pointer=function(e){return function(){return this.parsePointer(e)}},ve.pointer32=function(e){return function(){return this.parsePointer32(e)}},ve.tag=ve.prototype.parseTag,ve.byte=ve.prototype.parseByte,ve.uShort=ve.offset16=ve.prototype.parseUShort,ve.uShortList=ve.prototype.parseUShortList,ve.uLong=ve.offset32=ve.prototype.parseULong,ve.uLongList=ve.prototype.parseULongList,ve.struct=ve.prototype.parseStruct,ve.coverage=ve.prototype.parseCoverage,ve.classDef=ve.prototype.parseClassDef;var mL={reserved:ve.uShort,reqFeatureIndex:ve.uShort,featureIndexes:ve.uShortList};ve.prototype.parseScriptList=function(){return this.parsePointer(ve.recordList({tag:ve.tag,script:ve.pointer({defaultLangSys:ve.pointer(mL),langSysRecords:ve.recordList({tag:ve.tag,langSys:ve.pointer(mL)})})}))||[]},ve.prototype.parseFeatureList=function(){return this.parsePointer(ve.recordList({tag:ve.tag,feature:ve.pointer({featureParams:ve.offset16,lookupListIndexes:ve.uShortList})}))||[]},ve.prototype.parseLookupList=function(e){return this.parsePointer(ve.list(ve.pointer(function(){var t=this.parseUShort();bt.argument(1\\u003c=t&&t\\u003c=9,\\\"GPOS/GSUB lookup type \\\"+t+\\\" unknown.\\\");var r=this.parseUShort(),i=r&16;return{lookupType:t,lookupFlag:r,subtables:this.parseList(ve.pointer(e[t])),markFilteringSet:i?this.parseUShort():void 0}})))||[]},ve.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){var e=this.parseUShort(),t=this.parseUShort();bt.argument(e===1&&t\\u003c1,\\\"GPOS/GSUB feature variations table unknown.\\\");var r=this.parseRecordList32({conditionSetOffset:ve.offset32,featureTableSubstitutionOffset:ve.offset32});return r})||[]};var ot={getByte:cL,getCard8:cL,getUShort:Fx,getCard16:Fx,getShort:$ce,getULong:N2,getFixed:pL,getTag:qce,getOffset:Yce,getBytes:Zce,bytesToString:Jce,Parser:ve};function Kce(e,t){t.parseUShort(),e.length=t.parseULong(),e.language=t.parseULong();var r;e.groupCount=r=t.parseULong(),e.glyphIndexMap={};for(var i=0;i\\u003cr;i+=1)for(var s=t.parseULong(),a=t.parseULong(),n=t.parseULong(),o=s;o\\u003c=a;o+=1)e.glyphIndexMap[o]=n,n++}function epe(e,t,r,i,s){e.length=t.parseUShort(),e.language=t.parseUShort();var a;e.segCount=a=t.parseUShort()>>1,t.skip(\\\"uShort\\\",3),e.glyphIndexMap={};for(var n=new ot.Parser(r,i+s+14),o=new ot.Parser(r,i+s+16+a*2),l=new ot.Parser(r,i+s+16+a*4),u=new ot.Parser(r,i+s+16+a*6),h=i+s+16+a*8,d=0;d\\u003ca-1;d+=1)for(var c=void 0,m=n.parseUShort(),g=o.parseUShort(),y=l.parseShort(),b=u.parseUShort(),v=g;v\\u003c=m;v+=1)b!==0?(h=u.offset+u.relativeOffset-2,h+=b,h+=(v-g)*2,c=ot.getUShort(r,h),c!==0&&(c=c+y&65535)):c=v+y&65535,e.glyphIndexMap[v]=c}function tpe(e,t){var r={};r.version=ot.getUShort(e,t),bt.argument(r.version===0,\\\"cmap table version should be 0.\\\"),r.numTables=ot.getUShort(e,t+2);for(var i=-1,s=r.numTables-1;s>=0;s-=1){var a=ot.getUShort(e,t+4+s*8),n=ot.getUShort(e,t+4+s*8+2);if(a===3&&(n===0||n===1||n===10)||a===0&&(n===0||n===1||n===2||n===3||n===4)){i=ot.getULong(e,t+4+s*8+4);break}}if(i===-1)throw new Error(\\\"No valid cmap sub-tables found.\\\");var o=new ot.Parser(e,t+i);if(r.format=o.parseUShort(),r.format===12)Kce(r,o);else if(r.format===4)epe(r,o,e,t,i);else throw new Error(\\\"Only format 4 and 12 cmap tables are supported (found format \\\"+r.format+\\\").\\\");return r}function rpe(e,t,r){e.segments.push({end:t,start:t,delta:-(t-r),offset:0,glyphIndex:r})}function ipe(e){e.segments.push({end:65535,start:65535,delta:1,offset:0})}function spe(e){var t=!0,r;for(r=e.length-1;r>0;r-=1){var i=e.get(r);if(i.unicode>65535){console.log(\\\"Adding CMAP format 12 (needed!)\\\"),t=!1;break}}var s=[{name:\\\"version\\\",type:\\\"USHORT\\\",value:0},{name:\\\"numTables\\\",type:\\\"USHORT\\\",value:t?1:2},{name:\\\"platformID\\\",type:\\\"USHORT\\\",value:3},{name:\\\"encodingID\\\",type:\\\"USHORT\\\",value:1},{name:\\\"offset\\\",type:\\\"ULONG\\\",value:t?12:20}];t||(s=s.concat([{name:\\\"cmap12PlatformID\\\",type:\\\"USHORT\\\",value:3},{name:\\\"cmap12EncodingID\\\",type:\\\"USHORT\\\",value:10},{name:\\\"cmap12Offset\\\",type:\\\"ULONG\\\",value:0}])),s=s.concat([{name:\\\"format\\\",type:\\\"USHORT\\\",value:4},{name:\\\"cmap4Length\\\",type:\\\"USHORT\\\",value:0},{name:\\\"language\\\",type:\\\"USHORT\\\",value:0},{name:\\\"segCountX2\\\",type:\\\"USHORT\\\",value:0},{name:\\\"searchRange\\\",type:\\\"USHORT\\\",value:0},{name:\\\"entrySelector\\\",type:\\\"USHORT\\\",value:0},{name:\\\"rangeShift\\\",type:\\\"USHORT\\\",value:0}]);var a=new rt.Table(\\\"cmap\\\",s);for(a.segments=[],r=0;r\\u003ce.length;r+=1){for(var n=e.get(r),o=0;o\\u003cn.unicodes.length;o+=1)rpe(a,n.unicodes[o],r);a.segments=a.segments.sort(function(S,T){return S.start-T.start})}ipe(a);var l=a.segments.length,u=0,h=[],d=[],c=[],m=[],g=[],y=[];for(r=0;r\\u003cl;r+=1){var b=a.segments[r];b.end\\u003c=65535&&b.start\\u003c=65535?(h=h.concat({name:\\\"end_\\\"+r,type:\\\"USHORT\\\",value:b.end}),d=d.concat({name:\\\"start_\\\"+r,type:\\\"USHORT\\\",value:b.start}),c=c.concat({name:\\\"idDelta_\\\"+r,type:\\\"SHORT\\\",value:b.delta}),m=m.concat({name:\\\"idRangeOffset_\\\"+r,type:\\\"USHORT\\\",value:b.offset}),b.glyphId!==void 0&&(g=g.concat({name:\\\"glyph_\\\"+r,type:\\\"USHORT\\\",value:b.glyphId}))):u+=1,!t&&b.glyphIndex!==void 0&&(y=y.concat({name:\\\"cmap12Start_\\\"+r,type:\\\"ULONG\\\",value:b.start}),y=y.concat({name:\\\"cmap12End_\\\"+r,type:\\\"ULONG\\\",value:b.end}),y=y.concat({name:\\\"cmap12Glyph_\\\"+r,type:\\\"ULONG\\\",value:b.glyphIndex}))}if(a.segCountX2=(l-u)*2,a.searchRange=Math.pow(2,Math.floor(Math.log(l-u)/Math.log(2)))*2,a.entrySelector=Math.log(a.searchRange/2)/Math.log(2),a.rangeShift=a.segCountX2-a.searchRange,a.fields=a.fields.concat(h),a.fields.push({name:\\\"reservedPad\\\",type:\\\"USHORT\\\",value:0}),a.fields=a.fields.concat(d),a.fields=a.fields.concat(c),a.fields=a.fields.concat(m),a.fields=a.fields.concat(g),a.cmap4Length=14+h.length*2+2+d.length*2+c.length*2+m.length*2+g.length*2,!t){var v=16+y.length*4;a.cmap12Offset=20+a.cmap4Length,a.fields=a.fields.concat([{name:\\\"cmap12Format\\\",type:\\\"USHORT\\\",value:12},{name:\\\"cmap12Reserved\\\",type:\\\"USHORT\\\",value:0},{name:\\\"cmap12Length\\\",type:\\\"ULONG\\\",value:v},{name:\\\"cmap12Language\\\",type:\\\"ULONG\\\",value:0},{name:\\\"cmap12nGroups\\\",type:\\\"ULONG\\\",value:y.length/3}]),a.fields=a.fields.concat(y)}return a}var fL={parse:tpe,make:spe},Lx=[\\\".notdef\\\",\\\"space\\\",\\\"exclam\\\",\\\"quotedbl\\\",\\\"numbersign\\\",\\\"dollar\\\",\\\"percent\\\",\\\"ampersand\\\",\\\"quoteright\\\",\\\"parenleft\\\",\\\"parenright\\\",\\\"asterisk\\\",\\\"plus\\\",\\\"comma\\\",\\\"hyphen\\\",\\\"period\\\",\\\"slash\\\",\\\"zero\\\",\\\"one\\\",\\\"two\\\",\\\"three\\\",\\\"four\\\",\\\"five\\\",\\\"six\\\",\\\"seven\\\",\\\"eight\\\",\\\"nine\\\",\\\"colon\\\",\\\"semicolon\\\",\\\"less\\\",\\\"equal\\\",\\\"greater\\\",\\\"question\\\",\\\"at\\\",\\\"A\\\",\\\"B\\\",\\\"C\\\",\\\"D\\\",\\\"E\\\",\\\"F\\\",\\\"G\\\",\\\"H\\\",\\\"I\\\",\\\"J\\\",\\\"K\\\",\\\"L\\\",\\\"M\\\",\\\"N\\\",\\\"O\\\",\\\"P\\\",\\\"Q\\\",\\\"R\\\",\\\"S\\\",\\\"T\\\",\\\"U\\\",\\\"V\\\",\\\"W\\\",\\\"X\\\",\\\"Y\\\",\\\"Z\\\",\\\"bracketleft\\\",\\\"backslash\\\",\\\"bracketright\\\",\\\"asciicircum\\\",\\\"underscore\\\",\\\"quoteleft\\\",\\\"a\\\",\\\"b\\\",\\\"c\\\",\\\"d\\\",\\\"e\\\",\\\"f\\\",\\\"g\\\",\\\"h\\\",\\\"i\\\",\\\"j\\\",\\\"k\\\",\\\"l\\\",\\\"m\\\",\\\"n\\\",\\\"o\\\",\\\"p\\\",\\\"q\\\",\\\"r\\\",\\\"s\\\",\\\"t\\\",\\\"u\\\",\\\"v\\\",\\\"w\\\",\\\"x\\\",\\\"y\\\",\\\"z\\\",\\\"braceleft\\\",\\\"bar\\\",\\\"braceright\\\",\\\"asciitilde\\\",\\\"exclamdown\\\",\\\"cent\\\",\\\"sterling\\\",\\\"fraction\\\",\\\"yen\\\",\\\"florin\\\",\\\"section\\\",\\\"currency\\\",\\\"quotesingle\\\",\\\"quotedblleft\\\",\\\"guillemotleft\\\",\\\"guilsinglleft\\\",\\\"guilsinglright\\\",\\\"fi\\\",\\\"fl\\\",\\\"endash\\\",\\\"dagger\\\",\\\"daggerdbl\\\",\\\"periodcentered\\\",\\\"paragraph\\\",\\\"bullet\\\",\\\"quotesinglbase\\\",\\\"quotedblbase\\\",\\\"quotedblright\\\",\\\"guillemotright\\\",\\\"ellipsis\\\",\\\"perthousand\\\",\\\"questiondown\\\",\\\"grave\\\",\\\"acute\\\",\\\"circumflex\\\",\\\"tilde\\\",\\\"macron\\\",\\\"breve\\\",\\\"dotaccent\\\",\\\"dieresis\\\",\\\"ring\\\",\\\"cedilla\\\",\\\"hungarumlaut\\\",\\\"ogonek\\\",\\\"caron\\\",\\\"emdash\\\",\\\"AE\\\",\\\"ordfeminine\\\",\\\"Lslash\\\",\\\"Oslash\\\",\\\"OE\\\",\\\"ordmasculine\\\",\\\"ae\\\",\\\"dotlessi\\\",\\\"lslash\\\",\\\"oslash\\\",\\\"oe\\\",\\\"germandbls\\\",\\\"onesuperior\\\",\\\"logicalnot\\\",\\\"mu\\\",\\\"trademark\\\",\\\"Eth\\\",\\\"onehalf\\\",\\\"plusminus\\\",\\\"Thorn\\\",\\\"onequarter\\\",\\\"divide\\\",\\\"brokenbar\\\",\\\"degree\\\",\\\"thorn\\\",\\\"threequarters\\\",\\\"twosuperior\\\",\\\"registered\\\",\\\"minus\\\",\\\"eth\\\",\\\"multiply\\\",\\\"threesuperior\\\",\\\"copyright\\\",\\\"Aacute\\\",\\\"Acircumflex\\\",\\\"Adieresis\\\",\\\"Agrave\\\",\\\"Aring\\\",\\\"Atilde\\\",\\\"Ccedilla\\\",\\\"Eacute\\\",\\\"Ecircumflex\\\",\\\"Edieresis\\\",\\\"Egrave\\\",\\\"Iacute\\\",\\\"Icircumflex\\\",\\\"Idieresis\\\",\\\"Igrave\\\",\\\"Ntilde\\\",\\\"Oacute\\\",\\\"Ocircumflex\\\",\\\"Odieresis\\\",\\\"Ograve\\\",\\\"Otilde\\\",\\\"Scaron\\\",\\\"Uacute\\\",\\\"Ucircumflex\\\",\\\"Udieresis\\\",\\\"Ugrave\\\",\\\"Yacute\\\",\\\"Ydieresis\\\",\\\"Zcaron\\\",\\\"aacute\\\",\\\"acircumflex\\\",\\\"adieresis\\\",\\\"agrave\\\",\\\"aring\\\",\\\"atilde\\\",\\\"ccedilla\\\",\\\"eacute\\\",\\\"ecircumflex\\\",\\\"edieresis\\\",\\\"egrave\\\",\\\"iacute\\\",\\\"icircumflex\\\",\\\"idieresis\\\",\\\"igrave\\\",\\\"ntilde\\\",\\\"oacute\\\",\\\"ocircumflex\\\",\\\"odieresis\\\",\\\"ograve\\\",\\\"otilde\\\",\\\"scaron\\\",\\\"uacute\\\",\\\"ucircumflex\\\",\\\"udieresis\\\",\\\"ugrave\\\",\\\"yacute\\\",\\\"ydieresis\\\",\\\"zcaron\\\",\\\"exclamsmall\\\",\\\"Hungarumlautsmall\\\",\\\"dollaroldstyle\\\",\\\"dollarsuperior\\\",\\\"ampersandsmall\\\",\\\"Acutesmall\\\",\\\"parenleftsuperior\\\",\\\"parenrightsuperior\\\",\\\"266 ff\\\",\\\"onedotenleader\\\",\\\"zerooldstyle\\\",\\\"oneoldstyle\\\",\\\"twooldstyle\\\",\\\"threeoldstyle\\\",\\\"fouroldstyle\\\",\\\"fiveoldstyle\\\",\\\"sixoldstyle\\\",\\\"sevenoldstyle\\\",\\\"eightoldstyle\\\",\\\"nineoldstyle\\\",\\\"commasuperior\\\",\\\"threequartersemdash\\\",\\\"periodsuperior\\\",\\\"questionsmall\\\",\\\"asuperior\\\",\\\"bsuperior\\\",\\\"centsuperior\\\",\\\"dsuperior\\\",\\\"esuperior\\\",\\\"isuperior\\\",\\\"lsuperior\\\",\\\"msuperior\\\",\\\"nsuperior\\\",\\\"osuperior\\\",\\\"rsuperior\\\",\\\"ssuperior\\\",\\\"tsuperior\\\",\\\"ff\\\",\\\"ffi\\\",\\\"ffl\\\",\\\"parenleftinferior\\\",\\\"parenrightinferior\\\",\\\"Circumflexsmall\\\",\\\"hyphensuperior\\\",\\\"Gravesmall\\\",\\\"Asmall\\\",\\\"Bsmall\\\",\\\"Csmall\\\",\\\"Dsmall\\\",\\\"Esmall\\\",\\\"Fsmall\\\",\\\"Gsmall\\\",\\\"Hsmall\\\",\\\"Ismall\\\",\\\"Jsmall\\\",\\\"Ksmall\\\",\\\"Lsmall\\\",\\\"Msmall\\\",\\\"Nsmall\\\",\\\"Osmall\\\",\\\"Psmall\\\",\\\"Qsmall\\\",\\\"Rsmall\\\",\\\"Ssmall\\\",\\\"Tsmall\\\",\\\"Usmall\\\",\\\"Vsmall\\\",\\\"Wsmall\\\",\\\"Xsmall\\\",\\\"Ysmall\\\",\\\"Zsmall\\\",\\\"colonmonetary\\\",\\\"onefitted\\\",\\\"rupiah\\\",\\\"Tildesmall\\\",\\\"exclamdownsmall\\\",\\\"centoldstyle\\\",\\\"Lslashsmall\\\",\\\"Scaronsmall\\\",\\\"Zcaronsmall\\\",\\\"Dieresissmall\\\",\\\"Brevesmall\\\",\\\"Caronsmall\\\",\\\"Dotaccentsmall\\\",\\\"Macronsmall\\\",\\\"figuredash\\\",\\\"hypheninferior\\\",\\\"Ogoneksmall\\\",\\\"Ringsmall\\\",\\\"Cedillasmall\\\",\\\"questiondownsmall\\\",\\\"oneeighth\\\",\\\"threeeighths\\\",\\\"fiveeighths\\\",\\\"seveneighths\\\",\\\"onethird\\\",\\\"twothirds\\\",\\\"zerosuperior\\\",\\\"foursuperior\\\",\\\"fivesuperior\\\",\\\"sixsuperior\\\",\\\"sevensuperior\\\",\\\"eightsuperior\\\",\\\"ninesuperior\\\",\\\"zeroinferior\\\",\\\"oneinferior\\\",\\\"twoinferior\\\",\\\"threeinferior\\\",\\\"fourinferior\\\",\\\"fiveinferior\\\",\\\"sixinferior\\\",\\\"seveninferior\\\",\\\"eightinferior\\\",\\\"nineinferior\\\",\\\"centinferior\\\",\\\"dollarinferior\\\",\\\"periodinferior\\\",\\\"commainferior\\\",\\\"Agravesmall\\\",\\\"Aacutesmall\\\",\\\"Acircumflexsmall\\\",\\\"Atildesmall\\\",\\\"Adieresissmall\\\",\\\"Aringsmall\\\",\\\"AEsmall\\\",\\\"Ccedillasmall\\\",\\\"Egravesmall\\\",\\\"Eacutesmall\\\",\\\"Ecircumflexsmall\\\",\\\"Edieresissmall\\\",\\\"Igravesmall\\\",\\\"Iacutesmall\\\",\\\"Icircumflexsmall\\\",\\\"Idieresissmall\\\",\\\"Ethsmall\\\",\\\"Ntildesmall\\\",\\\"Ogravesmall\\\",\\\"Oacutesmall\\\",\\\"Ocircumflexsmall\\\",\\\"Otildesmall\\\",\\\"Odieresissmall\\\",\\\"OEsmall\\\",\\\"Oslashsmall\\\",\\\"Ugravesmall\\\",\\\"Uacutesmall\\\",\\\"Ucircumflexsmall\\\",\\\"Udieresissmall\\\",\\\"Yacutesmall\\\",\\\"Thornsmall\\\",\\\"Ydieresissmall\\\",\\\"001.000\\\",\\\"001.001\\\",\\\"001.002\\\",\\\"001.003\\\",\\\"Black\\\",\\\"Bold\\\",\\\"Book\\\",\\\"Light\\\",\\\"Medium\\\",\\\"Regular\\\",\\\"Roman\\\",\\\"Semibold\\\"],ape=[\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"space\\\",\\\"exclam\\\",\\\"quotedbl\\\",\\\"numbersign\\\",\\\"dollar\\\",\\\"percent\\\",\\\"ampersand\\\",\\\"quoteright\\\",\\\"parenleft\\\",\\\"parenright\\\",\\\"asterisk\\\",\\\"plus\\\",\\\"comma\\\",\\\"hyphen\\\",\\\"period\\\",\\\"slash\\\",\\\"zero\\\",\\\"one\\\",\\\"two\\\",\\\"three\\\",\\\"four\\\",\\\"five\\\",\\\"six\\\",\\\"seven\\\",\\\"eight\\\",\\\"nine\\\",\\\"colon\\\",\\\"semicolon\\\",\\\"less\\\",\\\"equal\\\",\\\"greater\\\",\\\"question\\\",\\\"at\\\",\\\"A\\\",\\\"B\\\",\\\"C\\\",\\\"D\\\",\\\"E\\\",\\\"F\\\",\\\"G\\\",\\\"H\\\",\\\"I\\\",\\\"J\\\",\\\"K\\\",\\\"L\\\",\\\"M\\\",\\\"N\\\",\\\"O\\\",\\\"P\\\",\\\"Q\\\",\\\"R\\\",\\\"S\\\",\\\"T\\\",\\\"U\\\",\\\"V\\\",\\\"W\\\",\\\"X\\\",\\\"Y\\\",\\\"Z\\\",\\\"bracketleft\\\",\\\"backslash\\\",\\\"bracketright\\\",\\\"asciicircum\\\",\\\"underscore\\\",\\\"quoteleft\\\",\\\"a\\\",\\\"b\\\",\\\"c\\\",\\\"d\\\",\\\"e\\\",\\\"f\\\",\\\"g\\\",\\\"h\\\",\\\"i\\\",\\\"j\\\",\\\"k\\\",\\\"l\\\",\\\"m\\\",\\\"n\\\",\\\"o\\\",\\\"p\\\",\\\"q\\\",\\\"r\\\",\\\"s\\\",\\\"t\\\",\\\"u\\\",\\\"v\\\",\\\"w\\\",\\\"x\\\",\\\"y\\\",\\\"z\\\",\\\"braceleft\\\",\\\"bar\\\",\\\"braceright\\\",\\\"asciitilde\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"exclamdown\\\",\\\"cent\\\",\\\"sterling\\\",\\\"fraction\\\",\\\"yen\\\",\\\"florin\\\",\\\"section\\\",\\\"currency\\\",\\\"quotesingle\\\",\\\"quotedblleft\\\",\\\"guillemotleft\\\",\\\"guilsinglleft\\\",\\\"guilsinglright\\\",\\\"fi\\\",\\\"fl\\\",\\\"\\\",\\\"endash\\\",\\\"dagger\\\",\\\"daggerdbl\\\",\\\"periodcentered\\\",\\\"\\\",\\\"paragraph\\\",\\\"bullet\\\",\\\"quotesinglbase\\\",\\\"quotedblbase\\\",\\\"quotedblright\\\",\\\"guillemotright\\\",\\\"ellipsis\\\",\\\"perthousand\\\",\\\"\\\",\\\"questiondown\\\",\\\"\\\",\\\"grave\\\",\\\"acute\\\",\\\"circumflex\\\",\\\"tilde\\\",\\\"macron\\\",\\\"breve\\\",\\\"dotaccent\\\",\\\"dieresis\\\",\\\"\\\",\\\"ring\\\",\\\"cedilla\\\",\\\"\\\",\\\"hungarumlaut\\\",\\\"ogonek\\\",\\\"caron\\\",\\\"emdash\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"AE\\\",\\\"\\\",\\\"ordfeminine\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"Lslash\\\",\\\"Oslash\\\",\\\"OE\\\",\\\"ordmasculine\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"ae\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"dotlessi\\\",\\\"\\\",\\\"\\\",\\\"lslash\\\",\\\"oslash\\\",\\\"oe\\\",\\\"germandbls\\\"],npe=[\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"space\\\",\\\"exclamsmall\\\",\\\"Hungarumlautsmall\\\",\\\"\\\",\\\"dollaroldstyle\\\",\\\"dollarsuperior\\\",\\\"ampersandsmall\\\",\\\"Acutesmall\\\",\\\"parenleftsuperior\\\",\\\"parenrightsuperior\\\",\\\"twodotenleader\\\",\\\"onedotenleader\\\",\\\"comma\\\",\\\"hyphen\\\",\\\"period\\\",\\\"fraction\\\",\\\"zerooldstyle\\\",\\\"oneoldstyle\\\",\\\"twooldstyle\\\",\\\"threeoldstyle\\\",\\\"fouroldstyle\\\",\\\"fiveoldstyle\\\",\\\"sixoldstyle\\\",\\\"sevenoldstyle\\\",\\\"eightoldstyle\\\",\\\"nineoldstyle\\\",\\\"colon\\\",\\\"semicolon\\\",\\\"commasuperior\\\",\\\"threequartersemdash\\\",\\\"periodsuperior\\\",\\\"questionsmall\\\",\\\"\\\",\\\"asuperior\\\",\\\"bsuperior\\\",\\\"centsuperior\\\",\\\"dsuperior\\\",\\\"esuperior\\\",\\\"\\\",\\\"\\\",\\\"isuperior\\\",\\\"\\\",\\\"\\\",\\\"lsuperior\\\",\\\"msuperior\\\",\\\"nsuperior\\\",\\\"osuperior\\\",\\\"\\\",\\\"\\\",\\\"rsuperior\\\",\\\"ssuperior\\\",\\\"tsuperior\\\",\\\"\\\",\\\"ff\\\",\\\"fi\\\",\\\"fl\\\",\\\"ffi\\\",\\\"ffl\\\",\\\"parenleftinferior\\\",\\\"\\\",\\\"parenrightinferior\\\",\\\"Circumflexsmall\\\",\\\"hyphensuperior\\\",\\\"Gravesmall\\\",\\\"Asmall\\\",\\\"Bsmall\\\",\\\"Csmall\\\",\\\"Dsmall\\\",\\\"Esmall\\\",\\\"Fsmall\\\",\\\"Gsmall\\\",\\\"Hsmall\\\",\\\"Ismall\\\",\\\"Jsmall\\\",\\\"Ksmall\\\",\\\"Lsmall\\\",\\\"Msmall\\\",\\\"Nsmall\\\",\\\"Osmall\\\",\\\"Psmall\\\",\\\"Qsmall\\\",\\\"Rsmall\\\",\\\"Ssmall\\\",\\\"Tsmall\\\",\\\"Usmall\\\",\\\"Vsmall\\\",\\\"Wsmall\\\",\\\"Xsmall\\\",\\\"Ysmall\\\",\\\"Zsmall\\\",\\\"colonmonetary\\\",\\\"onefitted\\\",\\\"rupiah\\\",\\\"Tildesmall\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"exclamdownsmall\\\",\\\"centoldstyle\\\",\\\"Lslashsmall\\\",\\\"\\\",\\\"\\\",\\\"Scaronsmall\\\",\\\"Zcaronsmall\\\",\\\"Dieresissmall\\\",\\\"Brevesmall\\\",\\\"Caronsmall\\\",\\\"\\\",\\\"Dotaccentsmall\\\",\\\"\\\",\\\"\\\",\\\"Macronsmall\\\",\\\"\\\",\\\"\\\",\\\"figuredash\\\",\\\"hypheninferior\\\",\\\"\\\",\\\"\\\",\\\"Ogoneksmall\\\",\\\"Ringsmall\\\",\\\"Cedillasmall\\\",\\\"\\\",\\\"\\\",\\\"\\\",\\\"onequarter\\\",\\\"onehalf\\\",\\\"threequarters\\\",\\\"questiondownsmall\\\",\\\"oneeighth\\\",\\\"threeeighths\\\",\\\"fiveeighths\\\",\\\"seveneighths\\\",\\\"onethird\\\",\\\"twothirds\\\",\\\"\\\",\\\"\\\",\\\"zerosuperior\\\",\\\"onesuperior\\\",\\\"twosuperior\\\",\\\"threesuperior\\\",\\\"foursuperior\\\",\\\"fivesuperior\\\",\\\"sixsuperior\\\",\\\"sevensuperior\\\",\\\"eightsuperior\\\",\\\"ninesuperior\\\",\\\"zeroinferior\\\",\\\"oneinferior\\\",\\\"twoinferior\\\",\\\"threeinferior\\\",\\\"fourinferior\\\",\\\"fiveinferior\\\",\\\"sixinferior\\\",\\\"seveninferior\\\",\\\"eightinferior\\\",\\\"nineinferior\\\",\\\"centinferior\\\",\\\"dollarinferior\\\",\\\"periodinferior\\\",\\\"commainferior\\\",\\\"Agravesmall\\\",\\\"Aacutesmall\\\",\\\"Acircumflexsmall\\\",\\\"Atildesmall\\\",\\\"Adieresissmall\\\",\\\"Aringsmall\\\",\\\"AEsmall\\\",\\\"Ccedillasmall\\\",\\\"Egravesmall\\\",\\\"Eacutesmall\\\",\\\"Ecircumflexsmall\\\",\\\"Edieresissmall\\\",\\\"Igravesmall\\\",\\\"Iacutesmall\\\",\\\"Icircumflexsmall\\\",\\\"Idieresissmall\\\",\\\"Ethsmall\\\",\\\"Ntildesmall\\\",\\\"Ogravesmall\\\",\\\"Oacutesmall\\\",\\\"Ocircumflexsmall\\\",\\\"Otildesmall\\\",\\\"Odieresissmall\\\",\\\"OEsmall\\\",\\\"Oslashsmall\\\",\\\"Ugravesmall\\\",\\\"Uacutesmall\\\",\\\"Ucircumflexsmall\\\",\\\"Udieresissmall\\\",\\\"Yacutesmall\\\",\\\"Thornsmall\\\",\\\"Ydieresissmall\\\"],_h=[\\\".notdef\\\",\\\".null\\\",\\\"nonmarkingreturn\\\",\\\"space\\\",\\\"exclam\\\",\\\"quotedbl\\\",\\\"numbersign\\\",\\\"dollar\\\",\\\"percent\\\",\\\"ampersand\\\",\\\"quotesingle\\\",\\\"parenleft\\\",\\\"parenright\\\",\\\"asterisk\\\",\\\"plus\\\",\\\"comma\\\",\\\"hyphen\\\",\\\"period\\\",\\\"slash\\\",\\\"zero\\\",\\\"one\\\",\\\"two\\\",\\\"three\\\",\\\"four\\\",\\\"five\\\",\\\"six\\\",\\\"seven\\\",\\\"eight\\\",\\\"nine\\\",\\\"colon\\\",\\\"semicolon\\\",\\\"less\\\",\\\"equal\\\",\\\"greater\\\",\\\"question\\\",\\\"at\\\",\\\"A\\\",\\\"B\\\",\\\"C\\\",\\\"D\\\",\\\"E\\\",\\\"F\\\",\\\"G\\\",\\\"H\\\",\\\"I\\\",\\\"J\\\",\\\"K\\\",\\\"L\\\",\\\"M\\\",\\\"N\\\",\\\"O\\\",\\\"P\\\",\\\"Q\\\",\\\"R\\\",\\\"S\\\",\\\"T\\\",\\\"U\\\",\\\"V\\\",\\\"W\\\",\\\"X\\\",\\\"Y\\\",\\\"Z\\\",\\\"bracketleft\\\",\\\"backslash\\\",\\\"bracketright\\\",\\\"asciicircum\\\",\\\"underscore\\\",\\\"grave\\\",\\\"a\\\",\\\"b\\\",\\\"c\\\",\\\"d\\\",\\\"e\\\",\\\"f\\\",\\\"g\\\",\\\"h\\\",\\\"i\\\",\\\"j\\\",\\\"k\\\",\\\"l\\\",\\\"m\\\",\\\"n\\\",\\\"o\\\",\\\"p\\\",\\\"q\\\",\\\"r\\\",\\\"s\\\",\\\"t\\\",\\\"u\\\",\\\"v\\\",\\\"w\\\",\\\"x\\\",\\\"y\\\",\\\"z\\\",\\\"braceleft\\\",\\\"bar\\\",\\\"braceright\\\",\\\"asciitilde\\\",\\\"Adieresis\\\",\\\"Aring\\\",\\\"Ccedilla\\\",\\\"Eacute\\\",\\\"Ntilde\\\",\\\"Odieresis\\\",\\\"Udieresis\\\",\\\"aacute\\\",\\\"agrave\\\",\\\"acircumflex\\\",\\\"adieresis\\\",\\\"atilde\\\",\\\"aring\\\",\\\"ccedilla\\\",\\\"eacute\\\",\\\"egrave\\\",\\\"ecircumflex\\\",\\\"edieresis\\\",\\\"iacute\\\",\\\"igrave\\\",\\\"icircumflex\\\",\\\"idieresis\\\",\\\"ntilde\\\",\\\"oacute\\\",\\\"ograve\\\",\\\"ocircumflex\\\",\\\"odieresis\\\",\\\"otilde\\\",\\\"uacute\\\",\\\"ugrave\\\",\\\"ucircumflex\\\",\\\"udieresis\\\",\\\"dagger\\\",\\\"degree\\\",\\\"cent\\\",\\\"sterling\\\",\\\"section\\\",\\\"bullet\\\",\\\"paragraph\\\",\\\"germandbls\\\",\\\"registered\\\",\\\"copyright\\\",\\\"trademark\\\",\\\"acute\\\",\\\"dieresis\\\",\\\"notequal\\\",\\\"AE\\\",\\\"Oslash\\\",\\\"infinity\\\",\\\"plusminus\\\",\\\"lessequal\\\",\\\"greaterequal\\\",\\\"yen\\\",\\\"mu\\\",\\\"partialdiff\\\",\\\"summation\\\",\\\"product\\\",\\\"pi\\\",\\\"integral\\\",\\\"ordfeminine\\\",\\\"ordmasculine\\\",\\\"Omega\\\",\\\"ae\\\",\\\"oslash\\\",\\\"questiondown\\\",\\\"exclamdown\\\",\\\"logicalnot\\\",\\\"radical\\\",\\\"florin\\\",\\\"approxequal\\\",\\\"Delta\\\",\\\"guillemotleft\\\",\\\"guillemotright\\\",\\\"ellipsis\\\",\\\"nonbreakingspace\\\",\\\"Agrave\\\",\\\"Atilde\\\",\\\"Otilde\\\",\\\"OE\\\",\\\"oe\\\",\\\"endash\\\",\\\"emdash\\\",\\\"quotedblleft\\\",\\\"quotedblright\\\",\\\"quoteleft\\\",\\\"quoteright\\\",\\\"divide\\\",\\\"lozenge\\\",\\\"ydieresis\\\",\\\"Ydieresis\\\",\\\"fraction\\\",\\\"currency\\\",\\\"guilsinglleft\\\",\\\"guilsinglright\\\",\\\"fi\\\",\\\"fl\\\",\\\"daggerdbl\\\",\\\"periodcentered\\\",\\\"quotesinglbase\\\",\\\"quotedblbase\\\",\\\"perthousand\\\",\\\"Acircumflex\\\",\\\"Ecircumflex\\\",\\\"Aacute\\\",\\\"Edieresis\\\",\\\"Egrave\\\",\\\"Iacute\\\",\\\"Icircumflex\\\",\\\"Idieresis\\\",\\\"Igrave\\\",\\\"Oacute\\\",\\\"Ocircumflex\\\",\\\"apple\\\",\\\"Ograve\\\",\\\"Uacute\\\",\\\"Ucircumflex\\\",\\\"Ugrave\\\",\\\"dotlessi\\\",\\\"circumflex\\\",\\\"tilde\\\",\\\"macron\\\",\\\"breve\\\",\\\"dotaccent\\\",\\\"ring\\\",\\\"cedilla\\\",\\\"hungarumlaut\\\",\\\"ogonek\\\",\\\"caron\\\",\\\"Lslash\\\",\\\"lslash\\\",\\\"Scaron\\\",\\\"scaron\\\",\\\"Zcaron\\\",\\\"zcaron\\\",\\\"brokenbar\\\",\\\"Eth\\\",\\\"eth\\\",\\\"Yacute\\\",\\\"yacute\\\",\\\"Thorn\\\",\\\"thorn\\\",\\\"minus\\\",\\\"multiply\\\",\\\"onesuperior\\\",\\\"twosuperior\\\",\\\"threesuperior\\\",\\\"onehalf\\\",\\\"onequarter\\\",\\\"threequarters\\\",\\\"franc\\\",\\\"Gbreve\\\",\\\"gbreve\\\",\\\"Idotaccent\\\",\\\"Scedilla\\\",\\\"scedilla\\\",\\\"Cacute\\\",\\\"cacute\\\",\\\"Ccaron\\\",\\\"ccaron\\\",\\\"dcroat\\\"];function gL(e){this.font=e}gL.prototype.charToGlyphIndex=function(e){var t=e.codePointAt(0),r=this.font.glyphs;if(r){for(var i=0;i\\u003cr.length;i+=1)for(var s=r.get(i),a=0;a\\u003cs.unicodes.length;a+=1)if(s.unicodes[a]===t)return i}return null};function yL(e){this.cmap=e}yL.prototype.charToGlyphIndex=function(e){return this.cmap.glyphIndexMap[e.codePointAt(0)]||0};function kx(e,t){this.encoding=e,this.charset=t}kx.prototype.charToGlyphIndex=function(e){var t=e.codePointAt(0),r=this.encoding[t];return this.charset.indexOf(r)};function A2(e){switch(e.version){case 1:this.names=_h.slice();break;case 2:this.names=new Array(e.numberOfGlyphs);for(var t=0;t\\u003ce.numberOfGlyphs;t++)e.glyphNameIndex[t]\\u003c_h.length?this.names[t]=_h[e.glyphNameIndex[t]]:this.names[t]=e.names[e.glyphNameIndex[t]-_h.length];break;case 2.5:this.names=new Array(e.numberOfGlyphs);for(var r=0;r\\u003ce.numberOfGlyphs;r++)this.names[r]=_h[r+e.glyphNameIndex[r]];break;case 3:this.names=[];break;default:this.names=[];break}}A2.prototype.nameToGlyphIndex=function(e){return this.names.indexOf(e)},A2.prototype.glyphIndexToName=function(e){return this.names[e]};function ope(e){for(var t,r=e.tables.cmap.glyphIndexMap,i=Object.keys(r),s=0;s\\u003ci.length;s+=1){var a=i[s],n=r[a];t=e.glyphs.get(n),t.addUnicode(parseInt(a))}for(var o=0;o\\u003ce.glyphs.length;o+=1)t=e.glyphs.get(o),e.cffEncoding?e.isCIDFont?t.name=\\\"gid\\\"+o:t.name=e.cffEncoding.charset[o]:e.glyphNames.names&&(t.name=e.glyphNames.glyphIndexToName(o))}function lpe(e){e._IndexToUnicodeMap={};for(var t=e.tables.cmap.glyphIndexMap,r=Object.keys(t),i=0;i\\u003cr.length;i+=1){var s=r[i],a=t[s];e._IndexToUnicodeMap[a]===void 0?e._IndexToUnicodeMap[a]={unicodes:[parseInt(s)]}:e._IndexToUnicodeMap[a].unicodes.push(parseInt(s))}}function upe(e,t){t.lowMemory?lpe(e):ope(e)}function hpe(e,t,r,i,s){e.beginPath(),e.moveTo(t,r),e.lineTo(i,s),e.stroke()}var wh={line:hpe};function dpe(e,t){var r=t||new di;return{configurable:!0,get:function(){return typeof r==\\\"function\\\"&&(r=r()),r},set:function(i){r=i}}}function ia(e){this.bindConstructorValues(e)}ia.prototype.bindConstructorValues=function(e){this.index=e.index||0,this.name=e.name||null,this.unicode=e.unicode||void 0,this.unicodes=e.unicodes||e.unicode!==void 0?[e.unicode]:[],\\\"xMin\\\"in e&&(this.xMin=e.xMin),\\\"yMin\\\"in e&&(this.yMin=e.yMin),\\\"xMax\\\"in e&&(this.xMax=e.xMax),\\\"yMax\\\"in e&&(this.yMax=e.yMax),\\\"advanceWidth\\\"in e&&(this.advanceWidth=e.advanceWidth),Object.defineProperty(this,\\\"path\\\",dpe(this,e.path))},ia.prototype.addUnicode=function(e){this.unicodes.length===0&&(this.unicode=e),this.unicodes.push(e)},ia.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},ia.prototype.getPath=function(e,t,r,i,s){e=e!==void 0?e:0,t=t!==void 0?t:0,r=r!==void 0?r:72;var a,n;i||(i={});var o=i.xScale,l=i.yScale;if(i.hinting&&s&&s.hinting&&(n=this.path&&s.hinting.exec(this,r)),n)a=s.hinting.getCommands(n),e=Math.round(e),t=Math.round(t),o=l=1;else{a=this.path.commands;var u=1/(this.path.unitsPerEm||1e3)*r;o===void 0&&(o=u),l===void 0&&(l=u)}for(var h=new di,d=0;d\\u003ca.length;d+=1){var c=a[d];c.type===\\\"M\\\"?h.moveTo(e+c.x*o,t+-c.y*l):c.type===\\\"L\\\"?h.lineTo(e+c.x*o,t+-c.y*l):c.type===\\\"Q\\\"?h.quadraticCurveTo(e+c.x1*o,t+-c.y1*l,e+c.x*o,t+-c.y*l):c.type===\\\"C\\\"?h.curveTo(e+c.x1*o,t+-c.y1*l,e+c.x2*o,t+-c.y2*l,e+c.x*o,t+-c.y*l):c.type===\\\"Z\\\"&&h.closePath()}return h},ia.prototype.getContours=function(){if(this.points===void 0)return[];for(var e=[],t=[],r=0;r\\u003cthis.points.length;r+=1){var i=this.points[r];t.push(i),i.lastPointOfContour&&(e.push(t),t=[])}return bt.argument(t.length===0,\\\"There are still points left in the current contour.\\\"),e},ia.prototype.getMetrics=function(){for(var e=this.path.commands,t=[],r=[],i=0;i\\u003ce.length;i+=1){var s=e[i];s.type!==\\\"Z\\\"&&(t.push(s.x),r.push(s.y)),(s.type===\\\"Q\\\"||s.type===\\\"C\\\")&&(t.push(s.x1),r.push(s.y1)),s.type===\\\"C\\\"&&(t.push(s.x2),r.push(s.y2))}var a={xMin:Math.min.apply(null,t),yMin:Math.min.apply(null,r),xMax:Math.max.apply(null,t),yMax:Math.max.apply(null,r),leftSideBearing:this.leftSideBearing};return isFinite(a.xMin)||(a.xMin=0),isFinite(a.xMax)||(a.xMax=this.advanceWidth),isFinite(a.yMin)||(a.yMin=0),isFinite(a.yMax)||(a.yMax=0),a.rightSideBearing=this.advanceWidth-a.leftSideBearing-(a.xMax-a.xMin),a},ia.prototype.draw=function(e,t,r,i,s){this.getPath(t,r,i,s).draw(e)},ia.prototype.drawPoints=function(e,t,r,i){function s(d,c,m,g){e.beginPath();for(var y=0;y\\u003cd.length;y+=1)e.moveTo(c+d[y].x*g,m+d[y].y*g),e.arc(c+d[y].x*g,m+d[y].y*g,2,0,Math.PI*2,!1);e.closePath(),e.fill()}t=t!==void 0?t:0,r=r!==void 0?r:0,i=i!==void 0?i:24;for(var a=1/this.path.unitsPerEm*i,n=[],o=[],l=this.path,u=0;u\\u003cl.commands.length;u+=1){var h=l.commands[u];h.x!==void 0&&n.push({x:h.x,y:-h.y}),h.x1!==void 0&&o.push({x:h.x1,y:-h.y1}),h.x2!==void 0&&o.push({x:h.x2,y:-h.y2})}e.fillStyle=\\\"blue\\\",s(n,t,r,a),e.fillStyle=\\\"red\\\",s(o,t,r,a)},ia.prototype.drawMetrics=function(e,t,r,i){var s;t=t!==void 0?t:0,r=r!==void 0?r:0,i=i!==void 0?i:24,s=1/this.path.unitsPerEm*i,e.lineWidth=1,e.strokeStyle=\\\"black\\\",wh.line(e,t,-1e4,t,1e4),wh.line(e,-1e4,r,1e4,r);var a=this.xMin||0,n=this.yMin||0,o=this.xMax||0,l=this.yMax||0,u=this.advanceWidth||0;e.strokeStyle=\\\"blue\\\",wh.line(e,t+a*s,-1e4,t+a*s,1e4),wh.line(e,t+o*s,-1e4,t+o*s,1e4),wh.line(e,-1e4,r+-n*s,1e4,r+-n*s),wh.line(e,-1e4,r+-l*s,1e4,r+-l*s),e.strokeStyle=\\\"green\\\",wh.line(e,t+u*s,-1e4,t+u*s,1e4)};function Dx(e,t,r){Object.defineProperty(e,t,{get:function(){return e.path,e[r]},set:function(i){e[r]=i},enumerable:!0,configurable:!0})}function C2(e,t){if(this.font=e,this.glyphs={},Array.isArray(t))for(var r=0;r\\u003ct.length;r++){var i=t[r];i.path.unitsPerEm=e.unitsPerEm,this.glyphs[r]=i}this.length=t&&t.length||0}C2.prototype.get=function(e){if(this.glyphs[e]===void 0){this.font._push(e),typeof this.glyphs[e]==\\\"function\\\"&&(this.glyphs[e]=this.glyphs[e]());var t=this.glyphs[e],r=this.font._IndexToUnicodeMap[e];if(r)for(var i=0;i\\u003cr.unicodes.length;i++)t.addUnicode(r.unicodes[i]);this.font.cffEncoding?this.font.isCIDFont?t.name=\\\"gid\\\"+e:t.name=this.font.cffEncoding.charset[e]:this.font.glyphNames.names&&(t.name=this.font.glyphNames.glyphIndexToName(e)),this.glyphs[e].advanceWidth=this.font._hmtxTableData[e].advanceWidth,this.glyphs[e].leftSideBearing=this.font._hmtxTableData[e].leftSideBearing}else typeof this.glyphs[e]==\\\"function\\\"&&(this.glyphs[e]=this.glyphs[e]());return this.glyphs[e]},C2.prototype.push=function(e,t){this.glyphs[e]=t,this.length++};function cpe(e,t){return new ia({index:t,font:e})}function ppe(e,t,r,i,s,a){return function(){var n=new ia({index:t,font:e});return n.path=function(){r(n,i,s);var o=a(e.glyphs,n);return o.unitsPerEm=e.unitsPerEm,o},Dx(n,\\\"xMin\\\",\\\"_xMin\\\"),Dx(n,\\\"xMax\\\",\\\"_xMax\\\"),Dx(n,\\\"yMin\\\",\\\"_yMin\\\"),Dx(n,\\\"yMax\\\",\\\"_yMax\\\"),n}}function mpe(e,t,r,i){return function(){var s=new ia({index:t,font:e});return s.path=function(){var a=r(e,s,i);return a.unitsPerEm=e.unitsPerEm,a},s}}var Zn={GlyphSet:C2,glyphLoader:cpe,ttfGlyphLoader:ppe,cffGlyphLoader:mpe};function xL(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var r=0;r\\u003ce.length;r+=1)if(!xL(e[r],t[r]))return!1;return!0}else return!1}function R2(e){var t;return e.length\\u003c1240?t=107:e.length\\u003c33900?t=1131:t=32768,t}function ru(e,t,r){var i=[],s=[],a=ot.getCard16(e,t),n,o;if(a!==0){var l=ot.getByte(e,t+2);n=t+(a+1)*l+2;for(var u=t+3,h=0;h\\u003ca+1;h+=1)i.push(ot.getOffset(e,u,l)),u+=l;o=n+i[a]}else o=t+2;for(var d=0;d\\u003ci.length-1;d+=1){var c=ot.getBytes(e,n+i[d],n+i[d+1]);r&&(c=r(c)),s.push(c)}return{objects:s,startOffset:t,endOffset:o}}function fpe(e,t){var r=[],i=ot.getCard16(e,t),s,a;if(i!==0){var n=ot.getByte(e,t+2);s=t+(i+1)*n+2;for(var o=t+3,l=0;l\\u003ci+1;l+=1)r.push(ot.getOffset(e,o,n)),o+=n;a=s+r[i]}else a=t+2;return{offsets:r,startOffset:t,endOffset:a}}function gpe(e,t,r,i,s){var a=ot.getCard16(r,i),n=0;if(a!==0){var o=ot.getByte(r,i+2);n=i+(a+1)*o+2}var l=ot.getBytes(r,n+t[e],n+t[e+1]);return s&&(l=s(l)),l}function ype(e){for(var t=\\\"\\\",r=15,i=[\\\"0\\\",\\\"1\\\",\\\"2\\\",\\\"3\\\",\\\"4\\\",\\\"5\\\",\\\"6\\\",\\\"7\\\",\\\"8\\\",\\\"9\\\",\\\".\\\",\\\"E\\\",\\\"E-\\\",null,\\\"-\\\"];;){var s=e.parseByte(),a=s>>4,n=s&15;if(a===r||(t+=i[a],n===r))break;t+=i[n]}return parseFloat(t)}function xpe(e,t){var r,i,s,a;if(t===28)return r=e.parseByte(),i=e.parseByte(),r\\u003c\\u003c8|i;if(t===29)return r=e.parseByte(),i=e.parseByte(),s=e.parseByte(),a=e.parseByte(),r\\u003c\\u003c24|i\\u003c\\u003c16|s\\u003c\\u003c8|a;if(t===30)return ype(e);if(t>=32&&t\\u003c=246)return t-139;if(t>=247&&t\\u003c=250)return r=e.parseByte(),(t-247)*256+r+108;if(t>=251&&t\\u003c=254)return r=e.parseByte(),-(t-251)*256-r-108;throw new Error(\\\"Invalid b0 \\\"+t)}function vpe(e){for(var t={},r=0;r\\u003ce.length;r+=1){var i=e[r][0],s=e[r][1],a=void 0;if(s.length===1?a=s[0]:a=s,t.hasOwnProperty(i)&&!isNaN(t[i]))throw new Error(\\\"Object \\\"+t+\\\" already has key \\\"+i);t[i]=a}return t}function vL(e,t,r){t=t!==void 0?t:0;var i=new ot.Parser(e,t),s=[],a=[];for(r=r!==void 0?r:e.length;i.relativeOffset\\u003cr;){var n=i.parseByte();n\\u003c=21?(n===12&&(n=1200+i.parseByte()),s.push([n,a]),a=[]):a.push(xpe(i,n))}return vpe(s)}function of(e,t){return t\\u003c=390?t=Lx[t]:t=e[t-391],t}function bL(e,t,r){for(var i={},s,a=0;a\\u003ct.length;a+=1){var n=t[a];if(Array.isArray(n.type)){var o=[];o.length=n.type.length;for(var l=0;l\\u003cn.type.length;l++)s=e[n.op]!==void 0?e[n.op][l]:void 0,s===void 0&&(s=n.value!==void 0&&n.value[l]!==void 0?n.value[l]:null),n.type[l]===\\\"SID\\\"&&(s=of(r,s)),o[l]=s;i[n.name]=o}else s=e[n.op],s===void 0&&(s=n.value!==void 0?n.value:null),n.type===\\\"SID\\\"&&(s=of(r,s)),i[n.name]=s}return i}function bpe(e,t){var r={};return r.formatMajor=ot.getCard8(e,t),r.formatMinor=ot.getCard8(e,t+1),r.size=ot.getCard8(e,t+2),r.offsetSize=ot.getCard8(e,t+3),r.startOffset=t,r.endOffset=t+4,r}var TL=[{name:\\\"version\\\",op:0,type:\\\"SID\\\"},{name:\\\"notice\\\",op:1,type:\\\"SID\\\"},{name:\\\"copyright\\\",op:1200,type:\\\"SID\\\"},{name:\\\"fullName\\\",op:2,type:\\\"SID\\\"},{name:\\\"familyName\\\",op:3,type:\\\"SID\\\"},{name:\\\"weight\\\",op:4,type:\\\"SID\\\"},{name:\\\"isFixedPitch\\\",op:1201,type:\\\"number\\\",value:0},{name:\\\"italicAngle\\\",op:1202,type:\\\"number\\\",value:0},{name:\\\"underlinePosition\\\",op:1203,type:\\\"number\\\",value:-100},{name:\\\"underlineThickness\\\",op:1204,type:\\\"number\\\",value:50},{name:\\\"paintType\\\",op:1205,type:\\\"number\\\",value:0},{name:\\\"charstringType\\\",op:1206,type:\\\"number\\\",value:2},{name:\\\"fontMatrix\\\",op:1207,type:[\\\"real\\\",\\\"real\\\",\\\"real\\\",\\\"real\\\",\\\"real\\\",\\\"real\\\"],value:[.001,0,0,.001,0,0]},{name:\\\"uniqueId\\\",op:13,type:\\\"number\\\"},{name:\\\"fontBBox\\\",op:5,type:[\\\"number\\\",\\\"number\\\",\\\"number\\\",\\\"number\\\"],value:[0,0,0,0]},{name:\\\"strokeWidth\\\",op:1208,type:\\\"number\\\",value:0},{name:\\\"xuid\\\",op:14,type:[],value:null},{name:\\\"charset\\\",op:15,type:\\\"offset\\\",value:0},{name:\\\"encoding\\\",op:16,type:\\\"offset\\\",value:0},{name:\\\"charStrings\\\",op:17,type:\\\"offset\\\",value:0},{name:\\\"private\\\",op:18,type:[\\\"number\\\",\\\"offset\\\"],value:[0,0]},{name:\\\"ros\\\",op:1230,type:[\\\"SID\\\",\\\"SID\\\",\\\"number\\\"]},{name:\\\"cidFontVersion\\\",op:1231,type:\\\"number\\\",value:0},{name:\\\"cidFontRevision\\\",op:1232,type:\\\"number\\\",value:0},{name:\\\"cidFontType\\\",op:1233,type:\\\"number\\\",value:0},{name:\\\"cidCount\\\",op:1234,type:\\\"number\\\",value:8720},{name:\\\"uidBase\\\",op:1235,type:\\\"number\\\"},{name:\\\"fdArray\\\",op:1236,type:\\\"offset\\\"},{name:\\\"fdSelect\\\",op:1237,type:\\\"offset\\\"},{name:\\\"fontName\\\",op:1238,type:\\\"SID\\\"}],SL=[{name:\\\"subrs\\\",op:19,type:\\\"offset\\\",value:0},{name:\\\"defaultWidthX\\\",op:20,type:\\\"number\\\",value:0},{name:\\\"nominalWidthX\\\",op:21,type:\\\"number\\\",value:0}];function Tpe(e,t){var r=vL(e,0,e.byteLength);return bL(r,TL,t)}function _L(e,t,r,i){var s=vL(e,t,r);return bL(s,SL,i)}function wL(e,t,r,i){for(var s=[],a=0;a\\u003cr.length;a+=1){var n=new DataView(new Uint8Array(r[a]).buffer),o=Tpe(n,i);o._subrs=[],o._subrsBias=0,o._defaultWidthX=0,o._nominalWidthX=0;var l=o.private[0],u=o.private[1];if(l!==0&&u!==0){var h=_L(e,u+t,l,i);if(o._defaultWidthX=h.defaultWidthX,o._nominalWidthX=h.nominalWidthX,h.subrs!==0){var d=u+h.subrs,c=ru(e,d+t);o._subrs=c.objects,o._subrsBias=R2(o._subrs)}o._privateDict=h}s.push(o)}return s}function Spe(e,t,r,i){var s,a,n=new ot.Parser(e,t);r-=1;var o=[\\\".notdef\\\"],l=n.parseCard8();if(l===0)for(var u=0;u\\u003cr;u+=1)s=n.parseSID(),o.push(of(i,s));else if(l===1)for(;o.length\\u003c=r;){s=n.parseSID(),a=n.parseCard8();for(var h=0;h\\u003c=a;h+=1)o.push(of(i,s)),s+=1}else if(l===2)for(;o.length\\u003c=r;){s=n.parseSID(),a=n.parseCard16();for(var d=0;d\\u003c=a;d+=1)o.push(of(i,s)),s+=1}else throw new Error(\\\"Unknown charset format \\\"+l);return o}function _pe(e,t,r){var i,s={},a=new ot.Parser(e,t),n=a.parseCard8();if(n===0)for(var o=a.parseCard8(),l=0;l\\u003co;l+=1)i=a.parseCard8(),s[i]=l;else if(n===1){var u=a.parseCard8();i=1;for(var h=0;h\\u003cu;h+=1)for(var d=a.parseCard8(),c=a.parseCard8(),m=d;m\\u003c=d+c;m+=1)s[m]=i,i+=1}else throw new Error(\\\"Unknown encoding format \\\"+n);return new kx(s,r)}function ML(e,t,r){var i,s,a,n,o=new di,l=[],u=0,h=!1,d=!1,c=0,m=0,g,y,b,v;if(e.isCIDFont){var S=e.tables.cff.topDict._fdSelect[t.index],T=e.tables.cff.topDict._fdArray[S];g=T._subrs,y=T._subrsBias,b=T._defaultWidthX,v=T._nominalWidthX}else g=e.tables.cff.topDict._subrs,y=e.tables.cff.topDict._subrsBias,b=e.tables.cff.topDict._defaultWidthX,v=e.tables.cff.topDict._nominalWidthX;var w=b;function N(E,P){d&&o.closePath(),o.moveTo(E,P),d=!0}function C(){var E;E=l.length%2!==0,E&&!h&&(w=l.shift()+v),u+=l.length>>1,l.length=0,h=!0}function R(E){for(var P,I,O,L,X,z,H,ue,ne,re,ce,ge,ye=0;ye\\u003cE.length;){var oe=E[ye];switch(ye+=1,oe){case 1:C();break;case 3:C();break;case 4:l.length>1&&!h&&(w=l.shift()+v,h=!0),m+=l.pop(),N(c,m);break;case 5:for(;l.length>0;)c+=l.shift(),m+=l.shift(),o.lineTo(c,m);break;case 6:for(;l.length>0&&(c+=l.shift(),o.lineTo(c,m),l.length!==0);)m+=l.shift(),o.lineTo(c,m);break;case 7:for(;l.length>0&&(m+=l.shift(),o.lineTo(c,m),l.length!==0);)c+=l.shift(),o.lineTo(c,m);break;case 8:for(;l.length>0;)i=c+l.shift(),s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),c=a+l.shift(),m=n+l.shift(),o.curveTo(i,s,a,n,c,m);break;case 10:X=l.pop()+y,z=g[X],z&&R(z);break;case 11:return;case 12:switch(oe=E[ye],ye+=1,oe){case 35:i=c+l.shift(),s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),H=a+l.shift(),ue=n+l.shift(),ne=H+l.shift(),re=ue+l.shift(),ce=ne+l.shift(),ge=re+l.shift(),c=ce+l.shift(),m=ge+l.shift(),l.shift(),o.curveTo(i,s,a,n,H,ue),o.curveTo(ne,re,ce,ge,c,m);break;case 34:i=c+l.shift(),s=m,a=i+l.shift(),n=s+l.shift(),H=a+l.shift(),ue=n,ne=H+l.shift(),re=n,ce=ne+l.shift(),ge=m,c=ce+l.shift(),o.curveTo(i,s,a,n,H,ue),o.curveTo(ne,re,ce,ge,c,m);break;case 36:i=c+l.shift(),s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),H=a+l.shift(),ue=n,ne=H+l.shift(),re=n,ce=ne+l.shift(),ge=re+l.shift(),c=ce+l.shift(),o.curveTo(i,s,a,n,H,ue),o.curveTo(ne,re,ce,ge,c,m);break;case 37:i=c+l.shift(),s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),H=a+l.shift(),ue=n+l.shift(),ne=H+l.shift(),re=ue+l.shift(),ce=ne+l.shift(),ge=re+l.shift(),Math.abs(ce-c)>Math.abs(ge-m)?c=ce+l.shift():m=ge+l.shift(),o.curveTo(i,s,a,n,H,ue),o.curveTo(ne,re,ce,ge,c,m);break;default:console.log(\\\"Glyph \\\"+t.index+\\\": unknown operator 1200\\\"+oe),l.length=0}break;case 14:l.length>0&&!h&&(w=l.shift()+v,h=!0),d&&(o.closePath(),d=!1);break;case 18:C();break;case 19:case 20:C(),ye+=u+7>>3;break;case 21:l.length>2&&!h&&(w=l.shift()+v,h=!0),m+=l.pop(),c+=l.pop(),N(c,m);break;case 22:l.length>1&&!h&&(w=l.shift()+v,h=!0),c+=l.pop(),N(c,m);break;case 23:C();break;case 24:for(;l.length>2;)i=c+l.shift(),s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),c=a+l.shift(),m=n+l.shift(),o.curveTo(i,s,a,n,c,m);c+=l.shift(),m+=l.shift(),o.lineTo(c,m);break;case 25:for(;l.length>6;)c+=l.shift(),m+=l.shift(),o.lineTo(c,m);i=c+l.shift(),s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),c=a+l.shift(),m=n+l.shift(),o.curveTo(i,s,a,n,c,m);break;case 26:for(l.length%2&&(c+=l.shift());l.length>0;)i=c,s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),c=a,m=n+l.shift(),o.curveTo(i,s,a,n,c,m);break;case 27:for(l.length%2&&(m+=l.shift());l.length>0;)i=c+l.shift(),s=m,a=i+l.shift(),n=s+l.shift(),c=a+l.shift(),m=n,o.curveTo(i,s,a,n,c,m);break;case 28:P=E[ye],I=E[ye+1],l.push((P\\u003c\\u003c24|I\\u003c\\u003c16)>>16),ye+=2;break;case 29:X=l.pop()+e.gsubrsBias,z=e.gsubrs[X],z&&R(z);break;case 30:for(;l.length>0&&(i=c,s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),c=a+l.shift(),m=n+(l.length===1?l.shift():0),o.curveTo(i,s,a,n,c,m),l.length!==0);)i=c+l.shift(),s=m,a=i+l.shift(),n=s+l.shift(),m=n+l.shift(),c=a+(l.length===1?l.shift():0),o.curveTo(i,s,a,n,c,m);break;case 31:for(;l.length>0&&(i=c+l.shift(),s=m,a=i+l.shift(),n=s+l.shift(),m=n+l.shift(),c=a+(l.length===1?l.shift():0),o.curveTo(i,s,a,n,c,m),l.length!==0);)i=c,s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),c=a+l.shift(),m=n+(l.length===1?l.shift():0),o.curveTo(i,s,a,n,c,m);break;default:oe\\u003c32?console.log(\\\"Glyph \\\"+t.index+\\\": unknown operator \\\"+oe):oe\\u003c247?l.push(oe-139):oe\\u003c251?(P=E[ye],ye+=1,l.push((oe-247)*256+P+108)):oe\\u003c255?(P=E[ye],ye+=1,l.push(-(oe-251)*256-P-108)):(P=E[ye],I=E[ye+1],O=E[ye+2],L=E[ye+3],ye+=4,l.push((P\\u003c\\u003c24|I\\u003c\\u003c16|O\\u003c\\u003c8|L)/65536))}}}return R(r),t.advanceWidth=w,o}function wpe(e,t,r,i){var s=[],a,n=new ot.Parser(e,t),o=n.parseCard8();if(o===0)for(var l=0;l\\u003cr;l++){if(a=n.parseCard8(),a>=i)throw new Error(\\\"CFF table CID Font FDSelect has bad FD index value \\\"+a+\\\" (FD count \\\"+i+\\\")\\\");s.push(a)}else if(o===3){var u=n.parseCard16(),h=n.parseCard16();if(h!==0)throw new Error(\\\"CFF Table CID Font FDSelect format 3 range has bad initial GID \\\"+h);for(var d,c=0;c\\u003cu;c++){if(a=n.parseCard8(),d=n.parseCard16(),a>=i)throw new Error(\\\"CFF table CID Font FDSelect has bad FD index value \\\"+a+\\\" (FD count \\\"+i+\\\")\\\");if(d>r)throw new Error(\\\"CFF Table CID Font FDSelect format 3 range has bad GID \\\"+d);for(;h\\u003cd;h++)s.push(a);h=d}if(d!==r)throw new Error(\\\"CFF Table CID Font FDSelect format 3 range has bad final GID \\\"+d)}else throw new Error(\\\"CFF Table CID Font FDSelect table has unsupported format \\\"+o);return s}function Mpe(e,t,r,i){r.tables.cff={};var s=bpe(e,t),a=ru(e,s.endOffset,ot.bytesToString),n=ru(e,a.endOffset),o=ru(e,n.endOffset,ot.bytesToString),l=ru(e,o.endOffset);r.gsubrs=l.objects,r.gsubrsBias=R2(r.gsubrs);var u=wL(e,t,n.objects,o.objects);if(u.length!==1)throw new Error(\\\"CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = \\\"+u.length);var h=u[0];if(r.tables.cff.topDict=h,h._privateDict&&(r.defaultWidthX=h._privateDict.defaultWidthX,r.nominalWidthX=h._privateDict.nominalWidthX),h.ros[0]!==void 0&&h.ros[1]!==void 0&&(r.isCIDFont=!0),r.isCIDFont){var d=h.fdArray,c=h.fdSelect;if(d===0||c===0)throw new Error(\\\"Font is marked as a CID font, but FDArray and/or FDSelect information is missing\\\");d+=t;var m=ru(e,d),g=wL(e,t,m.objects,o.objects);h._fdArray=g,c+=t,h._fdSelect=wpe(e,c,r.numGlyphs,g.length)}var y=t+h.private[1],b=_L(e,y,h.private[0],o.objects);if(r.defaultWidthX=b.defaultWidthX,r.nominalWidthX=b.nominalWidthX,b.subrs!==0){var v=y+b.subrs,S=ru(e,v);r.subrs=S.objects,r.subrsBias=R2(r.subrs)}else r.subrs=[],r.subrsBias=0;var T;i.lowMemory?(T=fpe(e,t+h.charStrings),r.nGlyphs=T.offsets.length):(T=ru(e,t+h.charStrings),r.nGlyphs=T.objects.length);var w=Spe(e,t+h.charset,r.nGlyphs,o.objects);if(h.encoding===0?r.cffEncoding=new kx(ape,w):h.encoding===1?r.cffEncoding=new kx(npe,w):r.cffEncoding=_pe(e,t+h.encoding,w),r.encoding=r.encoding||r.cffEncoding,r.glyphs=new Zn.GlyphSet(r),i.lowMemory)r._push=function(R){var E=gpe(R,T.offsets,e,t+h.charStrings);r.glyphs.push(R,Zn.cffGlyphLoader(r,R,ML,E))};else for(var N=0;N\\u003cr.nGlyphs;N+=1){var C=T.objects[N];r.glyphs.push(N,Zn.cffGlyphLoader(r,N,ML,C))}}function NL(e,t){var r,i=Lx.indexOf(e);return i>=0&&(r=i),i=t.indexOf(e),i>=0?r=i+Lx.length:(r=Lx.length+t.length,t.push(e)),r}function Npe(){return new rt.Record(\\\"Header\\\",[{name:\\\"major\\\",type:\\\"Card8\\\",value:1},{name:\\\"minor\\\",type:\\\"Card8\\\",value:0},{name:\\\"hdrSize\\\",type:\\\"Card8\\\",value:4},{name:\\\"major\\\",type:\\\"Card8\\\",value:1}])}function Ape(e){var t=new rt.Record(\\\"Name INDEX\\\",[{name:\\\"names\\\",type:\\\"INDEX\\\",value:[]}]);t.names=[];for(var r=0;r\\u003ce.length;r+=1)t.names.push({name:\\\"name_\\\"+r,type:\\\"NAME\\\",value:e[r]});return t}function AL(e,t,r){for(var i={},s=0;s\\u003ce.length;s+=1){var a=e[s],n=t[a.name];n!==void 0&&!xL(n,a.value)&&(a.type===\\\"SID\\\"&&(n=NL(n,r)),i[a.op]={name:a.name,type:a.type,value:n})}return i}function CL(e,t){var r=new rt.Record(\\\"Top DICT\\\",[{name:\\\"dict\\\",type:\\\"DICT\\\",value:{}}]);return r.dict=AL(TL,e,t),r}function RL(e){var t=new rt.Record(\\\"Top DICT INDEX\\\",[{name:\\\"topDicts\\\",type:\\\"INDEX\\\",value:[]}]);return t.topDicts=[{name:\\\"topDict_0\\\",type:\\\"TABLE\\\",value:e}],t}function Cpe(e){var t=new rt.Record(\\\"String INDEX\\\",[{name:\\\"strings\\\",type:\\\"INDEX\\\",value:[]}]);t.strings=[];for(var r=0;r\\u003ce.length;r+=1)t.strings.push({name:\\\"string_\\\"+r,type:\\\"STRING\\\",value:e[r]});return t}function Rpe(){return new rt.Record(\\\"Global Subr INDEX\\\",[{name:\\\"subrs\\\",type:\\\"INDEX\\\",value:[]}])}function Epe(e,t){for(var r=new rt.Record(\\\"Charsets\\\",[{name:\\\"format\\\",type:\\\"Card8\\\",value:0}]),i=0;i\\u003ce.length;i+=1){var s=e[i],a=NL(s,t);r.fields.push({name:\\\"glyph_\\\"+i,type:\\\"SID\\\",value:a})}return r}function Ppe(e){var t=[],r=e.path;t.push({name:\\\"width\\\",type:\\\"NUMBER\\\",value:e.advanceWidth});for(var i=0,s=0,a=0;a\\u003cr.commands.length;a+=1){var n=void 0,o=void 0,l=r.commands[a];if(l.type===\\\"Q\\\"){var u=.3333333333333333,h=2/3;l={type:\\\"C\\\",x:l.x,y:l.y,x1:Math.round(u*i+h*l.x1),y1:Math.round(u*s+h*l.y1),x2:Math.round(u*l.x+h*l.x1),y2:Math.round(u*l.y+h*l.y1)}}if(l.type===\\\"M\\\")n=Math.round(l.x-i),o=Math.round(l.y-s),t.push({name:\\\"dx\\\",type:\\\"NUMBER\\\",value:n}),t.push({name:\\\"dy\\\",type:\\\"NUMBER\\\",value:o}),t.push({name:\\\"rmoveto\\\",type:\\\"OP\\\",value:21}),i=Math.round(l.x),s=Math.round(l.y);else if(l.type===\\\"L\\\")n=Math.round(l.x-i),o=Math.round(l.y-s),t.push({name:\\\"dx\\\",type:\\\"NUMBER\\\",value:n}),t.push({name:\\\"dy\\\",type:\\\"NUMBER\\\",value:o}),t.push({name:\\\"rlineto\\\",type:\\\"OP\\\",value:5}),i=Math.round(l.x),s=Math.round(l.y);else if(l.type===\\\"C\\\"){var d=Math.round(l.x1-i),c=Math.round(l.y1-s),m=Math.round(l.x2-l.x1),g=Math.round(l.y2-l.y1);n=Math.round(l.x-l.x2),o=Math.round(l.y-l.y2),t.push({name:\\\"dx1\\\",type:\\\"NUMBER\\\",value:d}),t.push({name:\\\"dy1\\\",type:\\\"NUMBER\\\",value:c}),t.push({name:\\\"dx2\\\",type:\\\"NUMBER\\\",value:m}),t.push({name:\\\"dy2\\\",type:\\\"NUMBER\\\",value:g}),t.push({name:\\\"dx\\\",type:\\\"NUMBER\\\",value:n}),t.push({name:\\\"dy\\\",type:\\\"NUMBER\\\",value:o}),t.push({name:\\\"rrcurveto\\\",type:\\\"OP\\\",value:8}),i=Math.round(l.x),s=Math.round(l.y)}}return t.push({name:\\\"endchar\\\",type:\\\"OP\\\",value:14}),t}function Bpe(e){for(var t=new rt.Record(\\\"CharStrings INDEX\\\",[{name:\\\"charStrings\\\",type:\\\"INDEX\\\",value:[]}]),r=0;r\\u003ce.length;r+=1){var i=e.get(r),s=Ppe(i);t.charStrings.push({name:i.name,type:\\\"CHARSTRING\\\",value:s})}return t}function Ipe(e,t){var r=new rt.Record(\\\"Private DICT\\\",[{name:\\\"dict\\\",type:\\\"DICT\\\",value:{}}]);return r.dict=AL(SL,e,t),r}function Fpe(e,t){for(var r=new rt.Table(\\\"CFF \\\",[{name:\\\"header\\\",type:\\\"RECORD\\\"},{name:\\\"nameIndex\\\",type:\\\"RECORD\\\"},{name:\\\"topDictIndex\\\",type:\\\"RECORD\\\"},{name:\\\"stringIndex\\\",type:\\\"RECORD\\\"},{name:\\\"globalSubrIndex\\\",type:\\\"RECORD\\\"},{name:\\\"charsets\\\",type:\\\"RECORD\\\"},{name:\\\"charStringsIndex\\\",type:\\\"RECORD\\\"},{name:\\\"privateDict\\\",type:\\\"RECORD\\\"}]),i=1/t.unitsPerEm,s={version:t.version,fullName:t.fullName,familyName:t.familyName,weight:t.weightName,fontBBox:t.fontBBox||[0,0,0,0],fontMatrix:[i,0,0,i,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},a={},n=[],o,l=1;l\\u003ce.length;l+=1)o=e.get(l),n.push(o.name);var u=[];r.header=Npe(),r.nameIndex=Ape([t.postScriptName]);var h=CL(s,u);r.topDictIndex=RL(h),r.globalSubrIndex=Rpe(),r.charsets=Epe(n,u),r.charStringsIndex=Bpe(e),r.privateDict=Ipe(a,u),r.stringIndex=Cpe(u);var d=r.header.sizeOf()+r.nameIndex.sizeOf()+r.topDictIndex.sizeOf()+r.stringIndex.sizeOf()+r.globalSubrIndex.sizeOf();return s.charset=d,s.encoding=0,s.charStrings=s.charset+r.charsets.sizeOf(),s.private[1]=s.charStrings+r.charStringsIndex.sizeOf(),h=CL(s,u),r.topDictIndex=RL(h),r}var EL={parse:Mpe,make:Fpe};function Lpe(e,t){var r={},i=new ot.Parser(e,t);return r.version=i.parseVersion(),r.fontRevision=Math.round(i.parseFixed()*1e3)/1e3,r.checkSumAdjustment=i.parseULong(),r.magicNumber=i.parseULong(),bt.argument(r.magicNumber===1594834165,\\\"Font header has wrong magic number.\\\"),r.flags=i.parseUShort(),r.unitsPerEm=i.parseUShort(),r.created=i.parseLongDateTime(),r.modified=i.parseLongDateTime(),r.xMin=i.parseShort(),r.yMin=i.parseShort(),r.xMax=i.parseShort(),r.yMax=i.parseShort(),r.macStyle=i.parseUShort(),r.lowestRecPPEM=i.parseUShort(),r.fontDirectionHint=i.parseShort(),r.indexToLocFormat=i.parseShort(),r.glyphDataFormat=i.parseShort(),r}function kpe(e){var t=Math.round(new Date().getTime()/1e3)+2082844800,r=t;return e.createdTimestamp&&(r=e.createdTimestamp+2082844800),new rt.Table(\\\"head\\\",[{name:\\\"version\\\",type:\\\"FIXED\\\",value:65536},{name:\\\"fontRevision\\\",type:\\\"FIXED\\\",value:65536},{name:\\\"checkSumAdjustment\\\",type:\\\"ULONG\\\",value:0},{name:\\\"magicNumber\\\",type:\\\"ULONG\\\",value:1594834165},{name:\\\"flags\\\",type:\\\"USHORT\\\",value:0},{name:\\\"unitsPerEm\\\",type:\\\"USHORT\\\",value:1e3},{name:\\\"created\\\",type:\\\"LONGDATETIME\\\",value:r},{name:\\\"modified\\\",type:\\\"LONGDATETIME\\\",value:t},{name:\\\"xMin\\\",type:\\\"SHORT\\\",value:0},{name:\\\"yMin\\\",type:\\\"SHORT\\\",value:0},{name:\\\"xMax\\\",type:\\\"SHORT\\\",value:0},{name:\\\"yMax\\\",type:\\\"SHORT\\\",value:0},{name:\\\"macStyle\\\",type:\\\"USHORT\\\",value:0},{name:\\\"lowestRecPPEM\\\",type:\\\"USHORT\\\",value:0},{name:\\\"fontDirectionHint\\\",type:\\\"SHORT\\\",value:2},{name:\\\"indexToLocFormat\\\",type:\\\"SHORT\\\",value:0},{name:\\\"glyphDataFormat\\\",type:\\\"SHORT\\\",value:0}],e)}var PL={parse:Lpe,make:kpe};function Dpe(e,t){var r={},i=new ot.Parser(e,t);return r.version=i.parseVersion(),r.ascender=i.parseShort(),r.descender=i.parseShort(),r.lineGap=i.parseShort(),r.advanceWidthMax=i.parseUShort(),r.minLeftSideBearing=i.parseShort(),r.minRightSideBearing=i.parseShort(),r.xMaxExtent=i.parseShort(),r.caretSlopeRise=i.parseShort(),r.caretSlopeRun=i.parseShort(),r.caretOffset=i.parseShort(),i.relativeOffset+=8,r.metricDataFormat=i.parseShort(),r.numberOfHMetrics=i.parseUShort(),r}function Ope(e){return new rt.Table(\\\"hhea\\\",[{name:\\\"version\\\",type:\\\"FIXED\\\",value:65536},{name:\\\"ascender\\\",type:\\\"FWORD\\\",value:0},{name:\\\"descender\\\",type:\\\"FWORD\\\",value:0},{name:\\\"lineGap\\\",type:\\\"FWORD\\\",value:0},{name:\\\"advanceWidthMax\\\",type:\\\"UFWORD\\\",value:0},{name:\\\"minLeftSideBearing\\\",type:\\\"FWORD\\\",value:0},{name:\\\"minRightSideBearing\\\",type:\\\"FWORD\\\",value:0},{name:\\\"xMaxExtent\\\",type:\\\"FWORD\\\",value:0},{name:\\\"caretSlopeRise\\\",type:\\\"SHORT\\\",value:1},{name:\\\"caretSlopeRun\\\",type:\\\"SHORT\\\",value:0},{name:\\\"caretOffset\\\",type:\\\"SHORT\\\",value:0},{name:\\\"reserved1\\\",type:\\\"SHORT\\\",value:0},{name:\\\"reserved2\\\",type:\\\"SHORT\\\",value:0},{name:\\\"reserved3\\\",type:\\\"SHORT\\\",value:0},{name:\\\"reserved4\\\",type:\\\"SHORT\\\",value:0},{name:\\\"metricDataFormat\\\",type:\\\"SHORT\\\",value:0},{name:\\\"numberOfHMetrics\\\",type:\\\"USHORT\\\",value:0}],e)}var BL={parse:Dpe,make:Ope};function Upe(e,t,r,i,s){for(var a,n,o=new ot.Parser(e,t),l=0;l\\u003ci;l+=1){l\\u003cr&&(a=o.parseUShort(),n=o.parseShort());var u=s.get(l);u.advanceWidth=a,u.leftSideBearing=n}}function zpe(e,t,r,i,s){e._hmtxTableData={};for(var a,n,o=new ot.Parser(t,r),l=0;l\\u003cs;l+=1)l\\u003ci&&(a=o.parseUShort(),n=o.parseShort()),e._hmtxTableData[l]={advanceWidth:a,leftSideBearing:n}}function Vpe(e,t,r,i,s,a,n){n.lowMemory?zpe(e,t,r,i,s):Upe(t,r,i,s,a)}function Gpe(e){for(var t=new rt.Table(\\\"hmtx\\\",[]),r=0;r\\u003ce.length;r+=1){var i=e.get(r),s=i.advanceWidth||0,a=i.leftSideBearing||0;t.fields.push({name:\\\"advanceWidth_\\\"+r,type:\\\"USHORT\\\",value:s}),t.fields.push({name:\\\"leftSideBearing_\\\"+r,type:\\\"SHORT\\\",value:a})}return t}var IL={parse:Vpe,make:Gpe};function Wpe(e){for(var t=new rt.Table(\\\"ltag\\\",[{name:\\\"version\\\",type:\\\"ULONG\\\",value:1},{name:\\\"flags\\\",type:\\\"ULONG\\\",value:0},{name:\\\"numTags\\\",type:\\\"ULONG\\\",value:e.length}]),r=\\\"\\\",i=12+e.length*4,s=0;s\\u003ce.length;++s){var a=r.indexOf(e[s]);a\\u003c0&&(a=r.length,r+=e[s]),t.fields.push({name:\\\"offset \\\"+s,type:\\\"USHORT\\\",value:i+a}),t.fields.push({name:\\\"length \\\"+s,type:\\\"USHORT\\\",value:e[s].length})}return t.fields.push({name:\\\"stringPool\\\",type:\\\"CHARARRAY\\\",value:r}),t}function jpe(e,t){var r=new ot.Parser(e,t),i=r.parseULong();bt.argument(i===1,\\\"Unsupported ltag table version.\\\"),r.skip(\\\"uLong\\\",1);for(var s=r.parseULong(),a=[],n=0;n\\u003cs;n++){for(var o=\\\"\\\",l=t+r.parseUShort(),u=r.parseUShort(),h=l;h\\u003cl+u;++h)o+=String.fromCharCode(e.getInt8(h));a.push(o)}return a}var FL={make:Wpe,parse:jpe};function Hpe(e,t){var r={},i=new ot.Parser(e,t);return r.version=i.parseVersion(),r.numGlyphs=i.parseUShort(),r.version===1&&(r.maxPoints=i.parseUShort(),r.maxContours=i.parseUShort(),r.maxCompositePoints=i.parseUShort(),r.maxCompositeContours=i.parseUShort(),r.maxZones=i.parseUShort(),r.maxTwilightPoints=i.parseUShort(),r.maxStorage=i.parseUShort(),r.maxFunctionDefs=i.parseUShort(),r.maxInstructionDefs=i.parseUShort(),r.maxStackElements=i.parseUShort(),r.maxSizeOfInstructions=i.parseUShort(),r.maxComponentElements=i.parseUShort(),r.maxComponentDepth=i.parseUShort()),r}function Xpe(e){return new rt.Table(\\\"maxp\\\",[{name:\\\"version\\\",type:\\\"FIXED\\\",value:20480},{name:\\\"numGlyphs\\\",type:\\\"USHORT\\\",value:e}])}var LL={parse:Hpe,make:Xpe},kL=[\\\"copyright\\\",\\\"fontFamily\\\",\\\"fontSubfamily\\\",\\\"uniqueID\\\",\\\"fullName\\\",\\\"version\\\",\\\"postScriptName\\\",\\\"trademark\\\",\\\"manufacturer\\\",\\\"designer\\\",\\\"description\\\",\\\"manufacturerURL\\\",\\\"designerURL\\\",\\\"license\\\",\\\"licenseURL\\\",\\\"reserved\\\",\\\"preferredFamily\\\",\\\"preferredSubfamily\\\",\\\"compatibleFullName\\\",\\\"sampleText\\\",\\\"postScriptFindFontName\\\",\\\"wwsFamily\\\",\\\"wwsSubfamily\\\"],DL={0:\\\"en\\\",1:\\\"fr\\\",2:\\\"de\\\",3:\\\"it\\\",4:\\\"nl\\\",5:\\\"sv\\\",6:\\\"es\\\",7:\\\"da\\\",8:\\\"pt\\\",9:\\\"no\\\",10:\\\"he\\\",11:\\\"ja\\\",12:\\\"ar\\\",13:\\\"fi\\\",14:\\\"el\\\",15:\\\"is\\\",16:\\\"mt\\\",17:\\\"tr\\\",18:\\\"hr\\\",19:\\\"zh-Hant\\\",20:\\\"ur\\\",21:\\\"hi\\\",22:\\\"th\\\",23:\\\"ko\\\",24:\\\"lt\\\",25:\\\"pl\\\",26:\\\"hu\\\",27:\\\"es\\\",28:\\\"lv\\\",29:\\\"se\\\",30:\\\"fo\\\",31:\\\"fa\\\",32:\\\"ru\\\",33:\\\"zh\\\",34:\\\"nl-BE\\\",35:\\\"ga\\\",36:\\\"sq\\\",37:\\\"ro\\\",38:\\\"cz\\\",39:\\\"sk\\\",40:\\\"si\\\",41:\\\"yi\\\",42:\\\"sr\\\",43:\\\"mk\\\",44:\\\"bg\\\",45:\\\"uk\\\",46:\\\"be\\\",47:\\\"uz\\\",48:\\\"kk\\\",49:\\\"az-Cyrl\\\",50:\\\"az-Arab\\\",51:\\\"hy\\\",52:\\\"ka\\\",53:\\\"mo\\\",54:\\\"ky\\\",55:\\\"tg\\\",56:\\\"tk\\\",57:\\\"mn-CN\\\",58:\\\"mn\\\",59:\\\"ps\\\",60:\\\"ks\\\",61:\\\"ku\\\",62:\\\"sd\\\",63:\\\"bo\\\",64:\\\"ne\\\",65:\\\"sa\\\",66:\\\"mr\\\",67:\\\"bn\\\",68:\\\"as\\\",69:\\\"gu\\\",70:\\\"pa\\\",71:\\\"or\\\",72:\\\"ml\\\",73:\\\"kn\\\",74:\\\"ta\\\",75:\\\"te\\\",76:\\\"si\\\",77:\\\"my\\\",78:\\\"km\\\",79:\\\"lo\\\",80:\\\"vi\\\",81:\\\"id\\\",82:\\\"tl\\\",83:\\\"ms\\\",84:\\\"ms-Arab\\\",85:\\\"am\\\",86:\\\"ti\\\",87:\\\"om\\\",88:\\\"so\\\",89:\\\"sw\\\",90:\\\"rw\\\",91:\\\"rn\\\",92:\\\"ny\\\",93:\\\"mg\\\",94:\\\"eo\\\",128:\\\"cy\\\",129:\\\"eu\\\",130:\\\"ca\\\",131:\\\"la\\\",132:\\\"qu\\\",133:\\\"gn\\\",134:\\\"ay\\\",135:\\\"tt\\\",136:\\\"ug\\\",137:\\\"dz\\\",138:\\\"jv\\\",139:\\\"su\\\",140:\\\"gl\\\",141:\\\"af\\\",142:\\\"br\\\",143:\\\"iu\\\",144:\\\"gd\\\",145:\\\"gv\\\",146:\\\"ga\\\",147:\\\"to\\\",148:\\\"el-polyton\\\",149:\\\"kl\\\",150:\\\"az\\\",151:\\\"nn\\\"},$pe={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},OL={1078:\\\"af\\\",1052:\\\"sq\\\",1156:\\\"gsw\\\",1118:\\\"am\\\",5121:\\\"ar-DZ\\\",15361:\\\"ar-BH\\\",3073:\\\"ar\\\",2049:\\\"ar-IQ\\\",11265:\\\"ar-JO\\\",13313:\\\"ar-KW\\\",12289:\\\"ar-LB\\\",4097:\\\"ar-LY\\\",6145:\\\"ary\\\",8193:\\\"ar-OM\\\",16385:\\\"ar-QA\\\",1025:\\\"ar-SA\\\",10241:\\\"ar-SY\\\",7169:\\\"aeb\\\",14337:\\\"ar-AE\\\",9217:\\\"ar-YE\\\",1067:\\\"hy\\\",1101:\\\"as\\\",2092:\\\"az-Cyrl\\\",1068:\\\"az\\\",1133:\\\"ba\\\",1069:\\\"eu\\\",1059:\\\"be\\\",2117:\\\"bn\\\",1093:\\\"bn-IN\\\",8218:\\\"bs-Cyrl\\\",5146:\\\"bs\\\",1150:\\\"br\\\",1026:\\\"bg\\\",1027:\\\"ca\\\",3076:\\\"zh-HK\\\",5124:\\\"zh-MO\\\",2052:\\\"zh\\\",4100:\\\"zh-SG\\\",1028:\\\"zh-TW\\\",1155:\\\"co\\\",1050:\\\"hr\\\",4122:\\\"hr-BA\\\",1029:\\\"cs\\\",1030:\\\"da\\\",1164:\\\"prs\\\",1125:\\\"dv\\\",2067:\\\"nl-BE\\\",1043:\\\"nl\\\",3081:\\\"en-AU\\\",10249:\\\"en-BZ\\\",4105:\\\"en-CA\\\",9225:\\\"en-029\\\",16393:\\\"en-IN\\\",6153:\\\"en-IE\\\",8201:\\\"en-JM\\\",17417:\\\"en-MY\\\",5129:\\\"en-NZ\\\",13321:\\\"en-PH\\\",18441:\\\"en-SG\\\",7177:\\\"en-ZA\\\",11273:\\\"en-TT\\\",2057:\\\"en-GB\\\",1033:\\\"en\\\",12297:\\\"en-ZW\\\",1061:\\\"et\\\",1080:\\\"fo\\\",1124:\\\"fil\\\",1035:\\\"fi\\\",2060:\\\"fr-BE\\\",3084:\\\"fr-CA\\\",1036:\\\"fr\\\",5132:\\\"fr-LU\\\",6156:\\\"fr-MC\\\",4108:\\\"fr-CH\\\",1122:\\\"fy\\\",1110:\\\"gl\\\",1079:\\\"ka\\\",3079:\\\"de-AT\\\",1031:\\\"de\\\",5127:\\\"de-LI\\\",4103:\\\"de-LU\\\",2055:\\\"de-CH\\\",1032:\\\"el\\\",1135:\\\"kl\\\",1095:\\\"gu\\\",1128:\\\"ha\\\",1037:\\\"he\\\",1081:\\\"hi\\\",1038:\\\"hu\\\",1039:\\\"is\\\",1136:\\\"ig\\\",1057:\\\"id\\\",1117:\\\"iu\\\",2141:\\\"iu-Latn\\\",2108:\\\"ga\\\",1076:\\\"xh\\\",1077:\\\"zu\\\",1040:\\\"it\\\",2064:\\\"it-CH\\\",1041:\\\"ja\\\",1099:\\\"kn\\\",1087:\\\"kk\\\",1107:\\\"km\\\",1158:\\\"quc\\\",1159:\\\"rw\\\",1089:\\\"sw\\\",1111:\\\"kok\\\",1042:\\\"ko\\\",1088:\\\"ky\\\",1108:\\\"lo\\\",1062:\\\"lv\\\",1063:\\\"lt\\\",2094:\\\"dsb\\\",1134:\\\"lb\\\",1071:\\\"mk\\\",2110:\\\"ms-BN\\\",1086:\\\"ms\\\",1100:\\\"ml\\\",1082:\\\"mt\\\",1153:\\\"mi\\\",1146:\\\"arn\\\",1102:\\\"mr\\\",1148:\\\"moh\\\",1104:\\\"mn\\\",2128:\\\"mn-CN\\\",1121:\\\"ne\\\",1044:\\\"nb\\\",2068:\\\"nn\\\",1154:\\\"oc\\\",1096:\\\"or\\\",1123:\\\"ps\\\",1045:\\\"pl\\\",1046:\\\"pt\\\",2070:\\\"pt-PT\\\",1094:\\\"pa\\\",1131:\\\"qu-BO\\\",2155:\\\"qu-EC\\\",3179:\\\"qu\\\",1048:\\\"ro\\\",1047:\\\"rm\\\",1049:\\\"ru\\\",9275:\\\"smn\\\",4155:\\\"smj-NO\\\",5179:\\\"smj\\\",3131:\\\"se-FI\\\",1083:\\\"se\\\",2107:\\\"se-SE\\\",8251:\\\"sms\\\",6203:\\\"sma-NO\\\",7227:\\\"sms\\\",1103:\\\"sa\\\",7194:\\\"sr-Cyrl-BA\\\",3098:\\\"sr\\\",6170:\\\"sr-Latn-BA\\\",2074:\\\"sr-Latn\\\",1132:\\\"nso\\\",1074:\\\"tn\\\",1115:\\\"si\\\",1051:\\\"sk\\\",1060:\\\"sl\\\",11274:\\\"es-AR\\\",16394:\\\"es-BO\\\",13322:\\\"es-CL\\\",9226:\\\"es-CO\\\",5130:\\\"es-CR\\\",7178:\\\"es-DO\\\",12298:\\\"es-EC\\\",17418:\\\"es-SV\\\",4106:\\\"es-GT\\\",18442:\\\"es-HN\\\",2058:\\\"es-MX\\\",19466:\\\"es-NI\\\",6154:\\\"es-PA\\\",15370:\\\"es-PY\\\",10250:\\\"es-PE\\\",20490:\\\"es-PR\\\",3082:\\\"es\\\",1034:\\\"es\\\",21514:\\\"es-US\\\",14346:\\\"es-UY\\\",8202:\\\"es-VE\\\",2077:\\\"sv-FI\\\",1053:\\\"sv\\\",1114:\\\"syr\\\",1064:\\\"tg\\\",2143:\\\"tzm\\\",1097:\\\"ta\\\",1092:\\\"tt\\\",1098:\\\"te\\\",1054:\\\"th\\\",1105:\\\"bo\\\",1055:\\\"tr\\\",1090:\\\"tk\\\",1152:\\\"ug\\\",1058:\\\"uk\\\",1070:\\\"hsb\\\",1056:\\\"ur\\\",2115:\\\"uz-Cyrl\\\",1091:\\\"uz\\\",1066:\\\"vi\\\",1106:\\\"cy\\\",1160:\\\"wo\\\",1157:\\\"sah\\\",1144:\\\"ii\\\",1130:\\\"yo\\\"};function qpe(e,t,r){switch(e){case 0:if(t===65535)return\\\"und\\\";if(r)return r[t];break;case 1:return DL[t];case 3:return OL[t]}}var E2=\\\"utf-16\\\",Ype={0:\\\"macintosh\\\",1:\\\"x-mac-japanese\\\",2:\\\"x-mac-chinesetrad\\\",3:\\\"x-mac-korean\\\",6:\\\"x-mac-greek\\\",7:\\\"x-mac-cyrillic\\\",9:\\\"x-mac-devanagai\\\",10:\\\"x-mac-gurmukhi\\\",11:\\\"x-mac-gujarati\\\",12:\\\"x-mac-oriya\\\",13:\\\"x-mac-bengali\\\",14:\\\"x-mac-tamil\\\",15:\\\"x-mac-telugu\\\",16:\\\"x-mac-kannada\\\",17:\\\"x-mac-malayalam\\\",18:\\\"x-mac-sinhalese\\\",19:\\\"x-mac-burmese\\\",20:\\\"x-mac-khmer\\\",21:\\\"x-mac-thai\\\",22:\\\"x-mac-lao\\\",23:\\\"x-mac-georgian\\\",24:\\\"x-mac-armenian\\\",25:\\\"x-mac-chinesesimp\\\",26:\\\"x-mac-tibetan\\\",27:\\\"x-mac-mongolian\\\",28:\\\"x-mac-ethiopic\\\",29:\\\"x-mac-ce\\\",30:\\\"x-mac-vietnamese\\\",31:\\\"x-mac-extarabic\\\"},Zpe={15:\\\"x-mac-icelandic\\\",17:\\\"x-mac-turkish\\\",18:\\\"x-mac-croatian\\\",24:\\\"x-mac-ce\\\",25:\\\"x-mac-ce\\\",26:\\\"x-mac-ce\\\",27:\\\"x-mac-ce\\\",28:\\\"x-mac-ce\\\",30:\\\"x-mac-icelandic\\\",37:\\\"x-mac-romanian\\\",38:\\\"x-mac-ce\\\",39:\\\"x-mac-ce\\\",40:\\\"x-mac-ce\\\",143:\\\"x-mac-inuit\\\",146:\\\"x-mac-gaelic\\\"};function UL(e,t,r){switch(e){case 0:return E2;case 1:return Zpe[r]||Ype[t];case 3:if(t===1||t===10)return E2;break}}function Jpe(e,t,r){for(var i={},s=new ot.Parser(e,t),a=s.parseUShort(),n=s.parseUShort(),o=s.offset+s.parseUShort(),l=0;l\\u003cn;l++){var u=s.parseUShort(),h=s.parseUShort(),d=s.parseUShort(),c=s.parseUShort(),m=kL[c]||c,g=s.parseUShort(),y=s.parseUShort(),b=qpe(u,d,r),v=UL(u,h,d);if(v!==void 0&&b!==void 0){var S=void 0;if(v===E2?S=Ec.UTF16(e,o+y,g):S=Ec.MACSTRING(e,o+y,g,v),S){var T=i[m];T===void 0&&(T=i[m]={}),T[b]=S}}}var w=0;return a===1&&(w=s.parseUShort()),i}function P2(e){var t={};for(var r in e)t[e[r]]=parseInt(r);return t}function zL(e,t,r,i,s,a){return new rt.Record(\\\"NameRecord\\\",[{name:\\\"platformID\\\",type:\\\"USHORT\\\",value:e},{name:\\\"encodingID\\\",type:\\\"USHORT\\\",value:t},{name:\\\"languageID\\\",type:\\\"USHORT\\\",value:r},{name:\\\"nameID\\\",type:\\\"USHORT\\\",value:i},{name:\\\"length\\\",type:\\\"USHORT\\\",value:s},{name:\\\"offset\\\",type:\\\"USHORT\\\",value:a}])}function Qpe(e,t){var r=e.length,i=t.length-r+1;e:for(var s=0;s\\u003ci;s++)for(;s\\u003ci;s++){for(var a=0;a\\u003cr;a++)if(t[s+a]!==e[a])continue e;return s}return-1}function VL(e,t){var r=Qpe(e,t);if(r\\u003c0){r=t.length;for(var i=0,s=e.length;i\\u003cs;++i)t.push(e[i])}return r}function Kpe(e,t){var r,i=[],s={},a=P2(kL);for(var n in e){var o=a[n];if(o===void 0&&(o=n),r=parseInt(o),isNaN(r))throw new Error('Name table entry \\\"'+n+'\\\" does not exist, see nameTableNames for complete list.');s[r]=e[n],i.push(r)}for(var l=P2(DL),u=P2(OL),h=[],d=[],c=0;c\\u003ci.length;c++){r=i[c];var m=s[r];for(var g in m){var y=m[g],b=1,v=l[g],S=$pe[v],T=UL(b,S,v),w=He.MACSTRING(y,T);w===void 0&&(b=0,v=t.indexOf(g),v\\u003c0&&(v=t.length,t.push(g)),S=4,w=He.UTF16(y));var N=VL(w,d);h.push(zL(b,S,v,r,w.length,N));var C=u[g];if(C!==void 0){var R=He.UTF16(y),E=VL(R,d);h.push(zL(3,1,C,r,R.length,E))}}}h.sort(function(O,L){return O.platformID-L.platformID||O.encodingID-L.encodingID||O.languageID-L.languageID||O.nameID-L.nameID});for(var P=new rt.Table(\\\"name\\\",[{name:\\\"format\\\",type:\\\"USHORT\\\",value:0},{name:\\\"count\\\",type:\\\"USHORT\\\",value:h.length},{name:\\\"stringOffset\\\",type:\\\"USHORT\\\",value:6+h.length*12}]),I=0;I\\u003ch.length;I++)P.fields.push({name:\\\"record_\\\"+I,type:\\\"RECORD\\\",value:h[I]});return P.fields.push({name:\\\"strings\\\",type:\\\"LITERAL\\\",value:d}),P}var GL={parse:Jpe,make:Kpe},B2=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function eme(e){for(var t=0;t\\u003cB2.length;t+=1){var r=B2[t];if(e>=r.begin&&e\\u003cr.end)return t}return-1}function tme(e,t){var r={},i=new ot.Parser(e,t);r.version=i.parseUShort(),r.xAvgCharWidth=i.parseShort(),r.usWeightClass=i.parseUShort(),r.usWidthClass=i.parseUShort(),r.fsType=i.parseUShort(),r.ySubscriptXSize=i.parseShort(),r.ySubscriptYSize=i.parseShort(),r.ySubscriptXOffset=i.parseShort(),r.ySubscriptYOffset=i.parseShort(),r.ySuperscriptXSize=i.parseShort(),r.ySuperscriptYSize=i.parseShort(),r.ySuperscriptXOffset=i.parseShort(),r.ySuperscriptYOffset=i.parseShort(),r.yStrikeoutSize=i.parseShort(),r.yStrikeoutPosition=i.parseShort(),r.sFamilyClass=i.parseShort(),r.panose=[];for(var s=0;s\\u003c10;s++)r.panose[s]=i.parseByte();return r.ulUnicodeRange1=i.parseULong(),r.ulUnicodeRange2=i.parseULong(),r.ulUnicodeRange3=i.parseULong(),r.ulUnicodeRange4=i.parseULong(),r.achVendID=String.fromCharCode(i.parseByte(),i.parseByte(),i.parseByte(),i.parseByte()),r.fsSelection=i.parseUShort(),r.usFirstCharIndex=i.parseUShort(),r.usLastCharIndex=i.parseUShort(),r.sTypoAscender=i.parseShort(),r.sTypoDescender=i.parseShort(),r.sTypoLineGap=i.parseShort(),r.usWinAscent=i.parseUShort(),r.usWinDescent=i.parseUShort(),r.version>=1&&(r.ulCodePageRange1=i.parseULong(),r.ulCodePageRange2=i.parseULong()),r.version>=2&&(r.sxHeight=i.parseShort(),r.sCapHeight=i.parseShort(),r.usDefaultChar=i.parseUShort(),r.usBreakChar=i.parseUShort(),r.usMaxContent=i.parseUShort()),r}function rme(e){return new rt.Table(\\\"OS/2\\\",[{name:\\\"version\\\",type:\\\"USHORT\\\",value:3},{name:\\\"xAvgCharWidth\\\",type:\\\"SHORT\\\",value:0},{name:\\\"usWeightClass\\\",type:\\\"USHORT\\\",value:0},{name:\\\"usWidthClass\\\",type:\\\"USHORT\\\",value:0},{name:\\\"fsType\\\",type:\\\"USHORT\\\",value:0},{name:\\\"ySubscriptXSize\\\",type:\\\"SHORT\\\",value:650},{name:\\\"ySubscriptYSize\\\",type:\\\"SHORT\\\",value:699},{name:\\\"ySubscriptXOffset\\\",type:\\\"SHORT\\\",value:0},{name:\\\"ySubscriptYOffset\\\",type:\\\"SHORT\\\",value:140},{name:\\\"ySuperscriptXSize\\\",type:\\\"SHORT\\\",value:650},{name:\\\"ySuperscriptYSize\\\",type:\\\"SHORT\\\",value:699},{name:\\\"ySuperscriptXOffset\\\",type:\\\"SHORT\\\",value:0},{name:\\\"ySuperscriptYOffset\\\",type:\\\"SHORT\\\",value:479},{name:\\\"yStrikeoutSize\\\",type:\\\"SHORT\\\",value:49},{name:\\\"yStrikeoutPosition\\\",type:\\\"SHORT\\\",value:258},{name:\\\"sFamilyClass\\\",type:\\\"SHORT\\\",value:0},{name:\\\"bFamilyType\\\",type:\\\"BYTE\\\",value:0},{name:\\\"bSerifStyle\\\",type:\\\"BYTE\\\",value:0},{name:\\\"bWeight\\\",type:\\\"BYTE\\\",value:0},{name:\\\"bProportion\\\",type:\\\"BYTE\\\",value:0},{name:\\\"bContrast\\\",type:\\\"BYTE\\\",value:0},{name:\\\"bStrokeVariation\\\",type:\\\"BYTE\\\",value:0},{name:\\\"bArmStyle\\\",type:\\\"BYTE\\\",value:0},{name:\\\"bLetterform\\\",type:\\\"BYTE\\\",value:0},{name:\\\"bMidline\\\",type:\\\"BYTE\\\",value:0},{name:\\\"bXHeight\\\",type:\\\"BYTE\\\",value:0},{name:\\\"ulUnicodeRange1\\\",type:\\\"ULONG\\\",value:0},{name:\\\"ulUnicodeRange2\\\",type:\\\"ULONG\\\",value:0},{name:\\\"ulUnicodeRange3\\\",type:\\\"ULONG\\\",value:0},{name:\\\"ulUnicodeRange4\\\",type:\\\"ULONG\\\",value:0},{name:\\\"achVendID\\\",type:\\\"CHARARRAY\\\",value:\\\"XXXX\\\"},{name:\\\"fsSelection\\\",type:\\\"USHORT\\\",value:0},{name:\\\"usFirstCharIndex\\\",type:\\\"USHORT\\\",value:0},{name:\\\"usLastCharIndex\\\",type:\\\"USHORT\\\",value:0},{name:\\\"sTypoAscender\\\",type:\\\"SHORT\\\",value:0},{name:\\\"sTypoDescender\\\",type:\\\"SHORT\\\",value:0},{name:\\\"sTypoLineGap\\\",type:\\\"SHORT\\\",value:0},{name:\\\"usWinAscent\\\",type:\\\"USHORT\\\",value:0},{name:\\\"usWinDescent\\\",type:\\\"USHORT\\\",value:0},{name:\\\"ulCodePageRange1\\\",type:\\\"ULONG\\\",value:0},{name:\\\"ulCodePageRange2\\\",type:\\\"ULONG\\\",value:0},{name:\\\"sxHeight\\\",type:\\\"SHORT\\\",value:0},{name:\\\"sCapHeight\\\",type:\\\"SHORT\\\",value:0},{name:\\\"usDefaultChar\\\",type:\\\"USHORT\\\",value:0},{name:\\\"usBreakChar\\\",type:\\\"USHORT\\\",value:0},{name:\\\"usMaxContext\\\",type:\\\"USHORT\\\",value:0}],e)}var I2={parse:tme,make:rme,unicodeRanges:B2,getUnicodeRange:eme};function ime(e,t){var r={},i=new ot.Parser(e,t);switch(r.version=i.parseVersion(),r.italicAngle=i.parseFixed(),r.underlinePosition=i.parseShort(),r.underlineThickness=i.parseShort(),r.isFixedPitch=i.parseULong(),r.minMemType42=i.parseULong(),r.maxMemType42=i.parseULong(),r.minMemType1=i.parseULong(),r.maxMemType1=i.parseULong(),r.version){case 1:r.names=_h.slice();break;case 2:r.numberOfGlyphs=i.parseUShort(),r.glyphNameIndex=new Array(r.numberOfGlyphs);for(var s=0;s\\u003cr.numberOfGlyphs;s++)r.glyphNameIndex[s]=i.parseUShort();r.names=[];for(var a=0;a\\u003cr.numberOfGlyphs;a++)if(r.glyphNameIndex[a]>=_h.length){var n=i.parseChar();r.names.push(i.parseString(n))}break;case 2.5:r.numberOfGlyphs=i.parseUShort(),r.offset=new Array(r.numberOfGlyphs);for(var o=0;o\\u003cr.numberOfGlyphs;o++)r.offset[o]=i.parseChar();break}return r}function sme(){return new rt.Table(\\\"post\\\",[{name:\\\"version\\\",type:\\\"FIXED\\\",value:196608},{name:\\\"italicAngle\\\",type:\\\"FIXED\\\",value:0},{name:\\\"underlinePosition\\\",type:\\\"FWORD\\\",value:0},{name:\\\"underlineThickness\\\",type:\\\"FWORD\\\",value:0},{name:\\\"isFixedPitch\\\",type:\\\"ULONG\\\",value:0},{name:\\\"minMemType42\\\",type:\\\"ULONG\\\",value:0},{name:\\\"maxMemType42\\\",type:\\\"ULONG\\\",value:0},{name:\\\"minMemType1\\\",type:\\\"ULONG\\\",value:0},{name:\\\"maxMemType1\\\",type:\\\"ULONG\\\",value:0}])}var WL={parse:ime,make:sme},sn=new Array(9);sn[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(ve.coverage),deltaGlyphId:this.parseUShort()};if(t===2)return{substFormat:2,coverage:this.parsePointer(ve.coverage),substitute:this.parseOffset16List()};bt.assert(!1,\\\"0x\\\"+e.toString(16)+\\\": lookup type 1 format must be 1 or 2.\\\")},sn[2]=function(){var e=this.parseUShort();return bt.argument(e===1,\\\"GSUB Multiple Substitution Subtable identifier-format must be 1\\\"),{substFormat:e,coverage:this.parsePointer(ve.coverage),sequences:this.parseListOfLists()}},sn[3]=function(){var e=this.parseUShort();return bt.argument(e===1,\\\"GSUB Alternate Substitution Subtable identifier-format must be 1\\\"),{substFormat:e,coverage:this.parsePointer(ve.coverage),alternateSets:this.parseListOfLists()}},sn[4]=function(){var e=this.parseUShort();return bt.argument(e===1,\\\"GSUB ligature table identifier-format must be 1\\\"),{substFormat:e,coverage:this.parsePointer(ve.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var Pc={sequenceIndex:ve.uShort,lookupListIndex:ve.uShort};sn[5]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:t,coverage:this.parsePointer(ve.coverage),ruleSets:this.parseListOfLists(function(){var s=this.parseUShort(),a=this.parseUShort();return{input:this.parseUShortList(s-1),lookupRecords:this.parseRecordList(a,Pc)}})};if(t===2)return{substFormat:t,coverage:this.parsePointer(ve.coverage),classDef:this.parsePointer(ve.classDef),classSets:this.parseListOfLists(function(){var s=this.parseUShort(),a=this.parseUShort();return{classes:this.parseUShortList(s-1),lookupRecords:this.parseRecordList(a,Pc)}})};if(t===3){var r=this.parseUShort(),i=this.parseUShort();return{substFormat:t,coverages:this.parseList(r,ve.pointer(ve.coverage)),lookupRecords:this.parseRecordList(i,Pc)}}bt.assert(!1,\\\"0x\\\"+e.toString(16)+\\\": lookup type 5 format must be 1, 2 or 3.\\\")},sn[6]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(ve.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Pc)}})};if(t===2)return{substFormat:2,coverage:this.parsePointer(ve.coverage),backtrackClassDef:this.parsePointer(ve.classDef),inputClassDef:this.parsePointer(ve.classDef),lookaheadClassDef:this.parsePointer(ve.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Pc)}})};if(t===3)return{substFormat:3,backtrackCoverage:this.parseList(ve.pointer(ve.coverage)),inputCoverage:this.parseList(ve.pointer(ve.coverage)),lookaheadCoverage:this.parseList(ve.pointer(ve.coverage)),lookupRecords:this.parseRecordList(Pc)};bt.assert(!1,\\\"0x\\\"+e.toString(16)+\\\": lookup type 6 format must be 1, 2 or 3.\\\")},sn[7]=function(){var e=this.parseUShort();bt.argument(e===1,\\\"GSUB Extension Substitution subtable identifier-format must be 1\\\");var t=this.parseUShort(),r=new ve(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:t,extension:sn[t].call(r)}},sn[8]=function(){var e=this.parseUShort();return bt.argument(e===1,\\\"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1\\\"),{substFormat:e,coverage:this.parsePointer(ve.coverage),backtrackCoverage:this.parseList(ve.pointer(ve.coverage)),lookaheadCoverage:this.parseList(ve.pointer(ve.coverage)),substitutes:this.parseUShortList()}};function ame(e,t){t=t||0;var r=new ve(e,t),i=r.parseVersion(1);return bt.argument(i===1||i===1.1,\\\"Unsupported GSUB table version.\\\"),i===1?{version:i,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(sn)}:{version:i,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(sn),variations:r.parseFeatureVariationsList()}}var Bc=new Array(9);Bc[1]=function(e){return e.substFormat===1?new rt.Table(\\\"substitutionTable\\\",[{name:\\\"substFormat\\\",type:\\\"USHORT\\\",value:1},{name:\\\"coverage\\\",type:\\\"TABLE\\\",value:new rt.Coverage(e.coverage)},{name:\\\"deltaGlyphID\\\",type:\\\"USHORT\\\",value:e.deltaGlyphId}]):new rt.Table(\\\"substitutionTable\\\",[{name:\\\"substFormat\\\",type:\\\"USHORT\\\",value:2},{name:\\\"coverage\\\",type:\\\"TABLE\\\",value:new rt.Coverage(e.coverage)}].concat(rt.ushortList(\\\"substitute\\\",e.substitute)))},Bc[2]=function(e){return bt.assert(e.substFormat===1,\\\"Lookup type 2 substFormat must be 1.\\\"),new rt.Table(\\\"substitutionTable\\\",[{name:\\\"substFormat\\\",type:\\\"USHORT\\\",value:1},{name:\\\"coverage\\\",type:\\\"TABLE\\\",value:new rt.Coverage(e.coverage)}].concat(rt.tableList(\\\"seqSet\\\",e.sequences,function(t){return new rt.Table(\\\"sequenceSetTable\\\",rt.ushortList(\\\"sequence\\\",t))})))},Bc[3]=function(e){return bt.assert(e.substFormat===1,\\\"Lookup type 3 substFormat must be 1.\\\"),new rt.Table(\\\"substitutionTable\\\",[{name:\\\"substFormat\\\",type:\\\"USHORT\\\",value:1},{name:\\\"coverage\\\",type:\\\"TABLE\\\",value:new rt.Coverage(e.coverage)}].concat(rt.tableList(\\\"altSet\\\",e.alternateSets,function(t){return new rt.Table(\\\"alternateSetTable\\\",rt.ushortList(\\\"alternate\\\",t))})))},Bc[4]=function(e){return bt.assert(e.substFormat===1,\\\"Lookup type 4 substFormat must be 1.\\\"),new rt.Table(\\\"substitutionTable\\\",[{name:\\\"substFormat\\\",type:\\\"USHORT\\\",value:1},{name:\\\"coverage\\\",type:\\\"TABLE\\\",value:new rt.Coverage(e.coverage)}].concat(rt.tableList(\\\"ligSet\\\",e.ligatureSets,function(t){return new rt.Table(\\\"ligatureSetTable\\\",rt.tableList(\\\"ligature\\\",t,function(r){return new rt.Table(\\\"ligatureTable\\\",[{name:\\\"ligGlyph\\\",type:\\\"USHORT\\\",value:r.ligGlyph}].concat(rt.ushortList(\\\"component\\\",r.components,r.components.length+1)))}))})))},Bc[6]=function(e){if(e.substFormat===1){var t=new rt.Table(\\\"chainContextTable\\\",[{name:\\\"substFormat\\\",type:\\\"USHORT\\\",value:e.substFormat},{name:\\\"coverage\\\",type:\\\"TABLE\\\",value:new rt.Coverage(e.coverage)}].concat(rt.tableList(\\\"chainRuleSet\\\",e.chainRuleSets,function(s){return new rt.Table(\\\"chainRuleSetTable\\\",rt.tableList(\\\"chainRule\\\",s,function(a){var n=rt.ushortList(\\\"backtrackGlyph\\\",a.backtrack,a.backtrack.length).concat(rt.ushortList(\\\"inputGlyph\\\",a.input,a.input.length+1)).concat(rt.ushortList(\\\"lookaheadGlyph\\\",a.lookahead,a.lookahead.length)).concat(rt.ushortList(\\\"substitution\\\",[],a.lookupRecords.length));return a.lookupRecords.forEach(function(o,l){n=n.concat({name:\\\"sequenceIndex\\\"+l,type:\\\"USHORT\\\",value:o.sequenceIndex}).concat({name:\\\"lookupListIndex\\\"+l,type:\\\"USHORT\\\",value:o.lookupListIndex})}),new rt.Table(\\\"chainRuleTable\\\",n)}))})));return t}else if(e.substFormat===2)bt.assert(!1,\\\"lookup type 6 format 2 is not yet supported.\\\");else if(e.substFormat===3){var r=[{name:\\\"substFormat\\\",type:\\\"USHORT\\\",value:e.substFormat}];r.push({name:\\\"backtrackGlyphCount\\\",type:\\\"USHORT\\\",value:e.backtrackCoverage.length}),e.backtrackCoverage.forEach(function(s,a){r.push({name:\\\"backtrackCoverage\\\"+a,type:\\\"TABLE\\\",value:new rt.Coverage(s)})}),r.push({name:\\\"inputGlyphCount\\\",type:\\\"USHORT\\\",value:e.inputCoverage.length}),e.inputCoverage.forEach(function(s,a){r.push({name:\\\"inputCoverage\\\"+a,type:\\\"TABLE\\\",value:new rt.Coverage(s)})}),r.push({name:\\\"lookaheadGlyphCount\\\",type:\\\"USHORT\\\",value:e.lookaheadCoverage.length}),e.lookaheadCoverage.forEach(function(s,a){r.push({name:\\\"lookaheadCoverage\\\"+a,type:\\\"TABLE\\\",value:new rt.Coverage(s)})}),r.push({name:\\\"substitutionCount\\\",type:\\\"USHORT\\\",value:e.lookupRecords.length}),e.lookupRecords.forEach(function(s,a){r=r.concat({name:\\\"sequenceIndex\\\"+a,type:\\\"USHORT\\\",value:s.sequenceIndex}).concat({name:\\\"lookupListIndex\\\"+a,type:\\\"USHORT\\\",value:s.lookupListIndex})});var i=new rt.Table(\\\"chainContextTable\\\",r);return i}bt.assert(!1,\\\"lookup type 6 format must be 1, 2 or 3.\\\")};function nme(e){return new rt.Table(\\\"GSUB\\\",[{name:\\\"version\\\",type:\\\"ULONG\\\",value:65536},{name:\\\"scripts\\\",type:\\\"TABLE\\\",value:new rt.ScriptList(e.scripts)},{name:\\\"features\\\",type:\\\"TABLE\\\",value:new rt.FeatureList(e.features)},{name:\\\"lookups\\\",type:\\\"TABLE\\\",value:new rt.LookupList(e.lookups,Bc)}])}var jL={parse:ame,make:nme};function ome(e,t){var r=new ot.Parser(e,t),i=r.parseULong();bt.argument(i===1,\\\"Unsupported META table version.\\\"),r.parseULong(),r.parseULong();for(var s=r.parseULong(),a={},n=0;n\\u003cs;n++){var o=r.parseTag(),l=r.parseULong(),u=r.parseULong(),h=Ec.UTF8(e,t+l,u);a[o]=h}return a}function lme(e){var t=Object.keys(e).length,r=\\\"\\\",i=16+t*12,s=new rt.Table(\\\"meta\\\",[{name:\\\"version\\\",type:\\\"ULONG\\\",value:1},{name:\\\"flags\\\",type:\\\"ULONG\\\",value:0},{name:\\\"offset\\\",type:\\\"ULONG\\\",value:i},{name:\\\"numTags\\\",type:\\\"ULONG\\\",value:t}]);for(var a in e){var n=r.length;r+=e[a],s.fields.push({name:\\\"tag \\\"+a,type:\\\"TAG\\\",value:a}),s.fields.push({name:\\\"offset \\\"+a,type:\\\"ULONG\\\",value:i+n}),s.fields.push({name:\\\"length \\\"+a,type:\\\"ULONG\\\",value:e[a].length})}return s.fields.push({name:\\\"stringPool\\\",type:\\\"CHARARRAY\\\",value:r}),s}var HL={parse:ome,make:lme};function XL(e){return Math.log(e)/Math.log(2)|0}function F2(e){for(;e.length%4!==0;)e.push(0);for(var t=0,r=0;r\\u003ce.length;r+=4)t+=(e[r]\\u003c\\u003c24)+(e[r+1]\\u003c\\u003c16)+(e[r+2]\\u003c\\u003c8)+e[r+3];return t%=Math.pow(2,32),t}function $L(e,t,r,i){return new rt.Record(\\\"Table Record\\\",[{name:\\\"tag\\\",type:\\\"TAG\\\",value:e!==void 0?e:\\\"\\\"},{name:\\\"checkSum\\\",type:\\\"ULONG\\\",value:t!==void 0?t:0},{name:\\\"offset\\\",type:\\\"ULONG\\\",value:r!==void 0?r:0},{name:\\\"length\\\",type:\\\"ULONG\\\",value:i!==void 0?i:0}])}function qL(e){var t=new rt.Table(\\\"sfnt\\\",[{name:\\\"version\\\",type:\\\"TAG\\\",value:\\\"OTTO\\\"},{name:\\\"numTables\\\",type:\\\"USHORT\\\",value:0},{name:\\\"searchRange\\\",type:\\\"USHORT\\\",value:0},{name:\\\"entrySelector\\\",type:\\\"USHORT\\\",value:0},{name:\\\"rangeShift\\\",type:\\\"USHORT\\\",value:0}]);t.tables=e,t.numTables=e.length;var r=Math.pow(2,XL(t.numTables));t.searchRange=16*r,t.entrySelector=XL(r),t.rangeShift=t.numTables*16-t.searchRange;for(var i=[],s=[],a=t.sizeOf()+$L().sizeOf()*t.numTables;a%4!==0;)a+=1,s.push({name:\\\"padding\\\",type:\\\"BYTE\\\",value:0});for(var n=0;n\\u003ce.length;n+=1){var o=e[n];bt.argument(o.tableName.length===4,\\\"Table name\\\"+o.tableName+\\\" is invalid.\\\");var l=o.sizeOf(),u=$L(o.tableName,F2(o.encode()),a,l);for(i.push({name:u.tag+\\\" Table Record\\\",type:\\\"RECORD\\\",value:u}),s.push({name:o.tableName+\\\" table\\\",type:\\\"RECORD\\\",value:o}),a+=l,bt.argument(!isNaN(a),\\\"Something went wrong calculating the offset.\\\");a%4!==0;)a+=1,s.push({name:\\\"padding\\\",type:\\\"BYTE\\\",value:0})}return i.sort(function(h,d){return h.value.tag>d.value.tag?1:-1}),t.fields=t.fields.concat(i),t.fields=t.fields.concat(s),t}function YL(e,t,r){for(var i=0;i\\u003ct.length;i+=1){var s=e.charToGlyphIndex(t[i]);if(s>0){var a=e.glyphs.get(s);return a.getMetrics()}}return r}function ume(e){for(var t=0,r=0;r\\u003ce.length;r+=1)t+=e[r];return t/e.length}function hme(e){for(var t=[],r=[],i=[],s=[],a=[],n=[],o=[],l,u=0,h=0,d=0,c=0,m=0,g=0;g\\u003ce.glyphs.length;g+=1){var y=e.glyphs.get(g),b=y.unicode|0;if(isNaN(y.advanceWidth))throw new Error(\\\"Glyph \\\"+y.name+\\\" (\\\"+g+\\\"): advanceWidth is not a number.\\\");(l>b||l===void 0)&&b>0&&(l=b),u\\u003cb&&(u=b);var v=I2.getUnicodeRange(b);if(v\\u003c32)h|=1\\u003c\\u003cv;else if(v\\u003c64)d|=1\\u003c\\u003cv-32;else if(v\\u003c96)c|=1\\u003c\\u003cv-64;else if(v\\u003c123)m|=1\\u003c\\u003cv-96;else throw new Error(\\\"Unicode ranges bits > 123 are reserved for internal usage\\\");if(y.name!==\\\".notdef\\\"){var S=y.getMetrics();t.push(S.xMin),r.push(S.yMin),i.push(S.xMax),s.push(S.yMax),n.push(S.leftSideBearing),o.push(S.rightSideBearing),a.push(y.advanceWidth)}}var T={xMin:Math.min.apply(null,t),yMin:Math.min.apply(null,r),xMax:Math.max.apply(null,i),yMax:Math.max.apply(null,s),advanceWidthMax:Math.max.apply(null,a),advanceWidthAvg:ume(a),minLeftSideBearing:Math.min.apply(null,n),maxLeftSideBearing:Math.max.apply(null,n),minRightSideBearing:Math.min.apply(null,o)};T.ascender=e.ascender,T.descender=e.descender;var w=PL.make({flags:3,unitsPerEm:e.unitsPerEm,xMin:T.xMin,yMin:T.yMin,xMax:T.xMax,yMax:T.yMax,lowestRecPPEM:3,createdTimestamp:e.createdTimestamp}),N=BL.make({ascender:T.ascender,descender:T.descender,advanceWidthMax:T.advanceWidthMax,minLeftSideBearing:T.minLeftSideBearing,minRightSideBearing:T.minRightSideBearing,xMaxExtent:T.maxLeftSideBearing+(T.xMax-T.xMin),numberOfHMetrics:e.glyphs.length}),C=LL.make(e.glyphs.length),R=I2.make(Object.assign({xAvgCharWidth:Math.round(T.advanceWidthAvg),usFirstCharIndex:l,usLastCharIndex:u,ulUnicodeRange1:h,ulUnicodeRange2:d,ulUnicodeRange3:c,ulUnicodeRange4:m,sTypoAscender:T.ascender,sTypoDescender:T.descender,sTypoLineGap:0,usWinAscent:T.yMax,usWinDescent:Math.abs(T.yMin),ulCodePageRange1:1,sxHeight:YL(e,\\\"xyvw\\\",{yMax:Math.round(T.ascender/2)}).yMax,sCapHeight:YL(e,\\\"HIKLEFJMNTZBDPRAGOQSUVWXY\\\",T).yMax,usDefaultChar:e.hasChar(\\\" \\\")?32:0,usBreakChar:e.hasChar(\\\" \\\")?32:0},e.tables.os2)),E=IL.make(e.glyphs),P=fL.make(e.glyphs),I=e.getEnglishName(\\\"fontFamily\\\"),O=e.getEnglishName(\\\"fontSubfamily\\\"),L=I+\\\" \\\"+O,X=e.getEnglishName(\\\"postScriptName\\\");X||(X=I.replace(/\\\\s/g,\\\"\\\")+\\\"-\\\"+O);var z={};for(var H in e.names)z[H]=e.names[H];z.uniqueID||(z.uniqueID={en:e.getEnglishName(\\\"manufacturer\\\")+\\\":\\\"+L}),z.postScriptName||(z.postScriptName={en:X}),z.preferredFamily||(z.preferredFamily=e.names.fontFamily),z.preferredSubfamily||(z.preferredSubfamily=e.names.fontSubfamily);var ue=[],ne=GL.make(z,ue),re=ue.length>0?FL.make(ue):void 0,ce=WL.make(),ge=EL.make(e.glyphs,{version:e.getEnglishName(\\\"version\\\"),fullName:L,familyName:I,weightName:O,postScriptName:X,unitsPerEm:e.unitsPerEm,fontBBox:[0,T.yMin,T.ascender,T.advanceWidthMax]}),ye=e.metas&&Object.keys(e.metas).length>0?HL.make(e.metas):void 0,oe=[w,N,C,R,ne,P,ce,ge,E];re&&oe.push(re),e.tables.gsub&&oe.push(jL.make(e.tables.gsub)),ye&&oe.push(ye);for(var Ae=qL(oe),Ie=Ae.encode(),Xe=F2(Ie),at=Ae.fields,W=!1,j=0;j\\u003cat.length;j+=1)if(at[j].name===\\\"head table\\\"){at[j].value.checkSumAdjustment=2981146554-Xe,W=!0;break}if(!W)throw new Error(\\\"Could not find head table with checkSum to adjust.\\\");return Ae}var dme={make:qL,fontToTable:hme,computeCheckSum:F2};function L2(e,t){for(var r=0,i=e.length-1;r\\u003c=i;){var s=r+i>>>1,a=e[s].tag;if(a===t)return s;a\\u003ct?r=s+1:i=s-1}return-r-1}function ZL(e,t){for(var r=0,i=e.length-1;r\\u003c=i;){var s=r+i>>>1,a=e[s];if(a===t)return s;a\\u003ct?r=s+1:i=s-1}return-r-1}function JL(e,t){for(var r,i=0,s=e.length-1;i\\u003c=s;){var a=i+s>>>1;r=e[a];var n=r.start;if(n===t)return r;n\\u003ct?i=a+1:s=a-1}if(i>0)return r=e[i-1],t>r.end?0:r}function lf(e,t){this.font=e,this.tableName=t}lf.prototype={searchTag:L2,binSearch:ZL,getTable:function(e){var t=this.font.tables[this.tableName];return!t&&e&&(t=this.font.tables[this.tableName]=this.createDefaultTable()),t},getScriptNames:function(){var e=this.getTable();return e?e.scripts.map(function(t){return t.tag}):[]},getDefaultScriptName:function(){var e=this.getTable();if(e){for(var t=!1,r=0;r\\u003ce.scripts.length;r++){var i=e.scripts[r].tag;if(i===\\\"DFLT\\\")return i;i===\\\"latn\\\"&&(t=!0)}if(t)return\\\"latn\\\"}},getScriptTable:function(e,t){var r=this.getTable(t);if(r){e=e||\\\"DFLT\\\";var i=r.scripts,s=L2(r.scripts,e);if(s>=0)return i[s].script;if(t){var a={tag:e,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return i.splice(-1-s,0,a),a.script}}},getLangSysTable:function(e,t,r){var i=this.getScriptTable(e,r);if(i){if(!t||t===\\\"dflt\\\"||t===\\\"DFLT\\\")return i.defaultLangSys;var s=L2(i.langSysRecords,t);if(s>=0)return i.langSysRecords[s].langSys;if(r){var a={tag:t,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return i.langSysRecords.splice(-1-s,0,a),a.langSys}}},getFeatureTable:function(e,t,r,i){var s=this.getLangSysTable(e,t,i);if(s){for(var a,n=s.featureIndexes,o=this.font.tables[this.tableName].features,l=0;l\\u003cn.length;l++)if(a=o[n[l]],a.tag===r)return a.feature;if(i){var u=o.length;return bt.assert(u===0||r>=o[u-1].tag,\\\"Features must be added in alphabetical order.\\\"),a={tag:r,feature:{params:0,lookupListIndexes:[]}},o.push(a),n.push(u),a.feature}}},getLookupTables:function(e,t,r,i,s){var a=this.getFeatureTable(e,t,r,s),n=[];if(a){for(var o,l=a.lookupListIndexes,u=this.font.tables[this.tableName].lookups,h=0;h\\u003cl.length;h++)o=u[l[h]],o.lookupType===i&&n.push(o);if(n.length===0&&s){o={lookupType:i,lookupFlag:0,subtables:[],markFilteringSet:void 0};var d=u.length;return u.push(o),l.push(d),[o]}}return n},getGlyphClass:function(e,t){switch(e.format){case 1:return e.startGlyph\\u003c=t&&t\\u003ce.startGlyph+e.classes.length?e.classes[t-e.startGlyph]:0;case 2:var r=JL(e.ranges,t);return r?r.classId:0}},getCoverageIndex:function(e,t){switch(e.format){case 1:var r=ZL(e.glyphs,t);return r>=0?r:-1;case 2:var i=JL(e.ranges,t);return i?i.index+t-i.start:-1}},expandCoverage:function(e){if(e.format===1)return e.glyphs;for(var t=[],r=e.ranges,i=0;i\\u003cr.length;i++)for(var s=r[i],a=s.start,n=s.end,o=a;o\\u003c=n;o++)t.push(o);return t}};function uf(e){lf.call(this,e,\\\"gpos\\\")}uf.prototype=lf.prototype,uf.prototype.init=function(){var e=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(e)},uf.prototype.getKerningValue=function(e,t,r){for(var i=0;i\\u003ce.length;i++)for(var s=e[i].subtables,a=0;a\\u003cs.length;a++){var n=s[a],o=this.getCoverageIndex(n.coverage,t);if(!(o\\u003c0))switch(n.posFormat){case 1:for(var l=n.pairSets[o],u=0;u\\u003cl.length;u++){var h=l[u];if(h.secondGlyph===r)return h.value1&&h.value1.xAdvance||0}break;case 2:var d=this.getGlyphClass(n.classDef1,t),c=this.getGlyphClass(n.classDef2,r),m=n.classRecords[d][c];return m.value1&&m.value1.xAdvance||0}}return 0},uf.prototype.getKerningTables=function(e,t){if(this.font.tables.gpos)return this.getLookupTables(e,t,\\\"kern\\\",2)};function sa(e){lf.call(this,e,\\\"gsub\\\")}function cme(e,t){var r=e.length;if(r!==t.length)return!1;for(var i=0;i\\u003cr;i++)if(e[i]!==t[i])return!1;return!0}function k2(e,t,r){for(var i=e.subtables,s=0;s\\u003ci.length;s++){var a=i[s];if(a.substFormat===t)return a}if(r)return i.push(r),r}sa.prototype=lf.prototype,sa.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:\\\"DFLT\\\",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},sa.prototype.getSingle=function(e,t,r){for(var i=[],s=this.getLookupTables(t,r,e,1),a=0;a\\u003cs.length;a++)for(var n=s[a].subtables,o=0;o\\u003cn.length;o++){var l=n[o],u=this.expandCoverage(l.coverage),h=void 0;if(l.substFormat===1){var d=l.deltaGlyphId;for(h=0;h\\u003cu.length;h++){var c=u[h];i.push({sub:c,by:c+d})}}else{var m=l.substitute;for(h=0;h\\u003cu.length;h++)i.push({sub:u[h],by:m[h]})}}return i},sa.prototype.getMultiple=function(e,t,r){for(var i=[],s=this.getLookupTables(t,r,e,2),a=0;a\\u003cs.length;a++)for(var n=s[a].subtables,o=0;o\\u003cn.length;o++){var l=n[o],u=this.expandCoverage(l.coverage),h=void 0;for(h=0;h\\u003cu.length;h++){var d=u[h],c=l.sequences[h];i.push({sub:d,by:c})}}return i},sa.prototype.getAlternates=function(e,t,r){for(var i=[],s=this.getLookupTables(t,r,e,3),a=0;a\\u003cs.length;a++)for(var n=s[a].subtables,o=0;o\\u003cn.length;o++)for(var l=n[o],u=this.expandCoverage(l.coverage),h=l.alternateSets,d=0;d\\u003cu.length;d++)i.push({sub:u[d],by:h[d]});return i},sa.prototype.getLigatures=function(e,t,r){for(var i=[],s=this.getLookupTables(t,r,e,4),a=0;a\\u003cs.length;a++)for(var n=s[a].subtables,o=0;o\\u003cn.length;o++)for(var l=n[o],u=this.expandCoverage(l.coverage),h=l.ligatureSets,d=0;d\\u003cu.length;d++)for(var c=u[d],m=h[d],g=0;g\\u003cm.length;g++){var y=m[g];i.push({sub:[c].concat(y.components),by:y.ligGlyph})}return i},sa.prototype.addSingle=function(e,t,r,i){var s=this.getLookupTables(r,i,e,1,!0)[0],a=k2(s,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});bt.assert(a.coverage.format===1,\\\"Single: unable to modify coverage table format \\\"+a.coverage.format);var n=t.sub,o=this.binSearch(a.coverage.glyphs,n);o\\u003c0&&(o=-1-o,a.coverage.glyphs.splice(o,0,n),a.substitute.splice(o,0,0)),a.substitute[o]=t.by},sa.prototype.addMultiple=function(e,t,r,i){bt.assert(t.by instanceof Array&&t.by.length>1,'Multiple: \\\"by\\\" must be an array of two or more ids');var s=this.getLookupTables(r,i,e,2,!0)[0],a=k2(s,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});bt.assert(a.coverage.format===1,\\\"Multiple: unable to modify coverage table format \\\"+a.coverage.format);var n=t.sub,o=this.binSearch(a.coverage.glyphs,n);o\\u003c0&&(o=-1-o,a.coverage.glyphs.splice(o,0,n),a.sequences.splice(o,0,0)),a.sequences[o]=t.by},sa.prototype.addAlternate=function(e,t,r,i){var s=this.getLookupTables(r,i,e,3,!0)[0],a=k2(s,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});bt.assert(a.coverage.format===1,\\\"Alternate: unable to modify coverage table format \\\"+a.coverage.format);var n=t.sub,o=this.binSearch(a.coverage.glyphs,n);o\\u003c0&&(o=-1-o,a.coverage.glyphs.splice(o,0,n),a.alternateSets.splice(o,0,0)),a.alternateSets[o]=t.by},sa.prototype.addLigature=function(e,t,r,i){var s=this.getLookupTables(r,i,e,4,!0)[0],a=s.subtables[0];a||(a={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},s.subtables[0]=a),bt.assert(a.coverage.format===1,\\\"Ligature: unable to modify coverage table format \\\"+a.coverage.format);var n=t.sub[0],o=t.sub.slice(1),l={ligGlyph:t.by,components:o},u=this.binSearch(a.coverage.glyphs,n);if(u>=0){for(var h=a.ligatureSets[u],d=0;d\\u003ch.length;d++)if(cme(h[d].components,o))return;h.push(l)}else u=-1-u,a.coverage.glyphs.splice(u,0,n),a.ligatureSets.splice(u,0,[l])},sa.prototype.getFeature=function(e,t,r){if(/ss\\\\d\\\\d/.test(e))return this.getSingle(e,t,r);switch(e){case\\\"aalt\\\":case\\\"salt\\\":return this.getSingle(e,t,r).concat(this.getAlternates(e,t,r));case\\\"dlig\\\":case\\\"liga\\\":case\\\"rlig\\\":return this.getLigatures(e,t,r);case\\\"ccmp\\\":return this.getMultiple(e,t,r).concat(this.getLigatures(e,t,r));case\\\"stch\\\":return this.getMultiple(e,t,r)}},sa.prototype.add=function(e,t,r,i){if(/ss\\\\d\\\\d/.test(e))return this.addSingle(e,t,r,i);switch(e){case\\\"aalt\\\":case\\\"salt\\\":return typeof t.by==\\\"number\\\"?this.addSingle(e,t,r,i):this.addAlternate(e,t,r,i);case\\\"dlig\\\":case\\\"liga\\\":case\\\"rlig\\\":return this.addLigature(e,t,r,i);case\\\"ccmp\\\":return t.by instanceof Array?this.addMultiple(e,t,r,i):this.addLigature(e,t,r,i)}};function pme(){return typeof window\\u003c\\\"u\\\"}function QL(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),i=0;i\\u003ce.length;++i)r[i]=e[i];return t}function mme(e){for(var t=new Buffer(e.byteLength),r=new Uint8Array(e),i=0;i\\u003ct.length;++i)t[i]=r[i];return t}function hf(e,t){if(!e)throw t}function KL(e,t,r,i,s){var a;return(t&i)>0?(a=e.parseByte(),(t&s)===0&&(a=-a),a=r+a):(t&s)>0?a=r:a=r+e.parseShort(),a}function ek(e,t,r){var i=new ot.Parser(t,r);e.numberOfContours=i.parseShort(),e._xMin=i.parseShort(),e._yMin=i.parseShort(),e._xMax=i.parseShort(),e._yMax=i.parseShort();var s,a;if(e.numberOfContours>0){for(var n=e.endPointIndices=[],o=0;o\\u003ce.numberOfContours;o+=1)n.push(i.parseUShort());e.instructionLength=i.parseUShort(),e.instructions=[];for(var l=0;l\\u003ce.instructionLength;l+=1)e.instructions.push(i.parseByte());var u=n[n.length-1]+1;s=[];for(var h=0;h\\u003cu;h+=1)if(a=i.parseByte(),s.push(a),(a&8)>0)for(var d=i.parseByte(),c=0;c\\u003cd;c+=1)s.push(a),h+=1;if(bt.argument(s.length===u,\\\"Bad flags.\\\"),n.length>0){var m=[],g;if(u>0){for(var y=0;y\\u003cu;y+=1)a=s[y],g={},g.onCurve=!!(a&1),g.lastPointOfContour=n.indexOf(y)>=0,m.push(g);for(var b=0,v=0;v\\u003cu;v+=1)a=s[v],g=m[v],g.x=KL(i,a,b,2,16),b=g.x;for(var S=0,T=0;T\\u003cu;T+=1)a=s[T],g=m[T],g.y=KL(i,a,S,4,32),S=g.y}e.points=m}else e.points=[]}else if(e.numberOfContours===0)e.points=[];else{e.isComposite=!0,e.points=[],e.components=[];for(var w=!0;w;){s=i.parseUShort();var N={glyphIndex:i.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(s&1)>0?(s&2)>0?(N.dx=i.parseShort(),N.dy=i.parseShort()):N.matchedPoints=[i.parseUShort(),i.parseUShort()]:(s&2)>0?(N.dx=i.parseChar(),N.dy=i.parseChar()):N.matchedPoints=[i.parseByte(),i.parseByte()],(s&8)>0?N.xScale=N.yScale=i.parseF2Dot14():(s&64)>0?(N.xScale=i.parseF2Dot14(),N.yScale=i.parseF2Dot14()):(s&128)>0&&(N.xScale=i.parseF2Dot14(),N.scale01=i.parseF2Dot14(),N.scale10=i.parseF2Dot14(),N.yScale=i.parseF2Dot14()),e.components.push(N),w=!!(s&32)}if(s&256){e.instructionLength=i.parseUShort(),e.instructions=[];for(var C=0;C\\u003ce.instructionLength;C+=1)e.instructions.push(i.parseByte())}}}function D2(e,t){for(var r=[],i=0;i\\u003ce.length;i+=1){var s=e[i],a={x:t.xScale*s.x+t.scale01*s.y+t.dx,y:t.scale10*s.x+t.yScale*s.y+t.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};r.push(a)}return r}function fme(e){for(var t=[],r=[],i=0;i\\u003ce.length;i+=1){var s=e[i];r.push(s),s.lastPointOfContour&&(t.push(r),r=[])}return bt.argument(r.length===0,\\\"There are still points left in the current contour.\\\"),t}function tk(e){var t=new di;if(!e)return t;for(var r=fme(e),i=0;i\\u003cr.length;++i){var s=r[i],a=null,n=s[s.length-1],o=s[0];if(n.onCurve)t.moveTo(n.x,n.y);else if(o.onCurve)t.moveTo(o.x,o.y);else{var l={x:(n.x+o.x)*.5,y:(n.y+o.y)*.5};t.moveTo(l.x,l.y)}for(var u=0;u\\u003cs.length;++u)if(a=n,n=o,o=s[(u+1)%s.length],n.onCurve)t.lineTo(n.x,n.y);else{var h=a,d=o;a.onCurve||(h={x:(n.x+a.x)*.5,y:(n.y+a.y)*.5}),o.onCurve||(d={x:(n.x+o.x)*.5,y:(n.y+o.y)*.5}),t.quadraticCurveTo(n.x,n.y,d.x,d.y)}t.closePath()}return t}function rk(e,t){if(t.isComposite)for(var r=0;r\\u003ct.components.length;r+=1){var i=t.components[r],s=e.get(i.glyphIndex);if(s.getPath(),s.points){var a=void 0;if(i.matchedPoints===void 0)a=D2(s.points,i);else{if(i.matchedPoints[0]>t.points.length-1||i.matchedPoints[1]>s.points.length-1)throw Error(\\\"Matched points out of range in \\\"+t.name);var n=t.points[i.matchedPoints[0]],o=s.points[i.matchedPoints[1]],l={xScale:i.xScale,scale01:i.scale01,scale10:i.scale10,yScale:i.yScale,dx:0,dy:0};o=D2([o],l)[0],l.dx=n.x-o.x,l.dy=n.y-o.y,a=D2(s.points,l)}t.points=t.points.concat(a)}}return tk(t.points)}function gme(e,t,r,i){for(var s=new Zn.GlyphSet(i),a=0;a\\u003cr.length-1;a+=1){var n=r[a],o=r[a+1];n!==o?s.push(a,Zn.ttfGlyphLoader(i,a,ek,e,t+n,rk)):s.push(a,Zn.glyphLoader(i,a))}return s}function yme(e,t,r,i){var s=new Zn.GlyphSet(i);return i._push=function(a){var n=r[a],o=r[a+1];n!==o?s.push(a,Zn.ttfGlyphLoader(i,a,ek,e,t+n,rk)):s.push(a,Zn.glyphLoader(i,a))},s}function xme(e,t,r,i,s){return s.lowMemory?yme(e,t,r,i):gme(e,t,r,i)}var ik={getPath:tk,parse:xme},sk,Mh,ak,O2;function nk(e){this.font=e,this.getCommands=function(t){return ik.getPath(t).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function vme(e){return e}function ok(e){return Math.sign(e)*Math.round(Math.abs(e))}function bme(e){return Math.sign(e)*Math.round(Math.abs(e*2))/2}function Tme(e){return Math.sign(e)*(Math.round(Math.abs(e)+.5)-.5)}function Sme(e){return Math.sign(e)*Math.ceil(Math.abs(e))}function _me(e){return Math.sign(e)*Math.floor(Math.abs(e))}var lk=function(e){var t=this.srPeriod,r=this.srPhase,i=this.srThreshold,s=1;return e\\u003c0&&(e=-e,s=-1),e+=i-r,e=Math.trunc(e/t)*t,e+=r,e\\u003c0?r*s:e*s},Jn={x:1,y:0,axis:\\\"x\\\",distance:function(e,t,r,i){return(r?e.xo:e.x)-(i?t.xo:t.x)},interpolate:function(e,t,r,i){var s,a,n,o,l,u,h;if(!i||i===this){if(s=e.xo-t.xo,a=e.xo-r.xo,l=t.x-t.xo,u=r.x-r.xo,n=Math.abs(s),o=Math.abs(a),h=n+o,h===0){e.x=e.xo+(l+u)/2;return}e.x=e.xo+(l*o+u*n)/h;return}if(s=i.distance(e,t,!0,!0),a=i.distance(e,r,!0,!0),l=i.distance(t,t,!1,!0),u=i.distance(r,r,!1,!0),n=Math.abs(s),o=Math.abs(a),h=n+o,h===0){Jn.setRelative(e,e,(l+u)/2,i,!0);return}Jn.setRelative(e,e,(l*o+u*n)/h,i,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(e,t,r,i,s){if(!i||i===this){e.x=(s?t.xo:t.x)+r;return}var a=s?t.xo:t.x,n=s?t.yo:t.y,o=a+r*i.x,l=n+r*i.y;e.x=o+(e.y-l)/i.normalSlope},slope:0,touch:function(e){e.xTouched=!0},touched:function(e){return e.xTouched},untouch:function(e){e.xTouched=!1}},qo={x:0,y:1,axis:\\\"y\\\",distance:function(e,t,r,i){return(r?e.yo:e.y)-(i?t.yo:t.y)},interpolate:function(e,t,r,i){var s,a,n,o,l,u,h;if(!i||i===this){if(s=e.yo-t.yo,a=e.yo-r.yo,l=t.y-t.yo,u=r.y-r.yo,n=Math.abs(s),o=Math.abs(a),h=n+o,h===0){e.y=e.yo+(l+u)/2;return}e.y=e.yo+(l*o+u*n)/h;return}if(s=i.distance(e,t,!0,!0),a=i.distance(e,r,!0,!0),l=i.distance(t,t,!1,!0),u=i.distance(r,r,!1,!0),n=Math.abs(s),o=Math.abs(a),h=n+o,h===0){qo.setRelative(e,e,(l+u)/2,i,!0);return}qo.setRelative(e,e,(l*o+u*n)/h,i,!0)},normalSlope:0,setRelative:function(e,t,r,i,s){if(!i||i===this){e.y=(s?t.yo:t.y)+r;return}var a=s?t.xo:t.x,n=s?t.yo:t.y,o=a+r*i.x,l=n+r*i.y;e.y=l+i.normalSlope*(e.x-o)},slope:Number.POSITIVE_INFINITY,touch:function(e){e.yTouched=!0},touched:function(e){return e.yTouched},untouch:function(e){e.yTouched=!1}};Object.freeze(Jn),Object.freeze(qo);function df(e,t){this.x=e,this.y=t,this.axis=void 0,this.slope=t/e,this.normalSlope=-e/t,Object.freeze(this)}df.prototype.distance=function(e,t,r,i){return this.x*Jn.distance(e,t,r,i)+this.y*qo.distance(e,t,r,i)},df.prototype.interpolate=function(e,t,r,i){var s,a,n,o,l,u,h;if(n=i.distance(e,t,!0,!0),o=i.distance(e,r,!0,!0),s=i.distance(t,t,!1,!0),a=i.distance(r,r,!1,!0),l=Math.abs(n),u=Math.abs(o),h=l+u,h===0){this.setRelative(e,e,(s+a)/2,i,!0);return}this.setRelative(e,e,(s*u+a*l)/h,i,!0)},df.prototype.setRelative=function(e,t,r,i,s){i=i||this;var a=s?t.xo:t.x,n=s?t.yo:t.y,o=a+r*i.x,l=n+r*i.y,u=i.normalSlope,h=this.slope,d=e.x,c=e.y;e.x=(h*d-u*o+l-c)/(h-u),e.y=h*(e.x-d)+c},df.prototype.touch=function(e){e.xTouched=!0,e.yTouched=!0};function cf(e,t){var r=Math.sqrt(e*e+t*t);return e/=r,t/=r,e===1&&t===0?Jn:e===0&&t===1?qo:new df(e,t)}function Yo(e,t,r,i){this.x=this.xo=Math.round(e*64)/64,this.y=this.yo=Math.round(t*64)/64,this.lastPointOfContour=r,this.onCurve=i,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}Yo.prototype.nextTouched=function(e){for(var t=this.nextPointOnContour;!e.touched(t)&&t!==this;)t=t.nextPointOnContour;return t},Yo.prototype.prevTouched=function(e){for(var t=this.prevPointOnContour;!e.touched(t)&&t!==this;)t=t.prevPointOnContour;return t};var pf=Object.freeze(new Yo(0,0)),wme={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function iu(e,t){switch(this.env=e,this.stack=[],this.prog=t,e){case\\\"glyf\\\":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case\\\"prep\\\":this.fv=this.pv=this.dpv=Jn,this.round=ok}}nk.prototype.exec=function(e,t){if(typeof t!=\\\"number\\\")throw new Error(\\\"Point size is not a number!\\\");if(!(this._errorState>2)){var r=this.font,i=this._prepState;if(!i||i.ppem!==t){var s=this._fpgmState;if(!s){iu.prototype=wme,s=this._fpgmState=new iu(\\\"fpgm\\\",r.tables.fpgm),s.funcs=[],s.font=r,exports.DEBUG&&(console.log(\\\"---EXEC FPGM---\\\"),s.step=-1);try{Mh(s)}catch(u){console.log(\\\"Hinting error in FPGM:\\\"+u),this._errorState=3;return}}iu.prototype=s,i=this._prepState=new iu(\\\"prep\\\",r.tables.prep),i.ppem=t;var a=r.tables.cvt;if(a)for(var n=i.cvt=new Array(a.length),o=t/r.unitsPerEm,l=0;l\\u003ca.length;l++)n[l]=a[l]*o;else i.cvt=[];exports.DEBUG&&(console.log(\\\"---EXEC PREP---\\\"),i.step=-1);try{Mh(i)}catch(u){this._errorState\\u003c2&&console.log(\\\"Hinting error in PREP:\\\"+u),this._errorState=2}}if(!(this._errorState>1))try{return ak(e,i)}catch(u){this._errorState\\u003c1&&(console.log(\\\"Hinting error:\\\"+u),console.log(\\\"Note: further hinting errors are silenced\\\")),this._errorState=1;return}}},ak=function(e,t){var r=t.ppem/t.font.unitsPerEm,i=r,s=e.components,a,n,o;if(iu.prototype=t,!s)o=new iu(\\\"glyf\\\",e.instructions),exports.DEBUG&&(console.log(\\\"---EXEC GLYPH---\\\"),o.step=-1),O2(e,o,r,i),n=o.gZone;else{var l=t.font;n=[],a=[];for(var u=0;u\\u003cs.length;u++){var h=s[u],d=l.glyphs.get(h.glyphIndex);o=new iu(\\\"glyf\\\",d.instructions),exports.DEBUG&&(console.log(\\\"---EXEC COMP \\\"+u+\\\"---\\\"),o.step=-1),O2(d,o,r,i);for(var c=Math.round(h.dx*r),m=Math.round(h.dy*i),g=o.gZone,y=o.contours,b=0;b\\u003cg.length;b++){var v=g[b];v.xTouched=v.yTouched=!1,v.xo=v.x=v.x+c,v.yo=v.y=v.y+m}var S=n.length;n.push.apply(n,g);for(var T=0;T\\u003cy.length;T++)a.push(y[T]+S)}e.instructions&&!o.inhibitGridFit&&(o=new iu(\\\"glyf\\\",e.instructions),o.gZone=o.z0=o.z1=o.z2=n,o.contours=a,n.push(new Yo(0,0),new Yo(Math.round(e.advanceWidth*r),0)),exports.DEBUG&&(console.log(\\\"---EXEC COMPOSITE---\\\"),o.step=-1),Mh(o),n.length-=2)}return n},O2=function(e,t,r,i){for(var s=e.points||[],a=s.length,n=t.gZone=t.z0=t.z1=t.z2=[],o=t.contours=[],l,u=0;u\\u003ca;u++)l=s[u],n[u]=new Yo(l.x*r,l.y*i,l.lastPointOfContour,l.onCurve);for(var h,d,c=0;c\\u003ca;c++)l=n[c],h||(h=l,o.push(c)),l.lastPointOfContour?(l.nextPointOnContour=h,h.prevPointOnContour=l,h=void 0):(d=n[c+1],l.nextPointOnContour=d,d.prevPointOnContour=l);if(!t.inhibitGridFit){if(exports.DEBUG){console.log(\\\"PROCESSING GLYPH\\\",t.stack);for(var m=0;m\\u003ca;m++)console.log(m,n[m].x,n[m].y)}if(n.push(new Yo(0,0),new Yo(Math.round(e.advanceWidth*r),0)),Mh(t),n.length-=2,exports.DEBUG){console.log(\\\"FINISHED GLYPH\\\",t.stack);for(var g=0;g\\u003ca;g++)console.log(g,n[g].x,n[g].y)}}},Mh=function(e){var t=e.prog;if(t){var r=t.length,i;for(e.ip=0;e.ip\\u003cr;e.ip++){if(exports.DEBUG&&e.step++,i=sk[t[e.ip]],!i)throw new Error(\\\"unknown instruction: 0x\\\"+Number(t[e.ip]).toString(16));i(e)}}};function Ox(e){for(var t=e.tZone=new Array(e.gZone.length),r=0;r\\u003ct.length;r++)t[r]=new Yo(0,0)}function uk(e,t){var r=e.prog,i=e.ip,s=1,a;do if(a=r[++i],a===88)s++;else if(a===89)s--;else if(a===64)i+=r[i+1]+1;else if(a===65)i+=2*r[i+1]+1;else if(a>=176&&a\\u003c=183)i+=a-176+1;else if(a>=184&&a\\u003c=191)i+=(a-184+1)*2;else if(t&&s===1&&a===27)break;while(s>0);e.ip=i}function hk(e,t){exports.DEBUG&&console.log(t.step,\\\"SVTCA[\\\"+e.axis+\\\"]\\\"),t.fv=t.pv=t.dpv=e}function dk(e,t){exports.DEBUG&&console.log(t.step,\\\"SPVTCA[\\\"+e.axis+\\\"]\\\"),t.pv=t.dpv=e}function ck(e,t){exports.DEBUG&&console.log(t.step,\\\"SFVTCA[\\\"+e.axis+\\\"]\\\"),t.fv=e}function pk(e,t){var r=t.stack,i=r.pop(),s=r.pop(),a=t.z2[i],n=t.z1[s];exports.DEBUG&&console.log(\\\"SPVTL[\\\"+e+\\\"]\\\",i,s);var o,l;e?(o=a.y-n.y,l=n.x-a.x):(o=n.x-a.x,l=n.y-a.y),t.pv=t.dpv=cf(o,l)}function mk(e,t){var r=t.stack,i=r.pop(),s=r.pop(),a=t.z2[i],n=t.z1[s];exports.DEBUG&&console.log(\\\"SFVTL[\\\"+e+\\\"]\\\",i,s);var o,l;e?(o=a.y-n.y,l=n.x-a.x):(o=n.x-a.x,l=n.y-a.y),t.fv=cf(o,l)}function Mme(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"SPVFS[]\\\",r,i),e.pv=e.dpv=cf(i,r)}function Nme(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"SPVFS[]\\\",r,i),e.fv=cf(i,r)}function Ame(e){var t=e.stack,r=e.pv;exports.DEBUG&&console.log(e.step,\\\"GPV[]\\\"),t.push(r.x*16384),t.push(r.y*16384)}function Cme(e){var t=e.stack,r=e.fv;exports.DEBUG&&console.log(e.step,\\\"GFV[]\\\"),t.push(r.x*16384),t.push(r.y*16384)}function Rme(e){e.fv=e.pv,exports.DEBUG&&console.log(e.step,\\\"SFVTPV[]\\\")}function Eme(e){var t=e.stack,r=t.pop(),i=t.pop(),s=t.pop(),a=t.pop(),n=t.pop(),o=e.z0,l=e.z1,u=o[r],h=o[i],d=l[s],c=l[a],m=e.z2[n];exports.DEBUG&&console.log(\\\"ISECT[], \\\",r,i,s,a,n);var g=u.x,y=u.y,b=h.x,v=h.y,S=d.x,T=d.y,w=c.x,N=c.y,C=(g-b)*(T-N)-(y-v)*(S-w),R=g*v-y*b,E=S*N-T*w;m.x=(R*(S-w)-E*(g-b))/C,m.y=(R*(T-N)-E*(y-v))/C}function Pme(e){e.rp0=e.stack.pop(),exports.DEBUG&&console.log(e.step,\\\"SRP0[]\\\",e.rp0)}function Bme(e){e.rp1=e.stack.pop(),exports.DEBUG&&console.log(e.step,\\\"SRP1[]\\\",e.rp1)}function Ime(e){e.rp2=e.stack.pop(),exports.DEBUG&&console.log(e.step,\\\"SRP2[]\\\",e.rp2)}function Fme(e){var t=e.stack.pop();switch(exports.DEBUG&&console.log(e.step,\\\"SZP0[]\\\",t),e.zp0=t,t){case 0:e.tZone||Ox(e),e.z0=e.tZone;break;case 1:e.z0=e.gZone;break;default:throw new Error(\\\"Invalid zone pointer\\\")}}function Lme(e){var t=e.stack.pop();switch(exports.DEBUG&&console.log(e.step,\\\"SZP1[]\\\",t),e.zp1=t,t){case 0:e.tZone||Ox(e),e.z1=e.tZone;break;case 1:e.z1=e.gZone;break;default:throw new Error(\\\"Invalid zone pointer\\\")}}function kme(e){var t=e.stack.pop();switch(exports.DEBUG&&console.log(e.step,\\\"SZP2[]\\\",t),e.zp2=t,t){case 0:e.tZone||Ox(e),e.z2=e.tZone;break;case 1:e.z2=e.gZone;break;default:throw new Error(\\\"Invalid zone pointer\\\")}}function Dme(e){var t=e.stack.pop();switch(exports.DEBUG&&console.log(e.step,\\\"SZPS[]\\\",t),e.zp0=e.zp1=e.zp2=t,t){case 0:e.tZone||Ox(e),e.z0=e.z1=e.z2=e.tZone;break;case 1:e.z0=e.z1=e.z2=e.gZone;break;default:throw new Error(\\\"Invalid zone pointer\\\")}}function Ome(e){e.loop=e.stack.pop(),exports.DEBUG&&console.log(e.step,\\\"SLOOP[]\\\",e.loop)}function Ume(e){exports.DEBUG&&console.log(e.step,\\\"RTG[]\\\"),e.round=ok}function zme(e){exports.DEBUG&&console.log(e.step,\\\"RTHG[]\\\"),e.round=Tme}function Vme(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,\\\"SMD[]\\\",t),e.minDis=t/64}function Gme(e){exports.DEBUG&&console.log(e.step,\\\"ELSE[]\\\"),uk(e,!1)}function Wme(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,\\\"JMPR[]\\\",t),e.ip+=t-1}function jme(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,\\\"SCVTCI[]\\\",t),e.cvCutIn=t/64}function Hme(e){var t=e.stack;exports.DEBUG&&console.log(e.step,\\\"DUP[]\\\"),t.push(t[t.length-1])}function U2(e){exports.DEBUG&&console.log(e.step,\\\"POP[]\\\"),e.stack.pop()}function Xme(e){exports.DEBUG&&console.log(e.step,\\\"CLEAR[]\\\"),e.stack.length=0}function $me(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"SWAP[]\\\"),t.push(r),t.push(i)}function qme(e){var t=e.stack;exports.DEBUG&&console.log(e.step,\\\"DEPTH[]\\\"),t.push(t.length)}function Yme(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"LOOPCALL[]\\\",r,i);var s=e.ip,a=e.prog;e.prog=e.funcs[r];for(var n=0;n\\u003ci;n++)Mh(e),exports.DEBUG&&console.log(++e.step,n+1\\u003ci?\\\"next loopcall\\\":\\\"done loopcall\\\",n);e.ip=s,e.prog=a}function Zme(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,\\\"CALL[]\\\",t);var r=e.ip,i=e.prog;e.prog=e.funcs[t],Mh(e),e.ip=r,e.prog=i,exports.DEBUG&&console.log(++e.step,\\\"returning from\\\",t)}function Jme(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,\\\"CINDEX[]\\\",r),t.push(t[t.length-r])}function Qme(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,\\\"MINDEX[]\\\",r),t.push(t.splice(t.length-r,1)[0])}function Kme(e){if(e.env!==\\\"fpgm\\\")throw new Error(\\\"FDEF not allowed here\\\");var t=e.stack,r=e.prog,i=e.ip,s=t.pop(),a=i;for(exports.DEBUG&&console.log(e.step,\\\"FDEF[]\\\",s);r[++i]!==45;);e.ip=i,e.funcs[s]=r.slice(a+1,i)}function fk(e,t){var r=t.stack.pop(),i=t.z0[r],s=t.fv,a=t.pv;exports.DEBUG&&console.log(t.step,\\\"MDAP[\\\"+e+\\\"]\\\",r);var n=a.distance(i,pf);e&&(n=t.round(n)),s.setRelative(i,pf,n,a),s.touch(i),t.rp0=t.rp1=r}function gk(e,t){var r=t.z2,i=r.length-2,s,a,n;exports.DEBUG&&console.log(t.step,\\\"IUP[\\\"+e.axis+\\\"]\\\");for(var o=0;o\\u003ci;o++)s=r[o],!e.touched(s)&&(a=s.prevTouched(e),a!==s&&(n=s.nextTouched(e),a===n&&e.setRelative(s,s,e.distance(a,a,!1,!0),e,!0),e.interpolate(s,a,n,e)))}function yk(e,t){for(var r=t.stack,i=e?t.rp1:t.rp2,s=(e?t.z0:t.z1)[i],a=t.fv,n=t.pv,o=t.loop,l=t.z2;o--;){var u=r.pop(),h=l[u],d=n.distance(s,s,!1,!0);a.setRelative(h,h,d,n),a.touch(h),exports.DEBUG&&console.log(t.step,(t.loop>1?\\\"loop \\\"+(t.loop-o)+\\\": \\\":\\\"\\\")+\\\"SHP[\\\"+(e?\\\"rp1\\\":\\\"rp2\\\")+\\\"]\\\",u)}t.loop=1}function xk(e,t){var r=t.stack,i=e?t.rp1:t.rp2,s=(e?t.z0:t.z1)[i],a=t.fv,n=t.pv,o=r.pop(),l=t.z2[t.contours[o]],u=l;exports.DEBUG&&console.log(t.step,\\\"SHC[\\\"+e+\\\"]\\\",o);var h=n.distance(s,s,!1,!0);do u!==s&&a.setRelative(u,u,h,n),u=u.nextPointOnContour;while(u!==l)}function vk(e,t){var r=t.stack,i=e?t.rp1:t.rp2,s=(e?t.z0:t.z1)[i],a=t.fv,n=t.pv,o=r.pop();exports.DEBUG&&console.log(t.step,\\\"SHZ[\\\"+e+\\\"]\\\",o);var l;switch(o){case 0:l=t.tZone;break;case 1:l=t.gZone;break;default:throw new Error(\\\"Invalid zone\\\")}for(var u,h=n.distance(s,s,!1,!0),d=l.length-2,c=0;c\\u003cd;c++)u=l[c],a.setRelative(u,u,h,n)}function efe(e){for(var t=e.stack,r=e.loop,i=e.fv,s=t.pop()/64,a=e.z2;r--;){var n=t.pop(),o=a[n];exports.DEBUG&&console.log(e.step,(e.loop>1?\\\"loop \\\"+(e.loop-r)+\\\": \\\":\\\"\\\")+\\\"SHPIX[]\\\",n,s),i.setRelative(o,o,s),i.touch(o)}e.loop=1}function tfe(e){for(var t=e.stack,r=e.rp1,i=e.rp2,s=e.loop,a=e.z0[r],n=e.z1[i],o=e.fv,l=e.dpv,u=e.z2;s--;){var h=t.pop(),d=u[h];exports.DEBUG&&console.log(e.step,(e.loop>1?\\\"loop \\\"+(e.loop-s)+\\\": \\\":\\\"\\\")+\\\"IP[]\\\",h,r,\\\"\\u003c->\\\",i),o.interpolate(d,a,n,l),o.touch(d)}e.loop=1}function bk(e,t){var r=t.stack,i=r.pop()/64,s=r.pop(),a=t.z1[s],n=t.z0[t.rp0],o=t.fv,l=t.pv;o.setRelative(a,n,i,l),o.touch(a),exports.DEBUG&&console.log(t.step,\\\"MSIRP[\\\"+e+\\\"]\\\",i,s),t.rp1=t.rp0,t.rp2=s,e&&(t.rp0=s)}function rfe(e){for(var t=e.stack,r=e.rp0,i=e.z0[r],s=e.loop,a=e.fv,n=e.pv,o=e.z1;s--;){var l=t.pop(),u=o[l];exports.DEBUG&&console.log(e.step,(e.loop>1?\\\"loop \\\"+(e.loop-s)+\\\": \\\":\\\"\\\")+\\\"ALIGNRP[]\\\",l),a.setRelative(u,i,0,n),a.touch(u)}e.loop=1}function ife(e){exports.DEBUG&&console.log(e.step,\\\"RTDG[]\\\"),e.round=bme}function Tk(e,t){var r=t.stack,i=r.pop(),s=r.pop(),a=t.z0[s],n=t.fv,o=t.pv,l=t.cvt[i];exports.DEBUG&&console.log(t.step,\\\"MIAP[\\\"+e+\\\"]\\\",i,\\\"(\\\",l,\\\")\\\",s);var u=o.distance(a,pf);e&&(Math.abs(u-l)\\u003ct.cvCutIn&&(u=l),u=t.round(u)),n.setRelative(a,pf,u,o),t.zp0===0&&(a.xo=a.x,a.yo=a.y),n.touch(a),t.rp0=t.rp1=s}function sfe(e){var t=e.prog,r=e.ip,i=e.stack,s=t[++r];exports.DEBUG&&console.log(e.step,\\\"NPUSHB[]\\\",s);for(var a=0;a\\u003cs;a++)i.push(t[++r]);e.ip=r}function afe(e){var t=e.ip,r=e.prog,i=e.stack,s=r[++t];exports.DEBUG&&console.log(e.step,\\\"NPUSHW[]\\\",s);for(var a=0;a\\u003cs;a++){var n=r[++t]\\u003c\\u003c8|r[++t];n&32768&&(n=-((n^65535)+1)),i.push(n)}e.ip=t}function nfe(e){var t=e.stack,r=e.store;r||(r=e.store=[]);var i=t.pop(),s=t.pop();exports.DEBUG&&console.log(e.step,\\\"WS\\\",i,s),r[s]=i}function ofe(e){var t=e.stack,r=e.store,i=t.pop();exports.DEBUG&&console.log(e.step,\\\"RS\\\",i);var s=r&&r[i]||0;t.push(s)}function lfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"WCVTP\\\",r,i),e.cvt[i]=r/64}function ufe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,\\\"RCVT\\\",r),t.push(e.cvt[r]*64)}function Sk(e,t){var r=t.stack,i=r.pop(),s=t.z2[i];exports.DEBUG&&console.log(t.step,\\\"GC[\\\"+e+\\\"]\\\",i),r.push(t.dpv.distance(s,pf,e,!1)*64)}function _k(e,t){var r=t.stack,i=r.pop(),s=r.pop(),a=t.z1[i],n=t.z0[s],o=t.dpv.distance(n,a,e,e);exports.DEBUG&&console.log(t.step,\\\"MD[\\\"+e+\\\"]\\\",i,s,\\\"->\\\",o),t.stack.push(Math.round(o*64))}function hfe(e){exports.DEBUG&&console.log(e.step,\\\"MPPEM[]\\\"),e.stack.push(e.ppem)}function dfe(e){exports.DEBUG&&console.log(e.step,\\\"FLIPON[]\\\"),e.autoFlip=!0}function cfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"LT[]\\\",r,i),t.push(i\\u003cr?1:0)}function pfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"LTEQ[]\\\",r,i),t.push(i\\u003c=r?1:0)}function mfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"GT[]\\\",r,i),t.push(i>r?1:0)}function ffe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"GTEQ[]\\\",r,i),t.push(i>=r?1:0)}function gfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"EQ[]\\\",r,i),t.push(r===i?1:0)}function yfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"NEQ[]\\\",r,i),t.push(r!==i?1:0)}function xfe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,\\\"ODD[]\\\",r),t.push(Math.trunc(r)%2?1:0)}function vfe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,\\\"EVEN[]\\\",r),t.push(Math.trunc(r)%2?0:1)}function bfe(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,\\\"IF[]\\\",t),t||(uk(e,!0),exports.DEBUG&&console.log(e.step,\\\"EIF[]\\\"))}function Tfe(e){exports.DEBUG&&console.log(e.step,\\\"EIF[]\\\")}function Sfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"AND[]\\\",r,i),t.push(r&&i?1:0)}function _fe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"OR[]\\\",r,i),t.push(r||i?1:0)}function wfe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,\\\"NOT[]\\\",r),t.push(r?0:1)}function z2(e,t){var r=t.stack,i=r.pop(),s=t.fv,a=t.pv,n=t.ppem,o=t.deltaBase+(e-1)*16,l=t.deltaShift,u=t.z0;exports.DEBUG&&console.log(t.step,\\\"DELTAP[\\\"+e+\\\"]\\\",i,r);for(var h=0;h\\u003ci;h++){var d=r.pop(),c=r.pop(),m=o+((c&240)>>4);if(m===n){var g=(c&15)-8;g>=0&&g++,exports.DEBUG&&console.log(t.step,\\\"DELTAPFIX\\\",d,\\\"by\\\",g*l);var y=u[d];s.setRelative(y,y,g*l,a)}}}function Mfe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,\\\"SDB[]\\\",r),e.deltaBase=r}function Nfe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,\\\"SDS[]\\\",r),e.deltaShift=Math.pow(.5,r)}function Afe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"ADD[]\\\",r,i),t.push(i+r)}function Cfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"SUB[]\\\",r,i),t.push(i-r)}function Rfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"DIV[]\\\",r,i),t.push(i*64/r)}function Efe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"MUL[]\\\",r,i),t.push(i*r/64)}function Pfe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,\\\"ABS[]\\\",r),t.push(Math.abs(r))}function Bfe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,\\\"NEG[]\\\",r),t.push(-r)}function Ife(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,\\\"FLOOR[]\\\",r),t.push(Math.floor(r/64)*64)}function Ffe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,\\\"CEILING[]\\\",r),t.push(Math.ceil(r/64)*64)}function Ux(e,t){var r=t.stack,i=r.pop();exports.DEBUG&&console.log(t.step,\\\"ROUND[]\\\"),r.push(t.round(i/64)*64)}function Lfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"WCVTF[]\\\",r,i),e.cvt[i]=r*e.ppem/e.font.unitsPerEm}function V2(e,t){var r=t.stack,i=r.pop(),s=t.ppem,a=t.deltaBase+(e-1)*16,n=t.deltaShift;exports.DEBUG&&console.log(t.step,\\\"DELTAC[\\\"+e+\\\"]\\\",i,r);for(var o=0;o\\u003ci;o++){var l=r.pop(),u=r.pop(),h=a+((u&240)>>4);if(h===s){var d=(u&15)-8;d>=0&&d++;var c=d*n;exports.DEBUG&&console.log(t.step,\\\"DELTACFIX\\\",l,\\\"by\\\",c),t.cvt[l]+=c}}}function kfe(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,\\\"SROUND[]\\\",t),e.round=lk;var r;switch(t&192){case 0:r=.5;break;case 64:r=1;break;case 128:r=2;break;default:throw new Error(\\\"invalid SROUND value\\\")}switch(e.srPeriod=r,t&48){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*r;break;case 32:e.srPhase=.5*r;break;case 48:e.srPhase=.75*r;break;default:throw new Error(\\\"invalid SROUND value\\\")}t&=15,t===0?e.srThreshold=0:e.srThreshold=(t/8-.5)*r}function Dfe(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,\\\"S45ROUND[]\\\",t),e.round=lk;var r;switch(t&192){case 0:r=Math.sqrt(2)/2;break;case 64:r=Math.sqrt(2);break;case 128:r=2*Math.sqrt(2);break;default:throw new Error(\\\"invalid S45ROUND value\\\")}switch(e.srPeriod=r,t&48){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*r;break;case 32:e.srPhase=.5*r;break;case 48:e.srPhase=.75*r;break;default:throw new Error(\\\"invalid S45ROUND value\\\")}t&=15,t===0?e.srThreshold=0:e.srThreshold=(t/8-.5)*r}function Ofe(e){exports.DEBUG&&console.log(e.step,\\\"ROFF[]\\\"),e.round=vme}function Ufe(e){exports.DEBUG&&console.log(e.step,\\\"RUTG[]\\\"),e.round=Sme}function zfe(e){exports.DEBUG&&console.log(e.step,\\\"RDTG[]\\\"),e.round=_me}function Vfe(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,\\\"SCANCTRL[]\\\",t)}function wk(e,t){var r=t.stack,i=r.pop(),s=r.pop(),a=t.z2[i],n=t.z1[s];exports.DEBUG&&console.log(t.step,\\\"SDPVTL[\\\"+e+\\\"]\\\",i,s);var o,l;e?(o=a.y-n.y,l=n.x-a.x):(o=n.x-a.x,l=n.y-a.y),t.dpv=cf(o,l)}function Gfe(e){var t=e.stack,r=t.pop(),i=0;exports.DEBUG&&console.log(e.step,\\\"GETINFO[]\\\",r),r&1&&(i=35),r&32&&(i|=4096),t.push(i)}function Wfe(e){var t=e.stack,r=t.pop(),i=t.pop(),s=t.pop();exports.DEBUG&&console.log(e.step,\\\"ROLL[]\\\"),t.push(i),t.push(r),t.push(s)}function jfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"MAX[]\\\",r,i),t.push(Math.max(i,r))}function Hfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,\\\"MIN[]\\\",r,i),t.push(Math.min(i,r))}function Xfe(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,\\\"SCANTYPE[]\\\",t)}function $fe(e){var t=e.stack.pop(),r=e.stack.pop();switch(exports.DEBUG&&console.log(e.step,\\\"INSTCTRL[]\\\",t,r),t){case 1:e.inhibitGridFit=!!r;return;case 2:e.ignoreCvt=!!r;return;default:throw new Error(\\\"invalid INSTCTRL[] selector\\\")}}function su(e,t){var r=t.stack,i=t.prog,s=t.ip;exports.DEBUG&&console.log(t.step,\\\"PUSHB[\\\"+e+\\\"]\\\");for(var a=0;a\\u003ce;a++)r.push(i[++s]);t.ip=s}function au(e,t){var r=t.ip,i=t.prog,s=t.stack;exports.DEBUG&&console.log(t.ip,\\\"PUSHW[\\\"+e+\\\"]\\\");for(var a=0;a\\u003ce;a++){var n=i[++r]\\u003c\\u003c8|i[++r];n&32768&&(n=-((n^65535)+1)),s.push(n)}t.ip=r}function lt(e,t,r,i,s,a){var n=a.stack,o=e&&n.pop(),l=n.pop(),u=a.rp0,h=a.z0[u],d=a.z1[l],c=a.minDis,m=a.fv,g=a.dpv,y,b,v,S;b=y=g.distance(d,h,!0,!0),v=b>=0?1:-1,b=Math.abs(b),e&&(S=a.cvt[o],i&&Math.abs(b-S)\\u003ca.cvCutIn&&(b=S)),r&&b\\u003cc&&(b=c),i&&(b=a.round(b)),m.setRelative(d,h,v*b,g),m.touch(d),exports.DEBUG&&console.log(a.step,(e?\\\"MIRP[\\\":\\\"MDRP[\\\")+(t?\\\"M\\\":\\\"m\\\")+(r?\\\">\\\":\\\"_\\\")+(i?\\\"R\\\":\\\"_\\\")+(s===0?\\\"Gr\\\":s===1?\\\"Bl\\\":s===2?\\\"Wh\\\":\\\"\\\")+\\\"]\\\",e?o+\\\"(\\\"+a.cvt[o]+\\\",\\\"+S+\\\")\\\":\\\"\\\",l,\\\"(d =\\\",y,\\\"->\\\",v*b,\\\")\\\"),a.rp1=a.rp0,a.rp2=l,t&&(a.rp0=l)}sk=[hk.bind(void 0,qo),hk.bind(void 0,Jn),dk.bind(void 0,qo),dk.bind(void 0,Jn),ck.bind(void 0,qo),ck.bind(void 0,Jn),pk.bind(void 0,0),pk.bind(void 0,1),mk.bind(void 0,0),mk.bind(void 0,1),Mme,Nme,Ame,Cme,Rme,Eme,Pme,Bme,Ime,Fme,Lme,kme,Dme,Ome,Ume,zme,Vme,Gme,Wme,jme,void 0,void 0,Hme,U2,Xme,$me,qme,Jme,Qme,void 0,void 0,void 0,Yme,Zme,Kme,void 0,fk.bind(void 0,0),fk.bind(void 0,1),gk.bind(void 0,qo),gk.bind(void 0,Jn),yk.bind(void 0,0),yk.bind(void 0,1),xk.bind(void 0,0),xk.bind(void 0,1),vk.bind(void 0,0),vk.bind(void 0,1),efe,tfe,bk.bind(void 0,0),bk.bind(void 0,1),rfe,ife,Tk.bind(void 0,0),Tk.bind(void 0,1),sfe,afe,nfe,ofe,lfe,ufe,Sk.bind(void 0,0),Sk.bind(void 0,1),void 0,_k.bind(void 0,0),_k.bind(void 0,1),hfe,void 0,dfe,void 0,void 0,cfe,pfe,mfe,ffe,gfe,yfe,xfe,vfe,bfe,Tfe,Sfe,_fe,wfe,z2.bind(void 0,1),Mfe,Nfe,Afe,Cfe,Rfe,Efe,Pfe,Bfe,Ife,Ffe,Ux.bind(void 0,0),Ux.bind(void 0,1),Ux.bind(void 0,2),Ux.bind(void 0,3),void 0,void 0,void 0,void 0,Lfe,z2.bind(void 0,2),z2.bind(void 0,3),V2.bind(void 0,1),V2.bind(void 0,2),V2.bind(void 0,3),kfe,Dfe,void 0,void 0,Ofe,void 0,Ufe,zfe,U2,U2,void 0,void 0,void 0,void 0,void 0,Vfe,wk.bind(void 0,0),wk.bind(void 0,1),Gfe,void 0,Wfe,jfe,Hfe,Xfe,$fe,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,su.bind(void 0,1),su.bind(void 0,2),su.bind(void 0,3),su.bind(void 0,4),su.bind(void 0,5),su.bind(void 0,6),su.bind(void 0,7),su.bind(void 0,8),au.bind(void 0,1),au.bind(void 0,2),au.bind(void 0,3),au.bind(void 0,4),au.bind(void 0,5),au.bind(void 0,6),au.bind(void 0,7),au.bind(void 0,8),lt.bind(void 0,0,0,0,0,0),lt.bind(void 0,0,0,0,0,1),lt.bind(void 0,0,0,0,0,2),lt.bind(void 0,0,0,0,0,3),lt.bind(void 0,0,0,0,1,0),lt.bind(void 0,0,0,0,1,1),lt.bind(void 0,0,0,0,1,2),lt.bind(void 0,0,0,0,1,3),lt.bind(void 0,0,0,1,0,0),lt.bind(void 0,0,0,1,0,1),lt.bind(void 0,0,0,1,0,2),lt.bind(void 0,0,0,1,0,3),lt.bind(void 0,0,0,1,1,0),lt.bind(void 0,0,0,1,1,1),lt.bind(void 0,0,0,1,1,2),lt.bind(void 0,0,0,1,1,3),lt.bind(void 0,0,1,0,0,0),lt.bind(void 0,0,1,0,0,1),lt.bind(void 0,0,1,0,0,2),lt.bind(void 0,0,1,0,0,3),lt.bind(void 0,0,1,0,1,0),lt.bind(void 0,0,1,0,1,1),lt.bind(void 0,0,1,0,1,2),lt.bind(void 0,0,1,0,1,3),lt.bind(void 0,0,1,1,0,0),lt.bind(void 0,0,1,1,0,1),lt.bind(void 0,0,1,1,0,2),lt.bind(void 0,0,1,1,0,3),lt.bind(void 0,0,1,1,1,0),lt.bind(void 0,0,1,1,1,1),lt.bind(void 0,0,1,1,1,2),lt.bind(void 0,0,1,1,1,3),lt.bind(void 0,1,0,0,0,0),lt.bind(void 0,1,0,0,0,1),lt.bind(void 0,1,0,0,0,2),lt.bind(void 0,1,0,0,0,3),lt.bind(void 0,1,0,0,1,0),lt.bind(void 0,1,0,0,1,1),lt.bind(void 0,1,0,0,1,2),lt.bind(void 0,1,0,0,1,3),lt.bind(void 0,1,0,1,0,0),lt.bind(void 0,1,0,1,0,1),lt.bind(void 0,1,0,1,0,2),lt.bind(void 0,1,0,1,0,3),lt.bind(void 0,1,0,1,1,0),lt.bind(void 0,1,0,1,1,1),lt.bind(void 0,1,0,1,1,2),lt.bind(void 0,1,0,1,1,3),lt.bind(void 0,1,1,0,0,0),lt.bind(void 0,1,1,0,0,1),lt.bind(void 0,1,1,0,0,2),lt.bind(void 0,1,1,0,0,3),lt.bind(void 0,1,1,0,1,0),lt.bind(void 0,1,1,0,1,1),lt.bind(void 0,1,1,0,1,2),lt.bind(void 0,1,1,0,1,3),lt.bind(void 0,1,1,1,0,0),lt.bind(void 0,1,1,1,0,1),lt.bind(void 0,1,1,1,0,2),lt.bind(void 0,1,1,1,0,3),lt.bind(void 0,1,1,1,1,0),lt.bind(void 0,1,1,1,1,1),lt.bind(void 0,1,1,1,1,2),lt.bind(void 0,1,1,1,1,3)];function Ic(e){this.char=e,this.state={},this.activeState=null}function G2(e,t,r){this.contextName=r,this.startIndex=e,this.endOffset=t}function qfe(e,t,r){this.contextName=e,this.openRange=null,this.ranges=[],this.checkStart=t,this.checkEnd=r}function an(e,t){this.context=e,this.index=t,this.length=e.length,this.current=e[t],this.backtrack=e.slice(0,t),this.lookahead=e.slice(t+1)}function zx(e){this.eventId=e,this.subscribers=[]}function Yfe(e){var t=this,r=[\\\"start\\\",\\\"end\\\",\\\"next\\\",\\\"newToken\\\",\\\"contextStart\\\",\\\"contextEnd\\\",\\\"insertToken\\\",\\\"removeToken\\\",\\\"removeRange\\\",\\\"replaceToken\\\",\\\"replaceRange\\\",\\\"composeRUD\\\",\\\"updateContextsRanges\\\"];r.forEach(function(s){Object.defineProperty(t.events,s,{value:new zx(s)})}),e&&r.forEach(function(s){var a=e[s];typeof a==\\\"function\\\"&&t.events[s].subscribe(a)});var i=[\\\"insertToken\\\",\\\"removeToken\\\",\\\"removeRange\\\",\\\"replaceToken\\\",\\\"replaceRange\\\",\\\"composeRUD\\\"];i.forEach(function(s){t.events[s].subscribe(t.updateContextsRanges)})}function Xr(e){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],Yfe.call(this,e)}Ic.prototype.setState=function(e,t){return this.state[e]=t,this.activeState={key:e,value:this.state[e]},this.activeState},Ic.prototype.getState=function(e){return this.state[e]||null},Xr.prototype.inboundIndex=function(e){return e>=0&&e\\u003cthis.tokens.length},Xr.prototype.composeRUD=function(e){var t=this,r=!0,i=e.map(function(a){return t[a[0]].apply(t,a.slice(1).concat(r))}),s=function(a){return typeof a==\\\"object\\\"&&a.hasOwnProperty(\\\"FAIL\\\")};if(i.every(s))return{FAIL:\\\"composeRUD: one or more operations hasn't completed successfully\\\",report:i.filter(s)};this.dispatch(\\\"composeRUD\\\",[i.filter(function(a){return!s(a)})])},Xr.prototype.replaceRange=function(e,t,r,i){t=t!==null?t:this.tokens.length;var s=r.every(function(n){return n instanceof Ic});if(!isNaN(e)&&this.inboundIndex(e)&&s){var a=this.tokens.splice.apply(this.tokens,[e,t].concat(r));return i||this.dispatch(\\\"replaceToken\\\",[e,t,r]),[a,r]}else return{FAIL:\\\"replaceRange: invalid tokens or startIndex.\\\"}},Xr.prototype.replaceToken=function(e,t,r){if(!isNaN(e)&&this.inboundIndex(e)&&t instanceof Ic){var i=this.tokens.splice(e,1,t);return r||this.dispatch(\\\"replaceToken\\\",[e,t]),[i[0],t]}else return{FAIL:\\\"replaceToken: invalid token or index.\\\"}},Xr.prototype.removeRange=function(e,t,r){t=isNaN(t)?this.tokens.length:t;var i=this.tokens.splice(e,t);return r||this.dispatch(\\\"removeRange\\\",[i,e,t]),i},Xr.prototype.removeToken=function(e,t){if(!isNaN(e)&&this.inboundIndex(e)){var r=this.tokens.splice(e,1);return t||this.dispatch(\\\"removeToken\\\",[r,e]),r}else return{FAIL:\\\"removeToken: invalid token index.\\\"}},Xr.prototype.insertToken=function(e,t,r){var i=e.every(function(s){return s instanceof Ic});return i?(this.tokens.splice.apply(this.tokens,[t,0].concat(e)),r||this.dispatch(\\\"insertToken\\\",[e,t]),e):{FAIL:\\\"insertToken: invalid token(s).\\\"}},Xr.prototype.registerModifier=function(e,t,r){this.events.newToken.subscribe(function(i,s){var a=[i,s],n=t===null||t.apply(this,a)===!0,o=[i,s];if(n){var l=r.apply(this,o);i.setState(e,l)}}),this.registeredModifiers.push(e)},zx.prototype.subscribe=function(e){return typeof e==\\\"function\\\"?this.subscribers.push(e)-1:{FAIL:\\\"invalid '\\\"+this.eventId+\\\"' event handler\\\"}},zx.prototype.unsubscribe=function(e){this.subscribers.splice(e,1)},an.prototype.setCurrentIndex=function(e){this.index=e,this.current=this.context[e],this.backtrack=this.context.slice(0,e),this.lookahead=this.context.slice(e+1)},an.prototype.get=function(e){switch(!0){case e===0:return this.current;case(e\\u003c0&&Math.abs(e)\\u003c=this.backtrack.length):return this.backtrack.slice(e)[0];case(e>0&&e\\u003c=this.lookahead.length):return this.lookahead[e-1];default:return null}},Xr.prototype.rangeToText=function(e){if(e instanceof G2)return this.getRangeTokens(e).map(function(t){return t.char}).join(\\\"\\\")},Xr.prototype.getText=function(){return this.tokens.map(function(e){return e.char}).join(\\\"\\\")},Xr.prototype.getContext=function(e){var t=this.registeredContexts[e];return t||null},Xr.prototype.on=function(e,t){var r=this.events[e];return r?r.subscribe(t):null},Xr.prototype.dispatch=function(e,t){var r=this,i=this.events[e];i instanceof zx&&i.subscribers.forEach(function(s){s.apply(r,t||[])})},Xr.prototype.registerContextChecker=function(e,t,r){if(this.getContext(e))return{FAIL:\\\"context name '\\\"+e+\\\"' is already registered.\\\"};if(typeof t!=\\\"function\\\")return{FAIL:\\\"missing context start check.\\\"};if(typeof r!=\\\"function\\\")return{FAIL:\\\"missing context end check.\\\"};var i=new qfe(e,t,r);return this.registeredContexts[e]=i,this.contextCheckers.push(i),i},Xr.prototype.getRangeTokens=function(e){var t=e.startIndex+e.endOffset;return[].concat(this.tokens.slice(e.startIndex,t))},Xr.prototype.getContextRanges=function(e){var t=this.getContext(e);return t?t.ranges:{FAIL:\\\"context checker '\\\"+e+\\\"' is not registered.\\\"}},Xr.prototype.resetContextsRanges=function(){var e=this.registeredContexts;for(var t in e)if(e.hasOwnProperty(t)){var r=e[t];r.ranges=[]}},Xr.prototype.updateContextsRanges=function(){this.resetContextsRanges();for(var e=this.tokens.map(function(i){return i.char}),t=0;t\\u003ce.length;t++){var r=new an(e,t);this.runContextCheck(r)}this.dispatch(\\\"updateContextsRanges\\\",[this.registeredContexts])},Xr.prototype.setEndOffset=function(e,t){var r=this.getContext(t).openRange.startIndex,i=new G2(r,e,t),s=this.getContext(t).ranges;return i.rangeId=t+\\\".\\\"+s.length,s.push(i),this.getContext(t).openRange=null,i},Xr.prototype.runContextCheck=function(e){var t=this,r=e.index;this.contextCheckers.forEach(function(i){var s=i.contextName,a=t.getContext(s).openRange;if(!a&&i.checkStart(e)&&(a=new G2(r,null,s),t.getContext(s).openRange=a,t.dispatch(\\\"contextStart\\\",[s,r])),a&&i.checkEnd(e)){var n=r-a.startIndex+1,o=t.setEndOffset(n,s);t.dispatch(\\\"contextEnd\\\",[s,o])}})},Xr.prototype.tokenize=function(e){this.tokens=[],this.resetContextsRanges();var t=Array.from(e);this.dispatch(\\\"start\\\");for(var r=0;r\\u003ct.length;r++){var i=t[r],s=new an(t,r);this.dispatch(\\\"next\\\",[s]),this.runContextCheck(s);var a=new Ic(i);this.tokens.push(a),this.dispatch(\\\"newToken\\\",[a,s])}return this.dispatch(\\\"end\\\",[this.tokens]),this.tokens};function nu(e){return/[\\\\u0600-\\\\u065F\\\\u066A-\\\\u06D2\\\\u06FA-\\\\u06FF]/.test(e)}function Mk(e){return/[\\\\u0630\\\\u0690\\\\u0621\\\\u0631\\\\u0661\\\\u0671\\\\u0622\\\\u0632\\\\u0672\\\\u0692\\\\u06C2\\\\u0623\\\\u0673\\\\u0693\\\\u06C3\\\\u0624\\\\u0694\\\\u06C4\\\\u0625\\\\u0675\\\\u0695\\\\u06C5\\\\u06E5\\\\u0676\\\\u0696\\\\u06C6\\\\u0627\\\\u0677\\\\u0697\\\\u06C7\\\\u0648\\\\u0688\\\\u0698\\\\u06C8\\\\u0689\\\\u0699\\\\u06C9\\\\u068A\\\\u06CA\\\\u066B\\\\u068B\\\\u06CB\\\\u068C\\\\u068D\\\\u06CD\\\\u06FD\\\\u068E\\\\u06EE\\\\u06FE\\\\u062F\\\\u068F\\\\u06CF\\\\u06EF]/.test(e)}function ou(e){return/[\\\\u0600-\\\\u0605\\\\u060C-\\\\u060E\\\\u0610-\\\\u061B\\\\u061E\\\\u064B-\\\\u065F\\\\u0670\\\\u06D6-\\\\u06DC\\\\u06DF-\\\\u06E4\\\\u06E7\\\\u06E8\\\\u06EA-\\\\u06ED]/.test(e)}function Vx(e){return/[A-z]/.test(e)}function Zfe(e){return/\\\\s/.test(e)}function aa(e){this.font=e,this.features={}}function Nh(e){this.id=e.id,this.tag=e.tag,this.substitution=e.substitution}function mf(e,t){if(!e)return-1;switch(t.format){case 1:return t.glyphs.indexOf(e);case 2:for(var r=t.ranges,i=0;i\\u003cr.length;i++){var s=r[i];if(e>=s.start&&e\\u003c=s.end){var a=e-s.start;return s.index+a}}break;default:return-1}return-1}function Jfe(e,t){var r=mf(e,t.coverage);return r===-1?null:e+t.deltaGlyphId}function Qfe(e,t){var r=mf(e,t.coverage);return r===-1?null:t.substitute[r]}function W2(e,t){for(var r=[],i=0;i\\u003ce.length;i++){var s=e[i],a=t.current;a=Array.isArray(a)?a[0]:a;var n=mf(a,s);n!==-1&&r.push(n)}return r.length!==e.length?-1:r}function Kfe(e,t){var r=t.inputCoverage.length+t.lookaheadCoverage.length+t.backtrackCoverage.length;if(e.context.length\\u003cr)return[];var i=W2(t.inputCoverage,e);if(i===-1)return[];var s=t.inputCoverage.length-1;if(e.lookahead.length\\u003ct.lookaheadCoverage.length)return[];for(var a=e.lookahead.slice(s);a.length&&ou(a[0].char);)a.shift();var n=new an(a,0),o=W2(t.lookaheadCoverage,n),l=[].concat(e.backtrack);for(l.reverse();l.length&&ou(l[0].char);)l.shift();if(l.length\\u003ct.backtrackCoverage.length)return[];var u=new an(l,0),h=W2(t.backtrackCoverage,u),d=i.length===t.inputCoverage.length&&o.length===t.lookaheadCoverage.length&&h.length===t.backtrackCoverage.length,c=[];if(d)for(var m=0;m\\u003ct.lookupRecords.length;m++)for(var g=t.lookupRecords[m],y=g.lookupListIndex,b=this.getLookupByIndex(y),v=0;v\\u003cb.subtables.length;v++){var S=b.subtables[v],T=this.getLookupMethod(b,S),w=this.getSubstitutionType(b,S);if(w===\\\"12\\\")for(var N=0;N\\u003ci.length;N++){var C=e.get(N),R=T(C);R&&c.push(R)}}return c}function ege(e,t){var r=e.current,i=mf(r,t.coverage);if(i===-1)return null;for(var s,a=t.ligatureSets[i],n=0;n\\u003ca.length;n++){s=a[n];for(var o=0;o\\u003cs.components.length;o++){var l=e.lookahead[o],u=s.components[o];if(l!==u)break;if(o===s.components.length-1)return s}}return null}function tge(e,t){var r=mf(e,t.coverage);return r===-1?null:t.sequences[r]}aa.prototype.getDefaultScriptFeaturesIndexes=function(){for(var e=this.font.tables.gsub.scripts,t=0;t\\u003ce.length;t++){var r=e[t];if(r.tag===\\\"DFLT\\\")return r.script.defaultLangSys.featureIndexes}return[]},aa.prototype.getScriptFeaturesIndexes=function(e){var t=this.font.tables;if(!t.gsub)return[];if(!e)return this.getDefaultScriptFeaturesIndexes();for(var r=this.font.tables.gsub.scripts,i=0;i\\u003cr.length;i++){var s=r[i];if(s.tag===e&&s.script.defaultLangSys)return s.script.defaultLangSys.featureIndexes;var a=s.langSysRecords;if(a)for(var n=0;n\\u003ca.length;n++){var o=a[n];if(o.tag===e){var l=o.langSys;return l.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},aa.prototype.mapTagsToFeatures=function(e,t){for(var r={},i=0;i\\u003ce.length;i++){var s=e[i].tag,a=e[i].feature;r[s]=a}this.features[t].tags=r},aa.prototype.getScriptFeatures=function(e){var t=this.features[e];if(this.features.hasOwnProperty(e))return t;var r=this.getScriptFeaturesIndexes(e);if(!r)return null;var i=this.font.tables.gsub;return t=r.map(function(s){return i.features[s]}),this.features[e]=t,this.mapTagsToFeatures(t,e),t},aa.prototype.getSubstitutionType=function(e,t){var r=e.lookupType.toString(),i=t.substFormat.toString();return r+i},aa.prototype.getLookupMethod=function(e,t){var r=this,i=this.getSubstitutionType(e,t);switch(i){case\\\"11\\\":return function(s){return Jfe.apply(r,[s,t])};case\\\"12\\\":return function(s){return Qfe.apply(r,[s,t])};case\\\"63\\\":return function(s){return Kfe.apply(r,[s,t])};case\\\"41\\\":return function(s){return ege.apply(r,[s,t])};case\\\"21\\\":return function(s){return tge.apply(r,[s,t])};default:throw new Error(\\\"lookupType: \\\"+e.lookupType+\\\" - substFormat: \\\"+t.substFormat+\\\" is not yet supported\\\")}},aa.prototype.lookupFeature=function(e){var t=e.contextParams,r=t.index,i=this.getFeature({tag:e.tag,script:e.script});if(!i)return new Error(\\\"font '\\\"+this.font.names.fullName.en+\\\"' doesn't support feature '\\\"+e.tag+\\\"' for script '\\\"+e.script+\\\"'.\\\");for(var s=this.getFeatureLookups(i),a=[].concat(t.context),n=0;n\\u003cs.length;n++)for(var o=s[n],l=this.getLookupSubtables(o),u=0;u\\u003cl.length;u++){var h=l[u],d=this.getSubstitutionType(o,h),c=this.getLookupMethod(o,h),m=void 0;switch(d){case\\\"11\\\":m=c(t.current),m&&a.splice(r,1,new Nh({id:11,tag:e.tag,substitution:m}));break;case\\\"12\\\":m=c(t.current),m&&a.splice(r,1,new Nh({id:12,tag:e.tag,substitution:m}));break;case\\\"63\\\":m=c(t),Array.isArray(m)&&m.length&&a.splice(r,1,new Nh({id:63,tag:e.tag,substitution:m}));break;case\\\"41\\\":m=c(t),m&&a.splice(r,1,new Nh({id:41,tag:e.tag,substitution:m}));break;case\\\"21\\\":m=c(t.current),m&&a.splice(r,1,new Nh({id:21,tag:e.tag,substitution:m}));break}t=new an(a,r),!(Array.isArray(m)&&!m.length)&&(m=null)}return a.length?a:null},aa.prototype.supports=function(e){if(!e.script)return!1;this.getScriptFeatures(e.script);var t=this.features.hasOwnProperty(e.script);if(!e.tag)return t;var r=this.features[e.script].some(function(i){return i.tag===e.tag});return t&&r},aa.prototype.getLookupSubtables=function(e){return e.subtables||null},aa.prototype.getLookupByIndex=function(e){var t=this.font.tables.gsub.lookups;return t[e]||null},aa.prototype.getFeatureLookups=function(e){return e.lookupListIndexes.map(this.getLookupByIndex.bind(this))},aa.prototype.getFeature=function(e){if(!this.font)return{FAIL:\\\"No font was found\\\"};this.features.hasOwnProperty(e.script)||this.getScriptFeatures(e.script);var t=this.features[e.script];return t?t.tags[e.tag]?this.features[e.script].tags[e.tag]:null:{FAIL:\\\"No feature for script \\\"+e.script}};function rge(e){var t=e.current,r=e.get(-1);return r===null&&nu(t)||!nu(r)&&nu(t)}function ige(e){var t=e.get(1);return t===null||!nu(t)}var sge={startCheck:rge,endCheck:ige};function age(e){var t=e.current,r=e.get(-1);return(nu(t)||ou(t))&&!nu(r)}function nge(e){var t=e.get(1);switch(!0){case t===null:return!0;case(!nu(t)&&!ou(t)):var r=Zfe(t);if(!r)return!0;if(r){var i=!1;if(i=e.lookahead.some(function(s){return nu(s)||ou(s)}),!i)return!0}break;default:return!1}}var oge={startCheck:age,endCheck:nge};function lge(e,t,r){t[r].setState(e.tag,e.substitution)}function uge(e,t,r){t[r].setState(e.tag,e.substitution)}function hge(e,t,r){e.substitution.forEach(function(i,s){var a=t[r+s];a.setState(e.tag,i)})}function dge(e,t,r){var i=t[r];i.setState(e.tag,e.substitution.ligGlyph);for(var s=e.substitution.components.length,a=0;a\\u003cs;a++)i=t[r+a+1],i.setState(\\\"deleted\\\",!0)}var Nk={11:lge,12:uge,63:hge,41:dge};function j2(e,t,r){e instanceof Nh&&Nk[e.id]&&Nk[e.id](e,t,r)}function cge(e){for(var t=[].concat(e.backtrack),r=t.length-1;r>=0;r--){var i=t[r],s=Mk(i),a=ou(i);if(!s&&!a)return!0;if(s)return!1}return!1}function pge(e){if(Mk(e.current))return!1;for(var t=0;t\\u003ce.lookahead.length;t++){var r=e.lookahead[t],i=ou(r);if(!i)return!0}return!1}function mge(e){var t=this,r=\\\"arab\\\",i=this.featuresTags[r],s=this.tokenizer.getRangeTokens(e);if(s.length!==1){var a=new an(s.map(function(o){return o.getState(\\\"glyphIndex\\\")}),0),n=new an(s.map(function(o){return o.char}),0);s.forEach(function(o,l){if(!ou(o.char)){a.setCurrentIndex(l),n.setCurrentIndex(l);var u=0;cge(n)&&(u|=1),pge(n)&&(u|=2);var h;switch(u){case 1:h=\\\"fina\\\";break;case 2:h=\\\"init\\\";break;case 3:h=\\\"medi\\\";break}if(i.indexOf(h)!==-1){var d=t.query.lookupFeature({tag:h,script:r,contextParams:a});if(d instanceof Error)return console.info(d.message);d.forEach(function(c,m){c instanceof Nh&&(j2(c,s,m),a.context[m]=c.substitution)})}}})}}function Ak(e,t){var r=e.map(function(i){return i.activeState.value});return new an(r,t||0)}function fge(e){var t=this,r=\\\"arab\\\",i=this.tokenizer.getRangeTokens(e),s=Ak(i);s.context.forEach(function(a,n){s.setCurrentIndex(n);var o=t.query.lookupFeature({tag:\\\"rlig\\\",script:r,contextParams:s});o.length&&(o.forEach(function(l){return j2(l,i,n)}),s=Ak(i))})}function gge(e){var t=e.current,r=e.get(-1);return r===null&&Vx(t)||!Vx(r)&&Vx(t)}function yge(e){var t=e.get(1);return t===null||!Vx(t)}var xge={startCheck:gge,endCheck:yge};function Ck(e,t){var r=e.map(function(i){return i.activeState.value});return new an(r,t||0)}function vge(e){var t=this,r=\\\"latn\\\",i=this.tokenizer.getRangeTokens(e),s=Ck(i);s.context.forEach(function(a,n){s.setCurrentIndex(n);var o=t.query.lookupFeature({tag:\\\"liga\\\",script:r,contextParams:s});o.length&&(o.forEach(function(l){return j2(l,i,n)}),s=Ck(i))})}function nn(e){this.baseDir=e||\\\"ltr\\\",this.tokenizer=new Xr,this.featuresTags={}}nn.prototype.setText=function(e){this.text=e},nn.prototype.contextChecks={latinWordCheck:xge,arabicWordCheck:sge,arabicSentenceCheck:oge};function H2(e){var t=this.contextChecks[e+\\\"Check\\\"];return this.tokenizer.registerContextChecker(e,t.startCheck,t.endCheck)}function bge(){return H2.call(this,\\\"latinWord\\\"),H2.call(this,\\\"arabicWord\\\"),H2.call(this,\\\"arabicSentence\\\"),this.tokenizer.tokenize(this.text)}function Tge(){var e=this,t=this.tokenizer.getContextRanges(\\\"arabicSentence\\\");t.forEach(function(r){var i=e.tokenizer.getRangeTokens(r);e.tokenizer.replaceRange(r.startIndex,r.endOffset,i.reverse())})}nn.prototype.registerFeatures=function(e,t){var r=this,i=t.filter(function(s){return r.query.supports({script:e,tag:s})});this.featuresTags.hasOwnProperty(e)?this.featuresTags[e]=this.featuresTags[e].concat(i):this.featuresTags[e]=i},nn.prototype.applyFeatures=function(e,t){if(!e)throw new Error(\\\"No valid font was provided to apply features\\\");this.query||(this.query=new aa(e));for(var r=0;r\\u003ct.length;r++){var i=t[r];this.query.supports({script:i.script})&&this.registerFeatures(i.script,i.tags)}},nn.prototype.registerModifier=function(e,t,r){this.tokenizer.registerModifier(e,t,r)};function X2(){if(this.tokenizer.registeredModifiers.indexOf(\\\"glyphIndex\\\")===-1)throw new Error(\\\"glyphIndex modifier is required to apply arabic presentation features.\\\")}function Sge(){var e=this,t=\\\"arab\\\";if(this.featuresTags.hasOwnProperty(t)){X2.call(this);var r=this.tokenizer.getContextRanges(\\\"arabicWord\\\");r.forEach(function(i){mge.call(e,i)})}}function _ge(){var e=this,t=\\\"arab\\\";if(this.featuresTags.hasOwnProperty(t)){var r=this.featuresTags[t];if(r.indexOf(\\\"rlig\\\")!==-1){X2.call(this);var i=this.tokenizer.getContextRanges(\\\"arabicWord\\\");i.forEach(function(s){fge.call(e,s)})}}}function wge(){var e=this,t=\\\"latn\\\";if(this.featuresTags.hasOwnProperty(t)){var r=this.featuresTags[t];if(r.indexOf(\\\"liga\\\")!==-1){X2.call(this);var i=this.tokenizer.getContextRanges(\\\"latinWord\\\");i.forEach(function(s){vge.call(e,s)})}}}nn.prototype.checkContextReady=function(e){return!!this.tokenizer.getContext(e)},nn.prototype.applyFeaturesToContexts=function(){this.checkContextReady(\\\"arabicWord\\\")&&(Sge.call(this),_ge.call(this)),this.checkContextReady(\\\"latinWord\\\")&&wge.call(this),this.checkContextReady(\\\"arabicSentence\\\")&&Tge.call(this)},nn.prototype.processText=function(e){(!this.text||this.text!==e)&&(this.setText(e),bge.call(this),this.applyFeaturesToContexts())},nn.prototype.getBidiText=function(e){return this.processText(e),this.tokenizer.getText()},nn.prototype.getTextGlyphs=function(e){this.processText(e);for(var t=[],r=0;r\\u003cthis.tokenizer.tokens.length;r++){var i=this.tokenizer.tokens[r];if(!i.state.deleted){var s=i.activeState.value;t.push(Array.isArray(s)?s[0]:s)}}return t};function dr(e){e=e||{},e.tables=e.tables||{},e.empty||(hf(e.familyName,\\\"When creating a new Font object, familyName is required.\\\"),hf(e.styleName,\\\"When creating a new Font object, styleName is required.\\\"),hf(e.unitsPerEm,\\\"When creating a new Font object, unitsPerEm is required.\\\"),hf(e.ascender,\\\"When creating a new Font object, ascender is required.\\\"),hf(e.descender\\u003c=0,\\\"When creating a new Font object, negative descender value is required.\\\"),this.names={fontFamily:{en:e.familyName||\\\" \\\"},fontSubfamily:{en:e.styleName||\\\" \\\"},fullName:{en:e.fullName||e.familyName+\\\" \\\"+e.styleName},postScriptName:{en:e.postScriptName||(e.familyName+e.styleName).replace(/\\\\s/g,\\\"\\\")},designer:{en:e.designer||\\\" \\\"},designerURL:{en:e.designerURL||\\\" \\\"},manufacturer:{en:e.manufacturer||\\\" \\\"},manufacturerURL:{en:e.manufacturerURL||\\\" \\\"},license:{en:e.license||\\\" \\\"},licenseURL:{en:e.licenseURL||\\\" \\\"},version:{en:e.version||\\\"Version 0.1\\\"},description:{en:e.description||\\\" \\\"},copyright:{en:e.copyright||\\\" \\\"},trademark:{en:e.trademark||\\\" \\\"}},this.unitsPerEm=e.unitsPerEm||1e3,this.ascender=e.ascender,this.descender=e.descender,this.createdTimestamp=e.createdTimestamp,this.tables=Object.assign(e.tables,{os2:Object.assign({usWeightClass:e.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:e.widthClass||this.usWidthClasses.MEDIUM,fsSelection:e.fsSelection||this.fsSelectionValues.REGULAR},e.tables.os2)})),this.supported=!0,this.glyphs=new Zn.GlyphSet(this,e.glyphs||[]),this.encoding=new gL(this),this.position=new uf(this),this.substitution=new sa(this),this.tables=this.tables||{},this._push=null,this._hmtxTableData={},Object.defineProperty(this,\\\"hinting\\\",{get:function(){if(this._hinting)return this._hinting;if(this.outlinesFormat===\\\"truetype\\\")return this._hinting=new nk(this)}})}dr.prototype.hasChar=function(e){return this.encoding.charToGlyphIndex(e)!==null},dr.prototype.charToGlyphIndex=function(e){return this.encoding.charToGlyphIndex(e)},dr.prototype.charToGlyph=function(e){var t=this.charToGlyphIndex(e),r=this.glyphs.get(t);return r||(r=this.glyphs.get(0)),r},dr.prototype.updateFeatures=function(e){return this.defaultRenderOptions.features.map(function(t){return t.script===\\\"latn\\\"?{script:\\\"latn\\\",tags:t.tags.filter(function(r){return e[r]})}:t})},dr.prototype.stringToGlyphs=function(e,t){var r=this,i=new nn,s=function(d){return r.charToGlyphIndex(d.char)};i.registerModifier(\\\"glyphIndex\\\",null,s);var a=t?this.updateFeatures(t.features):this.defaultRenderOptions.features;i.applyFeatures(this,a);for(var n=i.getTextGlyphs(e),o=n.length,l=new Array(o),u=this.glyphs.get(0),h=0;h\\u003co;h+=1)l[h]=this.glyphs.get(n[h])||u;return l},dr.prototype.nameToGlyphIndex=function(e){return this.glyphNames.nameToGlyphIndex(e)},dr.prototype.nameToGlyph=function(e){var t=this.nameToGlyphIndex(e),r=this.glyphs.get(t);return r||(r=this.glyphs.get(0)),r},dr.prototype.glyphIndexToName=function(e){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(e):\\\"\\\"},dr.prototype.getKerningValue=function(e,t){e=e.index||e,t=t.index||t;var r=this.position.defaultKerningTables;return r?this.position.getKerningValue(r,e,t):this.kerningPairs[e+\\\",\\\"+t]||0},dr.prototype.defaultRenderOptions={kerning:!0,features:[{script:\\\"arab\\\",tags:[\\\"init\\\",\\\"medi\\\",\\\"fina\\\",\\\"rlig\\\"]},{script:\\\"latn\\\",tags:[\\\"liga\\\",\\\"rlig\\\"]}]},dr.prototype.forEachGlyph=function(e,t,r,i,s,a){t=t!==void 0?t:0,r=r!==void 0?r:0,i=i!==void 0?i:72,s=Object.assign({},this.defaultRenderOptions,s);var n=1/this.unitsPerEm*i,o=this.stringToGlyphs(e,s),l;if(s.kerning){var u=s.script||this.position.getDefaultScriptName();l=this.position.getKerningTables(u,s.language)}for(var h=0;h\\u003co.length;h+=1){var d=o[h];if(a.call(this,d,t,r,i,s),d.advanceWidth&&(t+=d.advanceWidth*n),s.kerning&&h\\u003co.length-1){var c=l?this.position.getKerningValue(l,d.index,o[h+1].index):this.getKerningValue(d,o[h+1]);t+=c*n}s.letterSpacing?t+=s.letterSpacing*i:s.tracking&&(t+=s.tracking/1e3*i)}return t},dr.prototype.getPath=function(e,t,r,i,s){var a=new di;return this.forEachGlyph(e,t,r,i,s,function(n,o,l,u){var h=n.getPath(o,l,u,s,this);a.extend(h)}),a},dr.prototype.getPaths=function(e,t,r,i,s){var a=[];return this.forEachGlyph(e,t,r,i,s,function(n,o,l,u){var h=n.getPath(o,l,u,s,this);a.push(h)}),a},dr.prototype.getAdvanceWidth=function(e,t,r){return this.forEachGlyph(e,0,0,t,r,function(){})},dr.prototype.draw=function(e,t,r,i,s,a){this.getPath(t,r,i,s,a).draw(e)},dr.prototype.drawPoints=function(e,t,r,i,s,a){this.forEachGlyph(t,r,i,s,a,function(n,o,l,u){n.drawPoints(e,o,l,u)})},dr.prototype.drawMetrics=function(e,t,r,i,s,a){this.forEachGlyph(t,r,i,s,a,function(n,o,l,u){n.drawMetrics(e,o,l,u)})},dr.prototype.getEnglishName=function(e){var t=this.names[e];if(t)return t.en},dr.prototype.validate=function(){var e=this;function t(i,s){}function r(i){var s=e.getEnglishName(i);s&&s.trim().length>0}r(\\\"fontFamily\\\"),r(\\\"weightName\\\"),r(\\\"manufacturer\\\"),r(\\\"copyright\\\"),r(\\\"version\\\"),this.unitsPerEm>0},dr.prototype.toTables=function(){return dme.fontToTable(this)},dr.prototype.toBuffer=function(){return console.warn(\\\"Font.toBuffer is deprecated. Use Font.toArrayBuffer instead.\\\"),this.toArrayBuffer()},dr.prototype.toArrayBuffer=function(){for(var e=this.toTables(),t=e.encode(),r=new ArrayBuffer(t.length),i=new Uint8Array(r),s=0;s\\u003ct.length;s++)i[s]=t[s];return r},dr.prototype.download=function(e){var t=this.getEnglishName(\\\"fontFamily\\\"),r=this.getEnglishName(\\\"fontSubfamily\\\");e=e||t.replace(/\\\\s/g,\\\"\\\")+\\\"-\\\"+r+\\\".otf\\\";var i=this.toArrayBuffer();if(pme())if(window.URL=window.URL||window.webkitURL,window.URL){var s=new DataView(i),a=new Blob([s],{type:\\\"font/opentype\\\"}),n=document.createElement(\\\"a\\\");n.href=window.URL.createObjectURL(a),n.download=e;var o=document.createEvent(\\\"MouseEvents\\\");o.initEvent(\\\"click\\\",!0,!1),n.dispatchEvent(o)}else console.warn(\\\"Font file could not be downloaded. Try using a different browser.\\\");else{var l=ev(),u=mme(i);l.writeFileSync(e,u)}},dr.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},dr.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},dr.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};function Rk(e,t){var r=JSON.stringify(e),i=256;for(var s in t){var a=parseInt(s);if(!(!a||a\\u003c256)){if(JSON.stringify(t[s])===r)return a;i\\u003c=a&&(i=a+1)}}return t[i]=e,i}function Mge(e,t,r){var i=Rk(t.name,r);return[{name:\\\"tag_\\\"+e,type:\\\"TAG\\\",value:t.tag},{name:\\\"minValue_\\\"+e,type:\\\"FIXED\\\",value:t.minValue\\u003c\\u003c16},{name:\\\"defaultValue_\\\"+e,type:\\\"FIXED\\\",value:t.defaultValue\\u003c\\u003c16},{name:\\\"maxValue_\\\"+e,type:\\\"FIXED\\\",value:t.maxValue\\u003c\\u003c16},{name:\\\"flags_\\\"+e,type:\\\"USHORT\\\",value:0},{name:\\\"nameID_\\\"+e,type:\\\"USHORT\\\",value:i}]}function Nge(e,t,r){var i={},s=new ot.Parser(e,t);return i.tag=s.parseTag(),i.minValue=s.parseFixed(),i.defaultValue=s.parseFixed(),i.maxValue=s.parseFixed(),s.skip(\\\"uShort\\\",1),i.name=r[s.parseUShort()]||{},i}function Age(e,t,r,i){for(var s=Rk(t.name,i),a=[{name:\\\"nameID_\\\"+e,type:\\\"USHORT\\\",value:s},{name:\\\"flags_\\\"+e,type:\\\"USHORT\\\",value:0}],n=0;n\\u003cr.length;++n){var o=r[n].tag;a.push({name:\\\"axis_\\\"+e+\\\" \\\"+o,type:\\\"FIXED\\\",value:t.coordinates[o]\\u003c\\u003c16})}return a}function Cge(e,t,r,i){var s={},a=new ot.Parser(e,t);s.name=i[a.parseUShort()]||{},a.skip(\\\"uShort\\\",1),s.coordinates={};for(var n=0;n\\u003cr.length;++n)s.coordinates[r[n].tag]=a.parseFixed();return s}function Rge(e,t){var r=new rt.Table(\\\"fvar\\\",[{name:\\\"version\\\",type:\\\"ULONG\\\",value:65536},{name:\\\"offsetToData\\\",type:\\\"USHORT\\\",value:0},{name:\\\"countSizePairs\\\",type:\\\"USHORT\\\",value:2},{name:\\\"axisCount\\\",type:\\\"USHORT\\\",value:e.axes.length},{name:\\\"axisSize\\\",type:\\\"USHORT\\\",value:20},{name:\\\"instanceCount\\\",type:\\\"USHORT\\\",value:e.instances.length},{name:\\\"instanceSize\\\",type:\\\"USHORT\\\",value:4+e.axes.length*4}]);r.offsetToData=r.sizeOf();for(var i=0;i\\u003ce.axes.length;i++)r.fields=r.fields.concat(Mge(i,e.axes[i],t));for(var s=0;s\\u003ce.instances.length;s++)r.fields=r.fields.concat(Age(s,e.instances[s],e.axes,t));return r}function Ege(e,t,r){var i=new ot.Parser(e,t),s=i.parseULong();bt.argument(s===65536,\\\"Unsupported fvar table version.\\\");var a=i.parseOffset16();i.skip(\\\"uShort\\\",1);for(var n=i.parseUShort(),o=i.parseUShort(),l=i.parseUShort(),u=i.parseUShort(),h=[],d=0;d\\u003cn;d++)h.push(Nge(e,t+a+d*o,r));for(var c=[],m=t+a+n*o,g=0;g\\u003cl;g++)c.push(Cge(e,m+g*u,h,r));return{axes:h,instances:c}}var Pge={make:Rge,parse:Ege},Bge=function(){return{coverage:this.parsePointer(ve.coverage),attachPoints:this.parseList(ve.pointer(ve.uShortList))}},Ige=function(){var e=this.parseUShort();if(bt.argument(e===1||e===2||e===3,\\\"Unsupported CaretValue table version.\\\"),e===1)return{coordinate:this.parseShort()};if(e===2)return{pointindex:this.parseShort()};if(e===3)return{coordinate:this.parseShort()}},Fge=function(){return this.parseList(ve.pointer(Ige))},Lge=function(){return{coverage:this.parsePointer(ve.coverage),ligGlyphs:this.parseList(ve.pointer(Fge))}},kge=function(){return this.parseUShort(),this.parseList(ve.pointer(ve.coverage))};function Dge(e,t){t=t||0;var r=new ve(e,t),i=r.parseVersion(1);bt.argument(i===1||i===1.2||i===1.3,\\\"Unsupported GDEF table version.\\\");var s={version:i,classDef:r.parsePointer(ve.classDef),attachList:r.parsePointer(Bge),ligCaretList:r.parsePointer(Lge),markAttachClassDef:r.parsePointer(ve.classDef)};return i>=1.2&&(s.markGlyphSets=r.parsePointer(kge)),s}var Oge={parse:Dge},on=new Array(10);on[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{posFormat:1,coverage:this.parsePointer(ve.coverage),value:this.parseValueRecord()};if(t===2)return{posFormat:2,coverage:this.parsePointer(ve.coverage),values:this.parseValueRecordList()};bt.assert(!1,\\\"0x\\\"+e.toString(16)+\\\": GPOS lookup type 1 format must be 1 or 2.\\\")},on[2]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();bt.assert(t===1||t===2,\\\"0x\\\"+e.toString(16)+\\\": GPOS lookup type 2 format must be 1 or 2.\\\");var r=this.parsePointer(ve.coverage),i=this.parseUShort(),s=this.parseUShort();if(t===1)return{posFormat:t,coverage:r,valueFormat1:i,valueFormat2:s,pairSets:this.parseList(ve.pointer(ve.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(i),value2:this.parseValueRecord(s)}})))};if(t===2){var a=this.parsePointer(ve.classDef),n=this.parsePointer(ve.classDef),o=this.parseUShort(),l=this.parseUShort();return{posFormat:t,coverage:r,valueFormat1:i,valueFormat2:s,classDef1:a,classDef2:n,class1Count:o,class2Count:l,classRecords:this.parseList(o,ve.list(l,function(){return{value1:this.parseValueRecord(i),value2:this.parseValueRecord(s)}}))}}},on[3]=function(){return{error:\\\"GPOS Lookup 3 not supported\\\"}},on[4]=function(){return{error:\\\"GPOS Lookup 4 not supported\\\"}},on[5]=function(){return{error:\\\"GPOS Lookup 5 not supported\\\"}},on[6]=function(){return{error:\\\"GPOS Lookup 6 not supported\\\"}},on[7]=function(){return{error:\\\"GPOS Lookup 7 not supported\\\"}},on[8]=function(){return{error:\\\"GPOS Lookup 8 not supported\\\"}},on[9]=function(){return{error:\\\"GPOS Lookup 9 not supported\\\"}};function Uge(e,t){t=t||0;var r=new ve(e,t),i=r.parseVersion(1);return bt.argument(i===1||i===1.1,\\\"Unsupported GPOS table version \\\"+i),i===1?{version:i,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(on)}:{version:i,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(on),variations:r.parseFeatureVariationsList()}}var zge=new Array(10);function Vge(e){return new rt.Table(\\\"GPOS\\\",[{name:\\\"version\\\",type:\\\"ULONG\\\",value:65536},{name:\\\"scripts\\\",type:\\\"TABLE\\\",value:new rt.ScriptList(e.scripts)},{name:\\\"features\\\",type:\\\"TABLE\\\",value:new rt.FeatureList(e.features)},{name:\\\"lookups\\\",type:\\\"TABLE\\\",value:new rt.LookupList(e.lookups,zge)}])}var Gge={parse:Uge,make:Vge};function Wge(e){var t={};e.skip(\\\"uShort\\\");var r=e.parseUShort();bt.argument(r===0,\\\"Unsupported kern sub-table version.\\\"),e.skip(\\\"uShort\\\",2);var i=e.parseUShort();e.skip(\\\"uShort\\\",3);for(var s=0;s\\u003ci;s+=1){var a=e.parseUShort(),n=e.parseUShort(),o=e.parseShort();t[a+\\\",\\\"+n]=o}return t}function jge(e){var t={};e.skip(\\\"uShort\\\");var r=e.parseULong();r>1&&console.warn(\\\"Only the first kern subtable is supported.\\\"),e.skip(\\\"uLong\\\");var i=e.parseUShort(),s=i&255;if(e.skip(\\\"uShort\\\"),s===0){var a=e.parseUShort();e.skip(\\\"uShort\\\",3);for(var n=0;n\\u003ca;n+=1){var o=e.parseUShort(),l=e.parseUShort(),u=e.parseShort();t[o+\\\",\\\"+l]=u}}return t}function Hge(e,t){var r=new ot.Parser(e,t),i=r.parseUShort();if(i===0)return Wge(r);if(i===1)return jge(r);throw new Error(\\\"Unsupported kern table version (\\\"+i+\\\").\\\")}var Xge={parse:Hge};function $ge(e,t,r,i){for(var s=new ot.Parser(e,t),a=i?s.parseUShort:s.parseULong,n=[],o=0;o\\u003cr+1;o+=1){var l=a.call(s);i&&(l*=2),n.push(l)}return n}var qge={parse:$ge};function Yge(e,t){var r=ev();r.readFile(e,function(i,s){if(i)return t(i.message);t(null,QL(s))})}function Zge(e,t){var r=new XMLHttpRequest;r.open(\\\"get\\\",e,!0),r.responseType=\\\"arraybuffer\\\",r.onload=function(){return r.response?t(null,r.response):t(\\\"Font could not be loaded: \\\"+r.statusText)},r.onerror=function(){t(\\\"Font could not be loaded\\\")},r.send()}function Ek(e,t){for(var r=[],i=12,s=0;s\\u003ct;s+=1){var a=ot.getTag(e,i),n=ot.getULong(e,i+4),o=ot.getULong(e,i+8),l=ot.getULong(e,i+12);r.push({tag:a,checksum:n,offset:o,length:l,compression:!1}),i+=16}return r}function Jge(e,t){for(var r=[],i=44,s=0;s\\u003ct;s+=1){var a=ot.getTag(e,i),n=ot.getULong(e,i+4),o=ot.getULong(e,i+8),l=ot.getULong(e,i+12),u=void 0;o\\u003cl?u=\\\"WOFF\\\":u=!1,r.push({tag:a,offset:n,compression:u,compressedLength:o,length:l}),i+=20}return r}function ri(e,t){if(t.compression===\\\"WOFF\\\"){var r=new Uint8Array(e.buffer,t.offset+2,t.compressedLength-2),i=new Uint8Array(t.length);if(Gce(r,i),i.byteLength!==t.length)throw new Error(\\\"Decompression error: \\\"+t.tag+\\\" decompressed length doesn't match recorded length\\\");var s=new DataView(i.buffer,0);return{data:s,offset:0}}else return{data:e,offset:t.offset}}function $2(e,t){t=t??{};var r,i,s=new dr({empty:!0}),a=new DataView(e,0),n,o=[],l=ot.getTag(a,0);if(l===\\\"\\\\0\\u0001\\\\0\\\\0\\\"||l===\\\"true\\\"||l===\\\"typ1\\\")s.outlinesFormat=\\\"truetype\\\",n=ot.getUShort(a,4),o=Ek(a,n);else if(l===\\\"OTTO\\\")s.outlinesFormat=\\\"cff\\\",n=ot.getUShort(a,4),o=Ek(a,n);else if(l===\\\"wOFF\\\"){var u=ot.getTag(a,4);if(u===\\\"\\\\0\\u0001\\\\0\\\\0\\\")s.outlinesFormat=\\\"truetype\\\";else if(u===\\\"OTTO\\\")s.outlinesFormat=\\\"cff\\\";else throw new Error(\\\"Unsupported OpenType flavor \\\"+l);n=ot.getUShort(a,12),o=Jge(a,n)}else throw new Error(\\\"Unsupported OpenType signature \\\"+l);for(var h,d,c,m,g,y,b,v,S,T,w,N,C=0;C\\u003cn;C+=1){var R=o[C],E=void 0;switch(R.tag){case\\\"cmap\\\":E=ri(a,R),s.tables.cmap=fL.parse(E.data,E.offset),s.encoding=new yL(s.tables.cmap);break;case\\\"cvt \\\":E=ri(a,R),N=new ot.Parser(E.data,E.offset),s.tables.cvt=N.parseShortList(R.length/2);break;case\\\"fvar\\\":d=R;break;case\\\"fpgm\\\":E=ri(a,R),N=new ot.Parser(E.data,E.offset),s.tables.fpgm=N.parseByteList(R.length);break;case\\\"head\\\":E=ri(a,R),s.tables.head=PL.parse(E.data,E.offset),s.unitsPerEm=s.tables.head.unitsPerEm,r=s.tables.head.indexToLocFormat;break;case\\\"hhea\\\":E=ri(a,R),s.tables.hhea=BL.parse(E.data,E.offset),s.ascender=s.tables.hhea.ascender,s.descender=s.tables.hhea.descender,s.numberOfHMetrics=s.tables.hhea.numberOfHMetrics;break;case\\\"hmtx\\\":b=R;break;case\\\"ltag\\\":E=ri(a,R),i=FL.parse(E.data,E.offset);break;case\\\"maxp\\\":E=ri(a,R),s.tables.maxp=LL.parse(E.data,E.offset),s.numGlyphs=s.tables.maxp.numGlyphs;break;case\\\"name\\\":T=R;break;case\\\"OS/2\\\":E=ri(a,R),s.tables.os2=I2.parse(E.data,E.offset);break;case\\\"post\\\":E=ri(a,R),s.tables.post=WL.parse(E.data,E.offset),s.glyphNames=new A2(s.tables.post);break;case\\\"prep\\\":E=ri(a,R),N=new ot.Parser(E.data,E.offset),s.tables.prep=N.parseByteList(R.length);break;case\\\"glyf\\\":c=R;break;case\\\"loca\\\":S=R;break;case\\\"CFF \\\":h=R;break;case\\\"kern\\\":v=R;break;case\\\"GDEF\\\":m=R;break;case\\\"GPOS\\\":g=R;break;case\\\"GSUB\\\":y=R;break;case\\\"meta\\\":w=R;break}}var P=ri(a,T);if(s.tables.name=GL.parse(P.data,P.offset,i),s.names=s.tables.name,c&&S){var I=r===0,O=ri(a,S),L=qge.parse(O.data,O.offset,s.numGlyphs,I),X=ri(a,c);s.glyphs=ik.parse(X.data,X.offset,L,s,t)}else if(h){var z=ri(a,h);EL.parse(z.data,z.offset,s,t)}else throw new Error(\\\"Font doesn't contain TrueType or CFF outlines.\\\");var H=ri(a,b);if(IL.parse(s,H.data,H.offset,s.numberOfHMetrics,s.numGlyphs,s.glyphs,t),upe(s,t),v){var ue=ri(a,v);s.kerningPairs=Xge.parse(ue.data,ue.offset)}else s.kerningPairs={};if(m){var ne=ri(a,m);s.tables.gdef=Oge.parse(ne.data,ne.offset)}if(g){var re=ri(a,g);s.tables.gpos=Gge.parse(re.data,re.offset),s.position.init()}if(y){var ce=ri(a,y);s.tables.gsub=jL.parse(ce.data,ce.offset)}if(d){var ge=ri(a,d);s.tables.fvar=Pge.parse(ge.data,ge.offset,s.names)}if(w){var ye=ri(a,w);s.tables.meta=HL.parse(ye.data,ye.offset),s.metas=s.tables.meta}return s}function Qge(e,t,r){r=r??{};var i=typeof window>\\\"u\\\",s=i&&!r.isUrl?Yge:Zge;return new Promise(function(a,n){s(e,function(o,l){if(o){if(t)return t(o);n(o)}var u;try{u=$2(l,r)}catch(h){if(t)return t(h,null);n(h)}if(t)return t(null,u);a(u)})})}function Kge(e,t){var r=ev(),i=r.readFileSync(e);return $2(QL(i),t)}var e0e=Object.freeze({__proto__:null,Font:dr,Glyph:ia,Path:di,BoundingBox:$o,_parse:ot,parse:$2,load:Qge,loadSync:Kge}),t0e=e0e,Pk=new Map;function r0e(e){let t=Pk.get(e);return t||(t=fetch(e).then(r=>{if(!r.ok)throw new Error(`typeface: ${r.status}`);return r.arrayBuffer()}).then(r=>t0e.parse(r)),Pk.set(e,t)),t}function i0e(e,t,r=0){return e.getAdvanceWidth(t,1,{kerning:!0,letterSpacing:r})}function s0e(e,t,r,i,s=0){let a=r/e.unitsPerEm,n=(e.tables?.os2?.sCapHeight??e.ascender*.72)*a,o=i*r,l=o*(t.length-1)+n,u=[];return t.forEach((h,d)=>{let c=e.getAdvanceWidth(h,r,{kerning:!0,letterSpacing:s}),m=l/2-n-d*o,g=e.getPath(h,-c/2,0,r,{kerning:!0,letterSpacing:s}),y=new nl,b=v=>m-v;for(let v of g.commands)v.type===\\\"M\\\"?y.moveTo(v.x,b(v.y)):v.type===\\\"L\\\"?y.lineTo(v.x,b(v.y)):v.type===\\\"Q\\\"?y.quadraticCurveTo(v.x1,b(v.y1),v.x,b(v.y)):v.type===\\\"C\\\"?y.bezierCurveTo(v.x1,b(v.y1),v.x2,b(v.y2),v.x,b(v.y)):v.type===\\\"Z\\\"&&y.currentPath?.closePath();u.push(...k5.createShapes(y))}),u}var a0e=\\\"frost-build-cache\\\",ff=\\\"builds\\\",n0e=1,o0e=\\\"frost-build-10-planar-cap-normals\\\";function Bk(){return new Promise(e=>{try{if(typeof indexedDB>\\\"u\\\")return e(null);let t=indexedDB.open(a0e,n0e);t.onupgradeneeded=()=>{t.result.createObjectStore(ff)},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch{e(null)}})}async function l0e(e){let t=await Bk();return t?new Promise(r=>{try{let i=t.transaction(ff,\\\"readonly\\\").objectStore(ff).get(e);i.onsuccess=()=>r(i.result??null),i.onerror=()=>r(null)}catch{r(null)}}):null}async function u0e(e,t){let r=await Bk();r&&await new Promise(i=>{try{let s=r.transaction(ff,\\\"readwrite\\\"),a=s.objectStore(ff);a.clear(),a.put(t,e),s.oncomplete=()=>i(),s.onerror=()=>i()}catch{i()}})}function h0e(e){let t=r=>e.attributes[r]?e.attributes[r].array:null;return{position:t(\\\"position\\\"),normal:t(\\\"normal\\\"),uv:t(\\\"uv\\\"),index:e.index?new Uint32Array(e.index.array):null}}function d0e(e){let t=new ps;return t.setAttribute(\\\"position\\\",new tr(e.position,3)),t.setAttribute(\\\"normal\\\",new tr(e.normal,3)),e.uv&&t.setAttribute(\\\"uv\\\",new tr(e.uv,2)),e.index&&t.setIndex(new _i(e.index,1)),t.computeBoundingBox(),t}var Ah=1/60,c0e=y2(Ice),p0e=\\\"frost-ice-textured-r1-reference-optics\\\",Ik=12,Gx={turbulenceScale:{path:[\\\"powder\\\",\\\"turbulenceScale\\\"],replay:!0},clumpCohesion:{path:[\\\"powder\\\",\\\"clumpCohesion\\\"],replay:!0},repelStrength:{path:[\\\"powder\\\",\\\"repelStrength\\\"],replay:!0},repelRange:{path:[\\\"powder\\\",\\\"repelRange\\\"],replay:!0},repelRadial:{path:[\\\"powder\\\",\\\"repelRadial\\\"],replay:!0},repelRadialRange:{path:[\\\"powder\\\",\\\"repelRadialRange\\\"],replay:!0},wrap:{path:[\\\"powder\\\",\\\"wrap\\\"],replay:!1},turbulenceDecay:{path:[\\\"powder\\\",\\\"turbulenceDecay\\\"],replay:!0},settledDrift:{path:[\\\"powder\\\",\\\"settledDrift\\\"],replay:!0},tumble:{path:[\\\"powder\\\",\\\"tumble\\\"],replay:!1},assemblyFrontDuration:{path:[\\\"healing\\\",\\\"assemblyFrontDuration\\\"],replay:!0},assemblyOriginX:{path:[\\\"healing\\\",\\\"assemblyOriginX\\\"],replay:!0},assemblyOriginY:{path:[\\\"healing\\\",\\\"assemblyOriginY\\\"],replay:!0},assemblyAngle:{path:[\\\"healing\\\",\\\"assemblyAngle\\\"],replay:!0},assemblySpread:{path:[\\\"healing\\\",\\\"assemblySpread\\\"],replay:!0},assemblyFrontNoise:{path:[\\\"healing\\\",\\\"assemblyFrontNoise\\\"],replay:!0},assemblySpeedVariation:{path:[\\\"healing\\\",\\\"assemblySpeedVariation\\\"],replay:!0},assemblyBend:{path:[\\\"healing\\\",\\\"assemblyBend\\\"],replay:!0},assemblySwirl:{path:[\\\"healing\\\",\\\"assemblySwirl\\\"],replay:!0},assemblyLandingVariation:{path:[\\\"healing\\\",\\\"assemblyLandingVariation\\\"],replay:!0},returnNoiseAmount:{path:[\\\"healing\\\",\\\"returnNoiseAmount\\\"],replay:!0},returnGroupStagger:{path:[\\\"healing\\\",\\\"returnGroupStagger\\\"],replay:!0},returnGroupScale:{path:[\\\"healing\\\",\\\"returnGroupScale\\\"],replay:!0},returnGroupSeed:{path:[\\\"healing\\\",\\\"returnGroupSeed\\\"],replay:!0},formJitter:{path:[\\\"healing\\\",\\\"waveJitter\\\"],replay:!0},waveReach:{path:[\\\"healing\\\",\\\"waveReach\\\"],replay:!0},alignToSurface:{path:[\\\"healing\\\",\\\"alignToSurface\\\"],replay:!1},alignCurve:{path:[\\\"healing\\\",\\\"alignCurve\\\"],replay:!1},rimAzimuth:{path:[\\\"lighting\\\",\\\"rimAzimuth\\\"],replay:!1},rimAngle:{path:[\\\"lighting\\\",\\\"rimAngle\\\"],replay:!1},rimSize:{path:[\\\"lighting\\\",\\\"rimSize\\\"],replay:!1},fillReflectionStrength:{path:[\\\"lighting\\\",\\\"fillReflectionStrength\\\"],replay:!1},accentCoolIntensity:{path:[\\\"lighting\\\",\\\"accentCool\\\",\\\"intensity\\\"],replay:!1},accentCoolReflection:{path:[\\\"lighting\\\",\\\"accentCool\\\",\\\"reflection\\\"],replay:!1},accentCoolElevation:{path:[\\\"lighting\\\",\\\"accentCool\\\",\\\"elevation\\\"],replay:!1},accentCoolAzimuth:{path:[\\\"lighting\\\",\\\"accentCool\\\",\\\"azimuth\\\"],replay:!1},accentCoolSize:{path:[\\\"lighting\\\",\\\"accentCool\\\",\\\"size\\\"],replay:!1},accentCoolColor:{path:[\\\"lighting\\\",\\\"accentCool\\\",\\\"color\\\"],replay:!1},accentWarmIntensity:{path:[\\\"lighting\\\",\\\"accentWarm\\\",\\\"intensity\\\"],replay:!1},accentWarmReflection:{path:[\\\"lighting\\\",\\\"accentWarm\\\",\\\"reflection\\\"],replay:!1},accentWarmElevation:{path:[\\\"lighting\\\",\\\"accentWarm\\\",\\\"elevation\\\"],replay:!1},accentWarmAzimuth:{path:[\\\"lighting\\\",\\\"accentWarm\\\",\\\"azimuth\\\"],replay:!1},accentWarmSize:{path:[\\\"lighting\\\",\\\"accentWarm\\\",\\\"size\\\"],replay:!1},accentWarmColor:{path:[\\\"lighting\\\",\\\"accentWarm\\\",\\\"color\\\"],replay:!1},keyColor:{path:[\\\"lighting\\\",\\\"key\\\",\\\"color\\\"],replay:!1},keyIntensity:{path:[\\\"lighting\\\",\\\"key\\\",\\\"intensity\\\"],replay:!1},keyElevation:{path:[\\\"lighting\\\",\\\"key\\\",\\\"elevation\\\"],replay:!1},keyAzimuth:{path:[\\\"lighting\\\",\\\"key\\\",\\\"azimuth\\\"],replay:!1},keySize:{path:[\\\"lighting\\\",\\\"key\\\",\\\"size\\\"],replay:!1},fill:{path:[\\\"lighting\\\",\\\"fill\\\"],replay:!1},fillColor:{path:[\\\"lighting\\\",\\\"fillColor\\\"],replay:!1},fillGroundColor:{path:[\\\"lighting\\\",\\\"fillGroundColor\\\"],replay:!1},rim:{path:[\\\"lighting\\\",\\\"rim\\\"],replay:!1},rimColor:{path:[\\\"lighting\\\",\\\"rimColor\\\"],replay:!1},rimElevation:{path:[\\\"lighting\\\",\\\"rimElevation\\\"],replay:!1},swayAmplitude:{path:[\\\"lighting\\\",\\\"sway\\\",\\\"amplitude\\\"],replay:!1},swayPeriod:{path:[\\\"lighting\\\",\\\"sway\\\",\\\"period\\\"],replay:!1},envSoftbox:{path:[\\\"lighting\\\",\\\"envSoftbox\\\"],replay:!1},envRim:{path:[\\\"lighting\\\",\\\"envRim\\\"],replay:!1},envFill:{path:[\\\"lighting\\\",\\\"envFill\\\"],replay:!1},backdropTop:{path:[\\\"lighting\\\",\\\"backdrop\\\",\\\"top\\\"],replay:!1},backdropMid:{path:[\\\"lighting\\\",\\\"backdrop\\\",\\\"mid\\\"],replay:!1},backdropBottom:{path:[\\\"lighting\\\",\\\"backdrop\\\",\\\"bottom\\\"],replay:!1},backdropCenterX:{path:[\\\"lighting\\\",\\\"backdrop\\\",\\\"centerX\\\"],replay:!1},backdropCenterY:{path:[\\\"lighting\\\",\\\"backdrop\\\",\\\"centerY\\\"],replay:!1},backdropRadius:{path:[\\\"lighting\\\",\\\"backdrop\\\",\\\"radius\\\"],replay:!1},backdropFalloff:{path:[\\\"lighting\\\",\\\"backdrop\\\",\\\"falloff\\\"],replay:!1},backdropNoise:{path:[\\\"lighting\\\",\\\"backdrop\\\",\\\"noise\\\"],replay:!1},...Object.fromEntries(Object.keys(Qd).map(e=>[$ie(e),{path:[\\\"ice\\\",\\\"features\\\",e],replay:!1}])),materialBacklight:{path:[\\\"ice\\\",\\\"backlight\\\"],replay:!1},materialInclusionAmount:{path:[\\\"ice\\\",\\\"inclusionAmount\\\"],replay:!1},materialInclusionScale:{path:[\\\"ice\\\",\\\"inclusionScale\\\"],replay:!1},materialBaseColor:{path:[\\\"ice\\\",\\\"baseColor\\\"],replay:!1},materialInteriorFrost:{path:[\\\"erosion\\\",\\\"interiorFrost\\\"],replay:!1},materialGrainAmount:{path:[\\\"erosion\\\",\\\"edgeBump\\\"],replay:!1},materialGrainScale:{path:[\\\"erosion\\\",\\\"edgeBumpScale\\\"],replay:!1},ior:{path:[\\\"ice\\\",\\\"ior\\\"],replay:!1},dispersion:{path:[\\\"ice\\\",\\\"dispersion\\\"],replay:!1},thicknessScale:{path:[\\\"ice\\\",\\\"thicknessScale\\\"],replay:!1},attenuationDistance:{path:[\\\"ice\\\",\\\"attenuationDistance\\\"],replay:!1},attenuationColor:{path:[\\\"ice\\\",\\\"attenuationColor\\\"],replay:!1},baseRoughness:{path:[\\\"ice\\\",\\\"baseRoughness\\\"],replay:!1},crumbleGlow:{path:[\\\"ice\\\",\\\"crumbleGlow\\\"],replay:!1},edgeWhiteness:{path:[\\\"ice\\\",\\\"edgeWhiteness\\\"],replay:!1},clearcoat:{path:[\\\"ice\\\",\\\"clearcoat\\\"],replay:!1},clearcoatRoughness:{path:[\\\"ice\\\",\\\"clearcoatRoughness\\\"],replay:!1},envIntensity:{path:[\\\"ice\\\",\\\"envIntensity\\\"],replay:!1},specularIntensity:{path:[\\\"ice\\\",\\\"specularIntensity\\\"],replay:!1},interiorScatter:{path:[\\\"ice\\\",\\\"interiorScatter\\\"],replay:!1},frostScale:{path:[\\\"ice\\\",\\\"frost\\\",\\\"scale\\\"],replay:!1},frostThreshold:{path:[\\\"ice\\\",\\\"frost\\\",\\\"threshold\\\"],replay:!1},frostSoftness:{path:[\\\"ice\\\",\\\"frost\\\",\\\"softness\\\"],replay:!1},frostRoughness:{path:[\\\"ice\\\",\\\"frost\\\",\\\"roughness\\\"],replay:!1},frostDiffuse:{path:[\\\"ice\\\",\\\"frost\\\",\\\"diffuse\\\"],replay:!1},crystalBump:{path:[\\\"ice\\\",\\\"frost\\\",\\\"crystalBump\\\"],replay:!1},crystalScale:{path:[\\\"ice\\\",\\\"frost\\\",\\\"crystalScale\\\"],replay:!1},crackLargeScale:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"largeScale\\\"],replay:!1},crackWarp:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"warp\\\"],replay:!1},crackWarpScale:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"warpScale\\\"],replay:!1},crackCoverage:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"coverage\\\"],replay:!1},crackRegionScale:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"regionScale\\\"],replay:!1},crackRegionCoverage:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"regionCoverage\\\"],replay:!1},veinScale:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"veinScale\\\"],replay:!1},veinContrast:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"veinContrast\\\"],replay:!1},crackWidth:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"width\\\"],replay:!1},crackBrightness:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"brightness\\\"],replay:!1},crackDarkness:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"darkness\\\"],replay:!1},crackRefraction:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"refraction\\\"],replay:!1},crackSurfaceStrength:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"surfaceStrength\\\"],replay:!1},fineScale:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"fineScale\\\"],replay:!1},fineAmount:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"fineAmount\\\"],replay:!1},fineCoverage:{path:[\\\"ice\\\",\\\"cracks\\\",\\\"fineCoverage\\\"],replay:!1},smudgeAmount:{path:[\\\"ice\\\",\\\"smudges\\\",\\\"amount\\\"],replay:!1},smudgeCoverage:{path:[\\\"ice\\\",\\\"smudges\\\",\\\"coverage\\\"],replay:!1},smudgeMaskScale:{path:[\\\"ice\\\",\\\"smudges\\\",\\\"maskScale\\\"],replay:!1},smudgeAnisotropy:{path:[\\\"ice\\\",\\\"smudges\\\",\\\"anisotropy\\\"],replay:!1},smudgeRoughness:{path:[\\\"ice\\\",\\\"smudges\\\",\\\"roughness\\\"],replay:!1},smudgeWhiteness:{path:[\\\"ice\\\",\\\"smudges\\\",\\\"whiteness\\\"],replay:!1},smudgeScale:{path:[\\\"ice\\\",\\\"smudges\\\",\\\"scale\\\"],replay:!1},microBump:{path:[\\\"ice\\\",\\\"bumps\\\",\\\"microBump\\\"],replay:!1},microScale:{path:[\\\"ice\\\",\\\"bumps\\\",\\\"microScale\\\"],replay:!1},microCoverage:{path:[\\\"ice\\\",\\\"bumps\\\",\\\"microCoverage\\\"],replay:!1},rippleBump:{path:[\\\"ice\\\",\\\"bumps\\\",\\\"rippleBump\\\"],replay:!1},rippleScale:{path:[\\\"ice\\\",\\\"bumps\\\",\\\"rippleScale\\\"],replay:!1},bumpMaskScale:{path:[\\\"ice\\\",\\\"bumps\\\",\\\"maskScale\\\"],replay:!1},baseTone:{path:[\\\"powder\\\",\\\"baseTone\\\"],replay:!1},fragTranslucency:{path:[\\\"powder\\\",\\\"fragments\\\",\\\"translucency\\\"],replay:!1},fragThroughTint:{path:[\\\"powder\\\",\\\"fragments\\\",\\\"throughTint\\\"],replay:!1},fragFresnelPower:{path:[\\\"powder\\\",\\\"fragments\\\",\\\"fresnelPower\\\"],replay:!1},fragRoughness:{path:[\\\"powder\\\",\\\"fragments\\\",\\\"roughness\\\"],replay:!1},fragClearcoat:{path:[\\\"powder\\\",\\\"fragments\\\",\\\"clearcoat\\\"],replay:!1},fragSpecular:{path:[\\\"powder\\\",\\\"fragments\\\",\\\"specular\\\"],replay:!1},sparkle:{path:[\\\"powder\\\",\\\"fragments\\\",\\\"sparkle\\\"],replay:!1},sparkleFraction:{path:[\\\"powder\\\",\\\"fragments\\\",\\\"sparkleFraction\\\"],replay:!1},spriteTilt:{path:[\\\"powder\\\",\\\"sprites\\\",\\\"tilt\\\"],replay:!1},spriteNormal:{path:[\\\"powder\\\",\\\"sprites\\\",\\\"normalStrength\\\"],replay:!1},spriteFrost:{path:[\\\"powder\\\",\\\"sprites\\\",\\\"frostFromAtlas\\\"],replay:!1},spriteFrostBoost:{path:[\\\"powder\\\",\\\"sprites\\\",\\\"frostBoost\\\"],replay:!1},spriteFrostRoughness:{path:[\\\"powder\\\",\\\"sprites\\\",\\\"frostRoughness\\\"],replay:!1},spriteEdgeLight:{path:[\\\"powder\\\",\\\"sprites\\\",\\\"edgeLight\\\"],replay:!1},spriteAlphaCut:{path:[\\\"powder\\\",\\\"sprites\\\",\\\"alphaCut\\\"],replay:!1},spriteSeeThrough:{path:[\\\"powder\\\",\\\"sprites\\\",\\\"seeThrough\\\"],replay:!1},bloomThreshold:{path:[\\\"post\\\",\\\"bloom\\\",\\\"threshold\\\"],replay:!1},bloomIntensity:{path:[\\\"post\\\",\\\"bloom\\\",\\\"intensity\\\"],replay:!1},bloomRadius:{path:[\\\"post\\\",\\\"bloom\\\",\\\"radius\\\"],replay:!1},monochrome:{path:[\\\"post\\\",\\\"monochrome\\\"],replay:!1},tonemap:{path:[\\\"post\\\",\\\"tonemap\\\"],replay:!1},exposure:{path:[\\\"post\\\",\\\"exposure\\\"],replay:!1},contrast:{path:[\\\"post\\\",\\\"contrast\\\"],replay:!1},blackLift:{path:[\\\"post\\\",\\\"blackLift\\\"],replay:!1},vignetteStrength:{path:[\\\"post\\\",\\\"vignette\\\",\\\"strength\\\"],replay:!1},vignetteSoftness:{path:[\\\"post\\\",\\\"vignette\\\",\\\"softness\\\"],replay:!1},vignetteRadius:{path:[\\\"post\\\",\\\"vignette\\\",\\\"radius\\\"],replay:!1},grainStrength:{path:[\\\"post\\\",\\\"grain\\\",\\\"strength\\\"],replay:!1},cutThreshold:{path:[\\\"erosion\\\",\\\"cutThreshold\\\"],replay:!1},cutSoftness:{path:[\\\"erosion\\\",\\\"cutSoftness\\\"],replay:!1},edgeWidth:{path:[\\\"erosion\\\",\\\"edgeWidth\\\"],replay:!1},edgeInset:{path:[\\\"erosion\\\",\\\"edgeInset\\\"],replay:!1},brushSoftness:{path:[\\\"erosion\\\",\\\"brushSoftness\\\"],replay:!0},brushNoise:{path:[\\\"erosion\\\",\\\"brushNoise\\\"],replay:!0},crumbleRate:{path:[\\\"erosion\\\",\\\"crumbleRate\\\"],replay:!0},crumbleCrackBias:{path:[\\\"erosion\\\",\\\"crumbleCrackBias\\\"],replay:!0},crumbleDuration:{path:[\\\"erosion\\\",\\\"crumbleDuration\\\"],replay:!0},ejectSpeed:{path:[\\\"powder\\\",\\\"ejectSpeed\\\"],replay:!0},ejectSpread:{path:[\\\"powder\\\",\\\"ejectSpread\\\"],replay:!0},ejectTurbulence:{path:[\\\"powder\\\",\\\"ejectTurbulence\\\"],replay:!0},drag:{path:[\\\"powder\\\",\\\"drag\\\"],replay:!0},gravity:{path:[\\\"powder\\\",\\\"gravity\\\"],replay:!0},turbulence:{path:[\\\"powder\\\",\\\"turbulence\\\"],replay:!0},settleTime:{path:[\\\"powder\\\",\\\"settleTime\\\"],replay:!0},maxSpeed:{path:[\\\"powder\\\",\\\"maxSpeed\\\"],replay:!0},minPixelSize:{path:[\\\"powder\\\",\\\"minPixelSize\\\"],replay:!1},grainSizeMultiplier:{path:[\\\"powder\\\",\\\"grainSizeMultiplier\\\"],replay:!1},spriteSize:{path:[\\\"powder\\\",\\\"sprites\\\",\\\"sizeScale\\\"],replay:!1},returnSpring:{path:[\\\"healing\\\",\\\"returnSpring\\\"],replay:!0},returnDamping:{path:[\\\"healing\\\",\\\"returnDamping\\\"],replay:!0},returnRamp:{path:[\\\"healing\\\",\\\"returnRamp\\\"],replay:!0},returnMaxSpeed:{path:[\\\"healing\\\",\\\"returnMaxSpeed\\\"],replay:!0},healRate:{path:[\\\"healing\\\",\\\"healRate\\\"],replay:!0},cellRestore:{path:[\\\"healing\\\",\\\"cellRestore\\\"],replay:!0},landedFade:{path:[\\\"healing\\\",\\\"landedFade\\\"],replay:!0},refrostTime:{path:[\\\"healing\\\",\\\"refrostTime\\\"],replay:!0}},q2=Object.freeze(Object.fromEntries(Object.entries(Gx).filter(([e,t])=>e.startsWith(\\\"material\\\")||[\\\"ice\\\",\\\"lighting\\\",\\\"post\\\"].includes(t.path[0])||[\\\"baseTone\\\",\\\"wrap\\\",\\\"sparkle\\\",\\\"sparkleFraction\\\"].includes(e)||e.startsWith(\\\"frag\\\")||e.startsWith(\\\"sprite\\\")).map(([e])=>[e,Io[e]]))),gf=[-1,.3,0],yf=[1,-.3,0];function Fk(e){return JSON.stringify([e.headlines,{...e.text,meshDetail:f2(e.text.meshDetail)},Nx(e.deformation),e.quality,e.upscaler,e.renderScale,e.shapeResolution??\\\"256\\\",e.erosionResolution,e.particleCount,e.logoUrl,g2(e.logoMeshDetail),e.shards.strayDust,Number(e.tune.spriteSeeThrough??q2.spriteSeeThrough)>0])}function m0e(e){e={...e,logoMeshDetail:g2(e.logoMeshDetail),text:{...e.text,meshDetail:f2(e.text.meshDetail)}};let t=null,r=null,i=!1,s=-1,a=-1,n=0,o=null,l=0,u=null,h=U=>{th.stages.push([U,performance.now()-th.start]),e.onProgress?.(U)},d=e.schedule,c=e.pose,m=e.shards,g=c2(e.cameraTrack),y=()=>e.cameraMode===\\\"authored\\\"&&g.keys.length>0,b=()=>y()&&g.objectMotion===\\\"stationary\\\";function v(){t&&(t.onCameraTransform=y()?U=>{t&&vce(t.camera,g,U,t.objectGroup.matrixWorld,t.rig.lookAt)}:null,y()||(t.camera.zoom=1,t.camera.updateProjectionMatrix()))}let S=Fk(e),T=[],w=[],N=[],C=null,R=-1,E=null,P=(U,J)=>{let q=le;for(let se=0;se\\u003cU.length-1;se++)q=q[U[se]];q[U[U.length-1]]=J};function I(U){for(let[J,q]of Object.entries({...q2,...Bs,...U})){let se=Gx[J];se&&(typeof q==\\\"string\\\"||typeof q==\\\"boolean\\\"||Number.isFinite(q))&&P(se.path,q)}}function O(){Ht.enabled=!0,Ht.clickResets=!0,Ht.shape=\\\"logo\\\",Ht.cursorErodes=!0,Ht.hud=!1,Ht.framing=!0,Object.assign(Ht,{distance:13.45,height:1.2,lookAtX:0,lookAtY:.05,fov:29.5,objectX:0,objectY:.05,objectZ:0,baseYaw:0,basePitch:0,rotateYaw:40,rotatePitch:45,parallaxRange:15}),Ht.cameraOverride=null,le.shape.deformAmplitude=0,le.camera.idleAmplitude=0;let U=le.performance;U.adaptiveResolution=!1,U.dynamicSceneResolution=!1,U.sceneResolutionScale=Math.max(.25,Math.min(1,e.renderScale)),U.minSceneResolutionScale=U.sceneResolutionScale,U.upscaler=e.upscaler,U.nativePostEffects=!0,U.upscaleSharpness=1,U.minPixelRatio=e.previewPixelRatio??2,le.post.pixelRatioCap=e.previewPixelRatio??2,U.idleSkip=!1,U.gpuTimers=!1,le.debug.stats=!1,le.debug.freeze=!1,le.debug.forceStroke=!1,le.shape.logo.sdfRes=[128,256,384].includes(Number(e.shapeResolution))?Number(e.shapeResolution):256,le.erosion.resolution=e.erosionResolution,le.powder.particleCount=e.particleCount,le.powder.amount=m.amount,le.powder.lostRadius=80,le.powder.strayCount=Math.round(m.strayDust),le.powder.inheritRotation=!0,le.powder.inheritTime=m.followObject*1e3,le.ice={...structuredClone(Mx.ice),features:{...Qd}},le.lighting=structuredClone(Mx.lighting),le.post=structuredClone(Mx.post),le.post.pixelRatioCap=e.previewPixelRatio??2,le.post.grain.backgroundStrength=0,le.powder.hazeIntensity=0,le.ice.cracks.steps=18,le.erosion.interiorSteps=48,U.adaptiveSteps=Mx.performance.adaptiveSteps,I(e.tune),e.quality===\\\"lite\\\"&&(le.shape.segments=96,le.ice.cracks.steps=6,le.ice.cracks.fineCracks=!1,le.erosion.resolution=\\\"64\\\",le.powder.particleCount=\\\"100k\\\",le.powder.densityGrid=\\\"32\\\",le.powder.hazeSteps=8),L()}function L(){le.healing.healDelay=1e9,le.healing.returnAfter=0,le.healing.waveTime=0,le.version++}function X(){le.healing.healDelay=0,le.healing.returnAfter=0,le.healing.waveTime=m.formSpread,le.healing.fallbackHeal=m.formFill,le.version++}let z=(async()=>{if(await new Promise(Fe=>setTimeout(Fe,250)),i)return;let U=navigator;if(!U.gpu)throw new Error(\\\"Frost: navigator.gpu is unavailable (WebGPU required)\\\");if(!await U.gpu.requestAdapter().catch(()=>null))throw new Error(\\\"Frost: no WebGPU adapter\\\");h(\\\"webgpu adapter\\\"),O();let J=new qX({canvas:e.canvas,antialias:!1,forceWebGL:!1,powerPreference:\\\"high-performance\\\",trackTimestamp:!1});if(await J.init(),J.backend?.isWebGLBackend)throw new Error(\\\"Frost: WebGPU backend unavailable, WebGL fallback is not supported\\\");J.toneMapping=eo,J.outputColorSpace=ds,J.shadowMap.enabled=le.lighting.shadow.intensity>0,J.shadowMap.type=Lh,J.setPixelRatio(1),J.setSize(e.width,e.height,!1),r=J,h(\\\"renderer\\\");let q=new bg,se=new gs(30,e.width/e.height,.5,80);se.position.set(0,1.2,13.5);let pe=le.shape.logo,Te=le.powder,we={\\\"100k\\\":1e5,\\\"250k\\\":25e4,\\\"500k\\\":5e5,\\\"1M\\\":1e6}[Te.particleCount]??1e5,ie=Nx(e.deformation),V=!!e.rig&&!e.rig.sequence,Oe=JSON.stringify([o0e,V,ie,e.headlines,e.text,e.logoUrl,e.logoMeshDetail,pe,we,Te.nearSurfaceFraction,Te.nearSurfaceDepth,le.shape.seed,le.shape.size]),tt=await new tb().loadAsync(a2(\\\"textures/bluenoise64.png\\\")).then(Fe=>(Fe.wrapS=Fe.wrapT=to,Fe.minFilter=Fe.magFilter=or,Fe.generateMipmaps=!1,Fe.colorSpace=Fa,Fe)),Je=await new tb().loadAsync(\\\"https://static.heygen.ai/hyperframes-oss/registry-assets/4bea3a8ab90c9527.png\\\").then(Fe=>(Fe.wrapS=Fe.wrapT=Qo,Fe.minFilter=Ia,Fe.magFilter=lr,Fe.generateMipmaps=!0,Fe.colorSpace=Fa,Fe)),ct=0,_e=new URLSearchParams(location.search).has(\\\"fresh\\\")?null:await l0e(Oe).catch(()=>null);if(_e&&_e.geometries.length===(V?1:3)&&_e.sdfs.length===(V?1:3)&&_e.rests.length===(V?0:2)){for(let Fe of _e.geometries)T.push(d0e(Fe));for(let Fe of _e.sdfs)w.push(F1(Fe.data,Fe.res,Fe.bound,Fe.thickness,Fe.sampleBound));ct=_e.sdfs[0].bound,h(\\\"shapes (cached)\\\")}else{let Fe=e.fontUrl.replace(/Geist-[A-Za-z]+\\\\.ttf$/,`Geist-${e.text.weight===400?\\\"Regular\\\":e.text.weight===600?\\\"SemiBold\\\":\\\"Bold\\\"}.ttf`),[it,Rt]=await Promise.all([Qae(e.logoUrl,pe),V?Promise.resolve(null):r0e(Fe)]);if(i)return;if(!it.length)throw new Error(\\\"Frost: the logo SVG produced no shapes\\\");h(\\\"assets\\\"),T.push(G5(it,pe,pe.width));let Ft={...pe,depth:e.text.depth,bevelThickness:e.text.bevel,bevelSize:e.text.bevel*.8,bevelOffset:0,cornerRadius:e.text.corner,curveSegments:10,bevelSegments:4};for(let Ze of V?[]:e.headlines){let ht=Ze.map(Gi=>Gi.trim()).filter(Boolean);ht.length||ht.push(\\\" \\\");let Yt=Math.max(.001,...ht.map(Gi=>i0e(Rt,Gi,e.text.letterSpacing))),Tr=e.text.width/Yt;T.push(G5(s0e(Rt,ht,Tr,e.text.lineHeight,e.text.letterSpacing),Ft,Tr))}for(let Ze=0;Ze\\u003cT.length;Ze++){let ht=T[Ze];if(h(Ze===0?\\\"logo geometry\\\":`text mesh ${Ze}/2 \\\\xB7 detail ${e.text.meshDetail}`),await new Promise(Yt=>setTimeout(Yt,0)),i)return;T[Ze]=Bce(ht,ie,pe.creaseAngle,Ze===0?void 0:e.text.meshDetail,Ze===0?e.logoMeshDetail:void 0),Ze>0&&h(`text mesh ${Ze}/2 \\\\xB7 ${T[Ze].getAttribute(\\\"position\\\").count/3} triangles`),await new Promise(Yt=>setTimeout(Yt,0)),T[Ze]!==ht&&ht.dispose()}for(let Ze of T){let ht=Fm(Ze);ct=Math.max(ct,ht.x,ht.y,ht.z)}ct*=1.15;for(let Ze of T){let ht=Fm(Ze),Yt=Math.max(ht.x,ht.y,ht.z)*1.15;w.push(qa.gpu?await nne(J,Ze,ct,pe.sdfRes,Yt):Kae(Ze,ct,pe.sdfRes,Yt)),await new Promise(Tr=>setTimeout(Tr,0))}if(i)return;h(\\\"shapes\\\")}C=F1(w[0].data.slice(),w[0].res,ct,w[0].thickness,w[0].sampleDomain.value),hx.extraShell=2*ct/pe.sdfRes*2;let nt=le.shape.size,dt=T.slice();for(let Fe=0;Fe\\u003cT.length;Fe++){let it=T[Fe].clone();it.scale(nt,nt,nt),T[Fe]=it}t=new gce(J,q,se,tt,{sdf:C,geometry:T[0]},Je),t.onObjectTransform=Fe=>{if(!t)return;if(E){E.pose(Fe);return}let it=Sce(Fe,d,c,R,b());t.motionGroup.quaternion.copy(it.rotation),t.motionGroup.position.copy(it.position),t.objectGroup.quaternion.copy(it.facing)},R=0,v();let ft=t.powder;if(N.push(ft.restInit.slice()),_e&&_e.rests.length===2)for(let Fe of _e.rests){let it=ft.restInit.slice();it.set(Fe.subarray(0,ft.count*4)),N.push(it)}else{for(let Fe=1;Fe\\u003cT.length;Fe++){let it=cw(\\\"logo\\\",le.shape.size,le.shape.tubeRatio,w[Fe]),Rt=Fm(dt[Fe]),Ft=rI(it,ft.count,Te.nearSurfaceFraction,Te.nearSurfaceDepth,Lm(le.shape.seed+101+Fe),[(Rt.x+.05)*nt,(Rt.y+.05)*nt,(Rt.z+.05)*nt]),Ze=ft.restInit.slice();for(let ht=0;ht\\u003cft.count;ht++)Ze[ht*4]=Ft.positions[ht*3],Ze[ht*4+1]=Ft.positions[ht*3+1],Ze[ht*4+2]=Ft.positions[ht*3+2];N.push(Ze),await new Promise(ht=>setTimeout(ht,0))}new URLSearchParams(location.search).has(\\\"fresh\\\")||u0e(Oe,{geometries:dt.map(h0e),sdfs:w.map(Fe=>({data:Fe.data,res:Fe.res,bound:Fe.bound,thickness:Fe.thickness,sampleBound:Fe.sampleDomain.value})),rests:N.slice(1).map(Fe=>Fe.slice(0,ft.count*4))}).catch(()=>{})}e.rig&&(E=new Tse(t,{...e.rig,retarget:Fe=>ge(Fe,!0)})),window.__fb={world:t,renderer:J,D:le,sim:pt,clock:ta};for(const Fe of[.25,.5,.75,0])G(Fe*y2(d)),await(async()=>{for(;o;)await o})();h(\\\"world\\\")})(),H=p2(d,c);function ue(){H=p2(d,c)}let ne=U=>{let J=H(U);return new si().setFromEuler(new cn(Bt.degToRad(J.pitch),Bt.degToRad(J.yaw),0,\\\"YXZ\\\"))},re=new si;function ce(U){if(U===0||b())return new si;let J=U===1?d.form1+2.8:d.form2+2.8;return ne(J).invert()}function ge(U,J){if(!t||!r||!C)return;let q=w[U];U!==R&&(C.data.set(q.data),C.sampleDomain.value=q.sampleDomain.value,C.sampleBoundNode&&(C.sampleBoundNode.value=q.sampleDomain.value),C.texture.needsUpdate=!0,C.thickness=q.thickness,t.shape=cw(\\\"logo\\\",le.shape.size,le.shape.tubeRatio,C),t.mesh.geometry=T[U],R=U),re.copy(e.rig?new si:ce(U)),t.objectGroup.quaternion.copy(re),t.motionGroup.updateMatrixWorld(!0),t.powder.syncModel(),t.erosion.rebake(r,J),t.powder.retarget(r,N[U])}function ye(U=!1){if(!t||!r)return;L(),t.erosion.u.reconstruct.value=0,le.powder.repelFromObject=!0;let J=U?m.finalEjectBoost:1;le.powder.ejectSpeed=Number(e.tune.ejectSpeed)*J,le.powder.maxSpeed=Number(e.tune.maxSpeed)*J,le.powder.minEjectSpeed=.66*J,le.version++,t.powder.restoreThresholds(r),t.interaction.sweep({from:gf,to:yf,duration:.7,radius:m.sliceRadius,strength:m.sliceStrength})}function oe(){if(!t)return;let U=t.shape.bound,J=yf[0]-gf[0],q=yf[1]-gf[1],se=Math.hypot(J,q),pe=-q/se,Te=J/se,we=Math.max(.15,m.shatterRadius*1.7)/U,ie=Math.max(1,Math.ceil(1.25/we)),V=m.breakDuration/(ie*2),Oe=0;for(let tt=1;tt\\u003c=ie;tt++)for(let Je of[1,-1]){let ct=Je*tt*we;t.interaction.sweep({from:[gf[0]+pe*ct,gf[1]+Te*ct,0],to:[yf[0]+pe*ct,yf[1]+Te*ct,0],duration:.5,delay:Oe*V,radius:m.shatterRadius,strength:m.shatterStrength}),Oe++}}function Ae(){!t||!r||(r.compute(t.erosion.fillNode),le.powder.repelFromObject=!1,le.version++)}function Ie(U){t&&(t.powder.u.assemblyEnd.value=(U===1?d.break1:d.break2)-.65,ge(U,!0),pt.lastStrokeT=ta.t,X())}function Xe(){t&&(L(),t.mesh.visible=!1,le.healing.resetFade=QF*1e3,pt.resetRequestedAt=ta.t)}function at(){t&&(a=-1,le.powder.repelFromObject=!0,t.resetSim(),t.interaction.clearScripted(),re.identity(),ge(0,!1),e.rig?.sequence&&r&&t.powder.reset(r),L(),le.healing.resetFade=50,Ui.inside=!1,Ui.x=0,Ui.y=0,Ui.lastMoveT=0,Ui.moved=!1,E?.reset(),s=0)}function W(U,J){if(!t)return;let q=U*Ah;if(E){s2(U),t.frame(q,Ah,J);return}ta.t=q;let se=pe=>Math.round(pe/Ah)===U;for(let pe of[d.logoBreak,d.break1,d.break2])se(pe)&&ye(pe===d.break2),se(pe+.3)&&oe(),se(pe+.3+m.breakDuration+.5)&&Ae();se(d.form1)&&Ie(1),se(d.form2)&&Ie(2),se(d.fadeOut)&&Xe(),s2(U),t.frame(q,Ah,J)}async function j(){let U=-1,J=0;for(;!i&&t&&r;){let q=l;(s\\u003c0||q\\u003cs)&&at(),q!==U&&(J=q-s>60?q-Ik:q,U=q);let se=Math.min(q,s+8);if(q===s&&a!==q){s2(q);let Te=e.rig&&q===0&&a\\u003c0?Ik:1;for(let we=0;we\\u003cTe;we++)t.frame(q*Ah,0,!0);a=q}for(;s\\u003cse;){s++;let Te=s===q||s>J;W(s,Te),Te&&(a=s)}let pe=r.backend?.device?.queue;if(pe?.onSubmittedWorkDone&&await pe.onSubmittedWorkDone(),i||s===l&&a===l)return;await new Promise(Te=>setTimeout(Te,0))}}function G(U){i||(n=Number.isFinite(U)?Math.max(0,Math.min(e.rig?.duration??y2(d),U)):0,l=Math.round(n/Ah),!(!t||!r||o)&&(u=null,o=Promise.resolve().then(j).catch(J=>{u=J,console.error(\\\"Frost seek failed\\\",J)}).finally(()=>{o=null})))}function ae(){a=-1,G(n)}function be(U,J){if(J!==S)return\\\"rebuild\\\";let q=!1,se=(Te,we)=>JSON.stringify(Te)===JSON.stringify(we);(!se(U.schedule,d)||!se(U.pose,c))&&(q=!0);let pe=b();g=c2(U.cameraTrack),e.cameraTrack=g,e.cameraMode=U.cameraMode,pe!==b()&&(q=!0),v(),se(U.shards,m)||(q=!0);for(let[Te,we]of Object.entries(U.tune))if(e.tune[Te]!==we){let ie=Gx[Te];ie&&(P(ie.path,we),ie.replay&&(q=!0))}return e.schedule=d=U.schedule,e.pose=c=U.pose,e.shards=m=U.shards,e.tune={...U.tune},le.powder.amount=m.amount,le.powder.inheritTime=m.followObject*1e3,le.version++,ue(),t&&(q?(s=-1,a=-1,G(n)):ae()),\\\"live\\\"}async function Be(){for(await z;o;)await o;if(u)throw u}function $(){i=!0,t?.dispose(),t=null,E?.dispose();for(let U of w)U.texture.dispose();C?.texture.dispose(),C=null;for(let U of T)U.dispose();r&&(r.dispose(),r=null),Ht.enabled=!1,Ht.shape=null,Ht.cameraOverride=null,delete window.__fb}return{ready:z,renderAt:G,redraw:ae,invalidate:()=>{s=-1,a=-1},waitForGpu:Be,poseAt:U=>H(U),applyOptions:be,structuralKey:S,get world(){return t},get shape(){return R},dispose:$}}return xD(gM)})();\\n\",\"frost.js\");\nrun(\"\\n (() => {\\n \\\"use strict\\\";\\n // Studio reruns composition scripts in the same document after timeline edits.\\n window.__frostInstance?.dispose();\\n const W = 1920,\\n H = 1080;\\n const schema = [\\n {\\n id: \\\"materialBaseColor\\\",\\n type: \\\"color\\\",\\n label: \\\"Base color\\\",\\n default: \\\"#ffffff\\\",\\n materialSection: \\\"Base\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"baseRoughness\\\",\\n type: \\\"number\\\",\\n label: \\\"Base roughness\\\",\\n default: 0.31,\\n min: 0,\\n max: 0.5,\\n step: 0.005,\\n materialSection: \\\"Base\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialTransmission\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Transmission\\\",\\n default: true,\\n materialSection: \\\"Transmission\\\",\\n materialScope: \\\"object\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description: \\\"Switch off to remove this feature without losing its settings.\\\",\\n },\\n {\\n id: \\\"materialBacklight\\\",\\n type: \\\"number\\\",\\n label: \\\"Backlight through ice\\\",\\n default: 0.27,\\n min: 0,\\n max: 2,\\n step: 0.01,\\n materialSection: \\\"Transmission\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"ior\\\",\\n type: \\\"number\\\",\\n label: \\\"Index of refraction\\\",\\n default: 1.675,\\n min: 1,\\n max: 2,\\n step: 0.005,\\n materialSection: \\\"Transmission\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"thicknessScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Thickness scale\\\",\\n default: 2.04,\\n min: 0.1,\\n max: 3,\\n step: 0.01,\\n materialSection: \\\"Transmission\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialAbsorption\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Absorption / tint\\\",\\n default: true,\\n materialSection: \\\"Absorption / tint\\\",\\n materialScope: \\\"object\\\",\\n materialToggle: true,\\n materialRequires: [\\\"materialTransmission\\\"],\\n description: \\\"Switch off to remove this feature without losing its settings.\\\",\\n },\\n {\\n id: \\\"attenuationColor\\\",\\n type: \\\"color\\\",\\n label: \\\"Attenuation colour (white = no absorption, clear glass)\\\",\\n default: \\\"#d5f4ff\\\",\\n materialSection: \\\"Absorption / tint\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"attenuationDistance\\\",\\n type: \\\"number\\\",\\n label: \\\"Attenuation distance\\\",\\n default: 6.54,\\n min: 0.05,\\n max: 12,\\n step: 0.01,\\n materialSection: \\\"Absorption / tint\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialDispersion\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Dispersion\\\",\\n default: false,\\n materialSection: \\\"Dispersion\\\",\\n materialScope: \\\"object\\\",\\n materialToggle: true,\\n materialRequires: [\\\"materialTransmission\\\"],\\n description: \\\"Switch off to remove this feature without losing its settings.\\\",\\n },\\n {\\n id: \\\"dispersion\\\",\\n type: \\\"number\\\",\\n label: \\\"Dispersion (0 = off; on/off reloads)\\\",\\n default: 0.12,\\n min: 0,\\n max: 0.3,\\n step: 0.005,\\n materialSection: \\\"Dispersion\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialReflections\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Reflections\\\",\\n default: true,\\n materialSection: \\\"Reflections\\\",\\n materialScope: \\\"object\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description: \\\"Switch off to remove this feature without losing its settings.\\\",\\n },\\n {\\n id: \\\"envIntensity\\\",\\n type: \\\"number\\\",\\n label: \\\"Environment intensity\\\",\\n default: 2.04,\\n min: 0,\\n max: 3,\\n step: 0.01,\\n materialSection: \\\"Reflections\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"specularIntensity\\\",\\n type: \\\"number\\\",\\n label: \\\"Specular intensity\\\",\\n default: 1.44,\\n min: 0,\\n max: 2,\\n step: 0.01,\\n materialSection: \\\"Reflections\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialFrost\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Frost\\\",\\n default: true,\\n materialSection: \\\"Frost\\\",\\n materialScope: \\\"object\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description: \\\"Switch off to remove this feature without losing its settings.\\\",\\n },\\n {\\n id: \\\"materialInteriorFrost\\\",\\n type: \\\"number\\\",\\n label: \\\"Uniform frost\\\",\\n default: 0,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Frost\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"frostScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Scale\\\",\\n default: 0.7,\\n min: 0.2,\\n max: 6,\\n step: 0.05,\\n materialSection: \\\"Frost\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"frostThreshold\\\",\\n type: \\\"number\\\",\\n label: \\\"Threshold (1 = no frost, clear glass)\\\",\\n default: 0.62,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Frost\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"frostSoftness\\\",\\n type: \\\"number\\\",\\n label: \\\"Softness\\\",\\n default: 0.24,\\n min: 0.01,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Frost\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"frostRoughness\\\",\\n type: \\\"number\\\",\\n label: \\\"Roughness\\\",\\n default: 0.73,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Frost\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"frostDiffuse\\\",\\n type: \\\"number\\\",\\n label: \\\"Diffuse (how much light frosted areas catch)\\\",\\n default: 0.11,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Frost\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialSurfaceBumps\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Object surface bumps / crack notches\\\",\\n default: false,\\n materialSection: \\\"Surface bumps\\\",\\n materialScope: \\\"object\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description:\\n \\\"Disable crystal, grain, micro, ripple and crack normal perturbations and crack notches on the solid. Preserves their settings and the shard finish.\\\",\\n },\\n {\\n id: \\\"materialCrystals\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Crystal bumps\\\",\\n default: true,\\n materialSection: \\\"Crystal bumps\\\",\\n materialScope: \\\"object\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description: \\\"Switch off to remove this feature without losing its settings.\\\",\\n },\\n {\\n id: \\\"crystalBump\\\",\\n type: \\\"number\\\",\\n label: \\\"Crystal bump\\\",\\n default: 0.01,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Crystal bumps\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"crystalScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Crystal scale\\\",\\n default: 4,\\n min: 4,\\n max: 80,\\n step: 1,\\n materialSection: \\\"Crystal bumps\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialGrain\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Grain bumps\\\",\\n default: true,\\n materialSection: \\\"Grain bumps\\\",\\n materialScope: \\\"object\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description: \\\"Switch off to remove this feature without losing its settings.\\\",\\n },\\n {\\n id: \\\"materialGrainAmount\\\",\\n type: \\\"number\\\",\\n label: \\\"Grain strength\\\",\\n default: 0.47,\\n min: 0,\\n max: 2,\\n step: 0.01,\\n materialSection: \\\"Grain bumps\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialGrainScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Grain scale\\\",\\n default: 150,\\n min: 1,\\n max: 150,\\n step: 1,\\n materialSection: \\\"Grain bumps\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialCutNormals\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Fracture normals\\\",\\n default: true,\\n materialSection: \\\"Fracture normals\\\",\\n materialScope: \\\"object\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description: \\\"Switch off to remove this feature without losing its settings.\\\",\\n },\\n {\\n id: \\\"materialMicro\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Micro bumps\\\",\\n default: true,\\n materialSection: \\\"Micro bumps\\\",\\n materialScope: \\\"object\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description: \\\"Switch off to remove this feature without losing its settings.\\\",\\n },\\n {\\n id: \\\"microBump\\\",\\n type: \\\"number\\\",\\n label: \\\"Micro bump\\\",\\n default: 0.445,\\n min: 0,\\n max: 1,\\n step: 0.005,\\n materialSection: \\\"Micro bumps\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"microScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Micro scale\\\",\\n default: 10,\\n min: 10,\\n max: 200,\\n step: 1,\\n materialSection: \\\"Micro bumps\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"microCoverage\\\",\\n type: \\\"number\\\",\\n label: \\\"Micro coverage\\\",\\n default: 0.25,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Micro bumps\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"bumpMaskScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Mask scale\\\",\\n default: 1.45,\\n min: 0.1,\\n max: 6,\\n step: 0.05,\\n materialSection: \\\"Micro bumps\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialRipples\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Ripples\\\",\\n default: true,\\n materialSection: \\\"Ripples\\\",\\n materialScope: \\\"object\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description: \\\"Switch off to remove this feature without losing its settings.\\\",\\n },\\n {\\n id: \\\"rippleBump\\\",\\n type: \\\"number\\\",\\n label: \\\"Ripple bump\\\",\\n default: 0.22,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Ripples\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"rippleScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Ripple scale\\\",\\n default: 23,\\n min: 2,\\n max: 30,\\n step: 0.5,\\n materialSection: \\\"Ripples\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialSmudges\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Smudges\\\",\\n default: true,\\n materialSection: \\\"Smudges\\\",\\n materialScope: \\\"object\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description: \\\"Switch off to remove this feature without losing its settings.\\\",\\n },\\n {\\n id: \\\"smudgeAmount\\\",\\n type: \\\"number\\\",\\n label: \\\"Amount\\\",\\n default: 0.78,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Smudges\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"smudgeCoverage\\\",\\n type: \\\"number\\\",\\n label: \\\"Coverage\\\",\\n default: 0.58,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Smudges\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"smudgeMaskScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Mask scale\\\",\\n default: 1.85,\\n min: 0.1,\\n max: 6,\\n step: 0.05,\\n materialSection: \\\"Smudges\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"smudgeAnisotropy\\\",\\n type: \\\"number\\\",\\n label: \\\"Anisotropy\\\",\\n default: 16.5,\\n min: 1,\\n max: 20,\\n step: 0.5,\\n materialSection: \\\"Smudges\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"smudgeRoughness\\\",\\n type: \\\"number\\\",\\n label: \\\"Roughness\\\",\\n default: 0.75,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Smudges\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"smudgeWhiteness\\\",\\n type: \\\"number\\\",\\n label: \\\"Whiteness\\\",\\n default: 0.035,\\n min: 0,\\n max: 0.5,\\n step: 0.005,\\n materialSection: \\\"Smudges\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"smudgeScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Scale\\\",\\n default: 1.3,\\n min: 0.5,\\n max: 10,\\n step: 0.1,\\n materialSection: \\\"Smudges\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialCracks\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Cracks\\\",\\n default: true,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description: \\\"Switch off to remove this feature without losing its settings.\\\",\\n },\\n {\\n id: \\\"crackLargeScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Large scale\\\",\\n default: 2.45,\\n min: 0.3,\\n max: 8,\\n step: 0.05,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"crackWarp\\\",\\n type: \\\"number\\\",\\n label: \\\"Warp\\\",\\n default: 0.22,\\n min: 0,\\n max: 1.5,\\n step: 0.01,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"crackCoverage\\\",\\n type: \\\"number\\\",\\n label: \\\"Coverage\\\",\\n default: 0.19,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"crackRegionScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Region scale\\\",\\n default: 1.8,\\n min: 0.1,\\n max: 4,\\n step: 0.05,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"crackRegionCoverage\\\",\\n type: \\\"number\\\",\\n label: \\\"Region coverage\\\",\\n default: 0.6,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"veinScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Vein scale\\\",\\n default: 8,\\n min: 1,\\n max: 20,\\n step: 0.25,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"veinContrast\\\",\\n type: \\\"number\\\",\\n label: \\\"Vein contrast\\\",\\n default: 0.55,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"crackWidth\\\",\\n type: \\\"number\\\",\\n label: \\\"Width\\\",\\n default: 0.0025,\\n min: 0.0005,\\n max: 0.02,\\n step: 0.0005,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"crackBrightness\\\",\\n type: \\\"number\\\",\\n label: \\\"Brightness\\\",\\n default: 0.65,\\n min: 0,\\n max: 3,\\n step: 0.01,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"crackDarkness\\\",\\n type: \\\"number\\\",\\n label: \\\"Darkness\\\",\\n default: 0.69,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"crackRefraction\\\",\\n type: \\\"number\\\",\\n label: \\\"Refraction\\\",\\n default: 0.076,\\n min: 0,\\n max: 0.1,\\n step: 0.001,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"crackSurfaceStrength\\\",\\n type: \\\"number\\\",\\n label: \\\"Surface strength\\\",\\n default: 0.16,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"fineScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Fine scale\\\",\\n default: 18.4,\\n min: 2,\\n max: 20,\\n step: 0.1,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"fineAmount\\\",\\n type: \\\"number\\\",\\n label: \\\"Fine amount\\\",\\n default: 0.52,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"fineCoverage\\\",\\n type: \\\"number\\\",\\n label: \\\"Fine coverage\\\",\\n default: 1,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Cracks\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialScatter\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Internal scattering\\\",\\n default: true,\\n materialSection: \\\"Internal scattering\\\",\\n materialScope: \\\"object\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description: \\\"Switch off to remove this feature without losing its settings.\\\",\\n },\\n {\\n id: \\\"materialInclusionScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Inclusion scale\\\",\\n default: 0.05,\\n min: 0.05,\\n max: 3,\\n step: 0.01,\\n materialSection: \\\"Internal scattering\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialInclusionAmount\\\",\\n type: \\\"number\\\",\\n label: \\\"Photographic inclusions\\\",\\n default: 2,\\n min: 0,\\n max: 2,\\n step: 0.01,\\n materialSection: \\\"Internal scattering\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"interiorScatter\\\",\\n type: \\\"number\\\",\\n label: \\\"Interior scatter\\\",\\n default: 0.09,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Internal scattering\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialClearcoat\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Clearcoat\\\",\\n default: true,\\n materialSection: \\\"Clearcoat\\\",\\n materialScope: \\\"object\\\",\\n materialToggle: true,\\n materialRequires: [\\\"materialReflections\\\"],\\n description: \\\"Switch off to remove this feature without losing its settings.\\\",\\n },\\n {\\n id: \\\"clearcoat\\\",\\n type: \\\"number\\\",\\n label: \\\"Clearcoat\\\",\\n default: 0,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Clearcoat\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"clearcoatRoughness\\\",\\n type: \\\"number\\\",\\n label: \\\"Clearcoat roughness\\\",\\n default: 0,\\n min: 0,\\n max: 1,\\n step: 0.005,\\n materialSection: \\\"Clearcoat\\\",\\n materialScope: \\\"object\\\",\\n },\\n {\\n id: \\\"materialShardNormals\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Shard normals\\\",\\n default: true,\\n materialSection: \\\"Shard normals\\\",\\n materialScope: \\\"shards\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description: \\\"Switch off to remove this feature without losing its settings.\\\",\\n },\\n {\\n id: \\\"spriteNormal\\\",\\n type: \\\"number\\\",\\n label: \\\"Sprite normal strength\\\",\\n default: 0.15,\\n min: 0,\\n max: 2.5,\\n step: 0.05,\\n materialSection: \\\"Shard normals\\\",\\n materialScope: \\\"shards\\\",\\n },\\n {\\n id: \\\"materialShardFrost\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Shard frost\\\",\\n default: true,\\n materialSection: \\\"Shard frost\\\",\\n materialScope: \\\"shards\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description:\\n \\\"Uses the shared material settings from Logo & text. This switch enables them on shards.\\\",\\n },\\n {\\n id: \\\"materialShardTransmission\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Shard transparency\\\",\\n default: true,\\n materialSection: \\\"Shard transparency\\\",\\n materialScope: \\\"shards\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description:\\n \\\"Uses the shared material settings from Logo & text. This switch enables them on shards.\\\",\\n },\\n {\\n id: \\\"spriteSeeThrough\\\",\\n type: \\\"number\\\",\\n label: \\\"See-through (0 = off; on/off reloads)\\\",\\n default: 1,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n materialSection: \\\"Shard transparency\\\",\\n materialScope: \\\"shards\\\",\\n },\\n {\\n id: \\\"materialShardReflections\\\",\\n type: \\\"boolean\\\",\\n label: \\\"Shard reflections\\\",\\n default: true,\\n materialSection: \\\"Shard reflections\\\",\\n materialScope: \\\"shards\\\",\\n materialToggle: true,\\n materialRequires: [],\\n description:\\n \\\"Uses the shared material settings from Logo & text. This switch enables them on shards.\\\",\\n },\\n {\\n id: \\\"minPixelSize\\\",\\n type: \\\"number\\\",\\n label: \\\"Minimum pixel size\\\",\\n default: 0.25,\\n min: 0,\\n max: 4,\\n step: 0.05,\\n materialSection: \\\"Shard shape\\\",\\n materialScope: \\\"shards\\\",\\n },\\n {\\n id: \\\"grainSizeMultiplier\\\",\\n type: \\\"number\\\",\\n label: \\\"Grain size multiplier\\\",\\n default: 1.05,\\n min: 0.2,\\n max: 4,\\n step: 0.05,\\n materialSection: \\\"Shard shape\\\",\\n materialScope: \\\"shards\\\",\\n },\\n {\\n id: \\\"spriteSize\\\",\\n type: \\\"number\\\",\\n label: \\\"Sprite size\\\",\\n default: 1.9,\\n min: 0.3,\\n max: 4,\\n step: 0.05,\\n materialSection: \\\"Shard shape\\\",\\n materialScope: \\\"shards\\\",\\n },\\n {\\n id: \\\"spriteTilt\\\",\\n type: \\\"number\\\",\\n label: \\\"Sprite tilt\\\",\\n default: 12,\\n min: 0,\\n max: 70,\\n step: 1,\\n unit: \\\"deg\\\",\\n materialSection: \\\"Shard shape\\\",\\n materialScope: \\\"shards\\\",\\n },\\n {\\n id: \\\"spriteAlphaCut\\\",\\n type: \\\"number\\\",\\n label: \\\"Alpha cut\\\",\\n default: 0.6,\\n min: 0.05,\\n max: 0.6,\\n step: 0.01,\\n materialSection: \\\"Shard shape\\\",\\n materialScope: \\\"shards\\\",\\n },\\n {\\n id: \\\"headline1\\\",\\n type: \\\"string\\\",\\n label: \\\"Copy - Headline 1 (| = line break)\\\",\\n default: \\\"Hard to|break.\\\",\\n maxLength: 60,\\n },\\n {\\n id: \\\"headline2\\\",\\n type: \\\"string\\\",\\n label: \\\"Copy - Headline 2 (| = line break)\\\",\\n default: \\\"Easy to|remember.\\\",\\n maxLength: 60,\\n },\\n {\\n id: \\\"textWidth\\\",\\n type: \\\"number\\\",\\n label: \\\"Type - Headline block width (the mark is 2.6 wide)\\\",\\n default: 6.5,\\n min: 1.2,\\n max: 9,\\n step: 0.05,\\n },\\n {\\n id: \\\"fontWeight\\\",\\n type: \\\"enum\\\",\\n label: \\\"Type - Weight (Geist)\\\",\\n default: \\\"600\\\",\\n options: [\\n { value: \\\"400\\\", label: \\\"Regular 400\\\" },\\n { value: \\\"600\\\", label: \\\"SemiBold 600\\\" },\\n { value: \\\"700\\\", label: \\\"Bold 700\\\" },\\n ],\\n },\\n {\\n id: \\\"letterSpacing\\\",\\n type: \\\"number\\\",\\n label: \\\"Type - Letter spacing\\\",\\n default: 0.01,\\n min: -0.1,\\n max: 0.4,\\n step: 0.005,\\n unit: \\\"em\\\",\\n },\\n {\\n id: \\\"textLineHeight\\\",\\n type: \\\"number\\\",\\n label: \\\"Type - Line height\\\",\\n default: 0.95,\\n min: 0.7,\\n max: 1.4,\\n step: 0.01,\\n unit: \\\"em\\\",\\n },\\n {\\n id: \\\"textDepth\\\",\\n type: \\\"number\\\",\\n label: \\\"Type - Extrusion depth (fraction of the font size)\\\",\\n default: 0.16,\\n min: 0.05,\\n max: 0.8,\\n step: 0.01,\\n },\\n {\\n id: \\\"textBevel\\\",\\n type: \\\"number\\\",\\n label: \\\"Type - Bevel (fraction of the font size)\\\",\\n default: 0.04,\\n min: 0,\\n max: 0.12,\\n step: 0.005,\\n },\\n {\\n id: \\\"textCorner\\\",\\n type: \\\"number\\\",\\n label: \\\"Type - Corner rounding (fraction of the font size)\\\",\\n default: 0.008,\\n min: 0,\\n max: 0.06,\\n step: 0.002,\\n },\\n {\\n id: \\\"textMeshDetail\\\",\\n type: \\\"number\\\",\\n label: \\\"Type - Text mesh detail (1-4; higher = smoother deformation)\\\",\\n default: 4,\\n min: 1,\\n max: 4,\\n step: 1,\\n },\\n {\\n id: \\\"logoBreakAt\\\",\\n type: \\\"number\\\",\\n label: \\\"Timing - Mark breaks\\\",\\n default: 1.5,\\n min: 0.3,\\n max: 4,\\n step: 0.1,\\n unit: \\\"s\\\",\\n },\\n {\\n id: \\\"formHeadline1At\\\",\\n type: \\\"number\\\",\\n label: \\\"Timing - Shards form headline 1\\\",\\n default: 3.8,\\n min: 2,\\n max: 10,\\n step: 0.1,\\n unit: \\\"s\\\",\\n },\\n {\\n id: \\\"headline1BreakAt\\\",\\n type: \\\"number\\\",\\n label: \\\"Timing - Headline 1 breaks\\\",\\n default: 10.375,\\n min: 6,\\n max: 18,\\n step: 0.025,\\n unit: \\\"s\\\",\\n },\\n {\\n id: \\\"formHeadline2At\\\",\\n type: \\\"number\\\",\\n label: \\\"Timing - Shards form headline 2\\\",\\n default: 12.675,\\n min: 9,\\n max: 22,\\n step: 0.025,\\n unit: \\\"s\\\",\\n },\\n {\\n id: \\\"headline2BreakAt\\\",\\n type: \\\"number\\\",\\n label: \\\"Timing - Headline 2 breaks\\\",\\n default: 18.5,\\n min: 15,\\n max: 27,\\n step: 0.025,\\n unit: \\\"s\\\",\\n },\\n {\\n id: \\\"fadeOutAt\\\",\\n type: \\\"number\\\",\\n label: \\\"Timing - Shards fade to empty\\\",\\n default: 22,\\n min: 17,\\n max: 29.5,\\n step: 0.025,\\n unit: \\\"s\\\",\\n },\\n {\\n id: \\\"turnYaw\\\",\\n type: \\\"number\\\",\\n label: \\\"Motion - Mark turn (yaw)\\\",\\n default: 180,\\n min: -360,\\n max: 360,\\n step: 5,\\n unit: \\\"deg\\\",\\n },\\n {\\n id: \\\"turnPitch\\\",\\n type: \\\"number\\\",\\n label: \\\"Motion - Mark tilt toward the camera (pitch)\\\",\\n default: -41,\\n min: -90,\\n max: 90,\\n step: 1,\\n unit: \\\"deg\\\",\\n },\\n {\\n id: \\\"approach\\\",\\n type: \\\"number\\\",\\n label: \\\"Motion - How close the mark comes\\\",\\n default: 7,\\n min: 0,\\n max: 7,\\n step: 0.1,\\n },\\n {\\n id: \\\"turnYaw2\\\",\\n type: \\\"number\\\",\\n label: \\\"Motion - Headline 1 turn (yaw; same sign as the mark turn keeps one direction)\\\",\\n default: 160,\\n min: -360,\\n max: 360,\\n step: 5,\\n unit: \\\"deg\\\",\\n },\\n {\\n id: \\\"turnPitch2\\\",\\n type: \\\"number\\\",\\n label: \\\"Motion - Headline 1 tilt (pitch)\\\",\\n default: 35,\\n min: -90,\\n max: 90,\\n step: 1,\\n unit: \\\"deg\\\",\\n },\\n {\\n id: \\\"retreat\\\",\\n type: \\\"number\\\",\\n label: \\\"Motion - How far headline 1 backs off\\\",\\n default: 3.5,\\n min: 0,\\n max: 8,\\n step: 0.1,\\n },\\n {\\n id: \\\"zoomIn\\\",\\n type: \\\"number\\\",\\n label: \\\"Motion - Extra approach for the last break (shards fly past the camera)\\\",\\n default: 5,\\n min: 0,\\n max: 8,\\n step: 0.1,\\n },\\n {\\n id: \\\"finalYaw\\\",\\n type: \\\"number\\\",\\n label: \\\"Motion - Last break turn (yaw)\\\",\\n default: 40,\\n min: -180,\\n max: 180,\\n step: 5,\\n unit: \\\"deg\\\",\\n },\\n {\\n id: \\\"finalPitch\\\",\\n type: \\\"number\\\",\\n label: \\\"Motion - Last break tilt (pitch)\\\",\\n default: -20,\\n min: -90,\\n max: 90,\\n step: 1,\\n unit: \\\"deg\\\",\\n },\\n {\\n id: \\\"driftYaw\\\",\\n type: \\\"number\\\",\\n label: \\\"Motion - Constant slow turn (never stands still)\\\",\\n default: 2,\\n min: -30,\\n max: 30,\\n step: 0.5,\\n unit: \\\"deg/s\\\",\\n },\\n {\\n id: \\\"driftSway\\\",\\n type: \\\"number\\\",\\n label: \\\"Motion - Slow tilt sway and depth bob amplitude\\\",\\n default: 4,\\n min: 0,\\n max: 20,\\n step: 0.5,\\n unit: \\\"deg\\\",\\n },\\n {\\n id: \\\"idleYaw\\\",\\n type: \\\"number\\\",\\n label: \\\"Motion - Idle turn back and forth while a headline holds (amplitude)\\\",\\n default: 6,\\n min: 0,\\n max: 40,\\n step: 0.5,\\n unit: \\\"deg\\\",\\n },\\n {\\n id: \\\"shardAmount\\\",\\n type: \\\"number\\\",\\n label: \\\"Shards - Visible fraction of the broken volume (Powder amount)\\\",\\n default: 0.44,\\n min: 0.02,\\n max: 1,\\n step: 0.01,\\n },\\n {\\n id: \\\"strayDust\\\",\\n type: \\\"number\\\",\\n label: \\\"Shards - Ambient dust motes around the object (the experiment had 40)\\\",\\n default: 24,\\n min: 0,\\n max: 200,\\n step: 1,\\n },\\n {\\n id: \\\"sliceRadius\\\",\\n type: \\\"number\\\",\\n label: \\\"Break - First (diagonal) slice radius\\\",\\n default: 0.6,\\n min: 0.05,\\n max: 1.5,\\n step: 0.01,\\n },\\n {\\n id: \\\"sliceStrength\\\",\\n type: \\\"number\\\",\\n label: \\\"Break - First slice strength\\\",\\n default: 21.5,\\n min: 1,\\n max: 40,\\n step: 0.5,\\n },\\n {\\n id: \\\"breakDuration\\\",\\n type: \\\"number\\\",\\n label: \\\"Break - Time for the follow-up slices to cross the shape\\\",\\n default: 2,\\n min: 0.4,\\n max: 4,\\n step: 0.1,\\n unit: \\\"s\\\",\\n },\\n {\\n id: \\\"finalEjectBoost\\\",\\n type: \\\"number\\\",\\n label: \\\"Break - Last break: eject speed and speed cap multiplier\\\",\\n default: 2.5,\\n min: 1,\\n max: 6,\\n step: 0.1,\\n },\\n {\\n id: \\\"shatterRadius\\\",\\n type: \\\"number\\\",\\n label: \\\"Break - Follow-up slice radius (sets their spacing too)\\\",\\n default: 0.45,\\n min: 0.1,\\n max: 1.5,\\n step: 0.01,\\n },\\n {\\n id: \\\"shatterStrength\\\",\\n type: \\\"number\\\",\\n label: \\\"Break - Follow-up slice strength\\\",\\n default: 32.5,\\n min: 1,\\n max: 40,\\n step: 0.5,\\n },\\n {\\n id: \\\"cutThreshold\\\",\\n type: \\\"number\\\",\\n label: \\\"Tune break - Cut threshold (surface gone above this erosion)\\\",\\n default: 0.3,\\n min: 0.3,\\n max: 0.98,\\n step: 0.01,\\n },\\n {\\n id: \\\"cutSoftness\\\",\\n type: \\\"number\\\",\\n label: \\\"Tune break - Cut softness\\\",\\n default: 0.19,\\n min: 0.005,\\n max: 0.3,\\n step: 0.005,\\n },\\n {\\n id: \\\"edgeWidth\\\",\\n type: \\\"number\\\",\\n label: \\\"Tune break - Crumbly edge band width\\\",\\n default: 0.19,\\n min: 0.05,\\n max: 0.8,\\n step: 0.01,\\n },\\n {\\n id: \\\"edgeInset\\\",\\n type: \\\"number\\\",\\n label: \\\"Tune break - Edge inset\\\",\\n default: 0,\\n min: 0,\\n max: 0.3,\\n step: 0.005,\\n },\\n {\\n id: \\\"brushSoftness\\\",\\n type: \\\"number\\\",\\n label: \\\"Tune break - Brush softness (edge falloff of a slice)\\\",\\n default: 0.15,\\n min: 0.02,\\n max: 1,\\n step: 0.01,\\n },\\n {\\n id: \\\"brushNoise\\\",\\n type: \\\"number\\\",\\n label: \\\"Tune break - Brush noise (ragged boundary)\\\",\\n default: 0.4,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n },\\n {\\n id: \\\"crumbleRate\\\",\\n type: \\\"number\\\",\\n label: \\\"Tune break - Crumble rate along cracks (high = the whole shape goes at once)\\\",\\n default: 4.3,\\n min: 0,\\n max: 6,\\n step: 0.05,\\n },\\n {\\n id: \\\"crumbleCrackBias\\\",\\n type: \\\"number\\\",\\n label: \\\"Tune break - Crumble crack bias\\\",\\n default: 5.1,\\n min: 0,\\n max: 6,\\n step: 0.05,\\n },\\n {\\n id: \\\"crumbleDuration\\\",\\n type: \\\"number\\\",\\n label: \\\"Tune break - Crumble duration after a stroke\\\",\\n default: 0.35,\\n min: 0,\\n max: 2,\\n step: 0.01,\\n },\\n {\\n id: \\\"ejectSpeed\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Eject speed\\\",\\n default: 0.91,\\n min: 0,\\n max: 4,\\n step: 0.01,\\n },\\n {\\n id: \\\"ejectSpread\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Eject spread along the normal\\\",\\n default: 0.48,\\n min: 0,\\n max: 3,\\n step: 0.01,\\n },\\n {\\n id: \\\"ejectTurbulence\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Eject turbulence\\\",\\n default: 4,\\n min: 0,\\n max: 4,\\n step: 0.01,\\n },\\n {\\n id: \\\"drag\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Drag (speed decays by this per second)\\\",\\n default: 0,\\n min: 0,\\n max: 8,\\n step: 0.01,\\n },\\n {\\n id: \\\"gravity\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Gravity (0 = shards never fall)\\\",\\n default: 0,\\n min: 0,\\n max: 2,\\n step: 0.005,\\n },\\n {\\n id: \\\"turbulence\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Turbulence strength (curl noise)\\\",\\n default: 4,\\n min: 0,\\n max: 4,\\n step: 0.01,\\n },\\n {\\n id: \\\"turbulenceScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Turbulence scale\\\",\\n default: 2.65,\\n min: 0.2,\\n max: 8,\\n step: 0.05,\\n },\\n {\\n id: \\\"turbulenceDecay\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Turbulence decay with age (low = keeps swirling)\\\",\\n default: 3.65,\\n min: 0.05,\\n max: 4,\\n step: 0.01,\\n },\\n {\\n id: \\\"clumpCohesion\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Clump cohesion (shards orbit a leader; 0 = none)\\\",\\n default: 0.9,\\n min: 0,\\n max: 10,\\n step: 0.05,\\n },\\n {\\n id: \\\"followObject\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Shards follow the object motion for (s; 30 = whole flight)\\\",\\n default: 30,\\n min: 0,\\n max: 30,\\n step: 0.5,\\n unit: \\\"s\\\",\\n },\\n {\\n id: \\\"settleTime\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Settle time (velocity is killed after this; 12 = never)\\\",\\n default: 2.2,\\n min: 0.3,\\n max: 12,\\n step: 0.05,\\n },\\n {\\n id: \\\"settledDrift\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Organic drift once settled (curl noise)\\\",\\n default: 1,\\n min: 0,\\n max: 1,\\n step: 0.005,\\n },\\n {\\n id: \\\"maxSpeed\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Speed cap\\\",\\n default: 26.3,\\n min: 1,\\n max: 40,\\n step: 0.1,\\n },\\n {\\n id: \\\"repelStrength\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Push out of the solid shape while it breaks\\\",\\n default: 30,\\n min: 0,\\n max: 30,\\n step: 0.1,\\n },\\n {\\n id: \\\"repelRange\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Push range outside the surface\\\",\\n default: 0.97,\\n min: 0.02,\\n max: 2,\\n step: 0.01,\\n },\\n {\\n id: \\\"repelRadial\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Push away from the shape centre (clears pockets and the hole)\\\",\\n default: 17.5,\\n min: 0,\\n max: 60,\\n step: 0.5,\\n },\\n {\\n id: \\\"repelRadialRange\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Radial push range (object radii)\\\",\\n default: 3.3,\\n min: 1,\\n max: 4,\\n step: 0.05,\\n },\\n {\\n id: \\\"tumble\\\",\\n type: \\\"number\\\",\\n label: \\\"Flight - Tumble rate\\\",\\n default: 1.05,\\n min: 0,\\n max: 12,\\n step: 0.05,\\n },\\n {\\n id: \\\"returnGroupStagger\\\",\\n type: \\\"number\\\",\\n label: \\\"Assembly - Regional delay (seconds)\\\",\\n default: 1.35,\\n min: 0,\\n max: 1.5,\\n step: 0.05,\\n unit: \\\"s\\\",\\n },\\n {\\n id: \\\"returnGroupScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Assembly - Region / noise size\\\",\\n default: 2.55,\\n min: 0.1,\\n max: 3,\\n step: 0.05,\\n description:\\n \\\"Larger values form broader connected patches. Noise is evaluated only on retarget.\\\",\\n },\\n {\\n id: \\\"returnGroupSeed\\\",\\n type: \\\"number\\\",\\n label: \\\"Return - Group timing seed\\\",\\n default: 60765,\\n min: 0,\\n max: 65535,\\n step: 1,\\n },\\n {\\n id: \\\"formSpread\\\",\\n type: \\\"number\\\",\\n label: \\\"Return - Wave spread (nearest shards leave first, seconds)\\\",\\n default: 0,\\n min: 0,\\n max: 4,\\n step: 0.05,\\n unit: \\\"s\\\",\\n },\\n {\\n id: \\\"waveReach\\\",\\n type: \\\"number\\\",\\n label: \\\"Return - Distance over which the wave spreads\\\",\\n default: 10,\\n min: 0.2,\\n max: 10,\\n step: 0.1,\\n },\\n {\\n id: \\\"formJitter\\\",\\n type: \\\"number\\\",\\n label: \\\"Return - Per-shard stagger (random delay up to this)\\\",\\n default: 2.8,\\n min: 0,\\n max: 3,\\n step: 0.05,\\n unit: \\\"s\\\",\\n },\\n {\\n id: \\\"formFill\\\",\\n type: \\\"number\\\",\\n label: \\\"Return - Fill-in rate for voxels no shard returns to\\\",\\n default: 3,\\n min: 0.05,\\n max: 3,\\n step: 0.05,\\n },\\n {\\n id: \\\"returnSpring\\\",\\n type: \\\"number\\\",\\n label: \\\"Return - Spring stiffness\\\",\\n default: 29.9,\\n min: 0.5,\\n max: 40,\\n step: 0.1,\\n },\\n {\\n id: \\\"returnDamping\\\",\\n type: \\\"number\\\",\\n label: \\\"Return - Spring damping\\\",\\n default: 1.34,\\n min: 0.2,\\n max: 2,\\n step: 0.01,\\n },\\n {\\n id: \\\"returnRamp\\\",\\n type: \\\"number\\\",\\n label: \\\"Return - Spring ramp-in (seconds until it pulls at full strength)\\\",\\n default: 0.45,\\n min: 0,\\n max: 3,\\n step: 0.05,\\n },\\n {\\n id: \\\"returnMaxSpeed\\\",\\n type: \\\"number\\\",\\n label: \\\"Return - Speed cap on the way home\\\",\\n default: 60,\\n min: 1,\\n max: 60,\\n step: 0.5,\\n },\\n {\\n id: \\\"alignToSurface\\\",\\n type: \\\"number\\\",\\n label: \\\"Return - Shards turn to lie on the surface (0 = keep tumbling)\\\",\\n default: 1,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n },\\n {\\n id: \\\"alignCurve\\\",\\n type: \\\"number\\\",\\n label: \\\"Return - Alignment curve over the flight home (1 linear, higher = later)\\\",\\n default: 3.75,\\n min: 0.2,\\n max: 4,\\n step: 0.05,\\n },\\n {\\n id: \\\"healRate\\\",\\n type: \\\"number\\\",\\n label: \\\"Return - Neighbour heal rate\\\",\\n default: 3,\\n min: 0.02,\\n max: 3,\\n step: 0.01,\\n },\\n {\\n id: \\\"cellRestore\\\",\\n type: \\\"number\\\",\\n label: \\\"Return - Cell restore rate\\\",\\n default: 60,\\n min: 0,\\n max: 60,\\n step: 0.5,\\n },\\n {\\n id: \\\"landedFade\\\",\\n type: \\\"number\\\",\\n label: \\\"Return - Landed shard fade\\\",\\n default: 1.65,\\n min: 0,\\n max: 2,\\n step: 0.01,\\n },\\n {\\n id: \\\"refrostTime\\\",\\n type: \\\"number\\\",\\n label: \\\"Return - Refrost time\\\",\\n default: 10.6,\\n min: 0.2,\\n max: 12,\\n step: 0.1,\\n },\\n { id: \\\"keyColor\\\", type: \\\"color\\\", label: \\\"Light - Key colour\\\", default: \\\"#f0f7ff\\\" },\\n {\\n id: \\\"keyIntensity\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Key intensity\\\",\\n default: 5.05,\\n min: 0,\\n max: 12,\\n step: 0.05,\\n },\\n {\\n id: \\\"keyElevation\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Key elevation\\\",\\n default: 42,\\n min: 10,\\n max: 89,\\n step: 0.5,\\n unit: \\\"deg\\\",\\n },\\n {\\n id: \\\"keyAzimuth\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Key azimuth\\\",\\n default: -38,\\n min: -90,\\n max: 90,\\n step: 0.5,\\n unit: \\\"deg\\\",\\n },\\n {\\n id: \\\"keySize\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Key size (softbox)\\\",\\n default: 1.25,\\n min: 0.2,\\n max: 3,\\n step: 0.01,\\n },\\n {\\n id: \\\"fill\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Fill intensity (hemisphere, diffuse only: barely shows on clear ice)\\\",\\n default: 0.18,\\n min: 0,\\n max: 1.5,\\n step: 0.005,\\n },\\n { id: \\\"fillColor\\\", type: \\\"color\\\", label: \\\"Light - Fill sky colour\\\", default: \\\"#cadde9\\\" },\\n {\\n id: \\\"fillGroundColor\\\",\\n type: \\\"color\\\",\\n label: \\\"Light - Fill ground colour\\\",\\n default: \\\"#172635\\\",\\n },\\n {\\n id: \\\"rim\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Rim spot intensity\\\",\\n default: 2.5,\\n min: 0,\\n max: 5,\\n step: 0.01,\\n },\\n { id: \\\"rimColor\\\", type: \\\"color\\\", label: \\\"Light - Rim colour\\\", default: \\\"#d9f1ff\\\" },\\n {\\n id: \\\"rimElevation\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Rim elevation (0 = straight behind)\\\",\\n default: 20,\\n min: 0,\\n max: 89,\\n step: 0.5,\\n unit: \\\"deg\\\",\\n },\\n {\\n id: \\\"swayAmplitude\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Key sway amplitude\\\",\\n default: 0,\\n min: 0,\\n max: 0.15,\\n step: 0.001,\\n },\\n {\\n id: \\\"swayPeriod\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Key sway period\\\",\\n default: 35,\\n min: 2,\\n max: 40,\\n step: 0.5,\\n unit: \\\"s\\\",\\n },\\n {\\n id: \\\"envSoftbox\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Environment softbox (the main light on glass)\\\",\\n default: 1.1,\\n min: 0,\\n max: 3,\\n step: 0.01,\\n },\\n {\\n id: \\\"envRim\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Environment rim strip\\\",\\n default: 1.4,\\n min: 0,\\n max: 3,\\n step: 0.01,\\n },\\n {\\n id: \\\"envFill\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Environment front fill\\\",\\n default: 0.22,\\n min: 0,\\n max: 1,\\n step: 0.005,\\n },\\n { id: \\\"backdropTop\\\", type: \\\"color\\\", label: \\\"Backdrop - Top colour\\\", default: \\\"#050505\\\" },\\n { id: \\\"backdropMid\\\", type: \\\"color\\\", label: \\\"Backdrop - Mid colour\\\", default: \\\"#050505\\\" },\\n {\\n id: \\\"backdropBottom\\\",\\n type: \\\"color\\\",\\n label: \\\"Backdrop - Bottom colour\\\",\\n default: \\\"#050505\\\",\\n },\\n {\\n id: \\\"backdropCenterX\\\",\\n type: \\\"number\\\",\\n label: \\\"Backdrop - Bloom centre X\\\",\\n default: 0.73,\\n min: 0,\\n max: 1,\\n step: 0.005,\\n },\\n {\\n id: \\\"backdropCenterY\\\",\\n type: \\\"number\\\",\\n label: \\\"Backdrop - Bloom centre Y\\\",\\n default: 0.22,\\n min: 0,\\n max: 2,\\n step: 0.005,\\n },\\n {\\n id: \\\"backdropRadius\\\",\\n type: \\\"number\\\",\\n label: \\\"Backdrop - Bloom radius\\\",\\n default: 0.8,\\n min: 0.1,\\n max: 2,\\n step: 0.005,\\n },\\n {\\n id: \\\"backdropFalloff\\\",\\n type: \\\"number\\\",\\n label: \\\"Backdrop - Bloom falloff\\\",\\n default: 0.85,\\n min: 0.5,\\n max: 6,\\n step: 0.01,\\n },\\n {\\n id: \\\"backdropNoise\\\",\\n type: \\\"number\\\",\\n label: \\\"Backdrop - Dither noise\\\",\\n default: 0,\\n min: 0,\\n max: 3,\\n step: 0.05,\\n },\\n {\\n id: \\\"bloomThreshold\\\",\\n type: \\\"number\\\",\\n label: \\\"Post - Bloom threshold\\\",\\n default: 3,\\n min: 0,\\n max: 3,\\n step: 0.01,\\n },\\n {\\n id: \\\"bloomIntensity\\\",\\n type: \\\"number\\\",\\n label: \\\"Post - Bloom intensity\\\",\\n default: 0.04,\\n min: 0,\\n max: 1.5,\\n step: 0.005,\\n },\\n {\\n id: \\\"bloomRadius\\\",\\n type: \\\"number\\\",\\n label: \\\"Post - Bloom radius\\\",\\n default: 1,\\n min: 0,\\n max: 1,\\n step: 0.005,\\n },\\n {\\n id: \\\"monochrome\\\",\\n type: \\\"number\\\",\\n label: \\\"Post - Monochrome\\\",\\n default: 0.04,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n },\\n {\\n id: \\\"tonemap\\\",\\n type: \\\"enum\\\",\\n label: \\\"Post - Tonemap\\\",\\n default: \\\"aces\\\",\\n options: [\\n { value: \\\"agx\\\", label: \\\"AgX\\\" },\\n { value: \\\"aces\\\", label: \\\"ACES\\\" },\\n { value: \\\"neutral\\\", label: \\\"Neutral\\\" },\\n { value: \\\"linear\\\", label: \\\"Linear\\\" },\\n ],\\n },\\n {\\n id: \\\"exposure\\\",\\n type: \\\"number\\\",\\n label: \\\"Post - Exposure\\\",\\n default: 1,\\n min: 0.1,\\n max: 4,\\n step: 0.01,\\n },\\n {\\n id: \\\"contrast\\\",\\n type: \\\"number\\\",\\n label: \\\"Post - Contrast\\\",\\n default: 1.03,\\n min: 0.6,\\n max: 1.6,\\n step: 0.005,\\n },\\n {\\n id: \\\"blackLift\\\",\\n type: \\\"number\\\",\\n label: \\\"Post - Black lift\\\",\\n default: 0,\\n min: 0,\\n max: 0.1,\\n step: 0.001,\\n },\\n {\\n id: \\\"vignetteStrength\\\",\\n type: \\\"number\\\",\\n label: \\\"Post - Vignette strength\\\",\\n default: 0.14,\\n min: 0,\\n max: 1,\\n step: 0.005,\\n },\\n {\\n id: \\\"vignetteSoftness\\\",\\n type: \\\"number\\\",\\n label: \\\"Post - Vignette softness\\\",\\n default: 1.2,\\n min: 0.1,\\n max: 1.5,\\n step: 0.005,\\n },\\n {\\n id: \\\"vignetteRadius\\\",\\n type: \\\"number\\\",\\n label: \\\"Post - Vignette radius\\\",\\n default: 1.2,\\n min: 0.2,\\n max: 1.6,\\n step: 0.005,\\n },\\n {\\n id: \\\"grainStrength\\\",\\n type: \\\"number\\\",\\n label: \\\"Post - Film grain\\\",\\n default: 0,\\n min: 0,\\n max: 0.15,\\n step: 0.001,\\n },\\n {\\n id: \\\"quality\\\",\\n type: \\\"enum\\\",\\n label: \\\"Performance - Quality profile\\\",\\n default: \\\"full\\\",\\n options: [\\n { value: \\\"full\\\", label: \\\"Full (baked look; needs a real GPU)\\\" },\\n { value: \\\"lite\\\", label: \\\"Lite (the source ?lite profile for software WebGPU)\\\" },\\n ],\\n },\\n {\\n id: \\\"upscaler\\\",\\n type: \\\"enum\\\",\\n label: \\\"Performance - Upscaler\\\",\\n default: \\\"fsr1\\\",\\n options: [\\n { value: \\\"fsr1\\\", label: \\\"FSR 1 (TRAA + EASU/RCAS)\\\" },\\n { value: \\\"taau\\\", label: \\\"TAAU\\\" },\\n { value: \\\"bilinear\\\", label: \\\"Bilinear\\\" },\\n { value: \\\"native\\\", label: \\\"Native (no upscale)\\\" },\\n ],\\n },\\n {\\n id: \\\"renderScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Performance - Scene resolution scale (upscaled to 1080p)\\\",\\n default: 1,\\n min: 0.35,\\n max: 1,\\n step: 0.05,\\n },\\n {\\n id: \\\"shapeResolution\\\",\\n type: \\\"enum\\\",\\n label: \\\"Shape voxel resolution\\\",\\n default: \\\"256\\\",\\n options: [\\n { value: \\\"128\\\", label: \\\"128 \\\\u2014 draft\\\" },\\n { value: \\\"256\\\", label: \\\"256 \\\\u2014 high\\\" },\\n { value: \\\"384\\\", label: \\\"384 \\\\u2014 ultra\\\" },\\n ],\\n description:\\n \\\"Resolution of the logo and text distance fields. Rebuilds shapes; higher values increase startup time and memory. Independent of breakup resolution.\\\",\\n },\\n {\\n id: \\\"erosionResolution\\\",\\n type: \\\"enum\\\",\\n label: \\\"Performance - Erosion field resolution (voxels per axis)\\\",\\n default: \\\"96\\\",\\n options: [\\n { value: \\\"64\\\", label: \\\"64\\\" },\\n { value: \\\"96\\\", label: \\\"96\\\" },\\n { value: \\\"128\\\", label: \\\"128\\\" },\\n { value: \\\"192\\\", label: \\\"192 (baked)\\\" },\\n ],\\n },\\n {\\n id: \\\"particleCount\\\",\\n type: \\\"enum\\\",\\n label: \\\"Performance - Powder particles\\\",\\n default: \\\"100k\\\",\\n options: [\\n { value: \\\"100k\\\", label: \\\"100k (baked)\\\" },\\n { value: \\\"250k\\\", label: \\\"250k\\\" },\\n { value: \\\"500k\\\", label: \\\"500k\\\" },\\n { value: \\\"1M\\\", label: \\\"1M\\\" },\\n ],\\n },\\n {\\n id: \\\"logoMeshDetail\\\",\\n type: \\\"number\\\",\\n label: \\\"Shape - Logo mesh detail (1-4; higher = finer surface)\\\",\\n default: 2,\\n min: 1,\\n max: 4,\\n step: 1,\\n },\\n {\\n id: \\\"logoUrl\\\",\\n type: \\\"string\\\",\\n label: \\\"Shape - SVG to extrude as the ice mark\\\",\\n default: \\\"/public/catalog/assets/e590d58631c76a9c.svg\\\",\\n maxLength: 200,\\n },\\n {\\n id: \\\"deformStrength\\\",\\n type: \\\"number\\\",\\n label: \\\"Geometry - Ice deformation strength (0 = original)\\\",\\n default: 0,\\n min: 0,\\n max: 0.08,\\n step: 0.001,\\n },\\n {\\n id: \\\"deformScale\\\",\\n type: \\\"number\\\",\\n label: \\\"Geometry - Noise feature size (larger = broader)\\\",\\n default: 0.41,\\n min: 0.001,\\n max: 0.5,\\n step: 0.001,\\n },\\n {\\n id: \\\"deformSeed\\\",\\n type: \\\"number\\\",\\n label: \\\"Geometry - Deformation seed\\\",\\n default: 7,\\n min: 0,\\n max: 65535,\\n step: 1,\\n },\\n {\\n id: \\\"cameraMode\\\",\\n type: \\\"enum\\\",\\n label: \\\"Camera - Camera source\\\",\\n default: \\\"original\\\",\\n options: [\\n { value: \\\"original\\\", label: \\\"Original approved camera\\\" },\\n { value: \\\"authored\\\", label: \\\"Motion workspace track\\\" },\\n ],\\n },\\n {\\n id: \\\"cameraTrack\\\",\\n type: \\\"string\\\",\\n label: \\\"Camera - Motion track JSON (version 1)\\\",\\n default: \\\"\\\",\\n maxLength: 48000,\\n },\\n {\\n id: \\\"rimAzimuth\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Rim azimuth\\\",\\n default: -146,\\n min: -180,\\n max: 180,\\n step: 1,\\n },\\n {\\n id: \\\"rimAngle\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Rim beam angle\\\",\\n default: 26,\\n min: 10,\\n max: 89,\\n step: 1,\\n },\\n {\\n id: \\\"rimSize\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Rim reflection size\\\",\\n default: 0.45,\\n min: 0.1,\\n max: 3,\\n step: 0.05,\\n },\\n {\\n id: \\\"fillReflectionStrength\\\",\\n type: \\\"number\\\",\\n label: \\\"Light - Fill reflection strength\\\",\\n default: 0.3,\\n min: 0,\\n max: 2,\\n step: 0.01,\\n },\\n {\\n id: \\\"accentCoolIntensity\\\",\\n type: \\\"number\\\",\\n label: \\\"Studio Cool accent - intensity\\\",\\n default: 3.71,\\n min: 0,\\n max: 4,\\n step: 0.01,\\n },\\n {\\n id: \\\"accentCoolReflection\\\",\\n type: \\\"number\\\",\\n label: \\\"Studio Cool accent - reflection\\\",\\n default: 2.31,\\n min: 0,\\n max: 3,\\n step: 0.01,\\n },\\n {\\n id: \\\"accentCoolElevation\\\",\\n type: \\\"number\\\",\\n label: \\\"Studio Cool accent - elevation\\\",\\n default: 63,\\n min: -85,\\n max: 85,\\n step: 1,\\n },\\n {\\n id: \\\"accentCoolAzimuth\\\",\\n type: \\\"number\\\",\\n label: \\\"Studio Cool accent - azimuth\\\",\\n default: 22,\\n min: -180,\\n max: 180,\\n step: 1,\\n },\\n {\\n id: \\\"accentCoolSize\\\",\\n type: \\\"number\\\",\\n label: \\\"Studio Cool accent - size\\\",\\n default: 2.65,\\n min: 0.1,\\n max: 3,\\n step: 0.05,\\n },\\n {\\n id: \\\"accentCoolColor\\\",\\n type: \\\"color\\\",\\n label: \\\"Studio Cool accent - color\\\",\\n default: \\\"#ff5900\\\",\\n },\\n {\\n id: \\\"accentWarmIntensity\\\",\\n type: \\\"number\\\",\\n label: \\\"Studio Warm accent - intensity\\\",\\n default: 2.99,\\n min: 0,\\n max: 4,\\n step: 0.01,\\n },\\n {\\n id: \\\"accentWarmReflection\\\",\\n type: \\\"number\\\",\\n label: \\\"Studio Warm accent - reflection\\\",\\n default: 0.34,\\n min: 0,\\n max: 3,\\n step: 0.01,\\n },\\n {\\n id: \\\"accentWarmElevation\\\",\\n type: \\\"number\\\",\\n label: \\\"Studio Warm accent - elevation\\\",\\n default: 30,\\n min: -85,\\n max: 85,\\n step: 1,\\n },\\n {\\n id: \\\"accentWarmAzimuth\\\",\\n type: \\\"number\\\",\\n label: \\\"Studio Warm accent - azimuth\\\",\\n default: -30,\\n min: -180,\\n max: 180,\\n step: 1,\\n },\\n {\\n id: \\\"accentWarmSize\\\",\\n type: \\\"number\\\",\\n label: \\\"Studio Warm accent - size\\\",\\n default: 1.2,\\n min: 0.1,\\n max: 3,\\n step: 0.05,\\n },\\n {\\n id: \\\"accentWarmColor\\\",\\n type: \\\"color\\\",\\n label: \\\"Studio Warm accent - color\\\",\\n default: \\\"#75aaff\\\",\\n },\\n {\\n id: \\\"returnNoiseAmount\\\",\\n type: \\\"enum\\\",\\n label: \\\"Assembly - Regional pattern\\\",\\n default: \\\"2\\\",\\n options: [\\n { value: \\\"2\\\", label: \\\"Travelling seam + organic spread\\\" },\\n { value: \\\"1\\\", label: \\\"Smooth noise regions\\\" },\\n { value: \\\"0\\\", label: \\\"Original cell groups\\\" },\\n ],\\n },\\n {\\n id: \\\"assemblyFrontDuration\\\",\\n type: \\\"number\\\",\\n label: \\\"Assembly - Growth duration (seconds)\\\",\\n default: 3.2,\\n min: 0,\\n max: 6,\\n step: 0.05,\\n },\\n {\\n id: \\\"assemblyOriginX\\\",\\n type: \\\"number\\\",\\n label: \\\"Assembly - Growth start X\\\",\\n default: -0.65,\\n min: -1,\\n max: 1,\\n step: 0.01,\\n },\\n {\\n id: \\\"assemblyOriginY\\\",\\n type: \\\"number\\\",\\n label: \\\"Assembly - Growth start Y\\\",\\n default: 0.55,\\n min: -1,\\n max: 1,\\n step: 0.01,\\n },\\n {\\n id: \\\"assemblyAngle\\\",\\n type: \\\"number\\\",\\n label: \\\"Assembly - Seam direction (degrees)\\\",\\n default: -35,\\n min: -180,\\n max: 180,\\n step: 1,\\n },\\n {\\n id: \\\"assemblySpread\\\",\\n type: \\\"number\\\",\\n label: \\\"Assembly - Outward spread vs seam travel\\\",\\n default: 0.65,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n },\\n {\\n id: \\\"assemblyFrontNoise\\\",\\n type: \\\"number\\\",\\n label: \\\"Assembly - Growth edge irregularity\\\",\\n default: 0.35,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n },\\n {\\n id: \\\"assemblySpeedVariation\\\",\\n type: \\\"number\\\",\\n label: \\\"Assembly - Return speed variation\\\",\\n default: 0.65,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n },\\n {\\n id: \\\"assemblyBend\\\",\\n type: \\\"number\\\",\\n label: \\\"Assembly - Approach path bend\\\",\\n default: 1.2,\\n min: 0,\\n max: 3,\\n step: 0.05,\\n },\\n {\\n id: \\\"assemblySwirl\\\",\\n type: \\\"number\\\",\\n label: \\\"Assembly - Approach twist\\\",\\n default: 1.1,\\n min: 0,\\n max: 3,\\n step: 0.05,\\n },\\n {\\n id: \\\"assemblyLandingVariation\\\",\\n type: \\\"number\\\",\\n label: \\\"Assembly - Landing transition variation\\\",\\n default: 0.8,\\n min: 0,\\n max: 1,\\n step: 0.01,\\n },\\n {\\n id: \\\"rendererProfile\\\",\\n type: \\\"enum\\\",\\n label: \\\"Renderer experiment (reload required)\\\",\\n default: \\\"studio\\\",\\n options: [\\n { value: \\\"original\\\", label: \\\"Original glass + GPU startup\\\" },\\n { value: \\\"lookup\\\", label: \\\"Original glass + material lookup\\\" },\\n { value: \\\"mesh\\\", label: \\\"Mesh surface + original glass\\\" },\\n { value: \\\"studio\\\", label: \\\"Studio glass approximation\\\" },\\n { value: \\\"matcap\\\", label: \\\"Matcap glass approximation\\\" },\\n ],\\n },\\n ];\\n const rigSchema = JSON.parse(\\n document.getElementById(\\\"frost-root\\\").getAttribute(\\\"data-composition-variables\\\"),\\n );\\n const defaults = Object.fromEntries(\\n [...schema, ...rigSchema].map((v) => [v.id, v.default]),\\n );\\n const values = {\\n ...defaults,\\n ...(window.__hyperframes && window.__hyperframes.getVariables\\n ? window.__hyperframes.getVariables()\\n : {}),\\n };\\n // The default logo ships beside this file; a logo the user sets is their project's path.\\n if (values.logoUrl === defaults.logoUrl && window.__frostAssetBase)\\n values.logoUrl = window.__frostAssetBase + \\\"logo.svg\\\";\\n window.Frost.setRendererProfile(values.rendererProfile);\\n console.info(\\\"[Frost renderer]\\\", JSON.stringify(window.__rewrite));\\n const matcapKeys = [\\n \\\"ior\\\",\\n \\\"thicknessScale\\\",\\n \\\"attenuationColor\\\",\\n \\\"attenuationDistance\\\",\\n \\\"materialBacklight\\\",\\n \\\"keyColor\\\",\\n \\\"keyElevation\\\",\\n \\\"keyAzimuth\\\",\\n \\\"keySize\\\",\\n \\\"envSoftbox\\\",\\n \\\"envRim\\\",\\n \\\"envFill\\\",\\n \\\"rimColor\\\",\\n \\\"rimElevation\\\",\\n \\\"rimAzimuth\\\",\\n \\\"rimSize\\\",\\n \\\"accentCoolColor\\\",\\n \\\"accentCoolReflection\\\",\\n \\\"accentCoolElevation\\\",\\n \\\"accentCoolAzimuth\\\",\\n \\\"accentCoolSize\\\",\\n \\\"accentWarmColor\\\",\\n \\\"accentWarmReflection\\\",\\n \\\"accentWarmElevation\\\",\\n \\\"accentWarmAzimuth\\\",\\n \\\"accentWarmSize\\\",\\n ];\\n const matcapSignature = (v) => JSON.stringify(matcapKeys.map((k) => v[k]));\\n const clamp = (v, a = 0, b = 1) => Math.max(a, Math.min(b, v));\\n // The GPU surface is an implementation detail; only the logo's authored controls belong on the timeline.\\n const surfaceHost = document.getElementById(\\\"frost-root\\\");\\n const surfaceRoot = surfaceHost.shadowRoot || surfaceHost.attachShadow({ mode: \\\"open\\\" });\\n surfaceRoot.replaceChildren();\\n const surfaceStyle = document.createElement(\\\"style\\\");\\n surfaceStyle.textContent =\\n \\\"#frost-stage{position:absolute;inset:0;background:#030303}canvas{position:absolute;inset:0;width:1920px;height:1080px;display:block}#frost-build-status{position:absolute;top:16px;right:16px;z-index:5;color:#eee;font:16px system-ui}\\\";\\n surfaceRoot.appendChild(surfaceStyle);\\n const stage = document.createElement(\\\"div\\\");\\n stage.id = \\\"frost-stage\\\";\\n surfaceRoot.appendChild(stage);\\n surfaceRoot.appendChild(document.createElement(\\\"slot\\\"));\\n stage.dataset.build = window.Frost.REVIEW_BUILD;\\n const buildStatus = document.createElement(\\\"span\\\");\\n buildStatus.id = \\\"frost-build-status\\\";\\n buildStatus.setAttribute(\\\"data-hf-ignore\\\", \\\"\\\");\\n stage.appendChild(buildStatus);\\n const TUNE_IDS = Object.keys(window.Frost.TUNABLES);\\n function optionsFrom(values) {\\n const num = (key, a, b) =>\\n Number.isFinite(Number(values[key])) ? clamp(Number(values[key]), a, b) : defaults[key];\\n const str = (key, max) =>\\n String(values[key] ?? defaults[key])\\n .replace(/\\\\s+/g, \\\" \\\")\\n .trim()\\n .slice(0, max);\\n const pick = (key, options) =>\\n options.includes(String(values[key])) ? String(values[key]) : defaults[key];\\n const lines = (key) =>\\n str(key, 60)\\n .split(\\\"|\\\")\\n .map((s) => s.trim())\\n .filter(Boolean);\\n const breakDuration = num(\\\"breakDuration\\\", 0.4, 4);\\n // beats: each far enough after the previous one for a break to finish before the next form\\n const raw = {\\n logoBreak: num(\\\"logoBreakAt\\\", 0.3, 4),\\n form1: num(\\\"formHeadline1At\\\", 2, 10),\\n break1: num(\\\"headline1BreakAt\\\", 6, 18),\\n form2: num(\\\"formHeadline2At\\\", 9, 22),\\n break2: num(\\\"headline2BreakAt\\\", 15, 27),\\n fadeOut: num(\\\"fadeOutAt\\\", 17, 29.5),\\n };\\n const schedule = window.Frost.resolveSchedule(raw, breakDuration);\\n const hex = (key) => {\\n const v = String(values[key] ?? \\\"\\\")\\n .trim()\\n .toLowerCase();\\n return /^#[0-9a-f]{3}$/.test(v)\\n ? \\\"#\\\" +\\n v\\n .slice(1)\\n .split(\\\"\\\")\\n .map((ch) => ch + ch)\\n .join(\\\"\\\")\\n : /^#[0-9a-f]{6}$/.test(v)\\n ? v\\n : defaults[key];\\n };\\n const tune = {};\\n for (const id of TUNE_IDS) {\\n const e = schema.find((v) => v.id === id);\\n if (!e) continue;\\n tune[id] =\\n e.type === \\\"boolean\\\"\\n ? values[id] === true || values[id] === 1 || values[id] === \\\"true\\\"\\n : e.type === \\\"number\\\"\\n ? num(id, e.min, e.max)\\n : e.type === \\\"color\\\"\\n ? hex(id)\\n : e.type === \\\"enum\\\"\\n ? pick(\\n id,\\n e.options.map((x) => x.value),\\n )\\n : str(id, 64);\\n }\\n return {\\n cameraMode: pick(\\\"cameraMode\\\", [\\\"original\\\", \\\"authored\\\"]),\\n cameraTrack: window.Frost.parseTrack(values.cameraTrack || \\\"\\\"),\\n headlines: [lines(\\\"headline1\\\"), lines(\\\"headline2\\\")],\\n text: {\\n width: num(\\\"textWidth\\\", 1.2, 9),\\n lineHeight: num(\\\"textLineHeight\\\", 0.7, 1.4),\\n depth: num(\\\"textDepth\\\", 0.05, 0.8),\\n bevel: num(\\\"textBevel\\\", 0, 0.12),\\n corner: num(\\\"textCorner\\\", 0, 0.06),\\n meshDetail: Math.round(num(\\\"textMeshDetail\\\", 1, 4)),\\n weight: Number(pick(\\\"fontWeight\\\", [\\\"400\\\", \\\"600\\\", \\\"700\\\"])),\\n letterSpacing: num(\\\"letterSpacing\\\", -0.1, 0.4),\\n },\\n schedule,\\n deformation: {\\n strength: num(\\\"deformStrength\\\", 0, 0.08),\\n scale: window.Frost.validateDeformationScale(\\n Number(values.deformScale ?? defaults.deformScale),\\n ),\\n seed: Math.round(num(\\\"deformSeed\\\", 0, 65535)),\\n },\\n pose: {\\n turnYaw: num(\\\"turnYaw\\\", -360, 360),\\n turnPitch: num(\\\"turnPitch\\\", -90, 90),\\n approach: num(\\\"approach\\\", 0, 7),\\n turnYaw2: num(\\\"turnYaw2\\\", -360, 360),\\n turnPitch2: num(\\\"turnPitch2\\\", -90, 90),\\n retreat: num(\\\"retreat\\\", 0, 8),\\n zoomIn: num(\\\"zoomIn\\\", 0, 8),\\n finalYaw: num(\\\"finalYaw\\\", -180, 180),\\n finalPitch: num(\\\"finalPitch\\\", -90, 90),\\n driftYaw: num(\\\"driftYaw\\\", -30, 30),\\n driftSway: num(\\\"driftSway\\\", 0, 20),\\n idleYaw: num(\\\"idleYaw\\\", 0, 40),\\n },\\n shards: {\\n amount: num(\\\"shardAmount\\\", 0.02, 1),\\n formSpread: num(\\\"formSpread\\\", 0, 4),\\n formFill: num(\\\"formFill\\\", 0.05, 3),\\n sliceRadius: num(\\\"sliceRadius\\\", 0.05, 1.5),\\n sliceStrength: num(\\\"sliceStrength\\\", 1, 40),\\n shatterRadius: num(\\\"shatterRadius\\\", 0.1, 1.5),\\n shatterStrength: num(\\\"shatterStrength\\\", 1, 40),\\n breakDuration,\\n strayDust: num(\\\"strayDust\\\", 0, 200),\\n followObject: num(\\\"followObject\\\", 0, 30),\\n finalEjectBoost: num(\\\"finalEjectBoost\\\", 1, 6),\\n },\\n tune,\\n quality: values.quality === \\\"lite\\\" ? \\\"lite\\\" : \\\"full\\\",\\n upscaler: pick(\\\"upscaler\\\", [\\\"fsr1\\\", \\\"taau\\\", \\\"bilinear\\\", \\\"native\\\"]),\\n renderScale: num(\\\"renderScale\\\", 0.35, 1),\\n shapeResolution: pick(\\\"shapeResolution\\\", [\\\"128\\\", \\\"256\\\", \\\"384\\\"]),\\n erosionResolution: pick(\\\"erosionResolution\\\", [\\\"64\\\", \\\"96\\\", \\\"128\\\", \\\"192\\\"]),\\n particleCount: pick(\\\"particleCount\\\", [\\\"100k\\\", \\\"250k\\\", \\\"500k\\\", \\\"1M\\\"]),\\n logoUrl: str(\\\"logoUrl\\\", 200) || defaults.logoUrl,\\n logoMeshDetail: Math.round(num(\\\"logoMeshDetail\\\", 1, 4)),\\n };\\n }\\n let opts;\\n try {\\n opts = optionsFrom(values);\\n } catch (error) {\\n buildStatus.textContent = error.message;\\n stage.dataset.state = \\\"invalid-settings\\\";\\n window.__frostConfigError = error.message;\\n return;\\n }\\n const schedule = opts.schedule;\\n const DURATION = 22.5;\\n const canvas = document.createElement(\\\"canvas\\\");\\n canvas.width = W;\\n canvas.height = H;\\n stage.appendChild(canvas);\\n // Native 3D Depth is an editable scalar adapter on the two progress controllers.\\n // Their Depth values mean 0–100% progress, never rendered object depth.\\n // Explicit keyframes make Studio's 3D inspector record edits at the playhead.\\n const timeline = gsap.timeline({ paused: true });\\n timeline.to(\\n \\\"#logo-position\\\",\\n {\\n keyframes: {\\n \\\"0%\\\": { x: 0, y: 0, z: 0 },\\n \\\"100%\\\": { x: 0, y: 0, z: 0, ease: \\\"none\\\" },\\n },\\n duration: 22.5,\\n ease: \\\"none\\\",\\n },\\n 0,\\n );\\n timeline.to(\\n \\\"#logo-rotation\\\",\\n {\\n keyframes: {\\n \\\"0%\\\": { rotationX: 0, rotationY: 0, rotationZ: 0 },\\n \\\"100%\\\": { rotationX: 0, rotationY: 0, rotationZ: 0, ease: \\\"none\\\" },\\n },\\n duration: 22.5,\\n ease: \\\"none\\\",\\n },\\n 0,\\n );\\n timeline.to(\\n \\\"#headline1-position\\\",\\n {\\n keyframes: {\\n \\\"0%\\\": { x: 0, y: 0, z: 0 },\\n \\\"100%\\\": { x: 0, y: 0, z: 0, ease: \\\"none\\\" },\\n },\\n duration: 22.5,\\n ease: \\\"none\\\",\\n },\\n 0,\\n );\\n timeline.to(\\n \\\"#headline1-rotation\\\",\\n {\\n keyframes: {\\n \\\"0%\\\": { rotationX: 0, rotationY: 0, rotationZ: 0 },\\n \\\"100%\\\": { rotationX: 0, rotationY: 0, rotationZ: 0, ease: \\\"none\\\" },\\n },\\n duration: 22.5,\\n ease: \\\"none\\\",\\n },\\n 0,\\n );\\n timeline.to(\\n \\\"#headline2-position\\\",\\n {\\n keyframes: {\\n \\\"0%\\\": { x: 0, y: 0, z: 0 },\\n \\\"100%\\\": { x: 0, y: 0, z: 0, ease: \\\"none\\\" },\\n },\\n duration: 22.5,\\n ease: \\\"none\\\",\\n },\\n 0,\\n );\\n timeline.to(\\n \\\"#headline2-rotation\\\",\\n {\\n keyframes: {\\n \\\"0%\\\": { rotationX: 0, rotationY: 0, rotationZ: 0 },\\n \\\"100%\\\": { rotationX: 0, rotationY: 0, rotationZ: 0, ease: \\\"none\\\" },\\n },\\n duration: 22.5,\\n ease: \\\"none\\\",\\n },\\n 0,\\n );\\n timeline.to(\\n \\\"#logo-breakup\\\",\\n {\\n keyframes: {\\n \\\"0%\\\": { z: 0, ease: \\\"none\\\" },\\n \\\"6.222222222222222%\\\": { z: 0, ease: \\\"none\\\" },\\n \\\"10.666666666666666%\\\": { z: 100, ease: \\\"power1.in\\\" },\\n \\\"100%\\\": { z: 100, ease: \\\"none\\\" },\\n },\\n duration: 22.5,\\n ease: \\\"none\\\",\\n },\\n 0,\\n );\\n timeline.to(\\n \\\"#logo-assembly\\\",\\n {\\n keyframes: {\\n \\\"0%\\\": { z: 0, ease: \\\"none\\\" },\\n \\\"100%\\\": { z: 0, ease: \\\"none\\\" },\\n },\\n duration: 22.5,\\n ease: \\\"none\\\",\\n },\\n 0,\\n );\\n timeline.to(\\n \\\"#headline1-breakup\\\",\\n {\\n keyframes: {\\n \\\"0%\\\": { z: 0, ease: \\\"none\\\" },\\n \\\"45.33333333333333%\\\": { z: 0, ease: \\\"none\\\" },\\n \\\"49.77777777777778%\\\": { z: 100, ease: \\\"power1.in\\\" },\\n \\\"100%\\\": { z: 100, ease: \\\"none\\\" },\\n },\\n duration: 22.5,\\n ease: \\\"none\\\",\\n },\\n 0,\\n );\\n timeline.to(\\n \\\"#headline1-assembly\\\",\\n {\\n keyframes: {\\n \\\"0%\\\": { z: 0, ease: \\\"none\\\" },\\n \\\"19.555555555555557%\\\": { z: 0, ease: \\\"none\\\" },\\n \\\"33.33333333333333%\\\": { z: 100, ease: \\\"sine.inOut\\\" },\\n \\\"100%\\\": { z: 100, ease: \\\"none\\\" },\\n },\\n duration: 22.5,\\n ease: \\\"none\\\",\\n },\\n 0,\\n );\\n timeline.to(\\n \\\"#headline2-breakup\\\",\\n {\\n keyframes: {\\n \\\"0%\\\": { z: 0, ease: \\\"none\\\" },\\n \\\"86.66666666666667%\\\": { z: 0, ease: \\\"none\\\" },\\n \\\"91.55555555555556%\\\": { z: 100, ease: \\\"power1.in\\\" },\\n \\\"100%\\\": { z: 100, ease: \\\"none\\\" },\\n },\\n duration: 22.5,\\n ease: \\\"none\\\",\\n },\\n 0,\\n );\\n timeline.to(\\n \\\"#headline2-assembly\\\",\\n {\\n keyframes: {\\n \\\"0%\\\": { z: 0, ease: \\\"none\\\" },\\n \\\"58.666666666666664%\\\": { z: 0, ease: \\\"none\\\" },\\n \\\"74.66666666666667%\\\": { z: 100, ease: \\\"sine.inOut\\\" },\\n \\\"100%\\\": { z: 100, ease: \\\"none\\\" },\\n },\\n duration: 22.5,\\n ease: \\\"none\\\",\\n },\\n 0,\\n );\\n timeline.to(\\n \\\"#scene-fade\\\",\\n {\\n keyframes: {\\n \\\"0%\\\": { z: 0, ease: \\\"none\\\" },\\n \\\"93.33333333333333%\\\": { z: 0, ease: \\\"none\\\" },\\n \\\"100%\\\": { z: 100, ease: \\\"sine.inOut\\\" },\\n },\\n duration: 22.5,\\n ease: \\\"none\\\",\\n },\\n 0,\\n );\\n timeline.to(\\n \\\"#camera-orbit\\\",\\n {\\n keyframes: {\\n \\\"0%\\\": { rotationX: 0, rotationY: 0, rotationZ: 0, ease: \\\"none\\\" },\\n \\\"5.555555555555555%\\\": { rotationX: 0, rotationY: -20, rotationZ: 0, ease: \\\"none\\\" },\\n \\\"7.6923076923076925%\\\": {\\n rotationX: 0,\\n rotationY: -31.39736,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"9.82905982905983%\\\": {\\n rotationX: 0,\\n rotationY: -49.403732,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"11.965811965811966%\\\": {\\n rotationX: 0,\\n rotationY: -72.817478,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"14.102564102564102%\\\": {\\n rotationX: 0,\\n rotationY: -100.436959,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"16.23931623931624%\\\": {\\n rotationX: 0,\\n rotationY: -131.060537,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"18.37606837606838%\\\": {\\n rotationX: 0,\\n rotationY: -163.486573,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"20.51282051282051%\\\": {\\n rotationX: 0,\\n rotationY: -196.513427,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"22.64957264957265%\\\": {\\n rotationX: 0,\\n rotationY: -228.939463,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"24.786324786324784%\\\": {\\n rotationX: 0,\\n rotationY: -259.563041,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"26.923076923076927%\\\": {\\n rotationX: 0,\\n rotationY: -287.182522,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"29.059829059829056%\\\": {\\n rotationX: 0,\\n rotationY: -310.596268,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"31.196581196581196%\\\": {\\n rotationX: 0,\\n rotationY: -328.60264,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"33.33333333333333%\\\": { rotationX: 0, rotationY: -340, rotationZ: 0, ease: \\\"none\\\" },\\n \\\"44.44444444444444%\\\": { rotationX: 0, rotationY: -380, rotationZ: 0, ease: \\\"none\\\" },\\n \\\"46.6031746031746%\\\": {\\n rotationX: 0,\\n rotationY: -390.850146,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"48.76190476190476%\\\": {\\n rotationX: 0,\\n rotationY: -407.241983,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"50.920634920634924%\\\": {\\n rotationX: 0,\\n rotationY: -428.251895,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"53.07936507936508%\\\": {\\n rotationX: 0,\\n rotationY: -452.956268,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"55.23809523809524%\\\": {\\n rotationX: 0,\\n rotationY: -480.431487,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"57.3968253968254%\\\": {\\n rotationX: 0,\\n rotationY: -509.753936,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"59.555555555555564%\\\": { rotationX: 0, rotationY: -540, rotationZ: 0, ease: \\\"none\\\" },\\n \\\"61.71428571428572%\\\": {\\n rotationX: 0,\\n rotationY: -570.246064,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"63.87301587301587%\\\": {\\n rotationX: 0,\\n rotationY: -599.568513,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"66.03174603174602%\\\": {\\n rotationX: 0,\\n rotationY: -627.043732,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"68.19047619047619%\\\": {\\n rotationX: 0,\\n rotationY: -651.748105,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"70.34920634920636%\\\": {\\n rotationX: 0,\\n rotationY: -672.758017,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"72.50793650793652%\\\": {\\n rotationX: 0,\\n rotationY: -689.149854,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"74.66666666666667%\\\": { rotationX: 0, rotationY: -700, rotationZ: 0, ease: \\\"none\\\" },\\n \\\"85.77777777777779%\\\": { rotationX: 0, rotationY: -740, rotationZ: 0, ease: \\\"none\\\" },\\n \\\"87.80952380952381%\\\": {\\n rotationX: 0,\\n rotationY: -754.178426,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"89.84126984126985%\\\": {\\n rotationX: 0,\\n rotationY: -780.349854,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"91.87301587301587%\\\": {\\n rotationX: 0,\\n rotationY: -815.91137,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"93.90476190476191%\\\": {\\n rotationX: 0,\\n rotationY: -858.260058,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"95.93650793650794%\\\": {\\n rotationX: 0,\\n rotationY: -904.793003,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"97.96825396825398%\\\": {\\n rotationX: 0,\\n rotationY: -952.907289,\\n rotationZ: 0,\\n ease: \\\"none\\\",\\n },\\n \\\"100%\\\": { rotationX: 0, rotationY: -1000, rotationZ: 0, ease: \\\"none\\\" },\\n },\\n duration: 22.5,\\n ease: \\\"none\\\",\\n },\\n 0,\\n );\\n window.__timelines = window.__timelines || {};\\n window.__timelines[\\\"frost-sequence-rig\\\"] = timeline;\\n const activeTimeline = () => window.__timelines[\\\"frost-sequence-rig\\\"] || timeline;\\n function rigRevision() {\\n const clean = (v) =>\\n Array.isArray(v)\\n ? v.map(clean)\\n : v && typeof v === \\\"object\\\"\\n ? Object.fromEntries(\\n Object.entries(v)\\n .filter(\\n ([k, v]) =>\\n !k.startsWith(\\\"_\\\") &&\\n typeof v !== \\\"function\\\" &&\\n ![\\n \\\"parent\\\",\\n \\\"callbackScope\\\",\\n \\\"scrollTrigger\\\",\\n \\\"onUpdateParams\\\",\\n \\\"onStartParams\\\",\\n \\\"onCompleteParams\\\",\\n ].includes(k),\\n )\\n .map(([k, v]) => [k, clean(v)]),\\n )\\n : v;\\n return JSON.stringify(\\n activeTimeline()\\n .getChildren(false, true, false)\\n .map((t) => [t.startTime(), t.duration(), clean(t.vars)]),\\n );\\n }\\n function sampleRig(t) {\\n const active = activeTimeline(),\\n saved = active.totalTime();\\n active.totalTime(t, true);\\n const get = (id, k) => Number.parseFloat(gsap.getProperty(\\\"#\\\" + id, k)) || 0;\\n const objects = [\\\"logo\\\", \\\"headline1\\\", \\\"headline2\\\"].map((id) => ({\\n x: get(id + \\\"-position\\\", \\\"x\\\") / 100,\\n y: -get(id + \\\"-position\\\", \\\"y\\\") / 100,\\n z: get(id + \\\"-position\\\", \\\"z\\\") / 100,\\n rx: get(id + \\\"-rotation\\\", \\\"rotationX\\\"),\\n ry: get(id + \\\"-rotation\\\", \\\"rotationY\\\"),\\n rz: get(id + \\\"-rotation\\\", \\\"rotationZ\\\"),\\n breakup: get(id + \\\"-breakup\\\", \\\"z\\\"),\\n assembly: get(id + \\\"-assembly\\\", \\\"z\\\"),\\n }));\\n // Do not replace a visible solid. Incoming assembly takes over the existing\\n // cloud once the outgoing object has fully broken. No particle reset.\\n let target = 0;\\n for (let k = 1; k \\u003c objects.length; k++)\\n if (objects[k].assembly > 0 && objects[k - 1].breakup >= 99.999 && target === k - 1)\\n target = k;\\n const result = {\\n ...objects[target],\\n target,\\n fade: get(\\\"scene-fade\\\", \\\"z\\\"),\\n cameraYaw: get(\\\"camera-orbit\\\", \\\"rotationY\\\"),\\n objects,\\n };\\n active.totalTime(saved, true);\\n return result;\\n }\\n // Opt-in Studio-only preview quality. Standalone/capture always keeps full quality.\\n let previewPixelRatio;\\n try {\\n if (\\n window.parent !== window &&\\n new URLSearchParams(location.search).get(\\\"__hf_shader_loading\\\") === \\\"player\\\"\\n ) {\\n const quality = new URLSearchParams(window.parent.location.search).get(\\\"frostPreview\\\");\\n if (quality === \\\"half\\\") previewPixelRatio = 1;\\n if (quality === \\\"quarter\\\") previewPixelRatio = 0.5;\\n }\\n } catch {} // Cross-origin embedding retains full quality.\\n stage.dataset.previewQuality =\\n previewPixelRatio === undefined ? \\\"full\\\" : String(previewPixelRatio / 2);\\n const frost = window.Frost.create({\\n canvas,\\n width: W,\\n height: H,\\n ...opts,\\n previewPixelRatio,\\n rig: { duration: DURATION, mode: values.assemblyMode, sequence: true, sample: sampleRig },\\n fontUrl: (window.__frostAssetBase || \\\"assets/\\\") + \\\"fonts/Geist-Bold.ttf\\\",\\n onProgress: (msg) => {\\n stage.dataset.state = msg;\\n buildStatus.textContent = \\\"Building Frost · \\\" + msg;\\n (window.__frostLog = window.__frostLog || []).push([msg]);\\n },\\n });\\n\\n window.__hf = window.__hf || {};\\n window.__hf.buildReady = window.__hf.buildReady || {};\\n window.__hf.buildReady.frost = frost.ready;\\n\\n let lastTime = 0,\\n disposed = false,\\n renderFailed = false,\\n revision = rigRevision();\\n function describeRenderError(err) {\\n if (err instanceof Error) return err.message;\\n // A loader's rejected promise is often the raw DOM Event from an\\n // onerror, not an Error, so the failed target is the real reason.\\n if (err && typeof err === \\\"object\\\" && \\\"type\\\" in err) {\\n const source = err.target && (err.target.src || err.target.href);\\n return source ? `failed to load ${source}` : `${err.type} event`;\\n }\\n return String(err);\\n }\\n function showRenderError(err) {\\n if (disposed || renderFailed) return;\\n renderFailed = true;\\n const message = describeRenderError(err);\\n console.error(\\\"Frost initialization/render failed:\\\", err);\\n window.__frostRuntimeError = message;\\n stage.dataset.state = \\\"render-error\\\";\\n stage.dataset.busy = \\\"false\\\";\\n buildStatus.hidden = false;\\n buildStatus.textContent = \\\"Frost failed: \\\" + message;\\n }\\n function renderAt(time) {\\n if (disposed || renderFailed) return;\\n const nextRevision = rigRevision();\\n if (nextRevision !== revision) {\\n revision = nextRevision;\\n stage.dataset.revisions = String(Number(stage.dataset.revisions || 0) + 1);\\n frost.invalidate();\\n }\\n lastTime = clamp(time, 0, DURATION);\\n canvas.style.opacity = String(1 - clamp(sampleRig(lastTime).fade / 100));\\n frost.renderAt(lastTime);\\n stage.dataset.requestedTime = lastTime.toFixed(4);\\n stage.dataset.busy = \\\"true\\\";\\n const requested = lastTime;\\n frost\\n .waitForGpu()\\n .then(() => {\\n if (disposed || requested !== lastTime) return;\\n stage.dataset.time = requested.toFixed(4);\\n stage.dataset.rigSample = JSON.stringify(sampleRig(requested));\\n stage.dataset.busy = \\\"false\\\";\\n })\\n .catch(showRenderError);\\n }\\n frost.ready\\n .then(() => {\\n buildStatus.hidden = true;\\n if (!disposed) renderAt(lastTime);\\n })\\n .catch((err) => {\\n showRenderError(err);\\n });\\n\\n timeline.eventCallback(\\\"onUpdate\\\", () => renderAt(timeline.time()));\\n window.__logoRig = { sample: sampleRig, mode: values.assemblyMode };\\n\\n function seek(event) {\\n const d = event && event.detail;\\n if (!d || typeof d.time !== \\\"number\\\") return;\\n const time = clamp(d.time, 0, DURATION);\\n activeTimeline().totalTime(time, true);\\n renderAt(time);\\n // async renderer: hold the capture until the GPU queue has drained (and until the scene has loaded)\\n if (typeof d.waitUntil === \\\"function\\\") d.waitUntil(frost.waitForGpu());\\n }\\n window.addEventListener(\\\"hf-seek\\\", seek);\\n window.__frostRendererProfile = values.rendererProfile;\\n window.__frostReady = frost.ready.then(async () => {\\n if (disposed) return;\\n const world = frost.world,\\n camera = world.camera;\\n // Capture the approved camera framing, then orbit that view around the fixed object.\\n world.rig.update(camera, world.objectGroup, 0, 0);\\n const base = camera.position.clone(),\\n aim = world.rig.lookAt.clone();\\n const pivot = world.motionGroup.position.clone();\\n const rotate = (out, source, angle) => {\\n const x = source.x - pivot.x,\\n z = source.z - pivot.z,\\n c = Math.cos(angle),\\n s = Math.sin(angle);\\n out.set(pivot.x + c * x + s * z, source.y, pivot.z - s * x + c * z);\\n };\\n world.onCameraTransform = (t) => {\\n const angle = (sampleRig(t).cameraYaw * Math.PI) / 180;\\n rotate(camera.position, base, angle);\\n rotate(world.rig.lookAt, aim, angle);\\n camera.lookAt(world.rig.lookAt);\\n camera.updateMatrixWorld(true);\\n };\\n frost.invalidate();\\n renderAt(lastTime);\\n await frost.waitForGpu();\\n });\\n window.__frost = {\\n renderAt,\\n schedule,\\n duration: DURATION,\\n poseAt: (t) => frost.poseAt(t),\\n get world() {\\n return frost.world;\\n },\\n get shape() {\\n return frost.shape;\\n },\\n waitForGpu: () => frost.waitForGpu(),\\n };\\n window.__frostInstance = {\\n dispose() {\\n if (disposed) return;\\n disposed = true;\\n canvasResize.disconnect();\\n timeline.kill();\\n window.removeEventListener(\\\"hf-seek\\\", seek);\\n frost.dispose();\\n canvas.remove();\\n },\\n applyVariables() {\\n return \\\"rebuild\\\";\\n },\\n };\\n // Studio can resize the drawing buffer after initialization; resizing clears its pixels.\\n // Redraw even when the paused playhead has not changed.\\n let canvasSize = canvas.width + \\\"x\\\" + canvas.height;\\n const canvasResize = new MutationObserver(() => {\\n const size = canvas.width + \\\"x\\\" + canvas.height;\\n if (size === canvasSize) return;\\n canvasSize = size;\\n if (!disposed) frost.redraw();\\n });\\n canvasResize.observe(canvas, { attributes: true, attributeFilter: [\\\"width\\\", \\\"height\\\"] });\\n renderAt(0);\\n })();\\n \",\"composition.js\");\n})().catch((error)=>console.error(\"[HyperFrames catalog] frost-sequence-camera-orbit could not load its scripts\",error));\n})();</script>\n <script>\n // frost.js reads its asset base when it loads; beside this file when mounted.\n if (typeof __hyperframes !== \"undefined\" && __hyperframes.assetUrl)\n window.__frostAssetBase = __hyperframes.assetUrl(\"assets/\");\n </script>\n \n <style>\n * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n }\n html,\n body {\n background: #030303;\n }\n #frost-root {\n position: relative;\n width: 1920px;\n height: 1080px;\n overflow: hidden;\n background: #030303;\n }\n #frost-stage {\n position: absolute;\n inset: 0;\n background: #030303;\n }\n #frost-stage canvas {\n position: absolute;\n inset: 0;\n width: 1920px;\n height: 1080px;\n display: block;\n }\n #frost-build-status {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: 5;\n padding: 10px 14px;\n background: #000b;\n color: #eee;\n font: 16px system-ui;\n }\n #frost-stage.nogpu {\n background: radial-gradient(ellipse 78% 78% at 50% 150%, #2a2a2a, #050505 70%, #030303);\n }\n /* the motion checker needs a moving layout box on every frame: a background-coloured 1.5 px plate */\n #frost-plate {\n position: absolute;\n left: 0;\n top: 1078px;\n width: 1.5px;\n height: 1.5px;\n background: #030303;\n pointer-events: none;\n }\n #frost-root {\n pointer-events: none;\n }\n #frost-root > .clip {\n position: absolute;\n left: 0;\n top: 0;\n width: 1920px;\n height: 1080px;\n background: transparent;\n pointer-events: none;\n }\n </style>\n </head>\n <body>\n <div\n data-hf-id=\"hf-b4of\"\n id=\"frost-root\"\n data-composition-variables='[{\"id\":\"headline1\",\"type\":\"string\",\"label\":\"First text (| = line break)\",\"default\":\"Hard to|break.\",\"maxLength\":60},{\"id\":\"headline2\",\"type\":\"string\",\"label\":\"Second text (| = line break)\",\"default\":\"Easy to|remember.\",\"maxLength\":60},{\"id\":\"logoUrl\",\"type\":\"string\",\"label\":\"Logo SVG asset path (upload in Assets, then paste path)\",\"default\":\"/public/catalog/assets/e590d58631c76a9c.svg\",\"maxLength\":200},{\"id\":\"assemblyMode\",\"type\":\"enum\",\"label\":\"Assembly response\",\"default\":\"hybrid\",\"options\":[{\"value\":\"physical\",\"label\":\"Physical attraction (100 = full strength)\"},{\"value\":\"directed\",\"label\":\"Direct progress (100 = assembled)\"},{\"value\":\"hybrid\",\"label\":\"Hybrid progress + physical flight\"}]},{\"id\":\"materialBaseColor\",\"type\":\"color\",\"label\":\"Base color\",\"default\":\"#ffffff\",\"materialSection\":\"Base\",\"materialScope\":\"object\"},{\"id\":\"baseRoughness\",\"type\":\"number\",\"label\":\"Base roughness\",\"default\":0.31,\"min\":0,\"max\":0.5,\"step\":0.005,\"materialSection\":\"Base\",\"materialScope\":\"object\"},{\"id\":\"materialTransmission\",\"type\":\"boolean\",\"label\":\"Transmission\",\"default\":true,\"materialSection\":\"Transmission\",\"materialScope\":\"object\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Switch off to remove this feature without losing its settings.\"},{\"id\":\"materialBacklight\",\"type\":\"number\",\"label\":\"Backlight through ice\",\"default\":0.27,\"min\":0,\"max\":2,\"step\":0.01,\"materialSection\":\"Transmission\",\"materialScope\":\"object\"},{\"id\":\"ior\",\"type\":\"number\",\"label\":\"Index of refraction\",\"default\":1.675,\"min\":1,\"max\":2,\"step\":0.005,\"materialSection\":\"Transmission\",\"materialScope\":\"object\"},{\"id\":\"thicknessScale\",\"type\":\"number\",\"label\":\"Thickness scale\",\"default\":2.04,\"min\":0.1,\"max\":3,\"step\":0.01,\"materialSection\":\"Transmission\",\"materialScope\":\"object\"},{\"id\":\"materialAbsorption\",\"type\":\"boolean\",\"label\":\"Absorption / tint\",\"default\":true,\"materialSection\":\"Absorption / tint\",\"materialScope\":\"object\",\"materialToggle\":true,\"materialRequires\":[\"materialTransmission\"],\"description\":\"Switch off to remove this feature without losing its settings.\"},{\"id\":\"attenuationColor\",\"type\":\"color\",\"label\":\"Attenuation colour (white = no absorption, clear glass)\",\"default\":\"#d5f4ff\",\"materialSection\":\"Absorption / tint\",\"materialScope\":\"object\"},{\"id\":\"attenuationDistance\",\"type\":\"number\",\"label\":\"Attenuation distance\",\"default\":6.54,\"min\":0.05,\"max\":12,\"step\":0.01,\"materialSection\":\"Absorption / tint\",\"materialScope\":\"object\"},{\"id\":\"materialDispersion\",\"type\":\"boolean\",\"label\":\"Dispersion\",\"default\":false,\"materialSection\":\"Dispersion\",\"materialScope\":\"object\",\"materialToggle\":true,\"materialRequires\":[\"materialTransmission\"],\"description\":\"Switch off to remove this feature without losing its settings.\"},{\"id\":\"dispersion\",\"type\":\"number\",\"label\":\"Dispersion (0 = off; on/off reloads)\",\"default\":0.12,\"min\":0,\"max\":0.3,\"step\":0.005,\"materialSection\":\"Dispersion\",\"materialScope\":\"object\"},{\"id\":\"materialReflections\",\"type\":\"boolean\",\"label\":\"Reflections\",\"default\":true,\"materialSection\":\"Reflections\",\"materialScope\":\"object\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Switch off to remove this feature without losing its settings.\"},{\"id\":\"envIntensity\",\"type\":\"number\",\"label\":\"Environment intensity\",\"default\":2.04,\"min\":0,\"max\":3,\"step\":0.01,\"materialSection\":\"Reflections\",\"materialScope\":\"object\"},{\"id\":\"specularIntensity\",\"type\":\"number\",\"label\":\"Specular intensity\",\"default\":1.44,\"min\":0,\"max\":2,\"step\":0.01,\"materialSection\":\"Reflections\",\"materialScope\":\"object\"},{\"id\":\"materialFrost\",\"type\":\"boolean\",\"label\":\"Frost\",\"default\":true,\"materialSection\":\"Frost\",\"materialScope\":\"object\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Switch off to remove this feature without losing its settings.\"},{\"id\":\"materialInteriorFrost\",\"type\":\"number\",\"label\":\"Uniform frost\",\"default\":0,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Frost\",\"materialScope\":\"object\"},{\"id\":\"frostScale\",\"type\":\"number\",\"label\":\"Scale\",\"default\":0.7,\"min\":0.2,\"max\":6,\"step\":0.05,\"materialSection\":\"Frost\",\"materialScope\":\"object\"},{\"id\":\"frostThreshold\",\"type\":\"number\",\"label\":\"Threshold (1 = no frost, clear glass)\",\"default\":0.62,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Frost\",\"materialScope\":\"object\"},{\"id\":\"frostSoftness\",\"type\":\"number\",\"label\":\"Softness\",\"default\":0.24,\"min\":0.01,\"max\":1,\"step\":0.01,\"materialSection\":\"Frost\",\"materialScope\":\"object\"},{\"id\":\"frostRoughness\",\"type\":\"number\",\"label\":\"Roughness\",\"default\":0.73,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Frost\",\"materialScope\":\"object\"},{\"id\":\"frostDiffuse\",\"type\":\"number\",\"label\":\"Diffuse (how much light frosted areas catch)\",\"default\":0.11,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Frost\",\"materialScope\":\"object\"},{\"id\":\"materialSurfaceBumps\",\"type\":\"boolean\",\"label\":\"Object surface bumps / crack notches\",\"default\":false,\"materialSection\":\"Surface bumps\",\"materialScope\":\"object\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Disable crystal, grain, micro, ripple and crack normal perturbations and crack notches on the solid. Preserves their settings and the shard finish.\"},{\"id\":\"materialCrystals\",\"type\":\"boolean\",\"label\":\"Crystal bumps\",\"default\":true,\"materialSection\":\"Crystal bumps\",\"materialScope\":\"object\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Switch off to remove this feature without losing its settings.\"},{\"id\":\"crystalBump\",\"type\":\"number\",\"label\":\"Crystal bump\",\"default\":0.01,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Crystal bumps\",\"materialScope\":\"object\"},{\"id\":\"crystalScale\",\"type\":\"number\",\"label\":\"Crystal scale\",\"default\":4,\"min\":4,\"max\":80,\"step\":1,\"materialSection\":\"Crystal bumps\",\"materialScope\":\"object\"},{\"id\":\"materialGrain\",\"type\":\"boolean\",\"label\":\"Grain bumps\",\"default\":true,\"materialSection\":\"Grain bumps\",\"materialScope\":\"object\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Switch off to remove this feature without losing its settings.\"},{\"id\":\"materialGrainAmount\",\"type\":\"number\",\"label\":\"Grain strength\",\"default\":0.47,\"min\":0,\"max\":2,\"step\":0.01,\"materialSection\":\"Grain bumps\",\"materialScope\":\"object\"},{\"id\":\"materialGrainScale\",\"type\":\"number\",\"label\":\"Grain scale\",\"default\":150,\"min\":1,\"max\":150,\"step\":1,\"materialSection\":\"Grain bumps\",\"materialScope\":\"object\"},{\"id\":\"materialCutNormals\",\"type\":\"boolean\",\"label\":\"Fracture normals\",\"default\":true,\"materialSection\":\"Fracture normals\",\"materialScope\":\"object\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Switch off to remove this feature without losing its settings.\"},{\"id\":\"materialMicro\",\"type\":\"boolean\",\"label\":\"Micro bumps\",\"default\":true,\"materialSection\":\"Micro bumps\",\"materialScope\":\"object\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Switch off to remove this feature without losing its settings.\"},{\"id\":\"microBump\",\"type\":\"number\",\"label\":\"Micro bump\",\"default\":0.445,\"min\":0,\"max\":1,\"step\":0.005,\"materialSection\":\"Micro bumps\",\"materialScope\":\"object\"},{\"id\":\"microScale\",\"type\":\"number\",\"label\":\"Micro scale\",\"default\":10,\"min\":10,\"max\":200,\"step\":1,\"materialSection\":\"Micro bumps\",\"materialScope\":\"object\"},{\"id\":\"microCoverage\",\"type\":\"number\",\"label\":\"Micro coverage\",\"default\":0.25,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Micro bumps\",\"materialScope\":\"object\"},{\"id\":\"bumpMaskScale\",\"type\":\"number\",\"label\":\"Mask scale\",\"default\":1.45,\"min\":0.1,\"max\":6,\"step\":0.05,\"materialSection\":\"Micro bumps\",\"materialScope\":\"object\"},{\"id\":\"materialRipples\",\"type\":\"boolean\",\"label\":\"Ripples\",\"default\":true,\"materialSection\":\"Ripples\",\"materialScope\":\"object\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Switch off to remove this feature without losing its settings.\"},{\"id\":\"rippleBump\",\"type\":\"number\",\"label\":\"Ripple bump\",\"default\":0.22,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Ripples\",\"materialScope\":\"object\"},{\"id\":\"rippleScale\",\"type\":\"number\",\"label\":\"Ripple scale\",\"default\":23,\"min\":2,\"max\":30,\"step\":0.5,\"materialSection\":\"Ripples\",\"materialScope\":\"object\"},{\"id\":\"materialSmudges\",\"type\":\"boolean\",\"label\":\"Smudges\",\"default\":true,\"materialSection\":\"Smudges\",\"materialScope\":\"object\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Switch off to remove this feature without losing its settings.\"},{\"id\":\"smudgeAmount\",\"type\":\"number\",\"label\":\"Amount\",\"default\":0.78,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Smudges\",\"materialScope\":\"object\"},{\"id\":\"smudgeCoverage\",\"type\":\"number\",\"label\":\"Coverage\",\"default\":0.58,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Smudges\",\"materialScope\":\"object\"},{\"id\":\"smudgeMaskScale\",\"type\":\"number\",\"label\":\"Mask scale\",\"default\":1.85,\"min\":0.1,\"max\":6,\"step\":0.05,\"materialSection\":\"Smudges\",\"materialScope\":\"object\"},{\"id\":\"smudgeAnisotropy\",\"type\":\"number\",\"label\":\"Anisotropy\",\"default\":16.5,\"min\":1,\"max\":20,\"step\":0.5,\"materialSection\":\"Smudges\",\"materialScope\":\"object\"},{\"id\":\"smudgeRoughness\",\"type\":\"number\",\"label\":\"Roughness\",\"default\":0.75,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Smudges\",\"materialScope\":\"object\"},{\"id\":\"smudgeWhiteness\",\"type\":\"number\",\"label\":\"Whiteness\",\"default\":0.035,\"min\":0,\"max\":0.5,\"step\":0.005,\"materialSection\":\"Smudges\",\"materialScope\":\"object\"},{\"id\":\"smudgeScale\",\"type\":\"number\",\"label\":\"Scale\",\"default\":1.3,\"min\":0.5,\"max\":10,\"step\":0.1,\"materialSection\":\"Smudges\",\"materialScope\":\"object\"},{\"id\":\"materialCracks\",\"type\":\"boolean\",\"label\":\"Cracks\",\"default\":true,\"materialSection\":\"Cracks\",\"materialScope\":\"object\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Switch off to remove this feature without losing its settings.\"},{\"id\":\"crackLargeScale\",\"type\":\"number\",\"label\":\"Large scale\",\"default\":2.45,\"min\":0.3,\"max\":8,\"step\":0.05,\"materialSection\":\"Cracks\",\"materialScope\":\"object\"},{\"id\":\"crackWarp\",\"type\":\"number\",\"label\":\"Warp\",\"default\":0.22,\"min\":0,\"max\":1.5,\"step\":0.01,\"materialSection\":\"Cracks\",\"materialScope\":\"object\"},{\"id\":\"crackCoverage\",\"type\":\"number\",\"label\":\"Coverage\",\"default\":0.19,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Cracks\",\"materialScope\":\"object\"},{\"id\":\"crackRegionScale\",\"type\":\"number\",\"label\":\"Region scale\",\"default\":1.8,\"min\":0.1,\"max\":4,\"step\":0.05,\"materialSection\":\"Cracks\",\"materialScope\":\"object\"},{\"id\":\"crackRegionCoverage\",\"type\":\"number\",\"label\":\"Region coverage\",\"default\":0.6,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Cracks\",\"materialScope\":\"object\"},{\"id\":\"veinScale\",\"type\":\"number\",\"label\":\"Vein scale\",\"default\":8,\"min\":1,\"max\":20,\"step\":0.25,\"materialSection\":\"Cracks\",\"materialScope\":\"object\"},{\"id\":\"veinContrast\",\"type\":\"number\",\"label\":\"Vein contrast\",\"default\":0.55,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Cracks\",\"materialScope\":\"object\"},{\"id\":\"crackWidth\",\"type\":\"number\",\"label\":\"Width\",\"default\":0.0025,\"min\":0.0005,\"max\":0.02,\"step\":0.0005,\"materialSection\":\"Cracks\",\"materialScope\":\"object\"},{\"id\":\"crackBrightness\",\"type\":\"number\",\"label\":\"Brightness\",\"default\":0.65,\"min\":0,\"max\":3,\"step\":0.01,\"materialSection\":\"Cracks\",\"materialScope\":\"object\"},{\"id\":\"crackDarkness\",\"type\":\"number\",\"label\":\"Darkness\",\"default\":0.69,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Cracks\",\"materialScope\":\"object\"},{\"id\":\"crackRefraction\",\"type\":\"number\",\"label\":\"Refraction\",\"default\":0.076,\"min\":0,\"max\":0.1,\"step\":0.001,\"materialSection\":\"Cracks\",\"materialScope\":\"object\"},{\"id\":\"crackSurfaceStrength\",\"type\":\"number\",\"label\":\"Surface strength\",\"default\":0.16,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Cracks\",\"materialScope\":\"object\"},{\"id\":\"fineScale\",\"type\":\"number\",\"label\":\"Fine scale\",\"default\":18.4,\"min\":2,\"max\":20,\"step\":0.1,\"materialSection\":\"Cracks\",\"materialScope\":\"object\"},{\"id\":\"fineAmount\",\"type\":\"number\",\"label\":\"Fine amount\",\"default\":0.52,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Cracks\",\"materialScope\":\"object\"},{\"id\":\"fineCoverage\",\"type\":\"number\",\"label\":\"Fine coverage\",\"default\":1,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Cracks\",\"materialScope\":\"object\"},{\"id\":\"materialScatter\",\"type\":\"boolean\",\"label\":\"Internal scattering\",\"default\":true,\"materialSection\":\"Internal scattering\",\"materialScope\":\"object\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Switch off to remove this feature without losing its settings.\"},{\"id\":\"materialInclusionScale\",\"type\":\"number\",\"label\":\"Inclusion scale\",\"default\":0.05,\"min\":0.05,\"max\":3,\"step\":0.01,\"materialSection\":\"Internal scattering\",\"materialScope\":\"object\"},{\"id\":\"materialInclusionAmount\",\"type\":\"number\",\"label\":\"Photographic inclusions\",\"default\":2,\"min\":0,\"max\":2,\"step\":0.01,\"materialSection\":\"Internal scattering\",\"materialScope\":\"object\"},{\"id\":\"interiorScatter\",\"type\":\"number\",\"label\":\"Interior scatter\",\"default\":0.09,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Internal scattering\",\"materialScope\":\"object\"},{\"id\":\"materialClearcoat\",\"type\":\"boolean\",\"label\":\"Clearcoat\",\"default\":true,\"materialSection\":\"Clearcoat\",\"materialScope\":\"object\",\"materialToggle\":true,\"materialRequires\":[\"materialReflections\"],\"description\":\"Switch off to remove this feature without losing its settings.\"},{\"id\":\"clearcoat\",\"type\":\"number\",\"label\":\"Clearcoat\",\"default\":0,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Clearcoat\",\"materialScope\":\"object\"},{\"id\":\"clearcoatRoughness\",\"type\":\"number\",\"label\":\"Clearcoat roughness\",\"default\":0,\"min\":0,\"max\":1,\"step\":0.005,\"materialSection\":\"Clearcoat\",\"materialScope\":\"object\"},{\"id\":\"materialShardNormals\",\"type\":\"boolean\",\"label\":\"Shard normals\",\"default\":true,\"materialSection\":\"Shard normals\",\"materialScope\":\"shards\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Switch off to remove this feature without losing its settings.\"},{\"id\":\"spriteNormal\",\"type\":\"number\",\"label\":\"Sprite normal strength\",\"default\":0.15,\"min\":0,\"max\":2.5,\"step\":0.05,\"materialSection\":\"Shard normals\",\"materialScope\":\"shards\"},{\"id\":\"materialShardFrost\",\"type\":\"boolean\",\"label\":\"Shard frost\",\"default\":true,\"materialSection\":\"Shard frost\",\"materialScope\":\"shards\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Uses the shared material settings from Logo &amp; text. This switch enables them on shards.\"},{\"id\":\"materialShardTransmission\",\"type\":\"boolean\",\"label\":\"Shard transparency\",\"default\":true,\"materialSection\":\"Shard transparency\",\"materialScope\":\"shards\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Uses the shared material settings from Logo &amp; text. This switch enables them on shards.\"},{\"id\":\"spriteSeeThrough\",\"type\":\"number\",\"label\":\"See-through (0 = off; on/off reloads)\",\"default\":1,\"min\":0,\"max\":1,\"step\":0.01,\"materialSection\":\"Shard transparency\",\"materialScope\":\"shards\"},{\"id\":\"materialShardReflections\",\"type\":\"boolean\",\"label\":\"Shard reflections\",\"default\":true,\"materialSection\":\"Shard reflections\",\"materialScope\":\"shards\",\"materialToggle\":true,\"materialRequires\":[],\"description\":\"Uses the shared material settings from Logo &amp; text. This switch enables them on shards.\"},{\"id\":\"minPixelSize\",\"type\":\"number\",\"label\":\"Minimum pixel size\",\"default\":0.25,\"min\":0,\"max\":4,\"step\":0.05,\"materialSection\":\"Shard shape\",\"materialScope\":\"shards\"},{\"id\":\"grainSizeMultiplier\",\"type\":\"number\",\"label\":\"Grain size multiplier\",\"default\":1.05,\"min\":0.2,\"max\":4,\"step\":0.05,\"materialSection\":\"Shard shape\",\"materialScope\":\"shards\"},{\"id\":\"spriteSize\",\"type\":\"number\",\"label\":\"Sprite size\",\"default\":1.9,\"min\":0.3,\"max\":4,\"step\":0.05,\"materialSection\":\"Shard shape\",\"materialScope\":\"shards\"},{\"id\":\"spriteTilt\",\"type\":\"number\",\"label\":\"Sprite tilt\",\"default\":12,\"min\":0,\"max\":70,\"step\":1,\"unit\":\"deg\",\"materialSection\":\"Shard shape\",\"materialScope\":\"shards\"},{\"id\":\"spriteAlphaCut\",\"type\":\"number\",\"label\":\"Alpha cut\",\"default\":0.6,\"min\":0.05,\"max\":0.6,\"step\":0.01,\"materialSection\":\"Shard shape\",\"materialScope\":\"shards\"},{\"id\":\"fontWeight\",\"type\":\"enum\",\"label\":\"Type - Weight (Geist)\",\"default\":\"600\",\"options\":[{\"value\":\"400\",\"label\":\"Regular 400\"},{\"value\":\"600\",\"label\":\"SemiBold 600\"},{\"value\":\"700\",\"label\":\"Bold 700\"}]},{\"id\":\"letterSpacing\",\"type\":\"number\",\"label\":\"Type - Letter spacing\",\"default\":0.01,\"min\":-0.1,\"max\":0.4,\"step\":0.005,\"unit\":\"em\"},{\"id\":\"shardAmount\",\"type\":\"number\",\"label\":\"Shards - Visible fraction of the broken volume (Powder amount)\",\"default\":0.44,\"min\":0.02,\"max\":1,\"step\":0.01},{\"id\":\"strayDust\",\"type\":\"number\",\"label\":\"Shards - Ambient dust motes around the object (the experiment had 40)\",\"default\":24,\"min\":0,\"max\":200,\"step\":1},{\"id\":\"sliceRadius\",\"type\":\"number\",\"label\":\"Break - First (diagonal) slice radius\",\"default\":0.6,\"min\":0.05,\"max\":1.5,\"step\":0.01},{\"id\":\"sliceStrength\",\"type\":\"number\",\"label\":\"Break - First slice strength\",\"default\":21.5,\"min\":1,\"max\":40,\"step\":0.5},{\"id\":\"finalEjectBoost\",\"type\":\"number\",\"label\":\"Break - Last break: eject speed and speed cap multiplier\",\"default\":2.5,\"min\":1,\"max\":6,\"step\":0.1},{\"id\":\"shatterRadius\",\"type\":\"number\",\"label\":\"Break - Follow-up slice radius (sets their spacing too)\",\"default\":0.45,\"min\":0.1,\"max\":1.5,\"step\":0.01},{\"id\":\"shatterStrength\",\"type\":\"number\",\"label\":\"Break - Follow-up slice strength\",\"default\":32.5,\"min\":1,\"max\":40,\"step\":0.5},{\"id\":\"cutThreshold\",\"type\":\"number\",\"label\":\"Tune break - Cut threshold (surface gone above this erosion)\",\"default\":0.3,\"min\":0.3,\"max\":0.98,\"step\":0.01},{\"id\":\"cutSoftness\",\"type\":\"number\",\"label\":\"Tune break - Cut softness\",\"default\":0.19,\"min\":0.005,\"max\":0.3,\"step\":0.005},{\"id\":\"edgeWidth\",\"type\":\"number\",\"label\":\"Tune break - Crumbly edge band width\",\"default\":0.19,\"min\":0.05,\"max\":0.8,\"step\":0.01},{\"id\":\"edgeInset\",\"type\":\"number\",\"label\":\"Tune break - Edge inset\",\"default\":0,\"min\":0,\"max\":0.3,\"step\":0.005},{\"id\":\"brushSoftness\",\"type\":\"number\",\"label\":\"Tune break - Brush softness (edge falloff of a slice)\",\"default\":0.15,\"min\":0.02,\"max\":1,\"step\":0.01},{\"id\":\"brushNoise\",\"type\":\"number\",\"label\":\"Tune break - Brush noise (ragged boundary)\",\"default\":0.4,\"min\":0,\"max\":1,\"step\":0.01},{\"id\":\"crumbleRate\",\"type\":\"number\",\"label\":\"Tune break - Crumble rate along cracks (high = the whole shape goes at once)\",\"default\":4.3,\"min\":0,\"max\":6,\"step\":0.05},{\"id\":\"crumbleCrackBias\",\"type\":\"number\",\"label\":\"Tune break - Crumble crack bias\",\"default\":5.1,\"min\":0,\"max\":6,\"step\":0.05},{\"id\":\"crumbleDuration\",\"type\":\"number\",\"label\":\"Tune break - Crumble duration after a stroke\",\"default\":0.35,\"min\":0,\"max\":2,\"step\":0.01},{\"id\":\"ejectSpeed\",\"type\":\"number\",\"label\":\"Flight - Eject speed\",\"default\":0.91,\"min\":0,\"max\":4,\"step\":0.01},{\"id\":\"ejectSpread\",\"type\":\"number\",\"label\":\"Flight - Eject spread along the normal\",\"default\":0.48,\"min\":0,\"max\":3,\"step\":0.01},{\"id\":\"ejectTurbulence\",\"type\":\"number\",\"label\":\"Flight - Eject turbulence\",\"default\":4,\"min\":0,\"max\":4,\"step\":0.01},{\"id\":\"drag\",\"type\":\"number\",\"label\":\"Flight - Drag (speed decays by this per second)\",\"default\":0,\"min\":0,\"max\":8,\"step\":0.01},{\"id\":\"gravity\",\"type\":\"number\",\"label\":\"Flight - Gravity (0 = shards never fall)\",\"default\":0,\"min\":0,\"max\":2,\"step\":0.005},{\"id\":\"turbulence\",\"type\":\"number\",\"label\":\"Flight - Turbulence strength (curl noise)\",\"default\":4,\"min\":0,\"max\":4,\"step\":0.01},{\"id\":\"turbulenceScale\",\"type\":\"number\",\"label\":\"Flight - Turbulence scale\",\"default\":2.65,\"min\":0.2,\"max\":8,\"step\":0.05},{\"id\":\"turbulenceDecay\",\"type\":\"number\",\"label\":\"Flight - Turbulence decay with age (low = keeps swirling)\",\"default\":3.65,\"min\":0.05,\"max\":4,\"step\":0.01},{\"id\":\"clumpCohesion\",\"type\":\"number\",\"label\":\"Flight - Clump cohesion (shards orbit a leader; 0 = none)\",\"default\":0.9,\"min\":0,\"max\":10,\"step\":0.05},{\"id\":\"followObject\",\"type\":\"number\",\"label\":\"Flight - Shards follow the object motion for (s; 30 = whole flight)\",\"default\":30,\"min\":0,\"max\":30,\"step\":0.5,\"unit\":\"s\"},{\"id\":\"settleTime\",\"type\":\"number\",\"label\":\"Flight - Settle time (velocity is killed after this; 12 = never)\",\"default\":2.2,\"min\":0.3,\"max\":12,\"step\":0.05},{\"id\":\"settledDrift\",\"type\":\"number\",\"label\":\"Flight - Organic drift once settled (curl noise)\",\"default\":1,\"min\":0,\"max\":1,\"step\":0.005},{\"id\":\"maxSpeed\",\"type\":\"number\",\"label\":\"Flight - Speed cap\",\"default\":26.3,\"min\":1,\"max\":40,\"step\":0.1},{\"id\":\"repelStrength\",\"type\":\"number\",\"label\":\"Flight - Push out of the solid shape while it breaks\",\"default\":30,\"min\":0,\"max\":30,\"step\":0.1},{\"id\":\"repelRange\",\"type\":\"number\",\"label\":\"Flight - Push range outside the surface\",\"default\":0.97,\"min\":0.02,\"max\":2,\"step\":0.01},{\"id\":\"repelRadial\",\"type\":\"number\",\"label\":\"Flight - Push away from the shape centre (clears pockets and the hole)\",\"default\":17.5,\"min\":0,\"max\":60,\"step\":0.5},{\"id\":\"repelRadialRange\",\"type\":\"number\",\"label\":\"Flight - Radial push range (object radii)\",\"default\":3.3,\"min\":1,\"max\":4,\"step\":0.05},{\"id\":\"tumble\",\"type\":\"number\",\"label\":\"Flight - Tumble rate\",\"default\":1.05,\"min\":0,\"max\":12,\"step\":0.05},{\"id\":\"returnGroupStagger\",\"type\":\"number\",\"label\":\"Assembly - Regional delay (seconds)\",\"default\":1.35,\"min\":0,\"max\":1.5,\"step\":0.05,\"unit\":\"s\"},{\"id\":\"returnGroupScale\",\"type\":\"number\",\"label\":\"Assembly - Region / noise size\",\"default\":2.55,\"min\":0.1,\"max\":3,\"step\":0.05,\"description\":\"Larger values form broader connected patches. Noise is evaluated only on retarget.\"},{\"id\":\"returnGroupSeed\",\"type\":\"number\",\"label\":\"Return - Group timing seed\",\"default\":60765,\"min\":0,\"max\":65535,\"step\":1},{\"id\":\"formSpread\",\"type\":\"number\",\"label\":\"Return - Wave spread (nearest shards leave first, seconds)\",\"default\":0,\"min\":0,\"max\":4,\"step\":0.05,\"unit\":\"s\"},{\"id\":\"waveReach\",\"type\":\"number\",\"label\":\"Return - Distance over which the wave spreads\",\"default\":10,\"min\":0.2,\"max\":10,\"step\":0.1},{\"id\":\"formJitter\",\"type\":\"number\",\"label\":\"Return - Per-shard stagger (random delay up to this)\",\"default\":2.8,\"min\":0,\"max\":3,\"step\":0.05,\"unit\":\"s\"},{\"id\":\"formFill\",\"type\":\"number\",\"label\":\"Return - Fill-in rate for voxels no shard returns to\",\"default\":3,\"min\":0.05,\"max\":3,\"step\":0.05},{\"id\":\"returnSpring\",\"type\":\"number\",\"label\":\"Return - Spring stiffness\",\"default\":29.9,\"min\":0.5,\"max\":40,\"step\":0.1},{\"id\":\"returnDamping\",\"type\":\"number\",\"label\":\"Return - Spring damping\",\"default\":1.34,\"min\":0.2,\"max\":2,\"step\":0.01},{\"id\":\"returnRamp\",\"type\":\"number\",\"label\":\"Return - Spring ramp-in (seconds until it pulls at full strength)\",\"default\":0.45,\"min\":0,\"max\":3,\"step\":0.05},{\"id\":\"returnMaxSpeed\",\"type\":\"number\",\"label\":\"Return - Speed cap on the way home\",\"default\":60,\"min\":1,\"max\":60,\"step\":0.5},{\"id\":\"alignToSurface\",\"type\":\"number\",\"label\":\"Return - Shards turn to lie on the surface (0 = keep tumbling)\",\"default\":1,\"min\":0,\"max\":1,\"step\":0.01},{\"id\":\"alignCurve\",\"type\":\"number\",\"label\":\"Return - Alignment curve over the flight home (1 linear, higher = later)\",\"default\":3.75,\"min\":0.2,\"max\":4,\"step\":0.05},{\"id\":\"healRate\",\"type\":\"number\",\"label\":\"Return - Neighbour heal rate\",\"default\":3,\"min\":0.02,\"max\":3,\"step\":0.01},{\"id\":\"cellRestore\",\"type\":\"number\",\"label\":\"Return - Cell restore rate\",\"default\":60,\"min\":0,\"max\":60,\"step\":0.5},{\"id\":\"landedFade\",\"type\":\"number\",\"label\":\"Return - Landed shard fade\",\"default\":1.65,\"min\":0,\"max\":2,\"step\":0.01},{\"id\":\"refrostTime\",\"type\":\"number\",\"label\":\"Return - Refrost time\",\"default\":10.6,\"min\":0.2,\"max\":12,\"step\":0.1},{\"id\":\"keyColor\",\"type\":\"color\",\"label\":\"Light - Key colour\",\"default\":\"#f0f7ff\"},{\"id\":\"keyIntensity\",\"type\":\"number\",\"label\":\"Light - Key intensity\",\"default\":5.05,\"min\":0,\"max\":12,\"step\":0.05},{\"id\":\"keyElevation\",\"type\":\"number\",\"label\":\"Light - Key elevation\",\"default\":42,\"min\":10,\"max\":89,\"step\":0.5,\"unit\":\"deg\"},{\"id\":\"keyAzimuth\",\"type\":\"number\",\"label\":\"Light - Key azimuth\",\"default\":-38,\"min\":-90,\"max\":90,\"step\":0.5,\"unit\":\"deg\"},{\"id\":\"keySize\",\"type\":\"number\",\"label\":\"Light - Key size (softbox)\",\"default\":1.25,\"min\":0.2,\"max\":3,\"step\":0.01},{\"id\":\"fill\",\"type\":\"number\",\"label\":\"Light - Fill intensity (hemisphere, diffuse only: barely shows on clear ice)\",\"default\":0.18,\"min\":0,\"max\":1.5,\"step\":0.005},{\"id\":\"fillColor\",\"type\":\"color\",\"label\":\"Light - Fill sky colour\",\"default\":\"#cadde9\"},{\"id\":\"fillGroundColor\",\"type\":\"color\",\"label\":\"Light - Fill ground colour\",\"default\":\"#172635\"},{\"id\":\"rim\",\"type\":\"number\",\"label\":\"Light - Rim spot intensity\",\"default\":2.5,\"min\":0,\"max\":5,\"step\":0.01},{\"id\":\"rimColor\",\"type\":\"color\",\"label\":\"Light - Rim colour\",\"default\":\"#d9f1ff\"},{\"id\":\"rimElevation\",\"type\":\"number\",\"label\":\"Light - Rim elevation (0 = straight behind)\",\"default\":20,\"min\":0,\"max\":89,\"step\":0.5,\"unit\":\"deg\"},{\"id\":\"swayAmplitude\",\"type\":\"number\",\"label\":\"Light - Key sway amplitude\",\"default\":0,\"min\":0,\"max\":0.15,\"step\":0.001},{\"id\":\"swayPeriod\",\"type\":\"number\",\"label\":\"Light - Key sway period\",\"default\":35,\"min\":2,\"max\":40,\"step\":0.5,\"unit\":\"s\"},{\"id\":\"envSoftbox\",\"type\":\"number\",\"label\":\"Light - Environment softbox (the main light on glass)\",\"default\":1.1,\"min\":0,\"max\":3,\"step\":0.01},{\"id\":\"envRim\",\"type\":\"number\",\"label\":\"Light - Environment rim strip\",\"default\":1.4,\"min\":0,\"max\":3,\"step\":0.01},{\"id\":\"envFill\",\"type\":\"number\",\"label\":\"Light - Environment front fill\",\"default\":0.22,\"min\":0,\"max\":1,\"step\":0.005},{\"id\":\"backdropTop\",\"type\":\"color\",\"label\":\"Backdrop - Top colour\",\"default\":\"#050505\"},{\"id\":\"backdropMid\",\"type\":\"color\",\"label\":\"Backdrop - Mid colour\",\"default\":\"#050505\"},{\"id\":\"backdropBottom\",\"type\":\"color\",\"label\":\"Backdrop - Bottom colour\",\"default\":\"#050505\"},{\"id\":\"backdropCenterX\",\"type\":\"number\",\"label\":\"Backdrop - Bloom centre X\",\"default\":0.73,\"min\":0,\"max\":1,\"step\":0.005},{\"id\":\"backdropCenterY\",\"type\":\"number\",\"label\":\"Backdrop - Bloom centre Y\",\"default\":0.22,\"min\":0,\"max\":2,\"step\":0.005},{\"id\":\"backdropRadius\",\"type\":\"number\",\"label\":\"Backdrop - Bloom radius\",\"default\":0.8,\"min\":0.1,\"max\":2,\"step\":0.005},{\"id\":\"backdropFalloff\",\"type\":\"number\",\"label\":\"Backdrop - Bloom falloff\",\"default\":0.85,\"min\":0.5,\"max\":6,\"step\":0.01},{\"id\":\"backdropNoise\",\"type\":\"number\",\"label\":\"Backdrop - Dither noise\",\"default\":0,\"min\":0,\"max\":3,\"step\":0.05},{\"id\":\"bloomThreshold\",\"type\":\"number\",\"label\":\"Post - Bloom threshold\",\"default\":3,\"min\":0,\"max\":3,\"step\":0.01},{\"id\":\"bloomIntensity\",\"type\":\"number\",\"label\":\"Post - Bloom intensity\",\"default\":0.04,\"min\":0,\"max\":1.5,\"step\":0.005},{\"id\":\"bloomRadius\",\"type\":\"number\",\"label\":\"Post - Bloom radius\",\"default\":1,\"min\":0,\"max\":1,\"step\":0.005},{\"id\":\"monochrome\",\"type\":\"number\",\"label\":\"Post - Monochrome\",\"default\":0.04,\"min\":0,\"max\":1,\"step\":0.01},{\"id\":\"tonemap\",\"type\":\"enum\",\"label\":\"Post - Tonemap\",\"default\":\"aces\",\"options\":[{\"value\":\"agx\",\"label\":\"AgX\"},{\"value\":\"aces\",\"label\":\"ACES\"},{\"value\":\"neutral\",\"label\":\"Neutral\"},{\"value\":\"linear\",\"label\":\"Linear\"}]},{\"id\":\"exposure\",\"type\":\"number\",\"label\":\"Post - Exposure\",\"default\":1,\"min\":0.1,\"max\":4,\"step\":0.01},{\"id\":\"contrast\",\"type\":\"number\",\"label\":\"Post - Contrast\",\"default\":1.03,\"min\":0.6,\"max\":1.6,\"step\":0.005},{\"id\":\"blackLift\",\"type\":\"number\",\"label\":\"Post - Black lift\",\"default\":0,\"min\":0,\"max\":0.1,\"step\":0.001},{\"id\":\"vignetteStrength\",\"type\":\"number\",\"label\":\"Post - Vignette strength\",\"default\":0.14,\"min\":0,\"max\":1,\"step\":0.005},{\"id\":\"vignetteSoftness\",\"type\":\"number\",\"label\":\"Post - Vignette softness\",\"default\":1.2,\"min\":0.1,\"max\":1.5,\"step\":0.005},{\"id\":\"vignetteRadius\",\"type\":\"number\",\"label\":\"Post - Vignette radius\",\"default\":1.2,\"min\":0.2,\"max\":1.6,\"step\":0.005},{\"id\":\"grainStrength\",\"type\":\"number\",\"label\":\"Post - Film grain\",\"default\":0,\"min\":0,\"max\":0.15,\"step\":0.001},{\"id\":\"quality\",\"type\":\"enum\",\"label\":\"Performance - Quality profile\",\"default\":\"full\",\"options\":[{\"value\":\"full\",\"label\":\"Full (baked look; needs a real GPU)\"},{\"value\":\"lite\",\"label\":\"Lite (the source ?lite profile for software WebGPU)\"}]},{\"id\":\"upscaler\",\"type\":\"enum\",\"label\":\"Performance - Upscaler\",\"default\":\"fsr1\",\"options\":[{\"value\":\"fsr1\",\"label\":\"FSR 1 (TRAA + EASU/RCAS)\"},{\"value\":\"taau\",\"label\":\"TAAU\"},{\"value\":\"bilinear\",\"label\":\"Bilinear\"},{\"value\":\"native\",\"label\":\"Native (no upscale)\"}]},{\"id\":\"renderScale\",\"type\":\"number\",\"label\":\"Performance - Scene resolution scale (upscaled to 1080p)\",\"default\":1,\"min\":0.35,\"max\":1,\"step\":0.05},{\"id\":\"shapeResolution\",\"type\":\"enum\",\"label\":\"Shape voxel resolution\",\"default\":\"256\",\"options\":[{\"value\":\"128\",\"label\":\"128 — draft\"},{\"value\":\"256\",\"label\":\"256 — high\"},{\"value\":\"384\",\"label\":\"384 — ultra\"}],\"description\":\"Resolution of the logo and text distance fields. Rebuilds shapes; higher values increase startup time and memory. Independent of breakup resolution.\"},{\"id\":\"erosionResolution\",\"type\":\"enum\",\"label\":\"Performance - Erosion field resolution (voxels per axis)\",\"default\":\"96\",\"options\":[{\"value\":\"64\",\"label\":\"64\"},{\"value\":\"96\",\"label\":\"96\"},{\"value\":\"128\",\"label\":\"128\"},{\"value\":\"192\",\"label\":\"192 (baked)\"}]},{\"id\":\"particleCount\",\"type\":\"enum\",\"label\":\"Performance - Powder particles\",\"default\":\"100k\",\"options\":[{\"value\":\"100k\",\"label\":\"100k (baked)\"},{\"value\":\"250k\",\"label\":\"250k\"},{\"value\":\"500k\",\"label\":\"500k\"},{\"value\":\"1M\",\"label\":\"1M\"}]},{\"id\":\"logoMeshDetail\",\"type\":\"number\",\"label\":\"Shape - Logo mesh detail (1-4; higher = finer surface)\",\"default\":2,\"min\":1,\"max\":4,\"step\":1},{\"id\":\"deformStrength\",\"type\":\"number\",\"label\":\"Geometry - Ice deformation strength (0 = original)\",\"default\":0,\"min\":0,\"max\":0.08,\"step\":0.001},{\"id\":\"deformScale\",\"type\":\"number\",\"label\":\"Geometry - Noise feature size (larger = broader)\",\"default\":0.41,\"min\":0.001,\"max\":0.5,\"step\":0.001},{\"id\":\"deformSeed\",\"type\":\"number\",\"label\":\"Geometry - Deformation seed\",\"default\":7,\"min\":0,\"max\":65535,\"step\":1},{\"id\":\"rimAzimuth\",\"type\":\"number\",\"label\":\"Light - Rim azimuth\",\"default\":-146,\"min\":-180,\"max\":180,\"step\":1},{\"id\":\"rimAngle\",\"type\":\"number\",\"label\":\"Light - Rim beam angle\",\"default\":26,\"min\":10,\"max\":89,\"step\":1},{\"id\":\"rimSize\",\"type\":\"number\",\"label\":\"Light - Rim reflection size\",\"default\":0.45,\"min\":0.1,\"max\":3,\"step\":0.05},{\"id\":\"fillReflectionStrength\",\"type\":\"number\",\"label\":\"Light - Fill reflection strength\",\"default\":0.3,\"min\":0,\"max\":2,\"step\":0.01},{\"id\":\"accentCoolIntensity\",\"type\":\"number\",\"label\":\"Studio Cool accent - intensity\",\"default\":3.71,\"min\":0,\"max\":4,\"step\":0.01},{\"id\":\"accentCoolReflection\",\"type\":\"number\",\"label\":\"Studio Cool accent - reflection\",\"default\":2.31,\"min\":0,\"max\":3,\"step\":0.01},{\"id\":\"accentCoolElevation\",\"type\":\"number\",\"label\":\"Studio Cool accent - elevation\",\"default\":63,\"min\":-85,\"max\":85,\"step\":1},{\"id\":\"accentCoolAzimuth\",\"type\":\"number\",\"label\":\"Studio Cool accent - azimuth\",\"default\":22,\"min\":-180,\"max\":180,\"step\":1},{\"id\":\"accentCoolSize\",\"type\":\"number\",\"label\":\"Studio Cool accent - size\",\"default\":2.65,\"min\":0.1,\"max\":3,\"step\":0.05},{\"id\":\"accentCoolColor\",\"type\":\"color\",\"label\":\"Studio Cool accent - color\",\"default\":\"#ff5900\"},{\"id\":\"accentWarmIntensity\",\"type\":\"number\",\"label\":\"Studio Warm accent - intensity\",\"default\":2.99,\"min\":0,\"max\":4,\"step\":0.01},{\"id\":\"accentWarmReflection\",\"type\":\"number\",\"label\":\"Studio Warm accent - reflection\",\"default\":0.34,\"min\":0,\"max\":3,\"step\":0.01},{\"id\":\"accentWarmElevation\",\"type\":\"number\",\"label\":\"Studio Warm accent - elevation\",\"default\":30,\"min\":-85,\"max\":85,\"step\":1},{\"id\":\"accentWarmAzimuth\",\"type\":\"number\",\"label\":\"Studio Warm accent - azimuth\",\"default\":-30,\"min\":-180,\"max\":180,\"step\":1},{\"id\":\"accentWarmSize\",\"type\":\"number\",\"label\":\"Studio Warm accent - size\",\"default\":1.2,\"min\":0.1,\"max\":3,\"step\":0.05},{\"id\":\"accentWarmColor\",\"type\":\"color\",\"label\":\"Studio Warm accent - color\",\"default\":\"#75aaff\"},{\"id\":\"returnNoiseAmount\",\"type\":\"enum\",\"label\":\"Assembly - Regional pattern\",\"default\":\"2\",\"options\":[{\"value\":\"2\",\"label\":\"Travelling seam + organic spread\"},{\"value\":\"1\",\"label\":\"Smooth noise regions\"},{\"value\":\"0\",\"label\":\"Original cell groups\"}]},{\"id\":\"assemblyFrontDuration\",\"type\":\"number\",\"label\":\"Assembly - Growth duration (seconds)\",\"default\":3.2,\"min\":0,\"max\":6,\"step\":0.05},{\"id\":\"assemblyOriginX\",\"type\":\"number\",\"label\":\"Assembly - Growth start X\",\"default\":-0.65,\"min\":-1,\"max\":1,\"step\":0.01},{\"id\":\"assemblyOriginY\",\"type\":\"number\",\"label\":\"Assembly - Growth start Y\",\"default\":0.55,\"min\":-1,\"max\":1,\"step\":0.01},{\"id\":\"assemblyAngle\",\"type\":\"number\",\"label\":\"Assembly - Seam direction (degrees)\",\"default\":-35,\"min\":-180,\"max\":180,\"step\":1},{\"id\":\"assemblySpread\",\"type\":\"number\",\"label\":\"Assembly - Outward spread vs seam travel\",\"default\":0.65,\"min\":0,\"max\":1,\"step\":0.01},{\"id\":\"assemblyFrontNoise\",\"type\":\"number\",\"label\":\"Assembly - Growth edge irregularity\",\"default\":0.35,\"min\":0,\"max\":1,\"step\":0.01},{\"id\":\"assemblySpeedVariation\",\"type\":\"number\",\"label\":\"Assembly - Return speed variation\",\"default\":0.65,\"min\":0,\"max\":1,\"step\":0.01},{\"id\":\"assemblyBend\",\"type\":\"number\",\"label\":\"Assembly - Approach path bend\",\"default\":1.2,\"min\":0,\"max\":3,\"step\":0.05},{\"id\":\"assemblySwirl\",\"type\":\"number\",\"label\":\"Assembly - Approach twist\",\"default\":1.1,\"min\":0,\"max\":3,\"step\":0.05},{\"id\":\"assemblyLandingVariation\",\"type\":\"number\",\"label\":\"Assembly - Landing transition variation\",\"default\":0.8,\"min\":0,\"max\":1,\"step\":0.01},{\"id\":\"rendererProfile\",\"type\":\"enum\",\"label\":\"Renderer experiment (reload required)\",\"default\":\"studio\",\"options\":[{\"value\":\"original\",\"label\":\"Original glass + GPU startup\"},{\"value\":\"lookup\",\"label\":\"Original glass + material lookup\"},{\"value\":\"mesh\",\"label\":\"Mesh surface + original glass\"},{\"value\":\"studio\",\"label\":\"Studio glass approximation\"},{\"value\":\"matcap\",\"label\":\"Matcap glass approximation\"}]},{\"id\":\"textWidth\",\"type\":\"number\",\"label\":\"Type - Headline block width (the mark is 2.6 wide)\",\"default\":6.5,\"min\":1.2,\"max\":9,\"step\":0.05},{\"id\":\"textLineHeight\",\"type\":\"number\",\"label\":\"Type - Line height\",\"default\":0.95,\"min\":0.7,\"max\":1.4,\"step\":0.01,\"unit\":\"em\"},{\"id\":\"textDepth\",\"type\":\"number\",\"label\":\"Type - Extrusion depth (fraction of the font size)\",\"default\":0.16,\"min\":0.05,\"max\":0.8,\"step\":0.01},{\"id\":\"textBevel\",\"type\":\"number\",\"label\":\"Type - Bevel (fraction of the font size)\",\"default\":0.04,\"min\":0,\"max\":0.12,\"step\":0.005},{\"id\":\"textCorner\",\"type\":\"number\",\"label\":\"Type - Corner rounding (fraction of the font size)\",\"default\":0.008,\"min\":0,\"max\":0.06,\"step\":0.002},{\"id\":\"textMeshDetail\",\"type\":\"number\",\"label\":\"Type - Text mesh detail (1-4; higher = smoother deformation)\",\"default\":4,\"min\":1,\"max\":4,\"step\":1}]'\n data-composition-id=\"frost-sequence-rig\"\n data-start=\"0\"\n data-duration=\"22.5\"\n data-width=\"1920\"\n data-height=\"1080\"\n data-requires-webgpu=\"\"\n >\n <div\n data-hf-id=\"hf-5a64\"\n id=\"logo-position\"\n class=\"clip\"\n data-start=\"0\"\n data-duration=\"22.5\"\n data-track-index=\"1\"\n data-name=\"Logo · Position XYZ\"\n aria-label=\"Logo · Position XYZ\"\n ></div>\n <div\n data-hf-id=\"hf-fjc6\"\n id=\"logo-rotation\"\n class=\"clip\"\n data-start=\"0\"\n data-duration=\"22.5\"\n data-track-index=\"2\"\n data-name=\"Logo · Rotation XYZ\"\n aria-label=\"Logo · Rotation XYZ\"\n ></div>\n <div\n data-hf-id=\"hf-speh\"\n id=\"logo-breakup\"\n class=\"clip\"\n data-start=\"0\"\n data-duration=\"22.5\"\n data-track-index=\"3\"\n data-name=\"Logo · Breakup %\"\n aria-label=\"Logo · Breakup %\"\n ></div>\n <div\n data-hf-id=\"hf-k8ny\"\n id=\"logo-assembly\"\n class=\"clip\"\n data-start=\"0\"\n data-duration=\"22.5\"\n data-track-index=\"4\"\n data-name=\"Logo · Assembly %\"\n aria-label=\"Logo · Assembly %\"\n ></div>\n <div\n data-hf-id=\"hf-uxt2\"\n id=\"headline1-position\"\n class=\"clip\"\n data-start=\"0\"\n data-duration=\"22.5\"\n data-track-index=\"5\"\n data-name=\"First text · Position XYZ\"\n aria-label=\"First text · Position XYZ\"\n ></div>\n <div\n data-hf-id=\"hf-y4rq\"\n id=\"headline1-rotation\"\n class=\"clip\"\n data-start=\"0\"\n data-duration=\"22.5\"\n data-track-index=\"6\"\n data-name=\"First text · Rotation XYZ\"\n aria-label=\"First text · Rotation XYZ\"\n ></div>\n <div\n data-hf-id=\"hf-35xb\"\n id=\"headline1-breakup\"\n class=\"clip\"\n data-start=\"0\"\n data-duration=\"22.5\"\n data-track-index=\"7\"\n data-name=\"First text · Breakup %\"\n aria-label=\"First text · Breakup %\"\n ></div>\n <div\n data-hf-id=\"hf-4hde\"\n id=\"headline1-assembly\"\n class=\"clip\"\n data-start=\"0\"\n data-duration=\"22.5\"\n data-track-index=\"8\"\n data-name=\"First text · Assembly %\"\n aria-label=\"First text · Assembly %\"\n ></div>\n <div\n data-hf-id=\"hf-tyaz\"\n id=\"headline2-position\"\n class=\"clip\"\n data-start=\"0\"\n data-duration=\"22.5\"\n data-track-index=\"9\"\n data-name=\"Second text · Position XYZ\"\n aria-label=\"Second text · Position XYZ\"\n ></div>\n <div\n data-hf-id=\"hf-2lbw\"\n id=\"headline2-rotation\"\n class=\"clip\"\n data-start=\"0\"\n data-duration=\"22.5\"\n data-track-index=\"10\"\n data-name=\"Second text · Rotation XYZ\"\n aria-label=\"Second text · Rotation XYZ\"\n ></div>\n <div\n data-hf-id=\"hf-xk1d\"\n id=\"headline2-breakup\"\n class=\"clip\"\n data-start=\"0\"\n data-duration=\"22.5\"\n data-track-index=\"11\"\n data-name=\"Second text · Breakup %\"\n aria-label=\"Second text · Breakup %\"\n ></div>\n <div\n data-hf-id=\"hf-9dhs\"\n id=\"headline2-assembly\"\n class=\"clip\"\n data-start=\"0\"\n data-duration=\"22.5\"\n data-track-index=\"12\"\n data-name=\"Second text · Assembly %\"\n aria-label=\"Second text · Assembly %\"\n ></div>\n <div\n data-hf-id=\"hf-b04i\"\n id=\"camera-orbit\"\n class=\"clip\"\n data-start=\"0\"\n data-duration=\"22.5\"\n data-track-index=\"14\"\n data-name=\"Camera · Orbit Y\"\n aria-label=\"Camera · Orbit Y\"\n ></div>\n <div\n data-hf-id=\"hf-flyz\"\n id=\"scene-fade\"\n class=\"clip\"\n data-start=\"0\"\n data-duration=\"22.5\"\n data-track-index=\"13\"\n data-name=\"Scene · Fade out %\"\n aria-label=\"Scene · Fade out %\"\n ></div>\n </div>\n \n </body>\n</html>\n"}