1import{r as zs,j as zc}from"./leden-BJs2q7zj.js";import{_ as fo}from"./main-CgQCw2X6.js";var Ju=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mD(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gD=Object.create,Jf=Object.defineProperty,vD=Object.getOwnPropertyDescriptor,yD=Object.getOwnPropertyNames,xD=Object.getPrototypeOf,bD=Object.prototype.hasOwnProperty,wD=(e,t,i)=>t in e?Jf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,ol=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),SD=(e,t)=>{for(var i in t)Jf(e,i,{get:t[i],enumerable:!0})},_D=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of yD(t))!bD.call(e,s)&&s!==i&&Jf(e,s,{get:()=>t[s],enumerable:!(r=vD(t,s))||r.enumerable});return e},mo=(e,t,i)=>(i=e!=null?gD(xD(e)):{},_D(t||!e||!e.__esModule?Jf(i,"default",{value:e,enumerable:!0}):i,e)),Bc=(e,t,i)=>(wD(e,typeof t!="symbol"?t+"":t,i),i),AD=ol((e,t)=>{(function(i,r){typeof e=="object"?t.exports=r():typeof define=="function"&&define.amd?define(r):i.Alea=r()})(e,function(){return i.importState=function(s){var a=new i;return a.importState(s),a},i;function i(){return(function(s){var a=0,n=0,o=0,l=1;s.length==0&&(s=[+new Date]);var h=r();a=h(" "),n=h(" "),o=h(" ");for(var c=0;c<s.length;c++)a-=h(s[c]),a<0&&(a+=1),n-=h(s[c]),n<0&&(n+=1),o-=h(s[c]),o<0&&(o+=1);h=null;var u=function(){var d=2091639*a+l*23283064365386963e-26;return a=n,n=o,o=d-(l=d|0)};return u.next=u,u.uint32=function(){return u()*4294967296},u.fract53=function(){return u()+(u()*2097152|0)*11102230246251565e-32},u.version="Alea 0.9",u.args=s,u.exportState=function(){return[a,n,o,l]},u.importState=function(d){a=+d[0]||0,n=+d[1]||0,o=+d[2]||0,l=+d[3]||0},u})(Array.prototype.slice.call(arguments))}function r(){var s=4022871197,a=function(n){n=n.toString();for(var o=0;o<n.length;o++){s+=n.charCodeAt(o);var l=.02519603282416938*s;s=l>>>0,l-=s,l*=s,s=l>>>0,l-=s,s+=l*4294967296}return(s>>>0)*23283064365386963e-26};return a.version="Mash 0.9",a}})}),Z2=ol((e,t)=>{(function(i,r){typeof e=="object"&&typeof t<"u"?r(e):typeof define=="function"&&define.amd?define(["exports"],r):r((i=typeof globalThis<"u"?globalThis:i||self).SVDJS={})})(e,function(i){i.SVD=function(r,s,a,n,o){if(s=s===void 0||s,a=a===void 0||a,o=1e-64/(n=n||Math.pow(2,-52)),!r)throw new TypeError("Matrix a is not defined");var l,h,c,u,d,p,f,m,g,v,y,x,w=r[0].length,S=r.length;if(S<w)throw new TypeError("Invalid matrix: m < n");for(var b=[],E=[],_=[],A=s==="f"?S:w,C=v=f=0;C<S;C++)E[C]=new Array(A).fill(0);for(C=0;C<w;C++)_[C]=new Array(w).fill(0);var T,I=new Array(w).fill(0);for(C=0;C<S;C++)for(l=0;l<w;l++)E[C][l]=r[C][l];for(C=0;C<w;C++){for(b[C]=f,g=0,c=C+1,l=C;l<S;l++)g+=Math.pow(E[l][C],2);if(g<o)f=0;else for(m=(p=E[C][C])*(f=p<0?Math.sqrt(g):-Math.sqrt(g))-g,E[C][C]=p-f,l=c;l<w;l++){for(g=0,h=C;h<S;h++)g+=E[h][C]*E[h][l];for(p=g/m,h=C;h<S;h++)E[h][l]=E[h][l]+p*E[h][C]}for(I[C]=f,g=0,l=c;l<w;l++)g+=Math.pow(E[C][l],2);if(g<o)f=0;else{for(m=(p=E[C][C+1])*(f=p<0?Math.sqrt(g):-Math.sqrt(g))-g,E[C][C+1]=p-f,l=c;l<w;l++)b[l]=E[C][l]/m;for(l=c;l<S;l++){for(g=0,h=c;h<w;h++)g+=E[l][h]*E[C][h];for(h=c;h<w;h++)E[l][h]=E[l][h]+g*b[h]}}v<(y=Math.abs(I[C])+Math.abs(b[C]))&&(v=y)}if(a)for(C=w-1;0<=C;C--){if(f!==0){for(m=E[C][C+1]*f,l=c;l<w;l++)_[l][C]=E[C][l]/m;for(l=c;l<w;l++){for(g=0,h=c;h<w;h++)g+=E[C][h]*_[h][l];for(h=c;h<w;h++)_[h][l]=_[h][l]+g*_[h][C]}}for(l=c;l<w;l++)_[C][l]=0,_[l][C]=0;_[C][C]=1,f=b[C],c=C}if(s){if(s==="f")for(C=w;C<S;C++){for(l=w;l<S;l++)E[C][l]=0;E[C][C]=1}for(C=w-1;0<=C;C--){for(c=C+1,f=I[C],l=c;l<A;l++)E[C][l]=0;if(f!==0){for(m=E[C][C]*f,l=c;l<A;l++){for(g=0,h=c;h<S;h++)g+=E[h][C]*E[h][l];for(p=g/m,h=C;h<S;h++)E[h][l]=E[h][l]+p*E[h][C]}for(l=C;l<S;l++)E[l][C]=E[l][C]/f}else for(l=C;l<S;l++)E[l][C]=0;E[C][C]=E[C][C]+1}}for(n*=v,h=w-1;0<=h;h--)for(var P=0;P<50;P++){for(T=!1,c=h;0<=c;c--){if(Math.abs(b[c])<=n){T=!0;break}if(Math.abs(I[c-1])<=n)break}if(!T){for(d=0,u=c-(g=1),C=c;C<h+1&&(p=g*b[C],b[C]=d*b[C],!(Math.abs(p)<=n));
1C++)if(f=I[C],I[C]=Math.sqrt(p*p+f*f),d=f/(m=I[C]),g=-p/m,s)for(l=0;l<S;l++)y=E[l][u],x=E[l][C],E[l][u]=y*d+x*g,E[l][C]=-y*g+x*d}if(x=I[h],c===h){if(x<0&&(I[h]=-x,a))for(l=0;l<w;l++)_[l][h]=-_[l][h];break}for(v=I[c],p=(((y=I[h-1])-x)*(y+x)+((f=b[h-1])-(m=b[h]))*(f+m))/(2*m*y),f=Math.sqrt(p*p+1),p=((v-x)*(v+x)+m*(y/(p<0?p-f:p+f)-m))/v,C=c+(g=d=1);C<h+1;C++){if(f=b[C],y=I[C],m=g*f,f*=d,x=Math.sqrt(p*p+m*m),p=v*(d=p/(b[C-1]=x))+f*(g=m/x),f=-v*g+f*d,m=y*g,y*=d,a)for(l=0;l<w;l++)v=_[l][C-1],x=_[l][C],_[l][C-1]=v*d+x*g,_[l][C]=-v*g+x*d;if(x=Math.sqrt(p*p+m*m),p=(d=p/(I[C-1]=x))*f+(g=m/x)*y,v=-g*f+d*y,s)for(l=0;l<S;l++)y=E[l][C-1],x=E[l][C],E[l][C-1]=y*d+x*g,E[l][C]=-y*g+x*d}b[c]=0,b[h]=p,I[h]=v}for(C=0;C<w;C++)I[C]<n&&(I[C]=0);return{u:E,q:I,v:_}},i.VERSION="1.1.1",Object.defineProperty(i,"__esModule",{value:!0})})}),MD=ol((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=i;function i(r){if(r===null||r===!0||r===!1)return NaN;var s=Number(r);return isNaN(s)?s:s<0?Math.ceil(s):Math.floor(s)}t.exports=e.default}),ED=ol((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=i;function i(r){var s=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()));return s.setUTCFullYear(r.getFullYear()),r.getTime()-s.getTime()}t.exports=e.default}),CD=ol((e,t)=>{function i(a,n){function o(){this.constructor=a}o.prototype=n.prototype,a.prototype=new o}function r(a,n,o,l){this.message=a,this.expected=n,this.found=o,this.location=l,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,r)}i(r,Error),r.buildMessage=function(a,n){var o={literal:function(f){return'"'+h(f.text)+'"'},class:function(f){var m="",g;for(g=0;g<f.parts.length;g++)m+=f.parts[g]instanceof Array?c(f.parts[g][0])+"-"+c(f.parts[g][1]):c(f.parts[g]);return"["+(f.inverted?"^":"")+m+"]"},any:function(f){return"any character"},end:function(f){return"end of input"},other:function(f){return f.description}};function l(f){return f.charCodeAt(0).toString(16).toUpperCase()}function h(f){return f.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(m){return"\\x0"+l(m)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(m){return"\\x"+l(m)})}function c(f){return f.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(m){return"\\x0"+l(m)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(m){return"\\x"+l(m)})}function u(f){return o[f.type](f)}function d(f){var m=new Array(f.length),g,v;for(g=0;g<f.length;g++)m[g]=u(f[g]);if(m.sort(),m.length>0){for(g=1,v=1;g<m.length;g++)m[g-1]!==m[g]&&(m[v]=m[g],v++);m.length=v}switch(m.length){case 1:return m[0];case 2:return m[0]+" or "+m[1];default:return m.slice(0,-1).join(", ")+", or "+m[m.length-1]}}function p(f){return f?'"'+h(f)+'"':"end of input"}return"Expected "+d(a)+" but "+p(n)+" found."};function s(a,n){n=n!==void 0?n:{};var o={},l={svg_path:hi},h=hi,c=function(D){if(!D)return[];for(var L=[],Y=0;Y<D.length;Y++)L=L.concat.apply(L,D[Y]);var F=L[0];return F&&F.code=="m"&&(delete F.relative,F.code="M"),L},u=function(D,L){return Da(D,L)},d=/^[Mm]/,p=Le(["M","m"],!1,!1),f=function(D,L,Y){var F=Xs(D,[L]);return Y&&(F=F.concat(Xs(D=="M"?"L":"l",Y[1]))),F},m=/^[Zz]/,g=Le(["Z","z"],!1,!1),v=function(){return Xs("Z")},y=/^[Ll]/,x=Le(["L","l"],!1,!1),w=function(D,L){return Xs(D,L)},S=/^[Hh]/,b=Le(["H","h"],!1,!1),E=function(D,L){return Xs(D,L.map(function(Y){return{x:Y}}))},_=/^[Vv]/,A=Le(["V","v"],!1,!1),C=function(D,L){return Xs(D,L.map(function(Y){return{y:Y}}))},T=/^[Cc]/,I=Le(["C","c"],!1,!1),P=function(D,L,Y){return{x1:D.x,y1:D.y,x2:L.x,y2:L.y,x:Y.x,y:Y.y}},O=/^[Ss]/,k=Le(["S","s"],!1,!1),G=function(D,L){return{x2:D.x,y2:D.y,x:L.x,y:L.y}},B=/^[Qq]/,U=Le(["Q","q"],!1,!1),Q=function(D,L){return{x1:D.x,y1:D.y,x:L.x,y:L.y}},q=/^[Tt]/,j=Le(["T","t"],!1,!1),X=/^[Aa]/,te=Le(["A","a"],!1,!1),K=function(D,L,Y,F,ee,_e){return{rx:D,ry:L,xAxisRotation:Y,largeArc:F,sweep:ee,x:_e.x,y:_e.y}},Z=function(D,L){return{x:D,y:L}},W=function(D){return D*1},re=function(D){return D.join("")*1},$=/^[01]/,ne=Le(["0","1"],!1,!1),ie=function(D){return D=="1"},ve=function(){return""},de=",",we=je(",",!1),Re=function(D){return D.join("")},Me=".",Ve=je(".",!1),Ne=/^[eE]/,Oe=Le(["e","E"],!1,!1),Ee=/^[+\-]/,Qe=Le(["+","-"],!1,!1),qe=/^[0-9]/,V=Le([["0","9"]],!1,!1),z=function(D){return D.join("")},oe=/^[ \t\n\r]/,Se=Le([" "," ",` 2`,"\r"],!1,!1),R=0,Ae=[{line:1,column:1}],ke=0,Ie=[],ce;if("startRule"in n){if(!(n.startRule in l))throw new Error(`Can't start parsing from rule "`+n.startRule+'".');h=l[n.startRule]}function je(D,L){return{type:"literal",text:D,ignoreCase:L}}function Le(D,L,Y){return{type:"class",parts:D,inverted:L,ignoreCase:Y}}function Xe(){return{type:"end"}}function it(D){var L=Ae[D],Y;if(L)return L;for(Y=D-1;!Ae[Y];)Y--;for(L=Ae[Y],L={line:L.line,column:L.column};Y<D;
vendor: 12,396 bytes, line 2
2)a.charCodeAt(Y)===10?(L.line++,L.column=1):L.column++,Y++;return Ae[D]=L,L}function Ke(D,L){var Y=it(D),F=it(L);return{start:{offset:D,line:Y.line,column:Y.column},end:{offset:L,line:F.line,column:F.column}}}function $e(D){R<ke||(R>ke&&(ke=R,Ie=[]),Ie.push(D))}function qt(D,L,Y){return new r(r.buildMessage(D,L),D,L,Y)}function hi(){var D,L,Y,F,ee;for(D=R,L=[],Y=_t();Y!==o;)L.push(Y),Y=_t();if(L!==o)if(Y=J(),Y===o&&(Y=null),Y!==o){for(F=[],ee=_t();ee!==o;)F.push(ee),ee=_t();F!==o?(L=c(Y),D=L):(R=D,D=o)}else R=D,D=o;else R=D,D=o;return D}function J(){var D,L,Y,F,ee,_e;if(D=R,L=fe(),L!==o){for(Y=[],F=R,ee=[],_e=_t();_e!==o;)ee.push(_e),_e=_t();for(ee!==o?(_e=fe(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);F!==o;){for(Y.push(F),F=R,ee=[],_e=_t();_e!==o;)ee.push(_e),_e=_t();ee!==o?(_e=fe(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o)}Y!==o?(L=u(L,Y),D=L):(R=D,D=o)}else R=D,D=o;return D}function fe(){var D,L,Y,F,ee,_e;if(D=R,L=ze(),L!==o){for(Y=[],F=R,ee=[],_e=_t();_e!==o;)ee.push(_e),_e=_t();for(ee!==o?(_e=be(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);F!==o;){for(Y.push(F),F=R,ee=[],_e=_t();_e!==o;)ee.push(_e),_e=_t();ee!==o?(_e=be(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o)}Y!==o?(L=u(L,Y),D=L):(R=D,D=o)}else R=D,D=o;return D}function be(){var D;return D=lt(),D===o&&(D=Et(),D===o&&(D=Ki(),D===o&&(D=$t(),D===o&&(D=Ss(),D===o&&(D=Tm(),D===o&&(D=N(),D===o&&(D=ae(),D===o&&(D=Ge())))))))),D}function ze(){var D,L,Y,F,ee,_e,Oa;if(D=R,d.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,$e(p)),L!==o){for(Y=[],F=_t();F!==o;)Y.push(F),F=_t();Y!==o?(F=et(),F!==o?(ee=R,_e=vt(),_e===o&&(_e=null),_e!==o?(Oa=xi(),Oa!==o?(_e=[_e,Oa],ee=_e):(R=ee,ee=o)):(R=ee,ee=o),ee===o&&(ee=null),ee!==o?(L=f(L,F,ee),D=L):(R=D,D=o)):(R=D,D=o)):(R=D,D=o)}else R=D,D=o;return D}function lt(){var D,L;return D=R,m.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,$e(g)),L!==o&&(L=v()),D=L,D}function Et(){var D,L,Y,F;if(D=R,y.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,$e(x)),L!==o){for(Y=[],F=_t();F!==o;)Y.push(F),F=_t();Y!==o?(F=xi(),F!==o?(L=w(L,F),D=L):(R=D,D=o)):(R=D,D=o)}else R=D,D=o;return D}function xi(){var D,L,Y,F,ee,_e;if(D=R,L=et(),L!==o){for(Y=[],F=R,ee=vt(),ee===o&&(ee=null),ee!==o?(_e=et(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);F!==o;)Y.push(F),F=R,ee=vt(),ee===o&&(ee=null),ee!==o?(_e=et(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);Y!==o?(L=u(L,Y),D=L):(R=D,D=o)}else R=D,D=o;return D}function Ki(){var D,L,Y,F;if(D=R,S.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,$e(b)),L!==o){for(Y=[],F=_t();F!==o;)Y.push(F),F=_t();Y!==o?(F=qs(),F!==o?(L=E(L,F),D=L):(R=D,D=o)):(R=D,D=o)}else R=D,D=o;return D}function qs(){var D,L,Y,F,ee,_e;if(D=R,L=bt(),L!==o){for(Y=[],F=R,ee=vt(),ee===o&&(ee=null),ee!==o?(_e=bt(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);F!==o;)Y.push(F),F=R,ee=vt(),ee===o&&(ee=null),ee!==o?(_e=bt(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);Y!==o?(L=u(L,Y),D=L):(R=D,D=o)}else R=D,D=o;return D}function $t(){var D,L,Y,F;if(D=R,_.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,$e(A)),L!==o){for(Y=[],F=_t();F!==o;)Y.push(F),F=_t();Y!==o?(F=qs(),F!==o?(L=C(L,F),D=L):(R=D,D=o)):(R=D,D=o)}else R=D,D=o;return D}function Ss(){var D,L,Y,F;if(D=R,T.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,$e(I)),L!==o){for(Y=[],F=_t();F!==o;)Y.push(F),F=_t();Y!==o?(F=Ur(),F!==o?(L=w(L,F),D=L):(R=D,D=o)):(R=D,D=o)}else R=D,D=o;return D}function Ur(){var D,L,Y,F,ee,_e;if(D=R,L=pl(),L!==o){for(Y=[],F=R,ee=vt(),ee===o&&(ee=null),ee!==o?(_e=pl(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);F!==o;)Y.push(F),F=R,ee=vt(),ee===o&&(ee=null),ee!==o?(_e=pl(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);Y!==o?(L=u(L,Y),D=L):(R=D,D=o)}else R=D,D=o;return D}function pl(){var D,L,Y,F,ee,_e;return D=R,L=et(),L!==o?(Y=vt(),Y===o&&(Y=null),Y!==o?(F=et(),F!==o?(ee=vt(),ee===o&&(ee=null),ee!==o?(_e=et(),_e!==o?(L=P(L,F,_e),D=L):(R=D,D=o)):(R=D,D=o)):(R=D,D=o)):(R=D,D=o)):(R=D,D=o),D}function Tm(){var D,L,Y,F;if(D=R,O.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,$e(k)),L!==o){for(Y=[],F=_t();F!==o;)Y.push(F),F=_t();Y!==o?(F=Pm(),F!==o?(L=w(L,F),D=L):(R=D,D=o)):(R=D,D=o)}else R=D,D=o;return D}function Pm(){var D,L,Y,F,ee,_e;if(D=R,L=ic(),L!==o){for(Y=[],F=R,ee=vt(),ee===o&&(ee=null),ee!==o?(_e=ic(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);F!==o;)Y.push(F),F=R,ee=vt(),ee===o&&(ee=null),ee!==o?(_e=ic(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);Y!==o?(L=u(L,Y),D=L):(R=D,D=o)}else R=D,D=o;return D}function ic(){var D,L,Y,F;return D=R,L=et(),L!==o?(Y=vt(),Y===o&&(Y=null),Y!==o?(F=et(),F!==o?(L=G(L,F),D=L):(R=D,D=o)):(R=D,D=o)):(R=D,D=o),D}function N(){var D,L,Y,F;if(D=R,B.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,$e(U)),L!==o){for(Y=[],F=_t();F!==o;)Y.push(F),F=_t();Y!==o?(F=le(),F!==o?(L=w(L,F),D=L):(R=D,D=o)):(R=D,D=o)}else R=D,D=o;return D}function le(){var D,L,Y,F,ee,_e;if(D=R,L=pe(),L!==o){for(Y=[],F=R,ee=vt(),ee===o&&(ee=null),ee!==o?(_e=pe(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);F!==o;)Y.push(F),F=R,ee=vt(),ee===o&&(ee=null),ee!==o?(_e=pe(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);Y!==o?(L=u(L,Y),D=L):(R=D,D=o)}else R=D,D=o;return D}function pe(){var D,L,Y,F;return D=R,L=et(),L!==o?(Y=vt(),Y===o&&(Y=null),Y!==o?(F=et(),F!==o?(L=Q(L,F),D=L):(R=D,D=o)):(R=D,D=o)):(R=D,D=o),D}function ae(){var D,L,Y,F;if(D=R,q.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,$e(j)),L!==o){for(Y=[],F=_t();F!==o;)Y.push(F),F=_t();Y!==o?(F=me(),F!==o?(L=w(L,F),D=L):(R=D,D=o)):(R=D,D=o)}else R=D,D=o;return D}function me(){var D,L,Y,F,ee,_e;if(D=R,L=et(),L!==o){for(Y=[],F=R,ee=vt(),ee===o&&(ee=null),ee!==o?(_e=et(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);F!==o;)Y.push(F),F=R,ee=vt(),ee===o&&(ee=null),ee!==o?(_e=et(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);Y!==o?(L=u(L,Y),D=L):(R=D,D=o)}else R=D,D=o;return D}function Ge(){var D,L,Y,F;if(D=R,X.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,$e(te)),L!==o){for(Y=[],F=_t();F!==o;)Y.push(F),F=_t();Y!==o?(F=ut(),F!==o?(L=w(L,F),D=L):(R=D,D=o)):(R=D,D=o)}else R=D,D=o;return D}function ut(){var D,L,Y,F,ee,_e;if(D=R,L=pt(),L!==o){for(Y=[],F=R,ee=vt(),ee===o&&(ee=null),ee!==o?(_e=pt(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);F!==o;)Y.push(F),F=R,ee=vt(),ee===o&&(ee=null),ee!==o?(_e=pt(),_e!==o?(ee=[ee,_e],F=ee):(R=F,F=o)):(R=F,F=o);Y!==o?(L=u(L,Y),D=L):(R=D,D=o)}else R=D,D=o;return D}function pt(){var D,L,Y,F,ee,_e,Oa,Dm,Ku,Om,Zu,Im;return D=R,L=zt(),L!==o?(Y=vt(),Y===o&&(Y=null),Y!==o?(F=zt(),F!==o?(ee=vt(),ee===o&&(ee=null),ee!==o?(_e=bt(),_e!==o?(Oa=vt(),Oa!==o?(Dm=wt(),Dm!==o?(Ku=vt(),Ku===o&&(Ku=null),Ku!==o?(Om=wt(),Om!==o?(Zu=vt(),Zu===o&&(Zu=null),Zu!==o?(Im=et(),Im!==o?(L=K(L,F,_e,Dm,Om,Im),D=L):(R=D,D=o)):(R=D,D=o)):(R=D,D=o)):(R=D,D=o)):(R=D,D=o)):(R=D,D=o)):(R=D,D=o)):(R=D,D=o)):(R=D,D=o)):(R=D,D=o)):(R=D,D=o),D}function et(){var D,L,Y,F;return D=R,L=bt(),L!==o?(Y=vt(),Y===o&&(Y=null),Y!==o?(F=bt(),F!==o?(L=Z(L,F),D=L):(R=D,D=o)):(R=D,D=o)):(R=D,D=o),D}function zt(){var D,L;return D=R,L=as(),L===o&&(L=_s()),L!==o&&(L=W(L)),D=L,D}function bt(){var D,L,Y,F;return D=R,L=R,Y=At(),Y===o&&(Y=null),Y!==o?(F=as(),F!==o?(Y=[Y,F],L=Y):(R=L,L=o)):(R=L,L=o),L===o&&(L=R,Y=At(),Y===o&&(Y=null),Y!==o?(F=_s(),F!==o?(Y=[Y,F],L=Y):(R=L,L=o)):(R=L,L=o)),L!==o&&(L=re(L)),D=L,D}function wt(){var D,L;return D=R,$.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,$e(ne)),L!==o&&(L=ie(L)),D=L,D}function vt(){var D,L,Y,F,ee;if(D=R,L=[],Y=_t(),Y!==o)for(;Y!==o;)L.push(Y),Y=_t();else L=o;if(L!==o)if(Y=Fi(),Y===o&&(Y=null),Y!==o){for(F=[],ee=_t();ee!==o;)F.push(ee),ee=_t();F!==o?(L=[L,Y,F],D=L):(R=D,D=o)}else R=D,D=o;else R=D,D=o;if(D===o){if(D=R,L=R,Y=Fi(),Y!==o){for(F=[],ee=_t();ee!==o;)F.push(ee),ee=_t();F!==o?(Y=[Y,F],L=Y):(R=L,L=o)}else R=L,L=o;L!==o&&(L=ve()),D=L}return D}function Fi(){var D;return a.charCodeAt(R)===44?(D=de,R++):(D=o,$e(we)),D}function as(){var D,L,Y,F;return D=R,L=R,Y=Pa(),Y!==o?(F=ci(),F===o&&(F=null),F!==o?(Y=[Y,F],L=Y):(R=L,L=o)):(R=L,L=o),L===o&&(L=R,Y=_s(),Y!==o?(F=ci(),F!==o?(Y=[Y,F],L=Y):(R=L,L=o)):(R=L,L=o)),L!==o&&(L=Re(L)),D=L,D}function Pa(){var D,L,Y,F,ee;return D=R,L=R,Y=_s(),Y===o&&(Y=null),Y!==o?(a.charCodeAt(R)===46?(F=Me,R++):(F=o,$e(Ve)),F!==o?(ee=_s(),ee!==o?(Y=[Y,F,ee],L=Y):(R=L,L=o)):(R=L,L=o)):(R=L,L=o),L===o&&(L=R,Y=_s(),Y!==o?(a.charCodeAt(R)===46?(F=Me,R++):(F=o,$e(Ve)),F!==o?(Y=[Y,F],L=Y):(R=L,L=o)):(R=L,L=o)),L!==o&&(L=Re(L)),D=L,D}function ci(){var D,L,Y,F,ee;return D=R,L=R,Ne.test(a.charAt(R))?(Y=a.charAt(R),R++):(Y=o,$e(Oe)),Y!==o?(F=At(),F===o&&(F=null),F!==o?(ee=_s(),ee!==o?(Y=[Y,F,ee],L=Y):(R=L,L=o)):(R=L,L=o)):(R=L,L=o),L!==o&&(L=Re(L)),D=L,D}function At(){var D;return Ee.test(a.charAt(R))?(D=a.charAt(R),R++):(D=o,$e(Qe)),D}function _s(){var D,L,Y;if(D=R,L=[],qe.test(a.charAt(R))?(Y=a.charAt(R),R++):(Y=o,$e(V)),Y!==o)for(;Y!==o;)L.push(Y),qe.test(a.charAt(R))?(Y=a.charAt(R),R++):(Y=o,$e(V));else L=o;return L!==o&&(L=z(L)),D=L,D}function _t(){var D,L;return D=R,oe.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,$e(Se)),L!==o&&(L=ve()),D=L,D}function Da(D,L){if(!L)return[D];for(var Y=[D],F=0,ee=L.length;F<ee;F++)Y[F+1]=L[F][1];return Y}var xo={m:"moveto",l:"lineto",h:"horizontal lineto",v:"vertical lineto",c:"curveto",s:"smooth curveto",q:"quadratic curveto",t:"smooth quadratic curveto",a:"elliptical arc",z:"closepath"};for(var wn in xo)xo[wn.toUpperCase()]=xo[wn];function Xs(D,L){L||(L=[{}]);for(var Y=L.length;Y--;){var F={code:D,command:xo[D]};D==D.toLowerCase()&&(F.relative=!0);for(var ee in L[Y])F[ee]=L[Y][ee];L[Y]=F}return L}if(ce=h(),ce!==o&&R===a.length)return ce;throw ce!==o&&R<a.length&&$e(Xe()),qt(Ie,ke<a.length?a.charAt(ke):null,ke<a.length?Ke(ke,ke+1):Ke(ke,ke))}t.exports={SyntaxError:r,parse:s}}),J2=ol((e,t)=>{var i=CD().parse;i.parseSVG=i,i.makeAbsolute=r,t.exports=i;function r(s){var a,n={x:0,y:0},o={x:"x0",y:"y0",x1:"x0",y1:"y0",x2:"x0",y2:"y0"};return s.forEach(function(l){l.command==="moveto"&&(a=l),l.x0=n.x,l.y0=n.y;for(var h in o)h in l&&(l[h]+=l.relative?l[o[h]]:0);"x"in l||(l.x=n.x),"y"in l||(l.y=n.y),l.relative=!1,l.code=l.code.toUpperCase(),l.command=="closepath"&&(l.x=a.x,l.y=a.y),n=l}),s}}),TD=ol((e,t)=>{t.exports=function(i,r){for(var s=i.split("."),a=r.split("."),n=0;n<3;n++){var o=Number(s[n]),l=Number(a[n]);if(o>l)return 1;if(l>o)return-1;if(!isNaN(o)&&isNaN(l))return 1;if(isNaN(o)&&!isNaN(l))return-1}return 0}}),Uh="149",ns={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},PD=0,Ux=1,DD=2,Yy=1,OD=2,Fc=3,Vs=0,sr=1,Ar=2,Ri=0,Wo=1,Nx=2,Vx=3,jx=4,ID=5,Xl=100,RD=101,LD=102,Hx=103,Gx=104,zD=200,BD=201,FD=202,kD=203,$2=204,eM=205,UD=206,ND=207,VD=208,jD=209,HD=210,GD=0,WD=1,qD=2,Vv=3,XD=4,YD=5,QD=6,KD=7,tM=0,ZD=1,JD=2,ya=0,$D=1,e3=2,t3=3,i3=4,r3=5,iM=300,Jo=301,$o=302,jv=303,Hv=304,Lu=306,rn=1e3,si=1001,Gv=1002,St=1003,Wx=1004,Rm=1005,xt=1006,s3=1007,Sh=1008,Mr=1009,a3=1010,n3=1011,rM=1012,o3=1013,sn=1014,Ht=1015,dn=1016,l3=1017,h3=1018,qo=1020,c3=1021,oi=1023,u3=1024,d3=1025,Xo=1026,el=1027,Mp=1028,p3=1029,Hp=1030,f3=1031,sM=1033,Lm=33776,zm=33777,Bm=33778,Fm=33779,qx=35840,Xx=35841,Yx=35842,Qx=35843,m3=36196,Kx=37492,Zx=37496,Jx=37808,$x=37809,eb=37810,tb=37811,ib=37812,rb=37813,sb=37814,ab=37815,nb=37816,ob=37817,lb=37818,hb=37819,cb=37820,ub=37821,km=36492,g3=36283,db=36284,pb=36285,fb=36286,aM=2200,nM=2201,Qy=2202,Gp=2300,Wp=2301,Um=2302,th=2400,ih=2401,qp=2402,Ky=2500,v3=2501,js=3e3,gt=3001,xn=3200,oM=3201,y3=0,x3=1,oa="srgb",Xp="srgb-linear",Nm=7680,b3=519,Wv=35044,w3=35048,qv="300 es",Xv=1035,or=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;let i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let i=this._listeners[e];if(i!==void 0){let r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let t=this._listeners[e.type];if(t!==void 0){e.target=this;let i=t.slice(0);for(let r=0,s=i.length;r<s;r++)i[r].call(this,e);e.target=null}}},br=["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","5
25","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"],mb=1234567,Xc=Math.PI/180,uu=180/Math.PI;function xs(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(br[e&255]+br[e>>8&255]+br[e>>16&255]+br[e>>24&255]+"-"+br[t&255]+br[t>>8&255]+"-"+br[t>>16&15|64]+br[t>>24&255]+"-"+br[i&63|128]+br[i>>8&255]+"-"+br[i>>16&255]+br[i>>24&255]+br[r&255]+br[r>>8&255]+br[r>>16&255]+br[r>>24&255]).toLowerCase()}function Pi(e,t,i){return Math.max(t,Math.min(i,e))}function Zy(e,t){return(e%t+t)%t}function S3(e,t,i,r,s){return r+(e-t)*(s-r)/(i-t)}function _3(e,t,i){return e!==t?(i-e)/(t-e):0}function Yc(e,t,i){return(1-i)*e+i*t}function A3(e,t,i,r){return Yc(e,t,1-Math.exp(-i*r))}function M3(e,t=1){return t-Math.abs(Zy(e,t*2)-t)}function E3(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t),e*e*(3-2*e))}function C3(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t),e*e*e*(e*(e*6-15)+10))}function T3(e,t){return e+Math.floor(Math.random()*(t-e+1))}function P3(e,t){return e+Math.random()*(t-e)}function D3(e){return e*(.5-Math.random())}function O3(e){e!==void 0&&(mb=e);let t=mb+=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 I3(e){return e*Xc}function R3(e){return e*uu}function Yv(e){return(e&e-1)===0&&e!==0}function lM(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Yp(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function L3(e,t,i,r,s){let a=Math.cos,n=Math.sin,o=a(i/2),l=n(i/2),h=a((t+r)/2),c=n((t+r)/2),u=a((t-r)/2),d=n((t-r)/2),p=a((r-t)/2),f=n((r-t)/2);switch(s){case"XYX":e.set(o*c,l*u,l*d,o*h);break;case"YZY":e.set(l*d,o*c,l*u,o*h);break;case"ZXZ":e.set(l*u,l*d,o*c,o*h);break;case"XZX":e.set(o*c,l*f,l*p,o*h);break;case"YXY":e.set(l*p,o*c,l*f,o*h);break;case"ZYZ":e.set(l*f,l*p,o*c,o*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function an(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function Kt(e,t){switch(t.constructor){case Float32Array:return e;case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw new Error("Invalid component type.")}}var Te=Object.freeze({__proto__:null,DEG2RAD:Xc,RAD2DEG:uu,ceilPowerOfTwo:lM,clamp:Pi,damp:A3,degToRad:I3,denormalize:an,euclideanModulo:Zy,floorPowerOfTwo:Yp,generateUUID:xs,inverseLerp:_3,isPowerOfTwo:Yv,lerp:Yc,mapLinear:S3,normalize:Kt,pingpong:M3,radToDeg:R3,randFloat:P3,randFloatSpread:D3,randInt:T3,seededRandom:O3,setQuaternionFromProperEuler:L3,smootherstep:C3,smoothstep:E3}),H=class{constructor(e=0,t=0){H.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 6,085 bytes, line 2
2sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Ii=class{constructor(){Ii.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,i,r,s,a,n,o,l){let h=this.elements;return h[0]=e,h[1]=r,h[2]=n,h[3]=t,h[4]=s,h[5]=o,h[6]=i,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,s=this.elements,a=i[0],n=i[3],o=i[6],l=i[1],h=i[4],c=i[7],u=i[2],d=i[5],p=i[8],f=r[0],m=r[3],g=r[6],v=r[1],y=r[4],x=r[7],w=r[2],S=r[5],b=r[8];return s[0]=a*f+n*v+o*w,s[3]=a*m+n*y+o*S,s[6]=a*g+n*x+o*b,s[1]=l*f+h*v+c*w,s[4]=l*m+h*y+c*S,s[7]=l*g+h*x+c*b,s[2]=u*f+d*v+p*w,s[5]=u*m+d*y+p*S,s[8]=u*g+d*x+p*b,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],n=e[5],o=e[6],l=e[7],h=e[8];return t*a*h-t*n*l-i*s*h+i*n*o+r*s*l-r*a*o}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],n=e[5],o=e[6],l=e[7],h=e[8],c=h*a-n*l,u=n*o-h*s,d=l*s-a*o,p=t*c+i*u+r*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=c*f,e[1]=(r*l-h*i)*f,e[2]=(n*i-r*a)*f,e[3]=u*f,e[4]=(h*t-r*o)*f,e[5]=(r*s-n*t)*f,e[6]=d*f,e[7]=(i*o-l*t)*f,e[8]=(a*t-i*s)*f,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,a,n){let o=Math.cos(s),l=Math.sin(s);return this.set(i*o,i*l,-i*(o*a+l*n)+a+e,-r*l,r*o,-r*(-l*a+o*n)+n+t,0,0,1),this}scale(e,t){return this.premultiply(Vm.makeScale(e,t)),this}rotate(e){return this.premultiply(Vm.makeRotation(-e)),this}translate(e,t){return this.premultiply(Vm.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}},Vm=new Ii;function hM(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}var z3={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function $u(e,t){return new z3[e](t)}function du(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function B3(e,t,i){return new Promise(function(r,s){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:s();break;case e.TIMEOUT_EXPIRED:setTimeout(a,i);break;default:r()}}setTimeout(a,i)})}function Yo(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}
vendor: 12,708 bytes, line 2
2function Ep(e){return e<.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}var jm={[oa]:{[Xp]:Yo},[Xp]:{[oa]:Ep}},Cr={legacyMode:!0,get workingColorSpace(){return Xp},set workingColorSpace(e){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(e,t,i){if(this.legacyMode||t===i||!t||!i)return e;if(jm[t]&&jm[t][i]!==void 0){let r=jm[t][i];return e.r=r(e.r),e.g=r(e.g),e.b=r(e.b),e}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)}},cM={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},ki={r:0,g:0,b:0},As={h:0,s:0,l:0},ed={h:0,s:0,l:0};function Hm(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+(t-e)*6*i:i<1/2?t:i<2/3?e+(t-e)*6*(2/3-i):e}function td(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}var Je=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&i===void 0?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=oa){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Cr.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Cr.workingColorSpace){return this.r=e,this.g=t,this.b=i,Cr.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Cr.workingColorSpace){if(e=Zy(e,1),t=Pi(t,0,1),i=Pi(i,0,1),t===0)this.r=this.g=this.b=i;else{let s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=Hm(a,s,e+1/3),this.g=Hm(a,s,e),this.b=Hm(a,s,e-1/3)}return Cr.toWorkingColorSpace(this,r),this}setStyle(e,t=oa){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let s,a=r[1],n=r[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 this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,Cr.toWorkingColorSpace(this,t),i(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,Cr.toWorkingColorSpace(this,t),i(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n)){let o=parseFloat(s[1])/360,l=parseFloat(s[2])/100,h=parseFloat(s[3])/100;return i(s[4]),this.setHSL(o,l,h,t)}break}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let s=r[1],a=s.length;if(a===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,Cr.toWorkingColorSpace(this,t),this;if(a===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,Cr.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=oa){let i=cM[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Yo(e.r),this.g=Yo(e.g),this.b=Yo(e.b),this}copyLinearToSRGB(e){return this.r=Ep(e.r),this.g=Ep(e.g),this.b=Ep(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=oa){return Cr.fromWorkingColorSpace(td(this,ki),e),Pi(ki.r*255,0,255)<<16^Pi(ki.g*255,0,255)<<8^Pi(ki.b*255,0,255)<<0}getHexString(e=oa){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Cr.workingColorSpace){Cr.fromWorkingColorSpace(td(this,ki),t);let i=ki.r,r=ki.g,s=ki.b,a=Math.max(i,r,s),n=Math.min(i,r,s),o,l,h=(n+a)/2;if(n===a)o=0,l=0;else{let c=a-n;switch(l=h<=.5?c/(a+n):c/(2-a-n),a){case i:o=(r-s)/c+(r<s?6:0);break;case r:o=(s-i)/c+2;break;case s:o=(i-r)/c+4;break}o/=6}return e.h=o,e.s=l,e.l=h,e}getRGB(e,t=Cr.workingColorSpace){return Cr.fromWorkingColorSpace(td(this,ki),t),e.r=ki.r,e.g=ki.g,e.b=ki.b,e}getStyle(e=oa){return Cr.fromWorkingColorSpace(td(this,ki),e),e!==oa?`color(${e} ${ki.r} ${ki.g} ${ki.b})`:`rgb(${ki.r*255|0},${ki.g*255|0},${ki.b*255|0})`}offsetHSL(e,t,i){return this.getHSL(As),As.h+=e,As.s+=t,As.l+=i,this.setHSL(As.h,As.s,As.l),this}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,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(As),e.getHSL(ed);let i=Yc(As.h,ed.h,t),r=Yc(As.s,ed.s,t),s=Yc(As.l,ed.l,t);return this.setHSL(i,r,s),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}};Je.NAMES=cM;var fl,uM=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{fl===void 0&&(fl=du("canvas")),fl.width=e.width,fl.height=e.height;let i=fl.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=fl}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=du("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=Yo(s[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Yo(t[i]/255)*255):t[i]=Yo(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},dM=class{constructor(e=null){this.isSource=!0,this.uuid=xs(),this.data=e,this.version=0}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 i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,n=r.length;a<n;a++)r[a].isDataTexture?s.push(Gm(r[a].image)):s.push(Gm(r[a]))}else s=Gm(r);i.url=s}return t||(e.images[this.uuid]=i),i}};function Gm(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap?uM.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var F3=0,li=class extends or{constructor(e=li.DEFAULT_IMAGE,t=li.DEFAULT_MAPPING,i=si,r=si,s=xt,a=Sh,n=oi,o=Mr,l=li.DEFAULT_ANISOTROPY,h=js){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:F3++}),this.uuid=xs(),this.name="",this.source=new dM(e),this.mipmaps=[],this.mapping=t,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=l,this.format=n,this.internalFormat=null,this.type=o,this.offset=new H(0,0),this.repeat=new H(1,1),this.center=new H(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ii,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,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,type:this.t
vendor: 4,824 bytes, line 2
2ype,encoding:this.encoding,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),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==iM)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case rn:e.x=e.x-Math.floor(e.x);break;case si:e.x=e.x<0?0:1;break;case Gv:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case rn:e.y=e.y-Math.floor(e.y);break;case si:e.y=e.y<0?0:1;break;case Gv:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}};li.DEFAULT_IMAGE=null;li.DEFAULT_MAPPING=iM;li.DEFAULT_ANISOTROPY=1;var ot=class{constructor(e=0,t=0,i=0,r=1){ot.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s,a=e.elements,n=a[0],o=a[4],l=a[8],h=a[1],c=a[5],u=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(o-h)<.01&&Math.abs(l-d)<.01&&Math.abs(u-p)<.01){if(Math.abs(o+h)<.1&&Math.abs(l+d)<.1&&Math.abs(u+p)<.1&&Math.abs(n+c+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let g=(n+1)/2,v=(c+1)/2,y=(f+1)/2,x=(o+h)/4,w=(l+d)/4,S=(u+p)/4;return g>v&&g>y?g<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(g),r=x/i,s=w/i):v>y?v<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(v),i=x/r,s=S/r):y<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(y),i=w/s,r=S/s),this.set(i,r,s,t),this}let m=Math.sqrt((p-u)*(p-u)+(l-d)*(l-d)+(h-o)*(h-o));return Math.abs(m)<.001&&(m=1),this.x=(p-u)/m,this.y=(l-d)/m,this.z=(h-o)/m,this.w=Math.acos((n+c+f-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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}
vendor: 12,389 bytes, line 2
2round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},Pt=class extends or{constructor(e=1,t=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new ot(0,0,e,t),this.scissorTest=!1,this.viewport=new ot(0,0,e,t);let r={width:e,height:t,depth:1};this.texture=new li(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:xt,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new dM(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},pM=class extends li{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=St,this.minFilter=St,this.wrapR=si,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},k3=class extends li{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=St,this.minFilter=St,this.wrapR=si,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},fM=class extends Pt{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;let s=this.texture;this.texture=[];for(let a=0;a<i;a++)this.texture[a]=s.clone(),this.texture[a].isRenderTargetTexture=!0}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.texture.length;r<s;r++)this.texture[r].image.width=e,this.texture[r].image.height=t,this.texture[r].image.depth=i;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.texture.length=0;for(let t=0,i=e.texture.length;t<i;t++)this.texture[t]=e.texture[t].clone(),this.texture[t].isRenderTargetTexture=!0;return this}},nt=class{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,n){let o=i[r+0],l=i[r+1],h=i[r+2],c=i[r+3],u=s[a+0],d=s[a+1],p=s[a+2],f=s[a+3];if(n===0){e[t+0]=o,e[t+1]=l,e[t+2]=h,e[t+3]=c;return}if(n===1){e[t+0]=u,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(c!==f||o!==u||l!==d||h!==p){let m=1-n,g=o*u+l*d+h*p+c*f,v=g>=0?1:-1,y=1-g*g;if(y>Number.EPSILON){let w=Math.sqrt(y),S=Math.atan2(w,g*v);m=Math.sin(m*S)/w,n=Math.sin(n*S)/w}let x=n*v;if(o=o*m+u*x,l=l*m+d*x,h=h*m+p*x,c=c*m+f*x,m===1-n){let w=1/Math.sqrt(o*o+l*l+h*h+c*c);o*=w,l*=w,h*=w,c*=w}}e[t]=o,e[t+1]=l,e[t+2]=h,e[t+3]=c}static multiplyQuaternionsFlat(e,t,i,r,s,a){let n=i[r],o=i[r+1],l=i[r+2],h=i[r+3],c=s[a],u=s[a+1],d=s[a+2],p=s[a+3];return e[t]=n*p+h*c+o*d-l*u,e[t+1]=o*p+h*u+l*c-n*d,e[t+2]=l*p+h*d+n*u-o*c,e[t+3]=h*p-n*c-o*u-l*d,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,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,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){let i=e._x,r=e._y,s=e._z,a=e._order,n=Math.cos,o=Math.sin,l=n(i/2),h=n(r/2),c=n(s/2),u=o(i/2),d=o(r/2),p=o(s/2);switch(a){case"XYZ":this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p;break;case"YXZ":this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p;break;case"ZXY":this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p;break;case"ZYX":this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p;break;case"YZX":this._x=u*h*c+l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c-u*d*p;break;case"XZY":this._x=u*h*c-l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],n=t[5],o=t[9],l=t[2],h=t[6],c=t[10],u=i+n+c;if(u>0){let d=.5/Math.sqrt(u+1);this._w=.25/d,this._x=(h-o)*d,this._y=(s-l)*d,this._z=(a-r)*d}else if(i>n&&i>c){let d=2*Math.sqrt(1+i-n-c);this._w=(h-o)/d,this._x=.25*d,this._y=(r+a)/d,this._z=(s+l)/d}else if(n>c){let d=2*Math.sqrt(1+n-i-c);this._w=(s-l)/d,this._x=(r+a)/d,this._y=.25*d,this._z=(o+h)/d}else{let d=2*Math.sqrt(1+c-i-n);this._w=(a-r)/d,this._x=(s+l)/d,this._y=(o+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(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=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Pi(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(i===0)return this;let r=Math.min(1,t/i);return this.slerp(e,r),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 i=e._x,r=e._y,s=e._z,a=e._w,n=t._x,o=t._y,l=t._z,h=t._w;return this._x=i*h+a*n+r*l-s*o,this._y=r*h+a*o+s*n-i*l,this._z=s*h+a*l+i*o-r*n,this._w=a*h-i*n-r*o-s*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let i=this._x,r=this._y,s=this._z,a=this._w,n=a*e._w+i*e._x+r*e._y+s*e._z;if(n<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,n=-n):this.copy(e),n>=1)return this._w=a,this._x=i,this._y=r,this._z=s,this;let o=1-n*n;if(o<=Number.EPSILON){let d=1-t;return this._w=d*a+t*this._w,this._x=d*i+t*this._x,this._y=d*r+t*this._y,this._z=d*s+t*this._z,this.normalize(),this._onChangeCallback(),this}let l=Math.sqrt(o),h=Math.atan2(l,n),c=Math.sin((1-t)*h)/l,u=Math.sin(t*h)/l;return this._w=a*c+this._w*u,this._x=i*c+this._x*u,this._y=r*c+this._y*u,this._z=s*c+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},M=class{constructor(e=0,t=0,i=0){M.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(gb.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(gb.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}
vendor: 8,046 bytes, line 2
2applyQuaternion(e){let t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,n=e.z,o=e.w,l=o*t+a*r-n*i,h=o*i+n*t-s*r,c=o*r+s*i-a*t,u=-s*t-a*i-n*r;return this.x=l*o+u*-s+h*-n-c*-a,this.y=h*o+u*-a+c*-s-l*-n,this.z=c*o+u*-n+l*-a-h*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,r=e.y,s=e.z,a=t.x,n=t.y,o=t.z;return this.x=r*o-s*n,this.y=s*a-i*o,this.z=i*n-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Wm.copy(this).projectOnVector(e),this.sub(Wm)}reflect(e){return this.sub(Wm.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(Pi(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Wm=new M,gb=new nt,yi=class{constructor(e=new M(1/0,1/0,1/0),t=new M(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,i=1/0,r=1/0,s=-1/0,a=-1/0,n=-1/0;for(let o=0,l=e.length;o<l;o+=3){let h=e[o],c=e[o+1],u=e[o+2];h<t&&(t=h),c<i&&(i=c),u<r&&(r=u),h>s&&(s=h),c>a&&(a=c),u>n&&(n=u)}return this.min.set(t,i,r),this.max.set(s,a,n),this}setFromBufferAttribute(e){let t=1/0,i=1/0,r=1/0,s=-1/0,a=-1/0,n=-1/0;for(let o=0,l=e.count;o<l;o++){let h=e.getX(o),c=e.getY(o),u=e.getZ(o);h<t&&(t=h),c<i&&(i=c),u<r&&(r=u),h>s&&(s=h),c>a&&(a=c),u>n&&(n=u)}return this.min.set(t,i,r),this.max.set(s,a,n),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=bo.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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<this.min.x||this.max.y<this.min.y||this.max.z<this.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 i=e.geometry;if(i!==void 0)if(t&&i.attributes!=null&&i.attributes.position!==void 0){let s=i.attributes.position;for(let a=0,n=s.count;a<n;a++)bo.fromBufferAttribute(s,a).applyMatrix4(e.matrixWorld),this.expandByPoint(bo)}else i.boundingBox===null&&i.computeBoundingBox(),qm.copy(i.boundingBox),qm.applyMatrix4(e.matrixWorld),this.union(qm);let r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,bo),bo.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(rc),id.subVectors(this.max,rc),ml.subVectors(e.a,rc),gl.subVectors(e.b,rc),vl.subVectors(e.c,rc),Sn.subVectors(gl,ml),_n.subVectors(vl,gl),wo.subVectors(ml,vl);
vendor: 4,186 bytes, line 2
2let t=[0,-Sn.z,Sn.y,0,-_n.z,_n.y,0,-wo.z,wo.y,Sn.z,0,-Sn.x,_n.z,0,-_n.x,wo.z,0,-wo.x,-Sn.y,Sn.x,0,-_n.y,_n.x,0,-wo.y,wo.x,0];return!Xm(t,ml,gl,vl,id)||(t=[1,0,0,0,1,0,0,0,1],!Xm(t,ml,gl,vl,id))?!1:(rd.crossVectors(Sn,_n),t=[rd.x,rd.y,rd.z],Xm(t,ml,gl,vl,id))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return bo.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(bo).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Ia[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ia[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ia[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ia[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ia[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ia[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ia[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ia[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ia),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}},Ia=[new M,new M,new M,new M,new M,new M,new M,new M],bo=new M,qm=new yi,ml=new M,gl=new M,vl=new M,Sn=new M,_n=new M,wo=new M,rc=new M,id=new M,rd=new M,So=new M;function Xm(e,t,i,r,s){for(let a=0,n=e.length-3;a<=n;a+=3){So.fromArray(e,a);let o=s.x*Math.abs(So.x)+s.y*Math.abs(So.y)+s.z*Math.abs(So.z),l=t.dot(So),h=i.dot(So),c=r.dot(So);if(Math.max(-Math.max(l,h,c),Math.min(l,h,c))>o)return!1}return!0}var U3=new yi,sc=new M,Ym=new M,is=class{constructor(e=new M,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;t!==void 0?i.copy(t):U3.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=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)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>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;sc.subVectors(e,this.center);let t=sc.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(sc,r/i),this.radius+=r}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):(Ym.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(sc.copy(e.center).add(Ym)),this.expandByPoint(sc.copy(e.center).sub(Ym))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},Ra=new M,Qm=new M,sd=new M,An=new M,Km=new M,ad=new M,Zm=new M,Nh=class{constructor(e=new M,t=new M(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}
vendor: 8,136 bytes, line 2
2recast(e){return this.origin.copy(this.at(e,Ra)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Ra.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ra.copy(this.direction).multiplyScalar(t).add(this.origin),Ra.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Qm.copy(e).add(t).multiplyScalar(.5),sd.copy(t).sub(e).normalize(),An.copy(this.origin).sub(Qm);let s=e.distanceTo(t)*.5,a=-this.direction.dot(sd),n=An.dot(this.direction),o=-An.dot(sd),l=An.lengthSq(),h=Math.abs(1-a*a),c,u,d,p;if(h>0)if(c=a*o-n,u=a*n-o,p=s*h,c>=0)if(u>=-p)if(u<=p){let f=1/h;c*=f,u*=f,d=c*(c+a*u+2*n)+u*(a*c+u+2*o)+l}else u=s,c=Math.max(0,-(a*u+n)),d=-c*c+u*(u+2*o)+l;else u=-s,c=Math.max(0,-(a*u+n)),d=-c*c+u*(u+2*o)+l;else u<=-p?(c=Math.max(0,-(-a*s+n)),u=c>0?-s:Math.min(Math.max(-s,-o),s),d=-c*c+u*(u+2*o)+l):u<=p?(c=0,u=Math.min(Math.max(-s,-o),s),d=u*(u+2*o)+l):(c=Math.max(0,-(a*s+n)),u=c>0?s:Math.min(Math.max(-s,-o),s),d=-c*c+u*(u+2*o)+l);else u=a>0?-s:s,c=Math.max(0,-(a*u+n)),d=-c*c+u*(u+2*o)+l;return i&&i.copy(this.direction).multiplyScalar(c).add(this.origin),r&&r.copy(sd).multiplyScalar(u).add(Qm),d}intersectSphere(e,t){Ra.subVectors(e.center,this.origin);let i=Ra.dot(this.direction),r=Ra.dot(Ra)-i*i,s=e.radius*e.radius;if(r>s)return null;let a=Math.sqrt(s-r),n=i-a,o=i+a;return n<0&&o<0?null:n<0?this.at(o,t):this.at(n,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=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 i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,n,o,l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,u=this.origin;return l>=0?(i=(e.min.x-u.x)*l,r=(e.max.x-u.x)*l):(i=(e.max.x-u.x)*l,r=(e.min.x-u.x)*l),h>=0?(s=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(s=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),c>=0?(n=(e.min.z-u.z)*c,o=(e.max.z-u.z)*c):(n=(e.max.z-u.z)*c,o=(e.min.z-u.z)*c),i>o||n>r)||((n>i||i!==i)&&(i=n),(o<r||r!==r)&&(r=o),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Ra)!==null}intersectTriangle(e,t,i,r,s){Km.subVectors(t,e),ad.subVectors(i,e),Zm.crossVectors(Km,ad);let a=this.direction.dot(Zm),n;if(a>0){if(r)return null;n=1}else if(a<0)n=-1,a=-a;else return null;An.subVectors(this.origin,e);let o=n*this.direction.dot(ad.crossVectors(An,ad));if(o<0)return null;let l=n*this.direction.dot(Km.cross(An));if(l<0||o+l>a)return null;let h=-n*An.dot(Zm);return h<0?null:this.at(h/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)}},xe=class{constructor(){xe.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,i,r,s,a,n,o,l,h,c,u,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=r,g[1]=s,g[5]=a,g[9]=n,g[13]=o,g[2]=l,g[6]=h,g[10]=c,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,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 xe().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,r=1/yl.setFromMatrixColumn(e,0).length(),s=1/yl.setFromMatrixColumn(e,1).length(),a=1/yl.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),n=Math.sin(i),o=Math.cos(r),l=Math.sin(r),h=Math.cos(s),c=Math.sin(s);if(e.order==="XYZ"){let u=a*h,d=a*c,p=n*h,f=n*c;t[0]=o*h,t[4]=-o*c,t[8]=l,t[1]=d+p*l,t[5]=u-f*l,t[9]=-n*o,t[2]=f-u*l,t[6]=p+d*l,t[10]=a*o}else if(e.order==="YXZ"){let u=o*h,d=o*c,p=l*h,f=l*c;t[0]=u+f*n,t[4]=p*n-d,t[8]=a*l,t[1]=a*c,t[5]=a*h,t[9]=-n,t[2]=d*n-p,t[6]=f+u*n,t[10]=a*o}else if(e.order==="ZXY"){let u=o*h,d=o*c,p=l*h,f=l*c;t[0]=u-f*n,t[4]=-a*c,t[8]=p+d*n,t[1]=d+p*n,t[5]=a*h,t[9]=f-u*n,t[2]=-a*l,t[6]=n,t[10]=a*o}else if(e.order==="ZYX"){let u=a*h,d=a*c,p=n*h,f=n*c;t[0]=o*h,t[4]=p*l-d,t[8]=u*l+f,t[1]=o*c,t[5]=f*l+u,t[9]=d*l-p,t[2]=-l,t[6]=n*o,t[10]=a*o}else if(e.order==="YZX"){let u=a*o,d=a*l,p=n*o,f=n*l;t[0]=o*h,t[4]=f-u*c,t[8]=p*c+d,t[1]=c,t[5]=a*h,t[9]=-n*h,t[2]=-l*h,t[6]=d*c+p,t[10]=u-f*c}else if(e.order==="XZY"){let u=a*o,d=a*l,p=n*o,f=n*l;t[0]=o*h,t[4]=-c,t[8]=l*h,t[1]=u*c+f,t[5]=a*h,t[9]=d*c-p,t[2]=p*c-d,t[6]=n*h,t[10]=f*c+u}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(N3,e,V3)}lookAt(e,t,i){let r=this.elements;return Jr.subVectors(e,t),Jr.lengthSq()===0&&(Jr.z=1),Jr.normalize(),Mn.crossVectors(i,Jr),Mn.lengthSq()===0&&(Math.abs(i.z)===1?Jr.x+=1e-4:Jr.z+=1e-4,Jr.normalize(),Mn.crossVectors(i,Jr)),Mn.normalize(),nd.crossVectors(Jr,Mn),r[0]=Mn.x,r[4]=nd.x,r[8]=Jr.x,r[1]=Mn.y,r[5]=nd.y,r[9]=Jr.y,r[2]=Mn.z,r[6]=nd.z,r[10]=Jr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,s=this.elements,a=i[0],n=i[4],o=i[8],l=i[12],h=i[1],c=i[5],u=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],y=i[7],x=i[11],w=i[15],S=r[0],b=r[4],E=r[8],_=r[12],A=r[1],C=r[5],T=r[9],I=r[13],P=r[2],O=r[6],k=r[10],G=r[14],B=r[3],U=r[7],Q=r[11],q=r[15];return s[0]=a*S+n*A+o*P+l*B,s[4]=a*b+n*C+o*O+l*U,s[8]=a*E+n*T+o*k+l*Q,s[12]=a*_+n*I+o*G+l*q,s[1]=h*S+c*A+u*P+d*B,s[5]=h*b+c*C+u*O+d*U,s[9]=h*E+c*T+u*k+d*Q,s[13]=h*_+c*I+u*G+d*q,s[2]=p*S+f*A+m*P+g*B,s[6]=p*b+f*C+m*O+g*U,s[10]=p*E+f*T+m*k+g*Q,s[14]=p*_+f*I+m*G+g*q,s[3]=v*S+y*A+x*P+w*B,s[7]=v*b+y*C+x*O+w*U,s[11]=v*E+y*T+x*k+w*Q,s[15]=v*_+y*I+x*G+w*q,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],n=e[5],o=e[9],l=e[13],h=e[2],c=e[6],u=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15];return p*(+s*o*c-r*l*c-s*n*u+i*l*u+r*n*d-i*o*d)+f*(+t*o*d-t*l*u+s*a*u-r*a*d+r*l*h-s*o*h)+m*(+t*l*c-t*n*d-s*a*c+i*a*d+s*n*h-i*l*h)+g*(-r*n*h-t*o*c+t*n*u+r*a*c-i*a*u+i*o*h)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],n=e[5],o=e[6],l=e[7],h=e[8],c=e[9],u=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=c*m*l-f*u*l+f*o*d-n*m*d-c*o*g+n*u*g,y=p*u*l-h*m*l-p*o*d+a*m*d+h*o*g-a*u*g,x=h*f*l-p*c*l+p*n*d-a*f*d-h*n*g+a*c*g,w=p*c*o-h*f*o-p*n*u+a*f*u+h*n*m-a*c*m,S=t*v+i*y+r*x+s*w;if(S===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let b=1/S;return e[0]=v*b,e[1]=(f*u*s-c*m*s-f*r*d+i*m*d+c*r*g-i*u*g)*b,e[2]=(n*m*s-f*o
vendor: 6,274 bytes, line 2
2*s+f*r*l-i*m*l-n*r*g+i*o*g)*b,e[3]=(c*o*s-n*u*s-c*r*l+i*u*l+n*r*d-i*o*d)*b,e[4]=y*b,e[5]=(h*m*s-p*u*s+p*r*d-t*m*d-h*r*g+t*u*g)*b,e[6]=(p*o*s-a*m*s-p*r*l+t*m*l+a*r*g-t*o*g)*b,e[7]=(a*u*s-h*o*s+h*r*l-t*u*l-a*r*d+t*o*d)*b,e[8]=x*b,e[9]=(p*c*s-h*f*s-p*i*d+t*f*d+h*i*g-t*c*g)*b,e[10]=(a*f*s-p*n*s+p*i*l-t*f*l-a*i*g+t*n*g)*b,e[11]=(h*n*s-a*c*s-h*i*l+t*c*l+a*i*d-t*n*d)*b,e[12]=w*b,e[13]=(h*f*r-p*c*r+p*i*u-t*f*u-h*i*m+t*c*m)*b,e[14]=(p*n*r-a*f*r-p*i*o+t*f*o+a*i*m-t*n*m)*b,e[15]=(a*c*r-h*n*r+h*i*o-t*c*o-a*i*u+t*n*u)*b,this}scale(e){let t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,n=e.y,o=e.z,l=s*a,h=s*n;return this.set(l*a+i,l*n-r*o,l*o+r*n,0,l*n+r*o,h*n+i,h*o-r*a,0,l*o-r*n,h*o+r*a,s*o*o+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){let r=this.elements,s=t._x,a=t._y,n=t._z,o=t._w,l=s+s,h=a+a,c=n+n,u=s*l,d=s*h,p=s*c,f=a*h,m=a*c,g=n*c,v=o*l,y=o*h,x=o*c,w=i.x,S=i.y,b=i.z;return r[0]=(1-(f+g))*w,r[1]=(d+x)*w,r[2]=(p-y)*w,r[3]=0,r[4]=(d-x)*S,r[5]=(1-(u+g))*S,r[6]=(m+v)*S,r[7]=0,r[8]=(p+y)*b,r[9]=(m-v)*b,r[10]=(1-(u+f))*b,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){let r=this.elements,s=yl.set(r[0],r[1],r[2]).length(),a=yl.set(r[4],r[5],r[6]).length(),n=yl.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Ms.copy(this);let o=1/s,l=1/a,h=1/n;return Ms.elements[0]*=o,Ms.elements[1]*=o,Ms.elements[2]*=o,Ms.elements[4]*=l,Ms.elements[5]*=l,Ms.elements[6]*=l,Ms.elements[8]*=h,Ms.elements[9]*=h,Ms.elements[10]*=h,t.setFromRotationMatrix(Ms),i.x=s,i.y=a,i.z=n,this}makePerspective(e,t,i,r,s,a){let n=this.elements,o=2*s/(t-e),l=2*s/(i-r),h=(t+e)/(t-e),c=(i+r)/(i-r),u=-(a+s)/(a-s),d=-2*a*s/(a-s);return n[0]=o,n[4]=0,n[8]=h,n[12]=0,n[1]=0,n[5]=l,n[9]=c,n[13]=0,n[2]=0,n[6]=0,n[10]=u,n[14]=d,n[3]=0,n[7]=0,n[11]=-1,n[15]=0,this}makeOrthographic(e,t,i,r,s,a){let n=this.elements,o=1/(t-e),l=1/(i-r),h=1/(a-s),c=(t+e)*o,u=(i+r)*l,d=(a+s)*h;return n[0]=2*o,n[4]=0,n[8]=0,n[12]=-c,n[1]=0,n[5]=2*l,n[9]=0,n[13]=-u,n[2]=0,n[6]=0,n[10]=-2*h,n[14]=-d,n[3]=0,n[7]=0,n[11]=0,n[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){let i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}},yl=new M,Ms=new xe,N3=new M(0,0,0),V3=new M(1,1,1),Mn=new M,nd=new M,Jr=new M,vb=new xe,yb=new nt,Di=class{constructor(e=0,t=0,i=0,r=Di.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){let r=e.elements,s=r[0],a=r[4],n=r[8],o=r[1],l=r[5],h=r[9],c=r[2],u=r[6],d=r[10];switch(t){case"XYZ":this._y=Math.asin(Pi(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Pi(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(n,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,s),this._z=0);break;case"ZXY":this._x=Math.asin(Pi(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,s));break;case"ZYX":this._y=Math.asin(-Pi(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,s)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Pi(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-c,s)):(this._x=0,this._y=Math.atan2(n,d));break;case"XZY":this._z=Math.asin(-Pi(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(n,s)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return vb.makeRotationFromQuaternion(e),this.setFromRotationMatrix(vb,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return yb.setFromEuler(this),this.setFromQuaternion(yb,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Di.DEFAULT_ORDER="XYZ";var Jy=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}
vendor: 5,349 bytes, line 2
2isEnabled(e){return(this.mask&(1<<e|0))!==0}},j3=0,xb=new M,xl=new nt,La=new xe,od=new M,ac=new M,H3=new M,G3=new nt,bb=new M(1,0,0),wb=new M(0,1,0),Sb=new M(0,0,1),W3={type:"added"},_b={type:"removed"},Vt=class extends or{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:j3++}),this.uuid=xs(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Vt.DEFAULT_UP.clone();let e=new M,t=new Di,i=new nt,r=new M(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new xe},normalMatrix:{value:new Ii}}),this.matrix=new xe,this.matrixWorld=new xe,this.matrixAutoUpdate=Vt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=Vt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new Jy,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return xl.setFromAxisAngle(e,t),this.quaternion.multiply(xl),this}rotateOnWorldAxis(e,t){return xl.setFromAxisAngle(e,t),this.quaternion.premultiply(xl),this}rotateX(e){return this.rotateOnAxis(bb,e)}rotateY(e){return this.rotateOnAxis(wb,e)}rotateZ(e){return this.rotateOnAxis(Sb,e)}translateOnAxis(e,t){return xb.copy(e).applyQuaternion(this.quaternion),this.position.add(xb.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(bb,e)}translateY(e){return this.translateOnAxis(wb,e)}translateZ(e){return this.translateOnAxis(Sb,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(La.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?od.copy(e):od.set(e,t,i);let r=this.parent;this.updateWorldMatrix(!0,!1),ac.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?La.lookAt(ac,od,this.up):La.lookAt(od,ac,this.up),this.quaternion.setFromRotationMatrix(La),r&&(La.extractRotation(r.matrixWorld),xl.setFromRotationMatrix(La),this.quaternion.premultiply(xl.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(W3)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(_b)),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){for(let e=0;e<this.children.length;e++){let t=this.children[e];t.parent=null,t.dispatchEvent(_b)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),La.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),La.multiply(e.parent.matrixWorld)),e.applyMatrix4(La),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){let s=this.children[i].getObjectByProperty(e,t);if(s!==void 0)return s}}getObjectsByProperty(e,t){let i=[];this[e]===t&&i.push(this);for(let r=0,s=this.children.length;r<s;r++){let a=this.children[r].getObjectsByProperty(e,t);a.length>0&&(i=i.concat(a))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ac,e,H3),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ac,G3,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix
vendor: 8,649 bytes, line 2
2):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,r=t.length;i<r;i++){let s=t[i];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){let i=this.parent;if(e===!0&&i!==null&&i.matrixWorldAutoUpdate===!0&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){let r=this.children;for(let s=0,a=r.length;s<a;s++){let n=r[s];n.matrixWorldAutoUpdate===!0&&n.updateWorldMatrix(!1,!0)}}}toJSON(e){let t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON()));function s(n,o){return n[o.uuid]===void 0&&(n[o.uuid]=o.toJSON(e)),o.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let n=this.geometry.parameters;if(n!==void 0&&n.shapes!==void 0){let o=n.shapes;if(Array.isArray(o))for(let l=0,h=o.length;l<h;l++){let c=o[l];s(e.shapes,c)}else s(e.shapes,o)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let n=[];for(let o=0,l=this.material.length;o<l;o++)n.push(s(e.materials,this.material[o]));r.material=n}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let n=0;n<this.children.length;n++)r.children.push(this.children[n].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let n=0;n<this.animations.length;n++){let o=this.animations[n];r.animations.push(s(e.animations,o))}}if(t){let n=a(e.geometries),o=a(e.materials),l=a(e.textures),h=a(e.images),c=a(e.shapes),u=a(e.skeletons),d=a(e.animations),p=a(e.nodes);n.length>0&&(i.geometries=n),o.length>0&&(i.materials=o),l.length>0&&(i.textures=l),h.length>0&&(i.images=h),c.length>0&&(i.shapes=c),u.length>0&&(i.skeletons=u),d.length>0&&(i.animations=d),p.length>0&&(i.nodes=p)}return i.object=r,i;function a(n){let o=[];for(let l in n){let h=n[l];delete h.metadata,o.push(h)}return o}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){let r=e.children[i];this.add(r.clone())}return this}};Vt.DEFAULT_UP=new M(0,1,0);Vt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Vt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Es=new M,za=new M,Jm=new M,Ba=new M,bl=new M,wl=new M,Ab=new M,$m=new M,eg=new M,tg=new M,fr=class{constructor(e=new M,t=new M,i=new M){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),Es.subVectors(e,t),r.cross(Es);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){Es.subVectors(r,t),za.subVectors(i,t),Jm.subVectors(e,t);let a=Es.dot(Es),n=Es.dot(za),o=Es.dot(Jm),l=za.dot(za),h=za.dot(Jm),c=a*l-n*n;if(c===0)return s.set(-2,-1,-1);let u=1/c,d=(l*o-n*h)*u,p=(a*h-n*o)*u;return s.set(1-d-p,p,d)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Ba),Ba.x>=0&&Ba.y>=0&&Ba.x+Ba.y<=1}static getUV(e,t,i,r,s,a,n,o){return this.getBarycoord(e,t,i,r,Ba),o.set(0,0),o.addScaledVector(s,Ba.x),o.addScaledVector(a,Ba.y),o.addScaledVector(n,Ba.z),o}static isFrontFacing(e,t,i,r){return Es.subVectors(i,t),za.subVectors(e,t),Es.cross(za).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Es.subVectors(this.c,this.b),za.subVectors(this.a,this.b),Es.cross(za).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return fr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return fr.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return fr.getUV(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return fr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return fr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,r=this.b,s=this.c,a,n;bl.subVectors(r,i),wl.subVectors(s,i),$m.subVectors(e,i);let o=bl.dot($m),l=wl.dot($m);if(o<=0&&l<=0)return t.copy(i);eg.subVectors(e,r);let h=bl.dot(eg),c=wl.dot(eg);if(h>=0&&c<=h)return t.copy(r);let u=o*c-h*l;if(u<=0&&o>=0&&h<=0)return a=o/(o-h),t.copy(i).addScaledVector(bl,a);tg.subVectors(e,s);let d=bl.dot(tg),p=wl.dot(tg);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return n=l/(l-p),t.copy(i).addScaledVector(wl,n);let m=h*p-d*c;if(m<=0&&c-h>=0&&d-p>=0)return Ab.subVectors(s,r),n=(c-h)/(c-h+(d-p)),t.copy(r).addScaledVector(Ab,n);let g=1/(m+f+u);return a=f*g,n=u*g,t.copy(i).addScaledVector(bl,a).addScaledVector(wl,n)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},q3=0,zu=class extends or{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:q3++}),this.uuid=xs(),this.name="",this.type="Material",this.blending=Wo,this.side=Vs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=$2,this.blendDst=eM,this.blendEquation=Xl,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Vv,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=b3,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Nm,this.stencilZFail=Nm,this.stencilZPass=Nm,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let i=e[t];if(i===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}let r=this[t];if(r===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};
vendor: 7,618 bytes, line 2
2i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Wo&&(i.blending=this.blending),this.side!==Vs&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(i.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){let a=[];for(let n in s){let o=s[n];delete o.metadata,a.push(o)}return a}if(t){let s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(t!==null){let r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 4,424 bytes, line 2
2adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}},pn=class extends zu{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Je(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=tM,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},Ei=new M,ld=new H,tt=class{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Wv,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)ld.fromBufferAttribute(this,t),ld.applyMatrix3(e),this.setXY(t,ld.x,ld.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)Ei.fromBufferAttribute(this,t),Ei.applyMatrix3(e),this.setXYZ(t,Ei.x,Ei.y,Ei.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)Ei.fromBufferAttribute(this,t),Ei.applyMatrix4(e),this.setXYZ(t,Ei.x,Ei.y,Ei.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Ei.fromBufferAttribute(this,t),Ei.applyNormalMatrix(e),this.setXYZ(t,Ei.x,Ei.y,Ei.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Ei.fromBufferAttribute(this,t),Ei.transformDirection(e),this.setXYZ(t,Ei.x,Ei.y,Ei.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=an(t,this.array)),t}setX(e,t){return this.normalized&&(t=Kt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=an(t,this.array)),t}setY(e,t){return this.normalized&&(t=Kt(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=an(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Kt(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=an(t,this.array)),t}setW(e,t){return this.normalized&&(t=Kt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Kt(t,this.array),i=Kt(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Kt(t,this.array),i=Kt(i,this.array),r=Kt(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Kt(t,this.array),i=Kt(i,this.array),r=Kt(r,this.array),s=Kt(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}
vendor: 3,462 bytes, line 2
2onUpload(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!==Wv&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}},mM=class extends tt{constructor(e,t,i){super(new Uint16Array(e),t,i)}},lh=class extends tt{constructor(e,t,i){super(new Uint32Array(e),t,i)}},De=class extends tt{constructor(e,t,i){super(new Float32Array(e),t,i)}},X3=0,os=new xe,ig=new Vt,Sl=new M,$r=new yi,nc=new yi,Zi=new M,He=class extends or{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:X3++}),this.uuid=xs(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(hM(e)?lh:mM)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let s=new Ii().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return os.makeRotationFromQuaternion(e),this.applyMatrix4(os),this}rotateX(e){return os.makeRotationX(e),this.applyMatrix4(os),this}rotateY(e){return os.makeRotationY(e),this.applyMatrix4(os),this}rotateZ(e){return os.makeRotationZ(e),this.applyMatrix4(os),this}translate(e,t,i){return os.makeTranslation(e,t,i),this.applyMatrix4(os),this}scale(e,t,i){return os.makeScale(e,t,i),this.applyMatrix4(os),this}lookAt(e){return ig.lookAt(e),ig.updateMatrix(),this.applyMatrix4(ig.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Sl).negate(),this.translate(Sl.x,Sl.y,Sl.z),this}setFromPoints(e){let t=[];for(let i=0,r=e.length;i<r;i++){let s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new De(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new yi);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "fal
2se".',this),this.boundingBox.set(new M(-1/0,-1/0,-1/0),new M(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){let s=t[i];$r.setFromBufferAttribute(s),this.morphTargetsRelative?(Zi.addVectors(this.boundingBox.min,$r.min),this.boundingBox.expandByPoint(Zi),Zi.addVectors(this.boundingBox.max,$r.max),this.boundingBox.expandByPoint(Zi)):(this.boundingBox.expandByPoint($r.min),this.boundingBox.expandByPoint($r.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.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 is);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "fal
2se".',this),this.boundingSphere.set(new M,1/0);return}if(e){let i=this.boundingSphere.center;if($r.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){let n=t[s];nc.setFromBufferAttribute(n),this.morphTargetsRelative?(Zi.addVectors($r.min,nc.min),$r.expandByPoint(Zi),Zi.addVectors($r.max,nc.max),$r.expandByPoint(Zi)):($r.expandByPoint(nc.min),$r.expandByPoint(nc.max))}$r.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)Zi.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Zi));if(t)for(let s=0,a=t.length;s<a;s++){let n=t[s],o=this.morphTargetsRelative;for(let l=0,h=n.count;l<h;l++)Zi.fromBufferAttribute(n,l),o&&(Sl.fromBufferAttribute(e,l),Zi.add(Sl)),r=Math.max(r,i.distanceToSquared(Zi))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=e.array,r=t.position.array,s=t.normal.array,a=t.uv.array,n=r.length/3;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new tt(new Float32Array(4*n),4));let o=this.getAttribute("tangent").array,l=[],h=[];for(let A=0;A<n;A++)l[A]=new M,h[A]=new M;let c=new M,u=new M,d=new M,p=new H,f=new H,m=new H,g=new M,v=new M;function y(A,C,T){c.fromArray(r,A*3),u.fromArray(r,C*3),d.fromArray(r,T*3),p.fromArray(a,A*2),f.fromArray(a,C*2),m.fromArray(a,T*2),u.sub(c),d.sub(c),f.sub(p),m.sub(p);let I=1/(f.x*m.y-m.x*f.y);!isFinite(I)||(g.copy(u).multiplyScalar(m.y).addScaledVector(d,-f.y).multiplyScalar(I),v.copy(d).multiplyScalar(f.x).addScaledVector(u,-m.x).multiplyScalar(I),l[A].add(g),l[C].add(g),l[T].add(g),h[A].add(v),h[C].add(v),h[T].add(v))}let x=this.groups;x.length===0&&(x=[{start:0,count:i.length}]);for(let A=0,C=x.length;A<C;++A){let T=x[A],I=T.start,P=T.count;for(let O=I,k=I+P;O<k;O+=3)y(i[O+0],i[O+1],i[O+2])}let w=new M,S=new M,b=new M,E=new M;function _(A){b.fromArray(s,A*3),E.copy(b);let C=l[A];w.copy(C),w.sub(b.multiplyScalar(b.dot(C))).normalize(),S.crossVectors(E,C);let T=S.dot(h[A])<0?-1:1;o[A*4]=w.x,o[A*4+1]=w.y,o[A*4+2]=w.z,o[A*4+3]=T}for(let A=0,C=x.length;A<C;++A){let T=x[A],I=T.start,P=T.count;for(let O=I,k=I+P;O<k;O+=3)_(i[O+0]),_(i[O+1]),_(i[O+2])}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new tt(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let u=0,d=i.count;u<d;u++)i.setXYZ(u,0,0,0);let r=new M,s=new M,a=new M,n=new M,o=new M,l=new M,h=new M,c=new M;if(e)for(let u=0,d=e.count;u<d;u+=3){let p=e.getX(u+0),f=e.getX(u+1),m=e.getX(u+2);r.fromBufferAttribute(t,p),s.fromBufferAttribute(t,f),a.fromBufferAttribute(t,m),h.subVectors(a,s),c.subVectors(r,s),h.cross(c),n.fromBufferAttribute(i,p),o.fromBufferAttribute(i,f),l.fromBufferAttribute(i,m),n.add(h),o.add(h),l.add(h),i.setXYZ(p,n.x,n.y,n.z),i.setXYZ(f,o.x,o.y,o.z),i.setXYZ(m,l.x,l.y,l.z)}else for(let u=0,d=t.count;u<d;u+=3)r.fromBufferAttribute(t,u+0),s.fromBufferAttribute(t,u+1),a.fromBufferAttribute(t,u+2),h.subVectors(a,s),c.subVectors(r,s),h.cross(c),i.setXYZ(u+0,h.x,h.y,h.z),i.setXYZ(u+1,h.x,h.y,h.z),i.setXYZ(u+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead."),this}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Zi.fromBufferAttribute(e,t),Zi.normalize(),e.setXYZ(t,Zi.x,Zi.y,Zi.z)}toNonIndexed(){function e(n,o){let l=n.array,h=n.itemSize,c=n.normalized,u=new l.constructor(o.length*h),d=0,p=0;for(let f=0,m=o.length;f<m;f++){n.isInterleavedBufferAttribute?d=o[f]*n.data.stride+n.offset:d=o[f]*h;for(let g=0;g<h;g++)u[p++]=l[d++]}return new tt(u,h,c)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new He,i=this.index.array,r=this.attributes;for(let n in r){let o=r[n],l=e(o,i);t.setAttribute(n,l)}let s=this.morphAttributes;for(let n in s){let o=[],l=s[n];for(let h=0,c=l.length;h<c;h++){let u=l[h],d=e(u,i);o.push(d)}t.morphAttributes[n]=o}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let n=0,o=a.length;n<o;n++){let l=a[n];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){let e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
vendor: 5,856 bytes, line 2
2if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let o=this.parameters;for(let l in o)o[l]!==void 0&&(e[l]=o[l]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let o in i){let l=i[o];e.data.attributes[o]=l.toJSON(e.data)}let r={},s=!1;for(let o in this.morphAttributes){let l=this.morphAttributes[o],h=[];for(let c=0,u=l.length;c<u;c++){let d=l[c];h.push(d.toJSON(e.data))}h.length>0&&(r[o]=h,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let n=this.boundingSphere;return n!==null&&(e.data.boundingSphere={center:n.center.toArray(),radius:n.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;i!==null&&this.setIndex(i.clone(t));let r=e.attributes;for(let l in r){let h=r[l];this.setAttribute(l,h.clone(t))}let s=e.morphAttributes;for(let l in s){let h=[],c=s[l];for(let u=0,d=c.length;u<d;u++)h.push(c[u].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let l=0,h=a.length;l<h;l++){let c=a[l];this.addGroup(c.start,c.count,c.materialIndex)}let n=e.boundingBox;n!==null&&(this.boundingBox=n.clone());let o=e.boundingSphere;return o!==null&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,e.parameters!==void 0&&(this.parameters=Object.assign({},e.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}},Mb=new xe,_l=new Nh,rg=new is,oc=new M,lc=new M,hc=new M,sg=new M,hd=new M,cd=new H,ud=new H,dd=new H,ag=new M,pd=new M,Zt=class extends Vt{constructor(e=new He,t=new pn){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,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=e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}getVertexPosition(e,t){let i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);let n=this.morphTargetInfluences;if(s&&n){hd.set(0,0,0);for(let o=0,l=s.length;o<l;o++){let h=n[o],c=s[o];h!==0&&(sg.fromBufferAttribute(c,e),a?hd.addScaledVector(sg,h):hd.addScaledVector(sg.sub(t),h))}t.add(hd)}return this.isSkinnedMesh&&this.boneTransform(e,t),t}raycast(e,t){let i=this.geometry,r=this.material,s=this.matrixWorld;if(r===void 0||(i.boundingSphere===null&&i.computeBoundingSphere(),rg.copy(i.boundingSphere),rg.applyMatrix4(s),e.ray.intersectsSphere(rg)===!1)||(Mb.copy(s).invert(),_l.copy(e.ray).applyMatrix4(Mb),i.boundingBox!==null&&_l.intersectsBox(i.boundingBox)===!1))return;let a,n=i.index,o=i.attributes.position,l=i.attributes.uv,h=i.attributes.uv2,c=i.groups,u=i.drawRange;if(n!==null)if(Array.isArray(r))for(let d=0,p=c.length;d<p;d++){let f=c[d],m=r[f.materialIndex],g=Math.max(f.start,u.start),v=Math.min(n.count,Math.min(f.start+f.count,u.start+u.count));for(let y=g,x=v;y<x;y+=3){let w=n.getX(y),S=n.getX(y+1),b=n.getX(y+2);a=fd(this,m,e,_l,l,h,w,S,b),a&&(a.faceIndex=Math.floor(y/3),a.face.materialIndex=f.materialIndex,t.push(a))}}else{let d=Math.max(0,u.start),p=Math.min(n.count,u.start+u.count);for(let f=d,m=p;f<m;f+=3){let g=n.getX(f),v=n.getX(f+1),y=n.getX(f+2);a=fd(this,r,e,_l,l,h,g,v,y),a&&(a.faceIndex=Math.floor(f/3),t.push(a))}}else if(o!==void 0)if(Array.isArray(r))for(let d=0,p=c.length;d<p;d++){let f=c[d],m=r[f.materialIndex],g=Math.max(f.start,u.start),v=Math.min(o.count,Math.min(f.start+f.count,u.start+u.count));for(let y=g,x=v;y<x;y+=3){let w=y,S=y+1,b=y+2;a=fd(this,m,e,_l,l,h,w,S,b),a&&(a.faceIndex=Math.floor(y/3),a.face.materialIndex=f.materialIndex,t.push(a))}}else{let d=Math.max(0,u.start),p=Math.min(o.count,u.start+u.count);for(let f=d,m=p;f<m;f+=3){let g=f,v=f+1,y=f+2;a=fd(this,r,e,_l,l,h,g,v,y),a&&(a.faceIndex=Math.floor(f/3),t.push(a))}}}};function Y3(e,t,i,r,s,a,n,o){let l;if(t.side===sr?l=r.intersectTriangle(n,a,s,!0,o):l=r.intersectTriangle(s,a,n,t.side===Vs,o),l===null)return null;pd.copy(o),pd.applyMatrix4(e.matrixWorld);let h=i.ray.origin.distanceTo(pd);return h<i.near||h>i.far?null:{distance:h,point:pd.clone(),object:e}}function fd(e,t,i,r,s,a,n,o,l){e.getVertexPosition(n,oc),e.getVertexPosition(o,lc),e.getVertexPosition(l,hc);let h=Y3(e,t,i,r,oc,lc,hc,ag);if(h){s&&(cd.fromBufferAttribute(s,n),ud.fromBufferAttribute(s,o),dd.fromBufferAttribute(s,l),h.uv=fr.getUV(ag,oc,lc,hc,cd,ud,dd,new H)),a&&(cd.fromBufferAttribute(a,n),ud.fromBufferAttribute(a,o),dd.fromBufferAttribute(a,l),h.uv2=fr.getUV(ag,oc,lc,hc,cd,ud,dd,new H));let c={a:n,b:o,c:l,normal:new M,materialIndex:0};fr.getNormal(oc,lc,hc,c.normal),h.face=c}return h}var Hs=class extends He{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};let n=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);let o=[],l=[],h=[],c=[],u=0,d=0;p("z","y","x",-1,-1,i,t,e,a,s,0),p("z","y","x",1,-1,i,t,-e,a,s,1
vendor: 4,825 bytes, lines 2-6
2),p("x","z","y",1,1,e,i,t,r,a,2),p("x","z","y",1,-1,e,i,-t,r,a,3),p("x","y","z",1,-1,e,t,i,r,s,4),p("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(o),this.setAttribute("position",new De(l,3)),this.setAttribute("normal",new De(h,3)),this.setAttribute("uv",new De(c,2));function p(f,m,g,v,y,x,w,S,b,E,_){let A=x/b,C=w/E,T=x/2,I=w/2,P=S/2,O=b+1,k=E+1,G=0,B=0,U=new M;for(let Q=0;Q<k;Q++){let q=Q*C-I;for(let j=0;j<O;j++){let X=j*A-T;U[f]=X*v,U[m]=q*y,U[g]=P,l.push(U.x,U.y,U.z),U[f]=0,U[m]=0,U[g]=S>0?1:-1,h.push(U.x,U.y,U.z),c.push(j/b),c.push(1-Q/E),G+=1}}for(let Q=0;Q<E;Q++)for(let q=0;q<b;q++){let j=u+q+O*Q,X=u+q+O*(Q+1),te=u+(q+1)+O*(Q+1),K=u+(q+1)+O*Q;o.push(j,X,K),o.push(X,te,K),B+=6}n.addGroup(d,B,_),d+=B,u+=G}}static fromJSON(e){return new Hs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function _h(e){let t={};for(let i in e){t[i]={};for(let r in e[i]){let s=e[i][r];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?t[i][r]=s.clone():Array.isArray(s)?t[i][r]=s.slice():t[i][r]=s}}return t}function Or(e){let t={};for(let i=0;i<e.length;i++){let r=_h(e[i]);for(let s in r)t[s]=r[s]}return t}function Q3(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i].clone());return t}function gM(e){return e.getRenderTarget()===null&&e.outputEncoding===gt?oa:Xp}var Vh={clone:_h,merge:Or},K3=`void main() { 3 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 4}`,Z3=`void main() { 5 gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 ); 6}`,Dt=class extends zu{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=K3,this.fragmentShader=Z3,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=_h(e.uniforms),this.uniformsGroups=Q3(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(let r in this.uniforms){let s=this.uniforms[r].value;s&&s.isTexture?t.uniforms[r]={type:"t",value:s.toJSON(e).uuid}:s&&s.isColor?t.uniforms[r]={type:"c",value:s.getHex()}:s&&s.isVector2?t.uniforms[r]={type:"v2",value:s.toArray()}:s&&s.isVector3?t.uniforms[r]={type:"v3",value:s.toArray()}:s&&s.isVector4?t.uniforms[r]={type:"v4",value:s.toArray()}:s&&s.isMatrix3?t.uniforms[r]={type:"m3",value:s.toArray()}:s&&s.isMatrix4?t.uniforms[r]={type:"m4",value:s.toArray()}:t.uniforms[r]={value:s}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;let i={};for(let r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}},go=class extends Vt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new xe,this.projectionMatrix=new xe,this.projectionMatrixInverse=new xe}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},wr=class extends go{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,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=uu*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Xc*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,947 bytes, lines 6-41
6getEffectiveFOV(){return uu*2*Math.atan(Math.tan(Xc*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,r,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=i,this.view.offsetY=r,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(Xc*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let o=a.fullWidth,l=a.fullHeight;s+=a.offsetX*r/o,t-=a.offsetY*i/l,r*=a.width/o,i*=a.height/l}let n=this.filmOffset;n!==0&&(s+=e*n/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far),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}},Al=-90,Ml=1,J3=class extends Vt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i;let r=new wr(Al,Ml,e,t);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(1,0,0),this.add(r);let s=new wr(Al,Ml,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);let a=new wr(Al,Ml,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(0,1,0),this.add(a);let n=new wr(Al,Ml,e,t);n.layers=this.layers,n.up.set(0,0,1),n.lookAt(0,-1,0),this.add(n);let o=new wr(Al,Ml,e,t);o.layers=this.layers,o.up.set(0,1,0),o.lookAt(0,0,1),this.add(o);let l=new wr(Al,Ml,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,-1),this.add(l)}update(e,t){this.parent===null&&this.updateMatrixWorld();let i=this.renderTarget,[r,s,a,n,o,l]=this.children,h=e.getRenderTarget(),c=e.toneMapping,u=e.xr.enabled;e.toneMapping=ya,e.xr.enabled=!1;let d=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,s),e.setRenderTarget(i,2),e.render(t,a),e.setRenderTarget(i,3),e.render(t,n),e.setRenderTarget(i,4),e.render(t,o),i.texture.generateMipmaps=d,e.setRenderTarget(i,5),e.render(t,l),e.setRenderTarget(h),e.toneMapping=c,e.xr.enabled=u,i.texture.needsPMREMUpdate=!0}},$y=class extends li{constructor(e,t,i,r,s,a,n,o,l,h){e=e!==void 0?e:[],t=t!==void 0?t:Jo,super(e,t,i,r,s,a,n,o,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},$3=class extends Pt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new $y(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:xt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:` 7 8 varying vec3 vWorldDirection; 9 10 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 11 12 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 13 14 } 15 16 void main() { 17 18 vWorldDirection = transformDirection( position, modelMatrix ); 19 20 #include <begin_vertex> 21 #include <project_vertex> 22 23 } 24 `,fragmentShader:` 25 26 uniform sampler2D tEquirect; 27 28 varying vec3 vWorldDirection; 29 30 #include <common> 31 32 void main() { 33 34 vec3 direction = normalize( vWorldDirection ); 35 36 vec2 sampleUV = equirectUv( direction ); 37 38 gl_FragColor = texture2D( tEquirect, sampleUV ); 39 40 } 41 `},r=new Hs(5,5,5),s=new Dt({name:"CubemapFromEquirect",uniforms:_h(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:sr,blending:Ri});s.uniforms.tEquirect.value=t;let a=new Zt(r,s),n=t.minFilter;return t.minFilter===Sh&&(t.minFilter=xt),new J3(1,10,this).update(e,a),t.minFilter=n,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,r){let s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}},ng=new M,eO=new M,tO=new Ii,Hr=class{constructor(e=new M(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,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}
vendor: 2,535 bytes, line 41
41setFromCoplanarPoints(e,t,i){let r=ng.subVectors(i,t).cross(eO.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,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(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){let i=e.delta(ng),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;let s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(i).multiplyScalar(s).add(e.start)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||tO.getNormalMatrix(e),r=this.coplanarPoint(ng).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.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)}},El=new is,md=new M,e1=class{constructor(e=new Hr,t=new Hr,i=new Hr,r=new Hr,s=new Hr,a=new Hr){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){let n=this.planes;return n[0].copy(e),n[1].copy(t),n[2].copy(i),n[3].copy(r),n[4].copy(s),n[5].copy(a),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){let t=this.planes,i=e.elements,r=i[0],s=i[1],a=i[2],n=i[3],o=i[4],l=i[5],h=i[6],c=i[7],u=i[8],d=i[9],p=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];return t[0].setComponents(n-r,c-o,f-u,y-m).normalize(),t[1].setComponents(n+r,c+o,f+u,y+m).normalize(),t[2].setComponents(n+s,c+l,f+d,y+g).normalize(),t[3].setComponents(n-s,c-l,f-d,y-g).normalize(),t[4].setComponents(n-a,c-h,f-p,y-v).normalize(),t[5].setComponents(n+a,c+h,f+p,y+v).normalize(),this}intersectsObject(e){let t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),El.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(El)}intersectsSprite(e){return El.center.set(0,0,0),El.radius=.7071067811865476,El.applyM
vendor: 5,307 bytes, lines 41-89
41atrix4(e.matrixWorld),this.intersectsSphere(El)}intersectsSphere(e){let t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let r=t[i];if(md.x=r.normal.x>0?e.max.x:e.min.x,md.y=r.normal.y>0?e.max.y:e.min.y,md.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(md)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function vM(){let e=null,t=!1,i=null,r=null;function s(a,n){i(a,n),r=e.requestAnimationFrame(s)}return{start:function(){t!==!0&&i!==null&&(r=e.requestAnimationFrame(s),t=!0)},stop:function(){e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(a){i=a},setContext:function(a){e=a}}}function iO(e,t){let i=t.isWebGL2,r=new WeakMap;function s(h,c){let u=h.array,d=h.usage,p=e.createBuffer();e.bindBuffer(c,p),e.bufferData(c,u,d),h.onUploadCallback();let f;if(u instanceof Float32Array)f=5126;else if(u instanceof Uint16Array)if(h.isFloat16BufferAttribute)if(i)f=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else f=5123;else if(u instanceof Int16Array)f=5122;else if(u instanceof Uint32Array)f=5125;else if(u instanceof Int32Array)f=5124;else if(u instanceof Int8Array)f=5120;else if(u instanceof Uint8Array)f=5121;else if(u instanceof Uint8ClampedArray)f=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:p,type:f,bytesPerElement:u.BYTES_PER_ELEMENT,version:h.version}}function a(h,c,u){let d=c.array,p=c.updateRange;e.bindBuffer(u,h),p.count===-1?e.bufferSubData(u,0,d):(i?e.bufferSubData(u,p.offset*d.BYTES_PER_ELEMENT,d,p.offset,p.count):e.bufferSubData(u,p.offset*d.BYTES_PER_ELEMENT,d.subarray(p.offset,p.offset+p.count)),p.count=-1),c.onUploadCallback()}function n(h){return h.isInterleavedBufferAttribute&&(h=h.data),r.get(h)}function o(h){h.isInterleavedBufferAttribute&&(h=h.data);let c=r.get(h);c&&(e.deleteBuffer(c.buffer),r.delete(h))}function l(h,c){if(h.isGLBufferAttribute){let d=r.get(h);(!d||d.version<h.version)&&r.set(h,{buffer:h.buffer,type:h.type,bytesPerElement:h.elementSize,version:h.version});return}h.isInterleavedBufferAttribute&&(h=h.data);let u=r.get(h);u===void 0?r.set(h,s(h,c)):u.version<h.version&&(a(u.buffer,h,c),u.version=h.version)}return{get:n,remove:o,update:l}}var Sa=class extends He{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};let s=e/2,a=t/2,n=Math.floor(i),o=Math.floor(r),l=n+1,h=o+1,c=e/n,u=t/o,d=[],p=[],f=[],m=[];for(let g=0;g<h;g++){let v=g*u-a;for(let y=0;y<l;y++){let x=y*c-s;p.push(x,-v,0),f.push(0,0,1),m.push(y/n),m.push(1-g/o)}}for(let g=0;g<o;g++)for(let v=0;v<n;v++){let y=v+l*g,x=v+l*(g+1),w=v+1+l*(g+1),S=v+1+l*g;d.push(y,x,S),d.push(x,w,S)}this.setIndex(d),this.setAttribute("position",new De(p,3)),this.setAttribute("normal",new De(f,3)),this.setAttribute("uv",new De(m,2))}static fromJSON(e){return new Sa(e.width,e.height,e.widthSegments,e.heightSegments)}},rO=`#ifdef USE_ALPHAMAP 42 diffuseColor.a *= texture2D( alphaMap, vUv ).g; 43#endif`,sO=`#ifdef USE_ALPHAMAP 44 uniform sampler2D alphaMap; 45#endif`,aO=`#ifdef USE_ALPHATEST 46 if ( diffuseColor.a < alphaTest ) discard; 47#endif`,nO=`#ifdef USE_ALPHATEST 48 uniform float alphaTest; 49#endif`,oO=`#ifdef USE_AOMAP 50 float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0; 51 reflectedLight.indirectDiffuse *= ambientOcclusion; 52 #if defined( USE_ENVMAP ) && defined( STANDARD ) 53 float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); 54 reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness ); 55 #endif 56#endif`,lO=`#ifdef USE_AOMAP 57 uniform sampler2D aoMap; 58 uniform float aoMapIntensity; 59#endif`,hO="vec3 transformed = vec3( position );",cO=`vec3 objectNormal = vec3( normal ); 60#ifdef USE_TANGENT 61 vec3 objectTangent = vec3( tangent.xyz ); 62#endif`,uO=`vec3 BRDF_Lambert( const in vec3 diffuseColor ) { 63 return RECIPROCAL_PI * diffuseColor; 64} 65vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { 66 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 67 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 68} 69float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { 70 float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); 71 return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); 72} 73vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { 74 float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); 75 float x2 = x * x; 76 float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); 77 return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); 78} 79float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { 80 float a2 = pow2( alpha ); 81 float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); 82 float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); 83 return 0.5 / max( gv + gl, EPSILON ); 84} 85float D_GGX( const in float alpha, const in float dotNH ) { 86 float a2 = pow2( alpha ); 87 float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; 88 return RECIPROCAL_PI * a2 / pow2( denom ); 89}
90vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) { 91 float alpha = pow2( roughness ); 92 vec3 halfDir = normalize( lightDir + viewDir ); 93 float dotNL = saturate( dot( normal, lightDir ) ); 94 float dotNV = saturate( dot( normal, viewDir ) ); 95 float dotNH = saturate( dot( normal, halfDir ) ); 96 float dotVH = saturate( dot( viewDir, halfDir ) ); 97 vec3 F = F_Schlick( f0, f90, dotVH ); 98 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 99 float D = D_GGX( alpha, dotNH ); 100 return F * ( V * D ); 101} 102#ifdef USE_IRIDESCENCE 103 vec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) { 104 float alpha = pow2( roughness ); 105 vec3 halfDir = normalize( lightDir + viewDir ); 106 float dotNL = saturate( dot( normal, lightDir ) ); 107 float dotNV = saturate( dot( normal, viewDir ) ); 108 float dotNH = saturate( dot( normal, halfDir ) ); 109 float dotVH = saturate( dot( viewDir, halfDir ) ); 110 vec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence ); 111 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); 112 float D = D_GGX( alpha, dotNH ); 113 return F * ( V * D ); 114 } 115#endif 116vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { 117 const float LUT_SIZE = 64.0; 118 const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; 119 const float LUT_BIAS = 0.5 / LUT_SIZE; 120 float dotNV = saturate( dot( N, V ) ); 121 vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); 122 uv = uv * LUT_SCALE + LUT_BIAS; 123 return uv; 124} 125float LTC_ClippedSphereFormFactor( const in vec3 f ) { 126 float l = length( f ); 127 return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); 128} 129vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { 130 float x = dot( v1, v2 ); 131 float y = abs( x ); 132 float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; 133 float b = 3.4175940 + ( 4.1616724 + y ) * y; 134 float v = a / b; 135 float theta_sintheta = ( x >
135 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; 136 return cross( v1, v2 ) * theta_sintheta; 137} 138vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { 139 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; 140 vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; 141 vec3 lightNormal = cross( v1, v2 ); 142 if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); 143 vec3 T1, T2; 144 T1 = normalize( V - N * dot( V, N ) ); 145 T2 = - cross( N, T1 ); 146 mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); 147 vec3 coords[ 4 ]; 148 coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); 149 coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); 150 coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); 151 coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); 152 coords[ 0 ] = normalize( coords[ 0 ] ); 153 coords[ 1 ] = normalize( coords[ 1 ] ); 154 coords[ 2 ] = normalize( coords[ 2 ] ); 155 coords[ 3 ] = normalize( coords[ 3 ] ); 156 vec3 vectorFormFactor = vec3( 0.0 ); 157 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); 158 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); 159 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); 160 vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); 161 float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); 162 return vec3( result ); 163} 164float G_BlinnPhong_Implicit( ) { 165 return 0.25; 166} 167float D_BlinnPhong( const in float shininess, const in float dotNH ) { 168 return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); 169} 170vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { 171 vec3 halfDir = normalize( lightDir + viewDir ); 172 float dotNH = saturate( dot( normal, halfDir ) ); 173 float dotVH = saturate( dot( viewDir, halfDir ) ); 174 vec3 F = F_Schlick( specularColor, 1.0, dotVH ); 175 float G = G_BlinnPhong_Implicit( ); 176 float D = D_BlinnPhong( shininess, dotNH ); 177 return F * ( G * D ); 178} 179#if defined( USE_SHEEN ) 180float D_Charlie( float roughness, float dotNH ) { 181 float alpha = pow2( roughness ); 182 float invAlpha = 1.0 / alpha; 183 float cos2h = dotNH * dotNH; 184 float sin2h = max( 1.0 - cos2h, 0.0078125 ); 185 return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); 186} 187float V_Neubelt( float dotNV, float dotNL ) { 188 return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); 189} 190vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { 191 vec3 halfDir = normalize( lightDir + viewDir ); 192 float dotNL = saturate( dot( normal, lightDir ) ); 193 float dotNV = saturate( dot( normal, viewDir ) ); 194 float dotNH = saturate( dot( normal, halfDir ) ); 195 float D = D_Charlie( sheenRoughness, dotNH ); 196 float V = V_Neubelt( dotNV, dotNL ); 197 return sheenColor * ( D * V ); 198} 199#endif`,dO=`#ifdef USE_IRIDESCENCE 200 const mat3 XYZ_TO_REC709 = mat3( 201 3.2404542, -0.9692660, 0.0556434, 202 -1.5371385, 1.8760108, -0.2040259, 203 -0.4985314, 0.0415560, 1.0572252 204 ); 205 vec3 Fresnel0ToIor( vec3 fresnel0 ) { 206 vec3 sqrtF0 = sqrt( fresnel0 ); 207 return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); 208 } 209 vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { 210 return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); 211 } 212 float IorToFresnel0( float transmittedIor, float incidentIor ) { 213 return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); 214 } 215 vec3 evalSensitivity( float OPD, vec3 shift ) { 216 float phase = 2.0 * PI * OPD * 1.0e-9; 217 vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); 218 vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); 219 vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); 220 vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); 221 xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); 222 xyz /= 1.0685e-7; 223 vec3 rgb = XYZ_TO_REC709 * xyz; 224 return rgb; 225 } 226 vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { 227 vec3 I; 228 float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); 229 float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); 230 float cosTheta2Sq = 1.0 - sinTheta2Sq; 231 if ( cosTheta2Sq < 0.0 ) { 232 return vec3( 1.0 ); 233 } 234 float cosTheta2 = sqrt( cosTheta2Sq ); 235 float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
236 float R12 = F_Schlick( R0, 1.0, cosTheta1 ); 237 float R21 = R12; 238 float T121 = 1.0 - R12; 239 float phi12 = 0.0; 240 if ( iridescenceIOR < outsideIOR ) phi12 = PI; 241 float phi21 = PI - phi12; 242 vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); 243 vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); 244 vec3 phi23 = vec3( 0.0 ); 245 if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; 246 if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; 247 if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; 248 float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; 249 vec3 phi = vec3( phi21 ) + phi23; 250 vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); 251 vec3 r123 = sqrt( R123 ); 252 vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); 253 vec3 C0 = R12 + Rs; 254 I = C0; 255 vec3 Cm = Rs - T121; 256 for ( int m = 1; m <= 2; ++ m ) { 257 Cm *= r123; 258 vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); 259 I += Cm * Sm; 260 } 261 return max( I, vec3( 0.0 ) ); 262 } 263#endif`,pO=`#ifdef USE_BUMPMAP 264 uniform sampler2D bumpMap; 265 uniform float bumpScale; 266 vec2 dHdxy_fwd() { 267 vec2 dSTdx = dFdx( vUv ); 268 vec2 dSTdy = dFdy( vUv ); 269 float Hll = bumpScale * texture2D( bumpMap, vUv ).x; 270 float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll; 271 float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll; 272 return vec2( dBx, dBy ); 273 } 274 vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 275 vec3 vSigmaX = dFdx( surf_pos.xyz ); 276 vec3 vSigmaY = dFdy( surf_pos.xyz ); 277 vec3 vN = surf_norm; 278 vec3 R1 = cross( vSigmaY, vN ); 279 vec3 R2 = cross( vN, vSigmaX ); 280 float fDet = dot( vSigmaX, R1 ) * faceDirection; 281 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 282 return normalize( abs( fDet ) * surf_norm - vGrad ); 283 } 284#endif`,fO=`#if NUM_CLIPPING_PLANES > 0 285 vec4 plane; 286 #pragma unroll_loop_start 287 for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { 288 plane = clippingPlanes[ i ]; 289 if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; 290 } 291 #pragma unroll_loop_end 292 #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES 293 bool clipped = true; 294 #pragma unroll_loop_start 295 for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { 296 plane = clippingPlanes[ i ]; 297 clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; 298 } 299 #pragma unroll_loop_end 300 if ( clipped ) discard; 301 #endif 302#endif`,mO=`#if NUM_CLIPPING_PLANES > 0 303 varying vec3 vClipPosition; 304 uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; 305#endif`,gO=`#if NUM_CLIPPING_PLANES > 0 306 varying vec3 vClipPosition; 307#endif`,vO=`#if NUM_CLIPPING_PLANES > 0 308 vClipPosition = - mvPosition.xyz; 309#endif`,yO=`#if defined( USE_COLOR_ALPHA ) 310 diffuseColor *= vColor; 311#elif defined( USE_COLOR ) 312 diffuseColor.rgb *= vColor; 313#endif`,xO=`#if defined( USE_COLOR_ALPHA ) 314 varying vec4 vColor; 315#elif defined( USE_COLOR ) 316 varying vec3 vColor; 317#endif`,bO=`#if defined( USE_COLOR_ALPHA ) 318 varying vec4 vColor; 319#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 320 varying vec3 vColor; 321#endif`,wO=`#if defined( USE_COLOR_ALPHA ) 322 vColor = vec4( 1.0 ); 323#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) 324 vColor = vec3( 1.0 ); 325#endif 326#ifdef USE_COLOR 327 vColor *= color; 328#endif 329#ifdef USE_INSTANCING_COLOR 330 vColor.xyz *= instanceColor.xyz; 331#endif`,SO=`#define PI 3.141592653589793 332#define PI2 6.283185307179586 333#define PI_HALF 1.5707963267948966 334#define RECIPROCAL_PI 0.3183098861837907 335#define RECIPROCAL_PI2 0.15915494309189535 336#define EPSILON 1e-6 337#ifndef saturate 338#define saturate( a ) clamp( a, 0.0, 1.0 ) 339#endif 340#define whiteComplement( a ) ( 1.0 - saturate( a ) ) 341float pow2( const in float x ) { return x*x; } 342vec3 pow2( const in vec3 x ) { return x*x; } 343float pow3( const in float x ) { return x*x*x; } 344float pow4( const in float x ) { float x2 = x*x; return x2*x2; } 345float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } 346float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 347highp float rand( const in vec2 uv ) { 348 const highp float a = 12.9898, b = 78.233, c = 43758.5453; 349 highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); 350 return fract( sin( sn ) * c ); 351} 352#ifdef HIGH_PRECISION 353 float precisionSafeLength( vec3 v ) { return length( v ); } 354#else 355 float precisionSafeLength( vec3 v ) { 356 float maxComponent = max3( abs( v ) ); 357 return length( v / maxComponent ) * maxComponent; 358 } 359#endif 360struct IncidentLight { 361 vec3 color; 362 vec3 direction; 363 bool visible; 364}; 365struct ReflectedLight { 366 vec3 directDiffuse; 367 vec3 directSpecular; 368 vec3 indirectDiffuse; 369 vec3 indirectSpecular; 370}; 371struct GeometricContext { 372 vec3 position; 373 vec3 normal; 374 vec3 viewDir; 375#ifdef USE_CLEARCOAT 376 vec3 clearcoatNormal; 377#endif 378}; 379vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 380 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 381} 382vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { 383 return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); 384} 385mat3 transposeMat3( const in mat3 m ) { 386 mat3 tmp; 387 tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); 388 tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); 389 tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); 390 return tmp; 391} 392float luminance( const in vec3 rgb ) { 393 const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); 394 return dot( weights, rgb ); 395} 396bool isPerspectiveMatrix( mat4 m ) { 397 return m[ 2 ][ 3 ] == - 1.0; 398} 399vec2 equirectUv( in vec3 dir ) { 400 float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; 401 float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; 402 return vec2( u, v ); 403}`,_O=`#ifdef ENVMAP_TYPE_CUBE_UV 404 #define cubeUV_minMipLevel 4.0 405 #define cubeUV_minTileSize 16.0 406 float getFace( vec3 direction ) { 407 vec3 absDirection = abs( direction ); 408 float face = - 1.0; 409 if ( absDirection.x > absDirection.z ) { 410 if ( absDirection.x > absDirection.y ) 411 face = direction.x > 0.0 ? 0.0 : 3.0; 412 else 413 face = direction.y > 0.0 ? 1.0 : 4.0; 414 } else { 415 if ( absDirection.z > absDirection.y ) 416 face = direction.z > 0.0 ? 2.0 : 5.0; 417 else 418 face = direction.y > 0.0 ? 1.0 : 4.0; 419 } 420 return face; 421 } 422 vec2 getUV( vec3 direction, float face ) { 423 vec2 uv; 424 if ( face == 0.0 ) { 425 uv = vec2( direction.z, direction.y ) / abs( direction.x ); 426 } else if ( face == 1.0 ) { 427 uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); 428 } else if ( face == 2.0 ) { 429 uv = vec2( - direction.x, direction.y ) / abs( direction.z ); 430 } else if ( face == 3.0 ) { 431 uv = vec2( - direction.z, direction.y ) / abs( direction.x ); 432 } else if ( face == 4.0 ) { 433 uv = vec2( - direction.x, direction.z ) / abs( direction.y ); 434 } else { 435 uv = vec2( direction.x, direction.y ) / abs( direction.z ); 436 } 437 return 0.5 * ( uv + 1.0 ); 438 } 439 vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { 440 float face = getFace( direction ); 441 float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); 442 mipInt = max( mipInt, cubeUV_minMipLevel ); 443 float faceSize = exp2( mipInt );
444 highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; 445 if ( face > 2.0 ) { 446 uv.y += faceSize; 447 face -= 3.0; 448 } 449 uv.x += face * faceSize; 450 uv.x += filterInt * 3.0 * cubeUV_minTileSize; 451 uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); 452 uv.x *= CUBEUV_TEXEL_WIDTH; 453 uv.y *= CUBEUV_TEXEL_HEIGHT; 454 #ifdef texture2DGradEXT 455 return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; 456 #else 457 return texture2D( envMap, uv ).rgb; 458 #endif 459 } 460 #define cubeUV_r0 1.0 461 #define cubeUV_v0 0.339 462 #define cubeUV_m0 - 2.0 463 #define cubeUV_r1 0.8 464 #define cubeUV_v1 0.276 465 #define cubeUV_m1 - 1.0 466 #define cubeUV_r4 0.4 467 #define cubeUV_v4 0.046 468 #define cubeUV_m4 2.0 469 #define cubeUV_r5 0.305 470 #define cubeUV_v5 0.016 471 #define cubeUV_m5 3.0 472 #define cubeUV_r6 0.21 473 #define cubeUV_v6 0.0038 474 #define cubeUV_m6 4.0 475 float roughnessToMip( float roughness ) { 476 float mip = 0.0; 477 if ( roughness >= cubeUV_r1 ) { 478 mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; 479 } else if ( roughness >= cubeUV_r4 ) { 480 mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; 481 } else if ( roughness >= cubeUV_r5 ) { 482 mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; 483 } else if ( roughness >= cubeUV_r6 ) { 484 mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; 485 } else { 486 mip = - 2.0 * log2( 1.16 * roughness ); } 487 return mip; 488 } 489 vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { 490 float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); 491 float mipF = fract( mip ); 492 float mipInt = floor( mip ); 493 vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); 494 if ( mipF == 0.0 ) { 495 return vec4( color0, 1.0 ); 496 } else { 497 vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); 498 return vec4( mix( color0, color1, mipF ), 1.0 ); 499 } 500 } 501#endif`,AO=`vec3 transformedNormal = objectNormal; 502#ifdef USE_INSTANCING 503 mat3 m = mat3( instanceMatrix ); 504 transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); 505 transformedNormal = m * transformedNormal; 506#endif 507transformedNormal = normalMatrix * transformedNormal; 508#ifdef FLIP_SIDED 509 transformedNormal = - transformedNormal; 510#endif 511#ifdef USE_TANGENT 512 vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; 513 #ifdef FLIP_SIDED 514 transformedTangent = - transformedTangent; 515 #endif 516#endif`,MO=`#ifdef USE_DISPLACEMENTMAP 517 uniform sampler2D displacementMap; 518 uniform float displacementScale; 519 uniform float displacementBias; 520#endif`,EO=`#ifdef USE_DISPLACEMENTMAP 521 transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias ); 522#endif`,CO=`#ifdef USE_EMISSIVEMAP 523 vec4 emissiveColor = texture2D( emissiveMap, vUv ); 524 totalEmissiveRadiance *= emissiveColor.rgb; 525#endif`,TO=`#ifdef USE_EMISSIVEMAP 526 uniform sampler2D emissiveMap; 527#endif`,PO="gl_FragColor = linearToOutputTexel( gl_FragColor );",DO=`vec4 LinearToLinear( in vec4 value ) { 528 return value; 529} 530vec4 LinearTosRGB( in vec4 value ) { 531 return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); 532}`,OO=`#ifdef USE_ENVMAP 533 #ifdef ENV_WORLDPOS 534 vec3 cameraToFrag; 535 if ( isOrthographic ) { 536 cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 537 } else { 538 cameraToFrag = normalize( vWorldPosition - cameraPosition ); 539 } 540 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 541 #ifdef ENVMAP_MODE_REFLECTION 542 vec3 reflectVec = reflect( cameraToFrag, worldNormal ); 543 #else 544 vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); 545 #endif 546 #else 547 vec3 reflectVec = vReflect; 548 #endif 549 #ifdef ENVMAP_TYPE_CUBE 550 vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); 551 #else 552 vec4 envColor = vec4( 0.0 ); 553 #endif 554 #ifdef ENVMAP_BLENDING_MULTIPLY 555 outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); 556 #elif defined( ENVMAP_BLENDING_MIX ) 557 outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); 558 #elif defined( ENVMAP_BLENDING_ADD ) 559 outgoingLight += envColor.xyz * specularStrength * reflectivity; 560 #endif 561#endif`,IO=`#ifdef USE_ENVMAP 562 uniform float envMapIntensity; 563 uniform float flipEnvMap; 564 #ifdef ENVMAP_TYPE_CUBE 565 uniform samplerCube envMap; 566 #else 567 uniform sampler2D envMap; 568 #endif 569 570#endif`,RO=`#ifdef USE_ENVMAP 571 uniform float reflectivity; 572 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 573 #define ENV_WORLDPOS 574 #endif 575 #ifdef ENV_WORLDPOS 576 varying vec3 vWorldPosition; 577 uniform float refractionRatio; 578 #else 579 varying vec3 vReflect; 580 #endif 581#endif`,LO=`#ifdef USE_ENVMAP 582 #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) 583 #define ENV_WORLDPOS 584 #endif 585 #ifdef ENV_WORLDPOS 586 587 varying vec3 vWorldPosition; 588 #else 589 varying vec3 vReflect; 590 uniform float refractionRatio; 591 #endif 592#endif`,zO=`#ifdef USE_ENVMAP 593 #ifdef ENV_WORLDPOS 594 vWorldPosition = worldPosition.xyz; 595 #else 596 vec3 cameraToVertex; 597 if ( isOrthographic ) { 598 cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 599 } else {
600 cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); 601 } 602 vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 603 #ifdef ENVMAP_MODE_REFLECTION 604 vReflect = reflect( cameraToVertex, worldNormal ); 605 #else 606 vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); 607 #endif 608 #endif 609#endif`,BO=`#ifdef USE_FOG 610 vFogDepth = - mvPosition.z; 611#endif`,FO=`#ifdef USE_FOG 612 varying float vFogDepth; 613#endif`,kO=`#ifdef USE_FOG 614 #ifdef FOG_EXP2 615 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); 616 #else 617 float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); 618 #endif 619 gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); 620#endif`,UO=`#ifdef USE_FOG 621 uniform vec3 fogColor; 622 varying float vFogDepth; 623 #ifdef FOG_EXP2 624 uniform float fogDensity; 625 #else 626 uniform float fogNear; 627 uniform float fogFar; 628 #endif 629#endif`,NO=`#ifdef USE_GRADIENTMAP 630 uniform sampler2D gradientMap; 631#endif 632vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { 633 float dotNL = dot( normal, lightDirection ); 634 vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); 635 #ifdef USE_GRADIENTMAP 636 return vec3( texture2D( gradientMap, coord ).r ); 637 #else 638 vec2 fw = fwidth( coord ) * 0.5; 639 return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); 640 #endif 641}`,VO=`#ifdef USE_LIGHTMAP 642 vec4 lightMapTexel = texture2D( lightMap, vUv2 ); 643 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 644 reflectedLight.indirectDiffuse += lightMapIrradiance; 645#endif`,jO=`#ifdef USE_LIGHTMAP 646 uniform sampler2D lightMap; 647 uniform float lightMapIntensity; 648#endif`,HO=`LambertMaterial material; 649material.diffuseColor = diffuseColor.rgb; 650material.specularStrength = specularStrength;`,GO=`varying vec3 vViewPosition; 651struct LambertMaterial { 652 vec3 diffuseColor; 653 float specularStrength; 654}; 655void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 656 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 657 vec3 irradiance = dotNL * directLight.color; 658 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 659} 660void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { 661 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 662} 663#define RE_Direct RE_Direct_Lambert 664#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,WO=`uniform bool receiveShadow; 665uniform vec3 ambientLightColor; 666uniform vec3 lightProbe[ 9 ]; 667vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { 668 float x = normal.x, y = normal.y, z = normal.z; 669 vec3 result = shCoefficients[ 0 ] * 0.886227; 670 result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; 671 result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; 672 result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; 673 result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; 674 result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; 675 result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); 676 result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; 677 result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); 678 return result; 679} 680vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { 681 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 682 vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); 683 return irradiance; 684} 685vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { 686 vec3 irradiance = ambientLightColor; 687 return irradiance; 688} 689float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { 690 #if defined ( PHYSICALLY_CORRECT_LIGHTS ) 691 float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); 692 if ( cutoffDistance > 0.0 ) { 693 distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); 694 } 695 return distanceFalloff; 696 #else 697 if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { 698 return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); 699 } 700 return 1.0; 701 #endif 702} 703float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { 704 return smoothstep( coneCosine, penumbraCosine, angleCosine ); 705} 706#if NUM_DIR_LIGHTS > 0 707 struct DirectionalLight { 708 vec3 direction; 709 vec3 color; 710 }; 711 uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; 712 void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) { 713 light.color = directionalLight.color; 714 light.direction = directionalLight.direction; 715 light.visible = true; 716 } 717#endif 718#if NUM_POINT_LIGHTS > 0 719 struct PointLight { 720 vec3 position; 721 vec3 color; 722 float distance; 723 float decay; 724 }; 725 uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; 726 void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) { 727 vec3 lVector = pointLight.position - geometry.position; 728 light.direction = normalize( lVector ); 729 float lightDistance = length( lVector ); 730 light.color = pointLight.color; 731 light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); 732 light.visible = ( light.color != vec3( 0.0 ) ); 733 } 734#endif
735#if NUM_SPOT_LIGHTS > 0 736 struct SpotLight { 737 vec3 position; 738 vec3 direction; 739 vec3 color; 740 float distance; 741 float decay; 742 float coneCos; 743 float penumbraCos; 744 }; 745 uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; 746 void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) { 747 vec3 lVector = spotLight.position - geometry.position; 748 light.direction = normalize( lVector ); 749 float angleCos = dot( light.direction, spotLight.direction ); 750 float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); 751 if ( spotAttenuation > 0.0 ) { 752 float lightDistance = length( lVector ); 753 light.color = spotLight.color * spotAttenuation; 754 light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); 755 light.visible = ( light.color != vec3( 0.0 ) ); 756 } else { 757 light.color = vec3( 0.0 ); 758 light.visible = false; 759 } 760 } 761#endif 762#if NUM_RECT_AREA_LIGHTS > 0 763 struct RectAreaLight { 764 vec3 color; 765 vec3 position; 766 vec3 halfWidth; 767 vec3 halfHeight; 768 }; 769 uniform sampler2D ltc_1; uniform sampler2D ltc_2; 770 uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; 771#endif 772#if NUM_HEMI_LIGHTS > 0 773 struct HemisphereLight { 774 vec3 direction; 775 vec3 skyColor; 776 vec3 groundColor; 777 }; 778 uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; 779 vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { 780 float dotNL = dot( normal, hemiLight.direction ); 781 float hemiDiffuseWeight = 0.5 * dotNL + 0.5; 782 vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); 783 return irradiance; 784 } 785#endif`,qO=`#if defined( USE_ENVMAP ) 786 vec3 getIBLIrradiance( const in vec3 normal ) { 787 #if defined( ENVMAP_TYPE_CUBE_UV ) 788 vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); 789 vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); 790 return PI * envMapColor.rgb * envMapIntensity; 791 #else 792 return vec3( 0.0 ); 793 #endif 794 } 795 vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { 796 #if defined( ENVMAP_TYPE_CUBE_UV ) 797 vec3 reflectVec = reflect( - viewDir, normal ); 798 reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); 799 reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); 800 vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); 801 return envMapColor.rgb * envMapIntensity; 802 #else 803 return vec3( 0.0 ); 804 #endif 805 } 806#endif`,XO=`ToonMaterial material; 807material.diffuseColor = diffuseColor.rgb;`,YO=`varying vec3 vViewPosition; 808struct ToonMaterial { 809 vec3 diffuseColor; 810}; 811void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 812 vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; 813 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 814} 815void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 816 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 817} 818#define RE_Direct RE_Direct_Toon 819#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,QO=`BlinnPhongMaterial material; 820material.diffuseColor = diffuseColor.rgb; 821material.specularColor = specular; 822material.specularShininess = shininess; 823material.specularStrength = specularStrength;`,KO=`varying vec3 vViewPosition; 824struct BlinnPhongMaterial { 825 vec3 diffuseColor; 826 vec3 specularColor; 827 float specularShininess; 828 float specularStrength; 829}; 830void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 831 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 832 vec3 irradiance = dotNL * directLight.color; 833 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 834 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; 835} 836void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { 837 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 838} 839#define RE_Direct RE_Direct_BlinnPhong 840#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,ZO=`PhysicalMaterial material; 841material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); 842vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); 843float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); 844material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; 845material.roughness = min( material.roughness, 1.0 ); 846#ifdef IOR 847 material.ior = ior; 848 #ifdef SPECULAR 849 float specularIntensityFactor = specularIntensity; 850 vec3 specularColorFactor = specularColor; 851 #ifdef USE_SPECULARINTENSITYMAP 852 specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a; 853 #endif 854 #ifdef USE_SPECULARCOLORMAP 855 specularColorFactor *= texture2D( specularColorMap, vUv ).rgb; 856 #endif 857 material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); 858 #else 859 float specularIntensityFactor = 1.0; 860 vec3 specularColorFactor = vec3( 1.0 ); 861 material.specularF90 = 1.0; 862 #endif 863 material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); 864#else 865 material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); 866 material.specularF90 = 1.0; 867#endif 868#ifdef USE_CLEARCOAT 869 material.clearcoat = clearcoat; 870 material.clearcoatRoughness = clearcoatRoughness; 871 material.clearcoatF0 = vec3( 0.04 ); 872 material.clearcoatF90 = 1.0; 873 #ifdef USE_CLEARCOATMAP 874 material.clearcoat *= texture2D( clearcoatMap, vUv ).x; 875 #endif 876 #ifdef USE_CLEARCOAT_ROUGHNESSMAP 877 material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y; 878 #endif 879 material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); 880 material.clearcoatRoughness += geometryRoughness; 881 material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); 882#endif
883#ifdef USE_IRIDESCENCE 884 material.iridescence = iridescence; 885 material.iridescenceIOR = iridescenceIOR; 886 #ifdef USE_IRIDESCENCEMAP 887 material.iridescence *= texture2D( iridescenceMap, vUv ).r; 888 #endif 889 #ifdef USE_IRIDESCENCE_THICKNESSMAP 890 material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum; 891 #else 892 material.iridescenceThickness = iridescenceThicknessMaximum; 893 #endif 894#endif 895#ifdef USE_SHEEN 896 material.sheenColor = sheenColor; 897 #ifdef USE_SHEENCOLORMAP 898 material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb; 899 #endif 900 material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); 901 #ifdef USE_SHEENROUGHNESSMAP 902 material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a; 903 #endif 904#endif`,JO=`struct PhysicalMaterial { 905 vec3 diffuseColor; 906 float roughness; 907 vec3 specularColor; 908 float specularF90; 909 #ifdef USE_CLEARCOAT 910 float clearcoat; 911 float clearcoatRoughness; 912 vec3 clearcoatF0; 913 float clearcoatF90; 914 #endif 915 #ifdef USE_IRIDESCENCE 916 float iridescence; 917 float iridescenceIOR; 918 float iridescenceThickness; 919 vec3 iridescenceFresnel; 920 vec3 iridescenceF0; 921 #endif 922 #ifdef USE_SHEEN 923 vec3 sheenColor; 924 float sheenRoughness; 925 #endif 926 #ifdef IOR 927 float ior; 928 #endif 929 #ifdef USE_TRANSMISSION 930 float transmission; 931 float transmissionAlpha; 932 float thickness; 933 float attenuationDistance; 934 vec3 attenuationColor; 935 #endif 936}; 937vec3 clearcoatSpecular = vec3( 0.0 ); 938vec3 sheenSpecular = vec3( 0.0 ); 939float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 940 float dotNV = saturate( dot( normal, viewDir ) ); 941 float r2 = roughness * roughness; 942 float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; 943 float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; 944 float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); 945 return saturate( DG * RECIPROCAL_PI ); 946} 947vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { 948 float dotNV = saturate( dot( normal, viewDir ) ); 949 const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); 950 const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); 951 vec4 r = roughness * c0 + c1; 952 float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; 953 vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; 954 return fab; 955} 956vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { 957 vec2 fab = DFGApprox( normal, viewDir, roughness ); 958 return specularColor * fab.x + specularF90 * fab.y; 959} 960#ifdef USE_IRIDESCENCE 961void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 962#else 963void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { 964#endif 965 vec2 fab = DFGApprox( normal, viewDir, roughness ); 966 #ifdef USE_IRIDESCENCE 967 vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); 968 #else 969 vec3 Fr = specularColor; 970 #endif 971 vec3 FssEss = Fr * fab.x + specularF90 * fab.y; 972 float Ess = fab.x + fab.y; 973 float Ems = 1.0 - Ess; 974 vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); 975 singleScatter += FssEss; 976 multiScatter += Fms * Ems; 977} 978#if NUM_RECT_AREA_LIGHTS > 0 979 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 980 vec3 normal = geometry.normal; 981 vec3 viewDir = geometry.viewDir; 982 vec3 position = geometry.position; 983 vec3 lightPos = rectAreaLight.position; 984 vec3 halfWidth = rectAreaLight.halfWidth; 985 vec3 halfHeight = rectAreaLight.halfHeight; 986 vec3 lightColor = rectAreaLight.color; 987 float roughness = material.roughness; 988 vec3 rectCoords[ 4 ]; 989 rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; 990 rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; 991 rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; 992 vec2 uv = LTC_Uv( normal, viewDir, roughness ); 993 vec4 t1 = texture2D( ltc_1, uv ); 994 vec4 t2 = texture2D( ltc_2, uv ); 995 mat3 mInv = mat3( 996 vec3( t1.x, 0, t1.y ), 997 vec3( 0, 1, 0 ), 998 vec3( t1.z, 0, t1.w ) 999 ); 1000 vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); 1001 reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); 1002 reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); 1003 } 1004#endif 1005void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1006 float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); 1007 vec3 irradiance = dotNL * directLight.color; 1008 #ifdef USE_CLEARCOAT 1009 float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); 1010 vec3 ccIrradiance = dotNLcc * directLight.color; 1011 clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1012 #endif 1013 #ifdef USE_SHEEN 1014 sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); 1015 #endif 1016 #ifdef USE_IRIDESCENCE 1017 reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness ); 1018 #else 1019 reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness ); 1020 #endif 1021 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1022} 1023void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { 1024 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 1025} 1026void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { 1027 #ifdef USE_CLEARCOAT 1028 clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); 1029 #endif 1030 #ifdef USE_SHEEN 1031 sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); 1032 #endif 1033 vec3 singleScattering = vec3( 0.0 ); 1034 vec3 multiScattering = vec3( 0.0 ); 1035 vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; 1036 #ifdef USE_IRIDESCENCE 1037 computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); 1038 #else 1039 computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); 1040 #endif 1041 vec3 totalScattering = singleScattering + multiScattering; 1042 vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); 1043 reflectedLight.indirectSpecular += radiance * singleScattering; 1044 reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; 1045 reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; 1046} 1047#define RE_Direct RE_Direct_Physical 1048#define RE_Direct_RectArea RE_Direct_RectArea_Physical 1049#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical 1050#define RE_IndirectSpecular RE_IndirectSpecular_Physical 1051float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { 1052 return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); 1053}`,$O=` 1054GeometricContext geometry; 1055geometry.position = - vViewPosition; 1056geometry.normal = normal; 1057geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); 1058#ifdef USE_CLEARCOAT 1059 geometry.clearcoatNormal = clearcoatNormal; 1060#endif 1061#ifdef USE_IRIDESCENCE 1062 float dotNVi = saturate( dot( normal, geometry.viewDir ) ); 1063 if ( material.iridescenceThickness == 0.0 ) { 1064 material.iridescence = 0.0; 1065 } else { 1066 material.iridescence = saturate( material.iridescence ); 1067 } 1068 if ( material.iridescence > 0.0 ) { 1069 material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); 1070 material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); 1071 } 1072#endif 1073IncidentLight directLight; 1074#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) 1075 PointLight pointLight; 1076 #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 1077 PointLightShadow pointLightShadow; 1078 #endif 1079 #pragma unroll_loop_start 1080 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 1081 pointLight = pointLights[ i ]; 1082 getPointLightInfo( pointLight, geometry, directLight ); 1083 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) 1084 pointLightShadow = pointLightShadows[ i ]; 1085 directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; 1086 #endif 1087 RE_Direct( directLight, geometry, material, reflectedLight ); 1088 } 1089 #pragma unroll_loop_end 1090#endif
1091#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) 1092 SpotLight spotLight; 1093 vec4 spotColor; 1094 vec3 spotLightCoord; 1095 bool inSpotLightMap; 1096 #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 1097 SpotLightShadow spotLightShadow; 1098 #endif 1099 #pragma unroll_loop_start 1100 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 1101 spotLight = spotLights[ i ]; 1102 getSpotLightInfo( spotLight, geometry, directLight ); 1103 #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1104 #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX 1105 #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1106 #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS 1107 #else 1108 #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) 1109 #endif 1110 #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) 1111 spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; 1112 inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); 1113 spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); 1114 directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; 1115 #endif 1116 #undef SPOT_LIGHT_MAP_INDEX 1117 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1118 spotLightShadow = spotLightShadows[ i ]; 1119 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1120 #endif 1121 RE_Direct( directLight, geometry, material, reflectedLight ); 1122 } 1123 #pragma unroll_loop_end 1124#endif 1125#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) 1126 DirectionalLight directionalLight; 1127 #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 1128 DirectionalLightShadow directionalLightShadow; 1129 #endif 1130 #pragma unroll_loop_start 1131 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 1132 directionalLight = directionalLights[ i ]; 1133 getDirectionalLightInfo( directionalLight, geometry, directLight ); 1134 #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) 1135 directionalLightShadow = directionalLightShadows[ i ]; 1136 directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1137 #endif 1138 RE_Direct( directLight, geometry, material, reflectedLight ); 1139 } 1140 #pragma unroll_loop_end 1141#endif 1142#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) 1143 RectAreaLight rectAreaLight; 1144 #pragma unroll_loop_start 1145 for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { 1146 rectAreaLight = rectAreaLights[ i ]; 1147 RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); 1148 } 1149 #pragma unroll_loop_end 1150#endif 1151#if defined( RE_IndirectDiffuse ) 1152 vec3 iblIrradiance = vec3( 0.0 ); 1153 vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); 1154 irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); 1155 #if ( NUM_HEMI_LIGHTS > 0 ) 1156 #pragma unroll_loop_start 1157 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 1158 irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); 1159 } 1160 #pragma unroll_loop_end 1161 #endif 1162#endif 1163#if defined( RE_IndirectSpecular ) 1164 vec3 radiance = vec3( 0.0 ); 1165 vec3 clearcoatRadiance = vec3( 0.0 ); 1166#endif`,eI=`#if defined( RE_IndirectDiffuse ) 1167 #ifdef USE_LIGHTMAP 1168 vec4 lightMapTexel = texture2D( lightMap, vUv2 ); 1169 vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; 1170 irradiance += lightMapIrradiance; 1171 #endif 1172 #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) 1173 iblIrradiance += getIBLIrradiance( geometry.normal ); 1174 #endif 1175#endif 1176#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) 1177 radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); 1178 #ifdef USE_CLEARCOAT 1179 clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); 1180 #endif 1181#endif`,tI=`#if defined( RE_IndirectDiffuse ) 1182 RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); 1183#endif 1184#if defined( RE_IndirectSpecular ) 1185 RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); 1186#endif`,iI=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1187 gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; 1188#endif`,rI=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) 1189 uniform float logDepthBufFC; 1190 varying float vFragDepth; 1191 varying float vIsPerspective; 1192#endif`,sI=`#ifdef USE_LOGDEPTHBUF 1193 #ifdef USE_LOGDEPTHBUF_EXT 1194 varying float vFragDepth; 1195 varying float vIsPerspective; 1196 #else 1197 uniform float logDepthBufFC; 1198 #endif 1199#endif`,aI=`#ifdef USE_LOGDEPTHBUF 1200 #ifdef USE_LOGDEPTHBUF_EXT 1201 vFragDepth = 1.0 + gl_Position.w; 1202 vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); 1203 #else 1204 if ( isPerspectiveMatrix( projectionMatrix ) ) { 1205 gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; 1206 gl_Position.z *= gl_Position.w; 1207 } 1208 #endif 1209#endif`,nI=`#ifdef USE_MAP 1210 vec4 sampledDiffuseColor = texture2D( map, vUv ); 1211 #ifdef DECODE_VIDEO_TEXTURE 1212 sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); 1213 #endif 1214 diffuseColor *= sampledDiffuseColor; 1215#endif`,oI=`#ifdef USE_MAP 1216 uniform sampler2D map; 1217#endif`,lI=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1218 vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; 1219#endif 1220#ifdef USE_MAP 1221 diffuseColor *= texture2D( map, uv ); 1222#endif 1223#ifdef USE_ALPHAMAP 1224 diffuseColor.a *= texture2D( alphaMap, uv ).g; 1225#endif`,hI=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) 1226 uniform mat3 uvTransform; 1227#endif 1228#ifdef USE_MAP 1229 uniform sampler2D map; 1230#endif 1231#ifdef USE_ALPHAMAP 1232 uniform sampler2D alphaMap; 1233#endif`,cI=`float metalnessFactor = metalness; 1234#ifdef USE_METALNESSMAP 1235 vec4 texelMetalness = texture2D( metalnessMap, vUv ); 1236 metalnessFactor *= texelMetalness.b; 1237#endif`,uI=`#ifdef USE_METALNESSMAP 1238 uniform sampler2D metalnessMap; 1239#endif`,dI=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) 1240 vColor *= morphTargetBaseInfluence; 1241 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1242 #if defined( USE_COLOR_ALPHA ) 1243 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; 1244 #elif defined( USE_COLOR ) 1245 if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; 1246 #endif 1247 } 1248#endif`,pI=`#ifdef USE_MORPHNORMALS 1249 objectNormal *= morphTargetBaseInfluence; 1250 #ifdef MORPHTARGETS_TEXTURE 1251 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1252 if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; 1253 } 1254 #else 1255 objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; 1256 objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; 1257 objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; 1258 objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; 1259 #endif 1260#endif`,fI=`#ifdef USE_MORPHTARGETS 1261 uniform float morphTargetBaseInfluence; 1262 #ifdef MORPHTARGETS_TEXTURE 1263 uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; 1264 uniform sampler2DArray morphTargetsTexture; 1265 uniform ivec2 morphTargetsTextureSize; 1266 vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { 1267 int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; 1268 int y = texelIndex / morphTargetsTextureSize.x; 1269 int x = texelIndex - y * morphTargetsTextureSize.x; 1270 ivec3 morphUV = ivec3( x, y, morphTargetIndex ); 1271 return texelFetch( morphTargetsTexture, morphUV, 0 ); 1272 } 1273 #else 1274 #ifndef USE_MORPHNORMALS 1275 uniform float morphTargetInfluences[ 8 ]; 1276 #else 1277 uniform float morphTargetInfluences[ 4 ]; 1278 #endif 1279 #endif 1280#endif`,mI=`#ifdef USE_MORPHTARGETS 1281 transformed *= morphTargetBaseInfluence; 1282 #ifdef MORPHTARGETS_TEXTURE 1283 for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { 1284 if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; 1285 } 1286 #else 1287 transformed += morphTarget0 * morphTargetInfluences[ 0 ]; 1288 transformed += morphTarget1 * morphTargetInfluences[ 1 ]; 1289 transformed += morphTarget2 * morphTargetInfluences[ 2 ]; 1290 transformed += morphTarget3 * morphTargetInfluences[ 3 ]; 1291 #ifndef USE_MORPHNORMALS 1292 transformed += morphTarget4 * morphTargetInfluences[ 4 ]; 1293 transformed += morphTarget5 * morphTargetInfluences[ 5 ]; 1294 transformed += morphTarget6 * morphTargetInfluences[ 6 ]; 1295 transformed += morphTarget7 * morphTargetInfluences[ 7 ]; 1296 #endif 1297 #endif 1298#endif`,gI=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; 1299#ifdef FLAT_SHADED 1300 vec3 fdx = dFdx( vViewPosition ); 1301 vec3 fdy = dFdy( vViewPosition ); 1302 vec3 normal = normalize( cross( fdx, fdy ) ); 1303#else 1304 vec3 normal = normalize( vNormal ); 1305 #ifdef DOUBLE_SIDED 1306 normal = normal * faceDirection; 1307 #endif 1308 #ifdef USE_TANGENT 1309 vec3 tangent = normalize( vTangent ); 1310 vec3 bitangent = normalize( vBitangent ); 1311 #ifdef DOUBLE_SIDED 1312 tangent = tangent * faceDirection; 1313 bitangent = bitangent * faceDirection; 1314 #endif 1315 #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP ) 1316 mat3 vTBN = mat3( tangent, bitangent, normal ); 1317 #endif 1318 #endif 1319#endif 1320vec3 geometryNormal = normal;`,vI=`#ifdef OBJECTSPACE_NORMALMAP 1321 normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; 1322 #ifdef FLIP_SIDED 1323 normal = - normal; 1324 #endif 1325 #ifdef DOUBLE_SIDED 1326 normal = normal * faceDirection; 1327 #endif 1328 normal = normalize( normalMatrix * normal ); 1329#elif defined( TANGENTSPACE_NORMALMAP ) 1330 vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; 1331 mapN.xy *= normalScale; 1332 #ifdef USE_TANGENT 1333 normal = normalize( vTBN * mapN ); 1334 #else
1335 normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection ); 1336 #endif 1337#elif defined( USE_BUMPMAP ) 1338 normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); 1339#endif`,yI=`#ifndef FLAT_SHADED 1340 varying vec3 vNormal; 1341 #ifdef USE_TANGENT 1342 varying vec3 vTangent; 1343 varying vec3 vBitangent; 1344 #endif 1345#endif`,xI=`#ifndef FLAT_SHADED 1346 varying vec3 vNormal; 1347 #ifdef USE_TANGENT 1348 varying vec3 vTangent; 1349 varying vec3 vBitangent; 1350 #endif 1351#endif`,bI=`#ifndef FLAT_SHADED 1352 vNormal = normalize( transformedNormal ); 1353 #ifdef USE_TANGENT 1354 vTangent = normalize( transformedTangent ); 1355 vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); 1356 #endif 1357#endif`,wI=`#ifdef USE_NORMALMAP 1358 uniform sampler2D normalMap; 1359 uniform vec2 normalScale; 1360#endif 1361#ifdef OBJECTSPACE_NORMALMAP 1362 uniform mat3 normalMatrix; 1363#endif 1364#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) ) 1365 vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) { 1366 vec3 q0 = dFdx( eye_pos.xyz ); 1367 vec3 q1 = dFdy( eye_pos.xyz ); 1368 vec2 st0 = dFdx( vUv.st ); 1369 vec2 st1 = dFdy( vUv.st ); 1370 vec3 N = surf_norm; 1371 vec3 q1perp = cross( q1, N ); 1372 vec3 q0perp = cross( N, q0 ); 1373 vec3 T = q1perp * st0.x + q0perp * st1.x; 1374 vec3 B = q1perp * st0.y + q0perp * st1.y; 1375 float det = max( dot( T, T ), dot( B, B ) ); 1376 float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det ); 1377 return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z ); 1378 } 1379#endif`,SI=`#ifdef USE_CLEARCOAT 1380 vec3 clearcoatNormal = geometryNormal; 1381#endif`,_I=`#ifdef USE_CLEARCOAT_NORMALMAP 1382 vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0; 1383 clearcoatMapN.xy *= clearcoatNormalScale; 1384 #ifdef USE_TANGENT 1385 clearcoatNormal = normalize( vTBN * clearcoatMapN ); 1386 #else 1387 clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection ); 1388 #endif 1389#endif`,AI=`#ifdef USE_CLEARCOATMAP 1390 uniform sampler2D clearcoatMap; 1391#endif 1392#ifdef USE_CLEARCOAT_ROUGHNESSMAP 1393 uniform sampler2D clearcoatRoughnessMap; 1394#endif 1395#ifdef USE_CLEARCOAT_NORMALMAP 1396 uniform sampler2D clearcoatNormalMap; 1397 uniform vec2 clearcoatNormalScale; 1398#endif`,MI=`#ifdef USE_IRIDESCENCEMAP 1399 uniform sampler2D iridescenceMap; 1400#endif 1401#ifdef USE_IRIDESCENCE_THICKNESSMAP 1402 uniform sampler2D iridescenceThicknessMap; 1403#endif`,EI=`#ifdef OPAQUE 1404diffuseColor.a = 1.0; 1405#endif 1406#ifdef USE_TRANSMISSION 1407diffuseColor.a *= material.transmissionAlpha + 0.1; 1408#endif 1409gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,CI=`vec3 packNormalToRGB( const in vec3 normal ) { 1410 return normalize( normal ) * 0.5 + 0.5; 1411} 1412vec3 unpackRGBToNormal( const in vec3 rgb ) { 1413 return 2.0 * rgb.xyz - 1.0; 1414} 1415const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; 1416const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); 1417const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); 1418const float ShiftRight8 = 1. / 256.; 1419vec4 packDepthToRGBA( const in float v ) { 1420 vec4 r = vec4( fract( v * PackFactors ), v ); 1421 r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; 1422} 1423float unpackRGBAToDepth( const in vec4 v ) { 1424 return dot( v, UnpackFactors ); 1425} 1426vec2 packDepthToRG( in highp float v ) { 1427 return packDepthToRGBA( v ).yx; 1428} 1429float unpackRGToDepth( const in highp vec2 v ) { 1430 return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); 1431} 1432vec4 pack2HalfToRGBA( vec2 v ) { 1433 vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); 1434 return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); 1435} 1436vec2 unpackRGBATo2Half( vec4 v ) { 1437 return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); 1438} 1439float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { 1440 return ( viewZ + near ) / ( near - far ); 1441} 1442float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) { 1443 return linearClipZ * ( near - far ) - near; 1444} 1445float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { 1446 return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); 1447} 1448float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) { 1449 return ( near * far ) / ( ( far - near ) * invClipZ - far ); 1450}`,TI=`#ifdef PREMULTIPLIED_ALPHA 1451 gl_FragColor.rgb *= gl_FragColor.a; 1452#endif`,PI=`vec4 mvPosition = vec4( transformed, 1.0 ); 1453#ifdef USE_INSTANCING 1454 mvPosition = instanceMatrix * mvPosition; 1455#endif 1456mvPosition = modelViewMatrix * mvPosition; 1457gl_Position = projectionMatrix * mvPosition;`,DI=`#ifdef DITHERING 1458 gl_FragColor.rgb = dithering( gl_FragColor.rgb ); 1459#endif`,OI=`#ifdef DITHERING 1460 vec3 dithering( vec3 color ) { 1461 float grid_position = rand( gl_FragCoord.xy ); 1462 vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); 1463 dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); 1464 return color + dither_shift_RGB; 1465 } 1466#endif`,II=`float roughnessFactor = roughness; 1467#ifdef USE_ROUGHNESSMAP 1468 vec4 texelRoughness = texture2D( roughnessMap, vUv ); 1469 roughnessFactor *= texelRoughness.g; 1470#endif`,RI=`#ifdef USE_ROUGHNESSMAP 1471 uniform sampler2D roughnessMap;
1472#endif`,LI=`#if NUM_SPOT_LIGHT_COORDS > 0 1473 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1474#endif 1475#if NUM_SPOT_LIGHT_MAPS > 0 1476 uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; 1477#endif 1478#ifdef USE_SHADOWMAP 1479 #if NUM_DIR_LIGHT_SHADOWS > 0 1480 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 1481 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1482 struct DirectionalLightShadow { 1483 float shadowBias; 1484 float shadowNormalBias; 1485 float shadowRadius; 1486 vec2 shadowMapSize; 1487 }; 1488 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1489 #endif 1490 #if NUM_SPOT_LIGHT_SHADOWS > 0 1491 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 1492 struct SpotLightShadow { 1493 float shadowBias; 1494 float shadowNormalBias; 1495 float shadowRadius; 1496 vec2 shadowMapSize; 1497 }; 1498 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1499 #endif 1500 #if NUM_POINT_LIGHT_SHADOWS > 0 1501 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 1502 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1503 struct PointLightShadow { 1504 float shadowBias; 1505 float shadowNormalBias; 1506 float shadowRadius; 1507 vec2 shadowMapSize; 1508 float shadowCameraNear; 1509 float shadowCameraFar; 1510 }; 1511 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1512 #endif 1513 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 1514 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 1515 } 1516 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 1517 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 1518 } 1519 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 1520 float occlusion = 1.0; 1521 vec2 distribution = texture2DDistribution( shadow, uv ); 1522 float hard_shadow = step( compare , distribution.x ); 1523 if (hard_shadow != 1.0 ) { 1524 float distance = compare - distribution.x ; 1525 float variance = max( 0.00000, distribution.y * distribution.y ); 1526 float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); 1527 } 1528 return occlusion; 1529 } 1530 float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 1531 float shadow = 1.0; 1532 shadowCoord.xyz /= shadowCoord.w; 1533 shadowCoord.z += shadowBias; 1534 bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; 1535 bool frustumTest = inFrustum && shadowCoord.z <= 1.0; 1536 if ( frustumTest ) { 1537 #if defined( SHADOWMAP_TYPE_PCF ) 1538 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1539 float dx0 = - texelSize.x * shadowRadius; 1540 float dy0 = - texelSize.y * shadowRadius; 1541 float dx1 = + texelSize.x * shadowRadius; 1542 float dy1 = + texelSize.y * shadowRadius; 1543 float dx2 = dx0 / 2.0; 1544 float dy2 = dy0 / 2.0; 1545 float dx3 = dx1 / 2.0; 1546 float dy3 = dy1 / 2.0; 1547 shadow = ( 1548 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + 1549 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + 1550 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + 1551 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + 1552 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + 1553 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + 1554 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + 1555 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + 1556 texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + 1557 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + 1558 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + 1559 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + 1560 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + 1561 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + 1562 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + 1563 texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + 1564 texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) 1565 ) * ( 1.0 / 17.0 ); 1566 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 1567 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 1568 float dx = texelSize.x; 1569 float dy = texelSize.y; 1570 vec2 uv = shadowCoord.xy;
1571 vec2 f = fract( uv * shadowMapSize + 0.5 ); 1572 uv -= f * texelSize; 1573 shadow = ( 1574 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 1575 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 1576 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 1577 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 1578 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 1579 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 1580 f.x ) + 1581 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 1582 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 1583 f.x ) + 1584 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 1585 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 1586 f.y ) + 1587 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 1588 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 1589 f.y ) + 1590 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 1591 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 1592 f.x ), 1593 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 1594 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 1595 f.x ), 1596 f.y ) 1597 ) * ( 1.0 / 9.0 ); 1598 #elif defined( SHADOWMAP_TYPE_VSM ) 1599 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 1600 #else 1601 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 1602 #endif 1603 } 1604 return shadow; 1605 } 1606 vec2 cubeToUV( vec3 v, float texelSizeY ) { 1607 vec3 absV = abs( v ); 1608 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 1609 absV *= scaleToCube; 1610 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 1611 vec2 planar = v.xy; 1612 float almostATexel = 1.5 * texelSizeY; 1613 float almostOne = 1.0 - almostATexel; 1614 if ( absV.z >= almostOne ) { 1615 if ( v.z > 0.0 ) 1616 planar.x = 4.0 - v.x; 1617 } else if ( absV.x >= almostOne ) { 1618 float signX = sign( v.x ); 1619 planar.x = v.z * signX + 2.0 * signX; 1620 } else if ( absV.y >= almostOne ) { 1621 float signY = sign( v.y ); 1622 planar.x = v.x + 2.0 * signY + 2.0; 1623 planar.y = v.z * signY - 2.0; 1624 } 1625 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 1626 } 1627 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 1628 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 1629 vec3 lightToPosition = shadowCoord.xyz; 1630 float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; 1631 vec3 bd3D = normalize( lightToPosition ); 1632 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) 1633 vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; 1634 return ( 1635 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + 1636 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + 1637 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + 1638 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + 1639 texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + 1640 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + 1641 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + 1642 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + 1643 texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) 1644 ) * ( 1.0 / 9.0 ); 1645 #else 1646 return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); 1647 #endif 1648 } 1649#endif`,zI=`#if NUM_SPOT_LIGHT_COORDS > 0 1650 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; 1651 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; 1652#endif 1653#ifdef USE_SHADOWMAP 1654 #if NUM_DIR_LIGHT_SHADOWS > 0 1655 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; 1656 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 1657 struct DirectionalLightShadow { 1658 float shadowBias; 1659 float shadowNormalBias; 1660 float shadowRadius; 1661 vec2 shadowMapSize; 1662 }; 1663 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 1664 #endif
1665 #if NUM_SPOT_LIGHT_SHADOWS > 0 1666 struct SpotLightShadow { 1667 float shadowBias; 1668 float shadowNormalBias; 1669 float shadowRadius; 1670 vec2 shadowMapSize; 1671 }; 1672 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 1673 #endif 1674 #if NUM_POINT_LIGHT_SHADOWS > 0 1675 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; 1676 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 1677 struct PointLightShadow { 1678 float shadowBias; 1679 float shadowNormalBias; 1680 float shadowRadius; 1681 vec2 shadowMapSize; 1682 float shadowCameraNear; 1683 float shadowCameraFar; 1684 }; 1685 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 1686 #endif 1687#endif`,BI=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) 1688 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); 1689 vec4 shadowWorldPosition; 1690#endif 1691#if defined( USE_SHADOWMAP ) 1692 #if NUM_DIR_LIGHT_SHADOWS > 0 1693 #pragma unroll_loop_start 1694 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1695 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); 1696 vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; 1697 } 1698 #pragma unroll_loop_end 1699 #endif 1700 #if NUM_POINT_LIGHT_SHADOWS > 0 1701 #pragma unroll_loop_start 1702 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1703 shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); 1704 vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; 1705 } 1706 #pragma unroll_loop_end 1707 #endif 1708#endif 1709#if NUM_SPOT_LIGHT_COORDS > 0 1710 #pragma unroll_loop_start 1711 for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { 1712 shadowWorldPosition = worldPosition; 1713 #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) 1714 shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; 1715 #endif 1716 vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; 1717 } 1718 #pragma unroll_loop_end 1719#endif`,FI=`float getShadowMask() { 1720 float shadow = 1.0; 1721 #ifdef USE_SHADOWMAP 1722 #if NUM_DIR_LIGHT_SHADOWS > 0 1723 DirectionalLightShadow directionalLight; 1724 #pragma unroll_loop_start 1725 for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { 1726 directionalLight = directionalLightShadows[ i ]; 1727 shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; 1728 } 1729 #pragma unroll_loop_end 1730 #endif 1731 #if NUM_SPOT_LIGHT_SHADOWS > 0 1732 SpotLightShadow spotLight; 1733 #pragma unroll_loop_start 1734 for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { 1735 spotLight = spotLightShadows[ i ]; 1736 shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; 1737 } 1738 #pragma unroll_loop_end 1739 #endif 1740 #if NUM_POINT_LIGHT_SHADOWS > 0 1741 PointLightShadow pointLight; 1742 #pragma unroll_loop_start 1743 for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { 1744 pointLight = pointLightShadows[ i ]; 1745 shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; 1746 } 1747 #pragma unroll_loop_end 1748 #endif 1749 #endif 1750 return shadow; 1751}`,kI=`#ifdef USE_SKINNING 1752 mat4 boneMatX = getBoneMatrix( skinIndex.x ); 1753 mat4 boneMatY = getBoneMatrix( skinIndex.y ); 1754 mat4 boneMatZ = getBoneMatrix( skinIndex.z ); 1755 mat4 boneMatW = getBoneMatrix( skinIndex.w ); 1756#endif`,UI=`#ifdef USE_SKINNING 1757 uniform mat4 bindMatrix; 1758 uniform mat4 bindMatrixInverse; 1759 uniform highp sampler2D boneTexture; 1760 uniform int boneTextureSize; 1761 mat4 getBoneMatrix( const in float i ) { 1762 float j = i * 4.0; 1763 float x = mod( j, float( boneTextureSize ) ); 1764 float y = floor( j / float( boneTextureSize ) ); 1765 float dx = 1.0 / float( boneTextureSize ); 1766 float dy = 1.0 / float( boneTextureSize ); 1767 y = dy * ( y + 0.5 ); 1768 vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); 1769 vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); 1770 vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); 1771 vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); 1772 mat4 bone = mat4( v1, v2, v3, v4 ); 1773 return bone; 1774 } 1775#endif`,NI=`#ifdef USE_SKINNING 1776 vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); 1777 vec4 skinned = vec4( 0.0 ); 1778 skinned += boneMatX * skinVertex * skinWeight.x; 1779 skinned += boneMatY * skinVertex * skinWeight.y; 1780 skinned += boneMatZ * skinVertex * skinWeight.z; 1781 skinned += boneMatW * skinVertex * skinWeight.w; 1782 transformed = ( bindMatrixInverse * skinned ).xyz; 1783#endif`,VI=`#ifdef USE_SKINNING 1784 mat4 skinMatrix = mat4( 0.0 ); 1785 skinMatrix += skinWeight.x * boneMatX; 1786 skinMatrix += skinWeight.y * boneMatY; 1787 skinMatrix += skinWeight.z * boneMatZ; 1788 skinMatrix += skinWeight.w * boneMatW; 1789 skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; 1790 objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; 1791 #ifdef USE_TANGENT 1792 objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; 1793 #endif 1794#endif`,jI=`float specularStrength; 1795#ifdef USE_SPECULARMAP 1796 vec4 texelSpecular = texture2D( specularMap, vUv ); 1797 specularStrength = texelSpecular.r; 1798#else 1799 specularStrength = 1.0; 1800#endif`,HI=`#ifdef USE_SPECULARMAP 1801 uniform sampler2D specularMap; 1802#endif`,GI=`#if defined( TONE_MAPPING ) 1803 gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); 1804#endif`,WI=`#ifndef saturate 1805#define saturate( a ) clamp( a, 0.0, 1.0 ) 1806#endif 1807uniform float toneMappingExposure; 1808vec3 LinearToneMapping( vec3 color ) { 1809 return toneMappingExposure * color; 1810} 1811vec3 ReinhardToneMapping( vec3 color ) { 1812 color *= toneMappingExposure; 1813 return saturate( color / ( vec3( 1.0 ) + color ) ); 1814} 1815vec3 OptimizedCineonToneMapping( vec3 color ) { 1816 color *= toneMappingExposure; 1817 color = max( vec3( 0.0 ), color - 0.004 ); 1818 return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); 1819} 1820vec3 RRTAndODTFit( vec3 v ) { 1821 vec3 a = v * ( v + 0.0245786 ) - 0.000090537; 1822 vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; 1823 return a / b; 1824} 1825vec3 ACESFilmicToneMapping( vec3 color ) { 1826 const mat3 ACESInputMat = mat3( 1827 vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), 1828 vec3( 0.04823, 0.01566, 0.83777 ) 1829 ); 1830 const mat3 ACESOutputMat = mat3( 1831 vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), 1832 vec3( -0.07367, -0.00605, 1.07602 ) 1833 ); 1834 color *= toneMappingExposure / 0.6; 1835 color = ACESInputMat * color; 1836 color = RRTAndODTFit( color ); 1837 color = ACESOutputMat * color; 1838 return saturate( color ); 1839} 1840vec3 CustomToneMapping( vec3 color ) { return color; }`,qI=`#ifdef USE_TRANSMISSION 1841 material.transmission = transmission; 1842 material.transmissionAlpha = 1.0; 1843 material.thickness = thickness; 1844 material.attenuationDistance = attenuationDistance; 1845 material.attenuationColor = attenuationColor; 1846 #ifdef USE_TRANSMISSIONMAP 1847 material.transmission *= texture2D( transmissionMap, vUv ).r; 1848 #endif 1849 #ifdef USE_THICKNESSMAP 1850 material.thickness *= texture2D( thicknessMap, vUv ).g;
1851 #endif 1852 vec3 pos = vWorldPosition; 1853 vec3 v = normalize( cameraPosition - pos ); 1854 vec3 n = inverseTransformDirection( normal, viewMatrix ); 1855 vec4 transmission = getIBLVolumeRefraction( 1856 n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, 1857 pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, 1858 material.attenuationColor, material.attenuationDistance ); 1859 material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission ); 1860 totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); 1861#endif`,XI=`#ifdef USE_TRANSMISSION 1862 uniform float transmission; 1863 uniform float thickness; 1864 uniform float attenuationDistance; 1865 uniform vec3 attenuationColor; 1866 #ifdef USE_TRANSMISSIONMAP 1867 uniform sampler2D transmissionMap; 1868 #endif 1869 #ifdef USE_THICKNESSMAP 1870 uniform sampler2D thicknessMap; 1871 #endif 1872 uniform vec2 transmissionSamplerSize; 1873 uniform sampler2D transmissionSamplerMap; 1874 uniform mat4 modelMatrix; 1875 uniform mat4 projectionMatrix; 1876 varying vec3 vWorldPosition; 1877 vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { 1878 vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); 1879 vec3 modelScale; 1880 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 1881 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 1882 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 1883 return normalize( refractionVector ) * thickness * modelScale; 1884 } 1885 float applyIorToRoughness( const in float roughness, const in float ior ) { 1886 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 1887 } 1888 vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { 1889 float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 1890 #ifdef texture2DLodEXT 1891 return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod ); 1892 #else 1893 return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod ); 1894 #endif 1895 } 1896 vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { 1897 if ( isinf( attenuationDistance ) ) { 1898 return radiance; 1899 } else { 1900 vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; 1901 vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance; 1902 } 1903 } 1904 vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, 1905 const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, 1906 const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, 1907 const in vec3 attenuationColor, const in float attenuationDistance ) { 1908 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 1909 vec3 refractedRayExit = position + transmissionRay; 1910 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 1911 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 1912 refractionCoords += 1.0; 1913 refractionCoords /= 2.0; 1914 vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); 1915 vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); 1916 vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); 1917 return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); 1918 } 1919#endif`,YI=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) 1920 varying vec2 vUv; 1921#endif`,QI=`#ifdef USE_UV 1922 #ifdef UVS_VERTEX_ONLY 1923 vec2 vUv; 1924 #else 1925 varying vec2 vUv; 1926 #endif 1927 uniform mat3 uvTransform; 1928#endif`,KI=`#ifdef USE_UV 1929 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 1930#endif`,ZI=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) 1931 varying vec2 vUv2; 1932#endif`,JI=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) 1933 attribute vec2 uv2; 1934 varying vec2 vUv2; 1935 uniform mat3 uv2Transform; 1936#endif`,$I=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) 1937 vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; 1938#endif`,eR=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_L
1938IGHT_COORDS > 0 1939 vec4 worldPosition = vec4( transformed, 1.0 ); 1940 #ifdef USE_INSTANCING 1941 worldPosition = instanceMatrix * worldPosition; 1942 #endif 1943 worldPosition = modelMatrix * worldPosition; 1944#endif`,tR=`varying vec2 vUv; 1945uniform mat3 uvTransform; 1946void main() { 1947 vUv = ( uvTransform * vec3( uv, 1 ) ).xy; 1948 gl_Position = vec4( position.xy, 1.0, 1.0 ); 1949}`,iR=`uniform sampler2D t2D; 1950uniform float backgroundIntensity; 1951varying vec2 vUv; 1952void main() { 1953 vec4 texColor = texture2D( t2D, vUv ); 1954 #ifdef DECODE_VIDEO_TEXTURE 1955 texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); 1956 #endif 1957 texColor.rgb *= backgroundIntensity; 1958 gl_FragColor = texColor; 1959 #include <tonemapping_fragment> 1960 #include <encodings_fragment> 1961}`,rR=`varying vec3 vWorldDirection; 1962#include <common> 1963void main() { 1964 vWorldDirection = transformDirection( position, modelMatrix ); 1965 #include <begin_vertex> 1966 #include <project_vertex> 1967 gl_Position.z = gl_Position.w; 1968}`,sR=`#ifdef ENVMAP_TYPE_CUBE 1969 uniform samplerCube envMap; 1970#elif defined( ENVMAP_TYPE_CUBE_UV ) 1971 uniform sampler2D envMap; 1972#endif 1973uniform float flipEnvMap; 1974uniform float backgroundBlurriness; 1975uniform float backgroundIntensity; 1976varying vec3 vWorldDirection; 1977#include <cube_uv_reflection_fragment> 1978void main() { 1979 #ifdef ENVMAP_TYPE_CUBE 1980 vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); 1981 #elif defined( ENVMAP_TYPE_CUBE_UV ) 1982 vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); 1983 #else 1984 vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 1985 #endif 1986 texColor.rgb *= backgroundIntensity; 1987 gl_FragColor = texColor; 1988 #include <tonemapping_fragment> 1989 #include <encodings_fragment> 1990}`,aR=`varying vec3 vWorldDirection; 1991#include <common> 1992void main() { 1993 vWorldDirection = transformDirection( position, modelMatrix ); 1994 #include <begin_vertex> 1995 #include <project_vertex> 1996 gl_Position.z = gl_Position.w; 1997}`,nR=`uniform samplerCube tCube; 1998uniform float tFlip; 1999uniform float opacity; 2000varying vec3 vWorldDirection; 2001void main() { 2002 vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); 2003 gl_FragColor = texColor; 2004 gl_FragColor.a *= opacity; 2005 #include <tonemapping_fragment> 2006 #include <encodings_fragment> 2007}`,oR=`#include <common> 2008#include <uv_pars_vertex> 2009#include <displacementmap_pars_vertex> 2010#include <morphtarget_pars_vertex> 2011#include <skinning_pars_vertex> 2012#include <logdepthbuf_pars_vertex> 2013#include <clipping_planes_pars_vertex> 2014varying vec2 vHighPrecisionZW; 2015void main() { 2016 #include <uv_vertex> 2017 #include <skinbase_vertex> 2018 #ifdef USE_DISPLACEMENTMAP 2019 #include <beginnormal_vertex> 2020 #include <morphnormal_vertex> 2021 #include <skinnormal_vertex> 2022 #endif 2023 #include <begin_vertex> 2024 #include <morphtarget_vertex> 2025 #include <skinning_vertex> 2026 #include <displacementmap_vertex> 2027 #include <project_vertex> 2028 #include <logdepthbuf_vertex> 2029 #include <clipping_planes_vertex> 2030 vHighPrecisionZW = gl_Position.zw; 2031}`,lR=`#if DEPTH_PACKING == 3200 2032 uniform float opacity; 2033#endif 2034#include <common> 2035#include <packing> 2036#include <uv_pars_fragment> 2037#include <map_pars_fragment> 2038#include <alphamap_pars_fragment> 2039#include <alphatest_pars_fragment> 2040#include <logdepthbuf_pars_fragment> 2041#include <clipping_planes_pars_fragment> 2042varying vec2 vHighPrecisionZW; 2043void main() { 2044 #include <clipping_planes_fragment> 2045 vec4 diffuseColor = vec4( 1.0 ); 2046 #if DEPTH_PACKING == 3200 2047 diffuseColor.a = opacity; 2048 #endif 2049 #include <map_fragment> 2050 #include <alphamap_fragment> 2051 #include <alphatest_fragment> 2052 #include <logdepthbuf_fragment> 2053 float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; 2054 #if DEPTH_PACKING == 3200 2055 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); 2056 #elif DEPTH_PACKING == 3201 2057 gl_FragColor = packDepthToRGBA( fragCoordZ ); 2058 #endif 2059}`,hR=`#define DISTANCE 2060varying vec3 vWorldPosition; 2061#include <common> 2062#include <uv_pars_vertex> 2063#include <displacementmap_pars_vertex> 2064#include <morphtarget_pars_vertex> 2065#include <skinning_pars_vertex> 2066#include <clipping_planes_pars_vertex> 2067void main() { 2068 #include <uv_vertex> 2069 #include <skinbase_vertex> 2070 #ifdef USE_DISPLACEMENTMAP 2071 #include <beginnormal_vertex> 2072 #include <morphnormal_vertex> 2073 #include <skinnormal_vertex> 2074 #endif 2075 #include <begin_vertex> 2076 #include <morphtarget_vertex> 2077 #include <skinning_vertex> 2078 #include <displacementmap_vertex> 2079 #include <project_vertex> 2080 #include <worldpos_vertex> 2081 #include <clipping_planes_vertex> 2082 vWorldPosition = worldPosition.xyz; 2083}`,cR=`#define DISTANCE 2084uniform vec3 referencePosition; 2085uniform float nearDistance; 2086uniform float farDistance; 2087varying vec3 vWorldPosition; 2088#include <common> 2089#include <packing> 2090#include <uv_pars_fragment> 2091#include <map_pars_fragment> 2092#include <alphamap_pars_fragment> 2093#include <alphatest_pars_fragment> 2094#include <clipping_planes_pars_fragment> 2095void main () { 2096 #include <clipping_planes_fragment> 2097 vec4 diffuseColor = vec4( 1.0 ); 2098 #include <map_fragment> 2099 #include <alphamap_fragment> 2100 #include <alphatest_fragment> 2101 float dist = length( vWorldPosition - referencePosition ); 2102 dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); 2103 dist = saturate( dist ); 2104 gl_FragColor = packDepthToRGBA( dist ); 2105}`,uR=`varying vec3 vWorldDirection; 2106#include <common> 2107void main() { 2108 vWorldDirection = transformDirection( position, modelMatrix ); 2109 #include <begin_vertex> 2110 #include <project_vertex> 2111}`,dR=`uniform sampler2D tEquirect; 2112varying vec3 vWorldDirection; 2113#include <common> 2114void main() { 2115 vec3 direction = normalize( vWorldDirection ); 2116 vec2 sampleUV = equirectUv( direction ); 2117 gl_FragColor = texture2D( tEquirect, sampleUV ); 2118 #include <tonemapping_fragment> 2119 #include <encodings_fragment> 2120}`,pR=`uniform float scale; 2121attribute float lineDistance; 2122varying float vLineDistance; 2123#include <common> 2124#include <color_pars_vertex> 2125#include <fog_pars_vertex> 2126#include <morphtarget_pars_vertex> 2127#include <logdepthbuf_pars_vertex> 2128#include <clipping_planes_pars_vertex> 2129void main() { 2130 vLineDistance = scale * lineDistance; 2131 #include <color_vertex> 2132 #include <morphcolor_vertex> 2133 #include <begin_vertex> 2134 #include <morphtarget_vertex> 2135 #include <project_vertex> 2136 #include <logdepthbuf_vertex> 2137 #include <clipping_planes_vertex> 2138 #include <fog_vertex> 2139}`,fR=`uniform vec3 diffuse; 2140uniform float opacity; 2141uniform float dashSize; 2142uniform float totalSize; 2143varying float vLineDistance; 2144#include <common> 2145#include <color_pars_fragment> 2146#include <fog_pars_fragment> 2147#include <logdepthbuf_pars_fragment> 2148#include <clipping_planes_pars_fragment> 2149void main() { 2150 #include <clipping_planes_fragment> 2151 if ( mod( vLineDistance, totalSize ) > dashSize ) { 2152 discard; 2153 } 2154 vec3 outgoingLight = vec3( 0.0 ); 2155 vec4 diffuseColor = vec4( diffuse, opacity ); 2156 #include <logdepthbuf_fragment> 2157 #include <color_fragment> 2158 outgoingLight = diffuseColor.rgb; 2159 #include <output_fragment> 2160 #include <tonemapping_fragment> 2161 #include <encodings_fragment> 2162 #include <fog_fragment> 2163 #include <premultiplied_alpha_fragment> 2164}`,mR=`#include <common> 2165#include <uv_pars_vertex> 2166#include <uv2_pars_vertex> 2167#include <envmap_pars_vertex> 2168#include <color_pars_vertex> 2169#include <fog_pars_vertex> 2170#include <morphtarget_pars_vertex> 2171#include <skinning_pars_vertex> 2172#include <logdepthbuf_pars_vertex> 2173#include <clipping_planes_pars_vertex> 2174void main() { 2175 #include <uv_vertex> 2176 #include <uv2_vertex> 2177 #include <color_vertex> 2178 #include <morphcolor_vertex> 2179 #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) 2180 #include <beginnormal_vertex> 2181 #include <morphnormal_vertex> 2182 #include <skinbase_vertex> 2183 #include <skinnormal_vertex> 2184 #include <defaultnormal_vertex> 2185 #endif 2186 #include <begin_vertex> 2187 #include <morphtarget_vertex> 2188 #include <skinning_vertex> 2189 #include <project_vertex> 2190 #include <logdepthbuf_vertex> 2191 #include <clipping_planes_vertex> 2192 #include <worldpos_vertex> 2193 #include <envmap_vertex> 2194 #include <fog_vertex> 2195}`,gR=`uniform vec3 diffuse; 2196uniform float opacity; 2197#ifndef FLAT_SHADED 2198 varying vec3 vNormal; 2199#endif 2200#include <common> 2201#include <dithering_pars_fragment> 2202#include <color_pars_fragment> 2203#include <uv_pars_fragment> 2204#include <uv2_pars_fragment> 2205#include <map_pars_fragment> 2206#include <alphamap_pars_fragment> 2207#include <alphatest_pars_fragment> 2208#include <aomap_pars_fragment> 2209#include <lightmap_pars_fragment> 2210#include <envmap_common_pars_fragment> 2211#include <envmap_pars_fragment> 2212#include <fog_pars_fragment> 2213#include <specularmap_pars_fragment> 2214#include <logdepthbuf_pars_fragment> 2215#include <clipping_planes_pars_fragment> 2216void main() { 2217 #include <clipping_planes_fragment> 2218 vec4 diffuseColor = vec4( diffuse, opacity ); 2219 #include <logdepthbuf_fragment> 2220 #include <map_fragment> 2221 #include <color_fragment> 2222 #include <alphamap_fragment> 2223 #include <alphatest_fragment> 2224 #include <specularmap_fragment> 2225 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2226 #ifdef USE_LIGHTMAP 2227 vec4 lightMapTexel = texture2D( lightMap, vUv2 ); 2228 reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; 2229 #else 2230 reflectedLight.indirectDiffuse += vec3( 1.0 ); 2231 #endif 2232 #include <aomap_fragment> 2233 reflectedLight.indirectDiffuse *= diffuseColor.rgb; 2234 vec3 outgoingLight = reflectedLight.indirectDiffuse; 2235 #include <envmap_fragment> 2236 #include <output_fragment> 2237 #include <tonemapping_fragment> 2238 #include <encodings_fragment> 2239 #include <fog_fragment> 2240 #include <premultiplied_alpha_fragment> 2241 #include <dithering_fragment> 2242}`,vR=`#define LAMBERT 2243varying vec3 vViewPosition; 2244#include <common> 2245#include <uv_pars_vertex> 2246#include <uv2_pars_vertex> 2247#include <displacementmap_pars_vertex> 2248#include <envmap_pars_vertex> 2249#include <color_pars_vertex> 2250#include <fog_pars_vertex> 2251#include <normal_pars_vertex> 2252#include <morphtarget_pars_vertex> 2253#include <skinning_pars_vertex> 2254#include <shadowmap_pars_vertex> 2255#include <logdepthbuf_pars_vertex> 2256#include <clipping_planes_pars_vertex> 2257void main() { 2258 #include <uv_vertex> 2259 #include <uv2_vertex> 2260 #include <color_vertex> 2261 #include <morphcolor_vertex> 2262 #include <beginnormal_vertex> 2263 #include <morphnormal_vertex> 2264 #include <skinbase_vertex> 2265 #include <skinnormal_vertex> 2266 #include <defaultnormal_vertex> 2267 #include <normal_vertex> 2268 #include <begin_vertex> 2269 #include <morphtarget_vertex> 2270 #include <skinning_vertex> 2271 #include <displacementmap_vertex> 2272 #include <project_vertex> 2273 #include <logdepthbuf_vertex> 2274 #include <clipping_planes_vertex> 2275 vViewPosition = - mvPosition.xyz; 2276 #include <worldpos_vertex> 2277 #include <envmap_vertex> 2278 #include <shadowmap_vertex> 2279 #include <fog_vertex> 2280}
2280`,yR=`#define LAMBERT 2281uniform vec3 diffuse; 2282uniform vec3 emissive; 2283uniform float opacity; 2284#include <common> 2285#include <packing> 2286#include <dithering_pars_fragment> 2287#include <color_pars_fragment> 2288#include <uv_pars_fragment> 2289#include <uv2_pars_fragment> 2290#include <map_pars_fragment> 2291#include <alphamap_pars_fragment> 2292#include <alphatest_pars_fragment> 2293#include <aomap_pars_fragment> 2294#include <lightmap_pars_fragment> 2295#include <emissivemap_pars_fragment> 2296#include <envmap_common_pars_fragment> 2297#include <envmap_pars_fragment> 2298#include <fog_pars_fragment> 2299#include <bsdfs> 2300#include <lights_pars_begin> 2301#include <normal_pars_fragment> 2302#include <lights_lambert_pars_fragment> 2303#include <shadowmap_pars_fragment> 2304#include <bumpmap_pars_fragment> 2305#include <normalmap_pars_fragment> 2306#include <specularmap_pars_fragment> 2307#include <logdepthbuf_pars_fragment> 2308#include <clipping_planes_pars_fragment> 2309void main() { 2310 #include <clipping_planes_fragment> 2311 vec4 diffuseColor = vec4( diffuse, opacity ); 2312 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2313 vec3 totalEmissiveRadiance = emissive; 2314 #include <logdepthbuf_fragment> 2315 #include <map_fragment> 2316 #include <color_fragment> 2317 #include <alphamap_fragment> 2318 #include <alphatest_fragment> 2319 #include <specularmap_fragment> 2320 #include <normal_fragment_begin> 2321 #include <normal_fragment_maps> 2322 #include <emissivemap_fragment> 2323 #include <lights_lambert_fragment> 2324 #include <lights_fragment_begin> 2325 #include <lights_fragment_maps> 2326 #include <lights_fragment_end> 2327 #include <aomap_fragment> 2328 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2329 #include <envmap_fragment> 2330 #include <output_fragment> 2331 #include <tonemapping_fragment> 2332 #include <encodings_fragment> 2333 #include <fog_fragment> 2334 #include <premultiplied_alpha_fragment> 2335 #include <dithering_fragment> 2336}`,xR=`#define MATCAP 2337varying vec3 vViewPosition; 2338#include <common> 2339#include <uv_pars_vertex> 2340#include <color_pars_vertex> 2341#include <displacementmap_pars_vertex> 2342#include <fog_pars_vertex> 2343#include <normal_pars_vertex> 2344#include <morphtarget_pars_vertex> 2345#include <skinning_pars_vertex> 2346#include <logdepthbuf_pars_vertex> 2347#include <clipping_planes_pars_vertex> 2348void main() { 2349 #include <uv_vertex> 2350 #include <color_vertex> 2351 #include <morphcolor_vertex> 2352 #include <beginnormal_vertex> 2353 #include <morphnormal_vertex> 2354 #include <skinbase_vertex> 2355 #include <skinnormal_vertex> 2356 #include <defaultnormal_vertex> 2357 #include <normal_vertex> 2358 #include <begin_vertex> 2359 #include <morphtarget_vertex> 2360 #include <skinning_vertex> 2361 #include <displacementmap_vertex> 2362 #include <project_vertex> 2363 #include <logdepthbuf_vertex> 2364 #include <clipping_planes_vertex> 2365 #include <fog_vertex> 2366 vViewPosition = - mvPosition.xyz; 2367}`,bR=`#define MATCAP 2368uniform vec3 diffuse; 2369uniform float opacity; 2370uniform sampler2D matcap; 2371varying vec3 vViewPosition; 2372#include <common> 2373#include <dithering_pars_fragment> 2374#include <color_pars_fragment> 2375#include <uv_pars_fragment> 2376#include <map_pars_fragment> 2377#include <alphamap_pars_fragment> 2378#include <alphatest_pars_fragment> 2379#include <fog_pars_fragment> 2380#include <normal_pars_fragment> 2381#include <bumpmap_pars_fragment> 2382#include <normalmap_pars_fragment> 2383#include <logdepthbuf_pars_fragment> 2384#include <clipping_planes_pars_fragment> 2385void main() { 2386 #include <clipping_planes_fragment> 2387 vec4 diffuseColor = vec4( diffuse, opacity ); 2388 #include <logdepthbuf_fragment> 2389 #include <map_fragment> 2390 #include <color_fragment> 2391 #include <alphamap_fragment> 2392 #include <alphatest_fragment> 2393 #include <normal_fragment_begin> 2394 #include <normal_fragment_maps> 2395 vec3 viewDir = normalize( vViewPosition ); 2396 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 2397 vec3 y = cross( viewDir, x ); 2398 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; 2399 #ifdef USE_MATCAP 2400 vec4 matcapColor = texture2D( matcap, uv ); 2401 #else 2402 vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); 2403 #endif 2404 vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; 2405 #include <output_fragment> 2406 #include <tonemapping_fragment> 2407 #include <encodings_fragment> 2408 #include <fog_fragment> 2409 #include <premultiplied_alpha_fragment> 2410 #include <dithering_fragment> 2411}`,wR=`#define NORMAL 2412#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) 2413 varying vec3 vViewPosition; 2414#endif 2415#include <common> 2416#include <uv_pars_vertex> 2417#include <displacementmap_pars_vertex> 2418#include <normal_pars_vertex> 2419#include <morphtarget_pars_vertex> 2420#include <skinning_pars_vertex> 2421#include <logdepthbuf_pars_vertex> 2422#include <clipping_planes_pars_vertex> 2423void main() { 2424 #include <uv_vertex> 2425 #include <beginnormal_vertex> 2426 #include <morphnormal_vertex> 2427 #include <skinbase_vertex> 2428 #include <skinnormal_vertex> 2429 #include <defaultnormal_vertex> 2430 #include <normal_vertex> 2431 #include <begin_vertex> 2432 #include <morphtarget_vertex> 2433 #include <skinning_vertex> 2434 #include <displacementmap_vertex> 2435 #include <project_vertex> 2436 #include <logdepthbuf_vertex> 2437 #include <clipping_planes_vertex> 2438#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) 2439 vViewPosition = - mvPosition.xyz; 2440#endif 2441}`,SR=`#define NORMAL 2442uniform float opacity; 2443#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) 2444 varying vec3 vViewPosition; 2445#endif 2446#include <packing> 2447#include <uv_pars_fragment> 2448#include <normal_pars_fragment> 2449#include <bumpmap_pars_fragment> 2450#include <normalmap_pars_fragment> 2451#include <logdepthbuf_pars_fragment> 2452#include <clipping_planes_pars_fragment> 2453void main() { 2454 #include <clipping_planes_fragment> 2455 #include <logdepthbuf_fragment> 2456 #include <normal_fragment_begin> 2457 #include <normal_fragment_maps> 2458 gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); 2459 #ifdef OPAQUE 2460 gl_FragColor.a = 1.0; 2461 #endif 2462}`,_R=`#define PHONG 2463varying vec3 vViewPosition; 2464#include <common> 2465#include <uv_pars_vertex> 2466#include <uv2_pars_vertex> 2467#include <displacementmap_pars_vertex> 2468#include <envmap_pars_vertex> 2469#include <color_pars_vertex> 2470#include <fog_pars_vertex> 2471#include <normal_pars_vertex> 2472#include <morphtarget_pars_vertex> 2473#include <skinning_pars_vertex> 2474#include <shadowmap_pars_vertex> 2475#include <logdepthbuf_pars_vertex> 2476#include <clipping_planes_pars_vertex> 2477void main() { 2478 #include <uv_vertex> 2479 #include <uv2_vertex> 2480 #include <color_vertex> 2481 #include <morphcolor_vertex> 2482 #include <beginnormal_vertex> 2483 #include <morphnormal_vertex> 2484 #include <skinbase_vertex> 2485 #include <skinnormal_vertex> 2486 #include <defaultnormal_vertex> 2487 #include <normal_vertex> 2488 #include <begin_vertex> 2489 #include <morphtarget_vertex> 2490 #include <skinning_vertex> 2491 #include <displacementmap_vertex> 2492 #include <project_vertex> 2493 #include <logdepthbuf_vertex> 2494 #include <clipping_planes_vertex> 2495 vViewPosition = - mvPosition.xyz; 2496 #include <worldpos_vertex> 2497 #include <envmap_vertex> 2498 #include <shadowmap_vertex> 2499 #include <fog_vertex> 2500}`,AR=`#define PHONG 2501uniform vec3 diffuse; 2502uniform vec3 emissive; 2503uniform vec3 specular; 2504uniform float shininess; 2505uniform float opacity; 2506#include <common> 2507#include <packing> 2508#include <dithering_pars_fragment> 2509#include <color_pars_fragment> 2510#include <uv_pars_fragment> 2511#include <uv2_pars_fragment> 2512#include <map_pars_fragment> 2513#include <alphamap_pars_fragment> 2514#include <alphatest_pars_fragment> 2515#include <aomap_pars_fragment> 2516#include <lightmap_pars_fragment> 2517#include <emissivemap_pars_fragment> 2518#include <envmap_common_pars_fragment> 2519#include <envmap_pars_fragment> 2520#include <fog_pars_fragment> 2521#include <bsdfs> 2522#include <lights_pars_begin> 2523#include <normal_pars_fragment> 2524#include <lights_phong_pars_fragment> 2525#include <shadowmap_pars_fragment> 2526#include <bumpmap_pars_fragment> 2527#include <normalmap_pars_fragment> 2528#include <specularmap_pars_fragment> 2529#include <logdepthbuf_pars_fragment> 2530#include <clipping_planes_pars_fragment> 2531void main() { 2532 #include <clipping_planes_fragment> 2533 vec4 diffuseColor = vec4( diffuse, opacity ); 2534 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2535 vec3 totalEmissiveRadiance = emissive; 2536 #include <logdepthbuf_fragment> 2537 #include <map_fragment> 2538 #include <color_fragment> 2539 #include <alphamap_fragment> 2540 #include <alphatest_fragment> 2541 #include <specularmap_fragment> 2542 #include <normal_fragment_begin> 2543 #include <normal_fragment_maps> 2544 #include <emissivemap_fragment> 2545 #include <lights_phong_fragment> 2546 #include <lights_fragment_begin> 2547 #include <lights_fragment_maps> 2548 #include <lights_fragment_end> 2549 #include <aomap_fragment> 2550 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; 2551 #include <envmap_fragment> 2552 #include <output_fragment> 2553 #include <tonemapping_fragment> 2554 #include <encodings_fragment> 2555 #include <fog_fragment> 2556 #include <premultiplied_alpha_fragment> 2557 #include <dithering_fragment> 2558}`,MR=`#define STANDARD 2559varying vec3 vViewPosition; 2560#ifdef USE_TRANSMISSION 2561 varying vec3 vWorldPosition; 2562#endif 2563#include <common> 2564#include <uv_pars_vertex> 2565#include <uv2_pars_vertex> 2566#include <displacementmap_pars_vertex> 2567#include <color_pars_vertex> 2568#include <fog_pars_vertex> 2569#include <normal_pars_vertex> 2570#include <morphtarget_pars_vertex> 2571#include <skinning_pars_vertex> 2572#include <shadowmap_pars_vertex> 2573#include <logdepthbuf_pars_vertex> 2574#include <clipping_planes_pars_vertex> 2575void main() { 2576 #include <uv_vertex> 2577 #include <uv2_vertex> 2578 #include <color_vertex> 2579 #include <morphcolor_vertex> 2580 #include <beginnormal_vertex> 2581 #include <morphnormal_vertex> 2582 #include <skinbase_vertex> 2583 #include <skinnormal_vertex> 2584 #include <defaultnormal_vertex> 2585 #include <normal_vertex> 2586 #include <begin_vertex> 2587 #include <morphtarget_vertex> 2588 #include <skinning_vertex> 2589 #include <displacementmap_vertex> 2590 #include <project_vertex> 2591 #include <logdepthbuf_vertex> 2592 #include <clipping_planes_vertex> 2593 vViewPosition = - mvPosition.xyz; 2594 #include <worldpos_vertex> 2595 #include <shadowmap_vertex> 2596 #include <fog_vertex> 2597#ifdef USE_TRANSMISSION 2598 vWorldPosition = worldPosition.xyz; 2599#endif 2600}`,ER=`#define STANDARD 2601#ifdef PHYSICAL 2602 #define IOR 2603 #define SPECULAR 2604#endif 2605uniform vec3 diffuse; 2606uniform vec3 emissive; 2607uniform float roughness; 2608uniform float metalness; 2609uniform float opacity; 2610#ifdef IOR 2611 uniform float ior; 2612#endif 2613#ifdef SPECULAR 2614 uniform float specularIntensity; 2615 uniform vec3 specularColor; 2616 #ifdef USE_SPECULARINTENSITYMAP 2617 uniform sampler2D specularIntensityMap; 2618 #endif 2619 #ifdef USE_SPECULARCOLORMAP 2620 uniform sampler2D specularColorMap; 2621 #endif 2622#endif 2623#ifdef USE_CLEARCOAT 2624 uniform float clearcoat; 2625 uniform float clearcoatRoughness; 2626#endif
2627#ifdef USE_IRIDESCENCE 2628 uniform float iridescence; 2629 uniform float iridescenceIOR; 2630 uniform float iridescenceThicknessMinimum; 2631 uniform float iridescenceThicknessMaximum; 2632#endif 2633#ifdef USE_SHEEN 2634 uniform vec3 sheenColor; 2635 uniform float sheenRoughness; 2636 #ifdef USE_SHEENCOLORMAP 2637 uniform sampler2D sheenColorMap; 2638 #endif 2639 #ifdef USE_SHEENROUGHNESSMAP 2640 uniform sampler2D sheenRoughnessMap; 2641 #endif 2642#endif 2643varying vec3 vViewPosition; 2644#include <common> 2645#include <packing> 2646#include <dithering_pars_fragment> 2647#include <color_pars_fragment> 2648#include <uv_pars_fragment> 2649#include <uv2_pars_fragment> 2650#include <map_pars_fragment> 2651#include <alphamap_pars_fragment> 2652#include <alphatest_pars_fragment> 2653#include <aomap_pars_fragment> 2654#include <lightmap_pars_fragment> 2655#include <emissivemap_pars_fragment> 2656#include <bsdfs> 2657#include <iridescence_fragment> 2658#include <cube_uv_reflection_fragment> 2659#include <envmap_common_pars_fragment> 2660#include <envmap_physical_pars_fragment> 2661#include <fog_pars_fragment> 2662#include <lights_pars_begin> 2663#include <normal_pars_fragment> 2664#include <lights_physical_pars_fragment> 2665#include <transmission_pars_fragment> 2666#include <shadowmap_pars_fragment> 2667#include <bumpmap_pars_fragment> 2668#include <normalmap_pars_fragment> 2669#include <clearcoat_pars_fragment> 2670#include <iridescence_pars_fragment> 2671#include <roughnessmap_pars_fragment> 2672#include <metalnessmap_pars_fragment> 2673#include <logdepthbuf_pars_fragment> 2674#include <clipping_planes_pars_fragment> 2675void main() { 2676 #include <clipping_planes_fragment> 2677 vec4 diffuseColor = vec4( diffuse, opacity ); 2678 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2679 vec3 totalEmissiveRadiance = emissive; 2680 #include <logdepthbuf_fragment> 2681 #include <map_fragment> 2682 #include <color_fragment> 2683 #include <alphamap_fragment> 2684 #include <alphatest_fragment> 2685 #include <roughnessmap_fragment> 2686 #include <metalnessmap_fragment> 2687 #include <normal_fragment_begin> 2688 #include <normal_fragment_maps> 2689 #include <clearcoat_normal_fragment_begin> 2690 #include <clearcoat_normal_fragment_maps> 2691 #include <emissivemap_fragment> 2692 #include <lights_physical_fragment> 2693 #include <lights_fragment_begin> 2694 #include <lights_fragment_maps> 2695 #include <lights_fragment_end> 2696 #include <aomap_fragment> 2697 vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; 2698 vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; 2699 #include <transmission_fragment> 2700 vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; 2701 #ifdef USE_SHEEN 2702 float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); 2703 outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; 2704 #endif 2705 #ifdef USE_CLEARCOAT 2706 float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); 2707 vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); 2708 outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; 2709 #endif 2710 #include <output_fragment> 2711 #include <tonemapping_fragment> 2712 #include <encodings_fragment> 2713 #include <fog_fragment> 2714 #include <premultiplied_alpha_fragment> 2715 #include <dithering_fragment> 2716}`,CR=`#define TOON 2717varying vec3 vViewPosition; 2718#include <common> 2719#include <uv_pars_vertex> 2720#include <uv2_pars_vertex> 2721#include <displacementmap_pars_vertex> 2722#include <color_pars_vertex> 2723#include <fog_pars_vertex> 2724#include <normal_pars_vertex> 2725#include <morphtarget_pars_vertex> 2726#include <skinning_pars_vertex> 2727#include <shadowmap_pars_vertex> 2728#include <logdepthbuf_pars_vertex> 2729#include <clipping_planes_pars_vertex> 2730void main() { 2731 #include <uv_vertex> 2732 #include <uv2_vertex> 2733 #include <color_vertex> 2734 #include <morphcolor_vertex> 2735 #include <beginnormal_vertex> 2736 #include <morphnormal_vertex> 2737 #include <skinbase_vertex> 2738 #include <skinnormal_vertex> 2739 #include <defaultnormal_vertex> 2740 #include <normal_vertex> 2741 #include <begin_vertex> 2742 #include <morphtarget_vertex> 2743 #include <skinning_vertex> 2744 #include <displacementmap_vertex> 2745 #include <project_vertex> 2746 #include <logdepthbuf_vertex> 2747 #include <clipping_planes_vertex> 2748 vViewPosition = - mvPosition.xyz; 2749 #include <worldpos_vertex> 2750 #include <shadowmap_vertex> 2751 #include <fog_vertex> 2752}`,TR=`#define TOON 2753uniform vec3 diffuse; 2754uniform vec3 emissive; 2755uniform float opacity; 2756#include <common> 2757#include <packing> 2758#include <dithering_pars_fragment> 2759#include <color_pars_fragment> 2760#include <uv_pars_fragment> 2761#include <uv2_pars_fragment> 2762#include <map_pars_fragment> 2763#include <alphamap_pars_fragment> 2764#include <alphatest_pars_fragment> 2765#include <aomap_pars_fragment> 2766#include <lightmap_pars_fragment> 2767#include <emissivemap_pars_fragment> 2768#include <gradientmap_pars_fragment> 2769#include <fog_pars_fragment> 2770#include <bsdfs> 2771#include <lights_pars_begin> 2772#include <normal_pars_fragment> 2773#include <lights_toon_pars_fragment> 2774#include <shadowmap_pars_fragment> 2775#include <bumpmap_pars_fragment> 2776#include <normalmap_pars_fragment> 2777#include <logdepthbuf_pars_fragment> 2778#include <clipping_planes_pars_fragment> 2779void main() { 2780 #include <clipping_planes_fragment> 2781 vec4 diffuseColor = vec4( diffuse, opacity ); 2782 ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); 2783 vec3 totalEmissiveRadiance = emissive; 2784 #include <logdepthbuf_fragment> 2785 #include <map_fragment> 2786 #include <color_fragment> 2787 #include <alphamap_fragment> 2788 #include <alphatest_fragment> 2789 #include <normal_fragment_begin> 2790 #include <normal_fragment_maps> 2791 #include <emissivemap_fragment> 2792 #include <lights_toon_fragment> 2793 #include <lights_fragment_begin> 2794 #include <lights_fragment_maps> 2795 #include <lights_fragment_end> 2796 #include <aomap_fragment> 2797 vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; 2798 #include <output_fragment> 2799 #include <tonemapping_fragment> 2800 #include <encodings_fragment> 2801 #include <fog_fragment> 2802 #include <premultiplied_alpha_fragment> 2803 #include <dithering_fragment> 2804}`,PR=`uniform float size; 2805uniform float scale; 2806#include <common> 2807#include <color_pars_vertex> 2808#include <fog_pars_vertex> 2809#include <morphtarget_pars_vertex> 2810#include <logdepthbuf_pars_vertex> 2811#include <clipping_planes_pars_vertex> 2812void main() { 2813 #include <color_vertex> 2814 #include <morphcolor_vertex> 2815 #include <begin_vertex> 2816 #include <morphtarget_vertex> 2817 #include <project_vertex> 2818 gl_PointSize = size; 2819 #ifdef USE_SIZEATTENUATION 2820 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 2821 if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); 2822 #endif 2823 #include <logdepthbuf_vertex> 2824 #include <clipping_planes_vertex> 2825 #include <worldpos_vertex> 2826 #include <fog_vertex> 2827}`,DR=`uniform vec3 diffuse; 2828uniform float opacity; 2829#include <common> 2830#include <color_pars_fragment> 2831#include <map_particle_pars_fragment> 2832#include <alphatest_pars_fragment> 2833#include <fog_pars_fragment> 2834#include <logdepthbuf_pars_fragment> 2835#include <clipping_planes_pars_fragment> 2836void main() { 2837 #include <clipping_planes_fragment> 2838 vec3 outgoingLight = vec3( 0.0 ); 2839 vec4 diffuseColor = vec4( diffuse, opacity ); 2840 #include <logdepthbuf_fragment> 2841 #include <map_particle_fragment> 2842 #include <color_fragment> 2843 #include <alphatest_fragment> 2844 outgoingLight = diffuseColor.rgb; 2845 #include <output_fragment> 2846 #include <tonemapping_fragment> 2847 #include <encodings_fragment> 2848 #include <fog_fragment> 2849 #include <premultiplied_alpha_fragment> 2850}`,OR=`#include <common> 2851#include <fog_pars_vertex> 2852#include <morphtarget_pars_vertex> 2853#include <skinning_pars_vertex> 2854#include <shadowmap_pars_vertex> 2855void main() { 2856 #include <beginnormal_vertex> 2857 #include <morphnormal_vertex> 2858 #include <skinbase_vertex> 2859 #include <skinnormal_vertex> 2860 #include <defaultnormal_vertex> 2861 #include <begin_vertex> 2862 #include <morphtarget_vertex> 2863 #include <skinning_vertex> 2864 #include <project_vertex> 2865 #include <worldpos_vertex> 2866 #include <shadowmap_vertex> 2867 #include <fog_vertex> 2868}`,IR=`uniform vec3 color; 2869uniform float opacity; 2870#include <common> 2871#include <packing> 2872#include <fog_pars_fragment> 2873#include <bsdfs> 2874#include <lights_pars_begin> 2875#include <shadowmap_pars_fragment> 2876#include <shadowmask_pars_fragment> 2877void main() { 2878 gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); 2879 #include <tonemapping_fragment> 2880 #include <encodings_fragment> 2881 #include <fog_fragment> 2882}`,RR=`uniform float rotation; 2883uniform vec2 center; 2884#include <common> 2885#include <uv_pars_vertex> 2886#include <fog_pars_vertex> 2887#include <logdepthbuf_pars_vertex> 2888#include <clipping_planes_pars_vertex> 2889void main() { 2890 #include <uv_vertex> 2891 vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); 2892 vec2 scale; 2893 scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); 2894 scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); 2895 #ifndef USE_SIZEATTENUATION 2896 bool isPerspective = isPerspectiveMatrix( projectionMatrix ); 2897 if ( isPerspective ) scale *= - mvPosition.z; 2898 #endif 2899 vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; 2900 vec2 rotatedPosition; 2901 rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; 2902 rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; 2903 mvPosition.xy += rotatedPosition; 2904 gl_Position = projectionMatrix * mvPosition; 2905 #include <logdepthbuf_vertex> 2906 #include <clipping_planes_vertex> 2907 #include <fog_vertex> 2908}`,LR=`uniform vec3 diffuse; 2909uniform float opacity; 2910#include <common> 2911#include <uv_pars_fragment> 2912#include <map_pars_fragment> 2913#include <alphamap_pars_fragment> 2914#include <alphatest_pars_fragment> 2915#include <fog_pars_fragment> 2916#include <logdepthbuf_pars_fragment> 2917#include <clipping_planes_pars_fragment> 2918void main() { 2919 #include <clipping_planes_fragment> 2920 vec3 outgoingLight = vec3( 0.0 ); 2921 vec4 diffuseColor = vec4( diffuse, opacity ); 2922 #include <logdepthbuf_fragment> 2923 #include <map_fragment> 2924 #include <alphamap_fragment> 2925 #include <alphatest_fragment> 2926 outgoingLight = diffuseColor.rgb; 2927 #include <output_fragment> 2928 #include <tonemapping_fragment> 2929 #include <encodings_fragment> 2930 #include <fog_fragment> 2931}`,yt={alphamap_fragment:rO,alphamap_pars_fragment:sO,alphatest_fragment:aO,alphatest_pars_fragment:nO,aomap_fragment:oO,aomap_pars_fragment:lO,begin_vertex:hO,beginnormal_vertex:cO,bsdfs:uO,iridescence_fragment:dO,bumpmap_pars_fragment:pO,clipping_planes_fragment:fO,clipping_planes_pars_fragment:mO,clipping_planes_pars_vertex:gO,clipping_planes_vertex:vO,color_fragment:yO,color_pars_fragment:xO,color_pars_vertex:bO,color_vertex:wO,common:SO,cube_uv_reflection_fragment:_O,defaultnormal_vertex:AO,displacementmap_pars_vertex:MO,displacementmap_vertex:EO,emissivemap_fragment:CO,emissivemap_pars_fragment:TO,encodings_fragment:PO,encodings_pars_fragment:DO,envmap_fragment:OO,envmap_common_pars_fragment:IO,envmap_pars_fragment:RO,envmap_pars_vertex:LO,envmap_physical_pars_fragment:qO,envmap_vertex:zO,fog_vertex:BO,fog_pars_vertex:FO,fog_fragment:kO,fog_pars_fragment:UO,gradientmap_pars_fragment:NO,lightmap_fragment:VO,lightmap_pars_fragment:jO,lights_lambert_fragment:HO,lights_lambert_pars_fragment:GO,lights_pars_begin:WO,lights_toon_fragment:XO,lights_toon_pars_fragment:YO,lights_phong_fragment:QO,lights_phong_pars_fragment:KO,lights_physical_fragment:ZO,lights_physical_pars_fragment:JO,lights_fragment_begin:$O,lights_fragment_maps:eI,lights_fragment_end:tI,logdepthbuf_fragment:iI,logdepthbuf_pars_fragment:rI,logdepthbuf_pars_vertex:sI,logdepthbuf_vertex:aI,map_fragment:nI,map_pars_fragment:oI,map_particle_fragment:lI,map_particle_pars_fragment:hI,metalnessmap_fragment:cI,metalnessmap_pars_fragment:uI,morphcolor_vertex:dI,morphnormal_vertex:pI,morphtarget_pars_vertex:fI,morphtarget_vertex:mI,normal_fragment_begin:gI,normal_fragment_maps:vI,normal_pars_fragment:yI,normal_pars_vertex:xI,normal_vertex:bI,normalmap_pars_fragment:wI,clearcoat_normal_fragment_begin:SI,clearcoat_normal_fragment_maps:_I,clearcoat_pars_fragment:AI,iridescence_pars_fragment:MI,output_fragment:EI,packing:CI,premultiplied_alpha_fragment:TI,project_vertex:PI,dithering_fragment:DI,dithering_pars_fragment:OI,roughnessmap_fragment:II,roughnessmap_pars_fragment:RI,shadowmap_pars_fragment:LI,shadowmap_pars_vertex:zI,shadowmap_vertex:BI,shadowmask_pars_fragment:FI,skinbase_vertex:kI,skinning_pars_vertex:UI,skinning_vertex:NI,skinnormal_vertex:VI,specularmap_fragment:jI,specularmap_pars_fragment:HI,tonemapping_fragment:GI,tonemapping_pars_fragment:WI,transmission_fragment:qI,transmission_pars_fragment:XI,uv_pars_fragment:YI,uv_pars_vertex:QI,uv_vertex:KI,uv2_pars_fragment:ZI,uv2_pars_vertex:JI,uv2_vertex:$I,worldpos_vertex:eR,background_vert:tR,background_frag:iR,backgroundCube_vert:rR,backgroundCube_frag:sR,cube_vert:aR,cube_frag:nR,depth_vert:oR,depth_frag:lR,distanceRGBA_vert:hR,distanceRGBA_frag:cR,equirect_vert:uR,equirect_frag:dR,linedashed_vert:pR,linedashed_frag:fR,meshbasic_vert:mR,meshbasic_frag:gR,meshlambert_vert:vR,meshlambert_frag:yR,meshmatcap_vert:xR,meshmatcap_frag:bR,meshnormal_vert:wR,meshnormal_frag:SR,meshphong_vert:_R,meshphong_frag:AR,meshphysical_vert:MR,meshphysical_frag:ER,meshtoon_vert:CR,meshtoon_frag:TR,points_vert:PR,points_frag:DR,shadow_vert:OR,shadow_frag:IR,sprite_vert:RR,sprite_frag:LR},Ce={common:{diffuse:{value:new Je(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ii},uv2Transform:{value:new Ii},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new H(1,1)}}
vendor: 4,469 bytes, line 2931
2931,displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Je(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Je(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ii}},sprite:{diffuse:{value:new Je(16777215)},opacity:{value:1},center:{value:new H(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ii}}},ha={basic:{uniforms:Or([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.fog]),vertexShader:yt.meshbasic_vert,fragmentShader:yt.meshbasic_frag},lambert:{uniforms:Or([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new Je(0)}}]),vertexShader:yt.meshlambert_vert,fragmentShader:yt.meshlambert_frag},phong:{uniforms:Or([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new Je(0)},specular:{value:new Je(1118481)},shininess:{value:30}}]),vertexShader:yt.meshphong_vert,fragmentShader:yt.meshphong_frag},standard:{uniforms:Or([Ce.common,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.roughnessmap,Ce.metalnessmap,Ce.fog,Ce.lights,{emissive:{value:new Je(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:yt.meshphysical_vert,fragmentShader:yt.meshphysical_frag},toon:{uniforms:Or([Ce.common,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.gradientmap,Ce.fog,Ce.lights,{emissive:{value:new Je(0)}}]),vertexShader:yt.meshtoon_vert,fragmentShader:yt.meshtoon_frag},matcap:{uniforms:Or([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,{matcap:{value:null}}]),vertexShader:yt.meshmatcap_vert,fragmentShader:yt.meshmatcap_frag},points:{uniforms:Or([Ce.points,Ce.fog]),vertexShader:yt.points_vert,fragmentShader:yt.points_frag},dashed:{uniforms:Or([Ce.common,Ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:yt.linedashed_vert,fragmentShader:yt.linedashed_frag},depth:{uniforms:Or([Ce.common,Ce.displacementmap]),vertexShader:yt.depth_vert,fragmentShader:yt.depth_frag},normal:{uniforms:Or([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,{opacity:{value:1}}]),vertexShader:yt.meshnormal_vert,fragmentShader:yt.meshnormal_frag},sprite:{uniforms:Or([Ce.sprite,Ce.fog]),vertexShader:yt.sprite_vert,fragmentShader:yt.sprite_frag},background:{uniforms:{uvTransform:{value:new Ii},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:yt.background_vert,fragmentShader:yt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:yt.backgroundCube_vert,fragmentShader:yt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:yt.cube_vert,fragmentShader:yt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:yt.equirect_vert,fragmentShader:yt.equirect_frag}
2931,distanceRGBA:{uniforms:Or([Ce.common,Ce.displacementmap,{referencePosition:{value:new M},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:yt.distanceRGBA_vert,fragmentShader:yt.distanceRGBA_frag},shadow:{uniforms:Or([Ce.lights,Ce.fog,{color:{value:new Je(0)},opacity:{value:1}}]),vertexShader:yt.shadow_vert,fragmentShader:yt.shadow_frag}};ha.physical={uniforms:Or([ha.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new H(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Je(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new H},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Je(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Je(1,1,1)},specularColorMap:{value:null}}]),vertexShader:yt.meshphysical_vert,fragmentShader:yt.meshphysical_frag};var gd={r:0,b:0,g:0};function zR(e,t,i,r,s,a,n){let o=new Je(0),l=a===!0?0:1,h,c,u=null,d=0,p=null;function f(g,v){let y=!1,x=v.isScene===!0?v.background:null;x&&x.isTexture&&(x=(v.backgroundBlurriness>0?i:t).get(x));let w=e.xr,S=w.getSession&&w.getSession();S&&S.environmentBlendMode==="additive"&&(x=null),x===null?m(o,l):x&&x.isColor&&(m(x,1),y=!0),(e.autoClear||y)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),x&&(x.isCubeTexture||x.mapping===Lu)?(c===void 0&&(c=new Zt(new Hs(1,1,1),new Dt({name:"BackgroundCubeMaterial",uniforms:_h(ha.backgroundCube.uniforms),vertexShader:ha.backgroundCube.vertexShader,fragmentShader:ha.backgroundCube.fragmentShader,side:sr,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(b,E,_){this.matrixWorld.copyPosition(_.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(c)),c.material.uniforms.envMap.value=x,c.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,c.material.toneMapped=x.encoding!==gt,(u!==x||d!==x.version||p!==e.toneMapping)&&(c.material.needsUpdate=!0,u=x,d=x.version,p=e.toneMapping),c.layers.enableAll(),g.unshift(c,c.geometry,c.material,0,0,null)):x&&x.isTexture&&(h===void 0&&(h=new Zt(new Sa(2,2),new Dt({name:"BackgroundMaterial",uniforms:_h(ha.background.uniforms),vertexShader:ha.background.vertexShader,fragmentShader:ha.background.fragmentShader,side:Vs,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(h)),h.material.uniforms.t2D.value=x,h.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,h.material.toneMapped=x.encoding!==gt,x.matrixAutoUpdate===!0&&x.updateMatrix(),h.material.uniforms.uvTransform.value.copy(x.matrix),(u!==x||d!==x.version||p!==e.toneMapping)&&(h.material.needsUpdate=!0,u=x,d=x.version,p=e.toneMapping),h.layers.enableAll(),g.unshift(h,h.geometry,h.material,0,0,null))}function m(g,v){g.getRGB(gd,gM(e)),r.buffers.color.setClear(gd.r,gd.g,gd.b,v,n)}return{getClearColor:function(){return o},setClearColor:function(g,v=1){o.set(g),l=v,m(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(g){l=g,m(o,l)},render:f}}function BR(e,t,i,r){let s=e.getParameter(34921),a=r.isWebGL2?null:t.get("OES_vertex_array_object"),n=r.isWebGL2||a!==null,o={},l=g(null),h=l,c=!1;function u(O,k,G,B,U){let Q=!1;if(n){let q=m(B,G,k);h!==q&&(h=q,p(h.object)),Q=v(O,B,G,U),Q&&y(O,B,G,U)}else{let q=k.wireframe===!0;
vendor: 4,125 bytes, line 2931
2931(h.geometry!==B.id||h.program!==G.id||h.wireframe!==q)&&(h.geometry=B.id,h.program=G.id,h.wireframe=q,Q=!0)}U!==null&&i.update(U,34963),(Q||c)&&(c=!1,_(O,k,G,B),U!==null&&e.bindBuffer(34963,i.get(U).buffer))}function d(){return r.isWebGL2?e.createVertexArray():a.createVertexArrayOES()}function p(O){return r.isWebGL2?e.bindVertexArray(O):a.bindVertexArrayOES(O)}function f(O){return r.isWebGL2?e.deleteVertexArray(O):a.deleteVertexArrayOES(O)}function m(O,k,G){let B=G.wireframe===!0,U=o[O.id];U===void 0&&(U={},o[O.id]=U);let Q=U[k.id];Q===void 0&&(Q={},U[k.id]=Q);let q=Q[B];return q===void 0&&(q=g(d()),Q[B]=q),q}function g(O){let k=[],G=[],B=[];for(let U=0;U<s;U++)k[U]=0,G[U]=0,B[U]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:k,enabledAttributes:G,attributeDivisors:B,object:O,attributes:{},index:null}}function v(O,k,G,B){let U=h.attributes,Q=k.attributes,q=0,j=G.getAttributes();for(let X in j)if(j[X].location>=0){let te=U[X],K=Q[X];if(K===void 0&&(X==="instanceMatrix"&&O.instanceMatrix&&(K=O.instanceMatrix),X==="instanceColor"&&O.instanceColor&&(K=O.instanceColor)),te===void 0||te.attribute!==K||K&&te.data!==K.data)return!0;q++}return h.attributesNum!==q||h.index!==B}function y(O,k,G,B){let U={},Q=k.attributes,q=0,j=G.getAttributes();for(let X in j)if(j[X].location>=0){let te=Q[X];te===void 0&&(X==="instanceMatrix"&&O.instanceMatrix&&(te=O.instanceMatrix),X==="instanceColor"&&O.instanceColor&&(te=O.instanceColor));let K={};K.attribute=te,te&&te.data&&(K.data=te.data),U[X]=K,q++}h.attributes=U,h.attributesNum=q,h.index=B}function x(){let O=h.newAttributes;for(let k=0,G=O.length;k<G;k++)O[k]=0}function w(O){S(O,0)}function S(O,k){let G=h.newAttributes,B=h.enabledAttributes,U=h.attributeDivisors;G[O]=1,B[O]===0&&(e.enableVertexAttribArray(O),B[O]=1),U[O]!==k&&((r.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](O,k),U[O]=k)}function b(){let O=h.newAttributes,k=h.enabledAttributes;for(let G=0,B=k.length;G<B;G++)k[G]!==O[G]&&(e.disableVertexAttribArray(G),k[G]=0)}function E(O,k,G,B,U,Q){r.isWebGL2===!0&&(G===5124||G===5125)?e.vertexAttribIPointer(O,k,G,U,Q):e.vertexAttribPointer(O,k,G,B,U,Q)}function _(O,k,G,B){if(r.isWebGL2===!1&&(O.isInstancedMesh||B.isInstancedBufferGeometry)&&t.get("ANGLE_instanced_arrays")===null)return;x();let U=B.attributes,Q=G.getAttributes(),q=k.defaultAttributeValues;for(let j in Q){let X=Q[j];if(X.location>=0){let te=U[j];if(te===void 0&&(j==="instanceMatrix"&&O.instanceMatrix&&(te=O.instanceMatrix),j==="instanceColor"&&O.instanceColor&&(te=O.instanceColor)),te!==void 0){let K=te.normalized,Z=te.itemSize,W=i.get(te);if(W===void 0)continue;let re=W.buffer,$=W.type,ne=W.bytesPerElement;if(te.isInterleavedBufferAttribute){let ie=te.data,ve=ie.stride,de=te.offset;if(ie.isInstancedInterleavedBuffer){for(let we=0;we<X.locationSize;we++)S(X.location+we,ie.meshPerAttribute);O.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=ie.meshPerAttribute*ie.count)}else for(let we=0;we<X.locationSize;we++)w(X.location+we);e.bindBuffer(34962,re);for(let we=0;we<X.locationSize;we++)E(X.location+we,Z/X.locationSize,$,K,ve*ne,(de+Z/X.locationSize*we)*ne)}else{if(te.isInstancedBufferAttribute){for(let ie=0;ie<X.locationSize;ie++)S(X.location+ie,te.meshPerAttribute);O.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=te.meshPerAttribute*te.count)}else for(let ie=0;ie<X.locationSize;ie++)w(X.location+ie);e.bindBuffer(34962,re);for(let ie=0;ie<X.locationSize;ie++)E(X.location+ie,Z/X.locationSize,$,K,Z*ne,Z/X.locationSize*ie*ne)}}else if(q!==void 0){let K=q[j];if(K!==void 0)switch(K.length){case 2:e.vertexAttrib2fv(X.location,K);break;case 3:e.vertexAttrib3fv(X.location,K);break;case 4:e.vertexAttrib4fv(X.location,K);break;default:e.vertexAttrib1fv(X.location,K)}}}}b()}function A(){I();for(let O in o){let k=o[O];for(let G in k){let B=k[G];for(let U in B)f(B[U].object),delete B[U];delete k[G]}delete o[O]}}function C(O){if(o[O.id]===void 0)return;let k=o[O.id];for(let G in k){let B=k[G];for(let U in B)f(B[U].object),delete B[U];delete k[G]}
2931delete o[O.id]}function T(O){for(let k in o){let G=o[k];if(G[O.id]===void 0)continue;let B=G[O.id];for(let U in B)f(B[U].object),delete B[U];delete G[O.id]}}function I(){P(),c=!0,h!==l&&(h=l,p(h.object))}function P(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:u,reset:I,resetDefaultState:P,dispose:A,releaseStatesOfGeometry:C,releaseStatesOfProgram:T,initAttributes:x,enableAttribute:w,disableUnusedAttributes:b}}function FR(e,t,i,r){let s=r.isWebGL2,a;function n(h){a=h}function o(h,c){e.drawArrays(a,h,c),i.update(c,a,1)}function l(h,c,u){if(u===0)return;let d,p;if(s)d=e,p="drawArraysInstanced";else if(d=t.get("ANGLE_instanced_arrays"),p="drawArraysInstancedANGLE",d===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}d[p](a,h,c,u),i.update(c,a,u)}this.setMode=n,this.render=o,this.renderInstances=l}function kR(e,t,i){let r;function s(){if(r!==void 0)return r;if(t.has("EXT_texture_filter_anisotropic")===!0){let E=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(E.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(E){if(E==="highp"){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";E="mediump"}return E==="mediump"&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}let n=typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext,o=i.precision!==void 0?i.precision:"highp",l=a(o);l!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",l,"instead."),o=l);let h=n||t.has("WEBGL_draw_buffers"),c=i.logarithmicDepthBuffer===!0,u=e.getParameter(34930),d=e.getParameter(35660),p=e.getParameter(3379),f=e.getParameter(34076),m=e.getParameter(34921),g=e.getParameter(36347),v=e.getParameter(36348),y=e.getParameter(36349),x=d>0,w=n||t.has("OES_texture_float"),S=x&&w,b=n?e.getParameter(36183):0;return{isWebGL2:n,drawBuffers:h,getMaxAnisotropy:s,getMaxPrecision:a,precision:o,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:d,maxTextureSize:p,maxCubemapSize:f,maxAttributes:m,maxVertexUniforms:g,maxVaryings:v,maxFragmentUniforms:y,vertexTextures:x,floatFragmentTextures:w,floatVertexTextures:S,maxSamples:b}}function UR(e){let t=this,i=null,r=0,s=!1,a=!1,n=new Hr,o=new Ii,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){let p=u.length!==0||d||r!==0||s;return s=d,r=u.length,p},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(u,d){i=c(u,d,0)},this.setState=function(u,d,p){let f=u.clippingPlanes,m=u.clipIntersection,g=u.clipShadows,v=e.get(u);if(!s||f===null||f.length===0||a&&!g)a?c(null):h();else{let y=a?0:r,x=y*4,w=v.clippingState||null;l.value=w,w=c(f,d,x,p);for(let S=0;S!==x;++S)w[S]=i[S];v.clippingState=w,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=y}};function h(){l.value!==i&&(l.value=i,l.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function c(u,d,p,f){let m=u!==null?u.length:0,g=null;if(m!==0){if(g=l.value,f!==!0||g===null){let v=p+m*4,y=d.matrixWorldInverse;o.getNormalMatrix(y),(g===null||g.length<v)&&(g=new Float32Array(v));for(let x=0,w=p;x!==m;++x,w+=4)n.copy(u[x]).applyMatrix4(y,o),n.normal.toArray(g,w),g[w+3]=n.constant}l.value=g,l.needsUpdate=!0}return t.numPlanes=m,t.numIntersection=0,g}}function NR(e){let t=new WeakMap;function i(n,o){return o===jv?n.mapping=Jo:o===Hv&&(n.mapping=$o),n}function r(n){if(n&&n.isTexture&&n.isRenderTargetTexture===!1){let o=n.mapping;if(o===jv||o===Hv)if(t.has(n)){let l=t.get(n).texture;return i(l,n.mapping)}else{let l=n.image;if(l&&l.height>0){let h=new $3(l.height/2);return h.fromEquirectangularTexture(e,n),t.set(n,h),n.addEventListener("dispose",s),i(h.texture,n.mapping)}else return null}}return n}function s(n){let o=n.target;o.removeEventListener("dispose",s);let l=t.get(o);l!==void 0&&(t.delete(o),l.dispose())}function a(){t=new WeakMap}return{get:r,dispose:a}}var $f=class extends go{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="Orthogra
2931phicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,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,i,r,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=i,this.view.offsetY=r,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),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2,s=i-e,a=i+e,n=r+t,o=r-t;if(this.view!==null&&this.view.enabled){let l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,a=s+l*this.view.width,n-=h*this.view.offsetY,o=n-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,n,o,this.near,this.far),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}},rh=4,Eb=[.125,.215,.35,.446,.526,.582],Io=20,og=new $f,Cb=new Je,lg=null,To=(1+Math.sqrt(5))/2,Cl=1/To,Tb=[new M(1,1,1),new M(-1,1,1),new M(1,1,-1),new M(-1,1,-1),new M(0,To,Cl),new M(0,To,-Cl),new M(Cl,0,To),new M(-Cl,0,To),new M(To,Cl,0),new M(-To,Cl,0)],Pb=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){lg=this._renderer.getRenderTarget(),this._setSize(256);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Ib(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Ob(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(lg),e.scissorTest=!1,vd(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Jo||e.mapping===$o?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),lg=this._renderer.getRenderTarget();let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:xt,minFilter:xt,generateMipmaps:!1,type:dn,format:oi,encoding:js,depthBuffer:!1},r=Db(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Db(e,t,i);let{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=VR(s)),this._blurMaterial=jR(s,e,t)}return r}_compileMaterial(e){let t=new Zt(this._lodPlanes[0],e);this._renderer.compile(t,og)}_sceneToCubeUV(e,t,i,r){let s=new wr(90,1,t,i),a=[1,-1,1,1,1,1],n=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,h=o.toneMapping;o.getClearColor(Cb),o.toneMapping=ya,o.autoClear=!1;
vendor: 5,337 bytes, lines 2931-3006
2931let c=new pn({name:"PMREM.Background",side:sr,depthWrite:!1,depthTest:!1}),u=new Zt(new Hs,c),d=!1,p=e.background;p?p.isColor&&(c.color.copy(p),e.background=null,d=!0):(c.color.copy(Cb),d=!0);for(let f=0;f<6;f++){let m=f%3;m===0?(s.up.set(0,a[f],0),s.lookAt(n[f],0,0)):m===1?(s.up.set(0,0,a[f]),s.lookAt(0,n[f],0)):(s.up.set(0,a[f],0),s.lookAt(0,0,n[f]));let g=this._cubeSize;vd(r,m*g,f>2?g:0,g,g),o.setRenderTarget(r),d&&o.render(u,s),o.render(e,s)}u.geometry.dispose(),u.material.dispose(),o.toneMapping=h,o.autoClear=l,e.background=p}_textureToCubeUV(e,t){let i=this._renderer,r=e.mapping===Jo||e.mapping===$o;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ib()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Ob());let s=r?this._cubemapMaterial:this._equirectMaterial,a=new Zt(this._lodPlanes[0],s),n=s.uniforms;n.envMap.value=e;let o=this._cubeSize;vd(t,0,0,3*o,2*o),i.setRenderTarget(t),i.render(a,og)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){let s=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),a=Tb[(r-1)%Tb.length];this._blur(e,r-1,r,s,a)}t.autoClear=i}_blur(e,t,i,r,s){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,r,"latitudinal",s),this._halfBlur(a,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,a,n){let o=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let h=3,c=new Zt(this._lodPlanes[r],l),u=l.uniforms,d=this._sizeLods[i]-1,p=isFinite(s)?Math.PI/(2*d):2*Math.PI/(2*Io-1),f=s/p,m=isFinite(s)?1+Math.floor(h*f):Io;m>Io&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Io}`);let g=[],v=0;for(let b=0;b<Io;++b){let E=b/f,_=Math.exp(-E*E/2);g.push(_),b===0?v+=_:b<m&&(v+=2*_)}for(let b=0;b<g.length;b++)g[b]=g[b]/v;u.envMap.value=e.texture,u.samples.value=m,u.weights.value=g,u.latitudinal.value=a==="latitudinal",n&&(u.poleAxis.value=n);let{_lodMax:y}=this;u.dTheta.value=p,u.mipInt.value=y-i;let x=this._sizeLods[r],w=3*x*(r>y-rh?r-y+rh:0),S=4*(this._cubeSize-x);vd(t,w,S,3*x,2*x),o.setRenderTarget(t),o.render(c,og)}};function VR(e){let t=[],i=[],r=[],s=e,a=e-rh+1+Eb.length;for(let n=0;n<a;n++){let o=Math.pow(2,s);i.push(o);let l=1/o;n>e-rh?l=Eb[n-e+rh-1]:n===0&&(l=0),r.push(l);let h=1/(o-2),c=-h,u=1+h,d=[c,c,u,c,u,u,c,c,u,u,c,u],p=6,f=6,m=3,g=2,v=1,y=new Float32Array(m*f*p),x=new Float32Array(g*f*p),w=new Float32Array(v*f*p);for(let b=0;b<p;b++){let E=b%3*2/3-1,_=b>2?0:-1,A=[E,_,0,E+2/3,_,0,E+2/3,_+1,0,E,_,0,E+2/3,_+1,0,E,_+1,0];y.set(A,m*f*b),x.set(d,g*f*b);let C=[b,b,b,b,b,b];w.set(C,v*f*b)}let S=new He;S.setAttribute("position",new tt(y,m)),S.setAttribute("uv",new tt(x,g)),S.setAttribute("faceIndex",new tt(w,v)),t.push(S),s>rh&&s--}return{lodPlanes:t,sizeLods:i,sigmas:r}}function Db(e,t,i){let r=new Pt(e,t,i);return r.texture.mapping=Lu,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function vd(e,t,i,r,s){e.viewport.set(t,i,r,s),e.scissor.set(t,i,r,s)}function jR(e,t,i){let r=new Float32Array(Io),s=new M(0,1,0);return new Dt({name:"SphericalGaussianBlur",defines:{n:Io,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:t1(),fragmentShader:` 2932 2933 precision mediump float; 2934 precision mediump int; 2935 2936 varying vec3 vOutputDirection; 2937 2938 uniform sampler2D envMap; 2939 uniform int samples; 2940 uniform float weights[ n ]; 2941 uniform bool latitudinal; 2942 uniform float dTheta; 2943 uniform float mipInt; 2944 uniform vec3 poleAxis; 2945 2946 #define ENVMAP_TYPE_CUBE_UV 2947 #include <cube_uv_reflection_fragment> 2948 2949 vec3 getSample( float theta, vec3 axis ) { 2950 2951 float cosTheta = cos( theta ); 2952 // Rodrigues' axis-angle rotation 2953 vec3 sampleDirection = vOutputDirection * cosTheta 2954 + cross( axis, vOutputDirection ) * sin( theta ) 2955 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 2956 2957 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 2958 2959 } 2960 2961 void main() { 2962 2963 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 2964 2965 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 2966 2967 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 2968 2969 } 2970 2971 axis = normalize( axis ); 2972 2973 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 2974 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 2975 2976 for ( int i = 1; i < n; i++ ) { 2977 2978 if ( i >= samples ) { 2979 2980 break; 2981 2982 } 2983 2984 float theta = dTheta * float( i ); 2985 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 2986 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 2987 2988 } 2989 2990 } 2991 `,blending:Ri,depthTest:!1,depthWrite:!1})}function Ob(){return new Dt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:t1(),fragmentShader:` 2992 2993 precision mediump float; 2994 precision mediump int; 2995 2996 varying vec3 vOutputDirection; 2997 2998 uniform sampler2D envMap; 2999 3000 #include <common> 3001 3002 void main() { 3003 3004 vec3 outputDirection = normalize( vOutputDirection ); 3005 vec2 uv = equirectUv( outputDirection ); 3006
3007 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 3008 3009 } 3010 `,blending:Ri,depthTest:!1,depthWrite:!1})}function Ib(){return new Dt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:t1(),fragmentShader:` 3011 3012 precision mediump float; 3013 precision mediump int; 3014 3015 uniform float flipEnvMap; 3016 3017 varying vec3 vOutputDirection; 3018 3019 uniform samplerCube envMap; 3020 3021 void main() { 3022 3023 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 3024 3025 } 3026 `,blending:Ri,depthTest:!1,depthWrite:!1})}function t1(){return` 3027 3028 precision mediump float; 3029 precision mediump int; 3030 3031 attribute float faceIndex; 3032 3033 varying vec3 vOutputDirection; 3034 3035 // RH coordinate system; PMREM face-indexing convention 3036 vec3 getDirection( vec2 uv, float face ) { 3037 3038 uv = 2.0 * uv - 1.0; 3039 3040 vec3 direction = vec3( uv, 1.0 ); 3041 3042 if ( face == 0.0 ) { 3043 3044 direction = direction.zyx; // ( 1, v, u ) pos x 3045 3046 } else if ( face == 1.0 ) { 3047 3048 direction = direction.xzy; 3049 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 3050 3051 } else if ( face == 2.0 ) { 3052 3053 direction.x *= -1.0; // ( -u, v, 1 ) pos z 3054 3055 } else if ( face == 3.0 ) { 3056 3057 direction = direction.zyx; 3058 direction.xz *= -1.0; // ( -1, v, -u ) neg x 3059 3060 } else if ( face == 4.0 ) { 3061 3062 direction = direction.xzy; 3063 direction.xy *= -1.0; // ( -u, -1, v ) neg y 3064 3065 } else if ( face == 5.0 ) { 3066 3067 direction.z *= -1.0; // ( u, v, -1 ) neg z 3068 3069 } 3070 3071 return direction; 3072 3073 } 3074 3075 void main() { 3076 3077 vOutputDirection = getDirection( uv, faceIndex ); 3078 gl_Position = vec4( position, 1.0 ); 3079 3080 } 3081 `}function HR(e){let t=new WeakMap,i=null;function r(o){if(o&&o.isTexture){let l=o.mapping,h=l===jv||l===Hv,c=l===Jo||l===$o;if(h||c)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let u=t.get(o);return i===null&&(i=new Pb(e)),u=h?i.fromEquirectangular(o,u):i.fromCubemap(o,u),t.set(o,u),u.texture}else{if(t.has(o))return t.get(o).texture;{let u=o.image;if(h&&u&&u.height>0||c&&u&&s(u)){i===null&&(i=new Pb(e));let d=h?i.fromEquirectangular(o):i.fromCubemap(o);return t.set(o,d),o.addEventListener("dispose",a),d.texture}else return null}}}return o}function s(o){let l=0,h=6;for(let c=0;c<h;c++)o[c]!==void 0&&l++;return l===h}function a(o){let l=o.target;l.removeEventListener("dispose",a);let h=t.get(l);h!==void 0&&(t.delete(l),h.dispose())}function n(){t=new WeakMap,i!==null&&(i.dispose(),i=null)}return{get:r,dispose:n}}function GR(e){let t={};function i(r){if(t[r]!==void 0)return t[r];let s;switch(r){case"WEBGL_depth_texture":s=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=e.getExtension(r)}return t[r]=s,s}return{has:function(r){return i(r)!==null},init:function(r){r.isWebGL2?i("EXT_color_buffer_float"):(i("WEBGL_depth_texture"),i("OES_texture_float"),i("OES_texture_half_float"),i("OES_texture_half_float_linear"),i("OES_standard_derivatives"),i("OES_element_index_uint"),i("OES_vertex_array_object"),i("ANGLE_instanced_arrays")),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture")},get:function(r){let s=i(r);return s===null&&console.warn("THREE.WebGLRenderer: "+r+" extension not supported."),s}}}function WR(e,t,i,r){let s={},a=new WeakMap;function n(u){let d=u.target;d.index!==null&&t.remove(d.index);for(let f in d.attributes)t.remove(d.attributes[f]);d.removeEventListener("dispose",n),delete s[d.id];let p=a.get(d);
vendor: 15,488 bytes, lines 3081-3089
3081p&&(t.remove(p),a.delete(d)),r.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,i.memory.geometries--}function o(u,d){return s[d.id]===!0||(d.addEventListener("dispose",n),s[d.id]=!0,i.memory.geometries++),d}function l(u){let d=u.attributes;for(let f in d)t.update(d[f],34962);let p=u.morphAttributes;for(let f in p){let m=p[f];for(let g=0,v=m.length;g<v;g++)t.update(m[g],34962)}}function h(u){let d=[],p=u.index,f=u.attributes.position,m=0;if(p!==null){let y=p.array;m=p.version;for(let x=0,w=y.length;x<w;x+=3){let S=y[x+0],b=y[x+1],E=y[x+2];d.push(S,b,b,E,E,S)}}else{let y=f.array;m=f.version;for(let x=0,w=y.length/3-1;x<w;x+=3){let S=x+0,b=x+1,E=x+2;d.push(S,b,b,E,E,S)}}let g=new(hM(d)?lh:mM)(d,1);g.version=m;let v=a.get(u);v&&t.remove(v),a.set(u,g)}function c(u){let d=a.get(u);if(d){let p=u.index;p!==null&&d.version<p.version&&h(u)}else h(u);return a.get(u)}return{get:o,update:l,getWireframeAttribute:c}}function qR(e,t,i,r){let s=r.isWebGL2,a;function n(d){a=d}let o,l;function h(d){o=d.type,l=d.bytesPerElement}function c(d,p){e.drawElements(a,p,o,d*l),i.update(p,a,1)}function u(d,p,f){if(f===0)return;let m,g;if(s)m=e,g="drawElementsInstanced";else if(m=t.get("ANGLE_instanced_arrays"),g="drawElementsInstancedANGLE",m===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[g](a,p,o,d*l,f),i.update(p,a,f)}this.setMode=n,this.setIndex=h,this.render=c,this.renderInstances=u}function XR(e){let t={geometries:0,textures:0},i={frame:0,calls:0,triangles:0,points:0,lines:0};function r(a,n,o){switch(i.calls++,n){case 4:i.triangles+=o*(a/3);break;case 1:i.lines+=o*(a/2);break;case 3:i.lines+=o*(a-1);break;case 2:i.lines+=o*a;break;case 0:i.points+=o*a;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n);break}}function s(){i.frame++,i.calls=0,i.triangles=0,i.points=0,i.lines=0}return{memory:t,render:i,programs:null,autoReset:!0,reset:s,update:r}}function YR(e,t){return e[0]-t[0]}function QR(e,t){return Math.abs(t[1])-Math.abs(e[1])}function KR(e,t,i){let r={},s=new Float32Array(8),a=new WeakMap,n=new ot,o=[];for(let h=0;h<8;h++)o[h]=[h,0];function l(h,c,u,d){let p=h.morphTargetInfluences;if(t.isWebGL2===!0){let f=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,m=f!==void 0?f.length:0,g=a.get(c);if(g===void 0||g.count!==m){let x=function(){O.dispose(),a.delete(c),c.removeEventListener("dispose",x)};g!==void 0&&g.texture.dispose();let w=c.morphAttributes.position!==void 0,S=c.morphAttributes.normal!==void 0,b=c.morphAttributes.color!==void 0,E=c.morphAttributes.position||[],_=c.morphAttributes.normal||[],A=c.morphAttributes.color||[],C=0;w===!0&&(C=1),S===!0&&(C=2),b===!0&&(C=3);let T=c.attributes.position.count*C,I=1;T>t.maxTextureSize&&(I=Math.ceil(T/t.maxTextureSize),T=t.maxTextureSize);let P=new Float32Array(T*I*4*m),O=new pM(P,T,I,m);O.type=Ht,O.needsUpdate=!0;let k=C*4;for(let G=0;G<m;G++){let B=E[G],U=_[G],Q=A[G],q=T*I*4*G;for(let j=0;j<B.count;j++){let X=j*k;w===!0&&(n.fromBufferAttribute(B,j),P[q+X+0]=n.x,P[q+X+1]=n.y,P[q+X+2]=n.z,P[q+X+3]=0),S===!0&&(n.fromBufferAttribute(U,j),P[q+X+4]=n.x,P[q+X+5]=n.y,P[q+X+6]=n.z,P[q+X+7]=0),b===!0&&(n.fromBufferAttribute(Q,j),P[q+X+8]=n.x,P[q+X+9]=n.y,P[q+X+10]=n.z,P[q+X+11]=Q.itemSize===4?n.w:1)}}g={count:m,texture:O,size:new H(T,I)},a.set(c,g),c.addEventListener("dispose",x)}let v=0;for(let x=0;x<p.length;x++)v+=p[x];let y=c.morphTargetsRelative?1:1-v;d.getUniforms().setValue(e,"morphTargetBaseInfluence",y),d.getUniforms().setValue(e,"morphTargetInfluences",p),d.getUniforms().setValue(e,"morphTargetsTexture",g.texture,i),d.getUniforms().setValue(e,"morphTargetsTextureSize",g.size)}else{let f=p===void 0?0:p.length,m=r[c.id];if(m===void 0||m.length!==f){m=[];for(let w=0;w<f;w++)m[w]=[w,0];r[c.id]=m}for(let w=0;w<f;w++){let S=m[w];S[0]=w,S[1]=p[w]}m.sort(QR);for(let w=0;w<8;w++)w<f&&m[w][1]?(o[w][0]=m[w][0],o[w][1]=m[w][1]):(o[w][0]=Number.MAX_SAFE_INTEGER,o[w][1]=0);o.sort(YR);let g=c.morphAttributes.position,v=c.morphAttributes.normal,y=0;for(let w=0;w<8;w++){let S=o[w],b=S[0],E=S[1];b!==Number.MAX_SAFE_INTEGER&&E?(g&&c.getAttribute("morphTarget"+w)!==g[b]&&c.setAttribute("morphTarget"+w,g[b]),v&&c.getAttribute("morphNormal"+w)!==v[b]&&c.setAttribute("morphNormal"+w,v[b]),s[w]=E,y+=E):(g&&c.hasAttribute("morphTarget"+w)===!0&&c.deleteAttribute("morphTarget"+w),v&&c.hasAttribute("morphNormal"+w)===!0&&c.deleteAttribute("morphNormal"+w),s[w]=0)}let x=c.morphTargetsRelative?1:1-y;d.getUniforms().setValue(e,"morphTargetBaseInfluence",x),d.getUniforms().setValue(e,"morphTargetInfluences",s)}}return{update:l}}function ZR(e,t,i,r){let s=new WeakMap;function a(l){let h=r.render.frame,c=l.geometry,u=t.get(l,c);return s.get(u)!==h&&(t.update(u),s.set(u,h)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),i.update(l.instanceMatrix,34962),l.instanceColor!==null&&i.update(l.instanceColor,34962)),u}function n(){s=new WeakMap}function o(l){let h=l.target;h.removeEventListener("dispose",o),i.remove(h.instanceMatrix),h.instanceColor!==null&&i.remove(h.instanceColor)}return{update:a,dispose:n}}var yM=new li,xM=new pM,bM=new k3,wM=new $y,Rb=[],Lb=[],zb=new Float32Array(16),Bb=new Float32Array(9),Fb=new Float32Array(4);function jh(e,t,i){let r=e[0];if(r==null||r<=0||r>0)return e;let s=t*i,a=Rb[s];if(a===void 0&&(a=new Float32Array(s),Rb[s]=a),t!==0){r.toArray(a,0);for(let n=1,o=0;n!==t;++n)o+=i,e[n].toArray(a,o)}return a}function Xi(e,t){if(e.length!==t.length)return!1;for(let i=0,r=e.length;i<r;i++)if(e[i]!==t[i])return!1;return!0}function Yi(e,t){for(let i=0,r=t.length;i<r;i++)e[i]=t[i]}function em(e,t){let i=Lb[t];i===void 0&&(i=new Int32Array(t),Lb[t]=i);for(let r=0;r!==t;++r)i[r]=e.allocateTextureUnit();return i}function JR(e,t){let i=this.cache;i[0]!==t&&(e.uniform1f(this.addr,t),i[0]=t)}function $R(e,t){let i=this.cache;if(t.x!==void 0)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(Xi(i,t))return;e.uniform2fv(this.addr,t),Yi(i,t)}}function eL(e,t){let i=this.cache;if(t.x!==void 0)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else if(t.r!==void 0)(i[0]!==t.r||i[1]!==t.g||i[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),i[0]=t.r,i[1]=t.g,i[2]=t.b);else{if(Xi(i,t))return;e.uniform3fv(this.addr,t),Yi(i,t)}}function tL(e,t){let i=this.cache;if(t.x!==void 0)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(Xi(i,t))return;e.uniform4fv(this.addr,t),Yi(i,t)}}function iL(e,t){let i=this.cache,r=t.elements;if(r===void 0){if(Xi(i,t))return;e.uniformMatrix2fv(this.addr,!1,t),Yi(i,t)}else{if(Xi(i,r))return;Fb.set(r),e.uniformMatrix2fv(this.addr,!1,Fb),Yi(i,r)}}function rL(e,t){let i=this.cache,r=t.elements;if(r===void 0){if(Xi(i,t))return;e.uniformMatrix3fv(this.addr,!1,t),Yi(i,t)}else{if(Xi(i,r))return;Bb.set(r),e.uniformMatrix3fv(this.addr,!1,Bb),Yi(i,r)}}function sL(e,t){let i=this.cache,r=t.elements;if(r===void 0){if(Xi(i,t))return;e.uniformMatrix4fv(this.addr,!1,t),Yi(i,t)}else{if(Xi(i,r))return;zb.set(r),e.uniformMatrix4fv(this.addr,!1,zb),Yi(i,r)}}function aL(e,t){let i=this.cache;i[0]!==t&&(e.uniform1i(this.addr,t),i[0]=t)}function nL(e,t){let i=this.cache;if(t.x!==void 0)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(Xi(i,t))return;e.uniform2iv(this.addr,t),Yi(i,t)}}function oL(e,t){let i=this.cache;if(t.x!==void 0)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(Xi(i,t))return;e.uniform3iv(this.addr,t),Yi(i,t)}}function lL(e,t){let i=this.cache;if(t.x!==void 0)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(Xi(i,t))return;e.uniform4iv(this.addr,t),Yi(i,t)}}function hL(e,t){let i=this.cache;i[0]!==t&&(e.uniform1ui(this.addr,t),i[0]=t)}function cL(e,t){let i=this.cache;if(t.x!==void 0)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(Xi(i,t))return;e.uniform2uiv(this.addr,t),Yi(i,t)}}function uL(e,t){let i=this.cache;if(t.x!==void 0)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(Xi(i,t))return;e.uniform3uiv(this.addr,t),Yi(i,t)}}function dL(e,t){let i=this.cache;if(t.x!==void 0)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(Xi(i,t))return;e.uniform4uiv(this.addr,t),Yi(i,t)}}function pL(e,t,i){let r=this.cache,s=i.allocateTextureUnit();r[0]!==s&&(e.uniform1i(this.addr,s),r[0]=s),i.setTexture2D(t||yM,s)}function fL(e,t,i){let r=this.cache,s=i.allocateTextureUnit();r[0]!==s&&(e.uniform1i(this.addr,s),r[0]=s),i.setTexture3D(t||bM,s)}function mL(e,t,i){let r=this.cache,s=i.allocateTextureUnit();r[0]!==s&&(e.uniform1i(this.addr,s),r[0]=s),i.setTextureCube(t||wM,s)}function gL(e,t,i){let r=this.cache,s=i.allocateTextureUnit();r[0]!==s&&(e.uniform1i(this.addr,s),r[0]=s),i.setTexture2DArray(t||xM,s)}function vL(e){switch(e){case 5126:return JR;case 35664:return $R;case 35665:return eL;case 35666:return tL;case 35674:return iL;case 35675:return rL;case 35676:return sL;case 5124:case 35670:return aL;case 35667:case 35671:return nL;case 35668:case 35672:return oL;case 35669:case 35673:return lL;case 5125:return hL;case 36294:return cL;case 36295:return uL;case 36296:return dL;case 35678:case 36198:case 36298:case 36306:case 35682:return pL;case 35679:case 36299:case 36307:return fL;case 35680:case 36300:case 36308:case 36293:return mL;case 36289:case 36303:case 36311:case 36292:return gL}}function yL(e,t){e.uniform1fv(this.addr,t)}function xL(e,t){let i=jh(t,this.size,2);e.uniform2fv(this.addr,i)}function bL(e,t){let i=jh(t,this.size,3);e.uniform3fv(this.addr,i)}function wL(e,t){let i=jh(t,this.size,4);e.uniform4fv(this.addr,i)}function SL(e,t){let i=jh(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,i)}function _L(e,t){let i=jh(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,i)}function AL(e,t){let i=jh(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,i)}function ML(e,t){e.uniform1iv(this.addr,t)}function EL(e,t){e.uniform2iv(this.addr,t)}function CL(e,t){e.uniform3iv(this.addr,t)}function TL(e,t){e.uniform4iv(this.addr,t)}function PL(e,t){e.uniform1uiv(this.addr,t)}function DL(e,t){e.uniform2uiv(this.addr,t)}function OL(e,t){e.uniform3uiv(this.addr,t)}function IL(e,t){e.uniform4uiv(this.addr,t)}function RL(e,t,i){let r=this.cache,s=t.length,a=em(i,s);Xi(r,a)||(e.uniform1iv(this.addr,a),Yi(r,a));for(let n=0;n!==s;++n)i.setTexture2D(t[n]||yM,a[n])}function LL(e,t,i){let r=this.cache,s=t.length,a=em(i,s);Xi(r,a)||(e.uniform1iv(this.addr,a),Yi(r,a));for(let n=0;n!==s;++n)i.setTexture3D(t[n]||bM,a[n])}function zL(e,t,i){let r=this.cache,s=t.length,a=em(i,s);Xi(r,a)||(e.uniform1iv(this.addr,a),Yi(r,a));for(let n=0;n!==s;++n)i.setTextureCube(t[n]||wM,a[n])}function BL(e,t,i){let r=this.cache,s=t.length,a=em(i,s);Xi(r,a)||(e.uniform1iv(this.addr,a),Yi(r,a));for(let n=0;n!==s;++n)i.setTexture2DArray(t[n]||xM,a[n])}function FL(e){switch(e){case 5126:return yL;case 35664:return xL;case 35665:return bL;case 35666:return wL;case 35674:return SL;case 35675:return _L;case 35676:return AL;case 5124:case 35670:return ML;case 35667:case 35671:return EL;case 35668:case 35672:return CL;case 35669:case 35673:return TL;case 5125:return PL;case 36294:return DL;case 36295:return OL;case 36296:return IL;case 35678:case 36198:case 36298:case 36306:case 35682:return RL;case 35679:case 36299:case 36307:return LL;case 35680:case 36300:case 36308:case 36293:return zL;case 36289:case 36303:case 36311:case 36292:return BL}}var kL=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.setValue=vL(t.type)}},UL=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.size=t.size,this.setValue=FL(t.type)}},NL=class{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){if(t===void 0)return;let r=this.seq;for(let s=0,a=r.length;s!==a;++s){let n=r[s];n.setValue(e,t[n.id],i)}}},hg=/(\w+)(\])?(\[|\.)?/g;function kb(e,t){e.seq.push(t),e.map[t.id]=t}function VL(e,t,i){let r=e.name,s=r.length;for(hg.lastIndex=0;;){let a=hg.exec(r),n=hg.lastIndex,o=a[1],l=a[2]==="]",h=a[3];if(l&&(o=o|0),h===void 0||h==="["&&n+2===s){kb(i,h===void 0?new kL(o,e,t):new UL(o,e,t));break}else{let c=i.map[o];c===void 0&&(c=new NL(o),kb(i,c)),i=c}}}var Cp=class{constructor(e,t){this.seq=[],this.map={};let i=e.getProgramParameter(t,35718);for(let r=0;r<i;++r){let s=e.getActiveUniform(t,r),a=e.getUniformLocation(t,s.name);VL(s,a,this)}}setValue(e,t,i,r){let s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){let r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,a=t.length;s!==a;++s){let n=t[s],o=i[n.id];o.needsUpdate!==!1&&n.setValue(e,o.value,r)}}static seqWithValue(e,t){let i=[];for(let r=0,s=e.length;r!==s;++r){let a=e[r];a.id in t&&i.push(a)}return i}};function Ub(e,t,i){let r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),r}var jL=0;function HL(e,t){let i=e.split(` 3082`),r=[],s=Math.max(t-6,0),a=Math.min(t+6,i.length);for(let n=s;n<a;n++){let o=n+1;r.push(`${o===t?">":" "} ${o}: ${i[n]}`)}return r.join(` 3083`)}function GL(e){switch(e){case js:return["Linear","( value )"];case gt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}function Nb(e,t,i){let r=e.getShaderParameter(t,35713),s=e.getShaderInfoLog(t).trim();if(r&&s==="")return"";let a=/ERROR: 0:(\d+)/.exec(s);if(a){let n=parseInt(a[1]);return i.toUpperCase()+` 3084 3085`+s+` 3086 3087`+HL(e.getShaderSource(t),n)}else return s}function WL(e,t){let i=GL(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function qL(e,t){let i;switch(t){case $D:i="Linear";break;case e3:i="Reinhard";break;case t3:i="OptimizedCineon";break;case i3:i="ACESFilmic";break;case r3:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),i="Linear"}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function XL(e){return[e.extensionDerivatives||e.envMapCubeUVHeight||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||e.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap||e.transmission)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(kc).join(` 3088`)}function YL(e){let t=[];for(let i in e){let r=e[i];r!==!1&&t.push("#define "+i+" "+r)}return t.join(` 3089`)}function QL(e,t){let i={},r=e.getProgramParameter(t,35721);for(let s=0;s<r;s++){let a=e.getActiveAttrib(t,s),n=a.name,o=1;a.type===35674&&(o=2),a.type===35675&&(o=3),a.type===35676&&(o=4),i[n]={type:a.type,location:e.getAttribLocation(t,n),locationSize:o}}return i}function kc(e){return e!==""}function Vb(e,t){let i=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_L
vendor: 7,498 bytes, lines 3089-3100
3089IGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function jb(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var KL=/^[ \t]*#include +<([\w\d./]+)>/gm;function Qv(e){return e.replace(KL,ZL)}function ZL(e,t){let i=yt[t];if(i===void 0)throw new Error("Can not resolve #include <"+t+">");return Qv(i)}var JL=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Hb(e){return e.replace(JL,$L)}function $L(e,t,i,r){let s="";for(let a=parseInt(t);a<parseInt(i);a++)s+=r.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return s}function Gb(e){let t="precision "+e.precision+` float; 3090precision `+e.precision+" int;";return e.precision==="highp"?t+=` 3091#define HIGH_PRECISION`:e.precision==="mediump"?t+=` 3092#define MEDIUM_PRECISION`:e.precision==="lowp"&&(t+=` 3093#define LOW_PRECISION`),t}function ez(e){let t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===Yy?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===OD?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===Fc&&(t="SHADOWMAP_TYPE_VSM"),t}function tz(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case Jo:case $o:t="ENVMAP_TYPE_CUBE";break;case Lu:t="ENVMAP_TYPE_CUBE_UV";break}return t}function iz(e){let t="ENVMAP_MODE_REFLECTION";return e.envMap&&e.envMapMode===$o&&(t="ENVMAP_MODE_REFRACTION"),t}function rz(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case tM:t="ENVMAP_BLENDING_MULTIPLY";break;case ZD:t="ENVMAP_BLENDING_MIX";break;case JD:t="ENVMAP_BLENDING_ADD";break}return t}function sz(e){let t=e.envMapCubeUVHeight;if(t===null)return null;let i=Math.log2(t)-2,r=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:r,maxMip:i}}function az(e,t,i,r){let s=e.getContext(),a=i.defines,n=i.vertexShader,o=i.fragmentShader,l=ez(i),h=tz(i),c=iz(i),u=rz(i),d=sz(i),p=i.isWebGL2?"":XL(i),f=YL(a),m=s.createProgram(),g,v,y=i.glslVersion?"#version "+i.glslVersion+` 3094`:"";i.isRawShaderMaterial?(g=[f].filter(kc).join(` 3095`),g.length>0&&(g+=` 3096`),v=[p,f].filter(kc).join(` 3097`),v.length>0&&(v+=` 3098`)):(g=[Gb(i),"#define SHADER_NAME "+i.shaderName,f,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.supportsVertexTextures?"#define VERTEX_TEXTURES":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+c:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.displacementMap&&i.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&i.flatShading===!1?"#define USE_MORPHNORMALS":"",i.morphColors&&i.isWebGL2?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` 3099`].filter(kc).join(` 3100`),v=[p,Gb(i),"#define SHADER_NAME "+i.shaderName,f,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+h:"",i.envMap?"#define "+c:"",i.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMap&&i.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",i.normalMap&&i.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescence?"#define USE_IR
3100IDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",i.specularColorMap?"#define USE_SPECULARCOLORMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEENCOLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs?"#define USE_UV":"",i.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",i.toneMapping!==ya?"#define TONE_MAPPING":"",i.toneMapping!==ya?yt.tonemapping_pars_fragment:"",i.toneMapping!==ya?qL("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",yt.encodings_pars_fragment,WL("linearToOutputTexel",i.outputEncoding),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"",` 3101`].filter(kc).join(` 3102`)),n=Qv(n),n=Vb(n,i),n=jb(n,i),o=Qv(o),o=Vb(o,i),o=jb(o,i),n=Hb(n),o=Hb(o),i.isWebGL2&&i.isRawShaderMaterial!==!0&&(y=`#version 300 es 3103`,g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` 3104`)+` 3105`+g,v=["#define varying in",i.glslVersion===qv?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===qv?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` 3106`)+` 3107`+v);let x=y+g+n,w=y+v+o,S=Ub(s,35633,x),b=Ub(s,35632,w);if(s.attachShader(m,S),s.attachShader(m,b),i.index0AttributeName!==void 0?s.bindAttribLocation(m,0,i.index0AttributeName):i.morphTargets===!0&&s.bindAttribLocation(m,0,"position"),s.linkProgram(m),e.debug.checkShaderErrors){let A=s.getProgramInfoLog(m).trim(),C=s.getShaderInfoLog(S).trim(),T=s.getShaderInfoLog(b).trim(),I=!0,P=!0;if(s.getProgramParameter(m,35714)===!1){I=!1;let O=Nb(s,S,"vertex"),k=Nb(s,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(m,35715)+` 3108 3109Program Info Log: `+A+` 3110`+O+` 3111`+k)}else A!==""?console.warn("THREE.WebGLProgram: Program Info Log:",A):(C===""||T==="")&&(P=!1);P&&(this.diagnostics={runnable:I,programLog:A,vertexShader:{log:C,prefix:g},fragmentShader:{log:T,prefix:v}})}s.deleteShader(S),s.deleteShader(b);let E;this.getUniforms=function(){return E===void 0&&(E=new Cp(s,m)),E};let _;return this.getAttributes=function(){return _===void 0&&(_=QL(s,m)),_},this.destroy=function(){r.releaseStatesOfProgram(this),s.deleteProgram(m),this.program=void 0},this.name=i.shaderName,this.id=jL++,this.cacheKey=t,this.usedTimes=1,this.program=m,this.vertexShader=S,this.fragmentShader=b,this}var nz=0,oz=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return i===void 0&&(i=new lz(e),t.set(e,i)),i}},lz=class{constructor(e){this.id=nz++,this.code=e,this.usedTimes=0}};function hz(e,t,i,r,s,a,n){let o=new Jy,l=new oz,h=[],c=s.isWebG
3111L2,u=s.logarithmicDepthBuffer,d=s.vertexTextures,p=s.precision,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(_,A,C,T,I){let P=T.fog,O=I.geometry,k=_.isMeshStandardMaterial?T.environment:null,G=(_.isMeshStandardMaterial?i:t).get(_.envMap||k),B=G&&G.mapping===Lu?G.image.height:null,U=f[_.type];_.precision!==null&&(p=s.getMaxPrecision(_.precision),p!==_.precision&&console.warn("THREE.WebGLProgram.getParameters:",_.precision,"not supported, using",p,"instead."));let Q=O.morphAttributes.position||O.morphAttributes.normal||O.morphAttributes.color,q=Q!==void 0?Q.length:0,j=0;O.morphAttributes.position!==void 0&&(j=1),O.morphAttributes.normal!==void 0&&(j=2),O.morphAttributes.color!==void 0&&(j=3);let X,te,K,Z;if(U){let ie=ha[U];X=ie.vertexShader,te=ie.fragmentShader}else X=_.vertexShader,te=_.fragmentShader,l.update(_),K=l.getVertexShaderID(_),Z=l.getFragmentShaderID(_);let W=e.getRenderTarget(),re=_.alphaTest>0,$=_.clearcoat>0,ne=_.iridescence>0;return{isWebGL2:c,shaderID:U,shaderName:_.type,vertexShader:X,fragmentShader:te,defines:_.defines,customVertexShaderID:K,customFragmentShaderID:Z,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:p,instancing:I.isInstancedMesh===!0,instancingColor:I.isInstancedMesh===!0&&I.instanceColor!==null,supportsVertexTextures:d,outputEncoding:W===null?e.outputEncoding:W.isXRRenderTarget===!0?W.texture.encoding:js,map:!!_.map,matcap:!!_.matcap,envMap:!!G,envMapMode:G&&G.mapping,envMapCubeUVHeight:B,lightMap:!!_.lightMap,aoMap:!!_.aoMap,emissiveMap:!!_.emissiveMap,bumpMap:!!_.bumpMap,normalMap:!!_.normalMap,objectSpaceNormalMap:_.normalMapType===x3,tangentSpaceNormalMap:_.normalMapType===y3,decodeVideoTexture:!!_.map&&_.map.isVideoTexture===!0&&_.map.encoding===gt,clearcoat:$,clearcoatMap:$&&!!_.clearcoatMap,clearcoatRoughnessMap:$&&!!_.clearcoatRoughnessMap,clearcoatNormalMap:$&&!!_.clearcoatNormalMap,iridescence:ne,iridescenceMap:ne&&!!_.iridescenceMap,iridescenceThicknessMap:ne&&!!_.iridescenceThicknessMap,displacementMap:!!_.displacementMap,roughnessMap:!!_.roughnessMap,metalnessMap:!!_.metalnessMap,specularMap:!!_.specularMap,specularIntensityMap:!!_.specularIntensityMap,specularColorMap:!!_.specularColorMap,opaque:_.transparent===!1&&_.blending===Wo,alphaMap:!!_.alphaMap,alphaTest:re,gradientMap:!!_.gradientMap,sheen:_.sheen>0,sheenColorMap:!!_.sheenColorMap,sheenRoughnessMap:!!_.sheenRoughnessMap,transmission:_.transmission>0,transmissionMap:!!_.transmissionMap,thicknessMap:!!_.thicknessMap,combine:_.combine,vertexTangents:!!_.normalMap&&!!O.attributes.tangent,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!O.attributes.color&&O.attributes.color.itemSize===4,vertexUvs:!!_.map||!!_.bumpMap||!!_.normalMap||!!_.specularMap||!!_.alphaMap||!!_.emissiveMap||!!_.roughnessMap||!!_.metalnessMap||!!_.clearcoatMap||!!_.clearcoatRoughnessMap||!!_.clearcoatNormalMap||!!_.iridescenceMap||!!_.iridescenceThicknessMap||!!_.displacementMap||!!_.transmissionMap||!!_.thicknessMap||!!_.specularIntensityMap||!!_.specularColorMap||!!_.sheenColorMap||!!_.sheenRoughnessMap,uvsVertexOnly:!(_.map||_.bumpMap||_.normalMap||_.specularMap||_.alphaMap||_.emissiveMap||_.roughnessMap||_.metalnessMap||_.clearcoatNormalMap||_.iridescenceMap||_.iridescenceThicknessMap||_.transmission>0||_.transmissionMap||_.thicknessMap||_.specularIntensityMap||_.specularColorMap||_.sheen>0||_.sheenColorMap||_.sheenRoughnessMap)&&!!_.displacementMap,fog:!!P,useFog:_.fog===!0,fogExp2:P&&P.isFogExp2,flatShading:!!_.flatShading,sizeAttenuation:_.sizeAttenuation,logarithmicDepthBuffer:u,skinning:I.isSkinnedMesh===!0,morphTargets:O.morphAttributes.position!==void 0,morphNormals:O.morphAttributes.normal!==void 0,morphColors:O.morphAttributes.color!==void 0,morphTargetsCount:q,morphTextureStride:j,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numSpotLightMaps:A.spotLightMap.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numSpotLightShadowsWithMaps:A.numSpotLightShadowsWithMaps,numClippingPlanes:n.numPlanes,numClipIntersection:n.numIntersection,dithering:_.dithering,shadowMapEnabled:e.shadowMap.enabled&&C.length>0,shadowMapType:e.shadowMap.type,toneMapping:_.toneMapped?e.toneMapping:ya,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===Ar,flipSided:_.side===sr,useDepthPacking:!!_.depthPacking,depthPacking:_.depthPacking||0,index0AttributeName:_.index0AttributeName,extensionDerivatives:_.extensions&&_.extensions.derivatives,extensionFragDepth:_.extensions&&_.extensions.fragDepth,extensionDrawBuffers:_.extensions&&_.extensions.drawBuffers,extensionShaderTextureLOD:_.extensions&&_.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||r.has("EXT_shader_texture_lod"),customProgramCacheKey:_.customProgramCacheKey()}}function g(_){let A=[];
vendor: 13,036 bytes, lines 3111-3117
3111if(_.shaderID?A.push(_.shaderID):(A.push(_.customVertexShaderID),A.push(_.customFragmentShaderID)),_.defines!==void 0)for(let C in _.defines)A.push(C),A.push(_.defines[C]);return _.isRawShaderMaterial===!1&&(v(A,_),y(A,_),A.push(e.outputEncoding)),A.push(_.customProgramCacheKey),A.join()}function v(_,A){_.push(A.precision),_.push(A.outputEncoding),_.push(A.envMapMode),_.push(A.envMapCubeUVHeight),_.push(A.combine),_.push(A.vertexUvs),_.push(A.fogExp2),_.push(A.sizeAttenuation),_.push(A.morphTargetsCount),_.push(A.morphAttributeCount),_.push(A.numDirLights),_.push(A.numPointLights),_.push(A.numSpotLights),_.push(A.numSpotLightMaps),_.push(A.numHemiLights),_.push(A.numRectAreaLights),_.push(A.numDirLightShadows),_.push(A.numPointLightShadows),_.push(A.numSpotLightShadows),_.push(A.numSpotLightShadowsWithMaps),_.push(A.shadowMapType),_.push(A.toneMapping),_.push(A.numClippingPlanes),_.push(A.numClipIntersection),_.push(A.depthPacking)}function y(_,A){o.disableAll(),A.isWebGL2&&o.enable(0),A.supportsVertexTextures&&o.enable(1),A.instancing&&o.enable(2),A.instancingColor&&o.enable(3),A.map&&o.enable(4),A.matcap&&o.enable(5),A.envMap&&o.enable(6),A.lightMap&&o.enable(7),A.aoMap&&o.enable(8),A.emissiveMap&&o.enable(9),A.bumpMap&&o.enable(10),A.normalMap&&o.enable(11),A.objectSpaceNormalMap&&o.enable(12),A.tangentSpaceNormalMap&&o.enable(13),A.clearcoat&&o.enable(14),A.clearcoatMap&&o.enable(15),A.clearcoatRoughnessMap&&o.enable(16),A.clearcoatNormalMap&&o.enable(17),A.iridescence&&o.enable(18),A.iridescenceMap&&o.enable(19),A.iridescenceThicknessMap&&o.enable(20),A.displacementMap&&o.enable(21),A.specularMap&&o.enable(22),A.roughnessMap&&o.enable(23),A.metalnessMap&&o.enable(24),A.gradientMap&&o.enable(25),A.alphaMap&&o.enable(26),A.alphaTest&&o.enable(27),A.vertexColors&&o.enable(28),A.vertexAlphas&&o.enable(29),A.vertexUvs&&o.enable(30),A.vertexTangents&&o.enable(31),A.uvsVertexOnly&&o.enable(32),_.push(o.mask),o.disableAll(),A.fog&&o.enable(0),A.useFog&&o.enable(1),A.flatShading&&o.enable(2),A.logarithmicDepthBuffer&&o.enable(3),A.skinning&&o.enable(4),A.morphTargets&&o.enable(5),A.morphNormals&&o.enable(6),A.morphColors&&o.enable(7),A.premultipliedAlpha&&o.enable(8),A.shadowMapEnabled&&o.enable(9),A.physicallyCorrectLights&&o.enable(10),A.doubleSided&&o.enable(11),A.flipSided&&o.enable(12),A.useDepthPacking&&o.enable(13),A.dithering&&o.enable(14),A.specularIntensityMap&&o.enable(15),A.specularColorMap&&o.enable(16),A.transmission&&o.enable(17),A.transmissionMap&&o.enable(18),A.thicknessMap&&o.enable(19),A.sheen&&o.enable(20),A.sheenColorMap&&o.enable(21),A.sheenRoughnessMap&&o.enable(22),A.decodeVideoTexture&&o.enable(23),A.opaque&&o.enable(24),_.push(o.mask)}function x(_){let A=f[_.type],C;if(A){let T=ha[A];C=Vh.clone(T.uniforms)}else C=_.uniforms;return C}function w(_,A){let C;for(let T=0,I=h.length;T<I;T++){let P=h[T];if(P.cacheKey===A){C=P,++C.usedTimes;break}}return C===void 0&&(C=new az(e,A,_,a),h.push(C)),C}function S(_){if(--_.usedTimes===0){let A=h.indexOf(_);h[A]=h[h.length-1],h.pop(),_.destroy()}}function b(_){l.remove(_)}function E(){l.dispose()}return{getParameters:m,getProgramCacheKey:g,getUniforms:x,acquireProgram:w,releaseProgram:S,releaseShaderCache:b,programs:h,dispose:E}}function cz(){let e=new WeakMap;function t(a){let n=e.get(a);return n===void 0&&(n={},e.set(a,n)),n}function i(a){e.delete(a)}function r(a,n,o){e.get(a)[n]=o}function s(){e=new WeakMap}return{get:t,remove:i,update:r,dispose:s}}function uz(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function Wb(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 qb(){let e=[],t=0,i=[],r=[],s=[];function a(){t=0,i.length=0,r.length=0,s.length=0}function n(u,d,p,f,m,g){let v=e[t];return v===void 0?(v={id:u.id,object:u,geometry:d,material:p,groupOrder:f,renderOrder:u.renderOrder,z:m,group:g},e[t]=v):(v.id=u.id,v.object=u,v.geometry=d,v.material=p,v.groupOrder=f,v.renderOrder=u.renderOrder,v.z=m,v.group=g),t++,v}function o(u,d,p,f,m,g){let v=n(u,d,p,f,m,g);p.transmission>0?r.push(v):p.transparent===!0?s.push(v):i.push(v)}function l(u,d,p,f,m,g){let v=n(u,d,p,f,m,g);p.transmission>0?r.unshift(v):p.transparent===!0?s.unshift(v):i.unshift(v)}function h(u,d){i.length>1&&i.sort(u||uz),r.length>1&&r.sort(d||Wb),s.length>1&&s.sort(d||Wb)}function c(){for(let u=t,d=e.length;u<d;u++){let p=e[u];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:i,transmissive:r,transparent:s,init:a,push:o,unshift:l,finish:c,sort:h}}function dz(){let e=new WeakMap;function t(r,s){let a=e.get(r),n;return a===void 0?(n=new qb,e.set(r,[n])):s>=a.length?(n=new qb,a.push(n)):n=a[s],n}function i(){e=new WeakMap}return{get:t,dispose:i}}function pz(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let i;switch(t.type){case"DirectionalLight":i={direction:new M,color:new Je};break;case"SpotLight":i={position:new M,direction:new M,color:new Je,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new M,color:new Je,distance:0,decay:0};break;case"HemisphereLight":i={direction:new M,skyColor:new Je,groundColor:new Je};break;case"RectAreaLight":i={color:new Je,position:new M,halfWidth:new M,halfHeight:new M};break}return e[t.id]=i,i}}}function fz(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let i;switch(t.type){case"DirectionalLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new H};break;case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new H};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new H,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=i,i}}}var mz=0;function gz(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function vz(e,t){let i=new pz,r=fz(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let c=0;c<9;c++)s.probe.push(new M);let a=new M,n=new xe,o=new xe;function l(c,u){let d=0,p=0,f=0;for(let T=0;T<9;T++)s.probe[T].set(0,0,0);let m=0,g=0,v=0,y=0,x=0,w=0,S=0,b=0,E=0,_=0;c.sort(gz);let A=u!==!0?Math.PI:1;for(let T=0,I=c.length;T<I;T++){let P=c[T],O=P.color,k=P.intensity,G=P.distance,B=P.shadow&&P.shadow.map?P.shadow.map.texture:null;if(P.isAmbientLight)d+=O.r*k*A,p+=O.g*k*A,f+=O.b*k*A;else if(P.isLightProbe)for(let U=0;U<9;U++)s.probe[U].addScaledVector(P.sh.coefficients[U],k);else if(P.isDirectionalLight){let U=i.get(P);if(U.color.copy(P.color).multiplyScalar(P.intensity*A),P.castShadow){let Q=P.shadow,q=r.get(P);q.shadowBias=Q.bias,q.shadowNormalBias=Q.normalBias,q.shadowRadius=Q.radius,q.shadowMapSize=Q.mapSize,s.directionalShadow[m]=q,s.directionalShadowMap[m]=B,s.directionalShadowMatrix[m]=P.shadow.matrix,w++}s.directional[m]=U,m++}else if(P.isSpotLight){let U=i.get(P);U.position.setFromMatrixPosition(P.matrixWorld),U.color.copy(O).multiplyScalar(k*A),U.distance=G,U.coneCos=Math.cos(P.angle),U.penumbraCos=Math.cos(P.angle*(1-P.penumbra)),U.decay=P.decay,s.spot[v]=U;let Q=P.shadow;if(P.map&&(s.spotLightMap[E]=P.map,E++,Q.updateMatrices(P),P.castShadow&&_++),s.spotLightMatrix[v]=Q.matrix,P.castShadow){let q=r.get(P);q.shadowBias=Q.bias,q.shadowNormalBias=Q.normalBias,q.shadowRadius=Q.radius,q.shadowMapSize=Q.mapSize,s.spotShadow[v]=q,s.spotShadowMap[v]=B,b++}v++}else if(P.isRectAreaLight){let U=i.get(P);U.color.copy(O).multiplyScalar(k),U.halfWidth.set(P.width*.5,0,0),U.halfHeight.set(0,P.height*.5,0),s.rectArea[y]=U,y++}else if(P.isPointLight){let U=i.get(P);if(U.color.copy(P.color).multiplyScalar(P.intensity*A),U.distance=P.distance,U.decay=P.decay,P.castShadow){let Q=P.shadow,q=r.get(P);q.shadowBias=Q.bias,q.shadowNormalBias=Q.normalBias,q.shadowRadius=Q.radius,q.shadowMapSize=Q.mapSize,q.shadowCameraNear=Q.camera.near,q.shadowCameraFar=Q.camera.far,s.pointShadow[g]=q,s.pointShadowMap[g]=B,s.pointShadowMatrix[g]=P.shadow.matrix,S++}s.point[g]=U,g++}else if(P.isHemisphereLight){let U=i.get(P);U.skyColor.copy(P.color).multiplyScalar(k*A),U.groundColor.copy(P.groundColor).multiplyScalar(k*A),s.hemi[x]=U,x++}}y>0&&(t.isWebGL2||e.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Ce.LTC_FLOAT_1,s.rectAreaLTC2=Ce.LTC_FLOAT_2):e.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=Ce.LTC_HALF_1,s.rectAreaLTC2=Ce.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=d,s.ambient[1]=p,s.ambient[2]=f;let C=s.hash;(C.directionalLength!==m||C.pointLength!==g||C.spotLength!==v||C.rectAreaLength!==y||C.hemiLength!==x||C.numDirectionalShadows!==w||C.numPointShadows!==S||C.numSpotShadows!==b||C.numSpotMaps!==E)&&(s.directional.length=m,s.spot.length=v,s.rectArea.length=y,s.point.length=g,s.hemi.length=x,s.directionalShadow.length=w,s.directionalShadowMap.length=w,s.pointShadow.length=S,s.pointShadowMap.length=S,s.spotShadow.length=b,s.spotShadowMap.length=b,s.directionalShadowMatrix.length=w,s.pointShadowMatrix.length=S,s.spotLightMatrix.length=b+E-_,s.spotLightMap.length=E,s.numSpotLightShadowsWithMaps=_,C.directionalLength=m,C.pointLength=g,C.spotLength=v,C.rectAreaLength=y,C.hemiLength=x,C.numDirectionalShadows=w,C.numPointShadows=S,C.numSpotShadows=b,C.numSpotMaps=E,s.version=mz++)}function h(c,u){let d=0,p=0,f=0,m=0,g=0,v=u.matrixWorldInverse;for(let y=0,x=c.length;y<x;y++){let w=c[y];if(w.isDirectionalLight){let S=s.directional[d];S.direction.setFromMatrixPosition(w.matrixWorld),a.setFromMatrixPosition(w.target.matrixWorld),S.direction.sub(a),S.direction.transformDirection(v),d++}else if(w.isSpotLight){let S=s.spot[f];S.position.setFromMatrixPosition(w.matrixWorld),S.position.applyMatrix4(v),S.direction.setFromMatrixPosition(w.matrixWorld),a.setFromMatrixPosition(w.target.matrixWorld),S.direction.sub(a),S.direction.transformDirection(v),f++}else if(w.isRectAreaLight){let S=s.rectArea[m];S.position.setFromMatrixPosition(w.matrixWorld),S.position.applyMatrix4(v),o.identity(),n.copy(w.matrixWorld),n.premultiply(v),o.extractRotation(n),S.halfWidth.set(w.width*.5,0,0),S.halfHeight.set(0,w.height*.5,0),S.halfWidth.applyMatrix4(o),S.halfHeight.applyMatrix4(o),m++}else if(w.isPointLight){let S=s.point[p];S.position.setFromMatrixPosition(w.matrixWorld),S.position.applyMatrix4(v),p++}else if(w.isHemisphereLight){let S=s.hemi[g];S.direction.setFromMatrixPosition(w.matrixWorld),S.direction.transformDirection(v),g++}}}return{setup:l,setupView:h,state:s}}function Xb(e,t){let i=new vz(e,t),r=[],s=[];function a(){r.length=0,s.length=0}function n(c){r.push(c)}function o(c){s.push(c)}function l(c){i.setup(r,c)}function h(c){i.setupView(r,c)}return{init:a,state:{lightsArray:r,shadowsArray:s,lights:i},setupLights:l,setupLightsView:h,pushLight:n,pushShadow:o}}function yz(e,t){let i=new WeakMap;function r(a,n=0){let o=i.get(a),l;return o===void 0?(l=new Xb(e,t),i.set(a,[l])):n>=o.length?(l=new Xb(e,t),o.push(l)):l=o[n],l}function s(){i=new WeakMap}return{get:r,dispose:s}}var SM=class extends zu{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=xn,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},xz=class extends zu{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new M,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}},bz=`void main() { 3112 gl_Position = vec4( position, 1.0 ); 3113}`,wz=`uniform sampler2D shadow_pass; 3114uniform vec2 resolution; 3115uniform float radius; 3116#include <packing> 3117void main() {
3118 const float samples = float( VSM_SAMPLES ); 3119 float mean = 0.0; 3120 float squared_mean = 0.0; 3121 float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); 3122 float uvStart = samples <= 1.0 ? 0.0 : - 1.0; 3123 for ( float i = 0.0; i < samples; i ++ ) { 3124 float uvOffset = uvStart + i * uvStride; 3125 #ifdef HORIZONTAL_PASS 3126 vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); 3127 mean += distribution.x; 3128 squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; 3129 #else 3130 float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); 3131 mean += depth; 3132 squared_mean += depth * depth; 3133 #endif 3134 } 3135 mean = mean / samples; 3136 squared_mean = squared_mean / samples; 3137 float std_dev = sqrt( squared_mean - mean * mean ); 3138 gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); 3139}`;function Sz(e,t,i){let r=new e1,s=new H,a=new H,n=new ot,o=new SM({depthPacking:oM}),l=new xz,h={},c=i.maxTextureSize,u={[Vs]:sr,[sr]:Vs,[Ar]:Ar},d=new Dt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new H},radius:{value:4}},vertexShader:bz,fragmentShader:wz}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let f=new He;f.setAttribute("position",new tt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new Zt(f,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Yy,this.render=function(w,S,b){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||w.length===0)return;let E=e.getRenderTarget(),_=e.getActiveCubeFace(),A=e.getActiveMipmapLevel(),C=e.state;C.setBlending(Ri),C.buffers.color.setClear(1,1,1,1),C.buffers.depth.setTest(!0),C.setScissorTest(!1);for(let T=0,I=w.length;T<I;T++){let P=w[T],O=P.shadow;if(O===void 0){console.warn("THREE.WebGLShadowMap:",P,"has no shadow.");continue}if(O.autoUpdate===!1&&O.needsUpdate===!1)continue;s.copy(O.mapSize);let k=O.getFrameExtents();if(s.multiply(k),a.copy(O.mapSize),(s.x>c||s.y>c)&&(s.x>c&&(a.x=Math.floor(c/k.x),s.x=a.x*k.x,O.mapSize.x=a.x),s.y>c&&(a.y=Math.floor(c/k.y),s.y=a.y*k.y,O.mapSize.y=a.y)),O.map===null){let B=this.type!==Fc?{minFilter:St,magFilter:St}:{};O.map=new Pt(s.x,s.y,B),O.map.texture.name=P.name+".shadowMap",O.camera.updateProjectionMatrix()}e.setRenderTarget(O.map),e.clear();let G=O.getViewportCount();for(let B=0;B<G;B++){let U=O.getViewport(B);n.set(a.x*U.x,a.y*U.y,a.x*U.z,a.y*U.w),C.viewport(n),O.updateMatrices(P,B),r=O.getFrustum(),x(S,b,O.camera,P,this.type)}O.isPointLightShadow!==!0&&this.type===Fc&&v(O,b),O.needsUpdate=!1}g.needsUpdate=!1,e.setRenderTarget(E,_,A)};function v(w,S){let b=t.update(m);d.defines.VSM_SAMPLES!==w.blurSamples&&(d.defines.VSM_SAMPLES=w.blurSamples,p.defines.VSM_SAMPLES=w.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new Pt(s.x,s.y)),d.uniforms.shadow_pass.value=w.map.texture,d.uniforms.resolution.value=w.mapSize,d.uniforms.radius.value=w.radius,e.setRenderTarget(w.mapPass),e.clear(),e.renderBufferDirect(S,null,b,d,m,null),p.uniforms.shadow_pass.value=w.mapPass.texture,p.uniforms.resolution.value=w.mapSize,p.uniforms.radius.value=w.radius,e.setRenderTarget(w.map),e.clear(),e.renderBufferDirect(S,null,b,p,m,null)}function y(w,S,b,E,_,A){let C=null,T=b.isPointLight===!0?w.customDistanceMaterial:w.customDepthMaterial;if(T!==void 0)C=T;else if(C=b.isPointLight===!0?l:o,e.localClippingEnabled&&S.clipShadows===!0&&Array.isArray(S.clippingPlanes)&&S.clippingPlanes.length!==0||S.displacementMap&&S.displacementScale!==0||S.alphaMap&&S.alphaTest>0||S.map&&S.alphaTest>0){let I=C.uuid,P=S.uuid,O=h[I];O===void 0&&(O={},h[I]=O);let k=O[P];k===void 0&&(k=C.clone(),O[P]=k),C=k}return C.visible=S.visible,C.wireframe=S.wireframe,A===Fc?C.side=S.shadowSide!==null?S.shadowSide:S.side:C.side=S.shadowSide!==null?S.shadowSide:u[S.side],C.alphaMap=S.alphaMap,C.alphaTest=S.alphaTest,C.map=S.map,C.clipShadows=S.clipShadows,C.clippingPlanes=S.clippingPlanes,C.clipIntersection=S.clipIntersection,C.displacementMap=S.displacementMap,C.displacementScale=S.displacementScale,C.displacementBias=S.displacementBias,C.wireframeLinewidth=S.wireframeLinewidth,C.linewidth=S.linewidth,b.isPointLight===!0&&C.isMeshDistanceMaterial===!0&&(C.referencePosition.setFromMatrixPosition(b.matrixWorld),C.nearDistance=E,C.farDistance=_),C}function x(w,S,b,E,_){if(w.visible===!1)return;if(w.layers.test(S.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&_===Fc)&&(!w.frustumCulled||r.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(b.matrixWorldInverse,w.matrixWorld);let C=t.update(w),T=w.material;if(Array.isArray(T)){let I=C.groups;for(let P=0,O=I.length;P<O;P++){let k=I[P],G=T[k.materialIndex];if(G&&G.visible){let B=y(w,G,E,b.near,b.far,_);e.renderBufferDirect(b,null,C,B,w,k)}}}else if(T.visible){let I=y(w,T,E,b.near,b.far,_);e.renderBufferDirect(b,null,C,I,w,null)}}let A=w.children;for(let C=0,T=A.length;C<T;C++)x(A[C],S,b,E,_)}}
3139function _z(e,t,i){let r=i.isWebGL2;function s(){let J=!1,fe=new ot,be=null,ze=new ot(0,0,0,0);return{setMask:function(lt){be!==lt&&!J&&(e.colorMask(lt,lt,lt,lt),be=lt)},setLocked:function(lt){J=lt},setClear:function(lt,Et,xi,Ki,qs){qs===!0&&(lt*=Ki,Et*=Ki,xi*=Ki),fe.set(lt,Et,xi,Ki),ze.equals(fe)===!1&&(e.clearColor(lt,Et,xi,Ki),ze.copy(fe))},reset:function(){J=!1,be=null,ze.set(-1,0,0,0)}}}function a(){let J=!1,fe=null,be=null,ze=null;return{setTest:function(lt){lt?re(2929):$(2929)},setMask:function(lt){fe!==lt&&!J&&(e.depthMask(lt),fe=lt)},setFunc:function(lt){if(be!==lt){switch(lt){case GD:e.depthFunc(512);break;case WD:e.depthFunc(519);break;case qD:e.depthFunc(513);break;case Vv:e.depthFunc(515);break;case XD:e.depthFunc(514);break;case YD:e.depthFunc(518);break;case QD:e.depthFunc(516);break;case KD:e.depthFunc(517);break;default:e.depthFunc(515)}be=lt}},setLocked:function(lt){J=lt},setClear:function(lt){ze!==lt&&(e.clearDepth(lt),ze=lt)},reset:function(){J=!1,fe=null,be=null,ze=null}}}function n(){let J=!1,fe=null,be=null,ze=null,lt=null,Et=null,xi=null,Ki=null,qs=null;return{setTest:function($t){J||($t?re(2960):$(2960))},setMask:function($t){fe!==$t&&!J&&(e.stencilMask($t),fe=$t)},setFunc:function($t,Ss,Ur){(be!==$t||ze!==Ss||lt!==Ur)&&(e.stencilFunc($t,Ss,Ur),be=$t,ze=Ss,lt=Ur)},setOp:function($t,Ss,Ur){(Et!==$t||xi!==Ss||Ki!==Ur)&&(e.stencilOp($t,Ss,Ur),Et=$t,xi=Ss,Ki=Ur)},setLocked:function($t){J=$t},setClear:function($t){qs!==$t&&(e.clearStencil($t),qs=$t)},reset:function(){J=!1,fe=null,be=null,ze=null,lt=null,Et=null,xi=null,Ki=null,qs=null}}}let o=new s,l=new a,h=new n,c=new WeakMap,u=new WeakMap,d={},p={},f=new WeakMap,m=[],g=null,v=!1,y=null,x=null,w=null,S=null,b=null,E=null,_=null,A=!1,C=null,T=null,I=null,P=null,O=null,k=e.getParameter(35661),G=!1,B=0,U=e.getParameter(7938);U.indexOf("WebGL")!==-1?(B=parseFloat(/^WebGL (\d)/.exec(U)[1]),G=B>=1):U.indexOf("OpenGL ES")!==-1&&(B=parseFloat(/^OpenGL ES (\d)/.exec(U)[1]),G=B>=2);let Q=null,q={},j=e.getParameter(3088),X=e.getParameter(2978),te=new ot().fromArray(j),K=new ot().fromArray(X);function Z(J,fe,be){let ze=new Uint8Array(4),lt=e.createTexture();e.bindTexture(J,lt),e.texParameteri(J,10241,9728),e.texParameteri(J,10240,9728);for(let Et=0;Et<be;Et++)e.texImage2D(fe+Et,0,6408,1,1,0,6408,5121,ze);return lt}let W={};W[3553]=Z(3553,3553,1),W[34067]=Z(34067,34069,6),o.setClear(0,0,0,1),l.setClear(1),h.setClear(0),re(2929),l.setFunc(Vv),Ve(!1),Ne(Ux),re(2884),Re(Ri);function re(J){d[J]!==!0&&(e.enable(J),d[J]=!0)}function $(J){d[J]!==!1&&(e.disable(J),d[J]=!1)}function ne(J,fe){return p[J]!==fe?(e.bindFramebuffer(J,fe),p[J]=fe,r&&(J===36009&&(p[36160]=fe),J===36160&&(p[36009]=fe)),!0):!1}function ie(J,fe){let be=m,ze=!1;if(J)if(be=f.get(fe),be===void 0&&(be=[],f.set(fe,be)),J.isWebGLMultipleRenderTargets){let lt=J.texture;if(be.length!==lt.length||be[0]!==36064){for(let Et=0,xi=lt.length;Et<xi;Et++)be[Et]=36064+Et;be.length=lt.length,ze=!0}}else be[0]!==36064&&(be[0]=36064,ze=!0);else be[0]!==1029&&(be[0]=1029,ze=!0);ze&&(i.isWebGL2?e.drawBuffers(be):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(be))}function ve(J){return g!==J?(e.useProgram(J),g=J,!0):!1}let de={[Xl]:32774,[RD]:32778,[LD]:32779};if(r)de[Hx]=32775,de[Gx]=32776;else{let J=t.get("EXT_blend_minmax");J!==null&&(de[Hx]=J.MIN_EXT,de[Gx]=J.MAX_EXT)}let we={[zD]:0,[BD]:1,[FD]:768,[$2]:770,[HD]:776,[VD]:774,[UD]:772,[kD]:769,[eM]:771,[jD]:775,[ND]:773};function Re(J,fe,be,ze,lt,Et,xi,Ki){if(J===Ri){v===!0&&($(3042),v=!1);return}if(v===!1&&(re(3042),v=!0),J!==ID){if(J!==y||Ki!==A){if((x!==Xl||b!==Xl)&&(e.blendEquation(32774),x=Xl,b=Xl),Ki)switch(J){case Wo:e.blendFuncSeparate(1,771,1,771);break;case Nx:e.blendFunc(1,1);break;case Vx:e.blendFuncSeparate(0,769,0,1);break;case jx:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",J);break}else switch(J){case Wo:e.blendFuncSeparate(770,771,1,771);break;case Nx:e.blendFunc(770,1);break;case Vx:e.blendFuncSeparate(0,769,0,1);break;case jx:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",J);break}w=null,S=null,E=null,_=null,y=J,A=Ki}return}lt=lt||fe,Et=Et||be,xi=xi||ze,(fe!==x||lt!==b)&&(e.blendEquationSeparate(de[fe],de[lt]),x=fe,b=lt),(be!==w||ze!==S||Et!==E||xi!==_)&&(e.blendFuncSeparate(we[be],we[ze],we[Et],we[xi]),w=be,S=ze,E=Et,_=xi),y=J,A=!1}function Me(J,fe){J.side===Ar?$(2884):re(2884);let be=J.side===sr;fe&&(be=!be),Ve(be),J.blending===Wo&&J.transparent===!1?Re(Ri):Re(J.blending,J.blendEquation,J.blendSrc,J.blendDst,J.blendEquationAlpha,J.blendSrcAlpha,J.blendDstAlpha,J.premultipliedAlpha),l.setFu
vendor: 4,131 bytes, line 3139
3139nc(J.depthFunc),l.setTest(J.depthTest),l.setMask(J.depthWrite),o.setMask(J.colorWrite);let ze=J.stencilWrite;h.setTest(ze),ze&&(h.setMask(J.stencilWriteMask),h.setFunc(J.stencilFunc,J.stencilRef,J.stencilFuncMask),h.setOp(J.stencilFail,J.stencilZFail,J.stencilZPass)),Ee(J.polygonOffset,J.polygonOffsetFactor,J.polygonOffsetUnits),J.alphaToCoverage===!0?re(32926):$(32926)}function Ve(J){C!==J&&(J?e.frontFace(2304):e.frontFace(2305),C=J)}function Ne(J){J!==PD?(re(2884),J!==T&&(J===Ux?e.cullFace(1029):J===DD?e.cullFace(1028):e.cullFace(1032))):$(2884),T=J}function Oe(J){J!==I&&(G&&e.lineWidth(J),I=J)}function Ee(J,fe,be){J?(re(32823),(P!==fe||O!==be)&&(e.polygonOffset(fe,be),P=fe,O=be)):$(32823)}function Qe(J){J?re(3089):$(3089)}function qe(J){J===void 0&&(J=33984+k-1),Q!==J&&(e.activeTexture(J),Q=J)}function V(J,fe,be){be===void 0&&(Q===null?be=33984+k-1:be=Q);let ze=q[be];ze===void 0&&(ze={type:void 0,texture:void 0},q[be]=ze),(ze.type!==J||ze.texture!==fe)&&(Q!==be&&(e.activeTexture(be),Q=be),e.bindTexture(J,fe||W[J]),ze.type=J,ze.texture=fe)}function z(){let J=q[Q];J!==void 0&&J.type!==void 0&&(e.bindTexture(J.type,null),J.type=void 0,J.texture=void 0)}function oe(){try{e.compressedTexImage2D.apply(e,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function Se(){try{e.compressedTexImage3D.apply(e,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function R(){try{e.texSubImage2D.apply(e,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function Ae(){try{e.texSubImage3D.apply(e,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function ke(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function Ie(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function ce(){try{e.texStorage2D.apply(e,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function je(){try{e.texStorage3D.apply(e,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function Le(){try{e.texImage2D.apply(e,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function Xe(){try{e.texImage3D.apply(e,arguments)}catch(J){console.error("THREE.WebGLState:",J)}}function it(J){te.equals(J)===!1&&(e.scissor(J.x,J.y,J.z,J.w),te.copy(J))}function Ke(J){K.equals(J)===!1&&(e.viewport(J.x,J.y,J.z,J.w),K.copy(J))}function $e(J,fe){let be=u.get(fe);be===void 0&&(be=new WeakMap,u.set(fe,be));let ze=be.get(J);ze===void 0&&(ze=e.getUniformBlockIndex(fe,J.name),be.set(J,ze))}function qt(J,fe){let be=u.get(fe).get(J);c.get(fe)!==be&&(e.uniformBlockBinding(fe,be,J.__bindingPointIndex),c.set(fe,be))}function hi(){e.disable(3042),e.disable(2884),e.disable(2929),e.disable(32823),e.disable(3089),e.disable(2960),e.disable(32926),e.blendEquation(32774),e.blendFunc(1,0),e.blendFuncSeparate(1,0,1,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(513),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(519,0,4294967295),e.stencilOp(7680,7680,7680),e.clearStencil(0),e.cullFace(1029),e.frontFace(2305),e.polygonOffset(0,0),e.activeTexture(33984),e.bindFramebuffer(36160,null),r===!0&&(e.bindFramebuffer(36009,null),e.bindFramebuffer(36008,null)),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),d={},Q=null,q={},p={},f=new WeakMap,m=[],g=null,v=!1,y=null,x=null,w=null,S=null,b=null,E=null,_=null,A=!1,C=null,T=null,I=null,P=null,O=null,te.set(0,0,e.canvas.width,e.canvas.height),K.set(0,0,e.canvas.width,e.canvas.height),o.reset(),l.reset(),h.reset()}return{buffers:{color:o,depth:l,stencil:h},enable:re,disable:$,bindFramebuffer:ne,drawBuffers:ie,useProgram:ve,setBlending:Re,setMaterial:Me,setFlipSided:Ve,setCullFace:Ne,setLineWidth:Oe,setPolygonOffset:Ee,setScissorTest:Qe,activeTexture:qe,bindTexture:V,unbindTexture:z,compressedTexImage2D:oe,compressedTexImage3D:Se,texImage2D:Le,texImage3D:Xe,updateUBOMapping:$e,uniformBlockBinding:qt,texStorage2D:ce,texStorage3D:je,texSubImage2D:R,texSubImage3D:Ae,compressedTexSubImage2D:ke,compressedTexSubImage3D:Ie,scissor:it,viewport:Ke,reset:hi}}
3139function Az(e,t,i,r,s,a,n){let o=s.isWebGL2,l=s.maxTextures,h=s.maxCubemapSize,c=s.maxTextureSize,u=s.maxSamples,d=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,p=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new WeakMap,m,g=new WeakMap,v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(V,z){return v?new OffscreenCanvas(V,z):du("canvas")}function x(V,z,oe,Se){let R=1;if((V.width>Se||V.height>Se)&&(R=Se/Math.max(V.width,V.height)),R<1||z===!0)if(typeof HTMLImageElement<"u"&&V instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&V instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&V instanceof ImageBitmap){let Ae=z?Yp:Math.floor,ke=Ae(R*V.width),Ie=Ae(R*V.height);m===void 0&&(m=y(ke,Ie));let ce=oe?y(ke,Ie):m;return ce.width=ke,ce.height=Ie,ce.getContext("2d").drawImage(V,0,0,ke,Ie),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+V.width+"x"+V.height+") to ("+ke+"x"+Ie+")."),ce}else return"data"in V&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+V.width+"x"+V.height+")."),V;return V}function w(V){return Yv(V.width)&&Yv(V.height)}function S(V){return o?!1:V.wrapS!==si||V.wrapT!==si||V.minFilter!==St&&V.minFilter!==xt}function b(V,z){return V.generateMipmaps&&z&&V.minFilter!==St&&V.minFilter!==xt}function E(V){e.generateMipmap(V)}function _(V,z,oe,Se,R=!1){if(o===!1)return z;if(V!==null){if(e[V]!==void 0)return e[V];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+V+"'")}let Ae=z;return z===6403&&(oe===5126&&(Ae=33326),oe===5131&&(Ae=33325),oe===5121&&(Ae=33321)),z===33319&&(oe===5126&&(Ae=33328),oe===5131&&(Ae=33327),oe===5121&&(Ae=33323)),z===6408&&(oe===5126&&(Ae=34836),oe===5131&&(Ae=34842),oe===5121&&(Ae=Se===gt&&R===!1?35907:32856),oe===32819&&(Ae=32854),oe===32820&&(Ae=32855)),(Ae===33325||Ae===33326||Ae===33327||Ae===33328||Ae===34842||Ae===34836)&&t.get("EXT_color_buffer_float"),Ae}function A(V,z,oe){return b(V,oe)===!0||V.isFramebufferTexture&&V.minFilter!==St&&V.minFilter!==xt?Math.log2(Math.max(z.width,z.height))+1:V.mipmaps!==void 0&&V.mipmaps.length>0?V.mipmaps.length:V.isCompressedTexture&&Array.isArray(V.image)?z.mipmaps.length:1}function C(V){return V===St||V===Wx||V===Rm?9728:9729}function T(V){let z=V.target;z.removeEventListener("dispose",T),P(z),z.isVideoTexture&&f.delete(z)}function I(V){let z=V.target;z.removeEventListener("dispose",I),k(z)}function P(V){let z=r.get(V);if(z.__webglInit===void 0)return;let oe=V.source,Se=g.get(oe);if(Se){let R=Se[z.__cacheKey];R.usedTimes--,R.usedTimes===0&&O(V),Object.keys(Se).length===0&&g.delete(oe)}r.remove(V)}function O(V){let z=r.get(V);e.deleteTexture(z.__webglTexture);let oe=V.source,Se=g.get(oe);delete Se[z.__cacheKey],n.memory.textures--}function k(V){let z=V.texture,oe=r.get(V),Se=r.get(z);if(Se.__webglTexture!==void 0&&(e.deleteTexture(Se.__webglTexture),n.memory.textures--),V.depthTexture&&V.depthTexture.dispose(),V.isWebGLCubeRenderTarget)for(let R=0;R<6;R++)e.deleteFramebuffer(oe.__webglFramebuffer[R]),oe.__webglDepthbuffer&&e.deleteRenderbuffer(oe.__webglDepthbuffer[R]);else{if(e.deleteFramebuffer(oe.__webglFramebuffer),oe.__webglDepthbuffer&&e.deleteRenderbuffer(oe.__webglDepthbuffer),oe.__webglMultisampledFramebuffer&&e.deleteFramebuffer(oe.__webglMultisampledFramebuffer),oe.__webglColorRenderbuffer)for(let R=0;R<oe.__webglColorRenderbuffer.length;R++)oe.__webglColorRenderbuffer[R]&&e.deleteRenderbuffer(oe.__webglColorRenderbuffer[R]);oe.__webglDepthRenderbuffer&&e.deleteRenderbuffer(oe.__webglDepthRenderbuffer)}if(V.isWebGLMultipleRenderTargets)for(let R=0,Ae=z.length;R<Ae;R++){let ke=r.get(z[R]);ke.__webglTexture&&(e.deleteTexture(ke.__webglTexture),n.memory.textures--),r.remove(z[R])}r.remove(z),r.remove(V)}let G=0;function B(){G=0}function U(){let V=G;return V>=l&&console.warn("THREE.WebGLTextures: Trying to use "+V+" texture units while this GPU supports only "+l),G+=1,V}function Q(V){let z=[];
3139return z.push(V.wrapS),z.push(V.wrapT),z.push(V.wrapR||0),z.push(V.magFilter),z.push(V.minFilter),z.push(V.anisotropy),z.push(V.internalFormat),z.push(V.format),z.push(V.type),z.push(V.generateMipmaps),z.push(V.premultiplyAlpha),z.push(V.flipY),z.push(V.unpackAlignment),z.push(V.encoding),z.join()}function q(V,z){let oe=r.get(V);if(V.isVideoTexture&&Qe(V),V.isRenderTargetTexture===!1&&V.version>0&&oe.__version!==V.version){let Se=V.image;if(Se===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Se.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{$(oe,V,z);return}}i.bindTexture(3553,oe.__webglTexture,33984+z)}function j(V,z){let oe=r.get(V);if(V.version>0&&oe.__version!==V.version){$(oe,V,z);return}i.bindTexture(35866,oe.__webglTexture,33984+z)}function X(V,z){let oe=r.get(V);if(V.version>0&&oe.__version!==V.version){$(oe,V,z);return}i.bindTexture(32879,oe.__webglTexture,33984+z)}function te(V,z){let oe=r.get(V);if(V.version>0&&oe.__version!==V.version){ne(oe,V,z);return}i.bindTexture(34067,oe.__webglTexture,33984+z)}let K={[rn]:10497,[si]:33071,[Gv]:33648},Z={[St]:9728,[Wx]:9984,[Rm]:9986,[xt]:9729,[s3]:9985,[Sh]:9987};function W(V,z,oe){if(oe?(e.texParameteri(V,10242,K[z.wrapS]),e.texParameteri(V,10243,K[z.wrapT]),(V===32879||V===35866)&&e.texParameteri(V,32882,K[z.wrapR]),e.texParameteri(V,10240,Z[z.magFilter]),e.texParameteri(V,10241,Z[z.minFilter])):(e.texParameteri(V,10242,33071),e.texParameteri(V,10243,33071),(V===32879||V===35866)&&e.texParameteri(V,32882,33071),(z.wrapS!==si||z.wrapT!==si)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(V,10240,C(z.magFilter)),e.texParameteri(V,10241,C(z.minFilter)),z.minFilter!==St&&z.minFilter!==xt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),t.has("EXT_texture_filter_anisotropic")===!0){let Se=t.get("EXT_texture_filter_anisotropic");if(z.magFilter===St||z.minFilter!==Rm&&z.minFilter!==Sh||z.type===Ht&&t.has("OES_texture_float_linear")===!1||o===!1&&z.type===dn&&t.has("OES_texture_half_float_linear")===!1)return;(z.anisotropy>1||r.get(z).__currentAnisotropy)&&(e.texParameterf(V,Se.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(z.anisotropy,s.getMaxAnisotropy())),r.get(z).__currentAnisotropy=z.anisotropy)}}function re(V,z){let oe=!1;V.__webglInit===void 0&&(V.__webglInit=!0,z.addEventListener("dispose",T));let Se=z.source,R=g.get(Se);R===void 0&&(R={},g.set(Se,R));let Ae=Q(z);if(Ae!==V.__cacheKey){R[Ae]===void 0&&(R[Ae]={texture:e.createTexture(),usedTimes:0},n.memory.textures++,oe=!0),R[Ae].usedTimes++;let ke=R[V.__cacheKey];ke!==void 0&&(R[V.__cacheKey].usedTimes--,ke.usedTimes===0&&O(z)),V.__cacheKey=Ae,V.__webglTexture=R[Ae].texture}return oe}function $(V,z,oe){let Se=3553;(z.isDataArrayTexture||z.isCompressedArrayTexture)&&(Se=35866),z.isData3DTexture&&(Se=32879);let R=re(V,z),Ae=z.source;i.bindTexture(Se,V.__webglTexture,33984+oe);let ke=r.get(Ae);if(Ae.version!==ke.__version||R===!0){i.activeTexture(33984+oe),e.pixelStorei(37440,z.flipY),e.pixelStorei(37441,z.premultiplyAlpha),e.pixelStorei(3317,z.unpackAlignment),e.pixelStorei(37443,0);let Ie=S(z)&&w(z.image)===!1,ce=x(z.image,Ie,!1,c);ce=qe(z,ce);let je=w(ce)||o,Le=a.convert(z.format,z.encoding),Xe=a.convert(z.type),it=_(z.internalFormat,Le,Xe,z.encoding,z.isVideoTexture);W(Se,z,je);let Ke,$e=z.mipmaps,qt=o&&z.isVideoTexture!==!0,hi=ke.__version===void 0||R===!0,J=A(z,ce,je);if(z.isDepthTexture)it=6402,o?z.type===Ht?it=36012:z.type===sn?it=33190:z.type===qo?it=35056:it=33189:z.type===
vendor: 10,209 bytes, line 3139
3139Ht&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),z.format===Xo&&it===6402&&z.type!==rM&&z.type!==sn&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),z.type=sn,Xe=a.convert(z.type)),z.format===el&&it===6402&&(it=34041,z.type!==qo&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),z.type=qo,Xe=a.convert(z.type))),hi&&(qt?i.texStorage2D(3553,1,it,ce.width,ce.height):i.texImage2D(3553,0,it,ce.width,ce.height,0,Le,Xe,null));else if(z.isDataTexture)if($e.length>0&&je){qt&&hi&&i.texStorage2D(3553,J,it,$e[0].width,$e[0].height);for(let fe=0,be=$e.length;fe<be;fe++)Ke=$e[fe],qt?i.texSubImage2D(3553,fe,0,0,Ke.width,Ke.height,Le,Xe,Ke.data):i.texImage2D(3553,fe,it,Ke.width,Ke.height,0,Le,Xe,Ke.data);z.generateMipmaps=!1}else qt?(hi&&i.texStorage2D(3553,J,it,ce.width,ce.height),i.texSubImage2D(3553,0,0,0,ce.width,ce.height,Le,Xe,ce.data)):i.texImage2D(3553,0,it,ce.width,ce.height,0,Le,Xe,ce.data);else if(z.isCompressedTexture)if(z.isCompressedArrayTexture){qt&&hi&&i.texStorage3D(35866,J,it,$e[0].width,$e[0].height,ce.depth);for(let fe=0,be=$e.length;fe<be;fe++)Ke=$e[fe],z.format!==oi?Le!==null?qt?i.compressedTexSubImage3D(35866,fe,0,0,0,Ke.width,Ke.height,ce.depth,Le,Ke.data,0,0):i.compressedTexImage3D(35866,fe,it,Ke.width,Ke.height,ce.depth,0,Ke.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):qt?i.texSubImage3D(35866,fe,0,0,0,Ke.width,Ke.height,ce.depth,Le,Xe,Ke.data):i.texImage3D(35866,fe,it,Ke.width,Ke.height,ce.depth,0,Le,Xe,Ke.data)}else{qt&&hi&&i.texStorage2D(3553,J,it,$e[0].width,$e[0].height);for(let fe=0,be=$e.length;fe<be;fe++)Ke=$e[fe],z.format!==oi?Le!==null?qt?i.compressedTexSubImage2D(3553,fe,0,0,Ke.width,Ke.height,Le,Ke.data):i.compressedTexImage2D(3553,fe,it,Ke.width,Ke.height,0,Ke.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):qt?i.texSubImage2D(3553,fe,0,0,Ke.width,Ke.height,Le,Xe,Ke.data):i.texImage2D(3553,fe,it,Ke.width,Ke.height,0,Le,Xe,Ke.data)}else if(z.isDataArrayTexture)qt?(hi&&i.texStorage3D(35866,J,it,ce.width,ce.height,ce.depth),i.texSubImage3D(35866,0,0,0,0,ce.width,ce.height,ce.depth,Le,Xe,ce.data)):i.texImage3D(35866,0,it,ce.width,ce.height,ce.depth,0,Le,Xe,ce.data);else if(z.isData3DTexture)qt?(hi&&i.texStorage3D(32879,J,it,ce.width,ce.height,ce.depth),i.texSubImage3D(32879,0,0,0,0,ce.width,ce.height,ce.depth,Le,Xe,ce.data)):i.texImage3D(32879,0,it,ce.width,ce.height,ce.depth,0,Le,Xe,ce.data);else if(z.isFramebufferTexture){if(hi)if(qt)i.texStorage2D(3553,J,it,ce.width,ce.height);else{let fe=ce.width,be=ce.height;for(let ze=0;ze<J;ze++)i.texImage2D(3553,ze,it,fe,be,0,Le,Xe,null),fe>>=1,be>>=1}}else if($e.length>0&&je){qt&&hi&&i.texStorage2D(3553,J,it,$e[0].width,$e[0].height);for(let fe=0,be=$e.length;fe<be;fe++)Ke=$e[fe],qt?i.texSubImage2D(3553,fe,0,0,Le,Xe,Ke):i.texImage2D(3553,fe,it,Le,Xe,Ke);z.generateMipmaps=!1}else qt?(hi&&i.texStorage2D(3553,J,it,ce.width,ce.height),i.texSubImage2D(3553,0,0,0,Le,Xe,ce)):i.texImage2D(3553,0,it,Le,Xe,ce);b(z,je)&&E(Se),ke.__version=Ae.version,z.onUpdate&&z.onUpdate(z)}V.__version=z.version}function ne(V,z,oe){if(z.image.length!==6)return;let Se=re(V,z),R=z.source;i.bindTexture(34067,V.__webglTexture,33984+oe);let Ae=r.get(R);if(R.version!==Ae.__version||Se===!0){i.activeTexture(33984+oe),e.pixelStorei(37440,z.flipY),e.pixelStorei(37441,z.premultiplyAlpha),e.pixelStorei(3317,z.unpackAlignment),e.pixelStorei(37443,0);let ke=z.isCompressedTexture||z.image[0].isCompressedTexture,Ie=z.image[0]&&z.image[0].isDataTexture,ce=[];for(let fe=0;fe<6;fe++)!ke&&!Ie?ce[fe]=x(z.image[fe],!1,!0,h):ce[fe]=Ie?z.image[fe].image:z.image[fe],ce[fe]=qe(z,ce[fe]);let je=ce[0],Le=w(je)||o,Xe=a.convert(z.format,z.encoding),it=a.convert(z.type),Ke=_(z.internalFormat,Xe,it,z.encoding),$e=o&&z.isVideoTexture!==!0,qt=Ae.__version===void 0||Se===!0,hi=A(z,je,Le);W(34067,z,Le);let J;if(ke){$e&&qt&&i.texStorage2D(34067,hi,Ke,je.width,je.height);for(let fe=0;fe<6;fe++){J=ce[fe].mipmaps;for(let be=0;be<J.length;be++){let ze=J[be];z.format!==oi?Xe!==null?$e?i.compressedTexSubImage2D(34069+fe,be,0,0,ze.width,ze.height,Xe,ze.data):i.compressedTexImage2D(34069+fe,be,Ke,ze.width,ze.height,0,ze.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):$e?i.texSubImage2D(34069+fe,be,0,0,ze.width,ze.height,Xe,it,ze.data):i.texImage2D(34069+fe,be,Ke,ze.width,ze.height,0,Xe,it,ze.data)}}}else{J=z.mipmaps,$e&&qt&&(J.length>0&&hi++,i.texStorage2D(34067,hi,Ke,ce[0].width,ce[0].height));for(let fe=0;fe<6;fe++)if(Ie){$e?i.texSubImage2D(34069+fe,0,0,0,ce[fe].width,ce[fe].height,Xe,it,ce[fe].data):i.texImage2D(34069+fe,0,Ke,ce[fe].width,ce[fe].height,0,Xe,it,ce[fe].data);for(let be=0;be<J.length;be++){let ze=J[be].image[fe].image;$e?i.texSubImage2D(34069+fe,be+1,0,0,ze.width,ze.height,Xe,it,ze.data):i.texImage2D(34069+fe,be+1,Ke,ze.width,ze.height,0,Xe,it,ze.data)}}else{$e?i.texSubImage2D(34069+fe,0,0,0,Xe,it,ce[fe]):i.texImage2D(34069+fe,0,Ke,Xe,it,ce[fe]);for(let be=0;be<J.length;be++){let ze=J[be];$e?i.texSubImage2D(34069+fe,be+1,0,0,Xe,it,ze.image[fe]):i.texImage2D(34069+fe,be+1,Ke,Xe,it,ze.image[fe])}}}b(z,Le)&&E(34067),Ae.__version=R.version,z.onUpdate&&z.onUpdate(z)}V.__version=z.version}function ie(V,z,oe,Se,R){let Ae=a.convert(oe.format,oe.encoding),ke=a.convert(oe.type),Ie=_(oe.internalFormat,Ae,ke,oe.encoding);r.get(z).__hasExternalTextures||(R===32879||R===35866?i.texImage3D(R,0,Ie,z.width,z.height,z.depth,0,Ae,ke,null):i.texImage2D(R,0,Ie,z.width,z.height,0,Ae,ke,null)),i.bindFramebuffer(36160,V),Ee(z)?d.framebufferTexture2DMultisampleEXT(36160,Se,R,r.get(oe).__webglTexture,0,Oe(z)):(R===3553||R>=34069&&R<=34074)&&e.framebufferTexture2D(36160,Se,R,r.get(oe).__webglTexture,0),i.bindFramebuffer(36160,null)}function ve(V,z,oe){if(e.bindRenderbuffer(36161,V),z.depthBuffer&&!z.stencilBuffer){let Se=33189;if(oe||Ee(z)){let R=z.depthTexture;R&&R.isDepthTexture&&(R.type===Ht?Se=36012:R.type===sn&&(Se=33190));let Ae=Oe(z);Ee(z)?d.renderbufferStorageMultisampleEXT(36161,Ae,Se,z.width,z.height):e.renderbufferStorageMultisample(36161,Ae,Se,z.width,z.height)}else e.renderbufferStorage(36161,Se,z.width,z.height);e.framebufferRenderbuffer(36160,36096,36161,V)}else if(z.depthBuffer&&z.stencilBuffer){let Se=Oe(z);oe&&Ee(z)===!1?e.renderbufferStorageMultisample(36161,Se,35056,z.width,z.height):Ee(z)?d.renderbufferStorageMultisampleEXT(36161,Se,35056,z.width,z.height):e.renderbufferStorage(36161,34041,z.width,z.height),e.framebufferRenderbuffer(36160,33306,36161,V)}else{let Se=z.isWebGLMultipleRenderTargets===!0?z.texture:[z.texture];for(let R=0;R<Se.length;R++){let Ae=Se[R],ke=a.convert(Ae.format,Ae.encoding),Ie=a.convert(Ae.type),ce=_(Ae.internalFormat,ke,Ie,Ae.encoding),je=Oe(z);oe&&Ee(z)===!1?e.renderbufferStorageMultisample(36161,je,ce,z.width,z.height):Ee(z)?d.renderbufferStorageMultisampleEXT(36161,je,ce,z.width,z.height):e.renderbufferStorage(36161,ce,z.width,z.height)}}e.bindRenderbuffer(36161,null)}function de(V,z){if(z&&z.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,V),!(z.depthTexture&&z.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(z.depthTexture).__webglTexture||z.depthTexture.image.width!==z.width||z.depthTexture.image.height!==z.height)&&(z.depthTexture.image.width=z.width,z.depthTexture.image.height=z.height,z.depthTexture.needsUpdate=!0),q(z.depthTexture,0);let oe=r.get(z.depthTexture).__webglTexture,Se=Oe(z);if(z.depthTexture.format===Xo)Ee(z)?d.framebufferTexture2DMultisampleEXT(36160,36096,3553,oe,0,Se):e.framebufferTexture2D(36160,36096,3553,oe,0);else if(z.depthTexture.format===el)Ee(z)?d.framebufferTexture2DMultisampleEXT(36160,33306,3553,oe,0,Se):e.framebufferTexture2D(36160,33306,3553,oe,0);else throw new Error("Unknown depthTexture format")}function we(V){let z=r.get(V),oe=V.isWebGLCubeRenderTarget===!0;if(V.depthTexture&&!z.__autoAllocateDepthBuffer){if(oe)throw new Error("target.depthTexture not supported in Cube render targets");de(z.__webglFramebuffer,V)}else if(oe){z.__webglDepthbuffer=[];for(let Se=0;Se<6;Se++)i.bindFramebuffer(36160,z.__webglFramebuffer[Se]),z.__webglDepthbuffer[Se]=e.createRenderbuffer(),ve(z.__webglDepthbuffer[Se],V,!1)}else i.bindFramebuffer(36160,z.__webglFramebuffer),z.__webglDepthbuffer=e.createRenderbuffer(),ve(z.__webglDepthbuffer,V,!1);i.bindFramebuffer(36160,null)}function Re(V,z,oe){let Se=r.get(V);z!==void 0&&ie(Se.__webglFramebuffer,V,V.texture,36064,3553),oe!==void 0&&we(V)}function Me(V){let z=V.texture,oe=r.get(V),Se=r.get(z);V.addEventListener("dispose",I),V.isWebGLMultipleRenderTargets!==!0&&(Se.__webglTexture===void 0&&(Se.__webglTexture=e.createTexture()),Se.__version=z.version,n.memory.textures++);let R=V.isWebGLCubeRenderTarget===!0,Ae=V.isWebGLMultipleRenderTargets===!0,ke=w(V)||o;if(R){oe.__webglFramebuffer=[];for(let Ie=0;Ie<6;Ie++)oe.__webglFramebuffer[Ie]=e.createFramebuffer()}else{if(oe.__webglFramebuffer=e.createFramebuffer(),Ae)if(s.drawBuffers){let Ie=V.texture;for(let ce=0,je=Ie.length;ce<je;ce++){let Le=r.get(Ie[ce]);Le.__webglTexture===void 0&&(Le.__webglTexture=e.createTexture(),n.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(o&&V.samples>0&&Ee(V)===!1){let Ie=Ae?z:[z];oe.__webglMultisampledFramebuffer=e.createFramebuffer(),oe.__webglColorRenderbuffer=[],i.bindFramebuffer(36160,oe.__webglMultisampledFramebuffer);for(let ce=0;ce<Ie.length;ce++){let je=Ie[ce];oe.__webglColorRenderbuffer[ce]=e.createRenderbuffer(),e.bindRenderbuffer(36161,oe.__webglColorRenderbuffer[ce]);let Le=a.convert(je.format,je.encoding),Xe=a.convert(je.type),it=_(je.internalFormat,Le,Xe,je.encoding,V.isXRRenderTarget===!0),Ke=Oe(V);e.renderbufferStorageMultisample(36161,Ke,it,V.width,V.height),e.framebufferRenderbuffer(36160,36064+ce,36161,oe.__webglColorRen
3139derbuffer[ce])}e.bindRenderbuffer(36161,null),V.depthBuffer&&(oe.__webglDepthRenderbuffer=e.createRenderbuffer(),ve(oe.__webglDepthRenderbuffer,V,!0)),i.bindFramebuffer(36160,null)}}if(R){i.bindTexture(34067,Se.__webglTexture),W(34067,z,ke);for(let Ie=0;Ie<6;Ie++)ie(oe.__webglFramebuffer[Ie],V,z,36064,34069+Ie);b(z,ke)&&E(34067),i.unbindTexture()}else if(Ae){let Ie=V.texture;for(let ce=0,je=Ie.length;ce<je;ce++){let Le=Ie[ce],Xe=r.get(Le);i.bindTexture(3553,Xe.__webglTexture),W(3553,Le,ke),ie(oe.__webglFramebuffer,V,Le,36064+ce,3553),b(Le,ke)&&E(3553)}i.unbindTexture()}else{let Ie=3553;(V.isWebGL3DRenderTarget||V.isWebGLArrayRenderTarget)&&(o?Ie=V.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),i.bindTexture(Ie,Se.__webglTexture),W(Ie,z,ke),ie(oe.__webglFramebuffer,V,z,36064,Ie),b(z,ke)&&E(Ie),i.unbindTexture()}V.depthBuffer&&we(V)}function Ve(V){let z=w(V)||o,oe=V.isWebGLMultipleRenderTargets===!0?V.texture:[V.texture];for(let Se=0,R=oe.length;Se<R;Se++){let Ae=oe[Se];if(b(Ae,z)){let ke=V.isWebGLCubeRenderTarget?34067:3553,Ie=r.get(Ae).__webglTexture;i.bindTexture(ke,Ie),E(ke),i.unbindTexture()}}}function Ne(V){if(o&&V.samples>0&&Ee(V)===!1){let z=V.isWebGLMultipleRenderTargets?V.texture:[V.texture],oe=V.width,Se=V.height,R=16384,Ae=[],ke=V.stencilBuffer?33306:36096,Ie=r.get(V),ce=V.isWebGLMultipleRenderTargets===!0;if(ce)for(let je=0;je<z.length;je++)i.bindFramebuffer(36160,Ie.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+je,36161,null),i.bindFramebuffer(36160,Ie.__webglFramebuffer),e.framebufferTexture2D(36009,36064+je,3553,null,0);i.bindFramebuffer(36008,Ie.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,Ie.__webglFramebuffer);for(let je=0;je<z.length;je++){Ae.push(36064+je),V.depthBuffer&&Ae.push(ke);let Le=Ie.__ignoreDepthValues!==void 0?Ie.__ignoreDepthValues:!1;if(Le===!1&&(V.depthBuffer&&(R|=256),V.stencilBuffer&&(R|=1024)),ce&&e.framebufferRenderbuffer(36008,36064,36161,Ie.__webglColorRenderbuffer[je]),Le===!0&&(e.invalidateFramebuffer(36008,[ke]),e.invalidateFramebuffer(36009,[ke])),ce){let Xe=r.get(z[je]).__webglTexture;e.framebufferTexture2D(36009,36064,3553,Xe,0)}e.blitFramebuffer(0,0,oe,Se,0,0,oe,Se,R,9728),p&&e.invalidateFramebuffer(36008,Ae)}if(i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,null),ce)for(let je=0;je<z.length;je++){i.bindFramebuffer(36160,Ie.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+je,36161,Ie.__webglColorRenderbuffer[je]);let Le=r.get(z[je]).__webglTexture;i.bindFramebuffer(36160,Ie.__webglFramebuffer),e.framebufferTexture2D(36009,36064+je,3553,Le,0)}i.bindFramebuffer(36009,Ie.__webglMultisampledFramebuffer)}}function Oe(V){return Math.min(u,V.samples)}function Ee(V){let z=r.get(V);return o&&V.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&z.__useRenderToTexture!==!1}function Qe(V){let z=n.render.frame;f.get(V)!==z&&(f.set(V,z),V.update())}function qe(V,z){let oe=V.encoding,Se=V.format,R=V.type;return V.isCompressedTexture===!0||V.isVideoTexture===!0||V.format===Xv||oe!==js&&(oe===gt?o===!1?t.has("EXT_sRGB")===!0&&Se===oi?(V.format=Xv,V.minFilter=xt,V.generateMipmaps=!1):z=uM.sRGBToLinear(z):(Se!==oi||R!==Mr)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",oe)),z}this.allocateTextureUnit=U,this.resetTextureUnits=B,this.setTexture2D=q,this.setTexture2DArray=j,this.setTexture3D=X,this.setTextureCube=te,this.rebindTextures=Re,this.setupRenderTarget=Me,this.updateRenderTargetMipmap=Ve,this.updateMultisampleRenderTarget=Ne,this.setupDepthRenderbuffer=we,this.setupFrameBufferTexture=ie,this.useMultisampledRTT=Ee}function Mz(e,t,i){let r=i.isWebGL2;function s(a,n=null){let o;if(a===Mr)return 5121;if(a===l3)return 32819;if(a===h3)return 32820;if(a===a3)return 5120;if(a===n3)return 5122;if(a===rM)return 5123;if(a===o3)return 5124;if(a===sn)return 5125;if(a===Ht)return 5126;if(a===dn)return r?5131:(o=t.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(a===c3)return 6406;if(a===oi)return 6408;if(a===u3)return 6409;if(a===d3)return 6410;if(a===Xo)return 6402;if(a===el)return 34041;if(a===Xv)return o=t.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(a===Mp)return 6403;if(a===p3)return 36244;if(a===Hp)return 33319;if(a===f3)return 33320;if(a===sM)return 36249;
vendor: 5,468 bytes, line 3139
3139if(a===Lm||a===zm||a===Bm||a===Fm)if(n===gt)if(o=t.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(a===Lm)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(a===zm)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(a===Bm)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(a===Fm)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=t.get("WEBGL_compressed_texture_s3tc"),o!==null){if(a===Lm)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===zm)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===Bm)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===Fm)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===qx||a===Xx||a===Yx||a===Qx)if(o=t.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(a===qx)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===Xx)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===Yx)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===Qx)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===m3)return o=t.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(a===Kx||a===Zx)if(o=t.get("WEBGL_compressed_texture_etc"),o!==null){if(a===Kx)return n===gt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(a===Zx)return n===gt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(a===Jx||a===$x||a===eb||a===tb||a===ib||a===rb||a===sb||a===ab||a===nb||a===ob||a===lb||a===hb||a===cb||a===ub)if(o=t.get("WEBGL_compressed_texture_astc"),o!==null){if(a===Jx)return n===gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(a===$x)return n===gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(a===eb)return n===gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(a===tb)return n===gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(a===ib)return n===gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(a===rb)return n===gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(a===sb)return n===gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(a===ab)return n===gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(a===nb)return n===gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(a===ob)return n===gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(a===lb)return n===gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(a===hb)return n===gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(a===cb)return n===gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(a===ub)return n===gt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(a===km)if(o=t.get("EXT_texture_compression_bptc"),o!==null){if(a===km)return n===gt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(a===g3||a===db||a===pb||a===fb)if(o=t.get("EXT_texture_compression_rgtc"),o!==null){if(a===km)return o.COMPRESSED_RED_RGTC1_EXT;if(a===db)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(a===pb)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(a===fb)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return a===qo?r?34042:(o=t.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):e[a]!==void 0?e[a]:null}return{convert:s}}var Ez=class extends wr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}},nn=class extends Vt{constructor(){super(),this.isGroup=!0,this.type="Group"}},Cz={type:"move"},cg=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new nn,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 nn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new M,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new M),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new nn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new M,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new M),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 i of e.hand.values())this._getHandJoint(t,i)}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,i){let r=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 f of e.hand.values()){let m=t.getJointPose(f,i),g=this._getHandJoint(l,f);m!==null&&(g.matrix.fromArray(m.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.jointRadius=m.radius),g.visible=m!==null}let h=l.joints["index-finger-tip"],c=l.joints["thumb-tip"],u=h.position.distanceTo(c.position),d=.02,p=.005;l.inputState.pinching&&u>
vendor: 4,161 bytes, line 3139
3139d+p?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&u<=d-p&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else o!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(o.matrix.fromArray(s.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),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));n!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(n.matrix.fromArray(r.transform.matrix),n.matrix.decompose(n.position,n.rotation,n.scale),r.linearVelocity?(n.hasLinearVelocity=!0,n.linearVelocity.copy(r.linearVelocity)):n.hasLinearVelocity=!1,r.angularVelocity?(n.hasAngularVelocity=!0,n.angularVelocity.copy(r.angularVelocity)):n.hasAngularVelocity=!1,this.dispatchEvent(Cz)))}return n!==null&&(n.visible=r!==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 i=new nn;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}},Ah=class extends li{constructor(e,t,i,r,s,a,n,o,l,h){if(h=h!==void 0?h:Xo,h!==Xo&&h!==el)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&h===Xo&&(i=sn),i===void 0&&h===el&&(i=qo),super(null,r,s,a,n,o,h,i,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=n!==void 0?n:St,this.minFilter=o!==void 0?o:St,this.flipY=!1,this.generateMipmaps=!1}},Tz=class extends or{constructor(e,t){super();let i=this,r=null,s=1,a=null,n="local-floor",o=1,l=null,h=null,c=null,u=null,d=null,p=null,f=t.getContextAttributes(),m=null,g=null,v=[],y=[],x=new Set,w=new Map,S=new wr;S.layers.enable(1),S.viewport=new ot;let b=new wr;b.layers.enable(2),b.viewport=new ot;let E=[S,b],_=new Ez;_.layers.enable(1),_.layers.enable(2);let A=null,C=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(j){let X=v[j];return X===void 0&&(X=new cg,v[j]=X),X.getTargetRaySpace()},this.getControllerGrip=function(j){let X=v[j];return X===void 0&&(X=new cg,v[j]=X),X.getGripSpace()},this.getHand=function(j){let X=v[j];return X===void 0&&(X=new cg,v[j]=X),X.getHandSpace()};function T(j){let X=y.indexOf(j.inputSource);if(X===-1)return;let te=v[X];te!==void 0&&te.dispatchEvent({type:j.type,data:j.inputSource})}function I(){r.removeEventListener("select",T),r.removeEventListener("selectstart",T),r.removeEventListener("selectend",T),r.removeEventListener("squeeze",T),r.removeEventListener("squeezestart",T),r.removeEventListener("squeezeend",T),r.removeEventListener("end",I),r.removeEventListener("inputsourceschange",P);for(let j=0;j<v.length;j++){let X=y[j];X!==null&&(y[j]=null,v[j].disconnect(X))}A=null,C=null,e.setRenderTarget(m),d=null,u=null,c=null,r=null,g=null,q.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(j){s=j,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(j){n=j,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(j){l=j},this.getBaseLayer=function(){return u!==null?u:d},this.getBinding=function(){return c},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(j){if(r=j,r!==null){if(m=e.getRenderTarget(),r.addEventListener("select",T),r.addEventListener("selectstart",T),r.addEventListener("selectend",T),r.addEventListener("squeeze",T),r.addEventListener("squeezestart",T),r.addEventListener("squeezeend",T),r.addEventListener("end",I),r.addEventListener("inputsourceschange",P),f.xrCompatible!==!0&&await t.makeXRCompatible(),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let X={antialias:r.render
3139State.layers===void 0?f.antialias:!0,alpha:f.alpha,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(r,t,X),r.updateRenderState({baseLayer:d}),g=new Pt(d.framebufferWidth,d.framebufferHeight,{format:oi,type:Mr,encoding:e.outputEncoding,stencilBuffer:f.stencil})}else{let X=null,te=null,K=null;f.depth&&(K=f.stencil?35056:33190,X=f.stencil?el:Xo,te=f.stencil?qo:sn);let Z={colorFormat:32856,depthFormat:K,scaleFactor:s};c=new XRWebGLBinding(r,t),u=c.createProjectionLayer(Z),r.updateRenderState({layers:[u]}),g=new Pt(u.textureWidth,u.textureHeight,{format:oi,type:Mr,depthTexture:new Ah(u.textureWidth,u.textureHeight,te,void 0,void 0,void 0,void 0,void 0,void 0,X),stencilBuffer:f.stencil,encoding:e.outputEncoding,samples:f.antialias?4:0});let W=e.properties.get(g);W.__ignoreDepthValues=u.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await r.requestReferenceSpace(n),q.setContext(r),q.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};function P(j){for(let X=0;X<j.removed.length;X++){let te=j.removed[X],K=y.indexOf(te);K>=0&&(y[K]=null,v[K].disconnect(te))}for(let X=0;X<j.added.length;X++){let te=j.added[X],K=y.indexOf(te);if(K===-1){for(let W=0;W<v.length;W++)if(W>=y.length){y.push(te),K=W;break}else if(y[W]===null){y[W]=te,K=W;break}if(K===-1)break}let Z=v[K];Z&&Z.connect(te)}}let O=new M,k=new M;function G(j,X,te){O.setFromMatrixPosition(X.matrixWorld),k.setFromMatrixPosition(te.matrixWorld);let K=O.distanceTo(k),Z=X.projectionMatrix.elements,W=te.projectionMatrix.elements,re=Z[14]/(Z[10]-1),$=Z[14]/(Z[10]+1),ne=(Z[9]+1)/Z[5],ie=(Z[9]-1)/Z[5],ve=(Z[8]-1)/Z[0],de=(W[8]+1)/W[0],we=re*ve,Re=re*de,Me=K/(-ve+de),Ve=Me*-ve;X.matrixWorld.decompose(j.position,j.quaternion,j.scale),j.translateX(Ve),j.translateZ(Me),j.matrixWorld.compose(j.position,j.quaternion,j.scale),j.matrixWorldInverse.copy(j.matrixWorld).invert();let Ne=re+Me,Oe=$+Me,Ee=we-Ve,Qe=Re+(K-Ve),qe=ne*$/Oe*Ne,V=ie*$/Oe*Ne;j.projectionMatrix.makePerspective(Ee,Qe,qe,V,Ne,Oe)}function B(j,X){X===null?j.matrixWorld.copy(j.matrix):j.matrixWorld.multiplyMatrices(X.matrixWorld,j.matrix),j.matrixWorldInverse.copy(j.matrixWorld).invert()}this.updateCamera=function(j){if(r===null)return;_.near=b.near=S.near=j.near,_.far=b.far=S.far=j.far,(A!==_.near||C!==_.far)&&(r.updateRenderState({depthNear:_.near,depthFar:_.far}),A=_.near,C=_.far);let X=j.parent,te=_.cameras;B(_,X);for(let Z=0;Z<te.length;Z++)B(te[Z],X);_.matrixWorld.decompose(_.position,_.quaternion,_.scale),j.matrix.copy(_.matrix),j.matrix.decompose(j.position,j.quaternion,j.scale);let K=j.children;for(let Z=0,W=K.length;Z<W;Z++)K[Z].updateMatrixWorld(!0);te.length===2?G(_,S,b):_.projectionMatrix.copy(S.projectionMatrix)},this.getCamera=function(){return _},this.getFoveation=function(){if(!(u===null&&d===null))return o},this.setFoveation=function(j){o=j,u!==null&&(u.fixedFoveation=j),d!==null&&d.fixedFoveation!==void 0&&(d.fixedFoveation=j)},this.getPlanes=function(){return x};let U=null;function Q(j,X){if(h=X.getViewerPose(l||a),p=X,h!==null){let te=h.views;d!==null&&(e.setRenderTargetFramebuffer(g,d.framebuffer),e.setRenderTarget(g));let K=!1;te.length!==_.cameras.length&&(_.cameras.length=0,K=!0);for(let Z=0;Z<te.length;Z++){let W=te[Z],re=null;if(d!==null)re=d.getViewport(W);else{let ne=c.getViewSubImage(u,W);re=ne.viewport,Z===0&&(e.setRenderTargetTextures(g,ne.colorTexture,u.ignoreDepthValues?void 0:ne.depthStencilTexture),e.setRenderTarget(g))}let $=E[Z];$===void 0&&($=new wr,$.layers.enable(Z),$.viewport=new ot,E[Z]=$),$.matrix.fromArray(W.transform.matrix),$.projectionMatrix.fromArray(W.projectionMatrix),$.viewport.set(re.x,re.y,re.width,re.height),Z===0&&_.matrix.copy($.matrix),K===!0&&_.cameras.push($)}}for(let te=0;te<v.length;te++){let K=y[te],Z=v[te];K!==null&&Z!==void 0&&Z.update(K,X,l||a)}if(U&&U(j,X),X.detectedPlanes){i.dispatchEvent({type:"planesdetected",data:X.detectedPlanes});let te=null;for(let K of x)X.detectedPlanes.has(K)||(te===null&&(te=[]),te.push(K));if(te!==null)for(let K of te)x.delete(K),w.delete(K),i.dispatchEvent({type:"planeremoved",data:K});for(let K of X.detectedPlanes)if(!x.has(K))x.add(K),w.set(K,X.lastChangedTime),i.dispatchEvent({type:"planeadded",data:K});else{let Z=w.get(K);K.lastChangedTime>
3139Z&&(w.set(K,K.lastChangedTime),i.dispatchEvent({type:"planechanged",data:K}))}}p=null}let q=new vM;q.setAnimationLoop(Q),this.setAnimationLoop=function(j){U=j},this.dispose=function(){}}};function Pz(e,t){function i(m,g){g.color.getRGB(m.fogColor.value,gM(e)),g.isFog?(m.fogNear.value=g.near,m.fogFar.value=g.far):g.isFogExp2&&(m.fogDensity.value=g.density)}function r(m,g,v,y,x){g.isMeshBasicMaterial||g.isMeshLambertMaterial?s(m,g):g.isMeshToonMaterial?(s(m,g),c(m,g)):g.isMeshPhongMaterial?(s(m,g),h(m,g)):g.isMeshStandardMaterial?(s(m,g),u(m,g),g.isMeshPhysicalMaterial&&d(m,g,x)):g.isMeshMatcapMaterial?(s(m,g),p(m,g)):g.isMeshDepthMaterial?s(m,g):g.isMeshDistanceMaterial?(s(m,g),f(m,g)):g.isMeshNormalMaterial?s(m,g):g.isLineBasicMaterial?(a(m,g),g.isLineDashedMaterial&&n(m,g)):g.isPointsMaterial?o(m,g,v,y):g.isSpriteMaterial?l(m,g):g.isShadowMaterial?(m.color.value.copy(g.color),m.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function s(m,g){m.opacity.value=g.opacity,g.color&&m.diffuse.value.copy(g.color),g.emissive&&m.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.bumpMap&&(m.bumpMap.value=g.bumpMap,m.bumpScale.value=g.bumpScale,g.side===sr&&(m.bumpScale.value*=-1)),g.displacementMap&&(m.displacementMap.value=g.displacementMap,m.displacementScale.value=g.displacementScale,m.displacementBias.value=g.displacementBias),g.emissiveMap&&(m.emissiveMap.value=g.emissiveMap),g.normalMap&&(m.normalMap.value=g.normalMap,m.normalScale.value.copy(g.normalScale),g.side===sr&&m.normalScale.value.negate()),g.specularMap&&(m.specularMap.value=g.specularMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let v=t.get(g).envMap;if(v&&(m.envMap.value=v,m.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=g.reflectivity,m.ior.value=g.ior,m.refractionRatio.value=g.refractionRatio),g.lightMap){m.lightMap.value=g.lightMap;let w=e.physicallyCorrectLights!==!0?Math.PI:1;m.lightMapIntensity.value=g.lightMapIntensity*w}g.aoMap&&(m.aoMap.value=g.aoMap,m.aoMapIntensity.value=g.aoMapIntensity);let y;g.map?y=g.map:g.specularMap?y=g.specularMap:g.displacementMap?y=g.displacementMap:g.normalMap?y=g.normalMap:g.bumpMap?y=g.bumpMap:g.roughnessMap?y=g.roughnessMap:g.metalnessMap?y=g.metalnessMap:g.alphaMap?y=g.alphaMap:g.emissiveMap?y=g.emissiveMap:g.clearcoatMap?y=g.clearcoatMap:g.clearcoatNormalMap?y=g.clearcoatNormalMap:g.clearcoatRoughnessMap?y=g.clearcoatRoughnessMap:g.iridescenceMap?
3139y=g.iridescenceMap:g.iridescenceThicknessMap?y=g.iridescenceThicknessMap:g.specularIntensityMap?y=g.specularIntensityMap:g.specularColorMap?y=g.specularColorMap:g.transmissionMap?y=g.transmissionMap:g.thicknessMap?y=g.thicknessMap:g.sheenColorMap?y=g.sheenColorMap:g.sheenRoughnessMap&&(y=g.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),m.uvTransform.value.copy(y.matrix));let x;g.aoMap?x=g.aoMap:g.lightMap&&(x=g.lightMap),x!==void 0&&(x.isWebGLRenderTarget&&(x=x.texture),x.matrixAutoUpdate===!0&&x.updateMatrix(),m.uv2Transform.value.copy(x.matrix))}function a(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity}function n(m,g){m.dashSize.value=g.dashSize,m.totalSize.value=g.dashSize+g.gapSize,m.scale.value=g.scale}function o(m,g,v,y){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.size.value=g.size*v,m.scale.value=y*.5,g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let x;g.map?x=g.map:g.alphaMap&&(x=g.alphaMap),x!==void 0&&(x.matrixAutoUpdate===!0&&x.updateMatrix(),m.uvTransform.value.copy(x.matrix))}function l(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.rotation.value=g.rotation,g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let v;g.map?v=g.map:g.alphaMap&&(v=g.alphaMap),v!==void 0&&(v.matrixAutoUpdate===!0&&v.updateMatrix(),m.uvTransform.value.copy(v.matrix))}function h(m,g){m.specular.value.copy(g.specular),m.shininess.value=Math.max(g.shininess,1e-4)}function c(m,g){g.gradientMap&&(m.gradientMap.value=g.gradientMap)}function u(m,g){m.roughness.value=g.roughness,m.metalness.value=g.metalness,g.roughnessMap&&(m.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(m.metalnessMap.value=g.metalnessMap),t.get(g).envMap&&(m.envMapIntensity.value=g.envMapIntensity)}function d(m,g,v){m.ior.value=g.ior,g.sheen>0&&(m.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),m.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(m.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(m.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(m.clearcoat.value=g.clearcoat,m.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(m.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(m.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),m.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===sr&&m.clearcoatNormalScale.value.negate())),g.iridescence>0&&(m.iridescence.value=g.iridescence,m.iridescenceIOR.value=g.iridescenceIOR,m.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(m.iridescenceMap.value=g.iridescenceMap),g.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=g.iridescenceThicknessMap)),g.transmission>0&&(m.transmission.value=g.transmission,m.transmissionSamplerMap.value=v.texture,m.transmissionSamplerSize.value.set(v.width,v.height),g.transmissionMap&&(m.transmissionMap.value=g.transmissionMap),m.thickness.value=g.thickness,g.thicknessMap&&(m.thicknessMap.value=g.thicknessMap),m.attenuationDistance.value=g.attenuationDistance,m.attenuationColor.value.copy(g.attenuationColor)),m.specularIntensity.value=g.specularIntensity,m.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(m.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(m.specularColorMap.value=g.specularColorMap)}function p(m,g){g.matcap&&(m.matcap.value=g.matcap)}function f(m,g){m.referencePosition.value.copy(g.referencePosition),m.nearDistance.value=g.nearDistance,m.farDistance.value=g.farDistance}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Dz(e,t,i,r){let s={},a={},n=[],o=i.isWebGL2?e.getParameter(35375):0;function l(y,x){let w=x.program;r.uniformBlockBinding(y,w)}function h(y,x){let w=s[y.id];w===void 0&&(f(y),w=c(y),s[y.id]=w,y.addEventListener("dispose",g));let S=x.program;r.updateUBOMapping(y,S);let b=t.render.frame;a[y.id]!==b&&(d(y),a[y.id]=b)}function c(y){let x=u();y.__bindingPointIndex=x;let w=e.createBuffer(),S=y.__size,b=y.usage;return e.bindBuffer(35345,w),e.bufferData(35345,S,b),e.bindBuffer(35345,null),e.bindBufferBase(35345,x,w),w}function u(){for(let y=0;y<o;y++)if(n.indexOf(y)===-1)return n.push(y),y;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(y){let x=s[y.id],w=y.uniforms,S=y.__cache;e.bindBuffer(35345,x);for(let b=0,E=w.length;b<E;b++){let _=w[b];if(p(_,b,S)===!0){let A=_.__offset,C=Array.isArray(_.value)?_.value:[_.value],T=0;for(let I=0;I<C.length;I++){let P=C[I],O=m(P);typeof P=="number"?(_.__data[0]=P,e.bufferSubData(35345,A+T,_.__data)):P.isMatrix3?(_.__data[0]=P.elements[0],_.__data[1]=P.elements[1],_.__data[2]=P.elements[2],_.__data[3]=P.elements[0],_.__data[4]=P.elements[3],_.__data[5]=P.elements[4],_.__data[6]=P.elements[5],_.__data[7]=P.elements[0],_.__data[8]=P.elements[6],_.__data[9]=P.elements[7],_.__data[10]=P.elements[8],_.__data[11]=P.elements[0]):(P.toArray(_.__data,T),T+=O.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(35345,A,_.__data)}}e.bindBuffer(35345,null)}function p(y,x,w){let S=y.value;if(w[x]===void 0){if(typeof S=="number")w[x]=S;else{let b=Array.isArray(S)?S:[S],E=[];for(let _=0;_<b.length;_++)E.push(b[_].clone());w[x]=E}return!0}
3139else if(typeof S=="number"){if(w[x]!==S)return w[x]=S,!0}else{let b=Array.isArray(w[x])?w[x]:[w[x]],E=Array.isArray(S)?S:[S];for(let _=0;_<b.length;_++){let A=b[_];if(A.equals(E[_])===!1)return A.copy(E[_]),!0}}return!1}function f(y){let x=y.uniforms,w=0,S=16,b=0;for(let E=0,_=x.length;E<_;E++){let A=x[E],C={boundary:0,storage:0},T=Array.isArray(A.value)?A.value:[A.value];for(let I=0,P=T.length;I<P;I++){let O=T[I],k=m(O);C.boundary+=k.boundary,C.storage+=k.storage}if(A.__data=new Float32Array(C.storage/Float32Array.BYTES_PER_ELEMENT),A.__offset=w,E>0){b=w%S;let I=S-b;b!==0&&I-C.boundary<0&&(w+=S-b,A.__offset=w)}w+=C.storage}return b=w%S,b>0&&(w+=S-b),y.__size=w,y.__cache={},this}function m(y){let x={boundary:0,storage:0};return typeof y=="number"?(x.boundary=4,x.storage=4):y.isVector2?(x.boundary=8,x.storage=8):y.isVector3||y.isColor?(x.boundary=16,x.storage=12):y.isVector4?(x.boundary=16,x.storage=16):y.isMatrix3?(x.boundary=48,x.storage=48):y.isMatrix4?(x.boundary=64,x.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),x}function g(y){let x=y.target;x.removeEventListener("dispose",g);let w=n.indexOf(x.__bindingPointIndex);n.splice(w,1),e.deleteBuffer(s[x.id]),delete s[x.id],delete a[x.id]}function v(){for(let y in s)e.deleteBuffer(s[y]);n=[],s={},a={}}return{bind:l,update:h,dispose:v}}function Oz(){let e=du("canvas");return e.style.display="block",e}function _M(e={}){this.isWebGLRenderer=!0;let t=e.canvas!==void 0?e.canvas:Oz(),i=e.context!==void 0?e.context:null,r=e.depth!==void 0?e.depth:!0,s=e.stencil!==void 0?e.stencil:!0,a=e.antialias!==void 0?e.antialias:!1,n=e.premultipliedAlpha!==void 0?e.premultipliedAlpha:!0,o=e.preserveDrawingBuffer!==void 0?e.preserveDrawingBuffer:!1,l=e.powerPreference!==void 0?e.powerPreference:"default",h=e.failIfMajorPerformanceCaveat!==void 0?e.failIfMajorPerformanceCaveat:!1,c;i!==null?c=i.getContextAttributes().alpha:c=e.alpha!==void 0?e.alpha:!1;let u=null,d=null,p=[],f=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=js,this.physicallyCorrectLights=!1,this.toneMapping=ya,this.toneMappingExposure=1;let m=this,g=!1,v=0,y=0,x=null,w=-1,S=null,b=new ot,E=new ot,_=null,A=t.width,C=t.height,T=1,I=null,P=null,O=new ot(0,0,A,C),k=new ot(0,0,A,C),G=!1,B=new e1,U=!1,Q=!1,q=null,j=new xe,X=new H,te=new M,K={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Z(){return x===null?T:1}let W=i;function re(N,le){for(let pe=0;pe<N.length;pe++){let ae=N[pe],me=t.getContext(ae,le);if(me!==null)return me}return null}try{let N={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:n,preserveDrawingBuffer:o,powerPreference:l,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Uh}`),t.addEventListener("webglcontextlost",it,!1),t.addEventListener("webglcontextrestored",Ke,!1),t.addEventListener("webglcontextcreationerror",$e,!1),W===null){let le=["webgl2","webgl","experimental-webgl"];if(m.isWebGL1Renderer===!0&&le.shift(),W=re(le,N),W===null)throw re(le)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}W.getShaderPrecisionFormat===void 0&&(W.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(N){throw console.error("THREE.WebGLRenderer: "+N.message),N}let $,ne,ie,ve,de,we,Re,Me,Ve,Ne,Oe,Ee,Qe,qe,V,z,oe,Se,R,Ae,ke,Ie,ce,je;function Le(){$=new GR(W),ne=new kR(W,$,e),$.init(ne),Ie=new Mz(W,$,ne),ie=new _z(W,$,ne),ve=new XR,de=new cz,we=new Az(W,$,ie,de,ne,Ie,ve),Re=new NR(m),Me=new HR(m),Ve=new iO(W,ne),ce=new BR(W,$,Ve,ne),Ne=new WR(W,Ve,ve,ce),Oe=new ZR(W,Ne,Ve,ve),R=new KR(W,ne,we),z=new UR(de),Ee=new hz(m,Re,Me,$,ne,ce,z),Qe=new Pz(m,de),qe=new dz,V=new yz($,ne),Se=new zR(m,Re,Me,ie,Oe,c,n),oe=new Sz(m,Oe,ne),je=new Dz(W,ve,ne,ie),Ae=new FR(W,$,ve,ne),ke=new qR(W,$,ve,ne),ve.programs=Ee.programs,m.capabilities=ne,m.extensions=$,m.properties=de,m.renderLists=qe,m.shadowMap=oe,m.
vendor: 2,405 bytes, line 3139
3139state=ie,m.info=ve}Le();let Xe=new Tz(m,W);this.xr=Xe,this.getContext=function(){return W},this.getContextAttributes=function(){return W.getContextAttributes()},this.forceContextLoss=function(){let N=$.get("WEBGL_lose_context");N&&N.loseContext()},this.forceContextRestore=function(){let N=$.get("WEBGL_lose_context");N&&N.restoreContext()},this.getPixelRatio=function(){return T},this.setPixelRatio=function(N){N!==void 0&&(T=N,this.setSize(A,C,!1))},this.getSize=function(N){return N.set(A,C)},this.setSize=function(N,le,pe){if(Xe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}A=N,C=le,t.width=Math.floor(N*T),t.height=Math.floor(le*T),pe!==!1&&(t.style.width=N+"px",t.style.height=le+"px"),this.setViewport(0,0,N,le)},this.getDrawingBufferSize=function(N){return N.set(A*T,C*T).floor()},this.setDrawingBufferSize=function(N,le,pe){A=N,C=le,T=pe,t.width=Math.floor(N*pe),t.height=Math.floor(le*pe),this.setViewport(0,0,N,le)},this.getCurrentViewport=function(N){return N.copy(b)},this.getViewport=function(N){return N.copy(O)},this.setViewport=function(N,le,pe,ae){N.isVector4?O.set(N.x,N.y,N.z,N.w):O.set(N,le,pe,ae),ie.viewport(b.copy(O).multiplyScalar(T).floor())},this.getScissor=function(N){return N.copy(k)},this.setScissor=function(N,le,pe,ae){N.isVector4?k.set(N.x,N.y,N.z,N.w):k.set(N,le,pe,ae),ie.scissor(E.copy(k).multiplyScalar(T).floor())},this.getScissorTest=function(){return G},this.setScissorTest=function(N){ie.setScissorTest(G=N)},this.setOpaqueSort=function(N){I=N},this.setTransparentSort=function(N){P=N},this.getClearColor=function(N){return N.copy(Se.getClearColor())},this.setClearColor=function(){Se.setClearColor.apply(Se,arguments)},this.getClearAlpha=function(){return Se.getClearAlpha()},this.setClearAlpha=function(){Se.setClearAlpha.apply(Se,arguments)},this.clear=function(N=!0,le=!0,pe=!0){let ae=0;N&&(ae|=16384),le&&(ae|=256),pe&&(ae|=1024),W.clear(ae)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",it,!1),t.removeEventListener("webglcontextrestored",Ke,!1),t.removeEventListener("webglcontextcreationerror",$e,!1),qe.dispose(),V.dispose(),de.dispose(),Re.dispose(),Me.dispose(),Oe.dispose(),ce.dispose(),je.dispose(),Ee.dispose(),Xe.dis
3139pose(),Xe.removeEventListener("sessionstart",ze),Xe.removeEventListener("sessionend",lt),q&&(q.dispose(),q=null),Et.stop()};function it(N){N.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function Ke(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;let N=ve.autoReset,le=oe.enabled,pe=oe.autoUpdate,ae=oe.needsUpdate,me=oe.type;Le(),ve.autoReset=N,oe.enabled=le,oe.autoUpdate=pe,oe.needsUpdate=ae,oe.type=me}function $e(N){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",N.statusMessage)}function qt(N){let le=N.target;le.removeEventListener("dispose",qt),hi(le)}function hi(N){J(N),de.remove(N)}function J(N){let le=de.get(N).programs;le!==void 0&&(le.forEach(function(pe){Ee.releaseProgram(pe)}),N.isShaderMaterial&&Ee.releaseShaderCache(N))}this.renderBufferDirect=function(N,le,pe,ae,me,Ge){le===null&&(le=K);let ut=me.isMesh&&me.matrixWorld.determinant()<0,pt=Tm(N,le,pe,ae,me);ie.setMaterial(ae,ut);let et=pe.index,zt=1;ae.wireframe===!0&&(et=Ne.getWireframeAttribute(pe),zt=2);let bt=pe.drawRange,wt=pe.attributes.position,vt=bt.start*zt,Fi=(bt.start+bt.count)*zt;Ge!==null&&(vt=Math.max(vt,Ge.start*zt),Fi=Math.min(Fi,(Ge.start+Ge.count)*zt)),et!==null?(vt=Math.max(vt,0),Fi=Math.min(Fi,et.count)):wt!=null&&(vt=Math.max(vt,0),Fi=Math.min(Fi,wt.count));let as=Fi-vt;if(as<0||as===1/0)return;ce.setup(me,ae,pt,pe,et);let Pa,ci=Ae;if(et!==null&&(Pa=Ve.get(et),ci=ke,ci.setIndex(Pa)),me.isMesh)ae.wireframe===!0?(ie.setLineWidth(ae.wireframeLinewidth*Z()),ci.setMode(1)):ci.setMode(4);else if(me.isLine){let At=ae.linewidth;At===void 0&&(At=1),ie.setLineWidth(At*Z()),me.isLineSegments?ci.setMode(1):me.isLineLoop?ci.setMode(2):ci.setMode(3)}else me.isPoints?ci.setMode(0):me.isSprite&&ci.setMode(4);if(me.isInstancedMesh)ci.renderInstances(vt,as,me.count);else if(pe.isInstancedBufferGeometry){let At=pe._maxInstanceCount!==void 0?pe._maxInstanceCount:1/0,_s=Math.min(pe.instanceCount,At);ci.renderInstances(vt,as,_s)}else ci.render(vt,as)},this.compile=function(N,le){function pe(ae,me,Ge){ae.transparent===!0&&ae.side===Ar&&ae.forceSinglePass===!1?(ae.side=sr,ae.needsUpdate=!0,Ur(ae,me,Ge),ae.side=Vs,ae.needsUpdate=!0,Ur(ae,me,Ge),ae.side=Ar):Ur(ae,me,Ge)}d=V.get(N),d.init(),f.push(d),N.traverseVisible(function(ae){ae.isLight&&ae.layers.test(le.layers)&&(d.pushLight(ae),ae.castShadow&&d.pushShadow(ae))}),d.setupLights(m.physicallyCorrectLights),N.traverse(function(ae){let me=ae.material;if(me)if(Array.isArray(me))for(let Ge=0;Ge<me.length;Ge++){let ut=me[Ge];pe(ut,N,ae)}else pe(me,N,ae)}),f.pop(),d=null};let fe=null;function be(N){fe&&fe(N)}function ze(){Et.stop()}function lt(){Et.start()}let Et=new vM;Et.setAnimationLoop(be),typeof self<"u"&&Et.setContext(self),this.setAnimationLoop=function(N){fe=N,Xe.setAnimationLoop(N),N===null?Et.stop():Et.start()},Xe.addEventListener("sessionstart",ze),Xe.addEventListener("sessionend",lt),this.render=function(N,le){if(le!==void 0&&le.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(g===!0)return;N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),le.parent===null&&le.matrixWorldAutoUpdate===!0&&le.updateMatrixWorld(),Xe.enabled===!0&&Xe.isPresenting===!0&&(Xe.cameraAutoUpdate===!0&&Xe.updateCamera(le),le=Xe.getCamera()),N.isScene===!0&&N.onBeforeRender(m,N,le,x),d=V.get(N,f.length),d.init(),f.push(d),j.multiplyMatrices(le.projectionMatrix,le.matrixWorldInverse),B.setFromProjectionMatrix(j),Q=this.localClippingEnabled,U=z.init(this.clippingPlanes,Q),u=qe.get(N,p.length),u.init(),p.push(u),xi(N,le,0,m.sortObjects),u.finish(),m.sortObjects===!0&&u.sort(I,P),U===!0&&z.beginShadows();let pe=d.state.shadowsArray;if(oe.render(pe,N,le),U===!0&&z.endShadows(),this.info.autoReset===!0&&this.info.reset(),Se.render(u,N),d.setupLights(m.physicallyCorrectLights),le.isArrayCamera){let ae=le.cameras;for(let me=0,Ge=ae.length;me<Ge;me++){let ut=ae[me];Ki(u,N,ut,ut.viewport)}}else Ki(u,N,le);x!==null&&(we.updateMultisampleRenderTarget(x),we.updateRenderTargetMipmap(x)),N.isScene===!0&&N.onAfterRender(m,N,le),ce.resetDefaultState(),w=-1,S=null,f.pop(),f.length>0?d=f[f.length-1]:d=null,p.pop(),p.length>0?u=p[p.length-1]:u=null};function xi(N,le,pe,ae){if(N.visible===!1)return;if(N.layers.test(le.layers)){if(N.isGroup)pe=N.renderOrder;else if(N.isLOD)N.autoUpdate===!0&&N.update(le);else if(N.isLight)d.pushLight(N),N.castShadow&&d.pushShadow(N);else if(N.isSprite){if(!N.frustumCulled||B.intersectsSprite(N)){ae&&te.setFromMatrixPosition(N.matrixWorld).applyMatrix4(j);let Ge=Oe.update(N),ut=N.material;ut.visible&&u.push(N,Ge,ut,pe,te.z,null)}}else if((N.isMesh||N.isLine||N.isPoints)&&(N.isSkinnedMesh&&N.skeleton.frame!==ve.render.frame&&(N.skeleton.update(),N.skeleton.frame=ve.render.frame),!N.frustumCulled||B.intersectsObject(N))){ae&&te.setFromMatrixPosition(N.matrixWorld).applyMatrix4(j);let Ge=Oe.update(N),ut=N.material;if(Array.isArray(ut)){let pt=Ge.groups;for(let et=0,zt=pt.length;et<zt;et++){let bt=pt[et],wt=ut[bt.materialIndex];wt&&wt.visible&&u.push(N,Ge,wt,pe,te.z,bt)}}else ut.visible&&u.push(N,Ge,ut,pe,te.z,null)}}let me=N.children;for(let Ge=0,ut=me.length;Ge<ut;Ge++)xi(me[Ge],le,pe,ae)}function Ki(N,le,pe,ae){let me=N.opaque,Ge=N.transmissive,ut=N.transparent;d.setupLightsView(pe),U===!0&&z.setGlobalState(m.clippingPlanes,pe),Ge.length>0&&qs(me,le,pe),ae&&ie.viewport(b.copy(ae)),me.length>0&&$t(me,le,pe),Ge.length>0&&$t(Ge,le,pe),ut.length>0&&$t(ut,le,pe),ie.buffers.depth.setTest(!0),ie.buffers.depth.setMask(!0),ie.buffers.color.setMask(!0),ie.setPolygonOffset(!1)}function qs(N,le,pe){let ae=ne.isWebGL2;q===null&&(q=new Pt(1,1,{generateMipmaps:!0,type:$.has("EXT_color_buffer_half_float")?dn:Mr,minFilter:Sh,samples:ae&&a===!0?4:0})),m.getDrawingBufferSize(X),ae?q.setSize(X.x,X.y):q.setSize(Yp(X.x),Yp(X.y));let me=m.getRenderTarget();m.setRenderTarget(q),m.clear();let Ge=m.toneMapping;m.toneMapping=ya,$t(N,le,pe),m.toneMapping=Ge,we.updateMultisampleRenderTarget(q),we.updateRenderTargetMipmap(q),m.setRenderTarget(me)}function $t(N,le,pe){let ae=le.isScene===!0?le.overrideMaterial:null;for(let me=0,Ge=N.length;me<Ge;me++){let ut=N[me],pt=ut.object,et=ut.geometry,zt=ae===null?ut.material:ae,bt=ut.group;
vendor: 9,619 bytes, line 3139
3139pt.layers.test(pe.layers)&&Ss(pt,le,pe,et,zt,bt)}}function Ss(N,le,pe,ae,me,Ge){N.onBeforeRender(m,le,pe,ae,me,Ge),N.modelViewMatrix.multiplyMatrices(pe.matrixWorldInverse,N.matrixWorld),N.normalMatrix.getNormalMatrix(N.modelViewMatrix),me.onBeforeRender(m,le,pe,ae,N,Ge),me.transparent===!0&&me.side===Ar&&me.forceSinglePass===!1?(me.side=sr,me.needsUpdate=!0,m.renderBufferDirect(pe,le,ae,me,N,Ge),me.side=Vs,me.needsUpdate=!0,m.renderBufferDirect(pe,le,ae,me,N,Ge),me.side=Ar):m.renderBufferDirect(pe,le,ae,me,N,Ge),N.onAfterRender(m,le,pe,ae,me,Ge)}function Ur(N,le,pe){le.isScene!==!0&&(le=K);let ae=de.get(N),me=d.state.lights,Ge=d.state.shadowsArray,ut=me.state.version,pt=Ee.getParameters(N,me.state,Ge,le,pe),et=Ee.getProgramCacheKey(pt),zt=ae.programs;ae.environment=N.isMeshStandardMaterial?le.environment:null,ae.fog=le.fog,ae.envMap=(N.isMeshStandardMaterial?Me:Re).get(N.envMap||ae.environment),zt===void 0&&(N.addEventListener("dispose",qt),zt=new Map,ae.programs=zt);let bt=zt.get(et);if(bt!==void 0){if(ae.currentProgram===bt&&ae.lightsStateVersion===ut)return pl(N,pt),bt}else pt.uniforms=Ee.getUniforms(N),N.onBuild(pe,pt,m),N.onBeforeCompile(pt,m),bt=Ee.acquireProgram(pt,et),zt.set(et,bt),ae.uniforms=pt.uniforms;let wt=ae.uniforms;(!N.isShaderMaterial&&!N.isRawShaderMaterial||N.clipping===!0)&&(wt.clippingPlanes=z.uniform),pl(N,pt),ae.needsLights=ic(N),ae.lightsStateVersion=ut,ae.needsLights&&(wt.ambientLightColor.value=me.state.ambient,wt.lightProbe.value=me.state.probe,wt.directionalLights.value=me.state.directional,wt.directionalLightShadows.value=me.state.directionalShadow,wt.spotLights.value=me.state.spot,wt.spotLightShadows.value=me.state.spotShadow,wt.rectAreaLights.value=me.state.rectArea,wt.ltc_1.value=me.state.rectAreaLTC1,wt.ltc_2.value=me.state.rectAreaLTC2,wt.pointLights.value=me.state.point,wt.pointLightShadows.value=me.state.pointShadow,wt.hemisphereLights.value=me.state.hemi,wt.directionalShadowMap.value=me.state.directionalShadowMap,wt.directionalShadowMatrix.value=me.state.directionalShadowMatrix,wt.spotShadowMap.value=me.state.spotShadowMap,wt.spotLightMatrix.value=me.state.spotLightMatrix,wt.spotLightMap.value=me.state.spotLightMap,wt.pointShadowMap.value=me.state.pointShadowMap,wt.pointShadowMatrix.value=me.state.pointShadowMatrix);let vt=bt.getUniforms(),Fi=Cp.seqWithValue(vt.seq,wt);return ae.currentProgram=bt,ae.uniformsList=Fi,bt}function pl(N,le){let pe=de.get(N);pe.outputEncoding=le.outputEncoding,pe.instancing=le.instancing,pe.skinning=le.skinning,pe.morphTargets=le.morphTargets,pe.morphNormals=le.morphNormals,pe.morphColors=le.morphColors,pe.morphTargetsCount=le.morphTargetsCount,pe.numClippingPlanes=le.numClippingPlanes,pe.numIntersection=le.numClipIntersection,pe.vertexAlphas=le.vertexAlphas,pe.vertexTangents=le.vertexTangents,pe.toneMapping=le.toneMapping}function Tm(N,le,pe,ae,me){le.isScene!==!0&&(le=K),we.resetTextureUnits();let Ge=le.fog,ut=ae.isMeshStandardMaterial?le.environment:null,pt=x===null?m.outputEncoding:x.isXRRenderTarget===!0?x.texture.encoding:js,et=(ae.isMeshStandardMaterial?Me:Re).get(ae.envMap||ut),zt=ae.vertexColors===!0&&!!pe.attributes.color&&pe.attributes.color.itemSize===4,bt=!!ae.normalMap&&!!pe.attributes.tangent,wt=!!pe.morphAttributes.position,vt=!!pe.morphAttributes.normal,Fi=!!pe.morphAttributes.color,as=ae.toneMapped?m.toneMapping:ya,Pa=pe.morphAttributes.position||pe.morphAttributes.normal||pe.morphAttributes.color,ci=Pa!==void 0?Pa.length:0,At=de.get(ae),_s=d.state.lights;if(U===!0&&(Q===!0||N!==S)){let F=N===S&&ae.id===w;z.setState(ae,N,F)}let _t=!1;ae.version===At.__version?(At.needsLights&&At.lightsStateVersion!==_s.state.version||At.outputEncoding!==pt||me.isInstancedMesh&&At.instancing===!1||!me.isInstancedMesh&&At.instancing===!0||me.isSkinnedMesh&&At.skinning===!1||!me.isSkinnedMesh&&At.skinning===!0||At.envMap!==et||ae.fog===!0&&At.fog!==Ge||At.numClippingPlanes!==void 0&&(At.numClippingPlanes!==z.numPlanes||At.numIntersection!==z.numIntersection)||At.vertexAlphas!==zt||At.vertexTangents!==bt||At.morphTargets!==wt||At.morphNormals!==vt||At.morphColors!==Fi||At.toneMapping!==as||ne.isWebGL2===!0&&At.morphTargetsCount!==ci)&&(_t=!0):(_t=!0,At.__version=ae.version);let Da=At.currentProgram;_t===!0&&(Da=Ur(ae,le,me));let xo=!1,wn=!1,Xs=!1,D=Da.getUniforms(),L=At.uniforms;if(ie.useProgram(Da.program)&&(xo=!0,wn=!0,Xs=!0),ae.id!==w&&(w=ae.id,wn=!0),xo||S!==N){if(D.setValue(W,"projectionMatrix",N.projectionMatrix),ne.logarithmicDepthBuffer&&D.setValue(W,"logDepthBufFC",2/(Math.log(N.far+1)/Math.LN2)),S!==N&&(S=N,wn=!0,Xs=!0),ae.isShaderMaterial||ae.isMeshPhongMaterial||ae.isMeshToonMaterial||ae.isMeshStandardMaterial||ae.envMap){let F=D.map.cameraPosition;F!==void 0&&F.setValue(W,te.setFromMatrixPosition(N.matrixWorld))}(ae.isMeshPhongMaterial||ae.isMeshToonMaterial||ae.isMeshLambertMaterial||ae.isMeshBasicMaterial||ae.isMeshStandardMaterial||ae.isShaderMaterial)&&D.setValue(W,"isOrthographic",N.isOrthographicCamera===!0),(ae.isMeshPhongMaterial||ae.isMeshToonMaterial||ae.isMeshLambertMaterial||ae.isMeshBasicMaterial||ae.isMeshStandardMaterial||ae.isShaderMaterial||ae.isShadowMaterial||me.isSkinnedMesh)&&D.setValue(W,"viewMatrix",N.matrixWorldInverse)}if(me.isSkinnedMesh){D.setOptional(W,me,"bindMatrix"),D.setOptional(W,me,"bindMatrixInverse");let F=me.skeleton;F&&(ne.floatVertexTextures?(F.boneTexture===null&&F.computeBoneTexture(),D.setValue(W,"boneTexture",F.boneTexture,we),D.setValue(W,"boneTextureSize",F.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}let Y=pe.morphAttributes;if((Y.position!==void 0||Y.normal!==void 0||Y.color!==void 0&&ne.isWebGL2===!0)&&R.update(me,pe,ae,Da),(wn||At.receiveShadow!==me.receiveShadow)&&(At.receiveShadow=me.receiveShadow,D.setValue(W,"receiveShadow",me.receiveShadow)),ae.isMeshGouraudMaterial&&ae.envMap!==null&&(L.envMap.value=et,L.flipEnvMap.value=et.isCubeTexture&&et.isRenderTargetTexture===!1?-1:1),wn&&(D.setValue(W,"toneMappingExposure",m.toneMappingExposure),At.needsLights&&Pm(L,Xs),Ge&&ae.fog===!0&&Qe.refreshFogUniforms(L,Ge),Qe.refreshMaterialUniforms(L,ae,T,C,q),Cp.upload(W,At.uniformsList,L,we)),ae.isShaderMaterial&&ae.uniformsNeedUpdate===!0&&(Cp.upload(W,At.uniformsList,L,we),ae.uniformsNeedUpdate=!1),ae.isSpriteMaterial&&D.setValue(W,"center",me.center),D.setValue(W,"modelViewMatrix",me.modelViewMatrix),D.setValue(W,"normalMatrix",me.normalMatrix),D.setValue(W,"modelMatrix",me.matrixWorld),me.previousModelViewMatrix&&D.setValue(W,"previousModelViewMatrix",me.previousModelViewMatrix),N.previousProjectionMatrix&&D.setValue(W,"previousProjectionMatrix",N.previousProjectionMatrix),ae.isShaderMaterial||ae.isRawShaderMaterial){let F=ae.uniformsGroups;for(let ee=0,_e=F.length;ee<_e;ee++)if(ne.isWebGL2){let Oa=F[ee];je.update(Oa,Da),je.bind(Oa,Da)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Da}function Pm(N,le){N.ambientLightColor.needsUpdate=le,N.lightProbe.needsUpdate=le,N.directionalLights.needsUpdate=le,N.directionalLightShadows.needsUpdate=le,N.pointLights.needsUpdate=le,N.pointLightShadows.needsUpdate=le,N.spotLights.needsUpdate=le,N.spotLightShadows.needsUpdate=le,N.rectAreaLights.needsUpdate=le,N.hemisphereLights.needsUpdate=le}function ic(N){return N.isMeshLambertMaterial||N.isMeshToonMaterial||N.isMeshPhongMaterial||N.isMeshStandardMaterial||N.isShadowMaterial||N.isShaderMaterial&&N.lights===!0}this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return x},this.setRenderTargetTextures=function(N,le,pe){de.get(N.texture).__webglTexture=le,de.get(N.depthTexture).__webglTexture=pe;let ae=de.get(N);ae.__hasExternalTextures=!0,ae.__hasExternalTextures&&(ae.__autoAllocateDepthBuffer=pe===void 0,ae.__autoAllocateDepthBuffer||$.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ae.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(N,le){let pe=de.get(N);pe.__webglFramebuffer=le,pe.__useDefaultFramebuffer=le===void 0},this.setRenderTarget=function(N,le=0,pe=0){x=N,v=le,y=pe;let ae=!0,me=null,Ge=!1,ut=!1;if(N){let pt=de.get(N);pt.__useDefaultFramebuffer!==void 0?(ie.bindFramebuffer(36160,null),ae=!1):pt.__webglFramebuffer===void 0?we.setupRenderTarget(N):pt.__hasExternalTextures&&we.rebindTextures(N,de.get(N.texture).__webglTexture,de.get(N.depthTexture).__webglTexture);let et=N.texture;(et.isData3DTexture||et.isDataArrayTexture||et.isCompressedArrayTexture)&&(ut=!0);let zt=de.get(N).__webglFramebuffer;N.isWebGLCubeRenderTarget?(me=zt[le],Ge=!0):ne.isWebGL2&&N.samples>0&&we.useMultisampledRTT(N)===!1?me=de.get(N).__webglMultisampledFramebuffer:me=zt,b.copy(N.viewport),E.copy(N.scissor),_=N.scissorTest}else b.copy(O).multiplyScalar(T).floor(),E.copy(k).multiplyScalar(T).floor(),_=G;if(ie.bindFramebuffer(36160,me)&&ne.drawBuffers&&ae&&ie.drawBuffers(N,me),ie.viewport(b),ie.scissor(E),ie.setScissorTest(_),Ge){let pt=de.get(N.texture);W.framebufferTexture2D(36160,36064,34069+le,pt.__webglTexture,pe)}else if(ut){let pt=de.get(N.texture),et=le||0;W.framebufferTextureLayer(36160,36064,pt.__webglTexture,pe||0,et)}w=-1},this.readRenderTargetPixels=function(N,le,pe,ae,me,Ge,ut){if(!(N&&N.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let pt=de.get(N).__webglFramebuffer;
3139if(N.isWebGLCubeRenderTarget&&ut!==void 0&&(pt=pt[ut]),pt){ie.bindFramebuffer(36160,pt);try{let et=N.texture,zt=et.format,bt=et.type;if(zt!==oi&&Ie.convert(zt)!==W.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let wt=bt===dn&&($.has("EXT_color_buffer_half_float")||ne.isWebGL2&&$.has("EXT_color_buffer_float"));if(bt!==Mr&&Ie.convert(bt)!==W.getParameter(35738)&&!(bt===Ht&&(ne.isWebGL2||$.has("OES_texture_float")||$.has("WEBGL_color_buffer_float")))&&!wt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}le>=0&&le<=N.width-ae&&pe>=0&&pe<=N.height-me&&W.readPixels(le,pe,ae,me,Ie.convert(zt),Ie.convert(bt),Ge)}finally{let et=x!==null?de.get(x).__webglFramebuffer:null;ie.bindFramebuffer(36160,et)}}},this.readRenderTargetPixelsAsync=async function(N,le,pe,ae,me,Ge,ut){if(!(N&&N.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let pt=de.get(N).__webglFramebuffer;if(N.isWebGLCubeRenderTarget&&ut!==void 0&&(pt=pt[ut]),pt){let et=N.texture,zt=et.format,bt=et.type;if(le>=0&&le<=N.width-ae&&pe>=0&&pe<=N.height-me){ie.bindFramebuffer(W.FRAMEBUFFER,pt);let wt=W.createBuffer();W.bindBuffer(W.PIXEL_PACK_BUFFER,wt),W.bufferData(W.PIXEL_PACK_BUFFER,Ge.byteLength,W.STREAM_READ),W.readPixels(le,pe,ae,me,Ie.convert(zt),Ie.convert(bt),0);let vt=x!==null?de.get(x).__webglFramebuffer:null;ie.bindFramebuffer(W.FRAMEBUFFER,vt);let Fi=W.fenceSync(W.SYNC_GPU_COMMANDS_COMPLETE,0);return W.flush(),await B3(W,Fi,4),W.bindBuffer(W.PIXEL_PACK_BUFFER,wt),W.getBufferSubData(W.PIXEL_PACK_BUFFER,0,Ge),W.deleteBuffer(wt),W.deleteSync(Fi),Ge}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(N,le,pe=0){let ae=Math.pow(2,-pe),me=Math.floor(le.image.width*ae),Ge=Math.floor(le.image.height*ae);we.setTexture2D(le,0),W.copyTexSubImage2D(3553,pe,0,0,N.x,N.y,me,Ge),ie.unbindTexture()},this.copyTextureToTexture=function(N,le,pe,ae=0){let me=le.image.width,Ge=le.image.height,ut=Ie.convert(pe.format),pt=Ie.convert(pe.type);we.setTexture2D(pe,0),W.pixelStorei(37440,pe.flipY),W.pixelStorei(37441,pe.premultiplyAlpha),W.pixelStorei(3317,pe.unpackAlignment),le.isDataTexture?W.texSubImage2D(3553,ae,N.x,N.y,me,Ge,ut,pt,le.image.data):le.isCompressedTexture?W.compressedTexSubImage2D(3553,ae,N.x,N.y,le.mipmaps[0].width,le.mipmaps[0].height,ut,le.mipmaps[0].data):W.texSubImage2D(3553,ae,N.x,N.y,ut,pt,le.image),ae===0&&pe.generateMipmaps&&W.generateMipmap(3553),ie.unbindTexture()},this.copyTextureToTexture3D=function(N,le,pe,ae,me=0){if(m.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Ge=N.max.x-N.min.x+1,ut=N.max.y-N.min.y+1,pt=N.max.z-N.min.z+1,et=Ie.convert(ae.format),zt=Ie.convert(ae.type),bt;if(ae.isData3DTexture)we.setTexture3D(ae,0),bt=32879;else if(ae.isDataArrayTexture)we.setTexture2DArray(ae,0),bt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}W.pixelStorei(37440,ae.flipY),W.pixelStorei(37441,ae.premultiplyAlpha),W.pixelStorei(3317,ae.unpackAlignment);let wt=W.getParameter(3314),vt=W.getParameter(32878),Fi=W.getParameter(3316),as=W.getParameter(3315),Pa=W.getParameter(32877),ci=pe.isCompressedTexture?pe.mipmaps[0]:pe.image;W.pixelStorei(3314,ci.width),W.pixelStorei(32878,ci.height),W.pixelStorei(3316,N.min.x),W.pixelStorei(3315,N.min.y),W.pixelStorei(32877,N.min.z),pe.isDataTexture||pe.isData3DTexture?W.texSubImage3D(bt,me,le.x,le.y,le.z,Ge,ut,pt,et,zt,ci.data):pe.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),W.compressedTexSubImage3D(bt,me,le.x,le.y,le.z,Ge,ut,pt,et,ci.data)):W.texSubImage3D(bt,me,le.x,le.y,le.z,Ge,ut,pt,et,zt,ci),W.pixelStorei(3314,wt),W.pixelStorei(32878,vt),W.pixelStorei(3316,Fi),W.pixelStorei(3315,as),W.pixelStorei(32877,Pa),me===0&&ae.generateMipmaps&&W.generateMipmap(bt),ie.unbindTexture()},this.initRenderTarget=function(N){de.get(N).__webglFramebuffer===void 0&&we.setupRenderTarget(N)},this.initTexture=function(N){N.isCubeTexture?we.setTextureCube(N,0):N.isData3DTexture?we.setTexture3D(N,0):N.isDataArrayTexture||N.isCompressedArrayTexture?we.setTexture2DArray(N,0):we.setTexture2D(N,0),ie.unbindTexture()},this.resetState=function(){v=0,y=0,x=null,ie.reset(),ce.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}var Iz=class extends _M{};Iz.prototype.isWebGL1Renderer=!0;var AM=class{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new Je(e),this.near=t,this.far=i}clone(){return new AM(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}},Qr=class extends Vt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){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}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}},Rz=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Wv,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=xs()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];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=xs()),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]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}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=xs()),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}}},Tr=new M,Kv=class{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}
vendor: 9,690 bytes, line 3139
3139get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)Tr.fromBufferAttribute(this,t),Tr.applyMatrix4(e),this.setXYZ(t,Tr.x,Tr.y,Tr.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Tr.fromBufferAttribute(this,t),Tr.applyNormalMatrix(e),this.setXYZ(t,Tr.x,Tr.y,Tr.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Tr.fromBufferAttribute(this,t),Tr.transformDirection(e),this.setXYZ(t,Tr.x,Tr.y,Tr.z);return this}setX(e,t){return this.normalized&&(t=Kt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Kt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Kt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Kt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=an(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=an(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=an(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=an(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Kt(t,this.array),i=Kt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Kt(t,this.array),i=Kt(i,this.array),r=Kt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Kt(t,this.array),i=Kt(i,this.array),r=Kt(r,this.array),s=Kt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let i=0;i<this.count;i++){let r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new tt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Kv(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let t=[];for(let i=0;i<this.count;i++){let r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},MM=class extends Vt{constructor(){super(),this.isBone=!0,this.type="Bone"}},zr=class extends li{constructor(e=null,t=1,i=1,r,s,a,n,o,l=St,h=St,c,u){super(null,a,n,o,l,h,r,s,c,u),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},Yb=new xe,Lz=new xe,i1=class{constructor(e=[],t=[]){this.uuid=xs(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new xe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let i=new xe;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){let e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,a=e.length;s<a;s++){let n=e[s]?e[s].matrixWorld:Lz;Yb.multiplyMatrices(n,t[s]),Yb.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new i1(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=lM(e),e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let i=new zr(t,e,e,oi,Ht);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this.boneTextureSize=e,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){let r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){let s=e.bones[i],a=t[s];a===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),a=new MM),this.bones.push(a),this.boneInverses.push(new xe().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){let e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){let a=t[r];e.bones.push(a.uuid);let n=i[r];e.boneInverses.push(n.toArray())}return e}},pu=class extends tt{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}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}},Qb=new xe,Kb=new xe,yd=[],zz=new xe,cc=new Zt,Bz=class extends Zt{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new pu(new Float32Array(i*16),16),this.instanceColor=null,this.count=i,this.frustumCulled=!1;for(let r=0;r<i;r++)this.setMatrixAt(r,zz)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){let i=this.matrixWorld,r=this.count;if(cc.geometry=this.geometry,cc.material=this.material,cc.material!==void 0)for(let s=0;s<r;s++){this.getMatrixAt(s,Qb),Kb.multiplyMatrices(i,Qb),cc.matrixWorld=Kb,cc.raycast(e,yd);for(let a=0,n=yd.length;a<n;a++){let o=yd[a];o.instanceId=s,o.object=this,t.push(o)}yd.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new pu(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}},vo=class extends zu{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Je(16777215),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.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},Zb=new M,Jb=new M,$b=new xe,ug=new Nh,xd=new is,Qp=class extends Vt{constructor(e=new He,t=new vo){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)Zb.fromBufferAttribute(t,r-1),Jb.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=Zb.distanceTo(Jb);e.setAttribute("lineDistance",new De(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),xd.copy(i.boundingSphere),xd.applyMatrix4(r),xd.radius+=s,e.ray.intersectsSphere(xd)===!1)return;$b.copy(r).invert(),ug.copy(e.ray).applyMatrix4($b);let n=s/((this.scale.x+this.scale.y+this.scale.z)/3),o=n*n,l=new M,h=new M,c=new M,u=new M,d=this.isLineSegments?2:1,p=i.index,f=i.attributes.position;if(p!==null){let m=Math.max(0,a.start),g=Math.min(p.count,a.start+a.count);for(let v=m,y=g-1;v<y;v+=d){let x=p.getX(v),w=p.getX(v+1);if(l.fromBufferAttribute(f,x),h.fromBufferAttribute(f,w),ug.distanceSqToSegment(l,h,u,c)>o)continue;u.applyMatrix4(this.matrixWorld);let S=e.ray.origin.distanceTo(u);S<e.near||S>e.far||t.push({distance:S,point:c.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}else{let m=Math.max(0,a.start),g=Math.min(f.count,a.start+a.count);for(let v=m,y=g-1;v<y;v+=d){if(l.fromBufferAttribute(f,v),h.fromBufferAttribute(f,v+1),ug.distanceSqToSegment(l,h,u,c)>o)continue;
vendor: 4,133 bytes, line 3139
3139u.applyMatrix4(this.matrixWorld);let x=e.ray.origin.distanceTo(u);x<e.near||x>e.far||t.push({distance:x,point:c.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,s=i.length;r<s;r++){let a=i[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}},ew=new M,tw=new M,Bu=class extends Qp{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,i=[];for(let r=0,s=t.count;r<s;r+=2)ew.fromBufferAttribute(t,r),tw.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+ew.distanceTo(tw);e.setAttribute("lineDistance",new De(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},Fz=class extends li{constructor(e,t,i,r,s,a,n,o,l){super(e,t,i,r,s,a,n,o,l),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:xt,this.magFilter=s!==void 0?s:xt,this.generateMipmaps=!1;let h=this;function c(){h.needsUpdate=!0,e.requestVideoFrameCallback(c)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(c)}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!("requestVideoFrameCallback"in e)&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}},kz=class extends li{constructor(e,t,i,r,s,a,n,o,l){super(e,t,i,r,s,a,n,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},Ea=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/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=[],i,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)i=this.getPoint(a/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i=this.getLengths(),r=0,s=i.length,a;t?a=t:a=e*i[s-1];let n=0,o=s-1,l;for(;n<=o;)if(r=Math.floor(n+(o-n)/2),l=i[r]-a,l<0)n=r+1;else if(l>0)o=r-1;else{o=r;break}if(r=o,i[r]===a)return r/(s-1);let h=i[r],c=i[r+1]-h,u=(a-h)/c;return(r+u)/(s-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);let s=this.getPoint(i),a=this.getPoint(r),n=t||(s.isVector2?new H:new M);return n.copy(a).sub(s).normalize(),n}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new M,r=[],s=[],a=[],n=new M,o=new xe;for(let d=0;d<=e;d++){let p=d/e;r[d]=this.getTangentAt(p,new M)}s[0]=new M,a[0]=new M;let l=Number.MAX_VALUE,h=Math.abs(r[0].x),c=Math.abs(r[0].y),u=Math.abs(r[0].z);h<=l&&(l=h,i.set(1,0,0)),c<=l&&(l=c,i.set(0,1,0)),u<=l&&i.set(0,0,1),n.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],n),a[0].crossVectors(r[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),a[d]=a[d-1].clone(),n.crossVectors(r[d-1],r[d]),n.length()>Number.EPSILON){n.normalize();let p=Math.acos(Pi(r[d-1].dot(r[d]),-1,1));s[d].applyMatrix4(o.makeRotationAxis(n,p))}a[d].crossVectors(r[d],s[d])}if(t===!0){let d=Math.acos(Pi(s[0].dot(s[e]),-1,1));d/=e,r[0].dot(n.crossVectors(s[0],s[e]))>0&&(d=-d);for(let p=1;p<=e;p++)s[p].applyMatrix4(o.makeRotationAxis(r[p],d*p)),a[p].crossVectors(r[p],s[p])}return{tangents:r,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.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.t
vendor: 4,292 bytes, line 3139
3139ype,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},tm=class extends Ea{constructor(e=0,t=0,i=1,r=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=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=n,this.aRotation=o}getPoint(e,t){let i=t||new H,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(a?s=0:s=r),this.aClockwise===!0&&!a&&(s===r?s=-r:s=s-r);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 h=Math.cos(this.aRotation),c=Math.sin(this.aRotation),u=o-this.aX,d=l-this.aY;o=u*h-d*c+this.aX,l=u*c+d*h+this.aY}return i.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}},Uz=class extends tm{constructor(e,t,i,r,s,a){super(e,t,i,i,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}};function r1(){let e=0,t=0,i=0,r=0;function s(a,n,o,l){e=a,t=o,i=-3*a+3*n-2*o-l,r=2*a-2*n+o+l}return{initCatmullRom:function(a,n,o,l,h){s(n,o,h*(o-a),h*(l-n))},initNonuniformCatmullRom:function(a,n,o,l,h,c,u){let d=(n-a)/h-(o-a)/(h+c)+(o-n)/c,p=(o-n)/c-(l-n)/(c+u)+(l-o)/u;d*=c,p*=c,s(n,o,d,p)},calc:function(a){let n=a*a,o=n*a;return e+t*a+i*n+r*o}}}var bd=new M,dg=new r1,pg=new r1,fg=new r1,Nz=class extends Ea{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new M){let i=t,r=this.points,s=r.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,h;this.closed||n>0?l=r[(n-1)%s]:(bd.subVectors(r[0],r[1]).add(r[0]),l=bd);let c=r[n%s],u=r[(n+1)%s];if(this.closed||n+2<s?h=r[(n+2)%s]:(bd.subVectors(r[s-1],r[s-2]).add(r[s-1]),h=bd),this.curveType==="centripetal"||this.curveType==="chordal"){let d=this.curveType==="chordal"?.5:.25,p=Math.pow(l.distanceToSquared(c),d),f=Math.pow(c.distanceToSquared(u),d),m=Math.pow(u.distanceToSquared(h),d);f<1e-4&&(f=1),p<1e-4&&(p=f),m<1e-4&&(m=f),dg.initNonuniformCatmullRom(l.x,c.x,u.x,h.x,p,f,m),pg.initNonuniformCatmullRom(l.y,c.y,u.y,h.y,p,f,m),fg.initNonuniformCatmullRom(l.z,c.z,u.z,h.z,p,f,m)}else this.curveType==="catmullrom"&&(dg.initCatmullRom(l.x,c.x,u.x,h.x,this.tension),pg.initCatmullRom(l.y,c.y,u.y,h.y,this.tension),fg.initCatmullRom(l.z,c.z,u.z,h.z,this.tension));return i.set(dg.calc(o),pg.calc(o),fg.calc(o)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(r.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,i=this.points.length;t<i;t++){let r=this.points[t];e.points.push(r.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,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(new M().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function iw(e,t,i,r,s){let a=(r-t)*.5,n=(s-i)*.5,o=e*e,l=e*o;return(2*i-2*r+a+n)*l+(-3*i+3*r-2*a-n)*o+a*e+i}function Vz(e,t){let i=1-e;return i*i*t}function jz(e,t){return 2*(1-e)*e*t}function Hz(e,t){return e*e*t}function Qc(e,t,i,r){return Vz(e,t)+jz(e,i)+Hz(e,r)}function Gz(e,t){let i=1-e;return i*i*i*t}function Wz(e,t){let i=1-e;return 3*i*i*e*t}function qz(e,t){return 3*(1-e)*e*e*t}function Xz(e,t){return e*e*e*t}function Kc(e,t,i,r,s){return Gz(e,t)+Wz(e,i)+qz(e,r)+Xz(e,s)}
vendor: 14,775 bytes, line 3139
3139var Fs=class extends Ea{constructor(e=new H,t=new H,i=new H,r=new H){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new H){let i=t,r=this.v0,s=this.v1,a=this.v2,n=this.v3;return i.set(Kc(e,r.x,s.x,a.x,n.x),Kc(e,r.y,s.y,a.y,n.y)),i}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}},Tp=class extends Ea{constructor(e=new M,t=new M,i=new M,r=new M){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new M){let i=t,r=this.v0,s=this.v1,a=this.v2,n=this.v3;return i.set(Kc(e,r.x,s.x,a.x,n.x),Kc(e,r.y,s.y,a.y,n.y),Kc(e,r.z,s.z,a.z,n.z)),i}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}},Ns=class extends Ea{constructor(e=new H,t=new H){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new H){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){let i=t||new H;return i.copy(this.v2).sub(this.v1).normalize(),i}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}},EM=class extends Ea{constructor(e=new M,t=new M){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new M){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(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}},ho=class extends Ea{constructor(e=new H,t=new H,i=new H){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new H){let i=t,r=this.v0,s=this.v1,a=this.v2;return i.set(Qc(e,r.x,s.x,a.x),Qc(e,r.y,s.y,a.y)),i}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}},Yz=class extends Ea{constructor(e=new M,t=new M,i=new M){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new M){let i=t,r=this.v0,s=this.v1,a=this.v2;return i.set(Qc(e,r.x,s.x,a.x),Qc(e,r.y,s.y,a.y),Qc(e,r.z,s.z,a.z)),i}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}},s1=class extends Ea{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new H){let i=t,r=this.points,s=(r.length-1)*e,a=Math.floor(s),n=s-a,o=r[a===0?a:a-1],l=r[a],h=r[a>r.length-2?r.length-1:a+1],c=r[a>r.length-3?r.length-1:a+2];return i.set(iw(n,o.x,l.x,h.x,c.x),iw(n,o.y,l.y,h.y,c.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(new H().fromArray(r))}return this}},Qz=Object.freeze({__proto__:null,ArcCurve:Uz,CatmullRomCurve3:Nz,CubicBezierCurve:Fs,CubicBezierCurve3:Tp,EllipseCurve:tm,LineCurve:Ns,LineCurve3:EM,QuadraticBezierCurve:ho,QuadraticBezierCurve3:Yz,SplineCurve:s1}),CM=class extends Ea{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);e.equals(t)||this.curves.push(new Ns(t,e))}getPoint(e,t){let i=e*this.getLength(),r=this.getCurveLengths(),s=0;for(;s<r.length;){if(r[s]>=i){let a=r[s]-i,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 i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],i;for(let r=0,s=this.curves;r<s.length;r++){let a=s[r],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<o.length;l++){let h=o[l];i&&i.equals(h)||(t.push(h),i=h)}}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,i=e.curves.length;t<i;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let r=e.curves[t];this.curves.push(new Qz[r.type]().fromJSON(r))}return this}},Kp=class extends CM{constructor(e){super(),this.type="Path",this.currentPoint=new H,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;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 i=new Ns(this.currentPoint.clone(),new H(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){let s=new ho(this.currentPoint.clone(),new H(e,t),new H(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,a){let n=new Fs(this.currentPoint.clone(),new H(e,t),new H(i,r),new H(s,a));return this.curves.push(n),this.currentPoint.set(s,a),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),i=new s1(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,a){let n=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+n,t+o,i,r,s,a),this}absarc(e,t,i,r,s,a){return this.absellipse(e,t,i,i,r,s,a),this}ellipse(e,t,i,r,s,a,n,o){let l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+l,t+h,i,r,s,a,n,o),this}absellipse(e,t,i,r,s,a,n,o){let l=new tm(e,t,i,r,s,a,n,o);if(this.curves.length>0){let c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);let h=l.getPoint(1);return this.currentPoint.copy(h),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}},TM=class extends He{constructor(e=[new H(0,-.5),new H(.5,0),new H(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=Pi(r,0,Math.PI*2);let s=[],a=[],n=[],o=[],l=[],h=1/t,c=new M,u=new H,d=new M,p=new M,f=new M,m=0,g=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:m=e[v+1].x-e[v].x,g=e[v+1].y-e[v].y,d.x=g*1,d.y=-m,d.z=g*0,f.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case e.length-1:o.push(f.x,f.y,f.z);break;default:m=e[v+1].x-e[v].x,g=e[v+1].y-e[v].y,d.x=g*1,d.y=-m,d.z=g*0,p.copy(d),d.x+=f.x,d.y+=f.y,d.z+=f.z,d.normalize(),o.push(d.x,d.y,d.z),f.copy(p)}for(let v=0;v<=t;v++){let y=i+v*h*r,x=Math.sin(y),w=Math.cos(y);for(let S=0;S<=e.length-1;S++){c.x=e[S].x*x,c.y=e[S].y,c.z=e[S].x*w,a.push(c.x,c.y,c.z),u.x=v/t,u.y=S/(e.length-1),n.push(u.x,u.y);let b=o[3*S+0]*x,E=o[3*S+1],_=o[3*S+0]*w;l.push(b,E,_)}}for(let v=0;v<t;v++)for(let y=0;y<e.length-1;y++){let x=y+v*e.length,w=x,S=x+e.length,b=x+e.length+1,E=x+1;s.push(w,S,E),s.push(b,E,S)}this.setIndex(s),this.setAttribute("position",new De(a,3)),this.setAttribute("uv",new De(n,2)),this.setAttribute("normal",new De(l,3))}static fromJSON(e){return new TM(e.points,e.segments,e.phiStart,e.phiLength)}},a1=class extends He{constructor(e=1,t=1,i=1,r=32,s=1,a=!1,n=0,o=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:a,thetaStart:n,thetaLength:o};let l=this;r=Math.floor(r),s=Math.floor(s);let h=[],c=[],u=[],d=[],p=0,f=[],m=i/2,g=0;v(),a===!1&&(e>0&&y(!0),t>0&&y(!1)),this.setIndex(h),this.setAttribute("position",new De(c,3)),this.setAttribute("normal",new De(u,3)),this.setAttribute("uv",new De(d,2));function v(){let x=new M,w=new M,S=0,b=(t-e)/i;for(let E=0;E<=s;E++){let _=[],A=E/s,C=A*(t-e)+e;for(let T=0;T<=r;T++){let I=T/r,P=I*o+n,O=Math.sin(P),k=Math.cos(P);w.x=C*O,w.y=-A*i+m,w.z=C*k,c.push(w.x,w.y,w.z),x.set(O,b,k).normalize(),u.push(x.x,x.y,x.z),d.push(I,1-A),_.push(p++)}f.push(_)}for(let E=0;E<r;E++)for(let _=0;_<s;_++){let A=f[_][E],C=f[_+1][E],T=f[_+1][E+1],I=f[_][E+1];h.push(A,C,I),h.push(C,T,I),S+=6}l.addGroup(g,S,0),g+=S}function y(x){let w=p,S=new H,b=new M,E=0,_=x===!0?e:t,A=x===!0?1:-1;for(let T=1;T<=r;T++)c.push(0,m*A,0),u.push(0,A,0),d.push(.5,.5),p++;let C=p;for(let T=0;T<=r;T++){let I=T/r*o+n,P=Math.cos(I),O=Math.sin(I);b.x=_*O,b.y=m*A,b.z=_*P,c.push(b.x,b.y,b.z),u.push(0,A,0),S.x=P*.5+.5,S.y=O*.5*A+.5,d.push(S.x,S.y),p++}for(let T=0;T<r;T++){let I=w+T,P=C+T;x===!0?h.push(P,P+1,I):h.push(P+1,P,I),E+=3}l.addGroup(g,E,x===!0?1:2),g+=E}}static fromJSON(e){return new a1(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},n1=class extends a1{constructor(e=1,t=1,i=32,r=1,s=!1,a=0,n=Math.PI*2){super(0,e,t,i,r,s,a,n),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:a,thetaLength:n}}static fromJSON(e){return new n1(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},o1=class extends He{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};let s=[],a=[];n(r),l(i),h(),this.setAttribute("position",new De(s,3)),this.setAttribute("normal",new De(s.slice(),3)),this.setAttribute("uv",new De(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function n(v){let y=new M,x=new M,w=new M;for(let S=0;S<t.length;S+=3)d(t[S+0],y),d(t[S+1],x),d(t[S+2],w),o(y,x,w,v)}function o(v,y,x,w){let S=w+1,b=[];for(let E=0;E<=S;E++){b[E]=[];let _=v.clone().lerp(x,E/S),A=y.clone().lerp(x,E/S),C=S-E;for(let T=0;T<=C;T++)T===0&&E===S?b[E][T]=_:b[E][T]=_.clone().lerp(A,T/C)}for(let E=0;E<S;E++)for(let _=0;_<2*(S-E)-1;_++){let A=Math.floor(_/2);_%2===0?(u(b[E][A+1]),u(b[E+1][A]),u(b[E][A])):(u(b[E][A+1]),u(b[E+1][A+1]),u(b[E+1][A]))}}function l(v){let y=new M;for(let x=0;x<s.length;x+=3)y.x=s[x+0],y.y=s[x+1],y.z=s[x+2],y.normalize().multiplyScalar(v),s[x+0]=y.x,s[x+1]=y.y,s[x+2]=y.z}function h(){let v=new M;for(let y=0;y<s.length;y+=3){v.x=s[y+0],v.y=s[y+1],v.z=s[y+2];let x=m(v)/2/Math.PI+.5,w=g(v)/Math.PI+.5;a.push(x,1-w)}p(),c()}function c(){for(let v=0;v<a.length;v+=6){let y=a[v+0],x=a[v+2],w=a[v+4],S=Math.max(y,x,w),b=Math.min(y,x,w);S>.9&&b<.1&&(y<.2&&(a[v+0]+=1),x<.2&&(a[v+2]+=1),w<.2&&(a[v+4]+=1))}}function u(v){s.push(v.x,v.y,v.z)}function d(v,y){let x=v*3;y.x=e[x+0],y.y=e[x+1],y.z=e[x+2]}function p(){let v=new M,y=new M,x=new M,w=new M,S=new H,b=new H,E=new H;for(let _=0,A=0;_<s.length;_+=9,A+=6){v.set(s[_+0],s[_+1],s[_+2]),y.set(s[_+3],s[_+4],s[_+5]),x.set(s[_+6],s[_+7],s[_+8]),S.set(a[A+0],a[A+1]),b.set(a[A+2],a[A+3]),E.set(a[A+4],a[A+5]),w.copy(v).add(y).add(x).divideScalar(3);let C=m(w);f(S,A+0,v,C),f(b,A+2,y,C),f(E,A+4,x,C)}}function f(v,y,x,w){w<0&&v.x===1&&(a[y]=v.x-1),x.x===0&&x.z===0&&(a[y]=w/2/Math.PI+.5)}function m(v){return Math.atan2(v.z,-v.x)}function g(v){return Math.atan2(-v.y,Math.sqrt(v.x*v.x+v.z*v.z))}}static fromJSON(e){return new o1(e.vertices,e.indices,e.radius,e.details)}},PM=class extends o1{constructor(e=1,t=0){let i=(1+Math.sqrt(5))/2,r=1/i,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new PM(e.radius,e.detail)}},Zp=class extends Kp{constructor(e){super(e),this.uuid=xs(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].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,i=e.holes.length;t<i;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let r=e.holes[t];this.holes.push(new Kp().fromJSON(r))}return this}},Kz={triangulate:function(e,t,i=2){let r=t&&t.length,s=r?t[0]*i:e.length,a=DM(e,0,s,i,!0),n=[];if(!a||a.next===a.prev)return n;let o,l,h,c,u,d,p;
vendor: 4,930 bytes, line 3139
3139if(r&&(a=tB(e,t,a,i)),e.length>80*i){o=h=e[0],l=c=e[1];for(let f=i;f<s;f+=i)u=e[f],d=e[f+1],u<o&&(o=u),d<l&&(l=d),u>h&&(h=u),d>c&&(c=d);p=Math.max(h-o,c-l),p=p!==0?32767/p:0}return fu(a,n,i,o,l,p,0),n}};function DM(e,t,i,r,s){let a,n;if(s===dB(e,t,i,r)>0)for(a=t;a<i;a+=r)n=rw(a,e[a],e[a+1],n);else for(a=i-r;a>=t;a-=r)n=rw(a,e[a],e[a+1],n);return n&&im(n,n.next)&&(gu(n),n=n.next),n}function tl(e,t){if(!e)return e;t||(t=e);let i=e,r;do if(r=!1,!i.steiner&&(im(i,i.next)||ui(i.prev,i,i.next)===0)){if(gu(i),i=t=i.prev,i===i.next)break;r=!0}else i=i.next;while(r||i!==t);return t}function fu(e,t,i,r,s,a,n){if(!e)return;!n&&a&&nB(e,r,s,a);let o=e,l,h;for(;e.prev!==e.next;){if(l=e.prev,h=e.next,a?Jz(e,r,s,a):Zz(e)){t.push(l.i/i|0),t.push(e.i/i|0),t.push(h.i/i|0),gu(e),e=h.next,o=h.next;continue}if(e=h,e===o){n?n===1?(e=$z(tl(e),t,i),fu(e,t,i,r,s,a,2)):n===2&&eB(e,t,i,r,s,a):fu(tl(e),t,i,r,s,a,1);break}}}function Zz(e){let t=e.prev,i=e,r=e.next;if(ui(t,i,r)>=0)return!1;let s=t.x,a=i.x,n=r.x,o=t.y,l=i.y,h=r.y,c=s<a?s<n?s:n:a<n?a:n,u=o<l?o<h?o:h:l<h?l:h,d=s>a?s>n?s:n:a>n?a:n,p=o>l?o>h?o:h:l>h?l:h,f=r.next;for(;f!==t;){if(f.x>=c&&f.x<=d&&f.y>=u&&f.y<=p&&sh(s,o,a,l,n,h,f.x,f.y)&&ui(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Jz(e,t,i,r){let s=e.prev,a=e,n=e.next;if(ui(s,a,n)>=0)return!1;let o=s.x,l=a.x,h=n.x,c=s.y,u=a.y,d=n.y,p=o<l?o<h?o:h:l<h?l:h,f=c<u?c<d?c:d:u<d?u:d,m=o>l?o>h?o:h:l>h?l:h,g=c>u?c>d?c:d:u>d?u:d,v=Zv(p,f,t,i,r),y=Zv(m,g,t,i,r),x=e.prevZ,w=e.nextZ;for(;x&&x.z>=v&&w&&w.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==s&&x!==n&&sh(o,c,l,u,h,d,x.x,x.y)&&ui(x.prev,x,x.next)>=0||(x=x.prevZ,w.x>=p&&w.x<=m&&w.y>=f&&w.y<=g&&w!==s&&w!==n&&sh(o,c,l,u,h,d,w.x,w.y)&&ui(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;x&&x.z>=v;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==s&&x!==n&&sh(o,c,l,u,h,d,x.x,x.y)&&ui(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;w&&w.z<=y;){if(w.x>=p&&w.x<=m&&w.y>=f&&w.y<=g&&w!==s&&w!==n&&sh(o,c,l,u,h,d,w.x,w.y)&&ui(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function $z(e,t,i){let r=e;do{let s=r.prev,a=r.next.next;!im(s,a)&&OM(s,r,r.next,a)&&mu(s,a)&&mu(a,s)&&(t.push(s.i/i|0),t.push(r.i/i|0),t.push(a.i/i|0),gu(r),gu(r.next),r=e=a),r=r.next}while(r!==e);return tl(r)}function eB(e,t,i,r,s,a){let n=e;do{let o=n.next.next;for(;o!==n.prev;){if(n.i!==o.i&&hB(n,o)){let l=IM(n,o);n=tl(n,n.next),l=tl(l,l.next),fu(n,t,i,r,s,a,0),fu(l,t,i,r,s,a,0);return}o=o.next}n=n.next}while(n!==e)}function tB(e,t,i,r){let s=[],a,n,o,l,h;for(a=0,n=t.length;a<n;a++)o=t[a]*r,l=a<n-1?t[a+1]*r:e.length,h=DM(e,o,l,r,!1),h===h.next&&(h.steiner=!0),s.push(lB(h));for(s.sort(iB),a=0;a<s.length;a++)i=rB(s[a],i);return i}function iB(e,t){return e.x-t.x}function rB(e,t){let i=sB(e,t);if(!i)return t;let r=IM(i,e);return tl(r,r.next),tl(i,i.next)}function sB(e,t){let i=t,r=-1/0,s,a=e.x,n=e.y;do{if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){let d=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(d<=a&&d>r&&(r=d,s=i.x<i.next.x?i:i.next,d===a))return s}i=i.next}while(i!==t);if(!s)return null;let o=s,l=s.x,h=s.y,c=1/0,u;i=s;do a>=i.x&&i.x>=l&&a!==i.x&&sh(n<h?a:r,n,l,h,n<h?r:a,n,i.x,i.y)&&(u=Math.abs(n-i.y)/(a-i.x),mu(i,e)&&(u<c||u===c&&(i.x>s.x||i.x===s.x&&aB(s,i)))&&(s=i,c=u)),i=i.next;while(i!==o);return s}function aB(e,t){return ui(e.prev,e,t.prev)<0&&ui(t.next,e,e.next)<0}function nB(e,t,i,r){let s=e;do s.z===0&&(s.z=Zv(s.x,s.y,t,i,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==e);s.prevZ.nextZ=null,s.prevZ=null,oB(s)}function oB(e){let t,i,r,s,a,n,o,l,h=1;do{for(i=e,e=null,a=null,n=0;i;){for(n++,r=i,o=0,t=0;t<h&&(o++,r=r.nextZ,!!r);t++);for(l=h;o>0||l>0&&r;)o!==0&&(l===0||!r||i.z<=r.z)?(s=i,i=i.nextZ,o--):(s=r,r=r.nextZ,l--),a?a.nextZ=s:e=s,s.prevZ=a,a=s;i=r}a.nextZ=null,h*=2}while(n>1);return e}function Zv(e,t,i,r,s){return e=(e-i)*s|0,t=(t-r)*s|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function lB(e){let t=e,i=e;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==e);return i}function sh(e,t,i,r,s,a,n,o){return(s-n)*(t-o)>=(e-n)*(a-o)&&(e-n)*(r-o)>=(i-n)*(t-o)&&(i-n)*(a-o)>=(s-n)*(r-o)}function hB(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!cB(e,t)&&(mu(e,t)&&mu(t,e)&&uB(e,t)&&(ui(e.prev,e,t.prev)||ui(e,t.prev,t))||im(e,t)&&ui(e.prev,e,e.next)>0&&ui(t.prev,t,t.next)>0)}function ui(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function im(e,t){return e.x===t.x&&e.y===t.y}function OM(e,t,i,r){let s=Sd(ui(e,t,i)),a=Sd(ui(e,t,r)),n=Sd(ui(i,r,e)),o=Sd(ui(i,r,t));return!!(s!==a&&n!==o||s===0&&wd(e,i,t)||a===0&&wd(e,r,t)||n===0&&wd(i,e,r)||o===0&&wd(i,t,r))}function wd(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function Sd(e){return e>0?1:e<0?-1:0}function cB(e,t){let i=e;do{if(i.i!==e.i&&i.next.i!==e.i&&i.i!==t.i&&i.next.i!==t.i&&OM(i,i.next,e,t))return!0;
vendor: 8,395 bytes, line 3139
3139i=i.next}while(i!==e);return!1}function mu(e,t){return ui(e.prev,e,e.next)<0?ui(e,t,e.next)>=0&&ui(e,e.prev,t)>=0:ui(e,t,e.prev)<0||ui(e,e.next,t)<0}function uB(e,t){let i=e,r=!1,s=(e.x+t.x)/2,a=(e.y+t.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&s<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==e);return r}function IM(e,t){let i=new Jv(e.i,e.x,e.y),r=new Jv(t.i,t.x,t.y),s=e.next,a=t.prev;return e.next=t,t.prev=e,i.next=s,s.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function rw(e,t,i,r){let s=new Jv(e,t,i);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function gu(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 Jv(e,t,i){this.i=e,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function dB(e,t,i,r){let s=0;for(let a=t,n=i-r;a<i;a+=r)s+=(e[n]-e[a])*(e[a+1]+e[n+1]),n=a;return s}var RM=class{static area(e){let t=e.length,i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return RM.area(e)<0}static triangulateShape(e,t){let i=[],r=[],s=[];sw(e),aw(i,e);let a=e.length;t.forEach(sw);for(let o=0;o<t.length;o++)r.push(a),a+=t[o].length,aw(i,t[o]);let n=Kz.triangulate(i,r);for(let o=0;o<n.length;o+=3)s.push(n.slice(o,o+3));return s}};function sw(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function aw(e,t){for(let i=0;i<t.length;i++)e.push(t[i].x),e.push(t[i].y)}var LM=class extends o1{constructor(e=1,t=0){let i=(1+Math.sqrt(5))/2,r=[-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],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new LM(e.radius,e.detail)}},hh=class extends He{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,a=0,n=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:a,thetaLength:n},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));let o=Math.min(a+n,Math.PI),l=0,h=[],c=new M,u=new M,d=[],p=[],f=[],m=[];for(let g=0;g<=i;g++){let v=[],y=g/i,x=0;g==0&&a==0?x=.5/t:g==i&&o==Math.PI&&(x=-.5/t);for(let w=0;w<=t;w++){let S=w/t;c.x=-e*Math.cos(r+S*s)*Math.sin(a+y*n),c.y=e*Math.cos(a+y*n),c.z=e*Math.sin(r+S*s)*Math.sin(a+y*n),p.push(c.x,c.y,c.z),u.copy(c).normalize(),f.push(u.x,u.y,u.z),m.push(S+x,1-y),v.push(l++)}h.push(v)}for(let g=0;g<i;g++)for(let v=0;v<t;v++){let y=h[g][v+1],x=h[g][v],w=h[g+1][v],S=h[g+1][v+1];(g!==0||a>0)&&d.push(y,x,S),(g!==i-1||o<Math.PI)&&d.push(x,w,S)}this.setIndex(d),this.setAttribute("position",new De(p,3)),this.setAttribute("normal",new De(f,3)),this.setAttribute("uv",new De(m,2))}static fromJSON(e){return new hh(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}},zM=class extends He{constructor(e=1,t=.4,i=12,r=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);let a=[],n=[],o=[],l=[],h=new M,c=new M,u=new M;for(let d=0;d<=i;d++)for(let p=0;p<=r;p++){let f=p/r*s,m=d/i*Math.PI*2;c.x=(e+t*Math.cos(m))*Math.cos(f),c.y=(e+t*Math.cos(m))*Math.sin(f),c.z=t*Math.sin(m),n.push(c.x,c.y,c.z),h.x=e*Math.cos(f),h.y=e*Math.sin(f),u.subVectors(c,h).normalize(),o.push(u.x,u.y,u.z),l.push(p/r),l.push(d/i)}for(let d=1;d<=i;d++)for(let p=1;p<=r;p++){let f=(r+1)*d+p-1,m=(r+1)*(d-1)+p-1,g=(r+1)*(d-1)+p,v=(r+1)*d+p;a.push(f,m,v),a.push(m,g,v)}this.setIndex(a),this.setAttribute("position",new De(n,3)),this.setAttribute("normal",new De(o,3)),this.setAttribute("uv",new De(l,2))}static fromJSON(e){return new zM(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}},BM=class extends He{constructor(e=1,t=.4,i=64,r=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:a},i=Math.floor(i),r=Math.floor(r);let n=[],o=[],l=[],h=[],c=new M,u=new M,d=new M,p=new M,f=new M,m=new M,g=new M;for(let y=0;y<=i;++y){let x=y/i*s*Math.PI*2;v(x,s,a,e,d),v(x+.01,s,a,e,p),m.subVectors(p,d),g.addVectors(p,d),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let w=0;w<=r;++w){let S=w/r*Math.PI*2,b=-t*Math.cos(S),E=t*Math.sin(S);c.x=d.x+(b*g.x+E*f.x),c.y=d.y+(b*g.y+E*f.y),c.z=d.z+(b*g.z+E*f.z),o.push(c.x,c.y,c.z),u.subVectors(c,d).normalize(),l.push(u.x,u.y,u.z),h.push(y/i),h.push(w/r)}}for(let y=1;y<=i;y++)for(let x=1;x<=r;x++){let w=(r+1)*(y-1)+(x-1),S=(r+1)*y+(x-1),b=(r+1)*y+x,E=(r+1)*(y-1)+x;n.push(w,S,E),n.push(S,b,E)}this.setIndex(n),this.setAttribute("position",new De(o,3)),this.setAttribute("normal",new De(l,3)),this.setAttribute("uv",new De(h,2));function v(y,x,w,S,b){let E=Math.cos(y),_=Math.sin(y),A=w/x*y,C=Math.cos(A);b.x=S*(2+C)*.5*E,b.y=S*(2+C)*_*.5,b.z=S*Math.sin(A)*.5}}static fromJSON(e){return new BM(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}},pB=class extends Dt{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};function En(e,t,i){return FM(e)?new e.constructor(e.subarray(t,i!==void 0?i:e.length)):e.slice(t,i)}function _d(e,t,i){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT=="number"?new t(e):Array.prototype.slice.call(e)}function FM(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function fB(e){function t(s,a){return e[s]-e[a]}let i=e.length,r=new Array(i);for(let s=0;s!==i;++s)r[s]=s;return r.sort(t),r}function nw(e,t,i){let r=e.length,s=new e.constructor(r);for(let a=0,n=0;n!==r;++a){let o=i[a]*t;for(let l=0;l!==t;++l)s[n++]=e[o+l]}return s}function kM(e,t,i,r){let s=1,a=e[0];for(;a!==void 0&&a[r]===void 0;)a=e[s++];if(a===void 0)return;let n=a[r];if(n!==void 0)if(Array.isArray(n))do n=a[r],n!==void 0&&(t.push(a.time),i.push.apply(i,n)),a=e[s++];while(a!==void 0);else if(n.toArray!==void 0)do n=a[r],n!==void 0&&(t.push(a.time),n.toArray(i,i.length)),a=e[s++];while(a!==void 0);else do n=a[r],n!==void 0&&(t.push(a.time),i.push(n)),a=e[s++];while(a!==void 0)}var rm=class{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let a;i:{r:if(!(e<r)){for(let n=i+2;;){if(r===void 0){if(e<s)break r;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===n)break;if(s=r,r=t[++i],e<r)break t}a=t.length;break i}if(!(e>=s)){let n=t[1];e<n&&(i=2,s=n);for(let o=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===o)break;if(r=s,s=t[--i-1],e>=s)break t}a=i,i=0;break i}break e}for(;i<a;){let n=i+a>>>1;e<t[n]?a=n:i=n+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let a=0;a!==r;++a)t[a]=i[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},mB=class extends rm{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:th,endingEnd:th}}intervalChanged_(e,t,i){let r=this.parameterPositions,s=e-2,a=e+1,n=r[s],o=r[a];if(n===void 0)switch(this.getSettings_().endingStart){case ih:s=e,n=2*t-i;break;case qp:s=r.length-2,n=t+r[s]-r[s+1];break;default:s=e,n=i}if(o===void 0)switch(this.getSettings_().endingEnd){case ih:a=e,o=2*i-t;break;case qp:a=1,o=i+r[1]-r[0];break;default:a=e-1,o=t}let l=(i-t)*.5,h=this.valueSize;this._weightPrev=l/(t-n),this._weightNext=l/(o-i),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(e,t,i,r){let s=this.resultBuffer,a=this.sampleValues,n=this.valueSize,o=e*n,l=o-n,h=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-t)/(r-t),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,y=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-
vendor: 15,407 bytes, line 3139
3139d*f;for(let w=0;w!==n;++w)s[w]=g*a[h+w]+v*a[l+w]+y*a[o+w]+x*a[c+w];return s}},UM=class extends rm{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let s=this.resultBuffer,a=this.sampleValues,n=this.valueSize,o=e*n,l=o-n,h=(i-t)/(r-t),c=1-h;for(let u=0;u!==n;++u)s[u]=a[l+u]*c+a[o+u]*h;return s}},gB=class extends rm{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}},Ca=class{constructor(e,t,i,r){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=_d(t,this.TimeBufferType),this.values=_d(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:_d(e.times,Array),values:_d(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new gB(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new UM(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new mB(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Gp:t=this.InterpolantFactoryMethodDiscrete;break;case Wp:t=this.InterpolantFactoryMethodLinear;break;case Um:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let i="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(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Gp;case this.InterpolantFactoryMethodLinear:return Wp;case this.InterpolantFactoryMethodSmooth:return Um}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){let i=this.times,r=i.length,s=0,a=r-1;for(;s!==r&&i[s]<e;)++s;for(;a!==-1&&i[a]>t;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);let n=this.getValueSize();this.times=En(i,s,a),this.values=En(this.values,s*n,a*n)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let n=0;n!==s;n++){let o=i[n];if(typeof o=="number"&&isNaN(o)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,n,o),e=!1;break}if(a!==null&&a>o){console.error("THREE.KeyframeTrack: Out of order keys.",this,n,o,a),e=!1;break}a=o}if(r!==void 0&&FM(r))for(let n=0,o=r.length;n!==o;++n){let l=r[n];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,n,l),e=!1;break}}return e}optimize(){let e=En(this.times),t=En(this.values),i=this.getValueSize(),r=this.getInterpolation()===Um,s=e.length-1,a=1;for(let n=1;n<s;++n){let o=!1,l=e[n],h=e[n+1];if(l!==h&&(n!==1||l!==e[0]))if(r)o=!0;else{let c=n*i,u=c-i,d=c+i;for(let p=0;p!==i;++p){let f=t[c+p];if(f!==t[u+p]||f!==t[d+p]){o=!0;break}}}if(o){if(n!==a){e[a]=e[n];let c=n*i,u=a*i;for(let d=0;d!==i;++d)t[u+d]=t[c+d]}++a}}if(s>0){e[a]=e[s];for(let n=s*i,o=a*i,l=0;l!==i;++l)t[o+l]=t[n+l];++a}return a!==e.length?(this.times=En(e,0,a),this.values=En(t,0,a*i)):(this.times=e,this.values=t),this}clone(){let e=En(this.times,0),t=En(this.values,0),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};Ca.prototype.TimeBufferType=Float32Array;Ca.prototype.ValueBufferType=Float32Array;Ca.prototype.DefaultInterpolation=Wp;var Hh=class extends Ca{};Hh.prototype.ValueTypeName="bool";Hh.prototype.ValueBufferType=Array;Hh.prototype.DefaultInterpolation=Gp;Hh.prototype.InterpolantFactoryMethodLinear=void 0;Hh.prototype.InterpolantFactoryMethodSmooth=void 0;var NM=class extends Ca{};NM.prototype.ValueTypeName="color";var Jp=class extends Ca{};Jp.prototype.ValueTypeName="number";var vB=class extends rm{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let s=this.resultBuffer,a=this.sampleValues,n=this.valueSize,o=(i-t)/(r-t),l=e*n;for(let h=l+n;l!==h;l+=4)nt.slerpFlat(s,0,a,l-n,a,l,o);return s}},Fu=class extends Ca{InterpolantFactoryMethodLinear(e){return new vB(this.times,this.values,this.getValueSize(),e)}};Fu.prototype.ValueTypeName="quaternion";Fu.prototype.DefaultInterpolation=Wp;Fu.prototype.InterpolantFactoryMethodSmooth=void 0;var Gh=class extends Ca{};Gh.prototype.ValueTypeName="string";Gh.prototype.ValueBufferType=Array;Gh.prototype.DefaultInterpolation=Gp;Gh.prototype.InterpolantFactoryMethodLinear=void 0;Gh.prototype.InterpolantFactoryMethodSmooth=void 0;var $p=class extends Ca{};$p.prototype.ValueTypeName="vector";var $v=class{constructor(e,t=-1,i,r=Ky){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=xs(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],i=e.tracks,r=1/(e.fps||1);for(let a=0,n=i.length;a!==n;++a)t.push(xB(i[a]).scale(r));let s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){let t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=i.length;s!==a;++s)t.push(Ca.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){let s=t.length,a=[];for(let n=0;n<s;n++){let o=[],l=[];o.push((n+s-1)%s,n,(n+1)%s),l.push(0,1,0);let h=fB(o);o=nw(o,1,h),l=nw(l,1,h),!r&&o[0]===0&&(o.push(s),l.push(l[0])),a.push(new Jp(".morphTargetInfluences["+t[n].name+"]",o,l).scale(1/i))}return new this(e,-1,a)}static findByName(e,t){let i=e;if(!Array.isArray(e)){let r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){let r={},s=/^([\w-]*?)([\d]+)$/;for(let n=0,o=e.length;n<o;n++){let l=e[n],h=l.name.match(s);if(h&&h.length>1){let c=h[1],u=r[c];u||(r[c]=u=[]),u.push(l)}}let a=[];for(let n in r)a.push(this.CreateFromMorphTargetSequence(n,r[n],t,i));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let i=function(h,c,u,d,p){if(u.length!==0){let f=[],m=[];kM(u,f,m,d),f.length!==0&&p.push(new h(c,f,m))}},r=[],s=e.name||"default",a=e.fps||30,n=e.blendMode,o=e.length||-1,l=e.hierarchy||[];for(let h=0;h<l.length;h++){let c=l[h].keys;if(!(!c||c.length===0))if(c[0].morphTargets){let u={},d;for(d=0;d<c.length;d++)if(c[d].morphTargets)for(let p=0;p<c[d].morphTargets.length;p++)u[c[d].morphTargets[p]]=-1;for(let p in u){let f=[],m=[];for(let g=0;g!==c[d].morphTargets.length;++g){let v=c[d];f.push(v.time),m.push(v.morphTarget===p?1:0)}r.push(new Jp(".morphTargetInfluence["+p+"]",f,m))}o=u.length*a}else{let u=".bones["+t[h].name+"]";i($p,u+".position",c,"pos",r),i(Fu,u+".quaternion",c,"rot",r),i($p,u+".scale",c,"scl",r)}}return r.length===0?null:new this(s,o,r,n)}resetDuration(){let e=this.tracks,t=0;for(let i=0,r=e.length;i!==r;++i){let s=this.tracks[i];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}};function yB(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Jp;case"vector":case"vector2":case"vector3":case"vector4":return $p;case"color":return NM;case"quaternion":return Fu;case"bool":case"boolean":return Hh;case"string":return Gh}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function xB(e){if(e.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=yB(e.type);if(e.times===void 0){let i=[],r=[];kM(e.keys,i,r,"value"),e.times=i,e.values=r}return t.parse!==void 0?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}var ef={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){if(this.enabled!==!1)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},VM=class{constructor(e,t,i){let r=this,s=!1,a=0,n=0,o,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(h){n++,s===!1&&r.onStart!==void 0&&r.onStart(h,a,n),s=!0},this.itemEnd=function(h){a++,r.onProgress!==void 0&&r.onProgress(h,a,n),a===n&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(h){r.onError!==void 0&&r.onError(h)},this.resolveURL=function(h){return o?o(h):h},this.setURLModifier=function(h){return o=h,this},this.addHandler=function(h,c){return l.push(h,c),this},this.removeHandler=function(h){let c=l.indexOf(h);return c!==-1&&l.splice(c,2),this},this.getHandler=function(h){for(let c=0,u=l.length;c<u;c+=2){let d=l[c],p=l[c+1];if(d.global&&(d.lastIndex=0),d.test(h))return p}return null}}},bB=new VM,ku=class{constructor(e){this.manager=e!==void 0?e:bB,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let i=this;return new Promise(function(r,s){i.load(e,r,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}},Fa={},wB=class extends Error{constructor(e,t){super(e),this.response=t}},e0=class extends ku{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=ef.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Fa[e]!==void 0){Fa[e].push({onLoad:t,onProgress:i,onError:r});return}Fa[e]=[],Fa[e].push({onLoad:t,onProgress:i,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),n=this.mimeType,o=this.responseType;fetch(a).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;let h=Fa[e],c=l.body.getReader(),u=l.headers.get("Content-Length")||l.headers.get("X-File-Size"),d=u?parseInt(u):0,p=d!==0,f=0,m=new ReadableStream({start(g){v();function v(){c.read().then(({done:y,value:x})=>{if(y)g.close();else{f+=x.byteLength;let w=new ProgressEvent("progress",{lengthComputable:p,loaded:f,total:d});for(let S=0,b=h.length;S<b;S++){let E=h[S];E.onProgress&&E.onProgress(w)}g.enqueue(x),v()}})}}});return new Response(m)}else throw new wB(`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(h=>new DOMParser().parseFromString(h,n));case"json":return l.json();default:if(n===void 0)return l.text();{let h=/charset="?([^;"\s]*)"?/i.exec(n),c=h&&h[1]?h[1].toLowerCase():void 0,u=new TextDecoder(c);return l.arrayBuffer().then(d=>u.decode(d))}}}).then(l=>{ef.add(e,l);let h=Fa[e];delete Fa[e];for(let c=0,u=h.length;c<u;c++){let d=h[c];d.onLoad&&d.onLoad(l)}}).catch(l=>{let h=Fa[e];if(h===void 0)throw this.manager.itemError(e),l;delete Fa[e];for(let c=0,u=h.length;c<u;c++){let d=h[c];d.onError&&d.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}},SB=class extends ku{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,a=ef.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;let n=du("img");function o(){h(),ef.add(e,this),t&&t(this),s.manager.itemEnd(e)}function l(c){h(),r&&r(c),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){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),s.manager.itemStart(e),n.src=e,n}},_B=class extends ku{constructor(e){super(e)}load(e,t,i,r){let s=new li,a=new SB(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)},i,r),s}},Uu=class extends Vt{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Je(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}},AB=class extends Uu{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Vt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Je(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}},mg=new xe,ow=new M,lw=new M,l1=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new H(512,512),this.map=null,this.mapPass=null,this.matrix=new xe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new e1,this._frameExtents=new H(1,1),this._viewportCount=1,this._viewports=[new ot(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;ow.setFromMatrixPosition(e.matrixWorld),t.position.copy(ow),lw.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(lw),t.updateMatrixWorld(),mg.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(mg),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(mg)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radiu
vendor: 7,513 bytes, line 3139
3139s=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}},MB=class extends l1{constructor(){super(new wr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){let t=this.camera,i=uu*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},EB=class extends Uu{constructor(e,t,i=0,r=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Vt.DEFAULT_UP),this.updateMatrix(),this.target=new Vt,this.distance=i,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new MB}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},hw=new xe,uc=new M,gg=new M,CB=class extends l1{constructor(){super(new wr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new H(4,2),this._viewportCount=6,this._viewports=[new ot(2,1,1,1),new ot(0,1,1,1),new ot(3,1,1,1),new ot(1,1,1,1),new ot(3,0,1,1),new ot(1,0,1,1)],this._cubeDirections=[new M(1,0,0),new M(-1,0,0),new M(0,0,1),new M(0,0,-1),new M(0,1,0),new M(0,-1,0)],this._cubeUps=[new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,0,1),new M(0,0,-1)]}updateMatrices(e,t=0){let i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),uc.setFromMatrixPosition(e.matrixWorld),i.position.copy(uc),gg.copy(i.position),gg.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(gg),i.updateMatrixWorld(),r.makeTranslation(-uc.x,-uc.y,-uc.z),hw.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(hw)}},TB=class extends Uu{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new CB}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}},PB=class extends l1{constructor(){super(new $f(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},DB=class extends Uu{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Vt.DEFAULT_UP),this.updateMatrix(),this.target=new Vt,this.shadow=new PB}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},jM=class extends He{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}},HM=class extends ku{constructor(e){super(e)}load(e,t,i,r){let s=this,a=new e0(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(n){try{t(s.parse(JSON.parse(n)))}catch(o){r?r(o):console.error(o),s.manager.itemError(e)}},i,r)}parse(e){let t={},i={};function r(u,d){if(t[d]!==void 0)return t[d];let p=u.interleavedBuffers[d],f=s(u,p.buffer),m=$u(p.type,f),g=new Rz(m,p.stride);return g.uuid=p.uuid,t[d]=g,g}function s(u,d){if(i[d]!==void 0)return i[d];let p=u.arrayBuffers[d],f=new Uint32Array(p).buffer;return i[d]=f,f}let a=e.isInstancedBufferGeometry?new jM:new He,n=e.data.index;if(n!==void 0){let u=$u(n.type,n.array);a.setIndex(new tt(u,1))}let o=e.data.attributes;for(let u in o){let d=o[u],p;if(d.isInterleavedBufferAttribute){let f=r(e.data,d.data);p=new Kv(f,d.itemSize,d.offset,d.normalized)}else{let f=$u(d.type,d.array),m=d.isInstancedBufferAttribute?pu:tt;p=new m(f,d.itemSize,d.normalized)}d.name!==void 0&&(p.name=d.name),d.usage!==void 0&&p.setUsage(d.usage),d.updateRange!==void 0&&(p.updateRange.offset=d.updateRange.offset,p.updateRange.count=d.updateRange.count),a.setAttribute(u,p)}let l=e.data.morphAttributes;if(l)for(let u in l){let d=l[u],p=[];for(let f=0,m=d.length;f<m;f++){let g=d[f],v;if(g.isInterleavedBufferAttribute){let y=r(e.data,g.data);v=new Kv(y,g.itemSize,g.offset,g.normalized)}else{let y=$u(g.type,g.array);v=new tt(y,g.itemSize,g.normalized)}g.name!==void 0&&(v.name=g.name),p.push(v)}a.morphAttributes[u]=p}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);let h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let u=0,d=h.length;u!==d;++u){let p=h[u];a.addGroup(p.start,p.count,p.materialIndex)}let c=e.data.boundingSphere;if(c!==void 0){let u=new M;c.center!==void 0&&u.fromArray(c.center),a.boundingSphere=new is(u,c.radius)}return e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}},OB=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=cw(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=cw();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function cw(){return(typeof performance>"u"?Date:performance).now()}var IB=class{constructor(e,t,i){this.binding=e,this.valueSize=i;let r,s,a;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:r=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let i=this.buffer,r=this.valueSize,s=e*r+r,a=this.cumulativeWeight;if(a===0){for(let n=0;n!==r;++n)i[s+n]=i[n];a=t}else{a+=t;let n=t/a;this._mixBufferRegion(i,s,0,n,r)}this.cumulativeWeight=a}accumulateAdditive(e){let t=this.buffer,i=this.valueSize,r=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,i=this.buffer,r=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,n=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){let o=t*this._origIndex;this._mixBufferRegion(i,r,o,1-s,t)}a>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let o=t,l=t+t;o!==l;++o)if(i[o]!==i[o+t]){n.setValue(i,r);break}}saveOriginalState(){let e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,a=r;s!==a;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;
vendor: 4,465 bytes, line 3139
3139for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,s){if(r>=.5)for(let a=0;a!==s;++a)e[t+a]=e[i+a]}_slerp(e,t,i,r){nt.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){let a=this._workIndex*s;nt.multiplyQuaternionsFlat(e,a,e,t,e,i),nt.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,i,r,s){let a=1-r;for(let n=0;n!==s;++n){let o=t+n;e[o]=e[o]*a+e[i+n]*r}}_lerpAdditive(e,t,i,r,s){for(let a=0;a!==s;++a){let n=t+a;e[n]=e[n]+e[i+a]*r}}},h1="\\[\\]\\.:\\/",RB=new RegExp("["+h1+"]","g"),c1="[^"+h1+"]",LB="[^"+h1.replace("\\.","")+"]",zB=/((?:WC+[\/:])*)/.source.replace("WC",c1),BB=/(WCOD+)?/.source.replace("WCOD",LB),FB=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",c1),kB=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",c1),UB=new RegExp("^"+zB+BB+FB+kB+"$"),NB=["material","materials","bones","map"],VB=class{constructor(e,t,i){let r=i||Xt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},Xt=class{constructor(e,t,i){this.path=t,this.parsedPath=i||Xt.parseTrackName(t),this.node=Xt.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Xt.Composite(e,t,i):new Xt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(RB,"")}static parseTrackName(e){let t=UB.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=i.nodeName.substring(r+1);NB.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){let i=function(s){for(let a=0;a<s.length;a++){let n=s[a];if(n.name===t||n.uuid===t)return n;let o=i(n.children);if(o)return o}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}
vendor: 11,686 bytes, line 3139
3139_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=Xt.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(i){let l=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===l){l=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}let a=e[r];if(a===void 0){let l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+r+" but it wasn't found.",e);return}let n=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?n=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(n=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=r;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][n]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Xt.Composite=VB;Xt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Xt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Xt.prototype.GetterByBindingType=[Xt.prototype._getValue_direct,Xt.prototype._getValue_array,Xt.prototype._getValue_arrayElement,Xt.prototype._getValue_toArray];Xt.prototype.SetterByBindingTypeAndVersioning=[[Xt.prototype._setValue_direct,Xt.prototype._setValue_direct_setNeedsUpdate,Xt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Xt.prototype._setValue_array,Xt.prototype._setValue_array_setNeedsUpdate,Xt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Xt.prototype._setValue_arrayElement,Xt.prototype._setValue_arrayElement_setNeedsUpdate,Xt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Xt.prototype._setValue_fromArray,Xt.prototype._setValue_fromArray_setNeedsUpdate,Xt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var jB=class{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;let s=t.tracks,a=s.length,n=new Array(a),o={endingStart:th,endingEnd:th};for(let l=0;l!==a;++l){let h=s[l].createInterpolant(null);n[l]=h,h.settings=o}this._interpolantSettings=o,this._interpolants=n,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=nM,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){let r=this._clip.duration,s=e._clip.duration,a=s/r,n=r/s;e.warp(1,a,t),this.warp(n,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){let e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){let r=this._mixer,s=r.time,a=this.timeScale,n=this._timeScaleInterpolant;n===null&&(n=r._lendControlInterpolant(),this._timeScaleInterpolant=n);let o=n.parameterPositions,l=n.sampleValues;return o[0]=s,o[1]=s+i,l[0]=e/a,l[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}let s=this._startTime;if(s!==null){let o=(e-s)*i;o<0||i===0?t=0:(this._startTime=null,t=i*o)}t*=this._updateTimeScale(e);let a=this._updateTime(t),n=this._updateWeight(e);if(n>0){let o=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case v3:for(let h=0,c=o.length;h!==c;++h)o[h].evaluate(a),l[h].accumulateAdditive(n);break;case Ky:default:for(let h=0,c=o.length;h!==c;++h)o[h].evaluate(a),l[h].accumulate(r,n)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let i=this._weightInterpolant;if(i!==null){let r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let i=this._timeScaleInterpolant;if(i!==null){let r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,i=this.loop,r=this.time+e,s=this._loopCount,a=i===Qy;if(e===0)return s===-1?r:a&&(s&1)===1?t-r:r;if(i===aM){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=t||r<0){let n=Math.floor(r/t);r-=t*n,s+=Math.abs(n);let o=this.repetitions-s;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(o===1){let l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=r;if(a&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){let r=this._interpolantSettings;i?(r.endingStart=ih,r.endingEnd=ih):(e?r.endingStart=this.zeroSlopeAtStart?ih:th:r.endingStart=qp,t?r.endingEnd=this.zeroSlopeAtEnd?ih:th:r.endingEnd=qp)}_scheduleFading(e,t,i){let r=this._mixer,s=r.time,a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);let n=a.parameterPositions,o=a.sampleValues;return n[0]=s,o[0]=t,n[1]=s+e,o[1]=i,this}},HB=new Float32Array(1),GB=class extends or{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,a=e._propertyBindings,n=e._interpolants,o=i.uuid,l=this._bindingsByRootAndName,h=l[o];h===void 0&&(h={},l[o]=h);for(let c=0;c!==s;++c){let u=r[c],d=u.name,p=h[d];if(p!==void 0)++p.referenceCount,a[c]=p;else{if(p=a[c],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,o,d));continue}let f=t&&t._propertyBindings[c].binding.parsedPath;p=new IB(Xt.create(i,d,f),u.ValueTypeName,u.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,o,d),a[c]=p}n[c].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}let t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){let s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){let s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,i){let r=this._actions,s=this._actionsByClip,a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{let n=a.knownActions;e._byClipCacheIndex=n.length,n.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[i]=e}_removeInactiveAction(e){let t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;let s=e._clip.uuid,a=this._actionsByClip,n=a[s],o=n.knownActions,l=o[o.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,o[h]=l,o.pop(),e._byClipCacheIndex=null;
vendor: 4,189 bytes, line 3139
3139let c=n.actionByRoot,u=(e._localRoot||this._root).uuid;delete c[u],o.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){let s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){let t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){let t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){let r=this._bindingsByRootAndName,s=this._bindings,a=r[t];a===void 0&&(a={},r[t]=a),a[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){let t=this._bindings,i=e.binding,r=i.rootNode.uuid,s=i.path,a=this._bindingsByRootAndName,n=a[r],o=t[t.length-1],l=e._cacheIndex;o._cacheIndex=l,t[l]=o,t.pop(),delete n[s],Object.keys(n).length===0&&delete a[r]}_lendBinding(e){let t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){let t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,i=e[t];return i===void 0&&(i=new UM(new Float32Array(2),new Float32Array(2),1,HB),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){let t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){let r=t||this._root,s=r.uuid,a=typeof e=="string"?$v.findByName(r,e):e,n=a!==null?a.uuid:e,o=this._actionsByClip[n],l=null;if(i===void 0&&(a!==null?i=a.blendMode:i=Ky),o!==void 0){let c=o.actionByRoot[s];if(c!==void 0&&c.blendMode===i)return c;l=o.knownActions[0],a===null&&(a=l._clip)}if(a===null)return null;let h=new jB(this,a,t,i);return this._bindAction(h,l),this._addInactiveAction(h,n,s),h}existingAction(e,t){let i=t||this._root,r=i.uuid,s=typeof e=="string"?$v.findByName(i,e):e,a=s?s.uuid:e,n=this._actionsByClip[a];return n!==void 0&&n.actionByRoot[r]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;let t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let l=0;l!==i;++l)t[l]._update(r,e,s,a);let n=this._bindings,o=this._nActiveBindings;for(let l=0;l!==o;++l)n[l].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,i=e.uuid,r=this._actionsByClip,s=r[i];if(s!==void 0){let a=s.knownActions;for(let n=0,o=a.length;n!==o;++n){let l=a[n];this._deactivateAction(l);let h=l._cacheIndex,c=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,c._cacheIndex=h,t[h]=c,t.pop(),this._removeInactiveBindingsForAction(l)}delete r[i]}}uncacheRoot(e){let t=e.uuid,i=this._actionsByClip;for(let a in i){let n=i[a].actionByRoot,o=n[t];o!==void 0&&(this._deactivateAction(o),this._removeInactiveAction(o))}let r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(let a in s){let n=s[a];n.restoreOriginalState(),this._removeInactiveBinding(n)}}uncacheAction(e,t){let i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}},ge=class{constructor(e){this.value=e}clone(){return new ge(this.value.clone===void 0?this.value:this.value.clone())}},GM=class{constructor(e,t,i=0,r=1/0){this.ray=new Nh(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new Jy,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster:
3139Unsupported camera type: "+t.type)}intersectObject(e,t=!0,i=[]){return t0(e,this,i,t),i.sort(uw),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)t0(e[r],this,i,t);return i.sort(uw),i}};function uw(e,t){return e.distance-t.distance}function t0(e,t,i,r){if(e.layers.test(t.layers)&&e.raycast(t,i),r===!0){let s=e.children;for(let a=0,n=s.length;a<n;a++)t0(s[a],t,i,!0)}}var dw=class{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(Pi(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}},pw=new H,u1=class{constructor(e=new H(1/0,1/0),t=new H(-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,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=pw.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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<this.min.x||this.max.y<this.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>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}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>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return pw.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),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)}},fw=new M,Ad=new M,bs=class{constructor(e=new M,t=new M){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){fw.subVectors(e,this.start),Ad.subVectors(this.end,this.start);let i=Ad.dot(Ad),r=Ad.dot(fw)/i;return t&&(r=Pi(r,0,1)),r}closestPointToPoint(e,t,i){let r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}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)}},mw=new M,WB=class extends Vt{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";let i=new He,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,n=1,o=32;a<o;a++,n++){let l=a/o*Math.PI*2,h=n/o*Math.PI*2;r.push(Math.cos(l),Math.sin(l),1,Math.cos(h),Math.sin(h),1)}i.setAttribute("position",new De(r,3));let s=new vo({fog:!1,toneMapped:!1});this.cone=new Bu(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),mw.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(mw),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},qB=class extends Zt{constructor(e,t,i){let r=new hh(t,4,2),s=new pn({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},gw=new M,Md=new M,vw=new M,XB=class extends Vt{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new He;r.setAttribute("position",new De([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let s=new vo({fog:!1,toneMapped:!1});this.lightPlane=new Qp(r,s),this.add(this.lightPlane),r=new He,r.setAttribute("position",new De([0,0,0,0,0,1],3)),this.targetLine=new Qp(r,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),gw.setFromMatrixPosition(this.light.matrixWorld),Md.setFromMatrixPosition(this.light.target.matrixWorld),vw.subVectors(Md,gw),this.lightPlane.lookAt(Md),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Md),this.targetLine.scale.z
vendor: 14,636 bytes, line 3139
3139=vw.length()}},Ed=new M,di=new go,tf=class extends Bu{constructor(e){let t=new He,i=new vo({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],a={};n("n1","n2"),n("n2","n4"),n("n4","n3"),n("n3","n1"),n("f1","f2"),n("f2","f4"),n("f4","f3"),n("f3","f1"),n("n1","f1"),n("n2","f2"),n("n3","f3"),n("n4","f4"),n("p","n1"),n("p","n2"),n("p","n3"),n("p","n4"),n("u1","u2"),n("u2","u3"),n("u3","u1"),n("c","t"),n("p","c"),n("cn1","cn2"),n("cn3","cn4"),n("cf1","cf2"),n("cf3","cf4");function n(p,f){o(p),o(f)}function o(p){r.push(0,0,0),s.push(0,0,0),a[p]===void 0&&(a[p]=[]),a[p].push(r.length/3-1)}t.setAttribute("position",new De(r,3)),t.setAttribute("color",new De(s,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();let l=new Je(16755200),h=new Je(16711680),c=new Je(43775),u=new Je(16777215),d=new Je(3355443);this.setColors(l,h,c,u,d)}setColors(e,t,i,r,s){let a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,i.r,i.g,i.b),a.setXYZ(33,i.r,i.g,i.b),a.setXYZ(34,i.r,i.g,i.b),a.setXYZ(35,i.r,i.g,i.b),a.setXYZ(36,i.r,i.g,i.b),a.setXYZ(37,i.r,i.g,i.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.b),a.setXYZ(40,s.r,s.g,s.b),a.setXYZ(41,s.r,s.g,s.b),a.setXYZ(42,s.r,s.g,s.b),a.setXYZ(43,s.r,s.g,s.b),a.setXYZ(44,s.r,s.g,s.b),a.setXYZ(45,s.r,s.g,s.b),a.setXYZ(46,s.r,s.g,s.b),a.setXYZ(47,s.r,s.g,s.b),a.setXYZ(48,s.r,s.g,s.b),a.setXYZ(49,s.r,s.g,s.b),a.needsUpdate=!0}update(){let e=this.geometry,t=this.pointMap,i=1,r=1;di.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),bi("c",t,e,di,0,0,-1),bi("t",t,e,di,0,0,1),bi("n1",t,e,di,-i,-r,-1),bi("n2",t,e,di,i,-r,-1),bi("n3",t,e,di,-i,r,-1),bi("n4",t,e,di,i,r,-1),bi("f1",t,e,di,-i,-r,1),bi("f2",t,e,di,i,-r,1),bi("f3",t,e,di,-i,r,1),bi("f4",t,e,di,i,r,1),bi("u1",t,e,di,i*.7,r*1.1,-1),bi("u2",t,e,di,-i*.7,r*1.1,-1),bi("u3",t,e,di,0,r*2,-1),bi("cf1",t,e,di,-i,0,1),bi("cf2",t,e,di,i,0,1),bi("cf3",t,e,di,0,-r,1),bi("cf4",t,e,di,0,r,1),bi("cn1",t,e,di,-i,0,-1),bi("cn2",t,e,di,i,0,-1),bi("cn3",t,e,di,0,-r,-1),bi("cn4",t,e,di,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function bi(e,t,i,r,s,a,n){Ed.set(s,a,n).unproject(r);let o=t[e];if(o!==void 0){let l=i.getAttribute("position");for(let h=0,c=o.length;h<c;h++)l.setXYZ(o[h],Ed.x,Ed.y,Ed.z)}}var rf=class extends Bu{constructor(e,t=16776960){let i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new He;s.setIndex(new tt(i,1)),s.setAttribute("position",new De(r,3)),super(s,new vo({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){let t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}},YB=class extends Bu{constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new He;r.setAttribute("position",new De(t,3)),r.setAttribute("color",new De(i,3));let s=new vo({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){let r=new Je,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},$a=QB();function QB(){let e=new ArrayBuffer(4),t=new Float32Array(e),i=new Uint32Array(e),r=new Uint32Array(512),s=new Uint32Array(512);for(let l=0;l<256;++l){let h=l-127;h<-27?(r[l]=0,r[l|256]=32768,s[l]=24,s[l|256]=24):h<-14?(r[l]=1024>>-h-14,r[l|256]=1024>>-h-14|32768,s[l]=-h-1,s[l|256]=-h-1):h<=15?(r[l]=h+15<<10,r[l|256]=h+15<<10|32768,s[l]=13,s[l|256]=13):h<128?(r[l]=31744,r[l|256]=64512,s[l]=24,s[l|256]=24):(r[l]=31744,r[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<1024;++l){let h=l<<13,c=0;for(;(h&8388608)===0;)h<<=1,c-=8388608;h&=-8388609,c+=947912704,a[l]=h|c}for(let l=1024;l<2048;++l)a[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)n[l]=l<<23;n[31]=1199570944,n[32]=2147483648;for(let l=33;l<63;++l)n[l]=2147483648+(l-32<<23);n[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:t,uint32View:i,baseTable:r,shiftTable:s,mantissaTable:a,exponentTable:n,offsetTable:o}}function KB(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Pi(e,-65504,65504),$a.floatView[0]=e;let t=$a.uint32View[0],i=t>>23&511;return $a.baseTable[i]+((t&8388607)>>$a.shiftTable[i])}function ZB(e){let t=e>>10;return $a.uint32View[0]=$a.mantissaTable[$a.offsetTable[t]+(e&1023)]+$a.exponentTable[t],$a.floatView[0]}var JB=Object.freeze({__proto__:null,fromHalfFloat:ZB,toHalfFloat:KB});typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Uh}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Uh);var dc=".",d1=Symbol("target"),WM=Symbol("unsubscribe");function i0(e){return e instanceof Date||e instanceof Set||e instanceof Map||e instanceof WeakSet||e instanceof WeakMap||ArrayBuffer.isView(e)}function $B(e){return(typeof e=="object"?e===null:typeof e!="function")||e instanceof RegExp}var ua=Array.isArray;function p1(e){return typeof e=="symbol"}var eF={after:(e,t)=>ua(e)?e.slice(t.length):t===""?e:e.slice(t.length+1),concat:(e,t)=>ua(e)?(e=[...e],t&&e.push(t),e):t&&t.toString!==void 0?(e!==""&&(e+=dc),p1(t)?e+t.toString():e+t):e,initial:e=>{if(ua(e))return e.slice(0,-1);if(e==="")return e;let t=e.lastIndexOf(dc);return t===-1?"":e.slice(0,t)},last:e=>{if(ua(e))return e[e.length-1]||"";if(e==="")return e;let t=e.lastIndexOf(dc);return t===-1?e:e.slice(t+1)},walk:(e,t)=>{if(ua(e))for(let i of e)t(i);else if(e!==""){let i=0,r=e.indexOf(dc);if(r===-1)t(e);else for(;i<e.length;)r===-1&&(r=e.length),t(e.slice(i,r)),i=r+1,r=e.indexOf(dc,i)}},get(e,t){return this.walk(t,i=>{e&&(e=e[i])}),e}},ps=eF;function tF(e){return typeof e=="object"&&typeof e.next=="function"}function iF(e,t,i,r,s){let a=e.next;if(t.name==="entries")e.next=function(){let n=a.call(this);return n.done===!1&&(n.value[0]=s(n.value[0],t,n.value[0],r),n.value[1]=s(n.value[1],t,n.value[0],r)),n};else if(t.name==="values"){let n=i[d1].keys();e.next=function(){let o=a.call(this);return o.done===!1&&(o.value=s(o.value,t,n.next().value,r)),o}}else e.next=function(){let n=a.call(this);return n.done===!1&&(n.value=s(n.value,t,n.value,r)),n};return e}function yw(e,t,i){return e.isUnsubscribed||t.ignoreSymbols&&p1(i)||t.ignoreUnderscores&&i.charAt(0)==="_"||"ignoreKeys"in t&&t.ignoreKeys.includes(i)}var rF=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return this._descriptorCache===void 0&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),i=t.get(e);return i===void 0&&(i={},t.set(e,i)),i}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let i=this._getProperties(e),r=i[t];return r===void 0&&(r=Reflect.getOwnPropertyDescriptor(e,t),i[t]=r),r}getProxy(e,t,i,r){if(this.isUnsubscribed)return e;let s=e[r],a=s||e;this._pathCache.set(a,t);let n=this._proxyCache.get(a);return n===void 0&&(n=s===void 0?new Proxy(e,i):e,this._proxyCache.set(a,n)),n}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,ps.get(t,this.getPath(e)))}defineProperty(e,t,i){return Reflect.defineProperty(e,t,i)?(this.isUnsubscribed||(this._getProperties(e)[t]=i),!0):!1}setProperty(e,t,i,r,s){if(!this._equals(s,i)||!(t in e)){let a=this._getOwnPropertyDescriptor(e,t);return a!==void 0&&"set"in a?Reflect.set(e,t,i,r):Reflect.set(e,t,i)}return!0}deleteProperty(e,t,i){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let r=this._getDescriptorCache().get(e);r&&(delete r[t],this._pathCache.delete(i))}return!0}return!1}isSameDescriptor(e,t,i){let r=this._getOwnPropertyDescriptor(t,i);return e!==void 0&&r!==void 0&&Object.is(e.value,r.value)&&(e.writable||!1)===(r.writable||!1)&&(e.enumerable||!1)===(r.enumerable||!1)&&(e.configurable||!1)===(r.configurable||!1)&&e.get===r.get&&e.set===r.set}isGetInvariant(e,t){let i=this._getOwnPropertyDescriptor(e,t);return i!==void 0&&i.configurable!==!0&&i.writable!==!0}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function r0(e){return toString.call(e)==="[object Object]"}function Cd(){return!0}function Tl(e,t){return e.length!==t.length||e.some((i,r)=>t[r]!==i)}var qM=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),sF=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),XM={push:Cd,pop:Cd,shift:Cd,unshift:Cd,copyWithin:Tl,reverse:Tl,sort:Tl,splice:Tl,flat:Tl,fill:Tl},aF=new Set([...qM,...sF,...Object.keys(XM)]);function Td(e,t){if(e.size!==t.size)return!0;for(let i of e)if(!t.has(i))return!0;return!1}var YM=["keys","values","entries"],QM=new Set(["has","toString"]),KM={add:Td,clear:Td,delete:Td,forEach:Td},nF=new Set([...QM,...Object.keys(KM),...YM]);function Pd(e,t){if(e.size!==t.size)return!0;let i;for(let[r,s]of e)if(i=t.get(r),i!==s||i===void 0&&!t.has(r))return!0;return!1}var oF=new Set([...QM,"get"]),ZM={set:Pd,clear:Pd,delete:Pd,forEach:Pd},lF=new Set([...oF,...Object.keys(ZM),...YM]),co=class{constructor(e,t,i,r){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=r,this._changes=r?[]:null,this.clone=t===void 0?e:this._shallowClone(e)}static isHandledMethod(e){return qM.has(e)}_shallowClone(e){let t=e;if(r0(e))t={...e};else if(ua(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(i=>this._shallowClone(i)));else if(e instanceof Map){t=new Map;for(let[i,r]of e.entries())t.set(i,this._shallowClone(r))}return this._clonedCache.add(t),t}preferredThisArg(e,t,i,r){return e?(ua(r)?this._onIsChanged=XM[t]:r instanceof Set?this._onIsChanged=KM[t]:r instanceof Map&&(this._onIsChanged=ZM[t]),r):i}update(e,t,i){let r=ps.after(e,this._path);if(t!=="length"){let s=this.clone;ps.walk(r,a=>{s&&s[a]&&(this._clonedCache.has(s[a])||(s[a]=this._shallowClone(s[a])),s=s[a])}),this._hasOnValidate&&this._changes.push({path:r,property:t,previous:i}),s&&s[t]&&(s[t]=i)}this._isChanged=!0}undo(e){let t;for(let i=this._changes.length-1;i!==-1;i--)t=this._changes[i],ps.get(e,t.path)[t.property]=t.previous}isChanged(e){return this._onIsChanged===void 0?this._isChanged:this._onIsChanged(this.clone,e)}},xw=class extends co{static isHandledMethod(e){return aF.has(e)}},hF=class extends co{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}},bw=class extends co{static isHandledMethod(e){return nF.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}},ww=class extends co{static isHandledMethod(e){return lF.has(e)}undo(e){for(let[t,i]of this.clone.entries())e.set(t,i);for(let t of e.keys())this.clone.has(t)||e.delete(t)}},cF=class extends co{constructor(e,t,i,r){super(void 0,t,i,r),this._arg1=i[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}},uF=class extends co{constructor(e,t,i,r){super(void 0,t,i,r),this._weakKey=i[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}},Yl=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return r0(e)||ua(e)||i0(e)}static isHandledMethod(e,t){return r0(e)?co.isHandledMethod(t):ua(e)?xw.isHandledMethod(t):e instanceof Set?bw.isHandledMethod(t):e instanceof Map?ww.isHandledMethod(t):i0(e)}get isCloning(){return this._stack.length>0}start(e,t,i){let r=co;ua(e)?r=xw:e instanceof Date?r=hF:e instanceof Set?r=bw:e instanceof Map?r=ww:e instanceof WeakSet?r=cF:e instanceof WeakMap&&(r=uF),this._stack.push(new r(e,t,i,this._hasOnValidate))}update(e,t,i){this._stack[this._stack.length-1].update(e,t,i)}preferredThisArg(e,t,i){let{name:r}=e,s=Yl.isHandledMethod(i,r);return this._stack[this._stack.length-1].preferredThisArg(s,r,t,i)}isChanged(e,t,i){return this._stack[this._stack.length-1].isChanged(e,t,i)}undo(e){this._previousClone!==void 0&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}},dF={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},f1=(e,t,i={})=>{i={...dF,...i};let r=Symbol("ProxyTarget"),{equals:s,isShallow:a,ignoreDetached:n,details:o}=i,l=new rF(s),h=typeof i.onValidate=="function",c=new Yl(h),u=(y,x,w,S,b)=>!h||c.isCloning||i.onValidate(ps.concat(l.getPath(y),x),w,S,b)===!0,d=(y,x,w,S)=>{!yw(l,i,x)&&!(n&&l.isDetached(y,e))&&p(l.getPath(y),x,w,S)},p=(y,x,w,S,b)=>{c.isCloning?c.update(y,x,S):t(ps.concat(y,x),w,S,b)},f=y=>y&&(y[r]||y),m=(y,x,w,S)=>$B(y)||w==="constructor"||a&&!Yl.isHandledMethod(x,w)||yw(l,i,w)||l.isGetInvariant(x,w)||n&&l.isDetached(x,e)?y:(S===void 0&&(S=l.getPath(x)),l.getProxy(y,ps.concat(S,w),g,r)),g={get(y,x,w){if(p1(x)
3139){if(x===r||x===d1)return y;if(x===WM&&!l.isUnsubscribed&&l.getPath(y).length===0)return l.unsubscribe(),y}let S=i0(y)?Reflect.get(y,x):Reflect.get(y,x,w);return m(S,y,x)},set(y,x,w,S){w=f(w);let b=y[r]||y,E=b[x];if(s(E,w)&&x in y)return!0;let _=u(y,x,w,E);return _&&l.setProperty(b,x,w,S,E)?(d(y,x,y[x],E),!0):!_},defineProperty(y,x,w){if(!l.isSameDescriptor(w,y,x)){let S=y[x];u(y,x,w.value,S)&&l.defineProperty(y,x,w,S)&&d(y,x,w.value,S)}return!0},deleteProperty(y,x){if(!Reflect.has(y,x))return!0;let w=Reflect.get(y,x),S=u(y,x,void 0,w);return S&&l.deleteProperty(y,x,w)?(d(y,x,void 0,w),!0):!S},apply(y,x,w){let S=x[r]||x;if(l.isUnsubscribed)return Reflect.apply(y,S,w);if((o===!1||o!==!0&&!o.includes(y.name))&&Yl.isHandledType(S)){let b=ps.initial(l.getPath(y)),E=Yl.isHandledMethod(S,y.name);c.start(S,b,w);let _=Reflect.apply(y,c.preferredThisArg(y,x,S),E?w.map(T=>f(T)):w),A=c.isChanged(S,s),C=c.stop();if(Yl.isHandledType(_)&&E&&(x instanceof Map&&y.name==="get"&&(b=ps.concat(b,w[0])),_=l.getProxy(_,b,g)),A){let T={name:y.name,args:w,result:_},I=c.isCloning?ps.initial(b):b,P=c.isCloning?ps.last(b):"";u(ps.get(e,I),P,S,C,T)?p(I,P,S,C,T):c.undo(S)}return(x instanceof Map||x instanceof Set)&&tF(_)?iF(_,y,x,b,m):_}return Reflect.apply(y,x,w)}},v=l.getProxy(e,i.pathAsArray?[]:"",g);return t=t.bind(v),h&&(i.onValidate=i.onValidate.bind(v)),v};f1.target=e=>e&&e[d1]||e;f1.unsubscribe=e=>e[WM]||e;var Sw=f1,pF=typeof global=="object"&&global&&global.Object===Object&&global,JM=pF,fF=typeof self=="object"&&self&&self.Object===Object&&self,mF=JM||fF||Function("return this")(),Gs=mF,gF=Gs.Symbol,ws=gF,$M=Object.prototype,vF=$M.hasOwnProperty,yF=$M.toString,pc=ws?ws.toStringTag:void 0;function xF(e){var t=vF.call(e,pc),i=e[pc];try{e[pc]=void 0;var r=!0}catch{}var s=yF.call(e);return r&&(t?e[pc]=i:delete e[pc]),s}var bF=xF,wF=Object.prototype,SF=wF.toString;function _F(e){return SF.call(e)}var AF=_F,MF="[object Null]",EF="[object Undefined]",_w=ws?ws.toStringTag:void 0;function CF(e){return e==null?e===void 0?EF:MF:_w&&_w in Object(e)?bF(e):AF(e)}var ll=CF;function TF(e){return e!=null&&typeof e=="object"}var fn=TF,PF="[object Symbol]";function DF(e){return typeof e=="symbol"||fn(e)&&ll(e)==PF}var Nu=DF;function OF(e,t){for(var i=-1,r=e==null?0:e.length,s=Array(r);++i<r;)s[i]=t(e[i],i,e);return s}var eE=OF,IF=Array.isArray,_a=IF,Aw=ws?ws.prototype:void 0,Mw=Aw?Aw.toString:void 0;function tE(e){if(typeof e=="string")return e;if(_a(e))return eE(e,tE)+"";if(Nu(e))return Mw?Mw.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var iE=tE,RF=/\s/;function LF(e){for(var t=e.length;t--&&RF.test(e.charAt(t)););return t}var rE=LF,zF=/^\s+/;function BF(e){return e&&e.slice(0,rE(e)+1).replace(zF,"")}var FF=BF;function kF(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var rs=kF,Ew=NaN,UF=/^[-+]0x[0-9a-f]+$/i,NF=/^0b[01]+$/i,VF=/^0o[0-7]+$/i,jF=parseInt;function HF(e){if(typeof e=="number")return e;if(Nu(e))return Ew;if(rs(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=rs(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=FF(e);var i=NF.test(e);return i||VF.test(e)?jF(e.slice(2),i?2:8):UF.test(e)?Ew:+e}var Cw=HF;function GF(e){return e}var sE=GF,WF="[object AsyncFunction]",qF="[object Function]",XF="[object GeneratorFunction]",YF="[object Proxy]";function QF(e){if(!rs(e))return!1;var t=ll(e);return t==qF||t==XF||t==WF||t==YF}var aE=QF,KF=Gs["__core-js_shared__"],vg=KF,Tw=(function(){var e=/[^.]+$/.exec(vg&&vg.keys&&vg.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function ZF(e){return!!Tw&&Tw in e}var JF=ZF,$F=Function.prototype,e4=$F.toString;function t4(e){if(e!=null){try{return e4.call(e)}catch{}try{return e+""}catch{}}return""}var hl=t4,i4=/[\\^$.*+?()[\]{}|]/g,r4=/^\[object .+?Constructor\]$/,s4=Function.prototype,a4=Object.prototype,n4=s4.toString,o4=a4.hasOwnProperty,l4=RegExp("^"+n4.call(o4).replace(i4,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h4(e){if(!rs(e)||JF(e))return!1;var t=aE(e)?l4:r4;return t.test(hl(e))}var c4=h4;function u4(e,t){return e?.[t]}var d4=u4;function p4(e,t){var i=d4(e,t);return c4(i)?i:void 0}var cl=p4,f4=cl(Gs,"WeakMap"),s0=f4,Pw=Object.create,m4=(function(){function e(){}return function(t){if(!rs(t))return{};if(Pw)return Pw(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}})(),g4=m4;function v4(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}var y4=v4;function x4(e,t){var i=-1,r=e.length;for(t||(t=Array(r));++i<r;)t[i]=e[i];return t}var b4=x4,w4=800,S4=16,_4=Date.now;function A4(e){var t=0,i=0;return function(){var r=_4(),s=S4-(r-i);if(i=r,s>0){if(++t>=w4)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var M4=A4;function E4(e){return function(){return e}}var C4=E4,T4=(function(){try{var e=cl(Object,"defineProperty");return e({},"",{}),e}catch{}})(),sf=T4,P4=sf?function(e,t){return sf(e,"toString",{configurable:!0,enumerable:!1,value:C4(t),writable:!0})}:sE,D4=P4,O4=M4(D4),I4=O4;function R4(e,t){for(var i=-1,r=e==null?0:e.length;++i<r&&t(e[i],i,e)!==!1;);return e}var L4=R4;function z4(e,t,i,r){for(var s=e.length,a=i+(r?1:-1);r?a--:++a<s;)if(t(e[a],a,e))return a;return-1}var B4=z4;
vendor: 12,629 bytes, line 3139
3139function F4(e){return e!==e}var k4=F4;function U4(e,t,i){for(var r=i-1,s=e.length;++r<s;)if(e[r]===t)return r;return-1}var N4=U4;function V4(e,t,i){return t===t?N4(e,t,i):B4(e,k4,i)}var j4=V4,H4=9007199254740991,G4=/^(?:0|[1-9]\d*)$/;function W4(e,t){var i=typeof e;return t=t??H4,!!t&&(i=="number"||i!="symbol"&&G4.test(e))&&e>-1&&e%1==0&&e<t}var m1=W4;function q4(e,t,i){t=="__proto__"&&sf?sf(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}var nE=q4;function X4(e,t){return e===t||e!==e&&t!==t}var g1=X4,Y4=Object.prototype,Q4=Y4.hasOwnProperty;function K4(e,t,i){var r=e[t];(!(Q4.call(e,t)&&g1(r,i))||i===void 0&&!(t in e))&&nE(e,t,i)}var v1=K4;function Z4(e,t,i,r){var s=!i;i||(i={});for(var a=-1,n=t.length;++a<n;){var o=t[a],l=r?r(i[o],e[o],o,i,e):void 0;l===void 0&&(l=e[o]),s?nE(i,o,l):v1(i,o,l)}return i}var Vu=Z4,Dw=Math.max;function J4(e,t,i){return t=Dw(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,a=Dw(r.length-t,0),n=Array(a);++s<a;)n[s]=r[t+s];s=-1;for(var o=Array(t+1);++s<t;)o[s]=r[s];return o[t]=i(n),y4(e,this,o)}}var $4=J4,ek=9007199254740991;function tk(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ek}var y1=tk;function ik(e){return e!=null&&y1(e.length)&&!aE(e)}var oE=ik,rk=Object.prototype;function sk(e){var t=e&&e.constructor,i=typeof t=="function"&&t.prototype||rk;return e===i}var x1=sk;function ak(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}var nk=ak,ok="[object Arguments]";function lk(e){return fn(e)&&ll(e)==ok}var Ow=lk,lE=Object.prototype,hk=lE.hasOwnProperty,ck=lE.propertyIsEnumerable,uk=Ow((function(){return arguments})())?Ow:function(e){return fn(e)&&hk.call(e,"callee")&&!ck.call(e,"callee")},b1=uk;function dk(){return!1}var pk=dk,hE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Iw=hE&&typeof module=="object"&&module&&!module.nodeType&&module,fk=Iw&&Iw.exports===hE,Rw=fk?Gs.Buffer:void 0,mk=Rw?Rw.isBuffer:void 0,gk=mk||pk,af=gk,vk="[object Arguments]",yk="[object Array]",xk="[object Boolean]",bk="[object Date]",wk="[object Error]",Sk="[object Function]",_k="[object Map]",Ak="[object Number]",Mk="[object Object]",Ek="[object RegExp]",Ck="[object Set]",Tk="[object String]",Pk="[object WeakMap]",Dk="[object ArrayBuffer]",Ok="[object DataView]",Ik="[object Float32Array]",Rk="[object Float64Array]",Lk="[object Int8Array]",zk="[object Int16Array]",Bk="[object Int32Array]",Fk="[object Uint8Array]",kk="[object Uint8ClampedArray]",Uk="[object Uint16Array]",Nk="[object Uint32Array]",ri={};ri[Ik]=ri[Rk]=ri[Lk]=ri[zk]=ri[Bk]=ri[Fk]=ri[kk]=ri[Uk]=ri[Nk]=!0;ri[vk]=ri[yk]=ri[Dk]=ri[xk]=ri[Ok]=ri[bk]=ri[wk]=ri[Sk]=ri[_k]=ri[Ak]=ri[Mk]=ri[Ek]=ri[Ck]=ri[Tk]=ri[Pk]=!1;function Vk(e){return fn(e)&&y1(e.length)&&!!ri[ll(e)]}var jk=Vk;function Hk(e){return function(t){return e(t)}}var w1=Hk,cE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zc=cE&&typeof module=="object"&&module&&!module.nodeType&&module,Gk=Zc&&Zc.exports===cE,yg=Gk&&JM.process,Wk=(function(){try{var e=Zc&&Zc.require&&Zc.require("util").types;return e||yg&&yg.binding&&yg.binding("util")}catch{}})(),Mh=Wk,Lw=Mh&&Mh.isTypedArray,qk=Lw?w1(Lw):jk,uE=qk,Xk=Object.prototype,Yk=Xk.hasOwnProperty;function Qk(e,t){var i=_a(e),r=!i&&b1(e),s=!i&&!r&&af(e),a=!i&&!r&&!s&&uE(e),n=i||r||s||a,o=n?nk(e.length,String):[],l=o.length;for(var h in e)(t||Yk.call(e,h))&&!(n&&(h=="length"||s&&(h=="offset"||h=="parent")||a&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||m1(h,l)))&&o.push(h);return o}var dE=Qk;function Kk(e,t){return function(i){return e(t(i))}}var pE=Kk,Zk=pE(Object.keys,Object),Jk=Zk,$k=Object.prototype,eU=$k.hasOwnProperty;function tU(e){if(!x1(e))return Jk(e);var t=[];for(var i in Object(e))eU.call(e,i)&&i!="constructor"&&t.push(i);return t}var iU=tU;function rU(e){return oE(e)?dE(e):iU(e)}var S1=rU;function sU(e){var t=[];if(e!=null)for(var i in Object(e))t.push(i);return t}var aU=sU,nU=Object.prototype,oU=nU.hasOwnProperty;function lU(e){if(!rs(e))return aU(e);var t=x1(e),i=[];for(var r in e)r=="constructor"&&(t||!oU.call(e,r))||i.push(r);return i}var hU=lU;function cU(e){return oE(e)?dE(e,!0):hU(e)}var ko=cU,uU=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,dU=/^\w*$/;function pU(e,t){if(_a(e))return!1;var i=typeof e;return i=="number"||i=="symbol"||i=="boolean"||e==null||Nu(e)?!0:dU.test(e)||!uU.test(e)||t!=null&&e in Object(t)}var fU=pU,mU=cl(Object,"create"),vu=mU;function gU(){this.__data__=vu?vu(null):{},this.size=0}var vU=gU;function yU(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var xU=yU,bU="__lodash_hash_undefined__",wU=Object.prototype,SU=wU.hasOwnProperty;function _U(e){var t=this.__data__;if(vu){var i=t[e];return i===bU?void 0:i}return SU.call(t,e)?t[e]:void 0}var AU=_U,MU=Object.prototype,EU=MU.hasOwnProperty;function CU(e){var t=this.__data__;return vu?t[e]!==void 0:EU.call(t,e)}var TU=CU,PU="__lodash_hash_undefined__";function DU(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=vu&&t===void 0?PU:t,this}var OU=DU;function Wh(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}Wh.prototype.clear=vU;Wh.prototype.delete=xU;Wh.prototype.get=AU;Wh.prototype.has=TU;Wh.prototype.set=OU;var zw=Wh;function IU(){this.__data__=[],this.size=0}var RU=IU;function LU(e,t){for(var i=e.length;i--;)if(g1(e[i][0],t))return i;return-1}var sm=LU,zU=Array.prototype,BU=zU.splice;function FU(e){var t=this.__data__,i=sm(t,e);if(i<0)return!1;var r=t.length-1;return i==r?t.pop():BU.call(t,i,1),--this.size,!0}var kU=FU;function UU(e){var t=this.__data__,i=sm(t,e);return i<0?void 0:t[i][1]}var NU=UU;function VU(e){return sm(this.__data__,e)>-1}var jU=VU;function HU(e,t){var i=this.__data__,r=sm(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this}var GU=HU;function qh(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}qh.prototype.clear=RU;qh.prototype.delete=kU;qh.prototype.get=NU;qh.prototype.has=jU;qh.prototype.set=GU;var am=qh,WU=cl(Gs,"Map"),yu=WU;function qU(){this.size=0,this.__data__={hash:new zw,map:new(yu||am),string:new zw}}var XU=qU;function YU(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var QU=YU;function KU(e,t){var i=e.__data__;return QU(t)?i[typeof t=="string"?"string":"hash"]:i.map}var nm=KU;function ZU(e){var t=nm(this,e).delete(e);return this.size-=t?1:0,t}var JU=ZU;function $U(e){return nm(this,e).get(e)}var eN=$U;function tN(e){return nm(this,e).has(e)}var iN=tN;function rN(e,t){var i=nm(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this}var sN=rN;function Xh(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var r=e[t];this.set(r[0],r[1])}}Xh.prototype.clear=XU;Xh.prototype.delete=JU;Xh.prototype.get=eN;Xh.prototype.has=iN;Xh.prototype.set=sN;var om=Xh,aN="Expected a function";function _1(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(aN);var i=function(){var r=arguments,s=t?t.apply(this,r):r[0],a=i.cache;if(a.has(s))return a.get(s);var n=e.apply(this,r);return i.cache=a.set(s,n)||a,n};return i.cache=new(_1.Cache||om),i}_1.Cache=om;var nN=_1,oN=500;function lN(e){var t=nN(e,function(r){return i.size===oN&&i.clear(),r}),i=t.cache;return t}var hN=lN,cN=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,uN=/\\(\\)?/g,dN=hN(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(cN,function(i,r,s,a){t.push(s?a.replace(uN,"$1"):r||i)}),t}),pN=dN;function fN(e){return e==null?"":iE(e)}var fE=fN;function mN(e,t){return _a(e)?e:fU(e,t)?[e]:pN(fE(e))}var Yh=mN;function gN(e){if(typeof e=="string"||Nu(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var lm=gN;function vN(e,t){t=Yh(t,e);for(var i=0,r=t.length;e!=null&&i<r;)e=e[lm(t[i++])];return i&&i==r?e:void 0}var mE=vN;function yN(e,t){for(var i=-1,r=t.length,s=e.length;++i<r;)e[s+i]=t[i];return e}var A1=yN,Bw=ws?ws.isConcatSpreadable:void 0;function xN(e){return _a(e)||b1(e)||!!(Bw&&e&&e[Bw])}var bN=xN;function gE(e,t,i,r,s){var a=-1,n=e.length;for(i||(i=bN),s||(s=[]);++a<n;){var o=e[a];t>0&&i(o)?t>1?gE(o,t-1,i,r,s):A1(s,o):r||(s[s.length]=o)}return s}var wN=gE;function SN(e){var t=e==null?0:e.length;return t?wN(e,1):[]}var _N=SN;function AN(e){return I4($4(e,void 0,_N),e+"")}var vE=AN,MN=pE(Object.getPrototypeOf,Object),M1=MN,EN="[object Object]",CN=Function.prototype,TN=Object.prototype,yE=CN.toString,PN=TN.hasOwnProperty,DN=yE.call(Object);function ON(e){if(!fn(e)||ll(e)!=EN)return!1;var t=M1(e);if(t===null)return!0;var i=PN.call(t,"constructor")&&t.constructor;return typeof i=="function"&&i instanceof i&&yE.call(i)==DN}var IN=ON;function RN(e,t,i){var r=-1,s=e.length;t<0&&(t=-t>s?0:s+t),i=i>s?s:i,i<0&&(i+=s),s=t>i?0:i-t>>>0,t>>>=0;for(var a=Array(s);++r<s;)a[r]=e[r+t];return a}var xE=RN;function LN(e,t,i){var r=e.length;return i=i===void 0?r:i,!t&&i>=r?e:xE(e,t,i)}var zN=LN,BN="\\ud800-\\udfff",FN="\\u0300-\\u036f",kN="\\ufe20-\\ufe2f",UN="\\u20d0-\\u20ff",NN=FN+kN+UN,VN="\\ufe0e\\ufe0f",jN="\\u200d",HN=RegExp("["+jN+BN+NN+VN+"]");function GN(e){return HN.test(e)}var WN=GN;function qN(e){return e.split("")}var XN=qN,bE="\\ud800-\\udfff",YN="\\u0300-\\u036f",QN="\\ufe20-\\ufe2f",KN="\\u20d0-\\u20ff",ZN=YN+QN+KN,JN="\\ufe0e\\ufe0f",$N="["+bE+"]",a0="["+ZN+"]",n0="\\ud83c[\\udffb-\\udfff]",e5="(?:"+a0+"|"+n0+")",wE="[^"+bE+"]",SE="(?:\\ud83c[\\udde6-\\uddff]){2}",_E="[\\ud800-\\udbff][\\udc00-\\udfff]",t5="\\u200d",AE=e5+"?",ME="["+JN+"]?",i5="(?:"+t5+"(?:"+[wE,SE,_E].join("|")+")"+ME+AE+")*",r5=ME+AE+i5,s5="(?:"+[wE+a0+"?",a0,SE,_E,$N].join("|")+")",a5=RegExp(n0+"(?="+n0+")|"+s5+r5,"g");function n5(e){return e.match(a5)||[]}var o5=n5;function l5(e){return WN(e)?o5(e):XN(e)}var Fw=l5;function h5(){this.__data__=new am,this.size=0}var c5=h5;function u5(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}var d5=u5;function p5(e){return this.__data__.get(e)}var f5=p5;function m5(e){return this.__data__.has(e)}var g5=m5,v5=200;function y5(e,t){var i=this.__data__;if(i instanceof am){var r=i.__data__;if(!yu||r.length<v5-1)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new om(r)}return i.set(e,t),this.size=i.size,this}var x5=y5;function Qh(e){var t=this.__data__=new am(e);this.size=t.size}Qh.prototype.clear=c5;Qh.prototype.delete=d5;Qh.prototype.get=f5;Qh.prototype.has=g5;Qh.prototype.set=x5;var Pp=Qh;function b5(e,t){return e&&Vu(t,S1(t),e)}var w5=b5;function S5(e,t){return e&&Vu(t,ko(t),e)}var _5=S5,EE=typeof exports=="object"&&exports&&!exports.nodeType&&exports,kw=EE&&typeof module=="object"&&module&&!module.nodeType&&module,A5=kw&&kw.exports===EE,Uw=A5?Gs.Buffer:void 0,Nw=Uw?Uw.allocUnsafe:void 0;function M5(e,t){if(t)return e.slice();var i=e.length,r=Nw?Nw(i):new e.constructor(i);return e.copy(r),r}var E5=M5;function C5(e,t){for(var i=-1,r=e==null?0:e.length,s=0,a=[];++i<r;){var n=e[i];t(n,i,e)&&(a[s++]=n)}return a}var T5=C5;function P5(){return[]}var CE=P5,D5=Object.prototype,O5=D5.propertyIsEnumerable,Vw=Object.getOwnPropertySymbols,I5=Vw?function(e){return e==null?[]:(e=Object(e),T5(Vw(e),function(t){return O5.call(e,t)}))}:CE,E1=I5;function R5(e,t){return Vu(e,E1(e),t)}var L5=R5,z5=Object.getOwnPropertySymbols,B5=z5?function(e){for(var t=[];e;)A1(t,E1(e)),e=M1(e);return t}:CE,TE=B5;function F5(e,t){return Vu(e,TE(e),t)}var k5=F5;function U5(e,t,i){var r=t(e);return _a(e)?r:A1(r,i(e))}var PE=U5;function N5(e){return PE(e,S1,E1)}var o0=N5;function V5(e){return PE(e,ko,TE)}var DE=V5,j5=cl(Gs,"DataView"),l0=j5,H5=cl(Gs,"Promise"),h0=H5,G5=cl(Gs,"Set"),c0=G5,jw="[object Map]",W5="[object Object]",Hw="[object Promise]",Gw="[object Set]",Ww="[object WeakMap]",qw="[object DataView]",q5=hl(l0),X5=hl(yu),Y5=hl(h0),Q5=hl(c0),K5=hl(s0),Po=ll;(l0&&Po(new l0(new ArrayBuffer(1)))!=qw||yu&&Po(new yu)!=jw||h0&&Po(h0.resolve())!=Hw||c0&&Po(new c0)!=Gw||s0&&Po(new s0)!=Ww)&&(Po=function(e){var t=ll(e),i=t==W5?e.constructor:void 0,r=i?hl(i):"";if(r)switch(r){case q5:return qw;case X5:return jw;case Y5:return Hw;case Q5:return Gw;case K5:return Ww}return t});var xu=Po,Z5=Object.prototype,J5=Z5.hasOwnProperty;function $5(e){var t=e.length,i=new e.constructor(t);return t&&typeof e[0]=="string"&&J5.call(e,"index")&&(i.index=e.index,i.input=e.input),i}var eV=$5,tV=Gs.Uint8Array,nf=tV;function iV(e){var t=new e.constructor(e.byteLength);return new nf(t).set(new nf(e)),t}var C1=iV;function rV(e,t){var i=t?C1(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}var sV=rV,aV=/\w*$/;function nV(e){var t=new e.constructor(e.source,aV.exec(e));return t.lastIndex=e.lastIndex,t}
vendor: 4,229 bytes, line 3139
3139var oV=nV,Xw=ws?ws.prototype:void 0,Yw=Xw?Xw.valueOf:void 0;function lV(e){return Yw?Object(Yw.call(e)):{}}var hV=lV;function cV(e,t){var i=t?C1(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}var uV=cV,dV="[object Boolean]",pV="[object Date]",fV="[object Map]",mV="[object Number]",gV="[object RegExp]",vV="[object Set]",yV="[object String]",xV="[object Symbol]",bV="[object ArrayBuffer]",wV="[object DataView]",SV="[object Float32Array]",_V="[object Float64Array]",AV="[object Int8Array]",MV="[object Int16Array]",EV="[object Int32Array]",CV="[object Uint8Array]",TV="[object Uint8ClampedArray]",PV="[object Uint16Array]",DV="[object Uint32Array]";function OV(e,t,i){var r=e.constructor;switch(t){case bV:return C1(e);case dV:case pV:return new r(+e);case wV:return sV(e,i);case SV:case _V:case AV:case MV:case EV:case CV:case TV:case PV:case DV:return uV(e,i);case fV:return new r;case mV:case yV:return new r(e);case gV:return oV(e);case vV:return new r;case xV:return hV(e)}}var IV=OV;function RV(e){return typeof e.constructor=="function"&&!x1(e)?g4(M1(e)):{}}var LV=RV,zV="[object Map]";function BV(e){return fn(e)&&xu(e)==zV}var FV=BV,Qw=Mh&&Mh.isMap,kV=Qw?w1(Qw):FV,UV=kV,NV="[object Set]";function VV(e){return fn(e)&&xu(e)==NV}var jV=VV,Kw=Mh&&Mh.isSet,HV=Kw?w1(Kw):jV,GV=HV,WV=1,qV=2,XV=4,OE="[object Arguments]",YV="[object Array]",QV="[object Boolean]",KV="[object Date]",ZV="[object Error]",IE="[object Function]",JV="[object GeneratorFunction]",$V="[object Map]",ej="[object Number]",RE="[object Object]",tj="[object RegExp]",ij="[object Set]",rj="[object String]",sj="[object Symbol]",aj="[object WeakMap]",nj="[object ArrayBuffer]",oj="[object DataView]",lj="[object Float32Array]",hj="[object Float64Array]",cj="[object Int8Array]",uj="[object Int16Array]",dj="[object Int32Array]",pj="[object Uint8Array]",fj="[object Uint8ClampedArray]",mj="[object Uint16Array]",gj="[object Uint32Array]",ei={};ei[OE]=ei[YV]=ei[nj]=ei[oj]=ei[QV]=ei[KV]=ei[lj]=ei[hj]=ei[cj]=ei[uj]=ei[dj]=ei[$V]=ei[ej]=ei[RE]=ei[tj]=ei[ij]=ei[rj]=ei[sj]=ei[pj]=ei[fj]=ei[mj]=ei[gj]=!0;ei[ZV]=ei[IE]=ei[aj]=!1;function Dp(e,t,i,r,s,a){var n,o=t&WV,l=t&qV,h=t&XV;if(i&&(n=s?i(e,r,s,a):i(e)),n!==void 0)return n;if(!rs(e))return e;var c=_a(e);if(c){if(n=eV(e),!o)return b4(e,n)}else{var u=xu(e),d=u==IE||u==JV;if(af(e))return E5(e,o);if(u==RE||u==OE||d&&!s){if(n=l||d?{}:LV(e),!o)return l?k5(e,_5(n,e)):L5(e,w5(n,e))}else{if(!ei[u])return s?e:{};n=IV(e,u,o)}}a||(a=new Pp);var p=a.get(e);if(p)return p;a.set(e,n),GV(e)?e.forEach(function(g){n.add(Dp(g,t,i,g,e,a))}):UV(e)&&e.forEach(function(g,v){n.set(v,Dp(g,t,i,v,e,a))});var f=h?l?DE:o0:l?ko:S1,m=c?void 0:f(e);return L4(m||e,function(g,v){m&&(v=g,g=e[v]),v1(n,v,Dp(g,t,i,v,e,a))}),n}var LE=Dp,vj=1,yj=4;function xj(e){return LE(e,vj|yj)}var hm=xj,bj="__lodash_hash_undefined__";function wj(e){return this.__data__.set(e,bj),this}var Sj=wj;function _j(e){return this.__data__.has(e)}var Aj=_j;function of(e){var t=-1,i=e==null?0:e.length;for(this.__data__=new om;++t<i;)this.add(e[t])}of.prototype.add=of.prototype.push=Sj;of.prototype.has=Aj;var Mj=of;function Ej(e,t){for(var i=-1,r=e==null?0:e.length;++i<r;)if(t(e[i],i,e))return!0;return!1}var Cj=Ej;function Tj(e,t){return e.has(t)}var Pj=Tj,Dj=1,Oj=2;function Ij(e,t,i,r,s,a){var n=i&Dj,o=e.length,l=t.length;if(o!=l&&!(n&&l>o))return!1;var h=a.get(e),c=a.get(t);if(h&&c)return h==t&&c==e;var u=-1,d=!0,p=i&Oj?new Mj:void 0;for(a.set(e,t),a.set(t,e);++u<o;){var f=e[u],m=t[u];if(r)var g=n?r(m,f,u,t,e,a):r(f,m,u,e,t,a);if(g!==void 0){if(g)continue;d=!1;break}if(p){if(!Cj(t,function(v,y){if(!Pj(p,y)&&(f===v||s(f,v,i,r,a)))return p.push(y)})){d=!1;break}}else if(!(f===m||s(f,m,i,r,a))){d=!1;break}}return a.delete(e),a.delete(t),d}var zE=Ij;function Rj(e){var t=-1,i=Array(e.size);return e.forEach(function(r,s){i[++t]=[s,r]}),i}var Lj=Rj;function zj(e){var t=-1,i=Array(e.size);return e.forEach(function(r){i[++t]=r}),i}var Bj=zj,Fj=1,kj=2,Uj="[object Boolean]",Nj="[object Date]",Vj="[object Error]",jj="[object Map]",Hj="[object Number]",Gj="[object RegExp]",Wj="[object Set]",qj="[object String]",Xj="[object Symbol]",Yj="[object ArrayBuffer]",Qj="[object DataView]",Zw=ws?ws.prototype:void 0,xg=Zw?Zw.valueOf
vendor: 1,671 bytes, line 3139
3139:void 0;function Kj(e,t,i,r,s,a,n){switch(i){case Qj:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Yj:return!(e.byteLength!=t.byteLength||!a(new nf(e),new nf(t)));case Uj:case Nj:case Hj:return g1(+e,+t);case Vj:return e.name==t.name&&e.message==t.message;case Gj:case qj:return e==t+"";case jj:var o=Lj;case Wj:var l=r&Fj;if(o||(o=Bj),e.size!=t.size&&!l)return!1;var h=n.get(e);if(h)return h==t;r|=kj,n.set(e,t);var c=zE(o(e),o(t),r,s,a,n);return n.delete(e),c;case Xj:if(xg)return xg.call(e)==xg.call(t)}return!1}var Zj=Kj,Jj=1,$j=Object.prototype,e6=$j.hasOwnProperty;function t6(e,t,i,r,s,a){var n=i&Jj,o=o0(e),l=o.length,h=o0(t),c=h.length;if(l!=c&&!n)return!1;for(var u=l;u--;){var d=o[u];if(!(n?d in t:e6.call(t,d)))return!1}var p=a.get(e),f=a.get(t);if(p&&f)return p==t&&f==e;var m=!0;a.set(e,t),a.set(t,e);for(var g=n;++u<l;){d=o[u];var v=e[d],y=t[d];if(r)var x=n?r(y,v,d,t,e,a):r(v,y,d,e,t,a);if(!(x===void 0?v===y||s(v,y,i,r,a):x)){m=!1;break}g||(g=d=="constructor")}if(m&&!g){var w=e.constructor,S=t.constructor;w!=S&&"constructor"in e&&"constructor"in t&&!(typeof w=="function"&&w instanceof w&&typeof S=="function"&&S instanceof S)&&(m=!1)}return a.delete(e),a.delete(t),m}var i6=t6,r6=1,Jw="[object Arguments]",$w="[object Array]",Dd="[object Object]",s6=Object.prototype,eS=s6.hasOwnProperty;function a6(e,t,i,r,s,a){var n=_a(e),o=_a(t),l=n?$w:xu(e),h=o?$w:xu(t);l=l==Jw?Dd:l,h=h==Jw?Dd:h;var c=l==Dd,u=h==Dd,d=l==h;if(d&&af(e)){if(!af(t))return!1;n=!0,c=!1}if(d&&!c)return a||(a=new Pp),n||uE(e)?zE(e,t,i,r,s,a):Zj(e,t,l,i,r,s,a);if(!(i&r6)){var p=c&&eS.call(e,"__wrapped__"),f=u&&eS.call(t,"__wrapped__");
3139if(p||f){var m=p?e.value():e,g=f?t.value():t;return a||(a=new Pp),s(m,g,i,r,a)}}return d?(a||(a=new Pp),i6(e,t,i,r,s,a)):!1}var n6=a6;function BE(e,t,i,r,s){return e===t?!0:e==null||t==null||!fn(e)&&!fn(t)?e!==e&&t!==t:n6(e,t,i,r,BE,s)}var o6=BE;function l6(e,t){return e!=null&&t in Object(e)}var h6=l6;function c6(e,t,i){t=Yh(t,e);for(var r=-1,s=t.length,a=!1;++r<s;){var n=lm(t[r]);if(!(a=e!=null&&i(e,n)))break;e=e[n]}return a||++r!=s?a:(s=e==null?0:e.length,!!s&&y1(s)&&m1(n,s)&&(_a(e)||b1(e)))}var u6=c6;function d6(e,t){return e!=null&&u6(e,t,h6)}var p6=d6,f6=function(){return Gs.Date.now()},bg=f6,m6="Expected a function",g6=Math.max,v6=Math.min;function y6(e,t,i){var r,s,a,n,o,l,h=0,c=!1,u=!1,d=!0;if(typeof e!="function")throw new TypeError(m6);t=Cw(t)||0,rs(i)&&(c=!!i.leading,u="maxWait"in i,a=u?g6(Cw(i.maxWait)||0,t):a,d="trailing"in i?!!i.trailing:d);function p(b){var E=r,_=s;return r=s=void 0,h=b,n=e.apply(_,E),n}function f(b){return h=b,o=setTimeout(v,t),c?p(b):n}function m(b){var E=b-l,_=b-h,A=t-E;return u?v6(A,a-_):A}function g(b){var E=b-l,_=b-h;return l===void 0||E>=t||E<0||u&&_>=a}function v(){var b=bg();if(g(b))return y(b);o=setTimeout(v,m(b))}function y(b){return o=void 0,d&&r?p(b):(r=s=void 0,n)}function x(){o!==void 0&&clearTimeout(o),h=0,r=l=s=o=void 0}function w(){return o===void 0?n:y(bg())}function S(){var b=bg(),E=g(b);if(r=arguments,s=this,l=b,E){if(o===void 0)return f(l);if(u)return clearTimeout(o),o=setTimeout(v,t),p(l)}return o===void 0&&(o=setTimeout(v,t)),n}return S.cancel=x,S.flush=w,S}var bu=y6;function x6(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var b6=x6;function w6(e,t){return e>t}var S6=w6;function _6(e,t){return t.length<2?e:mE(e,xE(t,0,-1))}var A6=_6;function M6(e,t){return o6(e,t)}var T1=M6;function E6(e,t,i){for(var r=-1,s=e.length;++r<s;){var a=e[r],n=t(a);if(n!=null&&(o===void 0?n===n&&!Nu(n):i(n,o)))var o=n,l=a}return l}var C6=E6;function T6(e){return e&&e.length?C6(e,sE,S6):void 0}var P6=T6;function D6(e,t){return t=Yh(t,e),e=A6(e,t),e==null||delete e[lm(b6(t))]}var O6=D6;function I6(e){return IN(e)?void 0:e}var R6=I6,L6=1,z6=2,B6=4,F6=vE(function(e,t){var i={};if(e==null)return i;var r=!1;t=eE(t,function(a){return a=Yh(a,e),r||(r=a.length>1),a}),Vu(e,DE(e),i),r&&(i=LE(i,L6|z6|B6,R6));for(var s=t.length;s--;)O6(i,t[s]);return i}),u0=F6;function k6(e,t,i,r){if(!rs(e))return e;t=Yh(t,e);for(var s=-1,a=t.length,n=a-1,o=e;o!=null&&++s<a;){var l=lm(t[s]),h=i;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(s!=n){var c=o[l];h=r?r(c,l,o):void 0,h===void 0&&(h=rs(c)?c:m1(t[s+1])?[]:{})}v1(o,l,h),o=o[l]}return e}var U6=k6;function N6(e,t,i){for(var r=-1,s=t.length,a={};++r<s;){var n=t[r],o=mE(e,n);i(o,n)&&U6(a,Yh(n,e),o)}return a}var V6=N6;function j6(e,t){return V6(e,t,function(i,r){return p6(e,r)})}var H6=j6,G6=vE(function(e,t){return e==null?{}:H6(e,t)}),xa=G6,W6="Expected a function";function q6(e,t,i){var r=!0,s=!0;if(typeof e!="function")throw new TypeError(W6);return rs(i)&&(r="leading"in i?!!i.leading:r,s="trailing"in i?!!i.trailing:s),bu(e,t,{leading:r,maxWait:t,trailing:s})}var X6=q6;function Y6(e,t){for(var i=e.length;i--&&j4(t,e[i],0)>-1;);return i}var Q6=Y6;function K6(e,t,i){if(e=fE(e),e&&(i||t===void 0))return e.slice(0,rE(e)+1);if(!e||!(t=iE(t)))return e;var r=Fw(e),s=Q6(r,Fw(t))+1;return zN(r,0,s).join("")}var Z6=K6;function FE(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}function Kr(e,t){return Object.setPrototypeOf(e,t),e}var J6=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().includes(" electron/"),$6=()=>typeof window>"u"?!1:window.navigator.platform.toUpperCase().includes("MAC"),eH=()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(window.navigator.userAgent)||cm&&"ontouchend"in document,tH=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,iH=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0,rH=()=>{if(typeof window>"u")return!1;let e=navigator.userAgent,t=navigator.vendor;return/Safari/i.test(e)&&/Apple Computer/.test(t)},sH=()=>{if(typeof window>"u")return null;let e=navigator.userAgent.match(/Version\/(\d+\.\d)/);return e&&e[1]},aH=()=>
vendor: 29,081 bytes, line 3139
3139{if(typeof window>"u")return;let e=new URLSearchParams(window.location.search).get("desktop-app-version");return e?(window.localStorage.setItem("desktop-app-version",e),e):window.localStorage.getItem("desktop-app-version")??"0.0.6"},kE=J6();kE&&aH();var cm=$6(),Kh=eH(),nH=tH(),ts=iH(),tS=rH(),oH=Number(sH());function UE(e){return Array.isArray(e)?e:[e]}function NE(e,t){let i=0;for(;i<e.length&&i<t.length;){if(e[i]<t[i])return-1;if(e[i]>t[i])return 1;i+=1}return i!==t.length?-1:i!==e.length?1:0}function Od(e){return cm?e.metaKey:e.ctrlKey}function lH(e){return e.wheelDeltaY===0||e.deltaY===0?cm&&e.shiftKey&&Math.abs(e.wheelDeltaX)>=120?!1:e.wheelDeltaX?e.wheelDeltaX===-3*e.deltaX||e.wheelDeltaX===-3*window.devicePixelRatio*e.deltaX:e.deltaMode===0:e.wheelDeltaY?e.wheelDeltaY===-3*e.deltaY||e.wheelDeltaY===-3*window.devicePixelRatio*e.deltaY:e.deltaMode===0}var at=[],lf={},Uc={},Op={};function VE(e){at.includes(e)||at.push(e)}function ch(e){delete lf[e.pointerId];for(let t=0;t<at.length;t++)if(at[t].pointerId===e.pointerId){at.splice(t,1);break}}function hH(){at.splice(0,at.length)}function hf(e){if(e.pointerType!=="touch")return;let t=lf[e.pointerId];t===void 0&&(t={x:0,y:0},lf[e.pointerId]=t),t.x=e.pageX,t.y=e.pageY}function wg(e){let t=e.pointerId===at[0].pointerId?at[1]:at[0];return lf[t.pointerId]}function jE(e){Uc[e.key]=!0,Op[e.key]=Op[e.key]===void 0?1:Op[e.key]+1}function HE(e){if(cm&&Uc.Meta)for(let t in Uc)Uc[t]=!1;else Uc[e.key]=!1;Op={}}function cH(e){e.addEventListener("pointerdown",VE,!0),e.addEventListener("pointerdown",hf,!0),e.addEventListener("pointermove",hf,!0),e.addEventListener("pointerup",ch,!0),e.addEventListener("pointercancel",ch,!0),e.addEventListener("pointerleave",ch,!0),window.addEventListener("keydown",jE,!0),window.addEventListener("keyup",HE,!0)}function uH(e){e.removeEventListener("pointerdown",VE,!0),e.removeEventListener("pointerdown",hf,!0),e.removeEventListener("pointermove",hf,!0),e.removeEventListener("pointerup",ch,!0),e.removeEventListener("pointercancel",ch,!0),e.removeEventListener("pointerleave",ch,!0),window.removeEventListener("keydown",jE,!0),window.removeEventListener("keyup",HE,!0)}var GE,dH=new Promise(e=>{GE=e}),Id;function pH(e){if(Id)return Id;async function t(){let i=e??"https://unpkg.com/@splinetool/[email protected]/build",r=fo(()=>import("./navmesh-B1pUQaZh.js"),[]),[s,a]=await Promise.all([r,fetch(`${i}/navmesh.wasm`).then(l=>l.arrayBuffer())]),n=s.default,o=await n({wasmBinary:a});GE(o)}return Id=t(),Id}var WE,fH=new Promise(e=>{WE=e}),Rd;function mH(){if(Rd)return Rd;async function e(){let t=await fo(()=>import("./physics-ChHD2_fM.js"),[]);await t.init(),WE(t)}return Rd=e(),Rd}var We=class{modifyById(e,t){let i=this;if(i[e]===void 0)throw new Error("not expected");{let r={...i,[e]:t};return Object.setPrototypeOf(r,We.prototype),r}}add(e,t){return this.runOp({type:1,id:e,data:t})?.data??this}runOp(e){let t=this;if(e.type===1){let i=t[e.id],r;i===void 0?r={type:2,id:e.id}:r={type:1,id:e.id,data:i};let{id:s,data:a}=e,n={...t,[s]:a};return Object.setPrototypeOf(n,We.prototype),{data:n,actual:e,reverse:r}}else if(e.type===2){let{id:i}=e,r=t[i];if(r===void 0)return null;{let s={...t};return Object.setPrototypeOf(s,We.prototype),delete s[i],{data:s,actual:e,reverse:{type:1,id:i,data:r}}}}return null}};function P1(e){if(e.deepFreeze!==void 0){e.deepFreeze(e);return}let t=Object.getOwnPropertyNames(e);for(let i of t){let r=e[i];r&&typeof r=="object"&&P1(r)}return Object.freeze(e)}function gH(e,t){let i=0;for(;i<e.length&&i<t.length;){if(e[i]<t[i])return-1;if(e[i]>t[i])return 1;i+=1}return i!==t.length?-1:i!==e.length?1:0}var qE=class extends Error{};function Sg(e){let t={...e};return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),t}function Xn(e,t,i){if(e===void 0?t===void 0?(e=0,t=10):e=t-10:t===void 0&&(t=e+10),e>t){let a=e;e=t,t=a}let r=[],s=1/(i+1);for(let a=0;a<i;a++){let n=e+(t-e)*(a+.75+Math.random()*.5)*s;r.push(n)}return r}function D1(e){return e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array}function vH(){return typeof process<"u"}function XE(e,t){for(let i of e)t(i.id,i.data)!==!0&&XE(i.children,t)}function YE(e,t){if(t(e.id,e.data)!==!0)for(let i of e.children)YE(i,t)}var mr=class extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,mr.prototype)}deepFreeze(){let e=0;for(;e<this.length;)P1(this[e]),e++}fillCaches0(e,t){this.objCaches.set(e.id,e),this.parentCaches.set(e.id,t);for(let i of e.children)this.fillCaches0(i,e.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let e of this)this.fillCaches0(e,null)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}nonExistOrDescendantOf(e,t){if(!this.has(e))return!0;for(;e;){let i=this.parent(e);if(i===t)return!0;e=i}return!1}rootAcestor(e){for(;e;){let t=this.parent(e);if(t)e=t;else return e}return e}isDescendantOf(e,t){for(;e;){let i=this.parent(e);if(i===t)return!0;e=i}return!1}data(e){return this.get(e)?.data}has(e){return this.childrenOf(e)!==void 0}get(e){return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){return e===null?this:this.get(e)?.children}traverseFrom(e,t){if(e===null)this.traverse(t);else{let i=this.get(e);i&&YE(i,t)}}traverse(e){XE(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let i=this.parent(e),r=this.childrenArray(i),s=r.findIndex(n=>n.id===e);if(s<0)throw new Error("not expected");let a=r[s];return r=[...r],r[s]={...a,data:t},this.modifyArrayBy(i,r)}}modifyArrayBy(e,t){let i=e,r=t;for(;i!==null;){let a=r,n=i;if(i=this.parent(i),i===void 0)throw new Error;r=this.childrenArray(i);let o=r.findIndex(l=>l.id===n);if(o<0)throw new Error;r=[...r],r[o]={...r[o],children:a}}Object.setPrototypeOf(r,mr.prototype);let s=r;return s.fillCaches(),s}runOp(e){switch(e.type){case 7:return this.addOp(e);case 8:return this.deleteOp(e);case 9:return this.moveOp(e)}return null}checkDuplicatedIdRec({id:e,children:t}){if(this.get(e)!==void 0)return!0;for(let i of t)if(this.checkDuplicatedIdRec(i))return!0;return!1}addOp(e){let{parent:t,fi:i,id:r,data:s,children:a}=e;if(t!==null&&this.get(t)===void 0||this.checkDuplicatedIdRec(e))return null;{let n=t,o=this.childrenArray(n),l={fi:i,id:r,data:s,children:a};return o=[...o,l],o.sort((h,c)=>h.fi-c.fi),e.localIndex=o.indexOf(l),{data:this.modifyArrayBy(n,o),actual:e,reverse:{type:8,id:r}}}}deleteOp(e){let{id:t}=e;if(this.get(t)===null)return null;{let i=this.parent(t);if(i===void 0)return null;let r=this.childrenArray(i),s=r.findIndex(n=>n.id===t);e.localIndex=s,r=[...r];let a=r.splice(s,1)[0];return{data:this.modifyArrayBy(i,r),actual:e,reverse:{type:7,...a,parent:i}}}}moveOp(e){let{parent:t,fi:i,id:r}=e;if(t!==null&&this.get(t)===void 0)return this.deleteOp({type:8,id:r});if(t!==null){let u=t;for(;u!==null;){if(u===void 0)throw new Error;if(u===r)throw new qE("cyclic tree");u=this.parent(u)}}let s=this.parent(r);if(s===void 0)return null;let a=s,n=this.childrenArray(s),o=n.findIndex(u=>u.id===r);n=[...n];let l=n.splice(o,1)[0],h=this.modifyArrayBy(s,n);s=t,n=h.childrenArray(s);let c=l.fi;return l={...l,fi:i},n=[...n,l],n.sort((u,d)=>u.fi-d.fi),e.localIndex=n.indexOf(l),h=h.modifyArrayBy(s,n),{data:h,actual:e,reverse:{type:9,parent:a,fi:c,id:r}}}previous(e,t){if(t===null){let r=this.childrenArray(e);return r.length===0?null:r[r.length-1].id}let i=null;for(let r of this.childrenArray(e)){if(r.id===t)return i;i=r.id}return null}traverseSortNext(e){let t=this.parent(e);if(t!==void 0){let i=this.childrenArray(t),r=i.findIndex(s=>s.id===e)+1;if(r<i.length)return i[r].id;if(t)return this.traverseSortNext(t)}}sortNext(e){let t=this.childrenArray(e);return t.length>0?t[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let t=this.childrenArray(e);return t.length>0?this.traverseSortPrevious(t[t.length-1].id):e}sortPrevious(e){let t=this.parent(e);if(t!==void 0){let i=this.childrenArray(t),r=i.findIndex(s=>s.id===e)-1;return r>=0?this.traverseSortPrevious(i[r].id):t}}getAllSorted(e){let t=[];for(let i of e){let r=this.getWithSortKey(i.id);r!==void 0&&t.push({...i,...r})}t.sort((i,r)=>gH(i.sortKey,r.sortKey));for(let i of t)delete i.sortKey;return t}getWithSortKey(e){var t=e;let i=[],r=this.get(t),s=r;if(r!==void 0){for(;t;)i.splice(0,0,r.fi),t=this.parent(t),t!==null&&(r=this.get(t));return{...s,sortKey:i}}}insertBeforeHelper(e,t,i){return this.insertAfterHelper(e,this.previous(e,t),i)}insertAfterHelper(e,t,i){let r=this.childrenArray(e);if(t===null){if(r.length===0)return Xn(0,i,i);{let s=r[0].fi;return Xn(s-i,s,i)}}else{let s=this.get(t);if(s===void 0||this.parent(t)!==e)throw new Error("illegal args");let a=r.find(n=>n.fi>s.fi);if(a===void 0){let n=r[r.length-1].fi;return Xn(n,n+i,i)}else return Xn(s.fi,a.fi,i)}}},cf;(e=>{function t(i,r){if(r.type!==0)return null;if(Array.isArray(i)){let s=r.props,a={},n=[...i],o=!1;if(s)for(let l of Object.keys(s)){let h=parseInt(l);if(isNaN(h))throw new Error("wrong index");a[l]=n[h],n[h]=s[l],o=!0}return o?{data:n,actual:r,reverse:{type:0,props:a}}:null}else{let s=r.props,a={},n={...i},o=!1;if(s)for(let l of Object.keys(s)){a[l]=n[l];let h=s[l];h===void 0?delete n[l]:n[l]=h,o=!0}return o?{data:n,actual:r,reverse:{type:0,props:a}}:null}}e.runOp=t})(cf||(cf={}));var Ue=class extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,Ue.prototype)}deepFreeze(){let e=0;for(;e<this.length;)P1(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){return this.get(e)?.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let i=this,r=i.findIndex(a=>a.id===e);if(r<0)throw new Error("not expected");let s=i[r];return i=[...i],i[r]={...s,data:t},this.modifyArrayBy(i)}}modifyArrayBy(e){Object.setPrototypeOf(e,Ue.prototype);let t=e;return vH()||t.fillCaches(),t}runOp(e){switch(e.type){case 4:return this.addOp(e);case 5:return this.deleteOp(e);case 6:return this.moveOp(e)}return null}addOp(e){let{fi:t,id:i,data:r}=e,s=this,a={fi:t,id:i,data:r};return s=[...s,a],s.sort((n,o)=>n.fi-o.fi),e.localIndex=s.indexOf(a),{data:this.modifyArrayBy(s),actual:e,reverse:{type:5,id:i}}}deleteOp(e){let{id:t}=e,i=this,r=i.findIndex(a=>a.id===t);if(r===-1)return null;e.localIndex=r,i=[...i];let s=i.splice(r,1)[0];return{data:this.modifyArrayBy(i),actual:e,reverse:{type:4,...s}}}moveOp(e){let{fi:t,id:i}=e,r=this;r=[...r];let s=r.findIndex(o=>o.id===i);if(s===-1)return null;let a=r[s].fi,n={...r[s],fi:t};return r[s]=n,r.sort((o,l)=>o.fi-l.fi),e.localIndex=r.indexOf(n),{data:this.modifyArrayBy(r),actual:e,reverse:{type:6,fi:a,id:i}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let t=null;for(let i of this){if(i.id===e)return t;t=i.id}return null}insertBeforeHelper(e,t){return this.insertAfterHelper(this.previous(e),t)}insertAfterHelper(e,t){let i=this;if(e===null){if(i.length===0)return Xn(0,t,t);{let r=i[0].fi;return Xn(r-t,r,t)}}else{let r=this.get(e);if(r===void 0)throw new Error("illegal args");let s=i.find(a=>a.fi>r.fi);if(s===void 0){let a=i[i.length-1].fi;return Xn(a,a+t,t)}else return Xn(r.fi,s.fi,t)}}};function Eh(e){return e&&typeof e=="object"&&e instanceof vi}var vi=class{unusedFunOverridesTable(e){}runOp(e){let t=[],i=this,r=0,s={};for(;r<e.path.length;){if(t.push(i),i=i===void 0?void 0:i[e.path[r]],i!==void 0&&!Eh(i))return null;r+=1}i=i?Sg(i):new vi;for(let[o,l]of Object.entries(e.props)){let h=i[o];s[o]=h,l===void 0?delete i[o]:i[o]=l}for(;r>0;){if(Object.keys(i).length===0){let o=t[r-1];o&&(i=Sg(o),delete i[e.path[r-1]])}else{let o=t[r-1];if(o){let l=Sg(o);l[e.path[r-1]]=i,i=l}else{let l=new vi;l[e.path[r-1]]=i,i=l}}r-=1}let a=Object.setPrototypeOf(i,vi.prototype),n={...e,props:s};return{data:a,actual:e,reverse:n}}},ro;(e=>{function t(s,a){return wu(s,a)??s}e.apply=t;function i(s,a){return I1(s,a)}e.merge=i;function r(s,a){let n=0,o=a.path,l=s;for(;n<o.length&&l!==void 0;){if(l=Hi.zoomOnce(l,o[n]),l===void 0)return a;if(!Eh(l))return;n+=1}if(l===void 0)return a;if(Eh(l))if(a.type===0){let h={...a.props};for(let c of Object.keys(l))delete h[c];return{...a,props:h}}else if(a.type===1||a.type===4||a.type===7){let h=O1([a],l);return h?h[0]:a}else return a}e.filterOp=r})(ro||(ro={}));function O1(e,t){if(t===void 0)return;let i=!1,r=e.map(s=>{let a=s.id,n=wu(s.data,t[a]);if(i=i||n!==void 0,n===void 0&&(n=s.data),s.children){let o=O1(s.children,t);return o!==void 0?i=!0:o=s.children,{...s,id:a,data:n,children:o}}else return{...s,id:a,data:n}});if(i)return r}function yH(e,t){if(t===void 0)return;let i=!1,r=e.map(s=>{let a=s.id,n=wu(s.data,t[a]);return i=i||n!==void 0,n===void 0&&(n=s.data),{...s,id:a,data:n}});if(i)return Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r}function wu(e,t){if(!Eh(t))return t;if(e instanceof mr){let i=O1(e,t);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i}else{if(e instanceof Ue)return yH(e,t);if(Array.isArray(e)){let i=!1,r=e.map((s,a)=>{let n=wu(s,t[a]);return i=i||n!==void 0,n===void 0&&(n=s),n});return i?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}else{if(e instanceof vi)return I1(e,t);if(e&&typeof e=="object"){let i={},r=!1;for(let[s,a]of Object.entries(e)){let n=wu(a,t[s]);r=r||n!==void 0,n===void 0&&(n=a),i[s]=n}return r?(Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i):void 0}}}}function I1(e,t){if(e===void 0)return t;if(t===void 0)return e;if(!Eh(t))return t;if(!Eh(e))return ro.apply(e,t);let i=new Set;for(let s of Object.keys(e))i.add(s);for(let s of Object.keys(t))i.add(s);let r=new vi;for(let s of i){let a=I1(e===void 0?void 0:e[s],t===void 0?void 0:t[s]);r[s]=a}return r}function xH(e,t){let i={cur:[],result:[],len:0};return e=Su(e,t,i)??e,[e,i.result]}function uf(e,t){return e===null?null:(e.cur[e.len]=t,e.len+=1,e)}function df(e){e&&(e.len-=1)}function bH(e){if(e===null)return null;e.result.push(e.cur.slice(0,e.len))}function QE(e,t,i){let r=!1,s=e.map(a=>{let n=a.id,o=t[n];if(o!==void 0&&typeof o=="string"&&(r=!0,n=o,i!==null))throw new Error("not supported");let l=Su(a.data,t,uf(i,n));df(i),r=r||l!==void 0,l===void 0&&(l=a.data);let h=QE(a.children,t,i);return h!==void 0?r=!0:h=a.children,{...a,id:n,data:l,children:h}});if(r)return s}function wH(e,t,i){let r=!1,s=e.map(a=>{let n=a.id,o=t[n];if(o!==void 0&&typeof o=="string"&&(r=!0,n=o,i!==null))throw new Error("not supported");let l=Su(a.data,t,uf(i,n));return df(i),r=r||l!==void 0,l===void 0&&(l=a.data),{...a,id:n,data:l}});if(r)return Object.setPrototypeOf(s,Object.getPrototypeOf(e)),s}function Su(e,t,i){if(e instanceof mr){let r=QE(e,t,i);return r!==void 0&&Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r}else{if(e instanceof Ue)return wH(e,t,i);if(Array.isArray(e)){let r=!1,s=e.map((a,n)=>{let o=Su(a,t,uf(i,n));return df(i),r=r||o!==void 0,o===void 0&&(o=a),o});return r?(Object.setPrototypeOf(s,Object.getPrototypeOf(e)),s):void 0}else if(e&&typeof e=="object"&&!D1(e)){let r={},s=!1;for(let[a,n]of Object.entries(e))if(a!=="name"&&a!=="variableId"){let o=t[a];if(typeof o=="string"){if(i!==null)throw new Error("not supported");s=!0,a=o}let l=Su(n,t,uf(i,a));df(i),s=s||l!==void 0,l===void 0&&(l=n),r[a]=l}else r[a]=n;return s?(Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r):void 0}else if(typeof e=="string"){let r=t[e];return r!==void 0&&bH(i),r}else return}}var pf;(e=>{function t(i,r){let s=Hi.zoom(r,i.path);if(typeof s=="object"){let a={};for(let n of Object.keys(i.props))a[n]=s[n];return{...i,props:a}}else return{...i,props:{}}}e.replaceProps=t})(pf||(pf={}));var ir;(e=>{function t(l,h){return{...l,path:l.path.slice(h)}}e.drop=t;function i(l,h){return r(l,h)?.data??l}e.applySimple=i;function r(l,h){let c=h.path;for(var u=[];;){let d;if(l instanceof vi&&h.type===0&&(d=l.runOp({...h,path:c.slice(u.length)}),d===null&&(d=void 0)),d===void 0&&u.length===c.length&&(l instanceof mr||l instanceof Ue||l instanceof We?d=l.runOp(h):d=cf.runOp(l,h)),d!==void 0)if(d!==null){let m=d.data;for(let g=u.length-1;g>=0;g--){let v=c[g],y=u[g];if(y instanceof mr){if(typeof v=="number")throw new Error("illegal arg");m=y.modifyById(v,m)}else if(y instanceof Ue){if(typeof v=="number")throw new Error("illegal arg");m=y.modifyById(v,m)}else if(y instanceof We){if(typeof v=="number")throw new Error("illegal arg");m=y.modifyById(v,m)}else if(y instanceof vi){let x={...y,[v]:m};m=Object.setPrototypeOf(x,vi.prototype)}else if(typeof y=="object")if(Array.isArray(y)){if(typeof v=="string"&&(v=parseInt(v),isNaN(v)))throw new Error("Invalid path");let x=m;m=[...y],m[v]=x}else m={...y,[v]:m};else return null}return{data:m,actual:{...d.actual,path:c},reverse:{...d.reverse,path:c}}}else return null;let p=c[u.length],f;if(l instanceof mr){if(typeof p=="number")throw new Error("");f=l.get(p)?.data}else if(l instanceof Ue){if(typeof p=="number")throw new Error("");f=l.get(p)?.data}else l!==null&&(f=l[p]);if(f!==void 0)u.push(l),l=f;else return null}}e.apply=r;function s(l,h){for(let c=0;c<l.length&&c<h.length;c++)if(l[c]!==h[c])return!0;return!1}e.pathDisjoint=s;function a(l,h){if(l.length!==h.length)return!1;for(let c=0;c<l.length;c++)if(l[c]!==h[c])return!1;return!0}e.pathEq=a;function n(l,h){return s(l.path,h.path)}e.commutative=n;function o(l,h){return l.type===0&&h.type===0&&a(l.path,h.path)?Object.keys(l.props).every(c=>h.props[c]!==void 0):!1}e.subsumed=o})(ir||(ir={}));var d0;(e=>{function t(){return[]}e.empty=t;function i(h,c){let u=[];for(let d of h){let[p,...f]=d.path;p===c&&u.push({...d,path:f})}return u}e.removePrefix=i;function r(h,c){return h.map(u=>({...u,path:[c,...u.path]}))}e.addPrefix=r;function s(h,c){return[...h,...c]}e.concat=s;function a(h,c){return[...h.filter(u=>!c.some(d=>ir.subsumed(u,d))),...c]}e.compress=a;function n(h,c){return h.every(u=>c.every(d=>ir.commutative(u,d)))}e.commutative=n;function o(h,c){for(let u of c){let d=l(h,u);d!==null&&(h=d.data)}return h}e.applyAll=o;function l(h,c){var u=h;let d=[],p=[];for(let f of c)try{if(f.type===3||f.type===5&&f.path[f.path.length-1]==="variables"){let m,g,v;if(f.type===3?(m=Hi.zoom(u,[...f.path,f.id]),v=ir.apply(u,{...f,type:2})):(m=Hi.zoom(u,[...f.path,f.id,"value"]),v=ir.apply(u,f)),v!==null){u=v.data;let[y,x]=xH(u,{[f.id]:m});u=y;for(let w=0;w<x.length;w++){let S=x[w],b=S.pop();if(typeof b=="number"){let E=[b];for(let A=w+1;A<x.length;A++){let C=x[A],T=C[C.length-1];if(typeof T=="number"&&Hi.equal(S,C.slice(0,C.length-1)))E.push(T),x.splice(A,1);else break}let _=Hi.zoom(u,S);g=_.map((A,C)=>E.includes(C)?f.id:A),m=_,b=S.pop()}else{if(b==="alphaOverride"||b==="alpha"){m/=100;let E=m,_=Hi.zoom(u,S.slice(0,S.length-2)),A=_.layers.map(C=>C.id===S[S.length-1]?{...C,data:{...C.data,[b]:E}}:C);Object.setPrototypeOf(A,Object.getPrototypeOf(_.layers)),_.layers=A}g=f.id}d.push({type:0,path:S,props:{[b]:m}}),p.push({type:0,path:S,props:{[b]:g}})}p.push(v.reverse),d.push(v.actual)}}else{let m=ir.apply(u,f);m!==null&&(d.push(m.actual),u=m.data,p.push(m.reverse))}}catch(m){if(m instanceof qE)return null;throw m}return{data:u,actual:d,reverse:p.reverse()}}e.apply=l})(d0||(d0={}));var KE=Symbol(),SH=Symbol(),um=Symbol(),ju=class{reportOp(e,t,i=[]){let r=this;if(t===null)return;r._current=t.data;let s=i;for(;!(r instanceof JE);){let a=r._path,n=r._current;if(a!==""&&s.splice(0,0,a),r=r._parent,r===null)return;r.update(a,n)}r.push(s,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let i=t[um];i&&i(),delete this._children[e]}}}},_H=class extends ju{constructor(e,t,i){super(),this._parent=e,this._path=t,this._current=i}update(e,t){if(Array.isArray(this._current)){if(typeof e=="string"&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid path");this._current=[...this._current],this._current[e]=t}else if(this._current instanceof vi){let i={...this._current,[e]:t};this._current=Object.setPrototypeOf(i,vi.prototype)}else this._current={...this._current,[e]:t}}runOp(e){this.reportOp(e,cf.runOp(this._current,e),e.path)}},AH=class extends ju{constructor(e,t,i){super(),this._parent=e,this._path=t,this._current=i}update(e,t){this._current={...this._current,[e]:t},Object.setPrototypeOf(this._current,We.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},ZE={get(e,t){if(t===um)return()=>{e._parent=null};if(t===KE)return e._current;if(t===SH)return e;let{_current:i,_children:r}=e;if(t==="push"&&Array.isArray(i))throw new Error("not supported to expand array");let s=r===void 0?void 0:r[t];if(s!==void 0)return s;let a=i[t],n=dm(e,t,a);return n!==a?(r===void 0&&(r={},e._children=r),r[t]=n,n):a},has(e,t){return t in e._current},ownKeys(e){return Reflect.ownKeys(e._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(e){return Object.getPrototypeOf(e._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(e,t){let i=e._current,r=Reflect.getOwnPropertyDescriptor(i,t);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:i[t]}}},MH={...ZE,set(e,t,i){let r={type:0,props:{[t]:Ai(i)??i}};return e.deleteChildren(t),e.runOp(r),!0},deleteProperty(e,t){let i={type:0,props:{[t]:void 0}};return e.deleteChildren(t),e.runOp(i),!0}},EH={...ZE,set(e,t,i){return i===void 0?this.deleteProperty(e,t):(e.deleteChildren(t),e.runOp({type:1,id:t,data:i})),!0},deleteProperty(e,t){return e.runOp({type:2,id:t}),!0}},R1=class extends ju{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[um]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}traverse(e){return this._current.traverse(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse((t,i)=>{e(t,this.data(t))})}data(e){let{_current:t,_children:i}=this,r=i===void 0?void 0:i[e];if(r!==void 0)return r;let s=t.get(e)?.data,a=dm(this,e,s);return a!==s?(i===void 0&&(i={},this._children=i),i[e]=a,a):s}add(e,t,i,r,s){this.runOp({type:7,parent:e,fi:t,id:i,data:r,children:s})}move(e,t,i){this.runOp({type:9,parent:e,fi:t,id:i})}insertAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let s=0;s<i.length;s++){let a=i[s];this.add(e,r[s],a.id,a.data,a.children)}}insertBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let s=0;s<i.length;s++){let a=i[s];this.add(e,r[s],a.id,a.data,a.children)}}moveAfter(e,t,i){let r=this._current.insertAfterHelper(e,t,i.length);for(let s=0;s<i.length;s++){let a=i[s];this.move(e,r[s],a)}}moveBefore(e,t,i){let r=this._current.insertBeforeHelper(e,t,i.length);for(let s=0;s<i.length;s++){let a=i[s];this.move(e,r[s],a)}}delete(e){this.deleteChildren(e),this.runOp({type:8,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},L1=class extends ju{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[um]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(e){let t=this.length;for(let i=0;i<t;i++){let r=this._current[i].id,s=this._current[i].fi;e(this.data(this._current[i].id),r,s)}}find(e){let t=this.length;for(let i=0;i<t;i++){let r=this._current[i].id;if(e(this.data(r),r))return this.get(r)}}update(e,t){this._current=this._current.modifyById(e,t)}randomId(){return this._current.randomId()}get(e){return{...this._current.get(e),data:this.data(e)}}data(e){let{_current:t,_children:i}=this,r=i===void 0?void 0:i[e];if(r!==void 0)return r;let s=t.get(e)?.data,a=dm(this,e,s);return a!==s?(i===void 0&&(i={},this._children=i),i[e]=a,a):s}runOp(e){this.reportOp(e,this._current.runOp(e))}add(e,t,i){this.runOp({type:4,fi:e,id:t,data:i})}move(e,t){this.runOp({type:6,fi:e,id:t})}insertAfter(e,t){let i=this._current.insertAfterHelper(e,t.length);for(let r=0;r<t.length;r++){let s=t[r];this.add(i[r],s.id,s.data)}}insertBefore(e,t){let i=this._current.insertBeforeHelper(e,t.length);for(let r=0;r<t.length;r++){let s=t[r];this.add(i[r],s.id,s.data)}}moveAfter(e,t){let i=this._current.insertAfterHelper(e,t.length);for(let r=0;r<t.length;r++){let s=t[r];this.move(i[r],s)}}moveBefore(e,t){let i=this._current.insertBeforeHelper(e,t.length);for(let r=0;r<t.length;r++){let s=t[r];this.move(i[r],s)}}delete(e){this.deleteChildren(e),this.runOp({type:5,id:e})}};function _g(e,t,i){if(e.length>0){let r=e[e.length-1];if(r.type===0&&t.type===0&&Hi.equal(r.path,i)){Object.assign(r.props,t.props);return}}e.push({...t,path:i})}var JE=class extends ju{constructor(e){super(),this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(e!=="")throw new Error("");this._current=t}push(e,t,i,r){_g(this.ts,t,e),_g(this.actual,i,e),_g(this.reverse,r,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function dm(e,t,i){return i instanceof mr?new R1(e,t,i):i instanceof Ue?new L1(e,t,i):i instanceof We?new Proxy(new AH(e,t,i),EH):i!==null&&typeof i=="object"?D1(i)?i:new Proxy(new _H(e,t,i),MH):i}function $E(e){let t=new JE(e);return[dm(t,"",e),t]}function _u(e,t){let[i,r]=$E(e);return t(i),r.result()}function Ai(e){return e instanceof R1||e instanceof L1?e._current:e!==null&&typeof e=="object"?e[KE]:e}var Hi;(e=>{function t(a,n){if(n.length===a.length)for(var o=0;o<a.length;){if(a[o]!==n[o])return!1;o+=1}else return!1;return!0}e.equal=t;function i(a,n,o){let l=s(o,a);if(l!==void 0&&typeof l=="object"&&l!==null){let h={...n};return Object.keys(l).forEach(c=>{delete h[c]}),h}else return n}e.removeOverridden=i;function r(a,n){if((a instanceof mr||a instanceof R1)&&typeof n=="string"||(a instanceof Ue||a instanceof L1)&&typeof n=="string")return a.data(n);if(typeof n=="number"&&Array.isArray(a)||typeof n=="string"&&typeof a=="object"&&a!==null)return a[n]}e.zoomOnce=r;function s(a,n,o=0){for(;o<n.length&&a!==void 0;)a=r(a,n[o]),o+=1;return a}e.zoom=s})(Hi||(Hi={}));function CH(e,t){let i=[];if(t.length===e.length)for(var r=0;r<e.length;){if(t[r]==="*")i.push(e[r]);else if(e[r]!==t[r])return null;r+=1}else return null;return i}function Qt(e,t){let i=[];if(t.length<=e.length)for(var r=0;r<t.length;){if(t[r]==="*")i.push(e[r]);else if(e[r]!==t[r])return null;r+=1}else return null;return i}var eC=class{},iS=class extends eC{constructor(e){super(),this.id=e}},rS=class extends eC{constructor(e){super(),this.data=e}},p0;try{p0=new TextDecoder}catch{}var Fe,so,se=0,Wr={},Bt,Yn,fs=0,da=0,es,hn,Fr=[],Nt,sS={useRecords:!1,mapsAsObjects:!0},tC=class{},iC=new tC;iC.name="MessagePack 0xC1";var Ch=!1,ff=class{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0)),Object.assign(this,e)}unpack(e,t){if(Fe)return lC(()=>(m0(),this?this.unpack(e,t):ff.prototype.unpack.call(sS,e,t)));so=t>-1?t:e.length,se=0,da=0,Yn=null,es=null,Fe=e;try{Nt=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(i){throw Fe=null,e instanceof Uint8Array?i:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof ff){if(Wr=this,this.structures)return Bt=this.structures,Ld();(!Bt||Bt.length>0)&&(Bt=[])}else Wr=sS,(!Bt||Bt.length>0)&&(Bt=[]);return Ld()}unpackMultiple(e,t){let i,r=0;try{Ch=!0;let s=e.length,a=this?this.unpack(e,s):fm.unpack(e,s);if(t){for(t(a);se<s;)if(r=se,t(Ld())===!1)return}else{for(i=[a];se<s;)r=se,i.push(Ld());return i}}catch(s){throw s.lastPosition=r,s.values=i,s}finally{Ch=!1,m0()}}_mergeStructures(e,t){e=e||[];for(let i=0,r=e.length;i<r;i++){let s=e[i];s&&(s.isShared=!0,i>=32&&(s.highByte=i-32>>5))}e.sharedLength=e.length;for(let i in t||[])if(i>=0){let r=e[i],s=t[i];s&&(r&&((e.restoreStructures||(e.restoreStructures=[]))[i]=r),e[i]=s)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function Ld(){try{if(!Wr.trusted&&!Ch){let t=Bt.sharedLength||0;t<Bt.length&&(Bt.length=t)}let e=fi();if(se==so)Bt.restoreStructures&&aS(),Bt=null,Fe=null,hn&&(hn=null);else if(se>so){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}
vendor: 4,480 bytes, line 3139
3139else if(!Ch)throw new Error("Data read, but end of buffer not reached");return e}catch(e){throw Bt.restoreStructures&&aS(),m0(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer"))&&(e.incomplete=!0),e}}function aS(){for(let e in Bt.restoreStructures)Bt[e]=Bt.restoreStructures[e];Bt.restoreStructures=null}function fi(){let e=Fe[se++];if(e<160)if(e<128){if(e<64)return e;{let t=Bt[e&63]||Wr.getStructures&&rC()[e&63];return t?(t.read||(t.read=z1(t,e&63)),t.read()):e}}else if(e<144)if(e-=128,Wr.mapsAsObjects){let t={};for(let i=0;i<e;i++)t[aC()]=fi();return t}else{let t=new Map;for(let i=0;i<e;i++)t.set(fi(),fi());return t}else{e-=144;let t=new Array(e);for(let i=0;i<e;i++)t[i]=fi();return t}else if(e<192){let t=e-160;if(da>=se)return Yn.slice(se-fs,(se+=t)-fs);if(da==0&&so<140){let i=t<16?B1(t):sC(t);if(i!=null)return i}return f0(t)}else{let t;switch(e){case 192:return null;case 193:return es?(t=fi(),t>0?es[1].slice(es.position1,es.position1+=t):es[0].slice(es.position0,es.position0-=t)):iC;case 194:return!1;case 195:return!0;case 196:return Ag(Fe[se++]);case 197:return t=Nt.getUint16(se),se+=2,Ag(t);case 198:return t=Nt.getUint32(se),se+=4,Ag(t);case 199:return _o(Fe[se++]);case 200:return t=Nt.getUint16(se),se+=2,_o(t);case 201:return t=Nt.getUint32(se),se+=4,_o(t);case 202:if(t=Nt.getFloat32(se),Wr.useFloat32>2){let i=F1[(Fe[se]&127)<<1|Fe[se+1]>>7];return se+=4,(i*t+(t>0?.5:-.5)>>0)/i}return se+=4,t;case 203:return t=Nt.getFloat64(se),se+=8,t;case 204:return Fe[se++];case 205:return t=Nt.getUint16(se),se+=2,t;case 206:return t=Nt.getUint32(se),se+=4,t;case 207:return Wr.int64AsNumber?(t=Nt.getUint32(se)*4294967296,t+=Nt.getUint32(se+4)):t=Nt.getBigUint64(se),se+=8,t;case 208:return Nt.getInt8(se++);case 209:return t=Nt.getInt16(se),se+=2,t;case 210:return t=Nt.getInt32(se),se+=4,t;case 211:return Wr.int64AsNumber?(t=Nt.getInt32(se)*4294967296,t+=Nt.getUint32(se+4)):t=Nt.getBigInt64(se),se+=8,t;case 212:if(t=Fe[se++],t==114)return cS(Fe[se++]&63);{let i=Fr[t];if(i)return i.read?(se++,i.read(fi())):i.noBuffer?(se++,i()):i(Fe.subarray(se,++se));throw new Error("Unknown extension "+t)}case 213:return t=Fe[se],t==114?(se++,cS(Fe[se++]&63,Fe[se++])):_o(2);case 214:return _o(4);case 215:return _o(8);case 216:return _o(16);case 217:return t=Fe[se++],da>=se?Yn.slice(se-fs,(se+=t)-fs):PH(t);case 218:return t=Nt.getUint16(se),se+=2,da>=se?Yn.slice(se-fs,(se+=t)-fs):DH(t);case 219:return t=Nt.getUint32(se),se+=4,da>=se?Yn.slice(se-fs,(se+=t)-fs):OH(t);case 220:return t=Nt.getUint16(se),se+=2,oS(t);case 221:return t=Nt.getUint32(se),se+=4,oS(t);case 222:return t=Nt.getUint16(se),se+=2,lS(t);case 223:return t=Nt.getUint32(se),se+=4,lS(t);default:if(e>=224)return e-256;if(e===void 0){let i=new Error("Unexpected end of MessagePack data");throw i.incomplete=!0,i}throw new Error("Unknown MessagePack token "+e)}}}var TH=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function z1(e,t){function i(){if(i.count++>2){let s=e.read=new Function("r","return function(){return {"+e.map(a=>TH.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"}}")(fi);return e.highByte===0&&(e.read=nS(t,e.read)),s()}let r={};for(let s=0,a=e.length;s<a;s++){let n=e[s];r[n]=fi()}return r}return i.count=0,e.highByte===0?nS(t,i):i}var nS=(e,t)=>function(){let i=Fe[se++];if(i===0)return t();let r=e<32?-(e+(i<<5)):e+(i<<5),s=Bt[r]||rC()[r];if(!s)throw new Error("Record id is not defined for "+r);return s.read||(s.read=z1(s,e)),s.read()};function rC(){let e=lC(()=>(Fe=null,Wr.getStructures()));return Bt=Wr._mergeStructures(e,Bt)}var f0=pm,PH=pm,DH=pm,OH=pm;function pm(e){let t;if(e<16&&(t=B1(e)))return t;if(e>64&&p0)return p0.decode(Fe.subarray(se,se+=e));let i=se+e,r=[];for(t="";se<i;){let s=Fe[se++];if((s&128)===0)r.push(s);else if((s&224)===192){let a=Fe[se++]&63;r.push((s&31)<<6|a)}else if((s&240)===224){let a=Fe[se++]&63,n=Fe[se++]&63;r.push((s&31)<<12|a<<6|n)}else if((s&248)===240){let a=Fe[se++]&63,n=Fe[se++]&63,o=Fe[se++]&63,l=(s&7)<<18|a<<12|n<<6|o;l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|l&1023),r.push(l)}else r.push(s);r.length>=4096&&(t+=$i.apply(String,r),r.length=0)}return r.length>0&&(t+=$i.apply(String,r)),t}function oS(e){let t=new Array(e);for(let i=0;i<e;i++)t[i]=fi();return t}function lS(e){if(Wr.mapsAsObjects){let t={};for(let i=0;i<e;i++)t[aC()]=fi();return t}else{let t=new Map;for(let i=0;i<e;i++)t.set(fi(),fi());return t}}var $i=String.fromCharCode;function sC(e){let t=se,i=new Array(e);for(let r=0;r<e;
3139r++){let s=Fe[se++];if((s&128)>0){se=t;return}i[r]=s}return $i.apply(String,i)}function B1(e){if(e<4)if(e<2){if(e===0)return"";{let t=Fe[se++];if((t&128)>1){se-=1;return}return $i(t)}}else{let t=Fe[se++],i=Fe[se++];if((t&128)>0||(i&128)>0){se-=2;return}if(e<3)return $i(t,i);let r=Fe[se++];if((r&128)>0){se-=3;return}return $i(t,i,r)}else{let t=Fe[se++],i=Fe[se++],r=Fe[se++],s=Fe[se++];if((t&128)>0||(i&128)>0||(r&128)>0||(s&128)>0){se-=4;return}if(e<6){if(e===4)return $i(t,i,r,s);{let a=Fe[se++];if((a&128)>0){se-=5;return}return $i(t,i,r,s,a)}}else if(e<8){let a=Fe[se++],n=Fe[se++];if((a&128)>0||(n&128)>0){se-=6;return}if(e<7)return $i(t,i,r,s,a,n);let o=Fe[se++];if((o&128)>0){se-=7;return}return $i(t,i,r,s,a,n,o)}else{let a=Fe[se++],n=Fe[se++],o=Fe[se++],l=Fe[se++];if((a&128)>0||(n&128)>0||(o&128)>0||(l&128)>0){se-=8;return}if(e<10){if(e===8)return $i(t,i,r,s,a,n,o,l);{let h=Fe[se++];if((h&128)>0){se-=9;return}return $i(t,i,r,s,a,n,o,l,h)}}else if(e<12){let h=Fe[se++],c=Fe[se++];if((h&128)>0||(c&128)>0){se-=10;return}if(e<11)return $i(t,i,r,s,a,n,o,l,h,c);let u=Fe[se++];if((u&128)>0){se-=11;return}return $i(t,i,r,s,a,n,o,l,h,c,u)}else{let h=Fe[se++],c=Fe[se++],u=Fe[se++],d=Fe[se++];if((h&128)>0||(c&128)>0||(u&128)>0||(d&128)>0){se-=12;return}if(e<14){if(e===12)return $i(t,i,r,s,a,n,o,l,h,c,u,d);{let p=Fe[se++];if((p&128)>0){se-=13;return}return $i(t,i,r,s,a,n,o,l,h,c,u,d,p)}}else{let p=Fe[se++],f=Fe[se++];if((p&128)>0||(f&128)>0){se-=14;return}if(e<15)return $i(t,i,r,s,a,n,o,l,h,c,u,d,p,f);let m=Fe[se++];if((m&128)>0){se-=15;return}return $i(t,i,r,s,a,n,o,l,h,c,u,d,p,f,m)}}}}}function Ag(e){return Wr.copyBuffers?Uint8Array.prototype.slice.call(Fe,se,se+=e):Fe.subarray(se,se+=e)}function _o(e){let t=Fe[se++];if(Fr[t])return Fr[t](Fe.subarray(se,se+=e));throw new Error("Unknown extension type "+t)}var hS=new Array(4096);function aC(){let e=Fe[se++];if(e>=160&&e<192){if(e=e-160,da>=se)return Yn.slice(se-fs,(se+=e)-fs);if(!(da==0&&so<180))return f0(e)}else return se--,fi();let t=(e<<5^(e>1?Nt.getUint16(se):e>0?Fe[se]:0))&4095,i=hS[t],r=se,s=se+e-3,a,n=0;if(i&&i.bytes==e){for(;r<s;){if(a=Nt.getUint32(r),a!=i[n++]){r=1879048192;break}r+=4}for(s+=3;r<s;)if(a=Fe[r++],a!=i[n++]){r=1879048192;break}if(r===s)return se=r,i.string;s-=3,r=se}for(i=[],hS[t]=i,i.bytes=e;r<s;)a=Nt.getUint32(r),i.push(a),r+=4;for(s+=3;r<s;)a=Fe[r++],i.push(a);let o=e<16?B1(e):sC(e);return o!=null?i.string=o:i.string=f0(e)}var cS=(e,t)=>{var i=fi();let r=e;t!==void 0&&(e=e<32?-((t<<5)+e):(t<<5)+e,i.highByte=t);let s=Bt[e];return s&&s.isShared&&((Bt.restoreStructures||(Bt.restoreStructures=[]))[e]=s),Bt[e]=i,i.read=z1(i,r),i.read()},nC=typeof self=="object"?self:global;Fr[0]=()=>{};Fr[0].noBuffer=!0;Fr[101]=()=>{let e=fi();return(nC[e[0]]||Error)(e[1])};Fr[105]=e=>{let t=Nt.getUint32(se-4);hn||(hn=new Map);let i=Fe[se],r;i>=144&&i<160||i==220||i==221?r=[]:r={};let s={target:r};hn.set(t,s);let a=fi();return s.used?Object.assign(r,a):(s.target=a,a)};Fr[112]=e=>{let t=Nt.getUint32(se-4),i=hn.get(t);return i.used=!0,i.target};Fr[115]=()=>new Set(fi());var oC=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array");Fr[116]=e=>{let t=e[0],i=oC[t];if(!i)throw new Error("Could not find typed array for code "+t);return new nC[i](Uint8Array.prototype.slice.call(e,1).buffer)};Fr[120]=()=>{let e=fi();return new RegExp(e[0],e[1])};Fr[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],i=se;se+=t-4,es=[fi(),fi()],es.position0=0,es.position1=0;let r=se;se=i;try{return fi()}finally{se=r}};Fr[255]=e=>e.length==4?new Date((e[0]*16777216+(e[1]<<16)+(e[2]<<8)+e[3])*1e3):e.length==8?new Date(((e[0]<<22)+(e[1]<<14)+(e[2]<<6)+(e[3]>>2))/1e6+((e[3]&3)*4294967296+e[4]*16777216+(e[5]<<16)+(e[6]<<8)+e[7])*1e3):e.length==12?new Date(((e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3])/1e6+((e[4]&128?-281474976710656:0)+e[6]*1099511627776+e[7]*4294967296+e[8]*16777216+(e[9]<<16)+(e[10]<<8)+e[11])*1e3):new Date("invalid");function lC(e){let t=so,i=se,r=fs,s=da,a=Yn,n=hn,o=es,l=new Uint8Array(Fe.slice(0,so)),h=Bt,c=Bt.slice(0,Bt.length),u=Wr,d=Ch,p=e();return so=t,se=i,fs=r,da=s,Yn=a,hn=n,es=o,Fe=l,Ch=d,Bt=h,Bt.splice(0,Bt.length,...c),Wr=u,Nt=new DataView(Fe.buffer,Fe.byteOffset,Fe.byteLength),p}function m0(){Fe=null,hn=null,Bt=null}function IH(e){e.unpack?Fr[e.type]=e.unpack:Fr[e.type]=e}var F1=new Array(147);for(let e=0;e<256;e++)F1[e]=+("1e"+Math.floor(45.15-e*.30103));
3139var fm=new ff({useRecords:!1});fm.unpack;fm.unpackMultiple;fm.unpack;var RH=new Float32Array(1);new Uint8Array(RH.buffer,0,4);var Ip;try{Ip=new TextEncoder}catch{}var mf,k1,mm=typeof Buffer<"u",Mg=mm?Buffer.allocUnsafeSlow:Uint8Array,hC=mm?Buffer:Uint8Array,uS=mm?4294967296:2144337920,ye,wi,he=0,Ys,Qs=null,LH=/[\u0080-\uFFFF]/,fc=Symbol("record-id"),cC=class extends ff{constructor(e){super(e),this.offset=0;let t,i,r,s,a,n=0,o=hC.prototype.utf8Write?function(b,E,_){return ye.utf8Write(b,E,_)}:Ip&&Ip.encodeInto?function(b,E){return Ip.encodeInto(b,ye.subarray(E)).written}:!1,l=this;e||(e={});let h=e&&e.sequential,c=e.structures||e.saveStructures,u=e.maxSharedStructures;if(u==null&&(u=c?32:0),u>8160)throw new Error("Maximum maxSharedStructure is 8160");let d=e.maxOwnStructures;d==null&&(d=c?32:64),h&&!e.saveStructures&&(this.structures=[]);let p=u>32||d+u>64,f=u+64,m=u+d+64;if(m>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let g=[],v=0,y=0;this.pack=this.encode=function(b,E){if(ye||(ye=new Mg(8192),wi=new DataView(ye.buffer,0,8192),he=0),Ys=ye.length-10,Ys-he<2048?(ye=new Mg(ye.length),wi=new DataView(ye.buffer,0,ye.length),Ys=ye.length-10,he=0):he=he+7&2147483640,t=he,a=l.structuredClone?new Map:null,l.bundleStrings?(Qs=["",""],ye[he++]=214,ye[he++]=98,Qs.position=he-t,he+=4):Qs=null,i=l.structures,i){i.uninitialized&&(i=l._mergeStructures(l.getStructures()));let _=i.sharedLength||0;if(_>u)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+i.sharedLength);if(!i.transitions){i.transitions=Object.create(null);for(let A=0;A<_;A++){let C=i[A];if(!C)continue;let T,I=i.transitions;for(let P=0,O=C.length;P<O;P++){let k=C[P];T=I[k],T||(T=I[k]=Object.create(null)),I=T}I[fc]=A+64}n=_}h||(i.nextId=_+64)}r&&(r=!1),s=i||[];try{if(x(b),Qs){wi.setUint32(Qs.position+t,he-Qs.position-t);let _=Qs;Qs=null,x(_[0]),x(_[1])}if(l.offset=he,a&&a.idsToInsert){he+=a.idsToInsert.length*6,he>Ys&&S(he),l.offset=he;let _=BH(ye.subarray(t,he),a.idsToInsert);return a=null,_}return E&FH?(ye.start=t,ye.end=he,ye):ye.subarray(t,he)}finally{if(i){if(y<10&&y++,v>1e4)i.transitions=null,y=0,v=0,g.length>0&&(g=[]);else if(g.length>0&&!h){for(let _=0,A=g.length;_<A;_++)g[_][fc]=0;g=[]}if(r&&l.saveStructures){let _=i.sharedLength||u;i.length>_&&(i=i.slice(0,_));let A=ye.subarray(t,he);return l.saveStructures(i,n)===!1?(l._mergeStructures(l.getStructures()),l.pack(b)):(n=_,A)}}E&kH&&(he=t)}};let x=b=>{he>Ys&&(ye=S(he));var E=typeof b,_;if(E==="string"){let A=b.length;if(Qs&&A>=8&&A<4096){let I=LH.test(b);Qs[I?0:1]+=b,ye[he++]=193,x(I?-A:A);return}let C;A<32?C=1:A<256?C=2:A<65536?C=3:C=5;let T=A*3;if(he+T>Ys&&(ye=S(he+T)),A<64||!o){let I,P,O,k=he+C;for(I=0;I<A;I++)P=b.charCodeAt(I),P<128?ye[k++]=P:P<2048?(ye[k++]=P>>6|192,ye[k++]=P&63|128):(P&64512)===55296&&((O=b.charCodeAt(I+1))&64512)===56320?(P=65536+((P&1023)<<10)+(O&1023),I++,ye[k++]=P>>18|240,ye[k++]=P>>12&63|128,ye[k++]=P>>6&63|128,ye[k++]=P&63|128):(ye[k++]=P>>12|224,ye[k++]=P>>6&63|128,ye[k++]=P&63|128);_=k-he-C}else _=o(b,he+C,T);_<32?ye[he++]=160|_:_<256?(C<2&&ye.copyWithin(he+2,he+1,he+1+_),ye[he++]=217,ye[he++]=_):_<65536?(C<3&&ye.copyWithin(he+3,he+2,he+2+_),ye[he++]=218,ye[he++]=_>>8,ye[he++]=_&255):(C<5&&ye.copyWithin(he+5,he+3,he+3+_),ye[he++]=219,wi.setUint32(he,_),he+=4),he+=_}else if(E==="number")if(b>>>0===b)b<64?ye[he++]=b:b<256?(ye[he++]=204,ye[he++]=b):b<65536?(ye[he++]=205,ye[he++]=b>>8,ye[he++]=b&255):(ye[he++]=206,wi.setUint32(he,b),he+=4);else if(b>>0===b)b>=-32?ye[he++]=256+b:b>=-128?(ye[he++]=208,ye[he++]=b+256):b>=-32768?(ye[he++]=209,wi.setInt16(he,b),he+=2):(ye[he++]=210,wi.setInt32(he,b),he+=4);else{let A;if((A=this.useFloat32)>0&&b<4294967296&&b>=-2147483648){ye[he++]=202,wi.setFloat32(he,b);let C;if(A<4||(C=b*F1[(ye[he]&127)<<1|ye[he+1]>>7])>>0===C){he+=4;return}else he--}ye[he++]=203,wi.setFloat64(he,b),he+=8}else if(E==="object")if(!b)ye[he++]=192;else{if(a){let C=a.get(b);if(C){if(!C.id){let T=a.idsToInsert||(a.idsToInsert=[]);C.id=T.push(C)}ye[he++]=214,ye[he++]=112,wi.setUint32(he,C.id),he+=4;return}else a.set(b,{offset:he-t})}let A=b.constructor;if(A===Object)w(b,!0);else if(A===Array){_=b.length,_<16?ye[he++]=144|_:_<65536?(ye[he++]=220,ye[he++]=_>>8,ye[he++]=_&255):(ye[he++]=221,wi.setUint32(he,_),he+=4);for(let C=0;C<_;C++)x(b[C])}else if(A===Map){_=b.size,_<16?ye[he++]=128|_:_<65536?(ye[he++]=222,ye[he++]=_>>8,ye[he++]=_&255):(ye[he++]=223,wi.setUint32(he,_),he+=4);for(let[C,T]of b)x(C),x(T)}else{for(let C=0,T=mf.length;C<T;C++){let I=k1[C];if(b instanceof I){let P=mf[C];if(P.write){P.type&&(ye[he++]=212,ye[he++]=P.type,ye[he++]=0),x(P.write.call(this,b));return}let O=ye,k=wi,G=he;ye=null;let B;try{B=P.pack.call(this,b,U=>(ye=O,O=null,he+=U,he>Ys&&S(he),{target:ye,targetView:wi,position:he-U}),x)}finally{O&&(ye=O,wi=k,he=G,Ys=ye.length-10)}B&&(B.length+he>Ys&&S(B.length+he),he=zH(B,ye,he,P.type));return}}w(b,!b.hasOwnProperty)}}else if(E==="boolean")ye[he++]=b?195:194;else if(E==="bigint"){if(b<BigInt(1)<<BigInt(63)&&b>=-(BigInt(1)<<BigInt(63)))ye[he++]=211,wi.setBigInt64(he,b);else if(b<BigInt(1)<<BigInt(64)&&b>0)ye[he++]=207,wi.setBigUint64(he,b);else if(this.largeBigIntToFloat)ye[he++]=203,wi.setFloat64(he,Number(b));else throw new RangeError(b+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");he+=8}else if(E==="undefined")this.encodeUndefinedAsNil?ye[he++]=192:(ye[he++]=212,ye[he++]=0,ye[he++]=0);else if(E==="function")x(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+E)},w=this.useRecords===!1?this.variableMapSize?b=>{let E=Object.keys(b),_=E.length;_<16?ye[he++]=128|_:_<65536?(ye[he++]=222,ye[he++]=_>>8,ye[he++]=_&255):(ye[he++]=223,wi.setUint32(he,_),he+=4);let A;for(let C=0;C<_;C++)x(A=E[C]),x(b[A])}:(b,E)=>{ye[he++]=222;let _=he-t;he+=2;let A=0;for(let C in b)(E||b.hasOwnProperty(C))&&(x(C),x(b[C]),A++);ye[_+++t]=A>>8,ye[_+t]=A&255}:b=>{let E=Object.keys(b),_,A=s.transitions||(s.transitions=Object.create(null)),C=0;for(let I=0,P=E.length;I<P;I++){let O=E[I];_=A[O],_||(_=A[O]=Object.create(null),C++),A=_}let T=A[fc];if(T)T>=96&&p?(ye[he++]=((T-=96)&31)+96,ye[he++]=T>>5):ye[he++]=T;else{T=s.nextId,T||(T=64),T<f&&this.shouldShareStructure&&!this.shouldShareStructure(E)?(T=s.nextOwnId,T<m||(T=f),s.nextOwnId=T+1):(T>=m&&(T=f),s.nextId=T+1);let I=E.highByte=T>=96&&p?T-96>>5:-1;A[fc]=T,s[T-64]=E,T<f?(E.isShared=!0,s.sharedLength=T-63,r=!0,I>=0?(ye[he++]=(T&31)+96,ye[he++]=I):ye[he++]=T):(I>=0?(ye[he++]=213,ye[he++]=114,ye[he++]=(T&31)+96,ye[he++]=I):(ye[he++]=212,ye[he++]=114,ye[he++]=T),C&&(v+=y*C),g.length>=d&&(g.shift()[fc]=0),g.push(A),x(E))}for(let I=0,P=E.length;I<P;I++)x(b[E[I]])},S=b=>{let E;if(b>
313916777216){if(b-t>uS)throw new Error("Packed buffer would be larger than maximum buffer size");E=Math.min(uS,Math.round(Math.max((b-t)*(b>67108864?1.25:2),4194304)/4096)*4096)}else E=(Math.max(b-t<<2,ye.length-1)>>12)+1<<12;let _=new Mg(E);return wi=new DataView(_.buffer,0,E),ye.copy?ye.copy(_,0,t,b):_.set(ye.slice(t,b)),he-=t,t=0,Ys=_.length-10,ye=_}}useBuffer(e){ye=e,wi=new DataView(ye.buffer,ye.byteOffset,ye.byteLength),he=0}};k1=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,tC];mf=[{pack(e,t,i){let r=e.getTime()/1e3;if((this.useTimestamp32||e.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:s,targetView:a,position:n}=t(6);s[n++]=214,s[n++]=255,a.setUint32(n,r)}else if(r>0&&r<17179869184){let{target:s,targetView:a,position:n}=t(10);s[n++]=215,s[n++]=255,a.setUint32(n,e.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),a.setUint32(n+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return t(0),i(this.onInvalidDate());let{target:s,targetView:a,position:n}=t(3);s[n++]=212,s[n++]=255,s[n++]=255}else{let{target:s,targetView:a,position:n}=t(15);s[n++]=199,s[n++]=12,s[n++]=255,a.setUint32(n,e.getMilliseconds()*1e6),a.setBigInt64(n+4,BigInt(Math.floor(r)))}}},{pack(e,t,i){let r=Array.from(e),{target:s,position:a}=t(this.structuredClone?3:0);this.structuredClone&&(s[a++]=212,s[a++]=115,s[a++]=0),i(r)}},{pack(e,t,i){let{target:r,position:s}=t(this.structuredClone?3:0);this.structuredClone&&(r[s++]=212,r[s++]=101,r[s++]=0),i([e.name,e.message])}},{pack(e,t,i){let{target:r,position:s}=t(this.structuredClone?3:0);this.structuredClone&&(r[s++]=212,r[s++]=120,r[s++]=0),i([e.source,e.flags])}},{pack(e,t){this.structuredClone?dS(e,16,t):pS(mm?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let i=e.constructor;i!==hC&&this.structuredClone?dS(e,oC.indexOf(i.name),t):pS(e,t)}},{pack(e,t){let{target:i,position:r}=t(1);i[r]=193}}];function dS(e,t,i,r){let s=e.byteLength;if(s+1<256){var{target:a,position:n}=i(4+s);a[n++]=199,a[n++]=s+1}else if(s+1<65536){var{target:a,position:n}=i(5+s);a[n++]=200,a[n++]=s+1>>8,a[n++]=s+1&255}else{var{target:a,position:n,targetView:o}=i(7+s);a[n++]=201,o.setUint32(n,s+1),n+=4}a[n++]=116,a[n++]=t,a.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n)}function pS(e,t){let i=e.byteLength;var r,s;if(i<256){var{target:r,position:s}=t(i+2);r[s++]=196,r[s++]=i}else if(i<65536){var{target:r,position:s}=t(i+3);r[s++]=197,r[s++]=i>>8,r[s++]=i&255}else{var{target:r,position:s,targetView:a}=t(i+5);r[s++]=198,a.setUint32(s,i),s+=4}r.set(e,s)}function zH(e,t,i,r){let s=e.length;switch(s){case 1:t[i++]=212;break;case 2:t[i++]=213;break;case 4:t[i++]=214;break;case 8:t[i++]=215;break;case 16:t[i++]=216;break;default:s<256?(t[i++]=199,t[i++]=s):s<65536?(t[i++]=200,t[i++]=s>>8,t[i++]=s&255):(t[i++]=201,t[i++]=s>>24,t[i++]=s>>16&255,t[i++]=s>>8&255,t[i++]=s&255)}return t[i++]=r,t.set(e,i),i+=s,i}function BH(e,t){let i,r=t.length*6,s=e.length-r;for(t.sort((a,n)=>a.offset>n.offset?1:-1);i=t.pop();){let a=i.offset,n=i.id;e.copyWithin(a+r,a,s),r-=6;let o=a+r;e[o++]=214,e[o++]=105,e[o++]=n>>24,e[o++]=n>>16&255,e[o++]=n>>8&255,e[o++]=n&255,s=a}return e}function Zh(e){if(e.Class){if(!e.pack&&!e.write)throw new Error("Extension has no pack or write function");if(e.pack&&!e.type)throw new Error("Extension has no type (numeric code to identify the extension)");k1.unshift(e.Class),mf.unshift(e)}IH(e)}var uC=new cC({useRecords:!1});uC.pack;uC.pack;var FH=512,kH=1024,fS=new cC({structuredClone:!0});Zh({Class:We.prototype.constructor,type:1,write(e){return{...e}},read(e){return Object.setPrototypeOf(e,We.prototype),e}});Zh({Class:Ue.prototype.constructor,type:2,write(e){return[...e]},read(e){return Object.setPrototypeOf(e,Ue.prototype),e}});Zh({Class:mr.prototype.constructor,type:3,write(e){return[...e]},read(e){return Object.setPrototypeOf(e,mr.prototype),e}});Zh({Class:iS.prototype.constructor,type:4,write(e){return e.id},read(e){return new iS(e)}});Zh({Class:rS.prototype.constructor,type:5,write(e){return e.data},read(e){return new rS(e)}});Zh({Class:vi.prototype.constructor,type:6,write(e){return{...e}},read(e){return Object.setPrototypeOf(e,vi.prototype),e}});function UH(e){var t=0;if(e.length===0)return t;for(let i=0;i<e.length;i++){let r=e[i];t=(t<<5)-t+r,t=t&t}return t}function g0(e){if(D1(e))return e;if(Array.isArray(e))return e.map(g0);if(typeof e=="object"&&e!==null){let t={};for(let i of Object.keys(e).sort())t[i]=g0(e[i]);return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),t}else return e}var gf;(e=>{function t(s){return fS.pack(s)}e.serialize=t;function i(s){return fS.unpack(s)}e.deserialize=i;function r(s){return UH(t(g0(s))).toString()}e.checksum=r})(gf||(gf={}));var mS;(e=>{function t(r){return r.type==="Conditional"?r.condition.type==="Distance"?"Distance":"StateChange":r.type}e.toEventUIType=t;function i(r){return r==="Distance"||r==="StateChange"?"Conditional":r}e.fromEventUIType=i})(mS||(mS={}));function v0(e){return e==="MouseDown"||e==="MouseUp"||e==="KeyDown"||e==="KeyUp"||e==="Collision"||e==="Trigger"}var lr={LookAt:[],Follow:["Create"],DragDrop:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseHover:["Transition","Animation","TimelineAnimation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Scroll:["Transition","Animation","TimelineAnimation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Start:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Conditional:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MousePress:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyDown:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyUp:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyPress:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],GameControl:["Transition","Animation","TimelineAnimation","Audio","Particles","Create","Conditional"],Collision:["Transition","Animation","TimelineAnimation","Audio","Particles","Video","Create","Destroy","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Trigger:["Transition","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Resize:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],VariableChange:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],API:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],WEBHOOK:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],AIAssistantListener:["SetVariable"],AIAssistantTrigger:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"]},gS;(e=>{function t(r){return r.type==="MouseDown"||r.type==="MouseUp"||r.type==="MousePress"||r.type==="KeyDown"||r.type==="KeyUp"||r.type==="KeyPress"}e.is=t;function i(r){return r==="MouseDown"||r==="MouseUp"||r==="MousePress"?{type:r,mode:"Object",disabled:!1,name:"",actions:new Ue}
vendor: 4,540 bytes, line 3139
3139:{type:r,disabled:!1,name:"",key:void 0,actions:new Ue}}e.defaultData=i})(gS||(gS={}));var vf;(e=>{function t(i){return{type:"Property",value:[i??null,"position","x"]}}e.propertyDefaultData=t,e.valueDefaultData={type:"Literal",value:0}})(vf||(vf={}));var y0;(e=>{function t(s){return{type:"Comparison",operator:"==",lOperand:vf.propertyDefaultData(s),rOperand:{...vf.valueDefaultData}}}e.comparisonDefaultData=t;function i(s){return{type:"Distance",toObject:s??null,fromObject:s??null,distance:200}}e.distanceDefaultData=i;function r(s,a){return{type:"State",object:s??null,state:a??null}}e.stateDefaultData=r})(y0||(y0={}));var vS;(e=>{function t(i){return i.find(r=>r==="ifActions"||r==="elseActions")!==void 0}e.isConditionalSubActions=t})(vS||(vS={}));var yS;(e=>{function t(r){return r.type==="Conditional"}e.is=t;function i(r){return{type:"Conditional",disabled:!1,name:"",inActions:new Ue,outActions:new Ue,condition:y0.distanceDefaultData(r)}}e.defaultData=i})(yS||(yS={}));var xS;(e=>e.defaultData={type:"DragDrop",name:"",cursor:"hand",disabled:!1,dampingFactor:1,objects:[],snapTo:"center",snapSurfaceMode:"bbox",snapSurfaceOffset:0,dropOn:"all",autoOrient:!0,dropDestinations:[],plane:"adaptive",planeMode:"locked",referenceFrame:"global",limits:[-1/0,1/0,-1/0,1/0,-1/0,1/0],drop:!1,resetOnSnapFail:!1,snapSpeed:20,resetSpeed:20,dragDropActions:{drag:new Ue,drop:new Ue}})(xS||(xS={}));var x0;(e=>e.defaultData={type:"Follow",disabled:!1,name:"",maxDelta:0,dampingFactor:1,target:"cursor",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledTranslation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5,actions:new Ue})(x0||(x0={}));var b0;(e=>e.defaultData={type:"LookAt",disabled:!1,name:"",distance:1e3,dampingFactor:1,target:"cursor",tilt:"up",axis:"z",plane:"custom",resetOnPointerLeave:!0,resetAfterDistanceLimit:!0,enabledRotation:[!0,!0,!0],limitDistanceEnabled:!1,limitDistance:1e3,snapDelay:0,resetSpeed:5})(b0||(b0={}));var bS;(e=>{function t(r){return r.type==="MouseHover"}e.is=t;function i(){return{type:"MouseHover",disabled:!1,name:"",actions:new Ue}}e.defaultData=i})(bS||(bS={}));var wS;(e=>{function t(r){return r.type==="Scroll"}e.is=t;function i(){return{type:"Scroll",disabled:!1,name:"",steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new Ue}}e.defaultData=i})(wS||(wS={}));var SS;(e=>{function t(r){return r.type==="Start"}e.is=t;function i(){return{type:"Start",disabled:!1,name:"",actions:new Ue}}e.defaultData=i})(SS||(SS={}));var _S;(e=>{function t(r){return r.type==="Collision"}e.is=t;function i(){return{type:"Collision",disabled:!1,name:"",target:"character",actions:new Ue}}e.defaultData=i})(_S||(_S={}));var AS;(e=>{function t(r){return r.type==="Trigger"}e.is=t;function i(r,s){return{type:"Trigger",name:"",disabled:!1,target:"all",triggeringObjects:[],actions:new Ue,triggerZone:"box",position:s.toArray(),rotation:[0,0,0],size:r.toArray(),radius:r.length()/2,helperVisible:!0}}e.defaultData=i})(AS||(AS={}));var w0;(e=>{e.defaultSizes={mobile:[480,480],tablet:[768,768],desktop:[1200,1200],custom:[769,1200]};function t(n){return n.type==="Resize"}e.is=t;function i(n){return typeof n=="string"?n:"custom"}e.sizeToDevice=i;function r(n){return typeof n=="string"?[...e.defaultSizes[n]]:[...n]}e.deviceToSize=r;function s(){let n={size:"mobile",operator:"<",actions:new Ue},o={size:"tablet",operator:"<",actions:new Ue},l={size:[...e.defaultSizes.custom],operator:"<>",actions:new Ue},h=new Ue;return h.push({id:Te.generateUUID(),fi:0,data:n},{id:Te.generateUUID(),fi:1,data:o},{id:Te.generateUUID(),fi:2,data:l}),{type:"Resize",disabled:!1,name:"",orientation:"horizontal",breakpoints:h}}e.defaultData=s;function a(){return{size:[...e.defaultSizes.custom],operator:"<>",actions:new Ue}}e.defaultBreakpointData=a})(w0||(w0={}));var S0;(e=>{e.propertyPaths={Position:["position"],"Position X":["position","x"],"Position Y":["position","y"],"Position Z":["position","z"],Rotation:["rotation"],"Rotation X":["rotation","x"],"Rotation Y":["rotation","y"],"Rotation Z":["rotation","z"],Scale:["scale"],"Scale X":["scale","x"],"Scale Y":["scale","y"],"Scale Z":["scale","z"],Width:["width"],Height:["height"],Depth:["depth"],"Mouse Position X":["mouse","x"],"Mouse Position Y":["mouse","y"],"Mouse Pressed":["mouse","pressed"],"Screen Width":["mouse","width"],"Screen Height":["mouse","height"],"Hit Position X":["raycast","x"],"Hit Position Y":["raycast","y"],"Hit Position Z":["raycast","z"],"Hit Ob
3139ject Position X":["raycast","objX"],"Hit Object Position Y":["raycast","objY"],"Hit Object Position Z":["raycast","objZ"]};function t(r){return r.type==="VariableChange"}e.is=t;function i(){return{disabled:!1,type:"VariableChange",name:"",actions:new Ue,variableId:"",objectId:null,property:"Position X"}}e.defaultData=i})(S0||(S0={}));var MS;(e=>{function t(r){return r.type==="API"}e.is=t;function i(){return{disabled:!1,type:"API",name:"",successActions:new Ue,errorActions:new Ue,userAPIId:""}}e.defaultData=i})(MS||(MS={}));var ES;(e=>{function t(r){return r.type==="WEBHOOK"}e.is=t;function i(){return{disabled:!1,type:"WEBHOOK",name:"",actions:new Ue,userWebhookId:""}}e.defaultData=i})(ES||(ES={}));var CS;(e=>{function t(r){return r.type==="AIAssistantListener"}e.is=t;function i(){return{disabled:!1,type:"AIAssistantListener",name:"",actions:new Ue,analysis:"average",analysisRange:[0,71],analysisSingle:0}}e.defaultData=i})(CS||(CS={}));var TS;(e=>{function t(r){return r.type==="AIAssistantTrigger"}e.is=t;function i(){return{disabled:!1,description:"",name:"",type:"AIAssistantTrigger",actions:new Ue}}e.defaultData=i})(TS||(TS={}));var Jh="personal camera",Jc="a218fcc3-276b-49b9-b485-49037fd14f5f",NH=2960946,ss=5526619,VH=(e=>(e.x="x",e.y="y",e.z="z",e))(VH||{}),ma;(e=>{function t(f,m){return f[0]===m[0]&&f[1]===m[1]}e.isEqual=t;function i(f,m,g){return[f[0]+(m[0]-f[0])*g,f[1]+(m[1]-f[1])*g]}e.lerp=i;function r(f,m){return[f[0]+m[0],f[1]+m[1]]}e.add=r;function s(f,m){return[f[0]-m[0],f[1]-m[1]]}e.sub=s;function a(f,m){return[f[0]*m[0],f[1]*m[1]]}e.multiply=a;function n(f,m){return[f[0]/m[0],f[1]/m[1]]}e.divide=n;function o(f,m){return Math.pow(m[0]-f[0],2)+Math.pow(m[1]-f[1],2)}e.distanceSquared=o;function l(f,m){return Math.sqrt(o(f,m))}e.distance=l;function h(f,m){return f[0]*m[0]+f[1]*m[1]}e.dot=h;function c(f,m){return[f[0]*m,f[1]*m]}e.scalarMultiply=c;function u(f,m,g){let v=e.sub(m,f),y=e.sub(g,f),x=e.dot(v,y)/e.dot(v,v),w=e.scalarMultiply(v,x);return e.add(f,w)}e.projectionOnto=u;function d(f,m,g){return l(f,u(f,m,g))}e.projectionOntoDistance=d;function p(f,m){return[(f[0]+m[0])*.5,(f[1]+m[1])*.5]}e.center=p})(ma||(ma={}));var ao;(e=>{function t(l,h){return l[0]===h[0]&&l[1]===h[1]&&l[2]===h[2]}e.isEqual=t;function i(l,h){return[l[0]+h[0],l[1]+h[1],l[2]+h[2]]}e.add=i;function r(l,h){return[l[0]-h[0],l[1]-h[1],l[2]-h[2]]}e.sub=r;function s(l,h){return[l[0]/h[0],l[1]/h[1],l[2]/h[2]]}e.div=s;function a(l,h){return[l[0]*h[0],l[1]*h[1],l[2]*h[2]]}e.mul=a;function n(l,h){return Math.hypot(l[0]-h[0],l[1]-h[1],l[2]-h[2])}e.dist=n;function o(l,h,c){return[l[0]+(h[0]-l[0])*c,l[1]+(h[1]-l[1])*c,l[2]+(h[2]-l[2])*c]}e.lerp=o})(ao||(ao={}));var Au;(e=>{function t(r,s){return r[0]===s[0]&&r[1]===s[1]&&r[2]===s[2]&&r[3]===s[3]}e.isEqual=t;function i(r,s,a){return[r[0]+(s[0]-r[0])*a,r[1]+(s[1]-r[1])*a,r[2]+(s[2]-r[2])*a,r[3]+(s[3]-r[3])*a]}e.lerp=i})(Au||(Au={}));var PS;(e=>{let t=180/Math.PI,i=Math.PI/180;function r(o){return typeof o=="number"?o*t:o}function s(o){return typeof o=="number"?o*i:o}function a(o){return[r(o[0]),r(o[1]),r(o[2])]}e.radToDeg=a;function n(o){return[s(o[0]),s(o[1]),s(o[2])]}e.degToRad=n})(PS||(PS={}));var Th;(e=>{e.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function t(s,a){for(let n=0;n<16;n++)if(s[n]!==a[n])return!1;return!0}e.isEqual=t;function i(s){return s??e.identity}e.simplify=i;function r(s,a){let n=a.slice(0);for(var o=0,l=a.length;o<l;o+=3){let h=s[3]*a[o]+s[7]*a[o+1]+s[11]*a[o+2]+s[15];n[o]=(s[0]*a[o]+s[4]*a[o+1]+s[8]*a[o+2]+s[12])/h,n[o+1]=(s[1]*a[o]+s[5]*a[o+1]+s[9]*a[o+2]+s[13])/h,n[o+2]=(s[2]*a[o]+s[6]*a[o+1]+s[10]*a[o+2]+s[14])/h}return n}e.applyMatrix4=r})(Th||(Th={}));var Ti;(e=>{function t(c){return typeof c=="object"&&typeof c.r=="number"&&typeof c.g=="number"&&typeof c.b=="number"}e.isRGB=t,e.white={r:1,g:1,b:1},e.red={r:1,g:0,b:0},e.black={r:0,g:0,b:0};function i(c){return{r:Math.round(c.r*255),g:Math.round(c.g*255),b:Math.round(c.b*255),a:1}}e.toRgb255a1=i;function r(c){return{r:c.r,g:c.g,b:c.b}}e.clone=r;function s(c){return c=Math.floor(c),{r:(c>>16&255)/255,g:(c>>8&255)/255,b:(c&255)/255}}e.fromHex=s;function a(c){return Math.round(c.r*255)*65536+Math.round(c.g*255)*256+Math.round(c.b*255)}e.toHex=a;function n(c,u){return c.r===u.r&&c.g===u.g&&c.b===u.b}e.equals=n;
vendor: 65,714 bytes, line 3139
3139function o(c,u){return c.r.toFixed(2)===u.r.toFixed(2)&&c.g.toFixed(2)===u.g.toFixed(2)&&c.b.toFixed(2)===u.b.toFixed(2)}e.equalsFixed=o;function l(c,u,d){return{r:c.r+(u.r-c.r)*d,g:c.g+(u.g-c.g)*d,b:c.b+(u.b-c.b)*d}}e.lerp=l;function h(c){return rs(c)?"r"in c&&"g"in c&&"b"in c&&!("a"in c):!1}e.is=h})(Ti||(Ti={}));var Ut;(e=>{e.white={...Ti.white,a:1};function t(h){return rs(h)?"r"in h&&"g"in h&&"b"in h&&"a"in h:!1}e.is=t,e.transparent={...Ti.white,a:0};function i(h){return{r:h[0],g:h[1],b:h[2],a:h[3]}}e.from0to1=i;function r(h,c){return{...Ti.fromHex(h),a:c}}e.fromHexAndA=r;function s(h){return{r:Math.round(h.r*255),g:Math.round(h.g*255),b:Math.round(h.b*255),a:h.a}}e.toRgb255a1=s;function a(h,c){return Ti.equals(h,c)&&h.a===c.a}e.equals=a;function n(h,c){return Ti.equalsFixed(h,c)&&h.a.toFixed(2)===c.a.toFixed(2)}e.equalsFixed=n;function o(h,c,u){return{r:h.r+(c.r-h.r)*u,g:h.g+(c.g-h.g)*u,b:h.b+(c.b-h.b)*u,a:h.a+(c.a-h.a)*u}}e.lerp=o;function l({r:h,g:c,b:u,a:d}=e.white){return`rgba(${h*255}, ${c*255}, ${u*255}, ${d})`}e.toStyle=l})(Ut||(Ut={}));var _0;(e=>e.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1],pivot:[0,0,0],pivotRotation:[0,0,0]})(_0||(_0={}));var jH=(e=>(e[e.LINEAR=0]="LINEAR",e[e.EASE=1]="EASE",e[e.EASE_IN=2]="EASE_IN",e[e.EASE_OUT=3]="EASE_OUT",e[e.EASE_IN_OUT=4]="EASE_IN_OUT",e[e.CUBIC=5]="CUBIC",e[e.SPRING=6]="SPRING",e[e.ARC=7]="ARC",e[e.NONE=8]="NONE",e))(jH||{}),yf;(e=>e.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(yf||(yf={}));var xf;(e=>e.defaultData={control1:[.5,0],control2:[.5,1]})(xf||(xf={}));var kn;(e=>(e.linear=[0,0,1,1],e.ease=[.25,.1,.25,1],e.easeIn=[.42,0,1,1],e.easeOut=[0,0,.58,1],e.easeInOut=[.42,0,.58,1]))(kn||(kn={}));function DS(e){return typeof e=="string"&&e.length===36?/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e):!1}var il;(e=>{e.all=["PerspectiveCamera","OrthographicCamera"];function t(i){return e.all.includes(i)}e.is=t})(il||(il={}));var Ph;(e=>{e.DefaultUp=[0,1,0],e.DefaultTargetOffset=1e3,e.defaultData={far:1e5,type:"OrthographicCamera",perspective:{near:70,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:e.DefaultUp,isUpVectorFlipped:!1,targetOffset:e.DefaultTargetOffset};function t(i){return i.type==="PerspectiveCamera"?i.perspective?.zoom??1:i.orthographic?.zoom??1}e.getZoom=t})(Ph||(Ph={}));var Qn;(e=>{function t(s,a=.1){return{disabled:!1,type:"linear",hideBase:!1,count:3,radial:{radius:Math.max(typeof s[0]=="number"?s[0]:1,typeof s[1]=="number"?s[1]:1)*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal",pivot:[0,0,0],pivotRotation:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[(typeof s[0]=="number"?s[0]+s[0]:1)*a,0,0],pivot:[0,0,0],pivotRotation:[0,0,0]},grid:{count:[2,2,2],size:s.map(n=>(typeof n=="number"?n:1)*(1+a)),useCenter:!0},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}}}e.defaultData=t;function i(s,a){let n={...s};if(dC.forEach(o=>{Object.assign(n,{[o]:a[o]??s[o]})}),n.radial={...s.radial},a.radial){let o=s.radial,l=a.radial;U1.forEach(h=>{Object.assign(n.radial,{[h]:l[h]??o[h]})})}if(n.linear={...s.linear},a.linear){let o=s.linear,l=a.linear;N1.forEach(h=>{Object.assign(n.linear,{[h]:l[h]??o[h]})})}if(n.grid={...s.grid},a.grid){let o=s.grid,l=a.grid;V1.forEach(h=>{Object.assign(n.grid,{[h]:l[h]??o[h]})})}if(n.toObject={...s.toObject},a.toObject){let o=s.toObject,l=a.toObject;j1.forEach(h=>{Object.assign(n.toObject,{[h]:l[h]??o[h]})})}if(n.randomnessObject={...s.randomnessObject},a.randomnessObject){let o=s.randomnessObject,l=a.randomnessObject;H1.forEach(h=>{Object.assign(n.randomnessObject,{[h]:l[h]??o[h]})})}return n}e.merge=i;function r(s){return!!(s.randomnessObject||s.toObject)}e.isPartial=r})(Qn||(Qn={}));var A0;(e=>{e.defaultData={radial:{},linear:{},grid:{},toObject:{},randomnessObject:{}};let t=["radial","linear","grid","toObject","randomnessObject"];function i(r,s){let a=[];r.count!==void 0&&a.push({type:0,path:s,props:{count:r.count}});for(let n of t){let o=r[n];o&&Object.keys(o).length>0&&a.push({type:0,path:[...s,n],props:o})}return a}e.toOps=i})(A0||(A0={}));var dC=["count"],U1=["radius","start","end","position","scale","rotation"],N1=["position","scale","rotation"],V1=["count","size"],j1=["count","position","scale","rotation"],H1=["strength","scale","rotation","position","movement","seed","freqScale"],M0;(e=>{e.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function t(i){return e.all.includes(i)}e.is=t})(M0||(M0={}));var E0;(e=>{function t(r){return i(r)}e.defaultData=t;function i(r){if(r==="PointLight")return{type:r,color:Ut.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(r==="SpotLight")return{type:r,color:Ut.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};if(r==="DirectionalLight")return{type:r,color:Ut.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}})(E0||(E0={}));var bf;(e=>(e.defaultShapeData={type:"PlaneEmitterShape",size:[100,100,100]},e.defaultCollisionData={colliderEntityId:null,collisionBounce:.75},e.defaultData={renderMaterial:{type:"particleMaterial",color:{r:1,g:.2,b:.545,a:1},color2:{r:.945,g:.714,b:.184,a:1},coloring:"gradient",ease:"linearFadeOut",easeSize:"linearFadeOut",transparent:!0,size:[40,40],texture:"pt_default_particle",spriteRotation:[0,0]},birthRatePerSec:50,gravity:1,noiseStrength:0,noiseScale:0,noiseSeed:1,noiseType:"curl",randomRotation:0,randomScale:.2,randomMass:.5,rootObjectType:"instancedMesh",life:1,direction:[0,0,0],directionMode:"axis",speed:10,shape:e.defaultShapeData,autoPlay:!0,emitTimeDelay:0,emitTimeCycle:"infinity",emitTimeDuration:1,...e.defaultCollisionData}))(bf||(bf={}));var Dh;(e=>e.defaultData={enabled:"visibility",fusedBody:!0,rigidBody:"positioned",density:1,pointMass:0,gravityScale:1,friction:.5,damping:0,restitution:.2,colliderType:"convex",enabledRotation:[!0,!0,!0],enabledTranslation:[!0,!0,!0]})(Dh||(Dh={}));var HH=(e=>(e[e.Front=0]="Front",e[e.Back=1]="Back",e[e.Double=2]="Double",e))(HH||{}),C0;(e=>{e.defaultData={castShadow:!0,receiveShadow:!0};function t(i,r){return i.castShadow===r.castShadow&&i.receiveShadow===r.receiveShadow}e.equals=t})(C0||(C0={}));var T0;(e=>{e.defaultData={flatShading:!1,wireframe:!1,side:0};function t(i,r){return i.flatShading===r.flatShading&&i.side===r.side&&i.wireframe===r.wireframe}e.equals=t})(T0||(T0={}));var P0;(e=>e.defaultData={...T0.defaultData,...C0.defaultData})(P0||(P0={}));var OS;(e=>{function t(i,r){let s=[];if("material"in i){let a=typeof i.material=="string"?r.materials[i.material]??r.lib.materials[i.material]?.asset:i.material;a&&s.push(a)}else if("materials"in i)for(let a of i.materials){let n=typeof a=="string"?r.materials[a]??r.lib.materials[a]?.asset:a;n&&s.push(n)}return s}e.getMaterialData=t})(OS||(OS={}));var wf;(e=>(e.defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7))(wf||(wf={}));var IS;(e=>{function t(i){return i==="texture"||i==="video"||i==="color"||i==="depth"||i==="normal"||i==="gradient"||i==="noise"||i==="fresnel"||i==="rainbow"||i==="toon"||i==="outline"||i==="particle"||i==="transmission"||i==="matcap"||i==="displace"||i==="pattern"||i==="light"}e.is=t})(IS||(IS={}));function GH(e){return e.type!=="displace"}var RS;(e=>{function t(i){return i==="phong"||i==="toon"||i==="lambert"||i==="physical"}e.is=t})(RS||(RS={}));var WH=(e=>(e[e.Linear=0]="Linear",e[e.Radial=1]="Radial",e[e.Polar=2]="Polar",e))(WH||{}),qH=(e=>(e[e.RepeatWrapping=1e3]="RepeatWrapping",e[e.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",e[e.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping",e))(qH||{}),XH=(e=>(e[e.NearestFilter=1003]="NearestFilter",e[e.LinearFilter=1006]="LinearFilter",e[e.LinearMipmapLinearFilter=1008]="LinearMipmapLinearFilter",e))(XH||{}),YH=(e=>(e[e.UV=0]="UV",e[e.Planar=1]="Planar",e[e.Spherical=2]="Spherical",e[e.Cylindrical=3]="Cylindrical",e[e.Triplanar=4]="Triplanar",e))(YH||{}),QH=(e=>(e[e.Simplex=0]="Simplex",e[e.SimplexFractal=1]="SimplexFractal",e[e.Ashima=2]="Ashima",e[e.Fbm=3]="Fbm",e[e.Perlin=4]="Perlin",e[e.Voronoi=5]="Voronoi",e))(QH||{}),KH=(e=>(e[e.F1=0]="F1",e[e.F2=1]="F2",e[e.F2MinusF1=2]="F2MinusF1",e[e.SmoothBlend=3]="SmoothBlend",e[e.Edge=4]="Edge",e[e.Power=5]="Power",e[e.Lines=6]="Lines",e[e.Cells=7]="Cells",e))(KH||{}),ZH=(e=>(e[e.Lights=0]="Lights",e[e.Static=1]="Static",e[e.Camera=2]="Camera",e))(ZH||{}),JH=(e=>(e[e.Circle=0]="Circle",e[e.Ring=1]="Ring",e[e.Polygon=2]="Polygon",e[e.Cross=3]="Cross",e[e.Diamond=4]="Diamond",e[e.Checkerboard=5]="Checkerboard",e[e.Line=6]="Line",e[e.Wave=7]="Wave",e))(JH||{}),pC=["mode","gradientType","noiseType","displacementType","projection","cnormal","crop","axis","side"],$H=["wrapping","image","video","name","minFilter","magFilter"],_i;(e=>{function t(n,o){let{texture:l,...h}=o;if(Object.assign(n,h),l){let c=n.texture;c&&Object.assign(c,l)}}e.patch=t;function i(n){return{...e.defaultData("color"),color:n}}e.defaultColorLayer=i;function r(n,o){return n==="light"&&o?s(o):a(n)}e.defaultData=r;function s(n){let o={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(n){case"phong":return{...o,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...o,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...o,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...o,category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0,occlusion:!0}}}function a(n){let o={alpha:1,mode:0,isMask:!1,visible:!0};switch(n){case"texture":return{...o,type:"texture",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{image:"image_0",wrapping:1e3,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"video":return{...o,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:wf.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...o,type:"color",color:Ti.fromHex(ss)};case"depth":return{...o,type:"depth",gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1]],steps:[0,1],near:50,far:200};case"normal":return{...o,type:"normal",cnormal:[1,1,1]};case"gradient":return{...o,type:"gradient",gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{...o,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...Ti.fromHex(6710886),a:1},colorB:{...Ti.fromHex(6710886),a:1},colorC:{...Ti.fromHex(16777215),a:1},colorD:{...Ti.fromHex(16777215),a:1},distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8],voronoiStyle:0,highCut:1,lowCut:0,smoothness:.3,seed:0,quality:1};case"fresnel":return{...o,type:"fresnel",color:Ut.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{...o,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...o,type:"toon",positioning:2,colors:[[0,0,0,1],[.5,.5,.5,1],[.5,.5,.5,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,.475,.525,1,1,1,1,1,1,1],num:4,source:[0,1e3,0],isWorldSpace:!0,noiseStrength:0,noiseScale:1,shadowColor:Ut.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...o,type:"outline",outlineColor:Ut.fromHexAndA(0,1),contourColor:Ut.fromHexAndA(0,1),outlineWidth:2,contourWidth:5,outlineThreshold:.4,contourThreshold:0,outlineSmoothing:0,contourFrequency:10,contourDirection:[0,1,0],positionalLines:!1,compensation:!0};case"matcap":return{...o,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...o,type:"transmission",thickness:10,ior:1.5,roughness:1};case"displace":return{visible:!0,type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,voronoiStyle:0,smoothness:.3,seed:0,highCut:1,lowCut:0,quality:1};case"pattern":return{...o,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...Ti.fromHex(0),a:1},colorB:{...Ti.fromHex(16777215),a:1},frequency:[10,10],size:.5,variation:0,smoothness:.5,zigzag:0,rotation:0,vertical:[0,1],horizontal:[0,1],sides:6}}}})(_i||(_i={}));var rr;(e=>{function t(u){return!u.layers.some(d=>d.data.type==="texture"&&d.data.projection!==0||d.data.type==="depth"&&!d.data.isWorldSpace||d.data.type==="noise"||d.data.type==="displace")}e.isMergable=t;function i(u){let d="";return u.layers.forEach(p=>{Object.entries(p.data).forEach(([f,m])=>{d+=`${f}${m}`,Array.isArray(m)?m.forEach(g=>d+=`${g}`):typeof m=="object"?Object.values(m).forEach(g=>{typeof g=="number"?d+=`${g.toFixed(4)}`:d+=`${g}`}):d+=`${m}`})}),d}e.getHash=i;function r(){return{layers:new Ue}}e.defaultEmptyData=r;function s(u="layer1",d="layer2"){return n("phong",u,d)}e.defaultData=s;function a(u,d){return{...u,name:d}}e.withName=a;function n(u,d="layer1",p="layer2",f=Ti.fromHex(16777215)){let m=new Ue;return m.push({fi:0,data:_i.defaultData("light",u),id:d}),m.push({fi:1,data:_i.defaultData("color"),id:p}),{layers:m}}e.defaultTwoLayerData=n;function o(u,d,p="layer1",f="layer2"){let m=new Ue;return m.push({fi:0,data:_i.defaultData("light",d),id:p}),m.push({fi:1,data:_i.defaultColorLayer(u),id:f}),{layers:m}}e.defaultColorMaterial=o;function l(u){let d=_i.defaultData("texture");u&&Object.assign(d.texture,{image:u});let p=new Ue;return p.push({fi:0,data:d,id:"layer1"}),p.push({fi:1,data:{..._i.defaultData("transmission"),alpha:1},id:"layer2"}),p.push({fi:2,data:{..._i.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:p}}e.defaultUIObjectMaterial=l;function h(u,d="phong",p="layer1",f="layer2"){let m=_i.defaultData("texture");Object.assign(m.texture,{image:u});let g=new Ue;return g.push({fi:0,data:m,id:p}),g.push({fi:1,data:_i.defaultData("light",d),id:f}),{layers:g}}e.defaultTwoLayerTextureData=h;function c(u,d="phong",p="layer1",f="layer2"){let m=_i.defaultData("video");Object.assign(m.texture,{video:u});let g=new Ue;return g.push({fi:0,data:m,id:p}),g.push({fi:1,data:_i.defaultData("light",d),id:f}),{layers:g}}e.defaultTwoLayerVideoTextureData=c})(rr||(rr={}));var Sf;(e=>{function t(){return{points:new Ue,roundness:0,shapeHoles:[],isClosed:!1}}e.defaultData=t})(Sf||(Sf={}));var _f;(e=>{function t(){return{points:new Ue,lastInsertionPlane:null,subdivisions:12,isClosed:!1,subdivisionMode:"parametric"}}e.defaultData=t})(_f||(_f={}));var Ql={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},D0;(e=>{function t(i,r){let s={...i};return G1.forEach(a=>{Object.assign(s,{[a]:r[a]??i[a]})}),s}e.merge=t})(D0||(D0={}));var fC={shape:Ql,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},G1=["depth","offset","angle","twist","startScale","endScale"],Af;(e=>{function t(s){return s==="PolygonGeometry"||s==="RectangleGeometry"||s==="StarGeometry"||s==="TriangleGeometry"||s==="EllipseGeometry"||s==="UIGeometry"}e.is2DParametricMesh=t;function i(s){return s==="PolygonGeometry"||s==="RectangleGeometry"||s==="StarGeometry"||s==="TriangleGeometry"||s==="EllipseGeometry"||s==="PathGeometry"||s==="VectorGeometry"||s==="ConeGeometry"||s==="CubeGeometry"||s==="CylinderGeometry"||s==="DodecahedronGeometry"||s==="HelixGeometry"||s==="IcosahedronGeometry"||s==="LatheGeometry"||s==="PyramidGeometry"||s==="SphereGeometry"||s==="PlaneGeometry"||s==="BackdropGeometry"||s==="TorusGeometry"||s==="TorusKnotGeometry"||s==="BooleanGeometry"||s==="TextGeometry"||s==="InputGeometry"}e.isParametricMesh=i;function r(s){return s==="PolygonGeometry"||s==="RectangleGeometry"||s==="StarGeometry"||s==="TriangleGeometry"||s==="EllipseGeometry"||s==="PathGeometry"||s==="VectorGeometry"||s==="ConeGeometry"||s==="CubeGeometry"||s==="CylinderGeometry"||s==="DodecahedronGeometry"||s==="HelixGeometry"||s==="IcosahedronGeometry"||s==="LatheGeometry"||s==="PyramidGeometry"||s==="SphereGeometry"||s==="PlaneGeometry"||s==="BackdropGeometry"||s==="TorusGeometry"||s==="TorusKnotGeometry"||s==="TextGeometry"||s==="SubdivGeometry"||s==="NonParametricGeometry"}e.isSwappableGeometry=r})(Af||(Af={}));var O0;(e=>{function t(i,r){let s={...i};return Object.assign(s,r),s.type==="PathGeometry"&&"extrusion"in r&&r.extrusion&&(s.extrusion={...i.extrusion},Object.assign(s.extrusion,D0.merge(s.extrusion,r.extrusion))),s}e.merge=t})(O0||(O0={}));var Nn;(e=>{function t(i){if(i==="RectangleGeometry")return{width:320,height:320,type:i,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="UIGeometry")return{type:i,frame:"",cornerRadius:[0,0,0,0],cornerType:0,width:1,height:1};if(i==="PathGeometry")return{type:i,width:1,height:1,depth:1,path:_f.defaultData(),extrusion:fC};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:Sf.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="BooleanGeometry")return{type:i,operation:2,width:0,height:0,depth:0,phongAngle:35};if(i==="ShapeBlendGeometry")return{type:i,width:0,height:0,depth:0,resolutionLevel:6,blendRange:100,useChildrenColors:!1};if(i==="TextGeometry")return{type:i,width:100,height:100,depth:0,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.2,letterSpacing:0,text:{textValue:""},textTransform:1,font:"Roboto_regular",editable:!1,extrudeBevelSize:0,extrudeBevelSegments:1};if(i==="InputGeometry")return{...e.defaultData("TextGeometry"),type:i,editable:!0};if(i==="SphereGeometry")return{type:"SphereGeometry",width:100,height:100,depth:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180};throw new Error("not implemented")}e.defaultData=t})(Nn||(Nn={}));var Eg=["width","height","depth"],I0;(e=>e.defaultData={enabled:!1,useBackgroundColor:!1,color:Ti.white,near:.1,far:2e3})(I0||(I0={}));var Mf;(e=>{let t={opacity:1,blendFunction:13,enabled:!1};e.defaultData={enabled:!1,pixelation:{...t,blendFunction:16,granularity:15},bloom:{...t,blendFunction:16,intensity:1,blurScale:1,luminanceThreshold:.25,luminanceSmoothing:.025,kernelSize:3},chromaticAberration:{...t,offset:[2,2]},vignette:{...t,darkness:1,offset:0},hueSaturation:{...t,hue:3,saturation:0},brightnessContrast:{...t,brightness:.25,contrast:0},depthOfField:{...t,focusDistance:100,focalLength:20,bokehScale:5},noise:{...t,blendFunction:16}}})(Mf||(Mf={}));var R0;(e=>e.defaultData={softShadowQuality:"low"})(R0||(R0={}));var L0;(e=>e.defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75})(L0||(L0={}));var z0;(e=>e.defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}})(z0||(z0={}));var Oh;(e=>e.defaultData={usePhysics:!1,gravity:-10})(Oh||(Oh={}));var B0;(e=>e.defaultData={playCamera:Jh,gameControlObject:null})(B0||(B0={}));var F0;(e=>e.defaultData={backgroundColor:Ut.fromHexAndA(NH,1),postprocessing:Mf.defaultData,fog:I0.defaultData,globalPhysics:Oh.defaultData,ambient:L0.defaultData,ao:z0.defaultData,shadow:R0.defaultData,publish:B0.defaultData})(F0||(F0={}));var k0;(e=>e.defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95})(k0||(k0={}));var LS;(e=>{function t(r){return r==="Component"||r==="Instance"}e.isComponentRelated=t;function i(r){return r==="Empty"||r==="Instance"}e.isEmptyOrComponent=i})(LS||(LS={}));var Ih;(e=>{e.identity={..._0.identity,hiddenMatrix:Th.identity};function t(s){return{position:s.position,rotation:s.rotation,scale:s.scale,pivot:s.pivot,pivotRotation:s.pivotRotation,hiddenMatrix:s.hiddenMatrix}}e.fromObject=t;function i(s,a){return{position:a?.position||s.position,rotation:a?.rotation||s.rotation,pivot:a?.pivot||s.pivot,pivotRotation:a?.pivotRotation||s.pivotRotation,scale:a?.scale||s.scale,hiddenMatrix:a?.hiddenMatrix||s.hiddenMatrix}}e.merge=i;function r(s,a){return FE({position:ao.isEqual(s.position,a.position)?void 0:a.position,rotation:ao.isEqual(s.rotation,a.rotation)?void 0:a.rotation,scale:ao.isEqual(s.scale,a.scale)?null:a.scale,hiddenMatrix:Th.isEqual(s.hiddenMatrix,a.hiddenMatrix)?void 0:a.hiddenMatrix})}e.diff=r})(Ih||(Ih={}));var eG=["slide","offset"],Gi;(e=>e.defaultData={states:new Ue,events:new Ue,timelineAnimations:new We,visible:!0,raycastLock:!1,physics:Dh.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...Ih.identity,cloner:null})(Gi||(Gi={}));var U0;(e=>e.defaultData={type:"Empty",...Gi.defaultData})(U0||(U0={}));var zS;(e=>e.defaultData={type:"ParticleCollider",...k0.defaultData,...Gi.defaultData})(zS||(zS={}));var BS;(e=>e.defaultData={type:"Component",...Gi.defaultData})(BS||(BS={}));var FS;(e=>e.defaultData={type:"Particle",...Gi.defaultData,...bf.defaultData})(FS||(FS={}));var Vn;(e=>e.defaultData={type:"Mesh",...Gi.defaultData,...P0.defaultData})(Vn||(Vn={}));var Mu;(e=>e.defaultData={...Gi.defaultData,...Ih.identity,position:[0,0,Ph.DefaultTargetOffset],...Ph.defaultData})(Mu||(Mu={}));var N0;(e=>{function t(i){return{...Gi.defaultData,...E0.defaultData(i)}}e.defaultData=t,e.defaultDirectionalLightData={...e.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(N0||(N0={}));var Ef;(e=>{function t(r,s,a=0){for(;a<s.length;){let n=r?r[s[a]]:void 0;if(s.length===a+1)return n;if(n)r=n.descendants,a+=1;else return}}e.resolveWithDes=t;function i(r,s,a=0){let n=t(r,s,a);if(n){let o=Object.keys(n);if(o.length===1&&o[0]==="descendants")return}return n}e.resolve=i})(Ef||(Ef={}));var Kn;(e=>{e.rootOverrideProps=["physics","events"],e.compositeNonOptionalOverrideProps=["geometry"],e.compositeEntireOverrideOverrideProps=["material"];function t(r,s){return{...Gi.defaultData,...s,component:r,overrides:new vi,physics:void 0,events:void 0,type:"Instance"}}e.ofComponent=t;function i(r){let s=Ih.fromObject(r.data);return t(r.id,s)}e.fromComponentData=i})(Kn||(Kn={}));var Rh;(e=>{e.defaultData={type:"Page",...Gi.defaultData,physics:{...Dh.defaultData,fusedBody:!1},...F0.defaultData,camera:Mu.defaultData};function t(i){return i.uiScene!==void 0}e.isUIPage=t})(Rh||(Rh={}));var V0;(e=>(e.defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],pivot:[0,0,0],pivotRotation:[0,0,0],hiddenMatrix:Th.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:Dh.defaultData,states:new Ue,events:new Ue,timelineAnimations:new We,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...Ph.defaultData},e.KeysByResetCategory={States:["states"],Events:["events"],Material:["material","materials"],Geometry:["geometry"],Position:["position"],Rotation:["rotation"],Scale:["scale"],Transform:["position","scale","rotation","hiddenMatrix"],Name:["name"],Visibility:["visible","raycastLock","flatShading","wireframe","side"],Shadows:["castShadow","receiveShadow"],Cloner:["cloner"],Physics:["physics"]},e.defaultMeshObject={name:"Rectangle",...Gi.defaultData,...Vn.defaultData,geometry:Nn.defaultData("RectangleGeometry"),material:rr.defaultTwoLayerData("phong","layer1","layer2")},e.defaultBooleanObject={name:"Boolean",...Gi.defaultData,...Vn.defaultData,geometry:Nn.defaultData("BooleanGeometry"),material:rr.defaultTwoLayerData("phong","layer1","layer2")},e.defaultShapeBlendObject={name:"Shape Blend",...Gi.defaultData,...Vn.defaultData,geometry:Nn.defaultData("ShapeBlendGeometry"),material:rr.defaultTwoLayerData("phong","layer1","layer2")},e.defaultTextObject={name:"Text",...Gi.defaultData,...Vn.defaultData,geometry:Nn.defaultData("TextGeometry"),material:rr.defaultTwoLayerData("phong","layer1","layer2")},e.defaultInputObject={name:"Input",...Gi.defaultData,...Vn.defaultData,geometry:Nn.defaultData("InputGeometry"),material:rr.defaultTwoLayerData("phong","layer1","layer2")}))(V0||(V0={}));var Zn;(e=>{function t(a,n){let o={name:n};return a.type==="Mesh"?(o.geometry={},"material"in a&&(o.material={layers:new vi}),"materials"in a&&(o.materials=a.materials.map(l=>({layers:new vi})))):il.is(a.type)&&(o.perspective={},o.orthographic={}),o}e.newEmpty=t;function i(a,n){if(n===void 0)return a;let o={...a};return"material"in o&&"material"in n&&n.material&&(o.material=_u(o.material,l=>{if(typeof l!="string")for(let[h,c]of Object.entries(n.material.layers)){let u=l.layers.data(h);u&&_i.patch(u,c)}}).data),o.materials&&n.materials&&(o.materials=_u(o.materials,l=>{for(let h=0;h<o.materials.length;h++){let c=n.materials[h];if(typeof c!="string")for(let[u,d]of Object.entries(c.layers)){let p=l[h]?.layers?.data(u);p&&_i.patch(p,d)}}}).data),o}function r(a,n){let o,l=[],h={orthographic:0,perspective:0,geometry:0};function c(u,d){for(let[p,f]of Object.entries(d.layers)){let{texture:m,...g}=f;if(m!==void 0&&Object.keys(m).length>0){let v={path:[...u,"layers",p,"texture"],props:m,type:0};l.push(v)}if(Object.keys(g).length>0){let v={path:[...u,"layers",p],props:g,type:0};l.push(v)}}}for(let[u,d]of Object.entries(n))if(u!=="name")if(u==="cloner")l.push(...A0.toOps(d,["cloner"]));else if(u==="pathSnapping")l.push({path:[u],props:{slide:d.slide,offset:d.offset},type:0});else if(u==="material")c(["material"],d);else if(u==="materials")for(let[p,f]of Object.entries(d))c(["materials",p],f);else if(h[u]===0){if(u==="geometry"&&d.extrusion!==void 0){let p={path:[u,"extrusion"],props:d.extrusion,type:0};l.push(p),d={...d},delete d.extrusion}if(Object.keys(d).length>0){let p={path:[u],props:d,type:0};l.push(p)}}else o===void 0&&(o={path:[],props:{},type:0},l.push(o)),o.props[u]=d;return l}e.toOps=r;function s(a,n){if(n===void 0)return a;let o={...a};if(Object.assign(o,Ih.merge(o,n)),Object.assign(o,{pathSnapping:Object.assign({},o.pathSnapping,{slide:n.pathSnapping?.slide??o.pathSnapping?.slide??0,offset:n.pathSnapping?.offset??o.pathSnapping?.offset??0})}),il.is(a.type)){o.orthographic={...o.orthographic},o.perspective={...o.perspective};let l=n;l.orthographic?.zoom!==void 0&&(o.orthographic.zoom=l.orthographic.zoom),l.perspective?.zoom!==void 0&&(o.perspective.zoom=l.perspective.zoom),l.isUpVectorFlipped!==void 0&&(o.isUpVectorFlipped=l.isUpVectorFlipped),l.targetOffset!==void 0&&(o.targetOffset=l.targetOffset)}else if(a.type==="Mesh")"geometry"in n&&Object.assign(o,{geometry:O0.merge(o.geometry,n.geometry)}),(n.material||n.materials)&&(o=i(o,n)),o.cloner&&"cloner"in n&&Object.assign(o,{cloner:Qn.merge(o.cloner,n.cloner)});else if(a.type==="Empty")o.cloner&&"cloner"in n&&Object.assign(o,{cloner:Qn.merge(o.cloner,n.cloner)});else if(M0.is(a.type)){let l=n;l.intensity!==void 0&&(o.intensity=l.intensity),l.color!==void 0&&(typeof l.color=="string"?o.color=l.color:o.color=Ti.clone(l.color))}return o}e.patch=s})(Zn||(Zn={}));var Cf;(e=>e.defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,rotationSpeed:1,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,hoverRotateDamping:.125,isTouchZoom:!0,orbitTouches:2,panTouches:3,resetHoverEffectOnPointerLeave:!0})(Cf||(Cf={}));var on;(e=>e.defaultData={orbitControls:Cf.defaultData,playPage:Jc,withBackground:!0,preventScroll:!1,preventTouchScroll:!1,hideCursor:!1,mouseEventTarget:"canvas",joystickSizeAndXYOffset:Array(12).fill(0).map((t,i)=>{let r=0,s=0;return i<5?s=-30:i<10&&(s=30),i===0||i===10||i===5?r=30:(i===4||i===11||i===9)&&(r=-30),[120,[r,s],"show"]}),settings:{image:{format:"jpg",ratio:1,colorSpace:"display-p3"},videoStatic:{fps:60,mbps:150,ratio:1,duration:1e3,format:"mp4",imageFormat:"jpg",activeTimeline:null,colorSpace:"display-p3"},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70,pixelRatioMobile:0,pixelRatioDesktop:0}},stopRaycast:!0,hdTransmission:!1})(on||(on={}));var j0;(e=>e.defaultData={id:"basic",label:"Basic",style:"None",prompt:""})(j0||(j0={}));var H0;(e=>e.defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0})(H0||(H0={}));var Uo;(e=>(e.defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...j0.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:H0.defaultData}),e.generateSeed=()=>Math.round(Math.random()*1e5)))(Uo||(Uo={}));var Eu;(e=>{function t(r){return r.find(s=>s.data.type==="Page"&&s.data.globalPhysics.usePhysics)!==void 0}e.physicsEnabled=t;function i(r,s,a){r.scene.objects.traverseFrom(s,(n,o)=>{if(o.type==="Instance"){let l=Qo.getComponentData(r,o.component)?.data;l&&a(n,o,l.events)}else a(n,o,o.events)})}e.traverseModuleInstances=i})(Eu||(Eu={}));var No;(e=>{e.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",e.defaultLight={fi:-1,data:N0.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]};function t(s=!0,a=[]){let n=[],o=V0.defaultMeshObject;s&&(n.push({...e.defaultLight}),n.push({fi:1,id:"7ba78968-2a55-48f2-b14c-5191da3e075e",data:o,children:[]})),n.push(...a);let l=new mr;return l.push({fi:1,id:Jc,data:{...Rh.defaultData,name:"Scene 1"},children:n}),l}e.createDefaultObjectTreeWithPage=t,e.defaultData={objects:t(),publish:on.defaultData,styles:Uo.defaultData()},e.emptyDataWithoutPage=function(){return{objects:new mr,publish:on.defaultData,styles:Uo.defaultData()}},e.emptyDataWithPage=function(s=!0){return{objects:t(s),publish:on.defaultData,styles:Uo.defaultData()}},e.emptyData=function(){return{objects:new mr,publish:{...on.defaultData},styles:Uo.defaultData()}};function i(s){return{...e.defaultData,objects:Kr(s,mr.prototype)}}e.withObjs=i;function r(s,a){return i([{id:s,data:a,children:[],fi:0}])}e.withObj=r})(No||(No={}));var $c;(e=>e.defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}})($c||($c={}));var G0;(e=>(e.defaultData=t=>({url:t,name:"New Webhook",parametersSchemas:new Ue}),e.defaultParameterValueByType=t=>t==="number"?0:t==="boolean"?!1:""))(G0||(G0={}));var kS;(e=>e.defaultData=(t,i="GET")=>({url:t,method:i,name:"New API",headers:new Ue,queries:new Ue,autoStart:!0}))(kS||(kS={}));var gr;(e=>{function t(n){return n.textValue!==void 0}e.isTextValue=t;function i(n){return typeof n=="number"}e.isNumber=i;function r(n){return typeof n=="boolean"}e.isBoolean=r;function s(n){return t(n)?"string":r(n)?"boolean":"number"}e.typeOfVariable=s;function a(n){return e.isTextValue(n)?Array.isArray(n.textValue)?n.textValue.map(o=>o.toString().padStart(n.padding??2,"0")).join(n.deliminator??":")+(n.suffix!==void 0?" "+n.suffix:""):n.textValue.toString():e.isBoolean(n)?n?"True":"False":e.isNumber(n)?parseFloat(n.toFixed(3)).toString():n.toString()}e.getDisplayedValue=a})(gr||(gr={}));var W0;(e=>e.all=["images","videos","colors","audios","particles","fonts","materials","variables"])(W0||(W0={}));var US;(e=>e.all=[...W0.all,"components"])(US||(US={}));var NS;(e=>{function t(){return{images:new We,videos:new We,colors:new We,audios:new We,particles:new We,fonts:new We,materials:new We,components:new We,variables:new We,userAPIs:new We,userWebhooks:new We,timelineAnimations:new We}}e.defaultData=t})(NS||(NS={}));var mn;(e=>{function t(){return{images:new We,videos:new We,colors:new We,audios:new We,particles:new We,fonts:new We,materials:new We,components:new We,variables:new We,userAPIs:new We,userWebhooks:new We,timelineAnimations:new We}}e.defaultData=t})(mn||(mn={}));var ms;(e=>{function t(){let n={};return n["89b10010-844c-11ec-a8a3-0242ac120002"]={r:.5,g:.5,b:.5,a:1,name:"Default Color"},Kr(n,We.prototype)}e.defaultColors=t;function i(){return Kr({},We.prototype)}e.defaultImages=i;function r(){return{catelogs:new We,materials:new We,images:new We,videos:new We,colors:new We,timelineAnimations:new We,audios:new We,particles:new We,fonts:new We,variables:new Ue,userAPIs:new We,userWebhooks:new We,lib:mn.defaultData()}}e.emptyData=r;function s(n){switch(n){case"number":return{value:0,name:"Number"};case"boolean":return{value:!1,name:"Boolean"};case"string":return{value:{textValue:"String value"},name:"String"};case"time":let o=[0,0,0];return{name:"Time",value:{textValue:o,deliminator:":",padding:2,suffix:"AM"},dynamicVariableType:"time",format:"HH:mm:ss",format12h24h:"12ampm",timeZone:null,hasEnd:!1,endValue:{textValue:o,deliminator:":",padding:2,suffix:"AM"},autoStart:!0,repeat:!1};case"counter":return{name:"Counter",value:0,dynamicVariableType:"counter",updateInterval:1e3,increment:1,autoStart:!0,hasEnd:!0,endValue:60,repeat:!0,randomStart:!1,range:[0,100],decimals:0};case"random":return{name:"Random",value:0,dynamicVariableType:"random",updateInterval:1e3,increment:1,autoStart:!0,isStatic:!1,hasEnd:!0,endValue:60,repeat:!0,min:0,max:100,decimals:0};default:console.error("Unknown variable type",n)}}e.defaultVariables=s;function a(n,o){if(o.format==="HH:mm:ss"){let l=Math.floor(n/3600),h=Math.floor((n-l*3600)/60),c=Math.round(n-l*3600-h*60);return{textValue:[l,h,c]}}else if(o.format==="mm:ss"){let l=Math.floor(n/60),h=Math.round(n-l*60);return{textValue:[l,h]}}else return o.format==="number"?n=Math.round(n):n=Math.round(n*1e3)/1e3,n}e.getFormattedTimerTime=a})(ms||(ms={}));var Tf;(e=>e.list=["idle","move","jump","run"])(Tf||(Tf={}));var Pf;(e=>(e.defaultColliderData={type:"capsule",height:200,radius:50,position:[0,0,0],rotation:[0,0,0]},e.defaultDataThirdPerson={moveMode:"walk",forwardDirection:"+z",speedTranslate:1e3,speedRotate:100,runMultiplier:2,rotationMode:"normal",rotBy:"keys",rotByTouch:"drag",delayPos:[.3,.3],delayRot:[.3,.3],keyAssignments:[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","▲"],["rotPosY","◀"],["rotNegX","▼"],["rotNegY","▶"],["jump","Space"],["run","⇧"],["none","Ctrl"]],touchControl:!0,joystickPosLoc:5,joystickRotLoc:11,jumpTouchButtonLoc:9,collider:e.defaultColliderData,colliderHelperVisible:!0,collisionEnabled:!0,jumpPower:100,resetYPosition:3e3,alignToGround:!1,autoOrientMove:!0,orientWith:"camera",orientMode:"radial",delayPosCamera:.3,delayRotCamera:.3,camera:"",cameraXAxis:"Limit",cameraYAxis:"Free",cameraRotXLimits:[0,Math.PI/2],cameraRotYLimits:[-Math.PI/2,Math.PI/2],gameActions:{idle:new Ue,move:new Ue,jump:new Ue,run:new Ue},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Ut.fromHexAndA(3728051,1)}}))(Pf||(Pf={}));function VS(e){e.layers.forEach(t=>{if(t.type==="depth"&&t.colorA!==void 0){let i=t.colorA,r=t.colorB,s=[[i.r,i.g,i.b,i.a],[r.r,r.g,r.b,r.a]],a=[0,1];for(let o=2;o<10;o++)s.push(s[1]),a.push(1);let n={...xa(Ai(t),"type","visible","isVector","isWorldSpace","origin","alpha","mode"),near:Math.max(0,t.near),far:Math.max(0,t.far),colors:s,steps:a,num:2,direction:[1,0,0],smooth:!1,gradientType:1};Object.assign(t,n)}else if(t.type==="depth"&&t.gradientType===1&&(t.near<0||t.far<0)){let i={...Ai(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,i)}})}function jn(e,t){Object.values(e.shared.materials).forEach(i=>t(i))}function Hn(e,t){e.scene.objects.traverse((i,r)=>{"materials"in r?r.materials.forEach((s,a)=>{s===void 0&&(r.materials[a]=rr.defaultData(),s=r.materials[a]),typeof s!="string"&&t(s)}):"material"in r?typeof r.material!="string"&&(r.material===void 0&&(r.material=rr.defaultData()),t(r.material)):r.type==="Mesh"&&(r.material===void 0&&(r.material=rr.defaultData()),t(r.material)),"overrides"in r&&Object.values(r.overrides).forEach(s=>{s.material&&typeof s.material!="string"&&Object.getPrototypeOf(s.material)!==vi.prototype&&t(s.material)})})}function tG(e){Object.assign(e.scene.publish,{orbitControls:{...Cf.defaultData,...Ai(e.scene.publish.orbitControls)}})}function iG(e){Object.assign(e.scene.publish.settings,{video:{...on.defaultData.settings.video,...Ai(e.scene.publish.settings.video)}})}function rG(e){function t(i){if(i.layers){for(let r of Object.values(i.layers))if(r){for(let[s,a]of Object.entries(r))if((pC.includes(s)||typeof a=="boolean")&&delete r[s],s==="texture")for(let[n,o]of Object.entries(a))($H.includes(n)||typeof o=="boolean")&&delete a[n]}}}e.scene.objects.traverse((i,r)=>{r.states.forEach(s=>{let a=s;a.material?t(a.material):a.materials&&a.materials.forEach(n=>{t(n)})})})}function sG(e){e.scene.publish.withBackground=!0}function aG(e){e.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}function nG(e){e.scene.objects.traverse((t,i)=>{let r=i.cloner;r&&(r.radial.scale=r.radial.scale.map(s=>s+1),r.linear.scale=r.linear.scale.map(s=>s+1))})}function oG(e){e.scene.objects.traverse((t,i)=>{let r=i.geometry;r&&(r.type==="DodecahedronGeometry"||r.type==="IcosahedronGeometry")&&(r.detail=Math.round(r.detail))})}function lG(e){e.scene.objects.traverse((t,i)=>{let r=e.scene.objects.unproxy().parent(t);if(r){let s=Ai(e.scene.objects.data(r));s&&s.type==="Mesh"&&s.geometry.type==="BooleanGeometry"&&i.type==="Mesh"&&(i.visible=Ai(i).booleanExclude!==!0)}})}function hG(e){e.scene.objects.traverse((t,i)=>{if(i.type==="Mesh"){let r=i;i.geometry.type==="NonParametricGeometry"?r.material!==void 0&&delete r.material:r.materials!==void 0&&delete r.materials}})}function cG(e){function t(r){Object.setPrototypeOf(r,vi.prototype),r.texture&&Object.setPrototypeOf(r.texture,vi.prototype)}function i(r){Object.setPrototypeOf(r,vi.prototype);for(let s in r)t(r[s])}e.scene.objects.traverse((r,s)=>{s.states.forEach(a=>{let n=a;if(n.material){let o=Ai(n.material).layers;i(o),n.material.layers=o}if(n.materials)for(let o=0;o<n.materials.length;o++){let l=n.materials[o],h=Ai(l).layers;i(h),l.layers=h}})})}function jS(e){e.layers===void 0&&Object.assign(e,rr.defaultTwoLayerData("lambert"))}function Cg(e){!e.layers||e.layers.forEach(t=>{if(t.type==="depth"&&t.colors.length===10){let i=[...t.colors];i.push(t.colors[9]);let r=[...t.steps];r.push(t.steps[9]);let s={...Ai(t),colors:i,steps:r};Object.assign(t,s)}})}function uG(e){e.scene.objects.traverse((t,i)=>{i.type==="Mesh"&&(i.geometry.type==="BooleanGeometry"||i.geometry.type==="SubdivGeometry")&&(i.geometry.phongAngle=35)})}function HS(e){e.scene.objects.traverse((t,i)=>{"materials"in i?i.materials.forEach(r=>{typeof r!="string"&&Cg(r)}):"material"in i&&typeof i.material!="string"&&Cg(i.material)}),Object.values(e.shared.materials).forEach(t=>Cg(t))}function dG(e){e.scene.environment.ambientLight.softShadows=!1,e.scene.environment.ambientLight.softShadowQuality="low",e.scene.objects.traverse((t,i)=>{(i.type==="DirectionalLight"||i.type==="SpotLight")&&(i.shadowResolution=1024,i.shadowRadius=1,i.depth=1e5)}),e.shared.penumbraSize=new Array(5).fill(.5)}function pG(e){e.shared.audios=Kr({},We.prototype)}function fG(e){e.shared.videos=Kr({},We.prototype)}function mG(e){let t=e.shared.materials;Object.entries(t).forEach(([i,r])=>{if(!r.layers){let s={name:"Untitled Material",layers:[{fi:0,data:{type:"light",category:"phong",alpha:.6,visible:!0,mode:0,specular:{r:.2,g:.2,b:.2},shininess:5},id:"layer1"},{fi:1,data:{type:"color",alpha:1,visible:!0,mode:0,color:{r:.2823529411764706,g:.2823529411764706,b:.30196078431372547}},id:"layer2"}]};Object.assign(t,{[i]:s})}})}function gG(e){Object.entries(Ai(e.shared.images)).filter(t=>t[1].asset===!1).map(t=>t[0]).forEach(t=>{delete e.shared.images[t]}),Object.entries(Ai(e.shared.audios)).filter(t=>t[1].asset===!1).map(t=>t[0]).forEach(t=>{delete e.shared.audios[t]})}function vG(e){e.scene.publish.settings.web.preload=!1}function GS(e){e.layers&&e.layers.forEach(t=>{t.type==="depth"&&t.num!==void 0&&(t.colors=t.colors.slice(0,t.num),t.steps=t.steps.slice(0,t.num),delete t.num)})}function WS(e){e.layers&&e.layers.forEach(t=>{GH(t)&&t.isMask===void 0&&(t.isMask=!1),(t.type==="texture"||t.type==="video")&&t.blending===void 0&&(t.blending=0),(t.type==="noise"||t.type==="displace"&&t.displacementType==="noise")&&(t.voronoiStyle===void 0&&(t.voronoiStyle=0),t.highCut===void 0&&(t.highCut=1),t.lowCut===void 0&&(t.lowCut=0),t.smoothness===void 0&&(t.smoothness=.3),t.seed===void 0&&(t.seed=0),t.quality===void 0&&(t.quality=1))})}function yG(e){e.shared.fonts=Kr({},We.prototype)}function xG(e){return e.replace(".typeface","").replace(/optimer/gi,"open sans").replace("space_mono","space mono").replace(/alma_mono/gi,"varela round").replace(/droid_sans_mono/gi,"noto sans mono").replace(/droid_sans|gentilis|gnomon_(simple|foreground)|helvetiker/gi,"roboto").replace(/droid_serif/gi,"roboto slab").replace("_sans"," sans").replace("crimson_text","crimson text").replace("medium_medium","medium").replace("fatface_fatface","fatface").replace("100hairline","thin").replace("200thin","extralight").replace("300light","light").replace("500medium","medium").replace("600semi","semibold").replace("800heavy","extrabold").replace("900black","black").replace(/bodoni_(11|16|24|36|48|72|96)([^_])/gi,"bodoni_$1_$2").replace(/bodoni_(11|16|24|36|48|72|96)/gi,"bodoni moda").replace(/(thin|hairline)(_regular)?/gi,"100").replace(/(extra|ultra)light(_regular)?/gi,"200").replace(/light(_regular)?/gi,"300").replace(/_book|_normal|_roman/gi,"_regular").replace(/medium(_regular)?/gi,"500").replace(/(semi|demi)bold(_regular)?/gi,"600").replace(/(extra|ultra)bold(_regular)?/gi,"800").replace(/bold(_regular)?/gi,"700").replace(/(black|heavy|fatface)(_regular)?/gi,"900").replace(/([1-9]00)_italic/gi,"$1italic").replace(/regularitalic/gi,"italic").replace(/regularitalic/gi,"italic").split(" ").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function bG(e){let t=[];e.scene.objects.traverse((i,r)=>{let s=r;if(s.type==="TextFrame"){let a=rr.defaultTwoLayerData("phong"),n=typeof s.color=="string"?e.shared.colors[s.color]:s.color;a.layers[1].data.color={r:n.r,g:n.g,b:n.b},a.layers[1].data.alpha=s.alpha;let o=xG(s.font);e.shared.fonts[o]===void 0&&(e.shared.fonts[o]={name:o});let l={name:s.name,...Gi.defaultData,...Vn.defaultData,flatShading:!1,wireframe:!1,geometry:{...Nn.defaultData("TextGeometry"),width:s.width,height:s.height,font:o,depth:0,horizontalAlign:s.horizontalAlign,verticalAlign:s.verticalAlign,fontSize:s.fontSize*1.40625,lineHeight:s.lineHeight/1.40625,letterSpacing:s.letterSpacing-1,text:s.text,textTransform:s.textTransform,extrudeBevelSize:0,extrudeBevelSegments:1},material:a,states:Ai(s.states),events:Ai(s.events),visible:s.visible,raycastLock:s.raycastLock,position:s.position,rotation:s.rotation,scale:s.scale,hiddenMatrix:s.hiddenMatrix},h=Ai(e.scene.objects).parent(i);e.scene.objects.insertAfter(h??null,i,[{id:i+"new",data:l,children:[]}]),t.push(i)}}),t.forEach(i=>{e.scene.objects.delete(i)})}function wG(e){let t={0:"MouseDown",1:"MouseUp",2:"MouseHover",5:"KeyDown",6:"KeyUp",7:"Start",9:"LookAt",10:"Follow",11:"Scroll",12:"Audio",13:"GameControl"};e.scene.objects.traverse((i,r)=>{r.events.forEach(s=>{if(t[Number(s.type)])if(Object.assign(s,{type:t[Number(s.type)]}),s.type==="Audio"&&"audioEvent"in s&&(Object.assign(s,{playAudio:s.audioEvent}),delete s.audioEvent),s.type==="GameControl")Object.assign(s,{gameActions:{idle:new Ue,move:new Ue,jump:new Ue}});else{let a=new Ue;Object.assign(s,{actions:a}),(s.type==="MouseDown"||s.type==="MouseUp"||s.type==="KeyDown"||s.type==="KeyUp")&&"url"in s&&a.push({fi:0,id:Te.generateUUID(),data:{type:"Link",url:s.url,delay:0}}),"targets"in s&&(s.targets.forEach((n,o,l)=>{let h={state:void 0,repeat:0,delay:0,delayDirection:void 0,direction:"normal",duration:0,easing:4},c={easing:n.easing,duration:n.duration};n.easing===6?Object.assign(c,xa(n,"mass","stiffness","damping","velocity")):n.easing===5&&Object.assign(c,{control1:{...n.control1},control2:{...n.control2}});let u={repeat:n.repeat?-1:0,delay:n.delay,delayDirection:n.delayDirection,direction:n.cycle&&n.rewind?"pingpong-rewind":n.cycle?"pingpong":"normal"},d={state:n.state,...u,...c},p={allowSlerp:!0,type:"Transition",object:n.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new Ue({fi:0,id:Te.generateUUID(),data:h},{fi:1,id:Te.generateUUID(),data:d})};a.push({fi:l,id:o,data:p})}),delete s.targets)}})})}function SG(e){e.scene.objects.traverse((t,i)=>{function r(s,a){let n=new Ue,o=[];if(i.events.forEach((l,h,c)=>{if(l.type==="Audio"&&l.trigger===a){let u;o.push(h),l.interaction==="play"?u={...xa(l,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in l?l.after:void 0,toggle:"after"in l?l.toggle:void 0,type:"Audio"}:(l.interaction==="pause"||l.interaction==="stop")&&(u={...xa(l,"interaction","delay","object","playAudio"),type:"Audio"}),u&&n.push({fi:c,id:h,data:u})}}),o.forEach(l=>i.events.delete(l)),n.length){let l=i.events.find(h=>h.type===s)?.data;l?"actions"in l&&l.actions.insertBefore(null,n):i.events.insertBefore(null,[{id:Te.generateUUID(),data:{type:s,actions:n}}])}}r("Start","start"),r("MouseDown","mouseDown"),r("MouseUp","mouseUp"),r("KeyDown","keyDown"),r("KeyUp","keyUp")})}function qS(e){let t=e.layers.find(i=>i.type==="light")?.data;if(t?.category==="basic"){let i=_i.defaultData("light","phong"),r=t;Object.assign(r,i),r.visible=!1}}function XS(e){jn(e,qS),Hn(e,qS)}function _G(e){e.scene.objects.traverse((t,i)=>{i.type==="Mesh"&&i.geometry.type==="SubdivGeometry"&&(i.geometry.scaleBaked||(i.geometry.scaleBaked=[1,1,1]))})}function AG(e){e.scene.objects.traverse((t,i)=>{(i.type==="Empty"||i.type==="Mesh")&&i.cloner&&!i.cloner.randomnessObject&&!i.cloner.toObject&&!i.cloner.randomness&&(i.cloner={...i.cloner,toObject:{object:"",spreadType:"random",scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],axis:"x",seed:0,count:99,align:"normal"},randomness:!1,randomnessObject:{strength:100,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0],movement:1,seed:0,freqScale:10,noiseType:"perlin"}})})}function MG(e){e.scene.objects.traverse((t,i)=>{i.type==="Mesh"&&i.geometry.type==="NonParametricGeometry"&&!("material"in i)&&!("materials"in i)&&(i.material=rr.defaultTwoLayerData("phong"))})}function EG(e){e.scene.publish.orbitControls.autoZoom===void 0&&(e.scene.publish.orbitControls.autoZoom=!1),e.scene.objects.traverse((t,i)=>{(i.type==="OrthographicCamera"||i.type==="PerspectiveCamera")&&(i.orthographic.autoZoom===void 0&&(i.orthographic.autoZoom=!1),i.orthographic.autoZoomFrustumSize===void 0&&(i.orthographic.autoZoomFrustumSize=790))})}function CG(e){e.scene.objects.traverse((t,i)=>{i.pathSnapping===void 0&&(i.pathSnapping={pathId:null,slide:0,offset:0,orientation:"tangential"}),i.pathSnapping.offset===void 0&&(i.pathSnapping.offset=0)})}function TG(e){e.scene.publish.mouseEventTarget===void 0&&(e.scene.publish.mouseEventTarget="canvas"),e.scene.publish.settings.web.hint===void 0&&(e.scene.publish.settings.web.hint=!1)}function PG(e){let{video:t}=e.scene.publish.settings;t.format==="gif"&&t.fps>48&&(t.fps=15)}function DG(e){e.scene.objects.traverse((t,i)=>{i.events.forEach(r=>{r.type==="GameControl"&&(r.resetYPosition=Math.abs(r.resetYPosition-i.position[1]))})})}function OG(e){let t=e.scene.environment.usePhysics;e.scene.objects.traverse((i,r)=>{t&&r.physics===null?r.collision=!1:r.collision="visibility"})}function IG(e){e.scene.objects.traverse((t,i)=>{i.events.forEach(r=>{r.type==="GameControl"&&(r.navmesh=Pf.defaultDataThirdPerson.navmesh)})})}function RG(e){e.scene.styles||(e.scene.styles=Uo.defaultData())}function YS(e){e.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function LG(e){e.scene.environment.ambientLight.occlusion===void 0&&(e.scene.environment.ambientLight.occlusion=!1),e.scene.environment.ambientLight.aoFullRes===void 0&&(e.scene.environment.ambientLight.aoFullRes=!1),e.scene.environment.ambientLight.radius===void 0&&(e.scene.environment.ambientLight.radius=256),e.scene.environment.ambientLight.bias===void 0&&(e.scene.environment.ambientLight.bias=.5),e.scene.environment.ambientLight.aoColor===void 0&&(e.scene.environment.ambientLight.aoColor={r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}),Hn(e,YS),jn(e,YS)}function zG(e){e.scene.objects.traverse((t,i)=>{i.events.forEach(r=>{r.type==="GameControl"&&Object.assign(r.gameActions,{run:new Ue})})})}function BG(e){e.scene.objects.traverse((t,i)=>{i.events.forEach(r=>{r.type==="GameControl"&&(r.keyAssignments=[...r.keyAssignments,["run","⇧"],["none","Ctrl"]])})})}function QS(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}function FG(e,t){if(t<1&&(Hn(e,VS),jn(e,VS),e.schema=1),t<2&&(tG(e),e.schema=2),t<3&&(rG(e),e.schema=3),t<4&&(sG(e),e.schema=4),t<5&&(aG(e),e.schema=5),t<6&&(nG(e),e.schema=6),t<7&&(oG(e),e.schema=7),t<8&&(e.schema=8),t<9&&(HS(e),e.schema=9),t<10&&(uG(e),e.schema=10),t<11&&(dG(e),e.schema=11),t<12&&(HS(e),e.schema=12),t<13&&(pG(e),e.schema=13),t<14&&(mG(e),e.schema=14),t<15&&(gG(e),e.schema=15),t<16&&(vG(e),e.schema=16),t<17&&(Hn(e,GS),jn(e,GS),e.schema=17),t<18&&(Hn(e,jS),jn(e,jS),e.schema=18),t<19&&(iG(e),e.schema=19),t<20&&(yG(e),bG(e),e.schema=20),t<21&&(wG(e),SG(e),e.schema=21),t<22&&(XS(e),e.schema=22),t<23&&(_G(e),e.schema=23),t<24&&(AG(e),e.schema=24),(t<25||e.shared.videos===void 0)&&(fG(e),t<25&&(e.schema=25)),t<26&&(lG(e),e.schema=26),t<27&&(hG(e),e.schema=27),t<28&&(XS(e),e.schema=28),t<29&&(cG(e),e.schema=29),t<30&&(MG(e),e.schema=30),t<31&&(EG(e),e.schema=31),t<33&&(CG(e),e.schema=33),t<34&&(TG(e),e.schema=34),t<35&&(PG(e),e.schema=35),t<36&&(DG(e),e.schema=36),t<37&&(OG(e),e.schema=37),t<38&&(Hn(e,WS),jn(e,WS),e.schema=38),t<39&&(IG(e),e.schema=39),t<40&&(RG(e),e.schema=40),t<41&&(LG(e),e.schema=41),t<42&&(zG(e),e.schema=42),t<43&&(BG(e),e.schema=43),t<99){Hn(e,QS),jn(e,QS),e.scene.publish.playCamera===null&&(e.scene.publish.playCamera=Jh);let i=Ai(e.scene.objects),r=e.scene.objects;e.scene.publish.playPage=Jc,r.insertBefore(null,null,[{id:Jc,data:{...Rh.defaultData,backgroundColor:e.scene.backgroundColor,fog:e.scene.fog,postprocessing:e.scene.postprocessing,ao:xa(e.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:e.scene.publish.playCamera,gameControlObject:e.scene.publish.gameControlObject},shadow:xa(e.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...Oh.defaultData,...xa(e.scene.environment,"usePhysics","gravity")},camera:Ai(e.scene.ownerCamera)??Rh.defaultData.camera,name:"Scene"},children:[]}]);for(let n of i)n.id!==No.TRASH_CAN_ID&&r.move(Jc,n.fi,n.id);let s=0,a=0;e.shared.penumbraSize&&e.scene.objects.traverse((n,o)=>{o.type==="DirectionalLight"?(o.penumbraSize=e.shared.penumbraSize[Math.min(s,2)],s+=1):o.type==="SpotLight"&&(o.penumbraSize=e.shared.penumbraSize[3+Math.min(a,1)],a+=1),(o.physics===void 0||o.physics===null)&&o.type!=="Instance"&&(o.physics={},Object.assign(o.physics,Dh.defaultData)),o.physics!==void 0&&o.physics!==null&&(o.physics.enabled=o.collision??"visibility",delete o.collision)}),e.schema=99}}function KS(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function kG(e){e.scene.objects.traverse((t,i)=>{let r=i.geometry;r&&r.type==="PathGeometry"&&(r.extrusion.capType="flat",r.extrusion.bevel=50,r.extrusion.bevelSides=6,r.extrusion.shape.type==="Custom"&&(r.extrusion.shape.shapeQuality="low"))})}function UG(e){Array.isArray(Ai(e.events))&&e.events?.forEach(t=>{"disabled"in t||(t.disabled=!1),(t.type==="MouseDown"||t.type==="MouseUp"||t.type==="MousePress")&&(t.mode=t.mode||"Object")})}var Kl=180/Math.PI;function ZS(e){e.rotation=e.rotation.slice(0,3).map(t=>t*Kl)}function mC(e){ZS(e),e.type==="Page"&&ZS(e.camera),e.states?.forEach(i=>{i.rotation===void 0||i.rotation===null||(i.rotation=i.rotation.slice(0,3).map(r=>r*Kl))});let t=e.geometry;t&&t.type==="SphereGeometry"&&(t.thetaLength=(t.thetaLength??180)*Kl),t&&t.type==="TorusGeometry"&&(t.arc=t.arc*Kl),t&&t.type==="PathGeometry"&&(t.extrusion.angle*=Kl,t.extrusion.twist*=Kl),e.type==="Mesh"&&e.geometry.type==="TextGeometry"&&(e.geometry.text={textValue:e.geometry.text}),Array.isArray(Ai(e.events))&&e.events?.forEach(i=>{(i.type==="MouseDown"||i.type==="MouseUp"||i.type==="MousePress"||i.type==="KeyDown"||i.type==="KeyUp"||i.type==="KeyPress"||i.type==="Collision"||i.type==="Trigger")&&(i.runMode=i.toggle?"Toggle":"Repeat")})}function NG(e){e.shared.variables=Kr({},We.prototype)}function VG(e){let t=Ai(e.shared.variables);e.shared.variables=Kr(Object.entries(t??{}).map(([i,r],s)=>({fi:s,id:i,data:r})),Ue.prototype)}var Qa=122;function Rp(e,t){t(e.data);for(let i of e.children)Rp(i,t)}function jG(e){let t=e.schema??104;t!==Qa&&(t<105&&(Rp(e.asset,mC),e.schema=105),t<118&&(Rp(e.asset,gC),e.schema=118),t<121&&(Rp(e.asset,q0),e.schema=121))}function HG(e){e.shared.particles=Kr({},We.prototype),e.shared.lib&&(e.shared.lib.particles=mn.defaultData().particles)}function GG(e){e.scene.objects.traverse((t,i)=>{i.type==="Particle"&&typeof i.renderMaterial.size=="number"&&Object.assign(i.renderMaterial,{size:[i.renderMaterial.size,i.renderMaterial.size]})})}function WG(e){e.scene.objects.traverse((t,i)=>{i.type==="Page"&&(i.postprocessing.depthOfField.focusDistance=100,i.postprocessing.depthOfField.focalLength=20,i.postprocessing.depthOfField.bokehScale=5)})}function qG(e){e.scene.objects.traverse((t,i)=>{Array.isArray(Ai(i.events))!==!1&&i.events?.forEach(r=>{let s=r.runMode;r.type==="MouseDown"||r.type==="MouseUp"||r.type==="KeyDown"||r.type==="KeyUp"||r.type==="Collision"||r.type==="Trigger"?r.actions?.forEach(a=>{a.type==="Transition"&&(a.runMode=s??"Repeat"),(a.type==="Animation"||a.type==="SwitchCamera")&&(a.runMode=s==="Toggle"?"Toggle":"Normal")}):r.type==="MouseHover"||r.type==="MousePress"||r.type==="KeyPress"?r.actions?.forEach(a=>{(a.type==="Transition"||a.type==="Animation"||a.type==="SwitchCamera")&&(a.runMode="Toggle")}):r.type==="GameControl"?(delete r.actions,Object.keys(r.gameActions).forEach(a=>{r.gameActions[a]?.forEach(n=>{n.type==="Transition"&&(n.runMode="Repeat"),n.type==="Animation"&&(n.runMode="Normal")})})):r.type==="DragDrop"?(delete r.actions,r.dragDropActions?.drag?.forEach(a=>{(a.type==="Transition"||a.type==="Animation"||a.type==="SwitchCamera")&&(a.runMode="Toggle")}),r.dragDropActions?.drop?.forEach(a=>{(a.type==="Transition"||a.type==="Animation"||a.type==="SwitchCamera")&&(a.runMode="Toggle")})):r.type==="Resize"?(delete r.actions,r.breakpoints?.forEach(a=>{a.actions?.forEach(n=>{(n.type==="Transition"||n.type==="Animation"||n.type==="SwitchCamera")&&(n.runMode="Toggle")})})):r.type==="Start"?r.actions?.forEach(a=>{a.type==="Transition"&&(a.runMode="Once"),(a.type==="Animation"||a.type==="SwitchCamera")&&(a.runMode="Normal")}):r.type==="VariableChange"||r.type==="Scroll"?r.actions?.forEach(a=>{a.type==="Transition"&&(a.runMode="Repeat"),(a.type==="Animation"||a.type==="SwitchCamera")&&(a.runMode="Normal")}):r.type==="Conditional"&&(delete r.actions,r.inActions?.forEach(a=>{a.type==="Transition"&&(a.runMode="Repeat"),(a.type==="Animation"||a.type==="SwitchCamera")&&(a.runMode="Normal")}),r.outActions?.forEach(a=>{a.type==="Transition"&&(a.runMode="Repeat"),(a.type==="Animation"||a.type==="SwitchCamera")&&(a.runMode="Normal")}))})})}function XG(e){e.shared.userAPIs=Kr({},We.prototype),e.shared.userWebhooks=Kr({},We.prototype),e.shared.lib&&(e.shared.lib.userAPIs=mn.defaultData().userAPIs,e.shared.lib.userWebhooks=mn.defaultData().userWebhooks)}function YG(e){e.scene.publish.settings.videoStatic===void 0&&(e.scene.publish.settings.videoStatic=on.defaultData.settings.videoStatic)}function gC(e){e.timelineAnimations=Kr({},We.prototype)}function q0(e){e.pivot=[0,0,0],e.pivotRotation=[0,0,0]}function vC(e){let t=e.schema??0;if(t!==Qa){console.warn("updating from ",t,"to ",Qa),FG(e,t),t<100&&(e.scene.publish.joystickSizeAndXYOffset===void 0&&(e.scene.publish.joystickSizeAndXYOffset=on.defaultData.joystickSizeAndXYOffset),e.schema=100),t<101&&(Hn(e,KS),jn(e,KS),e.schema=101),t<102&&(kG(e),e.schema=102),t<104&&(e.shared.catelogs=new We,e.shared.lib=mn.defaultData(),e.schema=104),t<105&&(NG(e),e.scene.objects.traverse((i,r)=>{mC(r)}),e.schema=105);for(let i of Object.values(e.shared.lib.components))jG(i);t<106&&(VG(e),e.schema=106),t<107&&(e.shared.lib.variables=mn.defaultData().variables,e.schema=107),t<109&&(HG(e),e.schema=109),t<110&&(GG(e),e.schema=110),t<111&&(e.scene.objects.traverse((i,r)=>{UG(r)}),e.schema=111),t<112&&(WG(e),e.schema=112),t<113&&(qG(e),e.schema=113),t<114&&(e.scene.publish.settings.web.imageQuality===void 0&&(e.scene.publish.settings.web.imageQuality=70),e.schema=114),t<115&&(XG(e),e.schema=115),t<116&&(YG(e),e.schema=116),t<117&&(e.scene.publish.settings.web.pixelRatioMobile===void 0&&(e.scene.publish.settings.web.pixelRatioMobile=0),e.scene.publish.settings.web.pixelRatioDesktop===void 0&&(e.scene.publish.settings.web.pixelRatioDesktop=0),e.schema=117),t<118&&(e.shared.timelineAnimations=Kr({},We.prototype),e.scene.objects.traverse((i,r)=>{gC(r)}),e.schema=118),t<119&&(e.scene.publish.settings.videoStatic.format=Qo.defaultData.scene.publish.settings.videoStatic.format,e.scene.publish.settings.videoStatic.imageFormat=Qo.defaultData.scene.publish.settings.videoStatic.imageFormat,e.schema=119),t<120&&(e.scene.publish.settings.image.colorSpace="display-p3",e.scene.publish.settings.videoStatic.colorSpace="display-p3",e.schema=120),t<121&&(e.scene.objects.traverse((i,r)=>{q0(r),r.type==="Page"&&q0(r.camera)}),e.schema=121),t<122&&(delete e.scene.publish.settings.video,e.scene.publish.orbitControls.rotationSpeed=Qo.defaultData.scene.publish.orbitControls.rotationSpeed,e.schema=122)}}var Qo;(e=>{e.defaultData={schema:Qa,scene:No.defaultData,frames:new We().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",$c.defaultData),shared:{...ms.emptyData(),colors:ms.defaultColors()}},e.emptyDataForImports=function(){let a=No.emptyDataWithPage();return{schema:Qa,scene:a,frames:new We().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",$c.defaultData),shared:{...ms.emptyData(),colors:ms.defaultColors(),images:ms.defaultImages()}}},e.emptyData=function(){return{schema:Qa,scene:No.emptyDataWithPage(),frames:new We().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",$c.defaultData),shared:ms.emptyData()}},e.clipboard2dData=function(){return{schema:Qa,scene:No.emptyData(),frames:new We,shared:ms.emptyData()}},e.collabHelper={...d0,updateSchema(a){return(a.schema??0)<Qa?_u(a,vC):(a.schema??0)-Qa}};function t(a){let n=e.collabHelper.updateSchema(a);return typeof n=="number"?n===0?a:null:n.data}e.updateSchemaDirectly=t;function i(a){return{...a,shared:{...a.shared,lib:mn.defaultData()}}}e.withoutLib=i;function r(a,n){let o=a.scene.objects.get(n);if(o&&o.data.type==="Component")return o;{let l=a.shared.lib.components[n];if(l)return{...l.asset,id:n}}}e.getComponentData=r;function s(a){let n=Object.values(a.shared.userAPIs);for(let o of n){let l=o.headers;for(let h of l)if(h.data.key.toLowerCase()==="authorization"&&h.data.value!=="")return!0}return!1}e.hasSensitiveData=s})(Qo||(Qo={}));var X0;(e=>e.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"})(X0||(X0={}));var JS;(e=>{function t(i){return!0}e.is=t})(JS||(JS={}));var Df;(e=>{e.defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]};function t(r,s){return{position:s?.position??r.position,rotation:s?.rotation??r.rotation,scale:s?.scale??r.scale,shear:s?.shear??r.shear}}e.merge=t;function i(r,s){return FE({position:ma.isEqual(r.position,s.position)?void 0:s.position,rotation:r.rotation===s.rotation?void 0:s.rotation,scale:ma.isEqual(r.scale,s.scale)?void 0:s.scale,shear:r.shear&&s.shear&&ma.isEqual(r.shear,s.shear)?void 0:s.shear})}e.diff=i})(Df||(Df={}));var Y0;(e=>e.defaultData={horizontalConstraint:0,verticalConstraint:0})(Y0||(Y0={}));var $S;(e=>e.defaultData={direction:"row",wrap:"unwrap",align:"top-left",gap:10,rowGap:10,autoGap:!1,autoRowGap:!1,leftPadding:8,rightPadding:8,topPadding:8,bottomPadding:8})($S||($S={}));var Of;(e=>e.defaultData={opacity:1,fill:{color:Ut.fromHexAndA(ss,1),enabled:!0},stroke:{color:Ut.from0to1([0,0,0,1]),thickness:1,enabled:!1,mode:"inside"},layerBlur:{radius:2,enabled:!1},backgroundBlur:{radius:2,enabled:!1},dropShadow:{offset:[10,10],blurRadius:10,color:Ut.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Ut.from0to1([0,0,0,1]),enabled:!1,spread:0}})(Of||(Of={}));var Vo;(e=>{function t(n,o){return{name:o}}e.newEmpty=t;function i(n,o){if(o===void 0)return n;let l={...n},h=["width","height","cornerRadius"];for(let c of h)c in l&&c in o&&o[c]!==void 0&&Object.assign(l,{[c]:o[c]});return l}function r(n,o){if(o===void 0)return n;let l={...n};return"fill"in l&&"fill"in o&&o.fill!==void 0&&Object.assign(l,{fill:{...l.fill,...o.fill}}),"stroke"in l&&"stroke"in o&&o.stroke!==void 0&&Object.assign(l,{stroke:{...l.stroke,...o.stroke}}),"layerBlur"in l&&"layerBlur"in o&&o.layerBlur!==void 0&&Object.assign(l,{layerBlur:{...l.layerBlur,...o.layerBlur}}),"backgroundBlur"in l&&"backgroundBlur"in o&&o.backgroundBlur!==void 0&&Object.assign(l,{backgroundBlur:{...l.backgroundBlur,...o.backgroundBlur}}),"dropShadow"in l&&"dropShadow"in o&&o.dropShadow!==void 0&&Object.assign(l,{dropShadow:{...l.dropShadow,...o.dropShadow}}),"innerShadow"in l&&"innerShadow"in o&&o.innerShadow!==void 0&&Object.assign(l,{innerShadow:{...l.innerShadow,...o.innerShadow}}),l}function s(n,o){if(o===void 0)return n;let l={...n};return Object.assign(l,Df.merge(l,o)),l=i(l,o),l=r(l,o),l}e.patch=s;function a(n,o){let l,h=[];for(let[c,u]of Object.entries(o))c!=="name"&&(l===void 0&&(l={path:[],props:{},type:0},h.push(l)),l.props[c]=u);return h}e.toOps=a})(Vo||(Vo={}));var Cu;(e=>e.defaultData={...Df.defaultData,...Y0.defaultData,states:new Ue,events:new Ue,visible:!0,raycastLock:!1})(Cu||(Cu={}));var Lh;(e=>e.defaultData={...Cu.defaultData,...Of.defaultData})(Lh||(Lh={}));var If;(e=>e.defaultData={cornerRadius:[0,0,0,0]})(If||(If={}));var Q0;(e=>e.defaultData={...Lh.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"})(Q0||(Q0={}));var Tu;(e=>e.defaultData={...Lh.defaultData,...If.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"})(Tu||(Tu={}));var K0;(e=>e.defaultData={...Lh.defaultData,type:"text2d",width:100,height:100,fontSize:12,lineHeight:1.2,letterSpacing:0,text:{textValue:"Hello world"},horizontalAlign:1,verticalAlign:1,textTransform:1,font:"Roboto_regular",name:"Text"})(K0||(K0={}));var Z0;(e=>e.defaultData={...Lh.defaultData,type:"path2d",path:"",name:"Path"})(Z0||(Z0={}));var e_;(e=>{function t(i){return i.type==="ellipse2d"||i.type==="rectangle2d"||i.type==="text2d"||i.type==="vector2d"||i.type==="path2d"}e.is=t})(e_||(e_={}));var Rf;(e=>e.defaultData={...Cu.defaultData,name:"Group",type:"group2d"})(Rf||(Rf={}));var J0;(e=>e.defaultData=()=>({...Cu.defaultData,...If.defaultData,...Of.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Ut.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Ut.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}))(J0||(J0={}));var Ko;(e=>{function t(n){switch(n){case"rectangle2d":return{...Tu.defaultData};case"ellipse2d":return{...Q0.defaultData};case"text2d":return{...K0.defaultData};case"vector2d":return{...Tu.defaultData};case"path2d":return{...Z0.defaultData};case"frame2d":return{...J0.defaultData()};case"group2d":return{...Rf.defaultData}}}e.defaultData=t;function i(n){return"width"in n&&"height"in n?[typeof n.width=="number"?n.width*.5:0,typeof n.height=="number"?n.height*.5:0]:[0,0]}e.getPivot=i;function r(n){return n.type==="rectangle2d"||n.type==="ellipse2d"||n.type==="text2d"||n.type==="frame2d"}e.isResizeable=r;function s(n){return n.type==="frame2d"&&n.autoLayout!==void 0}e.isAutoLayoutable=s;function a(n){return n.type==="rectangle2d"||n.type==="frame2d"}e.hasCorners=a})(Ko||(Ko={}));var $0;(e=>(e.defaultData={name:"UI",type:"scene2d",objects:new mr},e.emptyData=function(){return{type:"scene2d",objects:new mr}}))($0||($0={}));function jo(e,t=!1){let i=e[0].index!==null,r=new Set(Object.keys(e[0].attributes)),s=new Set(Object.keys(e[0].morphAttributes)),a={},n={},o=e[0].morphTargetsRelative,l=new He,h=0;for(let c=0;c<e.length;++c){let u=e[c],d=0;if(i!==(u.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+c+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let p in u.attributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+c+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;
3139a[p]===void 0&&(a[p]=[]),a[p].push(u.attributes[p]),d++}if(d!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+c+". Make sure all geometries have the same number of attributes."),null;if(o!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+c+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in u.morphAttributes){if(!s.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+c+". .morphAttributes must be consistent throughout all geometries."),null;n[p]===void 0&&(n[p]=[]),n[p].push(u.morphAttributes[p])}if(t){let p;if(i)p=u.index.count;else if(u.attributes.position!==void 0)p=u.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+c+". The geometry must have either an index or a position attribute"),null;l.addGroup(h,p,c),h+=p}}if(i){let c=0,u=[];for(let d=0;d<e.length;++d){let p=e[d].index;for(let f=0;f<p.count;++f)u.push(p.getX(f)+c);c+=e[d].attributes.position.count}l.setIndex(u)}for(let c in a){let u=t_(a[c]);if(!u)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+c+" attribute."),null;l.setAttribute(c,u)}for(let c in n){let u=n[c][0].length;if(u===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[c]=[];for(let d=0;d<u;++d){let p=[];for(let m=0;m<n[c].length;++m)p.push(n[c][m][d]);let f=t_(p);if(!f)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+c+" morphAttribute."),null;l.morphAttributes[c].push(f)}}return l}function t_(e){let t,i,r,s=0;for(let o=0;o<e.length;++o){let l=e[o];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(t===void 0&&(t=l.array.constructor),t!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(i===void 0&&(i=l.itemSize),i!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(r===void 0&&(r=l.normalized),r!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;s+=l.array.length}let a=new t(s),n=0;for(let o=0;o<e.length;++o)a.set(e[o].array,n),n+=e[o].array.length;return new tt(a,i,r)}var yC={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,timelineChangeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0,rewind:!0},W1={duration:1e3,delay:0,endDelay:0,startOnceDelay:0,pingPongDelayCorrection:0,pingPongEndDelayCorrection:0,easing:"easeOutElastic(1, .5)",round:0},QG=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],zh={CSS:{},springs:{}};function ks(e,t,i){return Math.min(Math.max(e,t),i)}function eu(e,t){return e.indexOf(t)>-1}function Tg(e,t){return e.apply(null,t)}var ct={arr:function(e){return Array.isArray(e)},obj:function(e){return eu(Object.prototype.toString.call(e),"Object")},pth:function(e){return ct.obj(e)&&e.hasOwnProperty("totalLength")},svg:function(e){return e instanceof SVGElement},inp:function(e){return e instanceof HTMLInputElement},dom:function(e){return!("isNode"in e)&&(e.nodeType||ct.svg(e))},str:function(e){return typeof e=="string"},fnc:function(e){return typeof e=="function"},und:function(e){return typeof e>"u"},hex:function(e){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e)},rgb:function(e){return/^rgb/.test(e)},hsl:function(e){return/^hsl/.test(e)},col:function(e){return ct.hex(e)||ct.rgb(e)||ct.hsl(e)},key:function(e){return!yC.hasOwnProperty(e)&&!W1.hasOwnProperty(e)&&e!=="targets"&&e!=="keyframes"}};function xC(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map(function(i){return parseFloat(i)}):[]}function bC(e,t){var i=xC(e),r=ks(ct.und(i[0])?1:i[0],.1,100),s=ks(ct.und(i[1])?100:i[1],.1,100),a=ks(ct.und(i[2])?10:i[2],.1,100),n=ks(ct.und(i[3])?0:i[3],.1,100),o=Math.sqrt(s/r),l=a/(2*Math.sqrt(s*r)),h=l<1?o*Math.sqrt(1-l*l):0,c=1,u=l<1?(l*o+-n)/h:-n+o;function d(f){var m=t?t*f/1e3:f;return l<1?m=Math.exp(-m*l*o)*(c*Math.cos(h*m)+u*Math.sin(h*m)):m=(c+u*m)*Math.exp(-m*o),f===0||f===1?f:1-m}function p(){var f=zh.springs[e];if(f)return f;for(var m=1/6,g=0,v=0;;)if(g+=m,d(g)===1){if(v++,v>=16)break}else v=0;var y=g*m*1e3;return zh.springs[e]=y,y}return t?d:p}function KG(e){return e===void 0&&(e=10),function(t){return Math.ceil(ks(t,1e-6,1)*e)*(1/e)}}var ZG=(function(){var e=11,t=1/(e-1);function i(c,u){return 1-3*u+3*c}function r(c,u){return 3*u-6*c}function s(c){return 3*c}function a(c,u,d){return((i(u,d)*c+r(u,d))*c+s(u))*c}function n(c,u,d){return 3*i(u,d)*c*c+2*r(u,d)*c+s(u)}function o(c,u,d,p,f){var m,g,v=0;do g=u+(d-u)/2,m=a(g,p,f)-c,m>0?d=g:u=g;
vendor: 8,998 bytes, line 3139
3139while(Math.abs(m)>1e-7&&++v<10);return g}function l(c,u,d,p){for(var f=0;f<4;++f){var m=n(u,d,p);if(m===0)return u;var g=a(u,d,p)-c;u-=g/m}return u}function h(c,u,d,p){if(!(0<=c&&c<=1&&0<=d&&d<=1))return;var f=new Float32Array(e);if(c!==u||d!==p)for(var m=0;m<e;++m)f[m]=a(m*t,c,d);function g(v){for(var y=0,x=1,w=e-1;x!==w&&f[x]<=v;++x)y+=t;--x;var S=(v-f[x])/(f[x+1]-f[x]),b=y+S*t,E=n(b,c,d);return E>=.001?l(v,b,c,d):E===0?b:o(v,y,y+t,c,d)}return function(v){return c===u&&d===p||v===0||v===1?v:a(g(v),u,p)}}return h})(),wC=(function(){var e={linear:function(){return function(r){return r}}},t={Sine:function(){return function(r){return 1-Math.cos(r*Math.PI/2)}},Circ:function(){return function(r){return 1-Math.sqrt(1-r*r)}},Back:function(){return function(r){return r*r*(3*r-2)}},Bounce:function(){return function(r){for(var s,a=4;r<((s=Math.pow(2,--a))-1)/11;);return 1/Math.pow(4,3-a)-7.5625*Math.pow((s*3-2)/22-r,2)}},Elastic:function(r,s){r===void 0&&(r=1),s===void 0&&(s=.5);var a=ks(r,1,10),n=ks(s,.1,2);return function(o){return o===0||o===1?o:-a*Math.pow(2,10*(o-1))*Math.sin((o-1-n/(Math.PI*2)*Math.asin(1/a))*(Math.PI*2)/n)}}},i=["Quad","Cubic","Quart","Quint","Expo"];return i.forEach(function(r,s){t[r]=function(){return function(a){return Math.pow(a,s+2)}}}),Object.keys(t).forEach(function(r){var s=t[r];e["easeIn"+r]=s,e["easeOut"+r]=function(a,n){return function(o){return 1-s(a,n)(1-o)}},e["easeInOut"+r]=function(a,n){return function(o){return o<.5?s(a,n)(o*2)/2:1-s(a,n)(o*-2+2)/2}}}),e})();function q1(e,t){if(ct.fnc(e))return e;var i=e.split("(")[0],r=wC[i],s=xC(e);switch(i){case"spring":return bC(e,t);case"cubicBezier":return Tg(ZG,s);case"steps":return Tg(KG,s);default:return Tg(r,s)}}function SC(e){try{var t=document.querySelectorAll(e);return t}catch{return}}function gm(e,t){for(var i=e.length,r=arguments.length>=2?arguments[1]:void 0,s=[],a=0;a<i;a++)if(a in e){var n=e[a];t.call(r,n,a,e)&&s.push(n)}return s}function vm(e){return e.reduce(function(t,i){return t.concat(ct.arr(i)?vm(i):i)},[])}function i_(e){return ct.arr(e)?e:(ct.str(e)&&(e=SC(e)||e),e instanceof NodeList||e instanceof HTMLCollection?[].slice.call(e):[e])}function X1(e,t){return e.some(function(i){return i===t})}function Y1(e){var t={};for(var i in e)t[i]=e[i];return t}function ey(e,t){var i=Y1(e);for(var r in e)i[r]=t.hasOwnProperty(r)?t[r]:e[r];return i}function ym(e,t){var i=Y1(e);for(var r in t)i[r]=ct.und(e[r])?t[r]:e[r];return i}function JG(e){var t=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(e);return t?"rgba("+t[1]+",1)":e}function $G(e){var t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,i=e.replace(t,function(o,l,h,c){return l+l+h+h+c+c}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i),s=parseInt(r[1],16),a=parseInt(r[2],16),n=parseInt(r[3],16);return"rgba("+s+","+a+","+n+",1)"}function eW(e){var t=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(e),i=parseInt(t[1],10)/360,r=parseInt(t[2],10)/100,s=parseInt(t[3],10)/100,a=t[4]||1;function n(d,p,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?d+(p-d)*6*f:f<1/2?p:f<2/3?d+(p-d)*(2/3-f)*6:d}var o,l,h;if(r==0)o=l=h=s;else{var c=s<.5?s*(1+r):s+r-s*r,u=2*s-c;o=n(u,c,i+1/3),l=n(u,c,i),h=n(u,c,i-1/3)}return"rgba("+o*255+","+l*255+","+h*255+","+a+")"}function tW(e){if(ct.rgb(e))return JG(e);if(ct.hex(e))return $G(e);if(ct.hsl(e))return eW(e)}function cn(e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(e);if(t)return t[1]}function iW(e){if(eu(e,"translate")||e==="perspective")return"px";if(eu(e,"rotate")||eu(e,"skew"))return"deg"}function ty(e,t){return ct.fnc(e)?e(t.target,t.id,t.total):e}function ga(e,t){return e.getAttribute(t)}function Q1(e,t,i){var r=cn(t);if(X1([i,"deg","rad","turn"],r))return t;var s=zh.CSS[t+i];if(!ct.und(s))return s;var a=100,n=document.createElement(e.tagName),o=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;o.appendChild(n),n.style.position="absolute",n.style.width=a+i;var l=a/n.offsetWidth;o.removeChild(n);var h=l*parseFloat(t);return zh.CSS[t+i]=h,h}function _C(e,t,i){if(t in e.style){var r=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),s=e.style[t]||getComputedStyle(e).getPropertyValue(r)||"0";return i?Q1(e,s,i):s}}function K1(e,t){if(ct.dom(e)&&!ct.inp(e)&&(ga(e,t)||ct.svg(e)&&e[t]))return"attribute";if(ct.dom(e)&&X1(QG,t))return"transform";if(ct.dom(e)&&t!=="transform"&&_C(e,t))return"css";if(e[t]!=null)return"object"}function AC(e){if(ct.dom(e)){for(var t=e.style.transform||"",i=/(\w+)\(([^)]*)\)/g,r=new Map,s;s=i.exec(t);)r.set(s[1],s[2]);return r}}function rW(e,t,i,r){var s=eu(t,"scale")?1:0+iW(t),a=AC(e).get(t)||s;return i&&(i.transforms.list.set(t,a),i.transforms.last=t),r?Q1(e,a,r):a}function Z1(e,t,i,r){switch(K1(e,t)){case"transform":return rW(e,t,r,i);case"css":return _C(e,t,i);case"attribute":return ga(e,t);default:return e[t]||0}}function J1(e,t){var i=/^(\*=|\+=|-=)/.exec(e);if(!i)return e;var r=cn(e)||0,s=parseFloat(t),a=parseFloat(e.replace(i[0],""));switch(i[0][0]){case"+":return s+a+r;case"-":return s-a+r;case"*":return s*a+r}}function MC(e,t){if(ct.col(e))return tW(e);if(/\s/g.test(e))return e;var i=cn(e),r=i?e.substr(0,e.length-i.length):e;return t?r+t:r}function $1(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function sW(e){return Math.PI*2*ga(e,"r")}function aW(e){return ga(e,"width")*2+ga(e,"height")*2}function nW(e){return $1({x:ga(e,"x1"),y:ga(e,"y1")},{x:ga(e,"x2"),y:ga(e,"y2")})}function EC(e){for(var t=e.points,i=0,r,s=0;s<t.numberOfItems;s++){var a=t.getItem(s);s>0&&(i+=$1(r,a)),r=a}return i}function oW(e){var t=e.points;return EC(e)+$1(t.getItem(t.numberOfItems-1),t.getItem(0))}function CC(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return sW(e);case"rect":return aW(e);case"line":return nW(e);case"polyline":return EC(e);case"polygon":return oW(e)}}function lW(e){var t=CC(e);return e.setAttribute("stroke-dasharray",t),t}function hW(e){for(var t=e.parentNode;ct.svg(t)&&ct.svg(t.parentNode);)t=t.parentNode;return t}function TC(e,t){var i=t||{},r=i.el||hW(e),s=r.getBoundingClientRect(),a=ga(r,"viewBox"),n=s.width,o=s.height,l=i.viewBox||(a?a.split(" "):[0,0,n,o]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:n/l[2],h:o/l[3]}}function cW(e,t){var i=ct.str(e)?SC(e)[0]:e,r=t||100;return function(s){return{property:s,el:i,svg:TC(i),totalLength:CC(i)*(r/100)}}}function uW(e,t){function i(o){o===void 0&&(o=0);var l=t+o>=1?t+o:0;return e.el.getPointAtLength(l)}var r=TC(e.el,e.svg),s=i(),a=i(-1),n=i(1);switch(e.property){case"x":return(s.x-r.x)*r.w;case"y":return(s.y-r.y)*r.h;case"angle":return Math.atan2(n.y-a.y,n.x-a.x)*180/Math.PI}}function r_(e,t){var i=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=MC(ct.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(i)?r.match(i).map(Number):[0],strings:ct.str(e)||t?r.split(i):[]}}function PC(e){var t=e?vm(ct.arr(e)?e.map(i_):i_(e)):[];return gm(t,function(i,r,s){return s.indexOf(i)===r})}function DC(e){var t=PC(e);return t.map(function(i,r){return{target:i,id:r,total:t.length,transforms:{list:AC(i)}}})}function dW(e,t){var i=Y1(t);if(/^spring/.test(i.easing)&&(i.duration=bC(i.easing)),ct.arr(e)){var r=e.length,s=r===2&&!ct.obj(e[0]);s?e={value:e}:ct.fnc(t.duration)||(i.duration=t.duration/r)}var a=ct.arr(e)?e:[e];return a.map(function(n,o){var l=ct.obj(n)&&!ct.pth(n)?n:{value:n};return ct.und(l.delay)&&(l.delay=o?0:t.delay),ct.und(l.endDelay)&&(l.endDelay=o===a.length-1?t.endDelay:0),l}).map(function(n){return ym(n,i)})}function pW(e){for(var t=gm(vm(e.map(function(a){return Object.keys(a)})),function(a){return ct.key(a)}).reduce(function(a,n){return a.indexOf(n)<0&&a.push(n),a},[]),i={},r=function(a){var n=t[a];i[n]=e.map(function(o){var l={};for(var h in o)ct.key(h)?h==n&&(l.value=o[h]):l[h]=o[h];return l})},s=0;s<t.length;s++)r(s);return i}function fW(e,t){var i=[],r=t.keyframes;r&&(t=ym(pW(r),t));for(var s in t)ct.key(s)&&i.push({name:s,tweens:dW(t[s],e)});return i}function mW(e,t){var i={};for(var r in e){var s=ty(e[r],t);ct.arr(s)&&(s=s.map(function(a){return ty(a,t)}),s.length===1&&(s=s[0])),i[r]=s}return i.duration=parseFloat(i.duration),i.delay=parseFloat(i.delay),i}function gW(e,t){var i;return e.tweens.map(function(r){var s=mW(r,t),a=s.value,n=ct.arr(a)?a[1]:a,o=cn(n),l=Z1(t.target,e.name,o,t),h=i?i.to.original:l,c=ct.arr(a)?a[0]:h,u=cn(c)||cn(l),d=o||u;return ct.und(n)&&(n=h),s.from=r_(c,d),s.to=r_(J1(n,c),d),s.start=i?i.end:0,s.end=s.start+s.delay+s.duration+s.endDelay,s.easing=q1(s.easing,s.duration),s.isPath=ct.pth(a),s.isColor=ct.col(s.from.original),s.isColor&&(s.round=1),i=s,s})}var OC={css:function(e,t,i){return e.style[t]=i},attribute:function(e,t,i){return e.setAttribute(t,i)},object:function(e,t,i){return e[t]=i},transform:function(e,t,i,r,s){if(r.list.set(t,i),t===r.last||s){var a="";r.list.forEach(function(n,o){a+=o+"("+n+") "}),e.style.transform=a}}};function IC(e,t){var i=DC(e);
3139i.forEach(function(r){for(var s in t){var a=ty(t[s],r),n=r.target,o=cn(a),l=Z1(n,s,o,r),h=o||cn(l),c=J1(MC(a,h),l),u=K1(n,s);OC[u](n,s,c,r.transforms,!0)}})}function vW(e,t){var i=K1(e.target,t.name);if(i){var r=gW(t,e),s=r[r.length-1];return{type:i,property:t.name,animatable:e,tweens:r,duration:s.end,delay:r[0].delay,endDelay:s.endDelay}}}function yW(e,t){return gm(vm(e.map(function(i){return t.map(function(r){return vW(i,r)})})),function(i){return!ct.und(i)})}function RC(e,t){var i=e.length,r=function(a){return a.timelineOffset?a.timelineOffset:0},s={};return s.duration=i?Math.max.apply(Math,e.map(function(a){let n=a.startOnceDelay??0,o=a.pingPongDelayCorrection??0,l=a.pingPongEndDelayCorrection??0;return r(a)+n+o+l+a.duration*(a.loop??1)})):t.duration,s.delay=i?Math.min.apply(Math,e.map(function(a){let n=a.startOnceDelay??0,o=a.pingPongDelayCorrection??0;return r(a)+n+o+a.delay})):t.delay,s.endDelay=i?s.duration-Math.max.apply(Math,e.map(function(a){let n=a.startOnceDelay??0,o=a.pingPongDelayCorrection??0,l=a.pingPongEndDelayCorrection??0;return r(a)+n+o+a.duration*(a.loop??1)-a.endDelay-l})):t.endDelay,s}var s_=0;function xW(e){var t=ey(yC,e),i=ey(W1,e),r=fW(i,e),s=DC(e.targets),a=yW(s,r),n=RC(a,i),o=s_;return s_++,ym(t,{id:o,children:[],animatables:s,animations:a,duration:n.duration,delay:n.delay,endDelay:n.endDelay,startOnceDelay:i.startOnceDelay,pingPongDelayCorrection:i.pingPongDelayCorrection,pingPongEndDelayCorrection:i.pingPongEndDelayCorrection})}var yr=[],uh=[],en,iy=(function(){let e=0,t=!0;function i(a){let n=yr.length;if(n){let o=0;for(;o<n;){let l=yr[o];l.paused?(yr.splice(o,1),n--):(l.tick(a),o++)}t&&(en=requestAnimationFrame(i))}else en&&(cancelAnimationFrame(en),en=null)}function r(){e=performance.now(),en=requestAnimationFrame(i)}function s(a){e+=a,i(e)}return{get isUsingInternalRaf(){return t},set isUsingInternalRaf(a){t=a},play:r,update:s}})();function ry(e){!iy.isUsingInternalRaf||(document.hidden?(yr.forEach(function(t){return t.pause(e.timeStamp)}),uh=yr.slice(0),Jt.running=yr=[]):(uh.forEach(function(t){return t.play(e.timeStamp)}),uh=[]))}function Jt(e){e===void 0&&(e={});var t=0,i=0,r=0,s,a,n=0,o=null;function l(S){var b=window.Promise&&new Promise(function(E){return o=E});return S.finished=b,b}var h=xW(e);l(h);function c(){var S=h.direction;S!=="alternate"&&(h.direction=S!=="normal"?"normal":"reverse"),h.reversed=!h.reversed,a.forEach(function(b){(b.loop===1||b.loop%2===0)&&(b.reversed=h.reversed)})}function u(){h.direction="normal",h.reversed=!1,a.forEach(function(S){return S.reversed=!1})}function d(S){return h.reversed?h.duration-S:S}function p(S,b,E=!1){b&&(h.reversed?b.seek(b.duration*b.loop-(S-b.timelineOffset-b.pingPongDelayCorrection),E):b.seek(S-b.timelineOffset-b.startOnceDelay-b.pingPongDelayCorrection,E))}function f(S,b=!1){if(h.reversed)for(var E=n;E--;)p(S,a[E],b);else for(var _=0;_<n;_++)p(S,a[_],b)}function m(S){var b=0,E=h.animations,_=E.length;for(h.direction!=="alternate"&&h.parent?.direction==="alternate"?h.parent?.rewind===!1&&h.reversePlayback===!0&&h.rewind===!1&&(h.parent?.reversed&&h.direction==="alternate"?S=h.duration-h.delay+h.endDelay-S:S=h.duration+h.delay-h.endDelay-S):x(!1,h.parent?.rewind,h.rewind,h.parent?.reversePlayback,h.reversePlayback)&&(h.parent?.reversed&&h.direction==="alternate"?S=h.duration-h.delay+h.endDelay-S:S=h.duration+h.delay-h.endDelay-S);b<_;){var A=E[b],C=A.animatable,T=A.tweens,I=T.length-1,P=T[I];I&&(P=gm(T,function(re){return S<re.end})[0]||P);let W;h.parent?.reversed&&h.direction==="alternate"?W=ks(S-P.start-P.endDelay,0,P.duration)/P.duration:W=ks(S-P.start-P.delay,0,P.duration)/P.duration;for(var O=isNaN(W)?1:P.easing(W),k=P.to.strings,G=P.round,B=[],U=P.to.numbers.length,Q=void 0,q=0;q<U;q++){var j=void 0;let re,$;h.direction!=="alternate"?h.parent?.rewind===!1&&h.reversePlayback===!0&&h.rewind===!1?(re=P.to.numbers[q],$=P.from.numbers[q]||0):($=P.to.numbers[q],re=P.from.numbers[q]||0):x(!0,h.parent?.rewind,h.rewind,h.parent?.reversePlayback,h.reversePlayback)?(re=P.to.numbers[q],$=P.from.numbers[q]||0):($=P.to.numbers[q],re=P.from.numbers[q]||0),P.isPath?j=uW(P.value,O*$):j=re+O*($-re),G&&(P.isColor&&q>2||(j=Math.round(j*G)/G)),B.push(j)}var X=k.length;if(!X)Q=B[0];else{Q=k[0];for(var te=0;te<X;te++){k[te];var K=k[te+1],Z=B[te];isNaN(Z)||(K?Q+=Z+K:Q+=Z+" ")}}OC[A.type](C.target,A.property,Q,C.transforms),A.currentValue=Q,b++}}function g(S){h[S]&&!h.passThrough&&h[S](h)}function v(){h.remaining&&h.remaining!==!0&&h.remaining--}let y={0:!1,1:!0,2:!1,3:!0,4:!1,5:!1,6:!1,7:!1,8:!1,9:!0,10:!0,11:!1,12:!1,13:!1,14:!0,15:!0,16:!1,17:!0,18:!0,19:!1,20:!1,21:!1,22:!0,23:!0,24:!1,25:!0,26:!1,27:!0,28:!1,29:!1,30:!1,31:!1};function x(S,b,E,_,A){return y[S<<4|b<<3|E<<2|_<<1|A]}function w(S,b=!1){var E=h.duration;let _=h.delay,A=E-h.endDelay;h.parent?.reversed&&h.direction==="alternate"&&(_=h.endDelay,A=E-h.delay);
3139var C=d(S);if(h.progress=ks(C/E*100,0,100),b||(h.reversePlayback=C<h.currentTime),n&&f(C,b),!h.began&&C>=_&&(h.began=!0),!h.loopBegan&&h.currentTime>0&&(h.loopBegan=!0,g("loopBegin")),(h.reversed||C>=0)&&C<=_&&h.currentTime!==0&&(m(0),g("change")),(C>=A&&h.currentTime!==E+h.pingPongDelayCorrection||!E)&&(m(E),g("change")),C>_&&C<A?(h.changeBegan||(h.changeBegan=!0,h.changeCompleted=!1,g("changeBegin")),m(C),g("change")):h.changeBegan?(h.changeCompleted=!0,h.changeBegan=!1,g("change"),n&&g("timelineChangeComplete")):h.began&&C>A&&g("changeComplete"),h.currentTime=ks(C,0,E+h.pingPongDelayCorrection),h.began&&g("update"),S>=E)if(v(),!h.remaining)h.paused=!0,h.completed||(h.completed=!0,g("loopComplete"),g("complete"),!h.passThrough&&"Promise"in window&&(o(),l(h)));else{n?t+=h.duration/Jt.speed:t+=h.duration;for(let T of a)T.setStartTime(0),T.remaining=T.loop;g("loopComplete"),h.loopBegan=!1,h.direction==="alternate"?c():n&&u()}}return h.reset=function(){var S=h.direction;h.passThrough=!1,h.currentTime=0,h.progress=0,h.paused=!0,h.began=!1,h.loopBegan=!1,h.changeBegan=!1,h.completed=!1,h.changeCompleted=!1,h.reversed=S==="reverse",h.remaining=h.loop,a=h.children,n=a.length;for(var b=n;b--;)h.children[b].reset();m(h.reversed?h.duration:0)},h.setStartTime=function(S){t=S},h.set=function(S,b){return IC(S,b),h},h.tick=function(S){r=S,t||(t=r),w((r+(i-t))*Jt.speed)},h.seek=function(S,b=!1){w(S-t,b)},h.pause=function(S){h.paused=!0,n&&(s=S??performance.now())},h.play=function(S){!h.paused||(h.completed&&h.reset(),h.paused=!1,yr.push(h),n&&s!==void 0&&(t+=(S??performance.now())-s),!en&&iy.isUsingInternalRaf&&iy.play())},h.reverse=function(S=0){c(),h.completed=!h.reversed,t=void 0,i=S},h.restart=function(){h.reset(),t=void 0,i=0,h.play()},h.destroy=function(){h.paused=!0;var S=yr.indexOf(h);S>-1&&yr.splice(S,1),S=uh.indexOf(h),S>-1&&uh.splice(S,1),h.children&&h.children.forEach(function(b){b.destroy&&b.destroy()}),h.animations=[],h.animatables=[],h.children=[],h.update=null,h.begin=null,h.complete=null,h.loopBegin=null,h.loopComplete=null,h.change=null,h.changeBegin=null,h.changeComplete=null,h.timelineChangeComplete=null,h.parent=null,o=null,a=[],n=0},h.reset(),h.autoplay&&h.play(),h}function a_(e,t){for(var i=t.length;i--;)X1(e,t[i].animatable.target)&&t.splice(i,1)}function bW(e){for(var t=PC(e),i=yr.length;i--;){var r=yr[i],s=r.animations,a=r.children;a_(t,s);for(var n=a.length;n--;){var o=a[n],l=o.animations;a_(t,l),!l.length&&!o.children.length&&a.splice(n,1)}!s.length&&!a.length&&r.pause()}}function wW(e,t){t===void 0&&(t={});var i=t.direction||"normal",r=t.easing?q1(t.easing):null,s=t.grid,a=t.axis,n=t.from||0,o=n==="first",l=n==="center",h=n==="last",c=ct.arr(e),u=parseFloat(c?e[0]:e),d=c?parseFloat(e[1]):0,p=cn(c?e[1]:e)||0,f=t.start||0+(c?u:0),m=[],g=0;return function(v,y,x){if(o&&(n=0),l&&(n=(x-1)/2),h&&(n=x-1),!m.length){for(var w=0;w<x;w++){if(!s)m.push(Math.abs(n-w));else{var S=l?(s[0]-1)/2:n%s[0],b=l?(s[1]-1)/2:Math.floor(n/s[0]),E=w%s[0],_=Math.floor(w/s[0]),A=S-E,C=b-_,T=Math.sqrt(A*A+C*C);a==="x"&&(T=-A),a==="y"&&(T=-C),m.push(T)}g=Math.max.apply(Math,m)}r&&(m=m.map(function(P){return r(P/g)*g})),i==="reverse"&&(m=m.map(function(P){return a?P<0?P*-1:-P:Math.abs(g-P)}))}var I=c?(d-u)/g:u;return f+I*(Math.round(m[y]*100)/100)+p}}function SW(e){e===void 0&&(e={});var t=Jt(e);return t.duration=0,t.add=function(i,r){var s=yr.indexOf(t),a=t.children;s>-1&&yr.splice(s,1);function n(d){d.passThrough=!0}for(var o=0;o<a.length;o++)n(a[o]);var l=ym(i,ey(W1,e));l.targets=l.targets||e.targets;var h=t.duration;l.autoplay=!1,l.timelineOffset=ct.und(r)?h:J1(r,h),n(t);var c=Jt(l);n(c),a.push(c),c.parent=t;var u=RC(a,e);return t.delay=u.delay,t.endDelay=u.endDelay,t.duration=u.duration,c.loop===!0&&(t.duration=1/0),t.seek(0),t.reset(),t.autoplay&&t.play(),t},t}Jt.version="3.2.0";Jt.speed=1;Jt.running=yr;Jt.remove=bW;Jt.get=Z1;Jt.set=IC;Jt.convertPx=Q1;Jt.path=cW;Jt.setDashoffset=lW;Jt.stagger=wW;Jt.timeline=SW;Jt.easing=q1;Jt.penner=wC;Jt.random=function(e,t){return Math.floor(Math.random()*(t-e+1))+e};Jt.removeAll=function(){yr.forEach(function(e){e.destroy&&e.destroy()}),yr=[],uh=[],Jt.running=yr,en&&(cancelAnimationFrame(en),en=null)};Jt.clearCache=function(){zh.CSS={},zh.springs={}};Jt.init=function(){typeof document<"u"&&(document.removeEventListener("visibilitychange",ry),document.addEventListener("visibilitychange",ry))};Jt.dispose=function(e){Jt.removeAll(),Jt.clearCache(),document.removeEventListener("visibilitychange",ry)};var un=Jt,Wi=class extends Je{constructor(e,t,i,r){super(e,t,i),this.isColorA=!0,this.a=r}setRGBA(e,t,i,r){super.setRGB(e,t,i),this.a=r}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,t="srgb"){let i;if(e==="transparent")return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let r,s=i[1],a=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=s==="rgba"?parseFloat(r[4]):1,super.setStyle(e,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.a=s==="hsla"?parseFloat(r[4]):1,super.setStyle(e,t);break}}return super.setStyle(e,t)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}},{degToRad:Qee,radToDeg:Kee}=Te,n_=new M,o_=new M,l_=new nt,_W=1e-4;function AW(e,t,i,r){if(r===0)return i.copy(e);if(r===1)return i.copy(t);let s=e.w*t.w+e.x*t.x+e.y*t.y+e.z*t.z;if(s>=1)return i.copy(e);let a=1-s*s;if(a<=Number.EPSILON){let c=1-r;
vendor: 5,907 bytes, line 3139
3139return i.w=c*e.w+r*t.w,i.x=c*e.x+r*t.x,i.y=c*e.y+r*t.y,i.z=c*e.z+r*t.z,i.normalize(),i}let n=Math.sqrt(a),o=Math.atan2(n,s),l=Math.sin((1-r)*o)/n,h=Math.sin(r*o)/n;return i.w=e.w*l+t.w*h,i.x=e.x*l+t.x*h,i.y=e.y*l+t.y*h,i.z=e.z*l+t.z*h,i}function pr(e,t,i,r,s,a){let n=i[e]!==void 0?i[e]:void 0,o=r[e];if(o==null)return;let l=n!=null?typeof n=="string"?Number(s.getVariable(n)??0):n:t[e],h=typeof o=="string"?Number(s.getVariable(o)??0):o;if(l!==h)return{update:c=>{let u=Te.lerp(l,h,c);a?t[e]=Math.trunc(u):t[e]=u},start:()=>{t[e]=l},end:()=>{t[e]=h}}}function ex(e,t,i,r,s,a){let n=i[e]?i[e]:void 0,o=r[e];if(!o)return;let l=t[e],h=[...n??l].map(u=>typeof u=="string"?Number(s.getVariable(u)??0):u),c=[...o].map(u=>typeof u=="string"?Number(s.getVariable(u)??0):u);if(!(h.length!==c.length||T1(h,c)))return{update:u=>{h.forEach((d,p)=>{let f=Te.lerp(d,c[p],u);t[e][p]=a?Math.trunc(f):f})},start:()=>{Object.assign(t[e],h)},end:()=>{Object.assign(t[e],c)}}}function Lf(e,t,i){return t.forEach((r,s)=>{e.setComponent(s,typeof r=="string"?Number(i.getVariable(r)??0):r)}),e}function h_(e,t,i,r,s){let a=i[e]?i[e]:void 0,n=r[e];if(!n)return;let o=t[e],l=a?Lf(new M,a,s):o.clone(),h=Lf(new M,n,s);if(!l.equals(h))return{update:c=>{o.lerpVectors(l,h,c)},start:()=>{o.copy(l)},end:()=>{o.copy(h)}}}function c_(e,t,i){return t.forEach((r,s)=>{e.setComponent(s,typeof r=="string"?Number(i.getVariable(r)??0):r)}),e}function zf(e,t,i,r,s){let a=i[e]?i[e]:void 0,n=r[e];if(!n)return;let o=t[e],l=!(o instanceof H),h=o instanceof H?o:new H().fromArray(o),c=a?c_(new H,a,s):h.clone(),u=c_(new H,n,s);if(!c.equals(u))return{update:d=>{h.lerpVectors(c,u,d),l&&(t[e]=h.toArray())},start:()=>{h.copy(c),l&&(t[e]=h.toArray())},end:()=>{h.copy(u),l&&(t[e]=h.toArray())}}}function MW(e,t,i,r){let s=i[e]?i[e]:void 0,a=r[e];if(!a)return;let n=t[e],o=s?new xe().fromArray(s):n.clone(),l=new M,h=new nt,c=new M;o.decompose(l,h,c);let u=new xe().fromArray(a),d=new M,p=new nt,f=new M;if(u.decompose(d,p,f),!o.equals(u))return{update:m=>{l_.slerpQuaternions(h,p,m),n_.lerpVectors(l,d,m),o_.lerpVectors(c,f,m),n.compose(n_,l_,o_)},start:()=>{n.compose(l,h,c)},end:()=>{n.compose(d,p,f)}}}function EW(e,t,i,r,s){let a=i[e]?i[e]:void 0,n=r[e];if(!n)return;let o=t[e],l=a?typeof a=="string"?s.getColor(a).clone():new Je().setRGB(a.r,a.g,a.b):o.clone(),h=typeof n=="string"?s.getColor(n).clone():new Je().setRGB(n.r,n.g,n.b);if(l.equals(h))return;let c=o.clone();return{update:u=>{c.lerpColors(l,h,u),t[e]?.copy?.(c)},start:()=>{c.copy(l)},end:()=>{c.copy(h)}}}function zd(e,t,i,r,s){let a=i[e]?i[e]:void 0,n=r[e];if(!n)return;let o=t[e],l=new Wi(o.r,o.g,o.b,o.a),h=a?typeof a=="string"?s.getColor(a).clone():new Wi(a.r,a.g,a.b,a.a):l.clone(),c=typeof n=="string"?s.getColor(n).clone():new Wi(n.r,n.g,n.b,n.a);if(!h.equals(c))return{update:u=>{l.lerpColors(h,c,u);let d=Te.lerp(h.a,c.a,u);l.a=d,t[e]={r:l.r,g:l.g,b:l.b,a:l.a}},start:()=>{l.copy(h)},end:()=>{l.copy(c)}}}function yo(e,t,i,r,s){if(typeof t[e]=="number")return pr(e,t,i??{},r,s);if(Array.isArray(t[e]))return ex(e,t,i??{},r,s)}function Gn(e,t,i,r,s){let a=i[e],n=r[e];if(typeof t[e]=="number")Math.abs(a-n)>_W&&(t[e]=Te.lerp(a,n,s));else if(Array.isArray(t[e]))for(let o=0,l=a.length;o<l;o++)t[e][o]=Te.lerp(a[o],n[o],s)}function CW(e,t,i,r){let s=[];if(!("cloner"in i)||!e.cloner)return s;let a=e.cloner,n="cloner"in t?t.cloner:{},o=i.cloner;dC.forEach(p=>{let f;p==="count"?f=pr("count",a.parameters,n,o,r.shared,!0):f=yo(p,a.parameters,n??{},o,r.shared),f&&s.push(f)});let l=TW(a,n,o,r.shared);l?.length&&s.push(...l);let h=PW(a,n,o,r.shared);h?.length&&s.push(...h);let c=DW(a,n,o,r.shared);c?.length&&s.push(...c);let u=OW(a,n,o,r.shared);u?.length&&s.push(...u);let d=IW(a,n,o,r.shared);return d?.length&&s.push(...d),s.length&&s.push({update:()=>{a.update(r)}}),s}function TW(e,t,i,r){if(e.parameters.type!=="radial")return;let s=t.radial,a=i.radial;if(!a)return;let n=e.parameters.radial,o=[];return U1.forEach(l=>{let h=yo(l,n,s??{},a,r);h&&o.push(h)}),o}function PW(e,t,i,r){if(e.parameters.type!=="linear")return;let s=t.linear,a=i.linear;if(!a)return;let n=[],o=e.parameters.linear;return N1.forEach(l=>{let h=yo(l,o,s??{},a,r);h&&n.push(h)}),n}function DW(e,t,i,r){if(e.parameters.type!=="grid")return;let s=t.grid,a=i.grid;if(!a)return;let n=[],o=e.parameters.grid;return V1.forEach(l=>{let h;l==="count"?h=ex(l,o,s??{},a,r,!0):h=yo(l,o,s??{},a,r),h&&n.push(h)}),n}function OW(e,t,i,r){if(e.parameters.type!=="toObject")return;let s=t.toObject,a=i.toObject;if(!a)return;let n=[],o=e.parameters.toObject;return j1.forEach(l=>{let h;l==="count"?h=pr(l,o,s??{},a,r,!0):h=yo(l,o,s??{},a,r),h&&n.push(h)}),n}function IW(e,t,i,r){if(!e.parameters.randomness)return;let s=t.randomnessObject,a=i.randomnessObject;if(!a)return;let n=[],o=e.parameters.randomnessObject;return H1.forEach(l=>{let h=yo(l,o,s??{},a,r);h&&n.push(h)}),n}function RW(e,t,i,r){let s=r.cloner?.parameters;if(s){Gn("count",s,e,t,i),s.count=Math.trunc(s.count);for(let a of U1)Gn(a,s.radial,e.radial,t.radial,i);for(let a of N1)Gn(a,s.linear,e.linear,t.linear,i);for(let a of V1)Gn(a,s.grid,e.grid,t.grid,i);for(let a of j1)Gn(a,s.toObject,e.toObject,t.toObject,i);return s}}function LW(e,t,i,r){let s=r.cloner?.parameters;if(s){for(let a of H1)Gn(a,s.randomnessObject,e.randomnessObject,t.randomnessObject,i);return s}}function Li(e,t=[0,0]){let i=e&&!isNaN(e[0])?e[0]:t[0],r=e&&!isNaN(e[1])?e[1]:t[1];return[i,r]}function Rr(e,t,i){switch(e){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 7:return"cubicBezier( .25, 1, .5, 1 )";case 5:let{control1:r,control2:s}=t??{...xf.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${s[0]}, ${s[1]} )`;case 6:let{mass:a,stiffness:n,damping:o,velocity:l}=i??{...yf.defaultData}
3139,h=new HW(a,n,o,l),c=h.solve(1);return()=>u=>h.solve(u)/c;case 8:return()=>u=>Math.floor(u)}}var u_;(e=>{function t(i){return i&&typeof i.x=="number"&&typeof i.y=="number"&&typeof i.z=="number"}e.is=t})(u_||(u_={}));var sy;(e=>{function t(o,l){let h=[0,0],c=[1,1];if(o?.cubicControls)h=Li(o.cubicControls.control1,h);else switch(o?.type){case 2:h=[.42,0];break;case 3:h=[0,0];break;case 4:h=[.42,0];break;case 1:h=[.25,.1];break;case 0:h=[0,0];break;case 7:h=[.25,1];break}if(l?.cubicControls)c=Li(l.cubicControls.control2,c);else switch(l?.type){case 2:c=[1,1];break;case 3:c=[.58,1];break;case 4:c=[.58,1];break;case 1:c=[.25,1];break;case 0:c=[1,1];break;case 7:c=[.5,1];break}return{control1:h,control2:c}}e.getControlsWithDefault=t;function i(o,l){return{id:o,name:l,to:5,properties:new Ue}}e.defaultData=i;function r(o){let l=new Ue;return o.forEach(({data:h,id:c,fi:u})=>{if(h.type==="light"){let d=d_(["material",`${h.category} lighting`],c,u);l.push(d)}else{let d=d_(["material",h.type],c,u);l.push(d)}}),l}e.createMaterialGroup=r;function s(o){return Object.entries(o).reduce((l,[h,c])=>(typeof c!="string"&&l.push({name:c.name}),l),[])}e.createName=s;function a(o,l,h){let c=un.timeline({easing:Rr(0),begin(){o.resetBBoxNeedsUpdate()},change(){o.resetBBoxNeedsUpdate()},direction:l.direction,autoplay:!1});return n(o,l,h).forEach(u=>c.add(u,0)),c.duration=l.to*1e3,c}e.createTimeline=a;function n(o,l,h,c){let u=[];return l.properties.forEach((d,p)=>{let f=d.data.path?.[0];if(f&&["position","rotation","scale"].includes(f)){let m=zW(d.data,h?.[f]);m&&u.push(...m)}if(f&&f==="shape size"&&"geometry"in o){let m=BW(o,d.data,h?.shapeSize);m&&u.push(...m)}if(f&&f==="path extrusion"&&o instanceof Cm){let m=FW(o,d.data,h?.pathExtrusion);m&&u.push(m)}if(f&&f==="path snapping"&&o.data.pathSnapping){let m=kW(o,d.data,h?.pathSnapping);m&&u.push(m)}if(f&&f==="material"&&o.type==="Mesh"&&"material"in o&&o.material instanceof yn){let m=d.data.id;if(m){let g=o.material.getLayerByUuid(m);if(g){let v=p_(g,d.data,h?.material,c);v&&u.push(v)}else{let v=o.material.getLayersOfType(d.data.type);if(v)for(let y of v){let x=p_(y,d.data,h?.material,c);x&&u.push(x)}}}}if(f&&f==="opacity"&&o.type==="Mesh"&&"material"in o){let m=UW(d.data,h?.opacity);m&&u.push(m)}if(f&&f==="cloner"){let m=NW(o,d.data,h?.cloner);m&&u.push(m)}if(f&&f==="camera"&&o instanceof qi){let m=VW(o,d.data,h?.camera,"zoom");m&&u.push(m)}if(f&&f==="light"&&(o instanceof Am||o instanceof Dx||o instanceof Mm)){let m=jW(o,d.data,h?.light,d.data.path[1],c);m&&u.push(m)}}),u}e.addKeyframesToTimeline=n,e.Presets=[{name:"Slide in",animationParams:{translateX:{value:[-20,0],easing:Rr(3),duration:1e3},opacity:{value:[0,1],easing:Rr(3),duration:1e3},endDelay:250,loop:!0}},{name:"Rotate",animationParams:{rotate:{value:[0,"1turn"],easing:Rr(5),duration:700},endDelay:250,loop:!0}},{name:"Scale Out",animationParams:{scale:{value:[1,1.5],easing:Rr(4),duration:1e3},endDelay:250,loop:!0}},{name:"Jump",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],endDelay:500,loop:!0}},{name:"Jump Rotate",animationParams:{translateY:[{value:0,duration:200,easing:"linear"},{value:-20,easing:"linear",duration:200},{value:0,easing:"linear",duration:100}],rotate:{value:[0,"1turn"],easing:Rr(5),duration:500},endDelay:500,loop:!0}},{name:"Bounce",animationParams:{translateY:{value:["20px","-20px"],duration:575,easing:"easeOutQuad"},direction:"alternate",loop:!0}}]})(sy||(sy={}));function d_(e,t,i){let r=t;return{id:r,fi:i,data:{id:r,path:e,keyframes:new Ue}}}var LC=["x","y","z"];function zW(e,t=()=>{}){let i=[];for(let r of LC){let s=[...e.keyframes??[]].filter(o=>o.data.value[r]!==void 0).sort((o,l)=>o.data.time-l.data.time),a=s[0];a&&t?.(a.data.value);let n={index:[],t:[]};for(let o=0;o<s.length-1;o++){let l=s[o],h=s[o+1]??l,c={duration:(h?.data?.time-l.data.time)*1e3,delay:o===0?s[0].data.time*1e3:0};o<s.length-1&&(n.t.push({...c,value:o%2===0?1:0,easing:Rr(l.data.easing.type,{control1:Li(l.data.easing.cubicControls?.control1,[0,0]),control2:Li(h.data.easing.cubicControls?.control2,[1,1])},l.data.easing.springParameters)}),n.index.push({...c,value:o,easing:"linear"}))}if(s.length>1){let o={t:0,index:0};i.push({targets:o,...n,update:l=>{let h=Math.ceil(o.index),c=h%2===0?o.t:1-o.t,u=s?.[h].data.value,d=s?.[h+1]?.data.value;if(u!==void 0&&d!==void 0){let p={[r]:u[r]+(d[r]-u[r])*c};t?.(p)}}})}}return i}function BW(e,t,i){let r=[];for(let s of LC){let a={},n=[...t.keyframes??[]].filter(l=>l.data.value[s]!==void 0).sort((l,h)=>l.data.time-h.data.time),o=n[0];o&&i?.(o.data.value),a={index:[],t:[]};for(let l=0;l<n.length-1;l++){let h=n[l],c=n[l+1]??h,u={duration:(c?.data?.time-h.data.time)*1e3,delay:l===0?n[0].data.time*1e3:0};l<n.length-1&&(a.t.push({...u,value:l%2===0?1:0,easing:Rr(h.data.easing.type,{control1:Li(h.data.easing.cubicControls?.control1,[0,0]),control2:Li(c.data.easing.cubicControls?.control2,[1,1])},h.data.easing.springParameters)}),a.index.push({...u,value:l,easing:"linear"}))}if(n.length>1){let l={t:0,index:0};r.push({targets:l,...a,update:h=>{let c=Math.ceil(l.index),u=c%2===0?l.t:1-l.t,d=n?.[c].data.value,p=n?.[c+1]?.data.value;if(d!==void 0&&p!==void 0){let f={[s]:d[s]+(p[s]-d[s])*u};i?.(f)}}})}}return r}function FW(e,t,i){let r={},s=[...t.keyframes??[]].sort((n,o)=>n.data.time-o.data.time),a=s[0];a&&i?.(e,a.data.value),r={index:[],t:[]};for(let n=0;n<s.length-1;n++){let o=s[n],l=s[n+1]??o,h={duration:(l?.data?.time-o.data.time)*1e3,delay:n===0?s[0].data.time*1e3:0};n<s.length-1&&(r.t.push({...h,value:n%2===0?1:0,easing:Rr(o.data.easing.type,{control1:Li(o.data.easing.cubicControls?.control1,[0,0]),control2:Li(l.data.easing.cubicControls?.control2,[1,1])},o.data.easing.springParameters)}),r.index.push({...h,value:n,easing:"linear"}))}if(s.length>1){let n={t:0,index:0};return{targets:n,...r,update:o=>{let l=Math.ceil(n.index),h=l%2===0?n.t:1-n.t,c=s?.[Math.min(l,s.length-1)].data.value,u=s?.[Math.min(l,s.length-1)+1]?.data.value;i?.(e,nJ(e,c,u,h))}}}}function kW(e,t,i){let r={},s=[...t.keyframes??[]].sort((n,o)=>n.data.time-o.data.time),a=s[0];a&&i?.(a.data.value),r={index:[],t:[]};for(let n=0;n<s.length-1;n++){let o=s[n],l=s[n+1]??o,h={duration:(l?.data?.time-o.data.time)*1e3,delay:n===0?s[0].data.time*1e3:0};n<s.length-1&&(r.t.push({...h,value:n%2===0?1:0,easing:Rr(o.data.easing.type,{control1:Li(o.data.easing.cubicControls?.control1,[0,0]),control2:Li(l.data.easing.cubicControls?.control2,[1,1])},o.data.easing.springParameters)}),r.index.push({...h,value:n,easing:"linear"}))}if(s.length>1){let n={t:0,index:0};return{targets:n,...r,update:o=>{let l=Math.ceil(n.index),h=l%2===0?n.t:1-n.t,c=s?.[Math.min(l,s.length-1)].data.value,u=s?.[Math.min(l,s.length-1)+1]?.data.value;i?.(oJ(e,c,u,h))}}}}function p_(e,t,i,r){if(t){let s={},a=[...t.keyframes??[]].sort((n,o)=>n.data.time-o.data.time);if("data"in e){let n=a[0];n&&i?.(n.data.value,e),s={index:[],t:[]};for(let o=0;o<a.length-1;o++){let l=a[o],h=a[o+1]??l,c={duration:(h?.data?.time-l.data.time)*1e3,delay:o===0?a[0].data.time*1e3:0};
3139o<a.length-1&&(s.t.push({...c,value:o%2===0?1:0,easing:Rr(l.data.easing.type,{control1:Li(l.data.easing.cubicControls?.control1,[0,0]),control2:Li(h.data.easing.cubicControls?.control2,[1,1])},l.data.easing.springParameters)}),s.index.push({...c,value:o,easing:"linear"}))}if(a.length>1){let o={t:0,index:0};return{targets:o,...s,update:l=>{let h=Math.ceil(o.index),c=h%2===0?o.t:1-o.t,u=a?.[Math.min(h,a.length-1)].data.value,d=a?.[Math.min(h,a.length-1)+1]?.data.value,p={},f={};if(Object.keys(u).length>0&&Object.keys(d).length>0){for(let m in e.data)if(m in u&&m in d){let g=tx(u[m],d[m],c,r);g!==void 0&&(p[m]=g,f[m]={start:u,end:d,t:c})}}i?.({...p},e,f)}}}}}}function UW(e,t){if(e){let i={},r=[...e.keyframes??[]].sort((a,n)=>a.data.time-n.data.time),s=r[0];s&&t?.(s.data.value),i={index:[],t:[]};for(let a=0;a<r.length-1;a++){let n=r[a],o=r[a+1]??n,l={duration:(o?.data?.time-n.data.time)*1e3,delay:a===0?r[0].data.time*1e3:0};a<r.length-1&&(i.t.push({...l,value:a%2===0?1:0,easing:Rr(n.data.easing.type,{control1:Li(n.data.easing.cubicControls?.control1,[0,0]),control2:Li(o.data.easing.cubicControls?.control2,[1,1])},n.data.easing.springParameters)}),i.index.push({...l,value:a,easing:"linear"}))}if(r.length>1){let a={t:0,index:0};return{targets:a,...i,update:n=>{let o=Math.ceil(a.index),l=o%2===0?a.t:1-a.t,h=r?.[Math.min(o,r.length-1)].data.value,c=r?.[Math.min(o,r.length-1)+1]?.data.value,u=Te.lerp(h,c,l);t?.(u)}}}}}function NW(e,t,i){let r={},s=[...t.keyframes??[]].sort((n,o)=>n.data.time-o.data.time),a=s[0];a&&i?.(e,a.data.value,a.data.value),r={index:[],t:[]};for(let n=0;n<s.length-1;n++){let o=s[n],l=s[n+1]??o,h={duration:(l?.data?.time-o.data.time)*1e3,delay:n===0?s[0].data.time*1e3:0};n<s.length-1&&(r.t.push({...h,value:n%2===0?1:0,easing:Rr(o.data.easing.type,{control1:Li(o.data.easing.cubicControls?.control1,[0,0]),control2:Li(l.data.easing.cubicControls?.control2,[1,1])},o.data.easing.springParameters)}),r.index.push({...h,value:n,easing:"linear"}))}if(s.length>1){let n={t:0,index:0};return{targets:n,...r,update:o=>{let l=Math.ceil(n.index),h=l%2===0?n.t:1-n.t,c=s?.[Math.min(l,s.length-1)].data.value,u=s?.[Math.min(l,s.length-1)+1]?.data.value;i?.(e,c.randomnessObject?void 0:RW(c,u,h,e),c.randomnessObject?LW(c,u,h,e):void 0)}}}}function tx(e,t,i,r){if(typeof e=="string"&&r&&(e=r.color(e)),typeof t=="string"&&r&&(e=r.color(t)),typeof e=="number")return e===t?void 0:Te.lerp(e,t,i);if(Ut.is(e))return Ut.lerp(e,t,i);if(Ti.is(e))return Ti.lerp(e,t,i);if(Array.isArray(e))return(e.length>t.length?t:e).map((s,a,n)=>{if(Array.isArray(s)){let o=e[a].length>t[a].length?t[a].length:e[a].length;return(o===4?Au:o===3?ao:ma).lerp(e[a],t[a],i)}else return Te.lerp(e[a],t[a],i)});if(typeof e=="object"&&e!==null){let s={};for(let a in e){let n=tx(e[a],t[a],i,r);n!==void 0&&(s[a]=n)}return s}}function VW(e,t,i,r){if(t){let s={[r]:[]},a=[...t.keyframes??[]].sort((o,l)=>o.data.time-l.data.time),n=a[0];
3139n&&(e[r]=n.data.value,n&&i?.(r,n.data.value));for(let o=0;o<a.length-1;o++){let l=a[o];if(!Number.isFinite(l.data.value))continue;let h=a[o+1]??l,c=h.data.value;s[r].push({value:c,easing:Rr(l.data.easing.type,{control1:Li(l.data.easing.cubicControls?.control1,[0,0]),control2:Li(h.data.easing.cubicControls?.control2,[1,1])},l.data.easing.springParameters),duration:(h?.data?.time-l.data.time)*1e3,delay:o===0?a[0].data.time*1e3:0})}if(a.length>1)return{targets:e,...s,update:()=>{i?.(r,e[r])}}}}function jW(e,t,i,r,s){if(t){let a={},n=[...t.keyframes??[]].sort((l,h)=>l.data.time-h.data.time),o=n[0];if(o){let l=o.data.value;e[r]=l,i?.(r,l)}a={index:[],t:[]};for(let l=0;l<n.length-1;l++){let h=n[l],c=n[l+1]??h,u={duration:(c?.data?.time-h.data.time)*1e3,delay:l===0?n[0].data.time*1e3:0};l<n.length-1&&(a.t.push({...u,value:l%2===0?1:0,easing:Rr(h.data.easing.type,{control1:Li(h.data.easing.cubicControls?.control1,[0,0]),control2:Li(c.data.easing.cubicControls?.control2,[1,1])},h.data.easing.springParameters)}),a.index.push({...u,value:l,easing:"linear"}))}if(n.length>1){let l={t:0,index:0};return{targets:l,...a,update:()=>{let h=Math.ceil(l.index),c=h%2===0?l.t:1-l.t,u=n?.[Math.min(h,n.length-1)].data.value,d=n?.[Math.min(h,n.length-1)+1]?.data.value,p=tx(u,d,c,s);i?.(r,p)}}}}}var HW=class{constructor(e=1,t=100,i=10,r=0){this.mass=e,this.stiffness=t,this.damping=i,this.initialVelocity=r,this.m_w0=Math.sqrt(t/e),this.m_zeta=i/(2*Math.sqrt(t*e)),this.m_zeta<1?(this.m_wd=this.m_w0*Math.sqrt(1-this.m_zeta*this.m_zeta),this.m_A=1,this.m_B=(this.m_zeta*this.m_w0+-r)/this.m_wd):(this.m_wd=0,this.m_A=1,this.m_B=-r+this.m_w0)}solve(e){return this.m_zeta<1?e=Math.exp(-e*this.m_zeta*this.m_w0)*(this.m_A*Math.cos(this.m_wd*e)+this.m_B*Math.sin(this.m_wd*e)):e=(this.m_A+this.m_B*e)*Math.exp(-e*this.m_w0),1-e}getDuration(){let e=.16666666666666666,t=0,i=0;for(;;)if(t+=e,this.solve(t)===1){if(i++,i>=16)break}else i=0;return t*e*1e3}},GW=Math.pow(2,-24),Bd=class{constructor(){}};function pa(e,t,i){return i.min.x=t[e],i.min.y=t[e+1],i.min.z=t[e+2],i.max.x=t[e+3],i.max.y=t[e+4],i.max.z=t[e+5],i}function f_(e){let t=-1,i=-1/0;for(let r=0;r<3;r++){let s=e[r+3]-e[r];s>i&&(i=s,t=r)}return t}function m_(e,t){t.set(e)}function g_(e,t,i){let r,s;for(let a=0;a<3;a++){let n=a+3;r=e[a],s=t[a],i[a]=r<s?r:s,r=e[n],s=t[n],i[n]=r>s?r:s}}function Fd(e,t,i){for(let r=0;r<3;r++){let s=t[e+2*r],a=t[e+2*r+1],n=s-a,o=s+a;n<i[r]&&(i[r]=n),o>i[r+3]&&(i[r+3]=o)}}function mc(e){let t=e[3]-e[0],i=e[4]-e[1],r=e[5]-e[2];return 2*(t*i+i*r+r*t)}function WW(e,t){if(!e.index){let i=e.attributes.position.count,r=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,s;i>65535?s=new Uint32Array(new r(4*i)):s=new Uint16Array(new r(2*i)),e.setIndex(new tt(s,1));for(let a=0;a<i;a++)s[a]=a}}function qW(e){if(!e.groups||!e.groups.length)return[{offset:0,count:e.index.count/3}];let t=[],i=new Set;for(let s of e.groups)i.add(s.start),i.add(s.start+s.count);let r=Array.from(i.values()).sort((s,a)=>s-a);for(let s=0;s<r.length-1;s++){let a=r[s],n=r[s+1];t.push({offset:a/3,count:(n-a)/3})}return t}function Pg(e,t,i,r,s=null){let a=1/0,n=1/0,o=1/0,l=-1/0,h=-1/0,c=-1/0,u=1/0,d=1/0,p=1/0,f=-1/0,m=-1/0,g=-1/0,v=s!==null;for(let y=t*6,x=(t+i)*6;y<x;y+=6){let w=e[y+0],S=e[y+1],b=w-S,E=w+S;b<a&&(a=b),E>l&&(l=E),v&&w<u&&(u=w),v&&w>f&&(f=w);let _=e[y+2],A=e[y+3],C=_-A,T=_+A;C<n&&(n=C),T>h&&(h=T),v&&_<d&&(d=_),v&&_>m&&(m=_);let I=e[y+4],P=e[y+5],O=I-P,k=I+P;O<o&&(o=O),k>c&&(c=k),v&&I<p&&(p=I),v&&I>g&&(g=I)}r[0]=a,r[1]=n,r[2]=o,r[3]=l,r[4]=h,r[5]=c,v&&(s[0]=u,s[1]=d,s[2]=p,s[3]=f,s[4]=m,s[5]=g)}function XW(e,t,i,r){let s=1/0,a=1/0,n=1/0,o=-1/0,l=-1/0,h=-1/0;for(let c=t*6,u=(t+i)*6;c<u;c+=6){let d=e[c+0];d<s&&(s=d),d>o&&(o=d);let p=e[c+2];p<a&&(a=p),p>l&&(l=p);let f=e[c+4];f<n&&(n=f),f>h&&(h=f)}r[0]=s,r[1]=a,r[2]=n,r[3]=o,r[4]=l,r[5]=h}function YW(e,t,i,r,s){let a=i,n=i+r-1,o=s.pos,l=s.axis*2;for(;;){for(;a<=n&&t[a*6+l]<o;)a++;for(;a<=n&&t[n*6+l]>=o;)n--;if(a<n){for(let h=0;h<3;h++){let c=e[a*3+h];e[a*3+h]=e[n*3+h],e[n*3+h]=c;let u=t[a*6+h*2+0];t[a*6+h*2+0]=t[n*6+h*2+0],t[n*6+h*2+0]=u;let d=t[a*6+h*2+1];t[a*6+h*2+1]=t[n*6+h*2+1],t[n*6+h*2+1]=d}a++,n--}else return a}}var Ga=32,QW=(e,t)=>
vendor: 7,894 bytes, line 3139
3139e.candidate-t.candidate,Cn=new Array(Ga).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),kd=new Float32Array(6);function KW(e,t,i,r,s,a){let n=-1,o=0;if(a===0)n=f_(t),n!==-1&&(o=(t[n]+t[n+3])/2);else if(a===1)n=f_(e),n!==-1&&(o=ZW(i,r,s,n));else if(a===2){let l=mc(e),h=1.25*s,c=r*6,u=(r+s)*6;for(let d=0;d<3;d++){let p=t[d],f=(t[d+3]-p)/Ga;if(s<Ga/4){let m=[...Cn];m.length=s;let g=0;for(let y=c;y<u;y+=6,g++){let x=m[g];x.candidate=i[y+2*d],x.count=0;let{bounds:w,leftCacheBounds:S,rightCacheBounds:b}=x;for(let E=0;E<3;E++)b[E]=1/0,b[E+3]=-1/0,S[E]=1/0,S[E+3]=-1/0,w[E]=1/0,w[E+3]=-1/0;Fd(y,i,w)}m.sort(QW);let v=s;for(let y=0;y<v;y++){let x=m[y];for(;y+1<v&&m[y+1].candidate===x.candidate;)m.splice(y+1,1),v--}for(let y=c;y<u;y+=6){let x=i[y+2*d];for(let w=0;w<v;w++){let S=m[w];x>=S.candidate?Fd(y,i,S.rightCacheBounds):(Fd(y,i,S.leftCacheBounds),S.count++)}}for(let y=0;y<v;y++){let x=m[y],w=x.count,S=s-x.count,b=x.leftCacheBounds,E=x.rightCacheBounds,_=0;w!==0&&(_=mc(b)/l);let A=0;S!==0&&(A=mc(E)/l);let C=1+1.25*(_*w+A*S);C<h&&(n=d,h=C,o=x.candidate)}}else{for(let v=0;v<Ga;v++){let y=Cn[v];y.count=0,y.candidate=p+f+v*f;let x=y.bounds;for(let w=0;w<3;w++)x[w]=1/0,x[w+3]=-1/0}for(let v=c;v<u;v+=6){let y=~~((i[v+2*d]-p)/f);y>=Ga&&(y=Ga-1);let x=Cn[y];x.count++,Fd(v,i,x.bounds)}let m=Cn[Ga-1];m_(m.bounds,m.rightCacheBounds);for(let v=Ga-2;v>=0;v--){let y=Cn[v],x=Cn[v+1];g_(y.bounds,x.rightCacheBounds,y.rightCacheBounds)}let g=0;for(let v=0;v<Ga-1;v++){let y=Cn[v],x=y.count,w=y.bounds,S=Cn[v+1].rightCacheBounds;x!==0&&(g===0?m_(w,kd):g_(w,kd,kd)),g+=x;let b=0,E=0;g!==0&&(b=mc(kd)/l);let _=s-g;_!==0&&(E=mc(S)/l);let A=1+1.25*(b*g+E*_);A<h&&(n=d,h=A,o=y.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${a} used.`);return{axis:n,pos:o}}function ZW(e,t,i,r){let s=0;for(let a=t,n=t+i;a<n;a++)s+=e[a*6+r*2];return s/i}function JW(e,t){let i=e.attributes.position,r=e.index.array,s=r.length/3,a=new Float32Array(s*6),n=i.normalized,o=i.array,l=i.offset||0,h=3;i.isInterleavedBufferAttribute&&(h=i.data.stride);let c=["getX","getY","getZ"];for(let u=0;u<s;u++){let d=u*3,p=u*6,f,m,g;n?(f=r[d+0],m=r[d+1],g=r[d+2]):(f=r[d+0]*h+l,m=r[d+1]*h+l,g=r[d+2]*h+l);for(let v=0;v<3;v++){let y,x,w;n?(y=i[c[v]](f),x=i[c[v]](m),w=i[c[v]](g)):(y=o[f+v],x=o[m+v],w=o[g+v]);let S=y;x<S&&(S=x),w<S&&(S=w);let b=y;x>b&&(b=x),w>b&&(b=w);let E=(b-S)/2,_=v*2;a[p+_+0]=S+E,a[p+_+1]=E+(Math.abs(S)+E)*GW,S<t[v]&&(t[v]=S),b>t[v+3]&&(t[v+3]=b)}}return a}function $W(e,t){function i(v){d&&d(v/p)}function r(v,y,x,w=null,S=0){if(!f&&S>=l&&(f=!0,h&&(console.warn(`MeshBVH: Max depth of ${l} reached when generating BVH. Consider increasing maxDepth.`),console.warn(e))),x<=c||S>=l)return i(y+x),v.offset=y,v.count=x,v;let b=KW(v.boundingData,w,n,y,x,u);if(b.axis===-1)return i(y+x),v.offset=y,v.count=x,v;let E=YW(o,n,y,x,b);if(E===y||E===y+x)i(y+x),v.offset=y,v.count=x;else{v.splitAxis=b.axis;let _=new Bd,A=y,C=E-y;v.left=_,_.boundingData=new Float32Array(6),Pg(n,A,C,_.boundingData,a),r(_,A,C,a,S+1);let T=new Bd,I=E,P=x-C;v.right=T,T.boundingData=new Float32Array(6),Pg(n,I,P,T.boundingData,a),r(T,I,P,a,S+1)}return v}WW(e,t);let s=new Float32Array(6),a=new Float32Array(6),n=JW(e,s),o=e.index.array,l=t.maxDepth,h=t.verbose,c=t.maxLeafTris,u=t.strategy,d=t.onProgress,p=e.index.count/3,f=!1,m=[],g=qW(e);if(g.length===1){let v=g[0],y=new Bd;y.boundingData=s,XW(n,v.offset,v.count,a),r(y,v.offset,v.count,a),m.push(y)}else for(let v of g){let y=new Bd;y.boundingData=new Float32Array(6),Pg(n,v.offset,v.count,y.boundingData,a),r(y,v.offset,v.count,a),m.push(y)}return m}function e8(e,t){let i=$W(e,t),r,s,a,n=[],o=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let c=0;c<i.length;c++){let u=i[c],d=l(u),p=new o(32*d);r=new Float32Array(p),s=new Uint32Array(p),a=new Uint16Array(p),h(0,u),n.push(p)}return n;function l(c){return c.count?1:1+l(c.left)+l(c.right)}function h(c,u){let d=c/4,p=c/2,f=!!u.count,m=u.boundingData;for(let g=0;g<6;g++)r[d+g]=m[g];if(f){let g=u.offset,v=u.count;return s[d+6]=g,a[p+14]=v,a[p+15]=65535,c+32}else{let g=u.left,v=u.right,y=u.splitAxis,x;if(x=h(c+32,g),x/4>Math.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return s[d+6]=x/4,x=h(x,v),s[d+7]=y,x}}}var gn=class{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let i=1/0,r=-1/0;for(let s=0,a=e.length;s<a;s++){let n=e[s][t];i=n<i?n:i,r=n>r?n:r}this.min=i,this.max=r}setFromPoints(e,t){let i=1/0,r=-1/0;for(let s=0,a=t.length;s<a;s++){let n=t[s],o=e.dot(n);i=o<i?o:i,r=o>r?o:r}this.min=i,this.max=r}isSeparated(e){return this.min>e.max||e.min>this.max}};gn.prototype.setFromBox=(function(){let e=new M;return function(t,i){let r=i.min,s=i.max,a=1/0,n=-1/0;for(let o=0;o<=1;o++)for(let l=0;l<=1;l++)for(let h=0;h<=1;h++){e.x=r.x*o+s.x*(1-o),e.y=r.y*l+s.y*(1-l),e.z=r.z*h+s.z*(1-h);let c=t.dot(e);a=Math.min(c,a),n=Math.max(c,n)}this.min=a,this.max=n}})();var t8=(function(){let e=new M,t=new M,i=new M;return function(r,s,a){let n=r.start,o=e,l=s.start,h=t;i.subVectors(n,l),e.subVectors(r.end,r.start),t.subVectors(s.end,s.start);let c=i.dot(h),u=h.dot(o),d=h.dot(h),p=i.dot(o),f=o.dot(o)*d-u*u,m,g;f!==0?m=(c*u-p*d)/f:m=0,g=(c+m*u)/d,a.x=m,a.y=g}})(),ix=(function(){let e=new H,t=new M,i=new M;return function(r,s,a,n){t8(r,s,e);let o=e.x,l=e.y;if(o>=0&&o<=1&&l>=0&&l<=1){r.at(o,a),s.at(l,n);return}else if(o>=0&&o<=1){l<0?s.at(0,n):s.at(1,n),r.closestPointToPoint(n,!0,a);return}else if(l>=0&&l<=1){o<0?r.at(0,a):r.at(1,a),s.closestPointToPoint(a,!0,n);return}else{let h;o<0?h=r.start:h=r.end;let c;l<0?c=s.start:c=s.end;let u=t,d=i;if(r.closestPointToPoint(c,!0,t),s.closestPointToPoint(h,!0,i),u.distanceToSquared(c)<=d.distanceToSquared(h)){a.copy(u),n.copy(c);return}else{a.copy(h),n.copy(d);return}}}})(),i8=(function(){let e=new M,t=new M,i=new Hr,r=new bs;return function(s,a){let{radius:n,center:o}=s,{a:l,b:h,c}=a;if(r.start=l,r.end=h,r.closestPointToPoint(o,!0,e).distanceTo(o)<=n||(r.start=l,r.end=c,r.closestPointToPoint(o,!0,e).distanceTo(o)<=n)||(r.start=h,r.end=c,r.closestPointToPoint(o,!0,e).distanceTo(o)<=n))return!0;let u=a.getPlane(i);if(Math.abs(u.distanceToPoint(o))<=n){let d=u.projectPoint(o,t);if(a.containsPoint(d))return!0}return!1}})(),r8=1e-15;function Pl(e){return Math.abs(e)<r8}var vn=class extends fr{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new M),this.satBounds=new Array(4).fill().map(()=>new gn),this.points=[this.a,this.b,this.c],this.sphere=new is,this.plane=new Hr,this.needsUpdate=!0}intersectsSphere(e){return i8(e,this)}update(){let e=this.a,t=this.b,i=this.c,r=this.points,s=this.satAxes,a=this.satBounds,n=s[0],o=a[0];this.getNormal(n),o.setFromPoints(n,r);let l=s[1],h=a[1];l.subVectors(e,t),h.setFromPoints(l,r);let c=s[2],u=a[2];c.subVectors(t,i),u.setFromPoints(c,r);let d=s[3],p=a[3];d.subVectors(i,e),p.setFromPoints(d,r),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(n,e),this.needsUpdate=!1}};vn.prototype.closestPointToSegment=(function(){let e=new M,t=new M,i=new bs;return function(r,s=null,a=null){let{start:n,end:o}=r,l=this.points,h,c=1/0;for(let u=0;u<3;u++){let d=(u+1)%3;i.start.copy(l[u]),i.end.copy(l[d]),ix(i,r,e,t),h=e.distanceToSquared(t),h<c&&(c=h,s&&s.copy(e),a&&a.copy(t))}return this.closestPointToPoint(n,e),h=n.distanceToSquared(e),h<c&&(c=h,s&&s.copy(e),a&&a.copy(n)),this.closestPointToPoint(o,e),h=o.distanceToSquared(e),h<c&&(c=h,s&&s.copy(e),a&&a.copy(o)),Math.sqrt(c)}})();vn.prototype.intersectsTriangle=(function(){let e=new vn,t=new Array(3),i=new Array(3),r=new gn,s=new gn,a=new M,n=new M,o=new M,l=new M,h=new bs,c=new bs,u=new bs;return function(d,p=null,f=!1){this.needsUpdate&&this.update(),d.isExtendedTriangle?d.needsUpdate&&d.update():(e.copy(d),e.update(
3139),d=e);let m=this.plane,g=d.plane;if(Math.abs(m.normal.dot(g.normal))>1-1e-10){let v=this.satBounds,y=this.satAxes;i[0]=d.a,i[1]=d.b,i[2]=d.c;for(let S=0;S<4;S++){let b=v[S],E=y[S];if(r.setFromPoints(E,i),b.isSeparated(r))return!1}let x=d.satBounds,w=d.satAxes;t[0]=this.a,t[1]=this.b,t[2]=this.c;for(let S=0;S<4;S++){let b=x[S],E=w[S];if(r.setFromPoints(E,t),b.isSeparated(r))return!1}for(let S=0;S<4;S++){let b=y[S];for(let E=0;E<4;E++){let _=w[E];if(a.crossVectors(b,_),r.setFromPoints(a,t),s.setFromPoints(a,i),r.isSeparated(s))return!1}}return p&&(f||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),p.start.set(0,0,0),p.end.set(0,0,0)),!0}else{let v=this.points,y=!1,x=0;for(let P=0;P<3;P++){let O=v[P],k=v[(P+1)%3];h.start.copy(O),h.end.copy(k),h.delta(n);let G=y?c.start:c.end,B=Pl(g.distanceToPoint(O));if(Pl(g.normal.dot(n))&&B){c.copy(h),x=2;break}if((g.intersectLine(h,G)||B)&&!Pl(G.distanceTo(k))){if(x++,y)break;y=!0}}if(x===1&&d.containsPoint(c.end))return p&&(p.start.copy(c.end),p.end.copy(c.end)),!0;if(x!==2)return!1;let w=d.points,S=!1,b=0;for(let P=0;P<3;P++){let O=w[P],k=w[(P+1)%3];h.start.copy(O),h.end.copy(k),h.delta(o);let G=S?u.start:u.end,B=Pl(m.distanceToPoint(O));if(Pl(m.normal.dot(o))&&B){u.copy(h),b=2;break}if((m.intersectLine(h,G)||B)&&!Pl(G.distanceTo(k))){if(b++,S)break;S=!0}}if(b===1&&this.containsPoint(u.end))return p&&(p.start.copy(u.end),p.end.copy(u.end)),!0;if(b!==2)return!1;if(c.delta(n),u.delta(o),n.dot(o)<0){let P=u.start;u.start=u.end,u.end=P}let E=c.start.dot(n),_=c.end.dot(n),A=u.start.dot(n),C=u.end.dot(n),T=_<A,I=E<C;return E!==C&&A!==_&&T===I?!1:(p&&(l.subVectors(c.start,u.start),l.dot(n)>0?p.start.copy(c.start):p.start.copy(u.start),l.subVectors(c.end,u.end),l.dot(n)<0?p.end.copy(c.end):p.end.copy(u.end)),!0)}}})();vn.prototype.distanceToPoint=(function(){let e=new M;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}})();vn.prototype.distanceToTriangle=(function(){let e=new M,t=new M,i=["a","b","c"],r=new bs,s=new bs;return function(a,n=null,o=null){let l=n||o?r:null;if(this.intersectsTriangle(a,l))return(n||o)&&(n&&l.getCenter(n),o&&l.getCenter(o)),0;let h=1/0;for(let c=0;c<3;c++){let u,d=i[c],p=a[d];this.closestPointToPoint(p,e),u=p.distanceToSquared(e),u<h&&(h=u,n&&n.copy(e),o&&o.copy(p));let f=this[d];a.closestPointToPoint(f,e),u=f.distanceToSquared(e),u<h&&(h=u,n&&n.copy(f),o&&o.copy(e))}for(let c=0;c<3;c++){let u=i[c],d=i[(c+1)%3];r.set(this[u],this[d]);for(let p=0;p<3;p++){let f=i[p],m=i[(p+1)%3];s.set(a[f],a[m]),ix(r,s,e,t);let g=e.distanceToSquared(t);g<h&&(h=g,n&&n.copy(e),o&&o.copy(t))}}return Math.sqrt(h)}})();var Aa=class{constructor(e,t,i){this.isOrientedBox=!0,this.min=new M,this.max=new M,this.matrix=new xe,this.invMatrix=new xe,this.points=new Array(8).fill().map(()=>new M),this.satAxes=new Array(3).fill().map(()=>new M),this.satBounds=new Array(3).fill().map(()=>new gn),this.alignedSatBounds=new Array(3).fill().map(()=>new gn),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),i&&this.matrix.copy(i)}set(e,t,i){this.min.copy(e),this.max.copy(t),this.matrix.copy(i),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}};Aa.prototype.update=(function(){return function(){let e=this.matrix,t=this.min,i=this.max,r=this.points;for(let l=0;l<=1;l++)for(let h=0;h<=1;h++)for(let c=0;c<=1;c++){let u=1*l|2*h|4*c,d=r[u];d.x=l?i.x:t.x,d.y=h?i.y:t.y,d.z=c?i.z:t.z,d.applyMatrix4(e)}let s=this.satBounds,a=this.satAxes,n=r[0];for(let l=0;l<3;l++){let h=a[l],c=s[l],u=1<<l,d=r[u];h.subVectors(n,d),c.setFromPoints(h,r)}let o=this.alignedSatBounds;o[0].setFromPointsField(r,"x"),o[1].setFromPointsField(r,"y"),o[2].setFromPointsField(r,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}})();Aa.prototype.intersectsBox=(function(){let e=new gn;return function(t){this.needsUpdate&&this.update();let i=t.min,r=t.max,s=this.satBounds,a=this.satAxes,n=this.alignedSatBounds;if(e.min=i.x,e.max=r.x,n[0].isSeparated(e)||(e.min=i.y,e.max=r.y,n[1].isSeparated(e))||(e.min=i.z,e.max=r.z,n[2].isSeparated(e)))return!1;for(let o=0;o<3;o++){let l=a[o],h=s[o];if(e.setFromBox(l,t),h.isSeparated(e))return!1}return!0}})();Aa.prototype.intersectsTriangle=(function(){let e=new vn,t=new Array(3),i=new gn,r=new gn,s=new M;return function(a){this.needsUpdate&&this.update(),a.isExtendedTriangle?a.needsUpdate&&a.update():(e.copy(a),e.update(
3139),a=e);let n=this.satBounds,o=this.satAxes;t[0]=a.a,t[1]=a.b,t[2]=a.c;for(let u=0;u<3;u++){let d=n[u],p=o[u];if(i.setFromPoints(p,t),d.isSeparated(i))return!1}let l=a.satBounds,h=a.satAxes,c=this.points;for(let u=0;u<3;u++){let d=l[u],p=h[u];if(i.setFromPoints(p,c),d.isSeparated(i))return!1}for(let u=0;u<3;u++){let d=o[u];for(let p=0;p<4;p++){let f=h[p];if(s.crossVectors(d,f),i.setFromPoints(s,t),r.setFromPoints(s,c),i.isSeparated(r))return!1}}return!0}})();Aa.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}})();Aa.prototype.distanceToPoint=(function(){let e=new M;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}})();Aa.prototype.distanceToBox=(function(){let e=["x","y","z"],t=new Array(12).fill().map(()=>new bs),i=new Array(12).fill().map(()=>new bs),r=new M,s=new M;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,r),a.closestPointToPoint(r,s),o&&o.copy(r),l&&l.copy(s)),0;let h=n*n,c=a.min,u=a.max,d=this.points,p=1/0;for(let m=0;m<8;m++){let g=d[m];s.copy(g).clamp(c,u);let v=g.distanceToSquared(s);if(v<p&&(p=v,o&&o.copy(g),l&&l.copy(s),v<h))return Math.sqrt(v)}let f=0;for(let m=0;m<3;m++)for(let g=0;g<=1;g++)for(let v=0;v<=1;v++){let y=(m+1)%3,x=(m+2)%3,w=g<<y|v<<x,S=1<<m|g<<y|v<<x,b=d[w],E=d[S];t[f].set(b,E);let _=e[m],A=e[y],C=e[x],T=i[f],I=T.start,P=T.end;I[_]=c[_],I[A]=g?c[A]:u[A],I[C]=v?c[C]:u[A],P[_]=u[_],P[A]=g?c[A]:u[A],P[C]=v?c[C]:u[A],f++}for(let m=0;m<=1;m++)for(let g=0;g<=1;g++)for(let v=0;v<=1;v++){s.x=m?u.x:c.x,s.y=g?u.y:c.y,s.z=v?u.z:c.z,this.closestPointToPoint(s,r);let y=s.distanceToSquared(r);if(y<p&&(p=y,o&&o.copy(r),l&&l.copy(s),y<h))return Math.sqrt(y)}for(let m=0;m<12;m++){let g=t[m];for(let v=0;v<12;v++){let y=i[v];ix(g,y,r,s);let x=r.distanceToSquared(s);if(x<p&&(p=x,o&&o.copy(r),l&&l.copy(s),x<h))return Math.sqrt(x)}}return Math.sqrt(p)}})();var Dl=new M,Ol=new M,Il=new M,Ud=new H,Nd=new H,Vd=new H,v_=new M,y_=new M,x_=new M,jd=new M;function s8(e,t,i,r,s,a){let n;return a===sr?n=e.intersectTriangle(r,i,t,!0,s):n=e.intersectTriangle(t,i,r,a!==Ar,s),n===null?null:{distance:e.origin.distanceTo(s),point:s.clone()}}function a8(e,t,i,r,s,a,n,o,l){Dl.fromBufferAttribute(t,a),Ol.fromBufferAttribute(t,n),Il.fromBufferAttribute(t,o);let h=s8(e,Dl,Ol,Il,jd,l);if(h){r&&(Ud.fromBufferAttribute(r,a),Nd.fromBufferAttribute(r,n),Vd.fromBufferAttribute(r,o),h.uv=fr.getInterpolation(jd,Dl,Ol,Il,Ud,Nd,Vd,new H)),s&&(Ud.fromBufferAttribute(s,a),Nd.fromBufferAttribute(s,n),Vd.fromBufferAttribute(s,o),h.uv1=fr.getInterpolation(jd,Dl,Ol,Il,Ud,Nd,Vd,new H)),i&&(v_.fromBufferAttribute(i,a),y_.fromBufferAttribute(i,n),x_.fromBufferAttribute(i,o),h.normal=fr.getInterpolation(jd,Dl,Ol,Il,v_,y_,x_,new M),h.normal.dot(e.direction)>0&&h.normal.multiplyScalar(-1));let c={a,b:n,c:o,normal:new M,materialIndex:0};fr.getNormal(Dl,Ol,Il,c.normal),h.face=c,h.faceIndex=a}return h}function zC(e,t,i,r,s){let a=r*3,n=e.index.getX(a),o=e.index.getX(a+1),l=e.index.getX(a+2),{position:h,normal:c,uv:u,uv1:d}=e.attributes,p=a8(i,h,c,u,d,n,o,l,t);return p?(p.faceIndex=r,s&&s.push(p),p):null}function n8(e,t,i,r,s,a){for(let n=r,o=r+s;n<o;n++)zC(e,t,i,n,a)}function o8(e,t,i,r,s){let a=1/0,n=null;for(let o=r,l=r+s;o<l;o++){let h=zC(e,t,i,o);h&&h.distance<a&&(n=h,a=h.distance)}return n}function ca(e,t,i,r){let s=e.a,a=e.b,n=e.c,o=t,l=t+1,h=t+2;i&&(o=i.getX(t),l=i.getX(t+1),h=i.getX(t+2)),s.x=r.getX(o),s.y=r.getY(o),s.z=r.getZ(o),a.x=r.getX(l),a.y=r.getY(l),a.z=r.getZ(l),n.x=r.getX(h),n.y=r.getY(h),n.z=r.getZ(h)}function b_(e,t,i,r,s,a,n){let o=i.index,l=i.attributes.position;for(let h=e,c=t+e;h<c;h++)if(ca(n,h*3,o,l),n.needsUpdate=!0,r(n,h,s,a))return!0;return!1}var BC=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)}};function Wn(e,t){return t[e+15]===65535}function dh(e,t){return t[e+6]}function Pu(e,t){return t[e+14]}function Du(e){return e+8}function Ou(e,t){return t[e+6]}function l8(e,t){return t[e+7]}var ah=new yi,Bf=new M,h8=["x","y","z"];function ay(e,t,i,r,s){let a=e*2,n=$h,o=no,l=oo;if(Wn(a,o)){let h=dh(e,l),c=Pu(a,o);n8(t,i,r,h,c,s)}else{let h=Du(e);
3139Ff(h,n,r,Bf)&&ay(h,t,i,r,s);let c=Ou(e,l);Ff(c,n,r,Bf)&&ay(c,t,i,r,s)}}function ny(e,t,i,r){let s=e*2,a=$h,n=no,o=oo;if(Wn(s,n)){let l=dh(e,o),h=Pu(s,n);return o8(t,i,r,l,h)}else{let l=l8(e,o),h=h8[l],c=r.direction[h]>=0,u,d;c?(u=Du(e),d=Ou(e,o)):(u=Ou(e,o),d=Du(e));let p=Ff(u,a,r,Bf)?ny(u,t,i,r):null;if(p){let m=p.point[h];if(c?m<=a[d+l]:m>=a[d+l+3])return p}let f=Ff(d,a,r,Bf)?ny(d,t,i,r):null;return p&&f?p.distance<=f.distance?p:f:p||f||null}}var c8=(function(){let e,t,i=[],r=new BC(()=>new yi);return function(...a){e=r.getPrimitive(),t=r.getPrimitive(),i.push(e,t);let n=s(...a);r.releasePrimitive(e),r.releasePrimitive(t),i.pop(),i.pop();let o=i.length;return o>0&&(t=i[o-1],e=i[o-2]),n};function s(a,n,o,l,h=null,c=0,u=0){function d(y){let x=y*2,w=no,S=oo;for(;!Wn(x,w);)y=Du(y),x=y*2;return dh(y,S)}function p(y){let x=y*2,w=no,S=oo;for(;!Wn(x,w);)y=Ou(y,S),x=y*2;return dh(y,S)+Pu(x,w)}let f=a*2,m=$h,g=no,v=oo;if(Wn(f,g)){let y=dh(a,v),x=Pu(f,g);return pa(a,m,e),l(y,x,!1,u,c+a,e)}else{let y=Du(a),x=Ou(a,v),w=y,S=x,b,E,_,A;if(h&&(_=e,A=t,pa(w,m,_),pa(S,m,A),b=h(_),E=h(A),E<b)){w=x,S=y;let G=b;b=E,E=G,_=A}_||(_=e,pa(w,m,_));let C=Wn(w*2,g),T=o(_,C,b,u+1,c+w),I;if(T===2){let G=d(w),B=p(w)-G;I=l(G,B,!0,u+1,c+w,_)}else I=T&&s(w,n,o,l,h,c,u+1);if(I)return!0;A=t,pa(S,m,A);let P=Wn(S*2,g),O=o(A,P,E,u+1,c+S),k;if(O===2){let G=d(S),B=p(S)-G;k=l(G,B,!0,u+1,c+S,A)}else k=O&&s(S,n,o,l,h,c,u+1);return!!k}}})(),u8=(function(){let e=new vn,t=new vn,i=new xe,r=new Aa,s=new Aa;return function a(n,o,l,h,c=null){let u=n*2,d=$h,p=no,f=oo;if(c===null&&(l.boundingBox||l.computeBoundingBox(),r.set(l.boundingBox.min,l.boundingBox.max,h),c=r),Wn(u,p)){let m=o,g=m.index,v=m.attributes.position,y=l.index,x=l.attributes.position,w=dh(n,f),S=Pu(u,p);if(i.copy(h).invert(),l.boundsTree)return pa(n,d,s),s.matrix.copy(i),s.needsUpdate=!0,l.boundsTree.shapecast({intersectsBounds:b=>s.intersectsBox(b),intersectsTriangle:b=>{b.a.applyMatrix4(h),b.b.applyMatrix4(h),b.c.applyMatrix4(h),b.needsUpdate=!0;for(let E=w*3,_=(S+w)*3;E<_;E+=3)if(ca(t,E,g,v),t.needsUpdate=!0,b.intersectsTriangle(t))return!0;return!1}});for(let b=w*3,E=S+w*3;b<E;b+=3){ca(e,b,g,v),e.a.applyMatrix4(i),e.b.applyMatrix4(i),e.c.applyMatrix4(i),e.needsUpdate=!0;for(let _=0,A=y.count;_<A;_+=3)if(ca(t,_,y,x),t.needsUpdate=!0,e.intersectsTriangle(t))return!0}}else{let m=n+8,g=f[n+6];return pa(m,d,ah),!!(c.intersectsBox(ah)&&a(m,o,l,h,c)||(pa(g,d,ah),c.intersectsBox(ah)&&a(g,o,l,h,c)))}}})();function Ff(e,t,i,r){return pa(e,t,ah),i.intersectBox(ah,r)}var oy=[],Lp,$h,no,oo;function Nc(e){Lp&&oy.push(Lp),Lp=e,$h=new Float32Array(e),no=new Uint16Array(e),oo=new Uint32Array(e)}function Hd(){Lp=null,$h=null,no=null,oo=null,oy.length&&Nc(oy.pop())}var Dg=Symbol("skip tree generation"),Og=new yi,Ig=new yi,Rl=new xe,Ao=new Aa,gc=new Aa,vc=new M,Gd=new M,d8=new M,p8=new M,f8=new M,w_=new yi,Ks=new BC(()=>new vn),tu=class{static serialize(e,t={}){if(t.isBufferGeometry)return console.warn("MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature."),tu.serialize(arguments[0],{cloneBuffers:arguments[2]===void 0?!0:arguments[2]});t={cloneBuffers:!0,...t};let i=e.geometry,r=e._roots,s=i.getIndex(),a;return t.cloneBuffers?a={roots:r.map(n=>n.slice()),index:s.array.slice()}:a={roots:r,index:s.array},a}static deserialize(e,t,i={}){if(typeof i=="boolean")return console.warn("MeshBVH.deserialize: The arguments for the function have changed. See documentation for new signature."),tu.deserialize(arguments[0],arguments[1],{setIndex:arguments[2]===void 0?!0:arguments[2]});i={setIndex:!0,...i};let{index:r,roots:s}=e,a=new tu(t,{...i,[Dg]:!0});if(a._roots=s,i.setIndex){let n=t.getIndex();if(n===null){let o=new tt(e.index,1,!1);t.setIndex(o)}else n.array!==r&&(n.array.set(r),n.needsUpdate=!0)}return a}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({strategy:0,maxDepth:40,maxLeafTris:10,verbose
3139:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[Dg]:!1},t),t.useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,t[Dg]||(this._roots=e8(e,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new yi))),this.geometry=e}refit(e=null){e&&Array.isArray(e)&&(e=new Set(e));let t=this.geometry,i=t.index.array,r=t.attributes.position,s,a,n,o,l=0,h=this._roots;for(let u=0,d=h.length;u<d;u++)s=h[u],a=new Uint32Array(s),n=new Uint16Array(s),o=new Float32Array(s),c(0,l),l+=s.byteLength;function c(u,d,p=!1){let f=u*2;if(n[f+15]===65535){let m=a[u+6],g=n[f+14],v=1/0,y=1/0,x=1/0,w=-1/0,S=-1/0,b=-1/0;for(let E=3*m,_=3*(m+g);E<_;E++){let A=i[E],C=r.getX(A),T=r.getY(A),I=r.getZ(A);C<v&&(v=C),C>w&&(w=C),T<y&&(y=T),T>S&&(S=T),I<x&&(x=I),I>b&&(b=I)}return o[u+0]!==v||o[u+1]!==y||o[u+2]!==x||o[u+3]!==w||o[u+4]!==S||o[u+5]!==b?(o[u+0]=v,o[u+1]=y,o[u+2]=x,o[u+3]=w,o[u+4]=S,o[u+5]=b,!0):!1}else{let m=u+8,g=a[u+6],v=m+d,y=g+d,x=p,w=!1,S=!1;e?x||(w=e.has(v),S=e.has(y),x=!w&&!S):(w=!0,S=!0);let b=x||w,E=x||S,_=!1;b&&(_=c(m,d,x));let A=!1;E&&(A=c(g,d,x));let C=_||A;if(C)for(let T=0;T<3;T++){let I=m+T,P=g+T,O=o[I],k=o[I+3],G=o[P],B=o[P+3];o[u+T]=O<G?O:G,o[u+T+3]=k>B?k:B}return C}}}traverse(e,t=0){let i=this._roots[t],r=new Uint32Array(i),s=new Uint16Array(i);a(0);function a(n,o=0){let l=n*2,h=s[l+15]===65535;if(h){let c=r[n+6],u=s[l+14];e(o,h,new Float32Array(i,n*4,6),c,u)}else{let c=n+8,u=r[n+6],d=r[n+7];e(o,h,new Float32Array(i,n*4,6),d)||(a(c,o+1),a(u,o+1))}}}raycast(e,t=Vs){let i=this._roots,r=this.geometry,s=[],a=t.isMaterial,n=Array.isArray(t),o=r.groups,l=a?t.side:t;for(let h=0,c=i.length;h<c;h++){let u=n?t[o[h].materialIndex].side:l,d=s.length;if(Nc(i[h]),ay(0,r,u,e,s),Hd(),n){let p=o[h].materialIndex;for(let f=d,m=s.length;f<m;f++)s[f].face.materialIndex=p}}return s}raycastFirst(e,t=Vs){let i=this._roots,r=this.geometry,s=t.isMaterial,a=Array.isArray(t),n=null,o=r.groups,l=s?t.side:t;for(let h=0,c=i.length;h<c;h++){let u=a?t[o[h].materialIndex].side:l;Nc(i[h]);let d=ny(0,r,u,e);Hd(),d!=null&&(n==null||d.distance<n.distance)&&(n=d,a&&(d.face.materialIndex=o[h].materialIndex))}return n}intersectsGeometry(e,t){let i=this.geometry,r=!1;for(let s of this._roots)if(Nc(s),r=u8(0,i,e,t),Hd(),r)break;return r}shapecast(e,t,i){let r=this.geometry;if(e instanceof Function){if(t){let u=t;t=(d,p,f,m)=>{let g=p*3;return u(d,g,g+1,g+2,f,m)}}e={boundsTraverseOrder:i,intersectsBounds:e,intersectsTriangle:t,intersectsRange:null},console.warn("MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.")}let s=Ks.getPrimitive(),{boundsTraverseOrder:a,intersectsBounds:n,intersectsRange:o,intersectsTriangle:l}=e;if(o&&l){let u=o;o=(d,p,f,m,g)=>u(d,p,f,m,g)?!0:b_(d,p,r,l,f,m,s)}else o||(l?o=(u,d,p,f)=>b_(u,d,r,l,p,f,s):o=(u,d,p)=>p);let h=!1,c=0;for(let u of this._roots){if(Nc(u),h=c8(0,r,n,o,a,c),Hd(),h)break;c+=u.byteLength}return Ks.releasePrimitive(s),h}bvhcast(e,t,i){let{intersectsRanges:r,intersectsTriangles:s}=i,a=this.geometry.index,n=this.geometry.attributes.position,o=e.geometry.index,l=e.geometry.attributes.position;Rl.copy(t).invert();let h=Ks.getPrimitive(),c=Ks.getPrimitive();if(s){let d=function(p,f,m,g,v,y,x,w){for(let S=m,b=m+g;S<b;S++){ca(c,S*3,o,l),c.a.applyMatrix4(t),c.b.applyMatrix4(t),c.c.applyMatrix4(t),c.needsUpdate=!0;for(let E=p,_=p+f;E<_;E++)if(ca(h,E*3,a,n),h.needsUpdate=!0,s(h,c,E,S,v,y,x,w))return!0}return!1};if(r){let p=r;r=function(f,m,g,v,y,x,w,S){return p(f,m,g,v,y,x,w,S)?!0:d(f,m,g,v,y,x,w,S)}}else r=d}e.getBoundingBox(Ig),Ig.applyMatrix4(t);let u=this.shapecast({intersectsBounds:d=>Ig.intersectsBox(d),intersectsRange:(d,p,f,m,g,v)=>(Og.copy(v),Og.applyMatrix4(Rl),e.shapecast({intersectsBounds:y=>Og.intersectsBox(y),intersectsRange:(y,x,w,S,b)=>r(d,p,y,x,m,g,S,b)}))});return Ks.releasePrimitive(h),Ks.releasePrimitive(c),u}intersectsBox(e,t){return Ao.set(e.min,e.max,t),Ao.needsUpdate=!0,this.shapecast({intersectsBounds:i=>Ao.intersectsBox(i),intersectsTriangle:i=>Ao.intersectsTriangle(i)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,i={},r={},s=0,a=1/0){e.boundingBox||e.computeBoundingBox(),Ao.set(e.boundingBox.min,e.boundingBox.max,t),Ao.needsUpdate=!0;let n=this.geometry,o=n.attributes.position,l=n.index,h=e.attributes.position,c=e.index,u=Ks.getPrimitive(),d=Ks.getPrimitive(),p=Gd,f=d8,m=null,g=null;r&&(m=p8,g=f8);let v=1/0,y=null,x=null;return Rl.copy(t).invert(),gc.matrix.copy(Rl),this.shapecast({boun
vendor: 5,812 bytes, line 3139
3139dsTraverseOrder:w=>Ao.distanceToBox(w),intersectsBounds:(w,S,b)=>b<v&&b<a?(S&&(gc.min.copy(w.min),gc.max.copy(w.max),gc.needsUpdate=!0),!0):!1,intersectsRange:(w,S)=>{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:b=>gc.distanceToBox(b),intersectsBounds:(b,E,_)=>_<v&&_<a,intersectsRange:(b,E)=>{for(let _=b*3,A=(b+E)*3;_<A;_+=3){ca(d,_,c,h),d.a.applyMatrix4(t),d.b.applyMatrix4(t),d.c.applyMatrix4(t),d.needsUpdate=!0;for(let C=w*3,T=(w+S)*3;C<T;C+=3){ca(u,C,l,o),u.needsUpdate=!0;let I=u.distanceToTriangle(d,p,m);if(I<v&&(f.copy(p),g&&g.copy(m),v=I,y=C/3,x=_/3),I<s)return!0}}}});{let b=c?c.count:h.count;for(let E=0,_=b;E<_;E+=3){ca(d,E,c,h),d.a.applyMatrix4(t),d.b.applyMatrix4(t),d.c.applyMatrix4(t),d.needsUpdate=!0;for(let A=w*3,C=(w+S)*3;A<C;A+=3){ca(u,A,l,o),u.needsUpdate=!0;let T=u.distanceToTriangle(d,p,m);if(T<v&&(f.copy(p),g&&g.copy(m),v=T,y=A/3,x=E/3),T<s)return!0}}}}}),Ks.releasePrimitive(u),Ks.releasePrimitive(d),v===1/0?null:(i.point?i.point.copy(f):i.point=f.clone(),i.distance=v,i.faceIndex=y,r&&(r.point?r.point.copy(g):r.point=g.clone(),r.point.applyMatrix4(Rl),f.applyMatrix4(Rl),r.distance=f.sub(r.point).length(),r.faceIndex=x),i)}closestPointToPoint(e,t={},i=0,r=1/0){let s=i*i,a=r*r,n=1/0,o=null;if(this.shapecast({boundsTraverseOrder:h=>(vc.copy(e).clamp(h.min,h.max),vc.distanceToSquared(e)),intersectsBounds:(h,c,u)=>u<n&&u<a,intersectsTriangle:(h,c)=>{h.closestPointToPoint(e,vc);let u=e.distanceToSquared(vc);return u<n&&(Gd.copy(vc),n=u,o=c),u<s}}),n===1/0)return null;let l=Math.sqrt(n);return t.point?t.point.copy(Gd):t.point=Gd.clone(),t.distance=l,t.faceIndex=o,t}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(t=>{pa(0,new Float32Array(t),w_),e.union(w_)}),e}},ly=mo(AD()),m8=.5*(Math.sqrt(3)-1),yc=(3-Math.sqrt(3))/6,g8=1/3,Zs=1/6,iu=e=>Math.floor(e)|0,S_=new Float64Array([1,1,-1,1,1,-1,-1,-1,1,0,-1,0,1,0,-1,0,0,1,0,-1,0,1,0,-1]),Rg=new Float64Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]);function v8(e=Math.random){let t=FC(e),i=new Float64Array(t).map(s=>S_[s%12*2]),r=new Float64Array(t).map(s=>S_[s%12*2+1]);return function(s,a){let n=0,o=0,l=0,h=(s+a)*m8,c=iu(s+h),u=iu(a+h),d=(c+u)*yc,p=c-d,f=u-d,m=s-p,g=a-f,v,y;m>g?(v=1,y=0):(v=0,y=1);let x=m-v+yc,w=g-y+yc,S=m-1+2*yc,b=g-1+2*yc,E=c&255,_=u&255,A=.5-m*m-g*g;if(A>=0){let I=E+t[_],P=i[I],O=r[I];A*=A,n=A*A*(P*m+O*g)}let C=.5-x*x-w*w;if(C>=0){let I=E+v+t[_+y],P=i[I],O=r[I];C*=C,o=C*C*(P*x+O*w)}let T=.5-S*S-b*b;if(T>=0){let I=E+1+t[_+1],P=i[I],O=r[I];T*=T,l=T*T*(P*S+O*b)}return 70*(n+o+l)}}function y8(e=Math.random){let t=FC(e),i=new Float64Array(t).map(a=>Rg[a%12*3]),r=new Float64Array(t).map(a=>Rg[a%12*3+1]),s=new Float64Array(t).map(a=>Rg[a%12*3+2]);return function(a,n,o){let l,h,c,u,d=(a+n+o)*g8,p=iu(a+d),f=iu(n+d),m=iu(o+d),g=(p+f+m)*Zs,v=p-g,y=f-g,x=m-g,w=a-v,S=n-y,b=o-x,E,_,A,C,T,I;w>=S?S>=b?(E=1,_=0,A=0,C=1,T=1,I=0):w>=b?(E=1,_=0,A=0,C=1,T=0,I=1):(E=0,_=0,A=1,C=1,T=0,I=1):S<b?(E=0,_=0,A=1,C=0,T=1,I=1):w<b?(E=0,_=1,A=0,C=0,T=1,I=1):(E=0,_=1,A=0,C=1,T=1,I=0);let P=w-E+Zs,O=S-_+Zs,k=b-A+Zs,G=w-C+2*Zs,B=S-T+2*Zs,U=b-I+2*Zs,Q=w-1+3*Zs,q=S-1+3*Zs,j=b-1+3*Zs,X=p&255,te=f&255,K=m&255,Z=.6-w*w-S*S-b*b;if(Z<0)l=0;else{let ne=X+t[te+t[K]];Z*=Z,l=Z*Z*(i[ne]*w+r[ne]*S+s[ne]*b)}let W=.6-P*P-O*O-k*k;if(W<0)h=0;else{let ne=X+E+t[te+_+t[K+A]];W*=W,h=W*W*(i[ne]*P+r[ne]*O+s[ne]*k)}let re=.6-G*G-B*B-U*U;if(re<0)c=0;else{let ne=X+C+t[te+T+t[K+I]];re*=re,c=re*re*(i[ne]*G+r[ne]*B+s[ne]*U)}let $=.6-Q*Q-q*q-j*j;if($<0)u=0;else{let ne=X+1+t[te+1+t[K+1]];$*=$,u=$*$*(i[ne]*Q+r[ne]*q+s[ne]*j)}return 32*(l+h+c+u)}}function FC(e){let t=new Uint8Array(512);for(let i=0;i<512/2;i++)t[i]=i;for(let i=0;i<512/2-1;i++){let r=i+~~(e()*(256-i)),s=t[i];t[i]=t[r],t[r]=s}for(let i=256;i<512;i++)t[i]=t[i-256];return t}var Cs=new fr,x8=class{constructor(e){this.weightAttribute=null;let t=e.geometry;if(!t.isBufferGeometry||t.attributes.position.itemSize!==3)throw new Error("THREE.MeshSurfaceSampler: Requires BufferGeometry triangle mesh.");t.index&&(t=t.toNonIndexed()),this.geometry=t,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.distribution=null}build(){let e=this.positionAttribute,t=new Float32Array(e.count/3);for(let r=0;r<e.count;r+=3){let s=1;Cs.a.fromBufferAttribute(e,r),Cs.b.fromBufferAttribute(e,r+1),Cs.c.fromBufferAttribute(e,r+2),s*=Cs.getArea(),t[r/3]=s}this.distribution=new Float32Array(e.count/3);let i=0;for(let r=0;r<t.length;r++)i+=t[r],this.distribution[r]=i;return this}setRandomGenerator(e){return this.randomFunction=e,this}sample(e,t){if(this.distribution){let i=this.distribution[this.distribution.length-1],r=this.binarySearch(this.randomFunction()*i);return this.sampleFace(r,e,t)}}binarySearch(e){if(!this.distribution)return 0;let t=this.distribution,i=0,r=t.length-1,s=-1;for(;i<=r;){let a=Math.ceil((i+r)/2);if(a===0||t[a-1]<=e&&t[a]>e){s=a;break}else e<t[a]?r=a-1:i=a+1}return s}sampleFace(e,t,i){let r=this.randomFunction(),s=this.randomFunction();return r+s>1&&(r=1-r,s=1-s),Cs.a.fromBufferAttribute(this.positionAttribute,e*3),Cs.b.fromBufferAttribute(this.positionAttribute,e*3+1),Cs.c.fromBufferAttribute(this.positionAttribute,e*3+2),t.set(0,0,0).addScaledVector(Cs.a,r).addScaledVector(Cs.b,s).addScaledVector(Cs.c,1-(r+s)),Cs.getNormal(i),this}},b8=mo(Z2()),w8=new xe,S8=new xe,_8=new xe,rl;(e=>{function t(i){return i&&i.__isSPEObject}e.is=t})(rl||(rl={}));var rx=e=>class extends e{constructor(){super(...arguments),this.previousModelViewMatrix=new xe,this.copyPreviousMatrix=!0,this.hiddenMatrix=new xe,this.pivotMatrix=new xe,this.matrixWorldRigid=new xe,this.shearScale=new xe,this.shearScaleInv=new xe}get __isSPEObject(){return!0}isDescendantOf(t){t instanceof Vt&&(t=t.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===t)return!0;
3139i=i.parent}return!1}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(let i of this.children)i.updateMatrixWorld(t)}updateWorldMatrix(t,i){let r=this.parent;if(t&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),i)for(let s of this.children)s.updateWorldMatrix(!1,!0)}traverseChildren(t,i=0){for(let r of this.children)rl.is(r)&&r.traverseObject(t,i+1)}traverseObject(t,i=0){if(t(this,i)!==!0)for(let r of this.children)rl.is(r)&&r.traverseObject(t,i+1)}updateMatrixWorldSVD(){let t=this.matrixWorld.elements,i=[[t[0],t[4],t[8]],[t[1],t[5],t[9]],[t[2],t[6],t[10]]],{u:r,v:s,q:a}=(0,b8.SVD)(i),n=w8.set(r[0][0],r[0][1],r[0][2],0,r[1][0],r[1][1],r[1][2],0,r[2][0],r[2][1],r[2][2],0,0,0,0,1),o=S8.set(s[0][0],s[0][1],s[0][2],0,s[1][0],s[1][1],s[1][2],0,s[2][0],s[2][1],s[2][2],0,0,0,0,1),l=_8.copy(o).transpose();
vendor: 4,616 bytes, line 3139
3139this.shearScale.makeScale(a[0],a[1],a[2]).multiply(l).premultiply(o),this.shearScaleInv.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(n,l).copyPosition(this.matrixWorld),a.every(h=>Math.abs(a[0]-h)<.01)?this.hasNonUniformScale=!1:this.hasNonUniformScale=!0}attach(t,i){this.updateWorldMatrix(!0,!1);let r=new xe().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),r.multiply(t.parent.matrixWorld)),"hiddenMatrix"in t&&t.hiddenMatrix instanceof xe?t.hiddenMatrix.premultiply(r):t.applyMatrix4(r),t.updateWorldMatrix(!1,!1),this.add(t),i!==void 0&&(this.children.pop(),this.children.splice(i,0,t)),this}copy(t,i=!1){return super.copy(t,i),this.hasNonUniformScale=t.hasNonUniformScale,this}onAfterRender(t,i,r,s,a,n){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}},A8=class extends rx(Vt){},M8=e=>e.type==="Mesh",vr=class extends A8{constructor(e){super(),this.object=e,this.matrixAutoUpdate=!1,this.hasNonUniformScale=e.hasNonUniformScale}raycast(e,t){}expand(){let e=0,t=this.object.entityChildren(e);for(;t;){let i=this.children[e];i?.object!==t&&(i&&this.remove(i),i=new vr(t),this.add(i),this.children.splice(e,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=t.matrix,i.hiddenMatrix=t.hiddenMatrix,i.pivotMatrix=t.pivotMatrix),i.expand(),e+=1,t=this.object.entityChildren(e)}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}get visible(){return this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&this.object.dataPatched.cloner?.hideBase===!0}set visible(e){}get castShadow(){return this.object.castShadow}set castShadow(e){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(e){}get isMesh(){return M8(this.object)}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(e){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(e){}},Ro=new M,Lo=new M,ph=new xe,kC=[new M(-1,1,1),new M(-1,-1,1),new M(1,-1,1),new M(1,1,1),new M(-1,1,-1),new M(-1,-1,-1),new M(1,-1,-1),new M(1,1,-1)],E8=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],C8=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],__=(e,t,i)=>{e.updateEntityBoxSize(Ro,Lo),ph.copy(t).multiply(e.matrixWorld),Lo.x===0&&Lo.y===0&&Lo.z===0?i.push(new M(Ro.x,Ro.y,Ro.z).applyMatrix4(ph)):kC.forEach(r=>{i.push(r.clone().multiply(Lo).add(Ro).applyMatrix4(ph))})},A_=class extends yi{constructor(){super(...arguments),this.matrix=new xe,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(t=>t.clone()),this.faces=e.faces.map(t=>t.clone()),this.edges=e.edges.map(t=>t.clone()),this.centerEdges=e.centerEdges.map(t=>t.clone()),this}setFromObjectSize(e,t=!1){e.updateWorldMatrix(!1,t),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let i=new xe().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,i,t)}expandByObjectSize(e,t,i=!1){let r=[];return i===!0?e.traverseEntity(s=>{if(s.visible||s.cloner&&s.data.visible){if(!("geometry"in s)){r.push(new M);return}__(s,t,r)}}):__(e,t,r),this.setFromPoints(r)}getCenter(e){return e=super.getCenter(e),e.applyMatrix4(this.matrix),e}getPositionToCenter(e){return e=super.getCenter(e),e.applyMatrix4(ph.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(Lo).multiplyScalar(.5),this.getCenter(Ro),ph.copy(this.matrix).setPosition(Ro),this.vertices=kC.map(e=>e.clone().multiply(Lo).applyMatrix4(ph))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=E8.map(([e,t])=>new bs(this.vertices[e],this.vertices[t])),this.centerEdges=this.edges.map(e=>e.getCenter(new M))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=C8.map(([e,t])=>this.vertices[e].clone().add(this.vertices[t]).multiplyScalar(.5))}},Jn={Cloner:()=>{},changeEntityProptotype:()=>{},createEntity:()=>{}},T8=class extends CM{constructor(){super()}getPoints(e=12){let t=[],i,r=this.getCurveLengths(),s=r[r.length-1]/r.length;for(let a=0,n=this.curves;a<n.length;a++){let o=n[a],l=a===0?r[a]:r[a]-r[a-1],h=Math.ceil(e*l/s),c=o.getPoints(h);for(let u=0;u<c.length;u++){let d=c[u];i&&i.equals(d)||(t.push(d),i=d)}}return this.autoClose&&t.length>
31391&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}},hy=.001;function cy(e,t,i){return t.clone().sub(e).cross(t.clone().sub(i)).length()<=hy}function Lg(e,t){let i=new M(...e.position),r=new M(...e.controlNext.position),s=new M(...t.controlPrevious.position),a=new M(...t.position);return cy(i,r,a)&&cy(i,s,a)}function UC(e){let t=e.points.map(c=>new M(...c.data.position)),i=[e.points[0]],r=new M(...i[0].data.position);for(let c=0;c<e.points.length-1;c++)cy(r,t[c],t[c+1])||(i.push(e.points[c]),r=t[c]);i.push(e.points[e.points.length-1]);let s=e.isClosed,a=i.length-(s?0:1),n=i.length,o=[];for(let c=0;c<n;c++){let u=i[c].data,d=new M(...u.position),p=new M(...u.controlPrevious.position),f=new M(...u.controlNext.position),m={position:d,baseRoundness:u.roundness,controlPrevious:p,controlNext:f};if(u.roundness===0||!e.isClosed&&(c===0||c===n-1)){o[c]={...m,removedLength:0};continue}let g=s&&c==0?n-1:c-1,v=s&&c==n-1?0:c+1,y=i[g].data,x=i[v].data,w=new M(...y.position),S=new M(...x.position),b=w.clone().sub(d).normalize(),E=S.clone().sub(d).normalize();Object.assign(m,{prevDir:b,nextDir:E});let _=Lg(y,u),A=Lg(u,x);if(!_||!A)o[c]={...m,removedLength:0};else{let C=b.clone().add(E).normalize(),T=C.clone().cross(b).length()/b.dot(C);o[c]={...m,tan:T,removedLength:u.roundness/T}}}for(let c=0;c<a;c++){let u=c,d=s&&c===n-1?0:c+1,p=o[u],f=o[d];if(p.removedLength!==0||f.removedLength!==0){let m=p.position.distanceTo(f.position);p.removedLength=Math.min(p.removedLength,m/2),f.removedLength=Math.min(f.removedLength,m/2)}}let l=[];for(let c=0;c<a;c++){let u=c,d=s&&c===n-1?0:c+1,p=o[u],f=o[d],m=null;if(!Lg(i[u].data,i[d].data))p.position.distanceTo(f.position)>hy&&(m=new Tp(p.position,p.controlNext,f.controlPrevious,f.position));else{let g=p.position.clone(),v=f.position.clone();(p.removedLength!==0||f.removedLength!==0)&&(p.nextDir&&g.add(p.nextDir.clone().setLength(p.removedLength)),f.prevDir&&v.add(f.prevDir.clone().setLength(f.removedLength))),g.distanceTo(v)>hy&&(m=new Tp(g,g.clone().lerp(v,.3),v.clone().lerp(g,.3),v))}l[2*c+1]=m}for(let c=0;c<n;c++){let u=o[c];if(u.removedLength===0){l[2*c]=null;continue}let d=u.position,p=u.prevDir.clone().multiplyScalar(u.removedLength).add(d),f=u.nextDir.clone().multiplyScalar(u.removedLength).add(d),m=u.tan*u.removedLength,g=u.prevDir.clone().add(u.nextDir).normalize(),v=p.clone().lerp(f,.5),y=p.distanceTo(f)/2,x=g.clone().multiplyScalar(Math.sqrt(Math.pow(m,2)-Math.pow(y,2))).add(v),w=g.clone().multiplyScalar(-m).add(x),S=d.distanceTo(w)/d.distanceTo(v),b=u.prevDir.clone().multiplyScalar(S*d.distanceTo(p)).add(d),E=b.clone().lerp(w,2),_=p.clone().lerp(b,4/3),A=f.clone().lerp(E,4/3);l[2*c]=new Tp(p,_,A,f)}let h=new T8;return l.forEach(c=>{c&&h.add(c)}),h}var Tt;(e=>{function t(i){return i&&i.__isEntity}e.is=t})(Tt||(Tt={}));var Ka=e=>Tt.is(e),P8={type:"completeState",isfromEntity:!0},D8=["x","y","z"],xc=new M,M_=new M(1,1,1),zg=new nt,E_=new Di,O8=new M().set(0,1,0),sx=e=>class extends rx(e){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.currentAnimationAction=null,this.reversibleToState=null,this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new A_,this._recursiveBBox=new A_,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(t){let i=this.children[t];if(Tt.is(i))return i}entityChildrenCount(){let t=this.children.length;for(;t--;)if(Tt.is(this.children[t]))return t+1;return 0}get isConcreteEntity(){return typeof this.identity=="string"}get isVirtualEntity(){return typeof this.identity!="string"}get isInstanceRoot(){return this.isConcreteEntity&&this.data.type==="Instance"}nearestInstanceSelfOrParent(){let t=this;for(;t.data.type!=="Instance";){let i=t.parent;if(Tt.is(i))t=i;else return}return t}forInstancesRec(t){this.instances.forEach(i=>{i.disposed||t(i),i.forInstancesRec(t)})}super_Entity(t,i){typeof t=="string"&&(this.uuid=t),this.identity=t,this.data=i,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(t,i,r=!1){if(!(this.data.states.length===0&&!r)){for(let s of this.data.states)Zn.toOps(this.data,s.data).forEac
vendor: 11,069 bytes, line 3139
3139h(a=>{let n=pf.replaceProps(a,this.data);this.dataPatched=this.data,this.updateByPatchedOp(n,this.data,i)});if(t!==null){let s=this.data.states.data(t);s&&(this.dataPatched=Zn.patch(this.data,s),Zn.toOps(this.data,s).forEach(a=>{this.updateByPatchedOp(a,this.dataPatched,i)}))}r&&this.updateTransformState(this.dataPatched,i),this.stateSelection=t,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(t,i){t.setScalar(0),i.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(t=>{Ka(t)&&t.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(t=>{t.resetBBoxNeedsUpdateSelf()})}find(t){let i;return this.traverseEntity(r=>{r.uuid===t&&(i=r)}),i}traverseSortNextHelper(){let t=this.parent;if(t){let i=t.children,r=i.indexOf(this)+1;if(Tt.is(i[r]))return i[r];if(Tt.is(t))return t.traverseSortNextHelper()}}sortNext(){let t=this.children;return this.children.length>0&&Tt.is(this.children[0])?t[0]:this.traverseSortNextHelper()}goUp(t){let i=this;for(;t>0&&i!==null;)i=i.parent,t-=1;return i}hasAnccestorOrSelf(t){return this===t||this.hasAnccestor(t)}hasAnccestor(t){let i=this.parent;for(;i;){if(t===i)return!0;i=i.parent}return!1}countToAccestor(t){let i=0,r=this;for(;r!==t;){if(r===null)return-1;r=r.parent,i+=1}return i}forEachEntity(t){for(let i of this.children)Ka(i)&&t(i)}traverseEntityAncestors(t){this.traverseAncestors(i=>{Tt.is(i)&&t(i)})}traverseConcreteEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)Ka(r)&&r.isConcreteEntity&&r.traverseEntity(t,i+1)}traverseEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)Ka(r)&&r.traverseEntity(t,i+1)}traverseVisibleEntity(t){t(this);for(let i of this.children)Ka(i)&&i.visible&&i.traverseVisibleEntity(t)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(t){super.updateMatrixWorld(t),this.dispatchEvent({type:"updateMatrixWorld"})}copy(t,i=!1){return super.copy(t,i),this.dataPatched=t.dataPatched,this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),this}hasEntityChild(){return this.children.some(t=>Ka(t))}isAncestorOf(t){if(this.uuid===t)return!1;let i=!1;return this.traverseEntity(r=>{r.uuid===t&&(i=!0)}),i}toObjectTransformState(t=[]){this.updateWorldMatrix(!0,!1);let i={position:this.position.toArray(),rotation:[this.rotation.x*Te.RAD2DEG,this.rotation.y*Te.RAD2DEG,this.rotation.z*Te.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]};return u0(i,t)}getTransformValues(t,i,r){return i[t].map((s,a)=>r?.shared.getVariable(s,[this.uuid,t,D8[a]])??s)}updateTransformState(t,i){let r=!1;if(t.position&&(this.position.fromArray(this.getTransformValues("position",t,i)),r=!0),t.rotation&&(xc.fromArray(this.getTransformValues("rotation",t,i)).multiplyScalar(Te.DEG2RAD),this.rotation.setFromVector3(xc),r=!0),t.scale&&(this.scale.fromArray(this.getTransformValues("scale",t,i)),r=!0),t.hiddenMatrix!==void 0&&(r=!0,this.hiddenMatrix.fromArray(t.hiddenMatrix??Th.identity)),t.pivot!==void 0||t.pivotRotation!==void 0){if(r=!0,t.pivot!==void 0&&t.pivotRotation!==void 0)this.pivotMatrix.compose(xc.fromArray(t.pivot).negate(),zg.setFromEuler(E_.fromArray(t.pivotRotation.map(s=>s*Te.DEG2RAD))).invert(),M_);else if(t.pivot!==void 0)this.pivotMatrix.setPosition(-t.pivot[0],-t.pivot[1],-t.pivot[2]);else if(t.pivotRotation!==void 0){let s=xc.setFromMatrixPosition(this.pivotMatrix);zg.setFromEuler(E_.fromArray(t.pivotRotation.map(a=>a*Te.DEG2RAD))).invert(),this.pivotMatrix.compose(s,zg,M_)}}return r&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(s=>{s.invalidateClonerTransform(this)})),t.position&&t.rotation&&t.scale&&t.hiddenMatrix!==void 0&&this.updateWorldMatrix(!1,!0),r}onVariableUpdate(t=!1){if(t){this.resetBBoxNeedsUpdate();return}this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(i=>{i.invalidateClonerTransform(this)}),this.requestRender()}dispose(){this.disposed=!0,this.cloner&&(this.cloner.removeFromParent(),this.cloner=void 0)}disposeChildrenRecursively(){for(let t of this.children)Tt.is(t)&&t.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(t=>{Tt.is(t)&&t.disposeRecursively()})}toState(t=[]){let i={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(t)};return u0(i,t)}updateByObjUpdateOp(t,i){t!==void 0&&this.updateByOp({type:0,props:t,path:[]},{...this.data,...t},i,!1)}updateByOp(t,i,r,s){let a=this.data;this.data=i;let n=t,o=Qt(t.path,["states","*"]);if(o!==null){if(t.type===0){let[l]=o;if(this?.stateSelection===l){let h={...t.props};if(delete h.name,Object.values(t.props).some(c=>c===void 0)){let c=this.data;if(c!==void 0){let u=Hi.zoom(c,t.path.slice(2));if(u)for(let d in t.props)t.props[d]===void 0&&d in u&&(h[d]=u[d])}}n={...t,props:h,path:t.path.slice(2)}}}}else if(t.type===0){let l=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(l!==void 0){if(t.props.name!==void 0&&l.name){let{name:c,...u}=l;l=u}if(t.props.material!==void 0&&"material"in l){let{material:c,...u}=l;l=u}let h=Hi.removeOverridden(t.path,t.props,l);n={...t,props:h}}}if(this.updateByPatchedOpBase(n,Zn.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),r),Qt(t.path,["overrides"])){let l=[],h=[...t.path];for(l.push(h[1]),h.splice(0,2);h.length>0&&h[0]==="descendants";)l.push(h[1]),h.splice(0,2);if(l[l.length-1]===void 0){if(t.type===0)for(let c of Object.keys(t.props)){l[l.length-1]=c;let u=r.scene.findInstance([this.uuid,...l]);u&&(u.overrideData=t.props[c],u.updateState(ro.apply(u.component.data,u.overrideData),r))}}else{let c=r.scene.findInstance([this.uuid,...l]);if(c){let u=Hi.zoom(c.component.data,h);if(t={...t,path:h},t.type===0){let d=t.props;if(u)for(let[p,f]of Object.entries(t.props))f===void 0&&(d===t.props&&(d={...t.props}),d[p]=u[p]);t={...t,props:d}}c.overrideData=Ef.resolve(i.overrides,l),c.updateByOp(t,ir.applySimple(c.data,t),r,!1)}}}else if(this.instances.length>0){let l;if(t.path.length===0&&t.type===0){let h;for(let c of Kn.rootOverrideProps)c in t.props&&(h===void 0&&(h={}),h[c]=t.props[c]);h&&(l={...t,props:h})}else for(let h of Kn.rootOverrideProps)if(Qt(t.path,[h])){l=t;break}l!==void 0&&this.instances.forEach(h=>{if(h.isInstanceRoot){let c=ro.filterOp(h.overrideData,l);c&&h.updateByOp(c,ir.applySimple(h.data,c),r,!0)}}),this.instances.forEach(h=>{if(!h.isInstanceRoot){let c=ro.filterOp(h.overrideData,t);if(c){let u;a===h.data&&t===c?u=i:u=ir.applySimple(h.data,c),h.updateByOp(c,u,r,!0)}}})}}updateByPatchedOpBase(t,i,r){if(this.dataPatched=i,t.path.length===0&&t.type===0)t.props.type!==void 0&&!il.is(t.props.type)&&Jn.changeEntityProptotype(this,i,r);else if(t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&"type"in t.props){Jn.changeEntityProptotype(this,i,r);for(let s of this.children)Tt.is(s)&&s.updateVisible(r.scene)}this.updateByPatchedOp(t,i,r)}updateByPatchedOp(t,i,r){if(t.path.length===0&&t.type===0?this.updateState(t.props,r):t.type===0&&("resolutionLevel"in t.props||"useChildrenColors"in t.props)&&this.updateState(i,r),t.path[0]==="morphTargetInfluences"&&t.type===0){let s=i.morphTargetInfluences.get(t.path[1])?.data.name;s&&this.updateMorphInfluences(s,r.shared.getVariable(t.props.value,[this.uuid,"morphTargetInfluences",s]))}if(Qt(t.path,["pathSnapping"])!==null&&this.updatePathSnapping(i.pathSnapping),Qt(t.path,["cloner"])!==null){let s=ir.drop(t,1);s.path.length===0&&s.type===0&&s.props.disabled===!0?this.setFromClonerState(null,r):this.cloner?this.cloner.updateState(i.cloner,r):(this.setFromClonerState(i.cloner,r),this.expandCloner(r)),this.updateVisible(r.scene)}}updatePathSnapping(t=this.dataPatched.pathSnapping){this._updatedPathSnapping=t,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(t){let i=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,r=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,s=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,a=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(i===null)return;let n=t.find(i);if(!n||this._needApplyPathSnapping===!1)return;this._needApplyPathSnapping=!1;let o=n.data;if(o.geometry.path.points.length<=1)return;let l=UC(o.geometry.path),h=(r+s)%1;r+s===1&&h===0&&(h=1);let c=null;try{c=l.curves.length?l.getPointAt(h):null}catch{}if(c===null)return;let u=this.parent?this.parent?.matrixWorld:new xe;n.updateMatrixWorld();let d=new xe().multiplyMatrices(u.clone().invert(),n.matrixWorld);c.applyMatrix4(d);let p={position:c.toArray(),rotation:o.rotation};if(a==="tangential"){let f=new xe().extractRotation(n.matrixWorld),m=l.getTangentAt(h).applyMatrix4(f).add(c),g=new xe().lookAt(c,m,O8),v=xc.setFromEuler(new Di().setFromRotationMatrix(g)).multiplyScalar(Te.RAD2DEG);p={...p,rotation:v.toArray()}}this.updateTransformState(p),this.traverseEntity(f=>{f._cameraType&&f.dispatchEvent(P8)})}updateVisible(t){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||this.dataPatched.cloner?.hideBase!==!0),!t)return;let i=!1;this.traverseEntity(r=>{if(r.data.type==="Splat")return i=!0,!0}),i&&t.reloadSplats()}updateState_Entity(t,i){t.name!==void 0&&(this.name=t.name),t.raycastLock!==void 0&&(this.raycastLock=t.raycastLock),t.visible!==void 0&&(this.updateVisible(i?.scene),this.resetBBoxNeedsUpdate()),i&&"cloner"in t&&t.cloner!==void 0&&(this.setFromClonerState(t.cloner,i),this.updateVisible(i.scene)),this.updateTransformState(t,i)}get attachedSurfaceCloners(){return this.children.filter(t=>t instanceof Jn.Cloner&&t.parameters.type==="toObject")}setFromClonerState(t,i){this.disposed||(t===null||t.disabled?(this.cloner&&this.cloner.removeFromParent(),this.cloner=void 0):this.cloner===void 0?(this.cloner=new Jn.Cloner(this,t),i.scene.addPendingExpandCloner(this)):this.cloner.updateState(t,i))}expandCloner(t){!this.disposed&&this.cloner&&this.cloner.expandClones(t)}invalidateClonerTransform(t){this.cloner&&this.cloner.invalidateTransform(t)}requestRender(){this.dispatchEvent({type:"requestRender"})}},NC=class{static create(e){return this.build(this.normalizeInputs(e))}
3139static normalizeInputs(e,t){let i=e.parameters?.radiusTop,r=e.parameters?.radiusBottom,s=Object.assign({},t?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},e.parameters);s.thetaLength=Te.clamp(s.thetaLength,0,360);let a=s.width/2,n=s.radiusTop??a,o=s.radiusBottom??a;if(n===o?(n=a,o=a):n>o?(n=a,o=o*a/n):(n=n*a/o,o=a),s.shapeBlendNode){n=i??a,o=r??a;let l=Math.max(n,o)*2;s.width=l,s.depth=l}return{parameters:Object.assign(s,{width:Math.abs(s.width),height:Math.abs(s.height??s.width),depth:Math.abs(s.depth??s.width),radiusTop:n,radiusBottom:o})}}static build(e){let{width:t,depth:i,height:r,radialSegments:s,heightSegments:a,openEnded:n,thetaStart:o,thetaLength:l,radiusTop:h,radiusBottom:c,cornerRadius:u,cornerSegments:d,hollow:p}=e.parameters,f;return l===0?(f=new He,f.setAttribute("position",new De([],3))):u||p?f=new VC(h,c,r,s,a,n,o,l*Math.PI/180,u,u,d,p):f=new a1(h,c,r,s,a,n,o,l*Math.PI/180),f.scale(1,1,i/t),Object.assign(f,{userData:{...e,type:"CylinderGeometry"}})}};function Tn(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}function C_(e){return new H(e.y,-e.x)}var VC=class extends He{constructor(e,t,i,r,s,a,n,o,l,h,c,u,d=!1){super(),this.type="RoundedCylinderBufferGeometry",e=e!==void 0?e:1,t=t!==void 0?t:1,i=i||1,r=Math.floor(r)||8,s=Math.floor(s)||1,a=a!==void 0?a:!1,n=n!==void 0?n:0,o=o!==void 0?o:Math.PI*2,a&&(l=0,h=0);let p=[],f=[],m=[],g=[],v=0,y=i/2,x=new M,w=new M;d&&e==0&&(e=l),d&&t==0&&(t=h);let S=new H(e,y),b=new H(t,-y),E=null,_=null,A=null,C=null,T=S.clone().sub(b),I=0,P=0,O=0;u>0&&(I=Math.min(e,t)*(1-u),P=e-I,O=t-I);let k=S.clone();k.x-=I;let G=Math.PI-T.angle(),B=T.angle(),U=Math.tan(B/2),Q=Math.tan(G/2),q=U+Q,j=u?q:Q,X=u?q:U;if(l=Math.min(l,(e-P)/j,T.length()/q),h=Math.min(h,(t-O)/X,T.length()/q),l>0){let $=l/U;E=S.clone().sub(new H($,l)),u&&(A=E.clone(),A.x-=I-q*l),S.sub(T.clone().setLength($))}if(h>0){let $=h/Q;_=b.clone().sub(new H($,-h)),b.add(T.clone().setLength($)),u&&(C=_.clone(),C.x-=I-q*h,k.sub(T.clone().setLength($)))}T=S.clone().sub(b);let te=T.length()<.5,K=[];for(let $=0;$<=r;$++){let ne=[],ie=$/r,ve=ie*o+n,de=new H(Math.sin(ve),Math.cos(ve));C&&_?(Z(ne,ie,de,G,h,C,-1,!0),Z(ne,ie,de,B,h,_,-1,!1)):_?(W(ne,de,_.x,0,-1),Z(ne,ie,de,B,h,_,-1,!1)):a||W(ne,de,t,O,-1);let we=C_(T).normalize();if(Tn(we,de,x),!te)for(let Re=0;Re<=s;Re++){let Me=Re/s,Ve=T.clone().multiplyScalar(Me).add(b);Tn(Ve,de,w),f.push(w.x,w.y,w.z),m.push(x.x,x.y,x.z),g.push(ie,.5+w.y/i),ne.push(v++)}if(A&&E?(Z(ne,ie,de,G,l,E,1,!1),Z(ne,ie,de,B,l,A,1,!0)):E?(Z(ne,ie,de,G,l,E,1,!1),W(ne,de,E.x,0,1)):a||W(ne,de,e,P,1),u&&!te){let Re=C_(T).multiplyScalar(-1).normalize();Tn(Re,de,x);for(let Me=0;Me<=s;Me++){let Ve=Me/s,Ne=T.clone().multiplyScalar(-Ve).add(k);Tn(Ne,de,w),f.push(w.x,w.y,w.z),m.push(x.x,x.y,x.z),g.push(ie,.5+w.y/i),ne.push(v++)}}
3139u&&!a&&ne.push(ne[0]),K.push(ne)}for(let $=0;$<K.length-1;$++)for(let ne=0;ne<K[0].length-1;ne++){if(a&&u&&ne==s)continue;let ie=K[$][ne],ve=K[$+1][ne],de=K[$+1][ne+1],we=K[$][ne+1],Re=f[de*3+0],Me=f[de*3+2];p.push(ie,ve,we),(Re!=0||Me!=0)&&p.push(ve,de,we)}o<Math.PI*2&&(re(-1,K[0],n),re(1,K[K.length-1],n+o)),this.setIndex(p),this.setAttribute("position",new De(f,3)),this.setAttribute("normal",new De(m,3)),this.setAttribute("uv",new De(g,2));function Z($,ne,ie,ve,de,we,Re,Me){for(let Ve=0;Ve<c+1;Ve++){let Ne=Ve/c,Oe=Re<0?Ne:1-Ne;Me&&(Oe-=1),Oe*=ve;let Ee=new H(Math.sin(Oe),Math.cos(Oe)*Re),Qe=Ee.clone().multiplyScalar(de).add(we);Tn(Qe,ie,w),f.push(w.x,w.y,w.z),Tn(Ee,ie,x),m.push(x.x,x.y,x.z),g.push(ne,.5+w.y/i),$.push(v++)}}function W($,ne,ie,ve,de){let we=new M,Re=new H,Me=[ie,ve];de<0&&Me.reverse();for(let Ve of Me)Re.set(Ve,y*de),Tn(Re,ne,we),f.push(we.x,we.y,we.z),m.push(0,de,0),g.push(.5,.5),$.push(v++)}function re($,ne,ie){let ve=new H(Math.sin(ie),Math.cos(ie)),de=new H(-Math.cos(ie),Math.sin(ie)),we=new M,Re=$<0?(Ne,Oe,Ee)=>p.push(Ne,Oe,Ee):(Ne,Oe,Ee)=>p.push(Ne,Ee,Oe),Me=new H((e+t+P+O)/4,0);Tn(Me,ve,we),f.push(we.x,we.y,we.z),m.push(de.x,0,de.y),g.push(.5,.5);let Ve=v++;for(let Ne of ne){let Oe=f.slice(Ne*3,Ne*3+3);f.push(...Oe),m.push(de.x,0,de.y);let Ee=g.slice(Ne*2,Ne*2+2);g.push(...Ee),v++}for(let Ne=Ve+1;Ne<v-1;Ne++)Re(Ve,Ne,Ne+1);Re(Ve,v-1,Ve+1)}}},I8=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},e.parameters);return i.thetaLength=Te.clamp(i.thetaLength,0,360),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,depth:i,height:r,radialSegments:s,heightSegments:a,openEnded:n,thetaStart:o,thetaLength:l,cornerRadiusTop:h,cornerRadiusBottom:c,cornerSegments:u}=e.parameters,d;return l===0?(d=new He,d.setAttribute("position",new De([],3))):h>0||c>0||l<360?d=new VC(0,t/2,r,s,a,n,o,l*Math.PI/180,h,c,u,0,!0):d=new n1(t/2,r,s,a,n),d.scale(1,1,i/t),Object.assign(d,{userData:{...e,type:"ConeGeometry"}})}},R8=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,widthSegments:s,heightSegments:a,depthSegments:n,cornerRadius:o,cornerSegments:l}=e.parameters,h;return o===0?h=new Hs(t,i,r,s,a,n):h=new L8(t,i,r,s,a,n,o,l),Object.assign(h,{userData:{...e,type:"CubeGeometry"}})}},Bg=Math.PI/2,L8=class extends He{constructor(e=1,t=1,i=1,r=1,s=1,a=1,n=0,o=4){super(),this.type="BoxGeometry",r=Math.floor(r),s=Math.floor(s),a=Math.floor(a),o=Math.floor(o),n=Math.min(n,e/2,t/2,i/2);let l=[],h=[],c=[],u=[],d=0;p("z","y","x",-1,-1,i,t,e,a,s),p("z","y","x",1,-1,i,t,-e,a,s),p("x","z","y",1,1,e,i,t,r,a),p("x","z","y",1,-1,e,i,-t,r,a),p("x","y","z",1,-1,e,t,i,r,s),p("x","y","z",-1,-1,e,t,-i,r,s),n>0&&(f("z","y","x",-1,-1,1,i,t,e,a),f("z","y","x",1,-1,-1,i,t,e,a),f("z","y","x",-1,1,-1,i,t,e,a),f("z","y","x",1,1,1,i,t,e,a),f("x","y","z",-1,-1,-1,e,t,i,r),f("x","y","z",1,-1,1,e,t,i,r),f("x","y","z",-1,1,1,e,t,i,r),f("x","y","z",1,1,-1,e,t,i,r),f("y","x","z",-1,-1,1,t,e,i,s),f("y","x","z",1,-1,-1,t,e,i,s),f("y","x","z",1,1,1,t,e,i,s),f("y","x","z",-1,1,-1,t,e,i,s),m(1,1,1),m(-1,1,1),m(1,-1,1),m(-1,-1,1),m(1,1,-1),m(-1,1,-1),m(1,-1,-1),m(-1,-1,-1)),this.setIndex(l),this.setAttribute("position",new De(h,3)),this.setAttribute("normal",new De(c,3)),this.setAttribute("uv",new De(u,2));function p(g,v,y,x,w,S,b,E,_,A){let C=(S-2*n)/_,T=(b-2*n)/A,I=S/2-n,P=b/2-n,O=E/2,k=_+1,G=A+1,B=0,U=new M;for(let Q=0;Q<G;Q++){let q=Q*T-P;for(let j=0;j<k;j++){let X=j*C-I;U[g]=X*x,U[v]=q*w,U[y]=O,h.push(U.x,U.y,U.z),U[g]=0,U[v]=0,U[y]=E>0?1:-1,c.push(U.x,U.y,U.z),u.push(j/_),u.push(1-Q/A),B+=1}}for(let Q=0;Q<A;Q++)for(let q=0;q<_;q++){let j=d+q+k*Q,X=d+q+k*(Q+1),te=d+(q+1)+k*(Q+1),K=d+(q+1)+k*Q;
3139l.push(j,X,K),l.push(X,te,K)}d+=B}function f(g,v,y,x,w,S,b,E,_,A){let C=(b-2*n)/A,T=b/2-n,I=E/2-n,P=_/2,O=A+1,k=0,G=new M,B=new M;for(let U=0;U<o+1;U++){let Q=U/o*Bg,q=Math.sin(Q)*n,j=(1-Math.cos(Q))*n,X=Math.sin(Q),te=Math.cos(Q);G[v]=(I+q)*w,G[y]=(P-j)*S,B[g]=0,B[v]=X*Math.sign(G[v]),B[y]=te*Math.sign(G[y]);for(let K=0;K<O;K++){let Z=K*C-T;G[g]=Z*x,h.push(G.x,G.y,G.z),c.push(B.x,B.y,B.z),u.push(K/A),u.push(0),k+=1}}for(let U=0;U<o;U++)for(let Q=0;Q<A;Q++){let q=d+Q+O*U,j=d+Q+O*(U+1),X=d+(Q+1)+O*(U+1),te=d+(Q+1)+O*U;l.push(q,j,te),l.push(j,X,te)}d+=k}function m(g,v,y){let x=new M,w=new M(e/2,t/2,i/2);w.subScalar(n);let S=[],b=g*v*y>0?(_,A,C)=>l.push(_,A,C):(_,A,C)=>l.push(_,C,A);for(let _=0;_<=o;_++){let A=[],C=Bg*(1-_/o),T=Math.cos(C),I=Math.sin(C),P=0;for(let O=0;O<=_;O++){let k=Math.cos(P),G=Math.sin(P);x.x=T*k,x.y=I,x.z=T*G;let B=w.clone().addScaledVector(x,n);h.push(g*B.x,v*B.y,y*B.z),c.push(g*x.x,v*x.y,y*x.z),u.push(0,0),A.push(d++),P+=Bg/_}S.push(A)}let E=S.length-1;for(let _=0;_<E;_++){let A=S[_],C=S[_+1],T=A.length-1;b(A[0],C[1],C[0]);for(let I=1;I<=T;I++)b(A[I-1],A[I],C[I]),b(A[I],C[I+1],C[I])}}}},ax=class extends He{constructor(e=[],t=[],i="",r=1,s=.2,a=4){super(),this.type="PolyhedronGeometryRound";let n=[],o=[],l=[];h(),c(),this.setAttribute("position",new De(n,3)),this.setAttribute("normal",new De(l,3)),this.setAttribute("uv",new De(o,2));return;function h(){s=Math.min(1-1e-5,s),s==0&&(a=0);let u={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],d=new M,p=d.clone(),f=new fr,m=s*r,g=r-m,v=a+1,y=new M,x=(B,U)=>y.subVectors(B,U).normalize(),w=(B,U)=>Array(B).fill(void 0).map(U),S=w(e.length/3,(B,U)=>new M().fromArray(e,U*3).setLength(r)),b=[],E=1e6;for(let B=0;B<S.length;B++){let U=S[B],Q=[],q,j,X,te=1e10,K=-1;for(;(K=t.indexOf(B,K+1))!=-1;){let $=K-K%3;q=t[$+(K+1)%3],j=t[$+(K+2)%3],X=U.distanceToSquared(S[q]),te=Math.min(te,X),Q.push([q,j,X])}te+=1e-6;let Z=[],W=0,re=Q.length;for(let $=0;$<re;$++){[q,j,X]=Q[W];let ne=b[q]?.includes(B)==!0;X<=te&&Z.push(q+ +ne*E),W=Q.findIndex(ie=>ie[0]==j)}b.push(Z)}let _=[];{let B=0,U=0,Q,q,j=u==3;for(let X=0;X<=a;X++){Q=X*(X+1)/2,q=(X+1)*(X+2)/2;for(let te=0;te<a-X;te++)[B,U]=[Q+te+X+2,q+te+X+3],_.push(Q,q,...j?[U,Q]:[B,q],U,B),[Q,q]=[B,U];_.push(Q,q,Q+a+2)}}let A=d.clone(),C=d.clone(),T=d.clone(),I=d.clone(),P=d.clone(),O=[],k=w(S.length,()=>w(u,()=>d.clone()));for(let B=0;B<S.length;B++){d.copy(S[B]).normalize(),A.copy(d).multiplyScalar(g);let U=b[B];for(let Z=0;Z<U.length;Z++){let W=U[Z],re=U[(Z+1)%u];f.setFromPointsAndIndices(S,B,W%E,re%E),f.b.sub(f.a).setLength(1e10).add(f.a),f.c.sub(f.a).setLength(1e10).add(f.a),f.closestPointToPoint(A,k[B][Z])}let Q=[],q=[],j=[],X=new M;a==0&&[...k[B]].reduce((Z,W)=>Z.add(W),X).multiplyScalar(1/u);for(let Z=0;Z<u;Z++){let W=[],re=(Z-1+u)%u,$=k[B][re],ne=k[B][Z];d.copy($).sub(A),p.copy(ne).sub(A);let ie=A.angleTo(d),ve=d.angleTo(p),de=Math.cos(ie)*m;a==0?C.copy(X):C.copy(A).setLength(g+de),q.push(de);let we=[C,$,ne];for(let Re=0;Re<2;Re++){let Me=we[Re],Ve=we[Re+1];I.subVectors(Me,A),P.subVectors(Ve,A),T.crossVectors(I,P).normalize();for(let Ne=0;Ne<v;Ne++){let Oe=[ie,ve][Re]*Ne/v;d.copy(I).applyAxisAngle(T,Oe).add(A),Q.push(d.clone()),Re&&(x(d,A),W.push([Ne==0?Me:d.clone(),y.clone()]))}Re&&(x(Ve,A),W.push([Ve,y.clone()]))}j.push(W)}O.push(j);let te=2*v,K=2;for(let Z=0;Z<u;Z++){let W=te*Z,re=te*((Z+1)%u),$=[Q[W]];for(let ie=1;ie<v;ie++){I=Q[W+ie],P=Q[re+ie],$.push(I);for(let ve=1,de=ie-K+1;ve<=de;ve++)d.lerpVectors(I,P,ve/(de+1)),d.sub(A).setLength(q[Z]).add(A),$.push(d.clone());$.push(P)}for(let ie=0;ie<v;ie++)$.push(Q[ie+v+W]);$.push(Q[re+v]);let ne=_.map(ie=>$[ie]);n.push(...ne.map(ie=>[ie.x,ie.y,ie.z]).flat()),l.push(...ne.map(ie=>(x(ie,A),[y.x,y.y,y.z])).flat())}}let G=[];for(let B=0;B<b.length;B++)for(let U=0;U<u;U++){let Q=b[B][U];if(Q<E){let q=b[Q].findIndex(te=>te%E==B),j=O[B][U],X=O[Q][q];for(let te=0;te<v;te++){let K=j[te],Z=X[v-te],W=j[te+1],re=X[v-(te+1)];[K,Z,W,W,Z,re].forEach($=>{n.push($[0].x,$[0].y,$[0].z),l.push($[1].x,$[1].y,$[1].z)})}G.push(j[0][0],X[v][0],j[v][0],X[0][0])}}for(;G.length;){let B,U,Q,q;[B,U]=G.splice(0,2);let j=[B];for(;B!=U;)j.push(U),Q=G.indexOf(U),q=Q%2,U=G.splice(Q-q,2)[1-q];y.subVectors(j[0],j[1]).cross(d.subVectors(j[0],j[2])).normalize();let X=y.dot(j[0])<0;X&&y.negate();for(let te=1;te<=j.length-2;
vendor: 44,086 bytes, line 3139
3139te++)[j[te+ +X],j[te+1-+X],j[0]].forEach(K=>{n.push(K.x,K.y,K.z),l.push(y.x,y.y,y.z)})}}function c(){let u=new M;for(let b=0;b<n.length;b+=3){u.x=n[b+0],u.y=n[b+1],u.z=n[b+2];let E=w(u)/2/Math.PI+.5,_=S(u)/Math.PI+.5;o.push(E,1-_)}let d=new M,p=new M,f=new M,m=new M,g=new H,v=new H,y=new H,x=(b,E,_,A)=>{A<0&&b.x===1&&(o[E]=b.x-1),_.x===0&&_.z===0&&(o[E]=A/2/Math.PI+.5)};for(let b=0,E=0;b<n.length;b+=9,E+=6){d.set(n[b+0],n[b+1],n[b+2]),p.set(n[b+3],n[b+4],n[b+5]),f.set(n[b+6],n[b+7],n[b+8]),g.set(o[E+0],o[E+1]),v.set(o[E+2],o[E+3]),y.set(o[E+4],o[E+5]),m.copy(d).add(p).add(f).divideScalar(3);let _=w(m);x(g,E+0,d,_),x(v,E+2,p,_),x(y,E+4,f,_)}for(let b=0;b<o.length;b+=6){let E=o[b+0],_=o[b+2],A=o[b+4],C=Math.max(E,_,A),T=Math.min(E,_,A);C>.9&&T<.1&&(E<.2&&(o[b+0]+=1),_<.2&&(o[b+2]+=1),A<.2&&(o[b+4]+=1))}function w(b){return Math.atan2(b.z,-b.x)}function S(b){return Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))}}}static fromJSON(e){return new ax(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}},z8=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,detail:s,corner:a,cornerSides:n}=e.parameters,o=s===0&&a!==0?new jC(t*.5,a,n):new PM(t*.5,s);return o.scale(1,i/t,r/t),Object.assign(o,{userData:{...e,type:"DodecahedronGeometry"}})}},jC=class extends ax{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,s=1/r,a=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-r,0,-s,r,0,s,-r,0,s,r,-s,-r,0,-s,r,0,s,-r,0,s,r,0,-r,0,-s,r,0,-s,-r,0,s,r,0,s],n=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],o="DodecahedronGeometry";super(a,n,o,e,t,i),this.type=o}static fromJSON(e){return new jC(e.radius,e.corner,e.cornerSides)}},bc=1e-12,nx=class{constructor(e){this.position=new H,this.startPosition=new H,this.uuid=Te.generateUUID(),this.position=e.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(e){this.position.copy(this.startPosition).add(e)}copy(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}clone(){return new nx(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},uy=class extends nx{constructor(e){super(e.position),this.parent=e}copy(e){return super.copy(e),this}clone(){return new uy(this.parent).copy(this)}},fh=class extends nx{constructor(e,t){super(t),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=e,this.controls.push(new uy(this),new uy(this))}static create(e,t){let i=new fh(e,new H(...t.position));return i.controls[0].position.set(...t.controlPrevious.position),i.controls[1].position.set(...t.controlNext.position),i.roundness=t.roundness,i.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored,i}getOppositeControl(e){let t=this.controls.indexOf(e);return t===0?this.controls[1]:t===1?this.controls[0]:null}applyOffsetToControls(e,t=1){for(let i=0,r=this.controls.length;i<r;i++){let s=this.controls[i];this.position.distanceTo(s.position)<=t?s.position.copy(this.position):s.applyOffset(e)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(e){return super.copy(e),this.controls[0].copy(e.controls[0]),this.controls[1].copy(e.controls[1]),this.roundness=e.roundness,this.uuid=e.uuid,this}clone(){return new fh(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){let e=this.curveBefore?.getTangentAt(1),t=this.curveAfter?.getTangentAt(0);return[e,t]}computeNormals(e=new H,t=new H){let[i,r]=this.computeTangents();return i&&r&&(T_(i,e),T_(r,t)),[e,t]}computeTangent(e=new H){let[t,i]=this.computeTangents();return t&&i&&e.copy(t).add(i).normalize(),e}computeNormal(e=new H){let[t,i]=this.computeNormals();return e.copy(t).add(i).normalize(),e}};function T_(e,t=new H){let i=e.length();return t.set(-e.y/i,e.x/i)}var ox=e=>e,ec=new H,xm=new H,B8=new H,F8=new H,k8=new H,U8=new H,HC=new M,GC=new M;function N8(e){let t=new H;t.addVectors(e.v0,ec.subVectors(e.v1,e.v0).multiplyScalar(2/3));let i=new H;return i.addVectors(e.v2,xm.subVectors(e.v1,e.v2).multiplyScalar(2/3)),new Fs(e.v0,t,i,e.v2)}function Vc(e,t,i=Number.EPSILON){return Math.abs(e-t)<i}function V8(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function j8(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function WC(e,t,i){let r=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),s=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)),a=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2));return Math.acos((s*s+r*r-a*a)/(2*s*r))}function H8(e,t,i){return D_(e,t)&&D_(t,i)&&dy(e.position,t.position,i.position)}function dy(e,t,i){return ec.copy(t).sub(e).cross(xm.copy(i).sub(e))===0}function G8(e,t,i,r,s){let a=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),n=(e.y+t.y)/2,o=(e.x+t.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(a/2,2))*(e.y-t.y)/a,h=Math.sqrt(Math.pow(i,2)-Math.pow(a/2,2))*(t.x-e.x)/a;return r.set(o+l,n+h),s.set(o-l,n-h),[r,s]}function W8(e,t,i){let r=e.distanceTo(i),s=t.distanceTo(i);return r<s?t:e}function q8(e,t,i,r,s,a){let n=t.x-e.x,o=t.y-e.y,l=i.x-e.x,h=i.y-e.y,c=Math.sqrt((n+l)*(n+l)+(o+h)*(o+h)),u;return WC(t,e,i)>Math.PI&&(c*=-1),Vc(h,o)?u=(o+h)*(r/c-.5)*8/3/(n-l):u=(n+l)*(r/c-.5)*8/3/(h-o),s.set(t.x-u*o,t.y+u*n),a.set(i.x+u*h,i.y-u*l),[s,a]}function P_(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function D_(e,t){return dy(e.position,e.controls[1].position,t.position)&&dy(e.position,t.controls[0].position,t.position)}function X8(e,t,i,r,s=.5){let a=ec.subVectors(t,e).multiplyScalar(s).add(e),n=xm.subVectors(i,t).multiplyScalar(s).add(t),o=B8.subVectors(r,i).multiplyScalar(s).add(i),l=a,h=F8.subVectors(n,a).multiplyScalar(s).add(a),c=k8.subVectors(o,n).multiplyScalar(s).add(n),u=o,d=U8.subVectors(c,h).multiplyScalar(s).add(h);return[e.x,e.y,l.x,l.y,h.x,h.y,d.x,d.y,c.x,c.y,u.x,u.y,r.x,r.y]}function Y8(e,t,i=12,r=!0){let s=GC.set(0,0,0),a,n=0;for(let o=0;o<t.length;o++){let l=ox(t[o]),h=ec,c=Zo(l,i);for(let u=0;u<=c;u++)if(l instanceof Fs||l instanceof ho||l instanceof Ns){if(l.getPoint(u/c,h),s.set(h.x,h.y,0),a!==void 0&&j8(a,s))continue;a===void 0&&(a=HC),a.copy(s),e.setXYZ(n,s.x,s.y,s.z),n++}}return r&&n>1&&!(e.getX(n-1)===e.getX(0)&&e.getY(n-1)===e.getY(0)&&e.getZ(n-1)===e.getZ(0))&&(e.setXYZ(n,e.getX(0),e.getY(0),e.getZ(0)),n++),e}function Q8(e,t,i,r=12,s=!0){let a=GC.set(0,0,0),n=0,o=[];for(let l=0;l<t.length;l++){if(i[l]===!1)continue;let h,c=ox(t[l]),u=ec,d=Zo(c,r);o.push(d);for(let p=0;p<=d;p++)if(c instanceof Fs||c instanceof ho||c instanceof Ns){if(c.getPoint(p/d,u),a.set(u.x,u.y,0),h?.equals(a))continue;h===void 0?h=HC:(e.setXYZ(n,h.x,h.y,h.z),n++,e.setXYZ(n,a.x,a.y,a.z),n++),h.copy(a)}}return s&&n>1&&!(e.getX(n-1)===e.getX(0)&&e.getY(n-1)===e.getY(0)&&e.getZ(n-1)===e.getZ(0))&&(e.setXYZ(n,e.getX(0),e.getY(0),e.getZ(0)),n++),o}function O_(e,t=12,i=!1){let r=[];for(let s=0,a=e.length;s<a;s++){let n=e[s],o=0;if(i&&n.roundedCurveCorner!==void 0){let l=Zo(n.roundedCurveCorner,t)*.5;s>0&&(r[s-1]+=l),o+=l}n.curveAfter!==void 0&&(o+=Zo(n.curveAfter,t)),r.push(o)}return e.length>0&&i&&e[0].roundedCurveCorner!==void 0&&(r[e.length-1]+=Zo(e[0].roundedCurveCorner,t)*.5),r}function Zo(e,t=12){return e&&e instanceof tm?t*2:e&&(e instanceof Ns||e instanceof EM)?1:e&&e instanceof s1?t*e.points.length:t}function K8(e,t,i=12,r=!0){let s,a=0;for(let n=0;n<t.length;n++){let o=ox(t[n]),l=Zo(o,i),h=ec;for(let c=0;c<=l;c++)if(o instanceof Fs||o instanceof ho||o instanceof Ns){if(o.getPoint(c/l,h),s!==void 0&&V8(s,h,bc))continue;s===void 0&&(s=xm),s.copy(h),e.push(h.x,h.y),a++}}return Vc(e[0],e[e.length-2],bc)&&Vc(e[1],e[e.length-1],bc)&&(e.pop(),e.pop()),r&&a>1&&!(Vc(e[a-1],e[1],bc)&&Vc(e[a-2],e[0],bc))&&(e.push(e[0],e[1]),a++),e}var Fg=new H,Z8=new H,J8=new H,$8=new H,e9=new H,t9=new H,mi=class extends Zp{constructor(e=100,t=100){super(),this.points=[],this.shapeHoles=[],this.plane=new Hr(new M(0,0,-1)),this.subdivision=0,this.controlSnapDistance=4,this.pointIDs=0,this.isMesh2D=!1,this.isText=!1,this._roundness=0,this.isClosed=!1,this.useCubicForRoundedCorners=!0,this.uuid=Te.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=e,this._height=t}static createFromState(e,t,i){let r=new mi;return r.isClosed=e.isClosed,r.points=e.points.map(s=>fh.create(s.id,s.data)),typeof e.roundness=="number"&&(r.roundness=e.roundness),r.shapeHoles=e.shapeHoles.map(s=>mi.createFromState(s)),t!==void 0&&i!==void 0&&r.applySize(t,i),r.update(),r}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let t=0,i=this.points.length;t<i;t++)this.points[t].roundness=e;this.needsUpdate=!0}}getPointsIndexesByIds(e){return e.map(t=>this.getPointIndexById(t)).filter(t=>t>=0)}getPointIndexById(e){let t=this.points.length,i=this.points.findIndex(r=>r.uuid===e);if(i<0){let r=t;for(let s=0,a=this.shapeHoles.length;s<a;s++){let n=this.shapeHoles[s],o=n.points.length,l=n.getPointIndexById(e);if(l<0)r+=o;else return l+r}}return i}getLineIndexById(e){return this.getPointIndexById(e)}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0){let t=this.points.length;for(let i=0,r=this.shapeHoles.length;i<r;i++){let s=this.shapeHoles[i],a=e-t;if(a<=s.points.length-1)return s.points[a];t+=s.points.length}}throw new Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let t=this.points.indexOf(e);if(t>=0)return t;if(t=this.points.length,this.shapeHoles.length>0)for(let i=0,r=this.shapeHoles.length;i<r;i++){let s=this.shapeHoles[i],a=s.points.indexOf(e);if(a>=0)return t+a;t+=s.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(t=>t.points));return[...this.points,...e]}applySize(e,t){e===0&&(e=.001),t===0&&(t=.001),this._width=e,this._height=t}applyScale(e,t){let i=Fg.set(e,t);for(let r=0,s=this.points.length;r<s;r++){let a=this.points[r];a.position.multiply(i),a.controls[0].position.multiply(i),a.controls[1].position.multiply(i)}for(let r=0,s=this.shapeHoles.length;r<s;r++)this.shapeHoles[r].applyScale(e,t);this._update()}createPoint(e,t=0,i=Te.generateUUID()){let r;e instanceof H?r=e:r=new H(e,t);let s=new fh(i,r);return s.roundness=this.roundness,s}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,t){this.points.splice(t,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];if(r.uuid===e)return r}for(let t=0,i=this.shapeHoles.length;t<i;t++){let r=this.shapeHoles[t].getPointByUuid(e);if(r)return r}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let t=this.points.indexOf(e);t>=0&&this.points.splice(t,1),this.needsUpdate=!0}removePointById(e){let t=this.points.find(i=>i.uuid===e);t&&this.removePoint(t)}update(){for(let e=0,t=this.shapeHoles.length;e<t;e++)this.shapeHoles[e].update();this._update()}extractShapePointsToBuffer(e,t=12,i=!1){this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t);let r=i?this.roundedCurveDivisions:this.curveDivisions;return Y8(e,i?this.roundedCurves:this.curves,t,this.autoClose),r.reduce((s,a)=>s+a,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=O_(this.points,e,!1),this.roundedCurveDivisions=O_(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,i=12){return Q8(e,this.curves,t,i,this.autoClose).reduce((r,s)=>r+s,0)*2}extractShapePointsToFlatArray(e,t=12){return this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t),K8(e,this.roundedCurves,t,this.autoClose)}getCurveIndexFromVertexId(e,t=!1){let i=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let r=t?this.roundedCurveDivisions:this.curveDivisions,s=0;t&&this.points[0].roundedCurveCorner!==void 0&&(s=Zo(this.points[0].roundedCurveCorner,this.subdivision)*.5);let a=e-s;a<0&&(a+=r.reduce((n,o)=>n+o,0));for(let n=0,o=r.length;n<o;n++){let l=r[n];if(a<i+l)return[n,(a-i+1)/l];i+=l}return[0,1]}getCurveT(e,t,i){let r=this.points[e],s=this.points[e>=this.points.length-1?0:e+1],a=this.curveDivisions,n=a[e];if(P_(r,s)){let l=r.position.distanceTo(s.position);return r.position.distanceTo(Fg.set(i.x,i.y))/l}let o=0;for(let l=0;l<e;l++)o+=a[l];return(t-o)/n}dispose(){}_applyCurveForPoint(e,t){P_(t,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(t.controls[1].position.x,t.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let i=this.curves[this.curves.length-1];e.curveBefore=i,t.curveAfter=i;let r=i.clone();e.roundedCurveBefore=r,t.roundedCurveAfter=r,e.roundedCurveCorner=void 0,this.roundedCurves.push(r)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];if(t===0)this.moveTo(r.position.x,r.position.y);else{let s=this.points[t-1];this._applyCurveForPoint(r,s)}}let e=this.getLastPoint();if(e?.curveAfter&&(e.curveAfter=void 0),this.isClosed){let t=this.points[0],i=this.points[this.points.length-1];this._applyCurveForPoint(t,i)}if(this.points.length>2){let t=0;for(let i=0,r=this.points.length;i<r;i++){let s=this.points[i],a=this.points[i-1]??this.points[this.points.length-1],n=this.points[i+1]??this.points[0],o=s.roundness,l=a&&n&&H8(a,s,n);if(!s.controlsMoved()&&o>0&&!l){let h=s.curveBefore,c=s.curveAfter;if(h===void 0||c===void 0)continue;let u=s.roundedCurveBefore,d=s.roundedCurveAfter,p=h.getLength(),f=c.getLength(),m=Math.min(o,p*.499),g=Math.min(o,f*.499),v=Math.min(m,g),y=1-v/p,x=v/f,w=h.getPointAt(y,Fg),S=c.getPointAt(x,Z8);this._subSplitCurve(h,u,y,w,void 0),this._subSplitCurve(c,d,x,void 0,S);let b;if(this.useCubicForRoundedCorners){let E=WC(w,s.position,S)/2,_=Math.tan(E)*w.distanceTo(s.position),[A,C]=G8(w,S,_,J8,$8),T=W8(A,C,s.position),[I,P]=q8(T,w,S,_,e9,t9);b=new Fs(w.clone(),I.clone(),P.clone(),S.clone())}else b=new ho(w.clone(),s.position.clone(),S.clone());s.roundedCurveCorner=b,this.roundedCurves.splice(i+t,0,b),t++}}}}_subSplitCurve(e,t,i,r,s){if(e instanceof Ns)r!==void 0&&t.v2.copy(r),s!==void 0&&t.v1.copy(s);else{let a=e,n=t,o=a.getUtoTmapping(i,0),l=X8(a.v0,a.v1,a.v2,a.v3,o);return r!==void 0&&(n.v0.set(l[0],l[1]),n.v1.set(l[2],l[3]),n.v2.set(l[4],l[5]),n.v3.set(l[6],l[7])),s!==void 0&&(n.v0.set(l[6],l[7]),n.v1.set(l[8],l[9]),n.v2.set(l[10],l[11]),n.v3.set(l[12],l[13])),n}return t}clone(){let e=new mi(this._width,this._height);return e.points=this.points.map(t=>t.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(t=>t.clone()),e}toJSON(){return{points:this.points.reduce((e,t)=>e.concat(t.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){this.points=[],this.pointIDs=0;let t=e.points.length/7;for(let i=0;i<t;i++){let r=i*7,s=e.points[r+0],a=e.points[r+1],n=e.points[r+2],o=e.points[r+3],l=e.points[r+4],h=e.points[r+5],c=e.points[r+6],u=new fh(Te.generateUUID(),new H(s,a));u.controls[0].position.set(n,o),u.controls[1].position.set(l,h),u.roundness=c,this.points.push(u)}return this.shapeHoles=e.shapeHoles?.length?e.shapeHoles.map(i=>{let r=new mi;return r.fromJSON(i),r}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e,t=!1){this.isText=t;let i=(s,a)=>{a instanceof Fs&&a.v3.equals(s.position)&&s.controls[0].position.copy(a.v2)},r=s=>{let a=[],n,o;for(n=0,o=s.length;n<o;n++)s[n]instanceof ho&&(s[n]=N8(s[n]));for(n=0,o=s.length;n<o;n++){let c=s[n],u=n>0?s[n-1]:null,d;c instanceof Fs?(d=this.createPoint(c.v0),d.controls[1].position.copy(c.v1)):c instanceof Ns&&(d=this.createPoint(c.v1)),d!==void 0&&(u!==null&&i(d,u),a.push(d))}let l=s[s.length-1],h=!1;return l instanceof Fs?l.v3.equals(a[0].position)&&(a[0].controls[0].position.copy(l.v2),h=!0):l instanceof Ns&&l.v2.equals(a[0].position)&&(h=!0),this.isClosed=h,a};return this.points=r(e.curves),e instanceof Zp&&(this.shapeHoles=e.holes.map(s=>{let a=new mi;return a.fromShape(s),a})),this.update(),this}updatePoint(e,t){let i=this.getPointByUuid(e);i&&(t.position!==void 0&&i.position.fromArray(t.position),t.roundness!==void 0&&(i.roundness=t.roundness),t.areControlsDirectionsMirrored!==void 0&&(i.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(e,t){let i=this.getPointByUuid(e)?.controls[0];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}updateNextControl(e,t){let i=this.getPointByUuid(e)?.controls[1];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}},qC=Math.PI*2;function kg({x:e,y:t},i,r,s,a){return{x:e*i+s,y:t*r+a}}function i9(e,t){let i=t===1.5707963267948966?.551915024494:t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=Math.cos(e),s=Math.sin(e),a=Math.cos(e+t),n=Math.sin(e+t);return[{x:r-s*i,y:s+r*i},{x:a+n*i,y:n-a*i},{x:a,y:n}]}function I_(e,t,i,r){let s=e*r-t*i<0?-1:1,a=Math.min(1,Math.max(-1,e*i+t*r));return s*Math.acos(a)}function r9(e,t,i,r,s,a,n,o,l,h){let c=Math.pow(s,2),u=Math.pow(a,2),d=Math.pow(n,2),p=Math.pow(o,2),f=c*u-c*p-u*d;f<0&&(f=0),f/=c*p+u*d,f=Math.sqrt(f)*(l===h?-1:1);let m=f*s/a*o,g=f*-a/s*n,v=m+(e+i)/2,y=g+(t+r)/2,x=(n-m)/s,w=(o-g)/a,S=(-n-m)/s,b=(-o-g)/a,E=I_(1,0,x,w),_=I_(x,w,S,b);return _<0&&(_+=qC),{centerx:v,centery:y,ang1:E,ang2:_}}function s9({px:e,py:t,cx:i,cy:r,rx:s,ry:a,largeArcFlag:n,sweepFlag:o}){let l=[];if(s===0||a===0)return[];let h=(e-i)/2,c=(t-r)/2;if(h===0&&c===0)return[];s=Math.abs(s),a=Math.abs(a);let u=Math.pow(h,2)/Math.pow(s,2)+Math.pow(c,2)/Math.pow(a,2);u>1&&(s*=Math.sqrt(u),a*=Math.sqrt(u));let d=r9(e,t,i,r,s,a,h,c,n,o),{ang1:p,ang2:f}=d,{centerx:m,centery:g}=d,v=Math.abs(f)/(qC/4);Math.abs(1-v)<1e-7&&(v=1);let y=Math.max(Math.ceil(v),1);f/=y;for(let x=0;x<y;x++)l.push(i9(p,f)),p+=f;return l.map(x=>{let{x:w,y:S}=kg(x[0],s,a,m,g),{x:b,y:E}=kg(x[1],s,a,m,g),{x:_,y:A}=kg(x[2],s,a,m,g);return{x1:w,y1:S,x2:b,y2:E,x:_,y:A}})}var Gt;(function(e){e[e.ODD=0]="ODD",e[e.NONZERO=1]="NONZERO",e[e.POSITIVE=2]="POSITIVE",e[e.NEGATIVE=3]="NEGATIVE",e[e.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(Gt||(Gt={}));var Oi;(function(e){e[e.POLYGONS=0]="POLYGONS",e[e.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",e[e.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(Oi||(Oi={}));function ht(e,t){if(!e)throw t||"Assertion Failed!"}var Ze=(function(){function e(){}return e.vertEq=function(t,i){return t.s===i.s&&t.t===i.t},e.vertLeq=function(t,i){return t.s<i.s||t.s===i.s&&t.t<=i.t},e.transLeq=function(t,i){return t.t<i.t||t.t===i.t&&t.s<=i.s},e.edgeGoesLeft=function(t){return e.vertLeq(t.Dst,t.Org)},e.edgeGoesRight=function(t){return e.vertLeq(t.Org,t.Dst)},e.vertL1dist=function(t,i){return Math.abs(t.s-i.s)+Math.abs(t.t-i.t)},e.edgeEval=function(t,i,r){ht(e.vertLeq(t,i)&&e.vertLeq(i,r));var s=i.s-t.s,a=r.s-i.s;return s+a>0?s<a?i.t-t.t+(t.t-r.t)*(s/(s+a)):i.t-r.t+(r.t-t.t)*(a/(s+a)):0},e.edgeSign=function(t,i,r){ht(e.vertLeq(t,i)&&e.vertLeq(i,r));var s=i.s-t.s,a=r.s-i.s;return s+a>0?(i.t-r.t)*s+(i.t-t.t)*a:0},e.transEval=function(t,i,r){ht(e.transLeq(t,i)&&e.transLeq(i,r));var s=i.t-t.t,a=r.t-i.t;return s+a>0?s<a?i.s-t.s+(t.s-r.s)*(s/(s+a)):i.s-r.s+(r.s-t.s)*(a/(s+a)):0},e.transSign=function(t,i,r){ht(e.transLeq(t,i)&&e.transLeq(i,r));var s=i.t-t.t,a=r.t-i.t;return s+a>0?(i.s-r.s)*s+(i.s-t.s)*a:0},e.vertCCW=function(t,i,r){return t.s*(i.t-r.t)+i.s*(r.t-t.t)+r.s*(t.t-i.t)>=0},e.interpolate=function(t,i,r,s){return t=t<0?0:t,r=r<0?0:r,t<=r?r===0?(i+s)/2:i+(s-i)*(t/(t+r)):s+(i-s)*(r/(t+r))},e.intersect=function(t,i,r,s,a){var n,o,l;e.vertLeq(t,i)||(l=t,t=i,i=l),e.vertLeq(r,s)||(l=r,r=s,s=l),e.vertLeq(t,r)||(l=t,t=r,r=l,l=i,i=s,s=l),e.vertLeq(r,i)?e.vertLeq(i,s)?(n=e.edgeEval(t,r,i),o=e.edgeEval(r,i,s),n+o<0&&(n=-n,o=-o),a.s=e.interpolate(n,r.s,o,i.s)):(n=e.edgeSign(t,r,i),o=-e.edgeSign(t,s,i),n+o<0&&(n=-n,o=-o),a.s=e.interpolate(n,r.s,o,s.s)):a.s=(r.s+i.s)/2,e.transLeq(t,i)||(l=t,t=i,i=l),e.transLeq(r,s)||(l=r,r=s,s=l),e.transLeq(t,r)||(l=t,t=r,r=l,l=i,i=s,s=l),e.transLeq(r,i)?e.transLeq(i,s)?(n=e.transEval(t,r,i),o=e.transEval(r,i,s),n+o<0&&(n=-n,o=-o),a.t=e.interpolate(n,r.t,o,i.t)):(n=e.transSign(t,r,i),o=-e.transSign(t,s,i),n+o<0&&(n=-n,o=-o),a.t=e.interpolate(n,r.t,o,s.t)):a.t=(r.t+i.t)/2},e})(),wc=(function(){function e(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}return e})(),Wd=(function(){function e(t){this.side=t,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(e.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(t){this.Sym.Lface=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(t){this.Sym.Org=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(t){this.Sym.Lnext=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(t){this.Onext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(t){this.Lnext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(t){this.Sym.Onext=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(t){this.Sym.Onext.Sym=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(t){this.Sym.Lnext.Sym=t},enumerable:!0,configurable:!0}),e})(),Zl=(function(){function e(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0}return e})(),R_=(function(){function e(){var t=new Zl,i=new wc,r=new Wd(0),s=new Wd(1);t.next=t.prev=t,t.anEdge=null,i.next=i.prev=i,r.next=r,r.Sym=s,s.next=s,s.Sym=r,this.vHead=t,this.fHead=i,this.eHead=r,this.eHeadSym=s}return e.prototype.makeEdge_=function(t){var i=new Wd(0),r=new Wd(1);t.Sym.side<t.side&&(t=t.Sym);var s=t.Sym.next;return r.next=s,s.Sym.next=i,i.next=t,t.Sym.next=r,i.Sym=r,i.Onext=i,i.Lnext=r,i.Org=null,i.Lface=null,i.winding=0,i.activeRegion=null,r.Sym=i,r.Onext=r,r.Lnext=i,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,i},e.prototype.splice_=function(t,i){var r=t.Onext,s=i.Onext;r.Sym.Lnext=i,s.Sym.Lnext=t,t.Onext=s,i.Onext=r},e.prototype.makeVertex_=function(t,i,r){var s=t;ht(s,"Vertex can't be null!");var a=r.prev;s.prev=a,a.next=s,s.next=r,r.prev=s,s.anEdge=i;var n=i;do n.Org=s,n=n.Onext;while(n!==i)},e.prototype.makeFace_=function(t,i,r){var s=t;ht(s,"Face can't be null");var a=r.prev;s.prev=a,a.next=s,s.next=r,r.prev=s,s.anEdge=i,s.trail=null,s.marked=!1,s.inside=r.inside;var n=i;do n.Lface=s,n=n.Lnext;while(n!==i)},e.prototype.killEdge_=function(t){t.Sym.side<t.side&&(t=t.Sym);var i=t.next,r=t.Sym.next;i.Sym.next=r,r.Sym.next=i},e.prototype.killVertex_=function(t,i){var r=t.anEdge,s=r;do s.Org=i,s=s.Onext;while(s!==r);var a=t.prev,n=t.next;n.prev=a,a.next=n},e.prototype.killFace_=function(t,i){var r=t.anEdge,s=r;do s.Lface=i,s=s.Lnext;while(s!==r);var a=t.prev,n=t.next;n.prev=a,a.next=n},e.prototype.makeEdge=function(){var t=new Zl,i=new Zl,r=new wc,s=this.makeEdge_(this.eHead);return this.makeVertex_(t,s,this.vHead),this.makeVertex_(i,s.Sym,this.vHead),this.makeFace_(r,s,this.fHead),s},e.prototype.splice=function(t,i){var r=!1,s=!1;if(t!==i){if(i.Org!==t.Org&&(s=!0,this.killVertex_(i.Org,t.Org)),i.Lface!==t.Lface&&(r=!0,this.killFace_(i.Lface,t.Lface)),this.splice_(i,t),!s){var a=new Zl;this.makeVertex_(a,i,t.Org),t.Org.anEdge=t}if(!r){var n=new wc;this.makeFace_(n,i,t.Lface),t.Lface.anEdge=t}}},e.prototype.delete=function(t){var i=t.Sym,r=!1;if(t.Lface!==t.Rface&&(r=!0,this.killFace_(t.Lface,t.Rface)),t.Onext===t)this.killVertex_(t.Org,null);else if(t.Rface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev),!r){var s=new wc;this.makeFace_(s,t,t.Lface)}i.Onext===i?(this.killVertex_(i.Org,null),this.killFace_(i.Lface,null)):(t.Lface.anEdge=i.Oprev,i.Org.anEdge=i.Onext,this.splice_(i,i.Oprev)),this.killEdge_(t)},e.prototype.addEdgeVertex=function(t){var i=this.makeEdge_(t),r=i.Sym;this.splice_(i,t.Lnext),i.Org=t.Dst;var s=new Zl;return this.makeVertex_(s,r,i.Org),i.Lface=r.Lface=t.Lface,i},e.prototype.splitEdge=function(t){var i=this.addEdgeVertex(t),r=i.Sym;return this.splice_(t.Sym,t.Sym.Oprev),this.splice_(t.Sym,r),t.Dst=r.Org,r.Dst.anEdge=r.Sym,r.Rface=t.Rface,r.winding=t.winding,r.Sym.winding=t.Sym.winding,r.idx=t.idx,r.Sym.idx=t.Sym.idx,r},e.prototype.connect=function(t,i){var r=!1,s=this.makeEdge_(t),a=s.Sym;if(i.Lface!==t.Lface&&(r=!0,this.killFace_(i.Lface,t.Lface)),this.splice_(s,t.Lnext),this.splice_(a,i),s.Org=t.Dst,a.Org=i.Org,s.Lface=a.Lface=t.Lface,t.Lface.anEdge=a,!r){var n=new wc;this.makeFace_(n,s,t.Lface)}return s},e.prototype.zapFace=function(t){var i=t.anEdge,r,s,a,n,o;s=i.Lnext;do r=s,s=r.Lnext,r.Lface=null,r.Rface===null&&(r.Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),a=r.Sym,a.Onext===a?this.killVertex_(a.Org,null):(a.Org.anEdge=a.Onext,this.splice_(a,a.Oprev)),this.killEdge_(r));while(r!=i);n=t.prev,o=t.next,o.prev=n,n.next=o},e.prototype.countFaceVerts_=function(t){var i=t.anEdge,r=0;do r++,i=i.Lnext;while(i!==t.anEdge);return r},e.prototype.mergeConvexFaces=function(t){var i,r,s,a,n,o,l;for(i=this.fHead.next;i!==this.fHead;i=i.next)if(i.inside)for(r=i.anEdge,n=r.Org;s=r.Lnext,a=r.Sym,a&&a.Lface&&a.Lface.inside&&(o=this.countFaceVerts_(i),l=this.countFaceVerts_(a.Lface),o+l-2<=t&&Ze.vertCCW(r.Lprev.Org,r.Org,a.Lnext.Lnext.Org)&&Ze.vertCCW(a.Lprev.Org,a.Org,r.Lnext.Lnext.Org)&&(s=a.Lnext,this.delete(a),r=null,a=null)),!(r&&r.Lnext.Org===n);)r=s;return!0},e.prototype.check=function(){var t=this.fHead,i=this.vHead,r=this.eHead,s,a,n,o,l,h;for(a=t,a=t;(s=a.next)!==t;a=s){ht(s.prev===a),l=s.anEdge;do ht(l.Sym!==l),ht(l.Sym.Sym===l),ht(l.Lnext.Onext.Sym===l),ht(l.Onext.Sym.Lnext===l),ht(l.Lface===s),l=l.Lnext;while(l!==s.anEdge)}for(ht(s.prev===a&&s.anEdge===null),o=i,o=i;(n=o.next)!==i;o=n){ht(n.prev===o),l=n.anEdge;do ht(l.Sym!==l),ht(l.Sym.Sym===l),ht(l.Lnext.Onext.Sym===l),ht(l.Onext.Sym.Lnext===l),ht(l.Org===n),l=l.Onext;while(l!==n.anEdge)}for(ht(n.prev===o&&n.anEdge===null),h=r,h=r;(l=h.next)!==r;h=l)ht(l.Sym.next===h.Sym),ht(l.Sym!==l),ht(l.Sym.Sym===l),ht(l.Org!==null),ht(l.Dst!==null),ht(l.Lnext.Onext.Sym===l),ht(l.Onext.Sym.Lnext===l);ht(l.Sym.next===h.Sym&&l.Sym===this.eHeadSym&&l.Sym.Sym===l&&l.Org===null&&l.Dst===null&&l.Lface===null&&l.Rface===null)},e})(),L_=(function(){function e(){this.handle=null}return e})(),z_=(function(){function e(){this.key=null,this.node=0}return e})(),a9=(function(){function e(t,i){this.leq=i,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=t,this.nodes=[],this.handles=[];for(var r=0;r<t+1;r++)this.nodes[r]=new L_,this.handles[r]=new z_;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return e.prototype.floatDown_=function(t){var i=this.nodes,r=this.handles,s,a,n;for(s=i[t].handle;;){if(n=t<<1,n<this.size&&this.leq(r[i[n+1].handle].key,r[i[n].handle].key)&&++n,ht(n<=this.max),a=i[n].handle,n>this.size||this.leq(r[s].key,r[a].key)){i[t].handle=s,r[s].node=t;break}i[t].handle=a,r[a].node=t,t=n}},e.prototype.floatUp_=function(t){var i=this.nodes,r=this.handles,s,a,n;for(s=i[t].handle;;){if(n=t>>1,a=i[n].handle,n===0||this.leq(r[a].key,r[s].key)){i[t].handle=s,r[s].node=t;break}i[t].handle=a,r[a].node=t,t=n}},e.prototype.init=function(){for(var t=this.size;t>=1;--t)this.floatDown_(t);this.initialized=!0},e.prototype.min=function(){return this.handles[this.nodes[1].handle].key},e.prototype.insert=function(t){var i,r;if(i=++this.size,i*2>this.max){this.max*=2;var s,a;for(a=this.nodes.length,this.nodes.length=this.max+1,s=a;s<this.nodes.length;s++)this.nodes[s]=new L_;for(a=this.handles.length,this.handles.length=this.max+1,s=a;s<this.handles.length;s++)this.handles[s]=new z_}return this.freeList===0?r=i:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[i].handle=r,this.handles[r].node=i,this.handles[r].key=t,this.initialized&&this.floatUp_(i),r},e.prototype.extractMin=function(){var t=this.nodes,i=this.handles,r=t[1].handle,s=i[r].key;return this.size>0&&(t[1].handle=t[this.size].handle,i[t[1].handle].node=1,i[r].key=null,i[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),s},e.prototype.delete=function(t){var i=this.nodes,r=this.handles,s;ht(t>=1&&t<=this.max&&r[t].key!==null),s=r[t].node,i[s].handle=i[this.size].handle,r[i[s].handle].node=s,--this.size,s<=this.size&&(s<=1||this.leq(r[i[s>>1].handle].key,r[i[s].handle].key)?this.floatDown_(s):this.floatUp_(s)),r[t].key=null,r[t].node=this.freeList,this.freeList=t},e})(),Ug=(function(){function e(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}return e})(),B_=(function(){function e(){this.key=null,this.next=null,this.prev=null}return e})(),n9=(function(){function e(t,i){this.frame=t,this.leq=i,this.head=new B_,this.head.next=this.head,this.head.prev=this.head}return e.prototype.min=function(){return this.head.next},e.prototype.max=function(){return this.head.prev},e.prototype.insert=function(t){return this.insertBefore(this.head,t)},e.prototype.search=function(t){var i=this.head;do i=i.next;while(i.key!==null&&!this.leq(this.frame,t,i.key));return i},e.prototype.insertBefore=function(t,i){do t=t.prev;while(t.key!==null&&!this.leq(this.frame,t.key,i));var r=new B_;return r.key=i,r.next=t.next,t.next.prev=r,r.prev=t,t.next=r,r},e.prototype.delete=function(t){t.next.prev=t.prev,t.prev.next=t.next},e})(),o9=(function(){function e(){}return e.regionBelow=function(t){return t.nodeUp.prev.key},e.regionAbove=function(t){return t.nodeUp.next.key},e.debugEvent=function(t){},e.addWinding=function(t,i){t.winding+=i.winding,t.Sym.winding+=i.Sym.winding},e.edgeLeq=function(t,i,r){var s=t.event,a=i.eUp,n=r.eUp;if(a.Dst===s)return n.Dst===s?Ze.vertLeq(a.Org,n.Org)?Ze.edgeSign(n.Dst,a.Org,n.Org)<=0:Ze.edgeSign(a.Dst,n.Org,a.Org)>=0:Ze.edgeSign(n.Dst,s,n.Org)<=0;if(n.Dst===s)return Ze.edgeSign(a.Dst,s,a.Org)>=0;var o=Ze.edgeEval(a.Dst,s,a.Org),l=Ze.edgeEval(n.Dst,s,n.Org);return o>=l},e.deleteRegion=function(t,i){i.fixUpperEdge&&ht(i.eUp.winding===0),i.eUp.activeRegion=null,t.dict.delete(i.nodeUp)},e.fixUpperEdge=function(t,i,r){ht(i.fixUpperEdge),t.mesh.delete(i.eUp),i.fixUpperEdge=!1,i.eUp=r,r.activeRegion=i},e.topLeftRegion=function(t,i){var r=i.eUp.Org,s;do i=e.regionAbove(i);while(i.eUp.Org===r);if(i.fixUpperEdge){if(s=t.mesh.connect(e.regionBelow(i).eUp.Sym,i.eUp.Lnext),s===null)return null;e.fixUpperEdge(t,i,s),i=e.regionAbove(i)}return i},e.topRightRegion=function(t){var i=t.eUp.Dst;do t=e.regionAbove(t);while(t.eUp.Dst===i);return t},e.addRegionBelow=function(t,i,r){var s=new Ug;return s.eUp=r,s.nodeUp=t.dict.insertBefore(i.nodeUp,s),s.fixUpperEdge=!1,s.sentinel=!1,s.dirty=!1,r.activeRegion=s,s},e.isWindingInside=function(t,i){switch(t.windingRule){case Gt.ODD:return(i&1)!==0;case Gt.NONZERO:return i!==0;case Gt.POSITIVE:return i>0;case Gt.NEGATIVE:return i<0;case Gt.ABS_GEQ_TWO:return i>=2||i<=-2}throw new Error("Invalid winding rulle")},e.computeWinding=function(t,i){i.windingNumber=e.regionAbove(i).windingNumber+i.eUp.winding,i.inside=e.isWindingInside(t,i.windingNumber)},e.finishRegion=function(t,i){var r=i.eUp,s=r.Lface;s.inside=i.inside,s.anEdge=r,e.deleteRegion(t,i)},e.finishLeftRegions=function(t,i,r){for(var s,a=null,n=i,o=i.eUp;n!==r;){if(n.fixUpperEdge=!1,a=e.regionBelow(n),s=a.eUp,s.Org!=o.Org){if(!a.fixUpperEdge){e.finishRegion(t,n);break}s=t.mesh.connect(o.Lprev,s.Sym),e.fixUpperEdge(t,a,s)}o.Onext!==s&&(t.mesh.splice(s.Oprev,s),t.mesh.splice(o,s)),e.finishRegion(t,n),o=a.eUp,n=a}return o},e.addRightEdges=function(t,i,r,s,a,n){var o,l,h,c,u=!0;h=r;do ht(Ze.vertLeq(h.Org,h.Dst)),e.addRegionBelow(t,i,h.Sym),h=h.Onext;while(h!==s);for(a===null&&(a=e.regionBelow(i).eUp.Rprev),l=i,c=a;o=e.regionBelow(l),h=o.eUp.Sym,h.Org===c.Org;)h.Onext!==c&&(t.mesh.splice(h.Oprev,h),t.mesh.splice(c.Oprev,h)),o.windingNumber=l.windingNumber-h.winding,o.inside=e.isWindingInside(t,o.windingNumber),l.dirty=!0,!u&&e.checkForRightSplice(t,l)&&(e.addWinding(h,c),e.deleteRegion(t,l),t.mesh.delete(c)),u=!1,l=o,c=h;l.dirty=!0,ht(l.windingNumber-h.winding===o.windingNumber),n&&e.walkDirtyRegions(t,l)},e.spliceMergeVertices=function(t,i,r){t.mesh.splice(i,r)},e.vertexWeights=function(t,i,r){var s=Ze.vertL1dist(i,t),a=Ze.vertL1dist(r,t),n=.5*a/(s+a),o=.5*s/(s+a);t.coords[0]+=n*i.coords[0]+o*r.coords[0],t.coords[1]+=n*i.coords[1]+o*r.coords[1],t.coords[2]+=n*i.coords[2]+o*r.coords[2]},e.getIntersectData=function(t,i,r,s,a,n){i.coords[0]=i.coords[1]=i.coords[2]=0,i.idx=-1,e.vertexWeights(i,r,s),e.vertexWeights(i,a,n)},e.checkForRightSplice=function(t,i){var r=e.regionBelow(i),s=i.eUp,a=r.eUp;if(Ze.vertLeq(s.Org,a.Org)){if(Ze.edgeSign(a.Dst,s.Org,a.Org)>0)return!1;Ze.vertEq(s.Org,a.Org)?s.Org!==a.Org&&(t.pq.delete(s.Org.pqHandle),e.spliceMergeVertices(t,a.Oprev,s)):(t.mesh.splitEdge(a.Sym),t.mesh.splice(s,a.Oprev),i.dirty=r.dirty=!0)}else{if(Ze.edgeSign(s.Dst,a.Org,s.Org)<0)return!1;e.regionAbove(i).dirty=i.dirty=!0,t.mesh.splitEdge(s.Sym),t.mesh.splice(a.Oprev,s)}return!0},e.checkForLeftSplice=function(t,i){var r=e.regionBelow(i),s=i.eUp,a=r.eUp,n;if(ht(!Ze.vertEq(s.Dst,a.Dst)),Ze.vertLeq(s.Dst,a.Dst)){if(Ze.edgeSign(s.Dst,a.Dst,s.Org)<0)return!1;e.regionAbove(i).dirty=i.dirty=!0,n=t.mesh.splitEdge(s),t.mesh.splice(a.Sym,n),n.Lface.inside=i.inside}else{if(Ze.edgeSign(a.Dst,s.Dst,a.Org)>0)return!1;i.dirty=r.dirty=!0,n=t.mesh.splitEdge(a),t.mesh.splice(s.Lnext,a.Sym),n.Rface.inside=i.inside}return!0},e.checkForIntersect=function(t,i){var r=e.regionBelow(i),s=i.eUp,a=r.eUp,n=s.Org,o=a.Org,l=s.Dst,h=a.Dst,c,u,d=new Zl,p,f;if(ht(!Ze.vertEq(h,l)),ht(Ze.edgeSign(l,t.event,n)<=0),ht(Ze.edgeSign(h,t.event,o)>=0),ht(n!==t.event&&o!==t.event),ht(!i.fixUpperEdge&&!r.fixUpperEdge),n===o||(c=Math.min(n.t,l.t),u=Math.max(o.t,h.t),c>u))return!1;if(Ze.vertLeq(n,o)){if(Ze.edgeSign(h,n,o)>0)return!1}else if(Ze.edgeSign(l,o,n)<0)return!1;return e.debugEvent(t),Ze.intersect(l,n,h,o,d),ht(Math.min(n.t,l.t)<=d.t),ht(d.t<=Math.max(o.t,h.t)),ht(Math.min(h.s,l.s)<=d.s),ht(d.s<=Math.max(o.s,n.s)),Ze.vertLeq(d,t.event)&&(d.s=t.event.s,d.t=t.event.t),p=Ze.vertLeq(n,o)?n:o,Ze.vertLeq(p,d)&&(d.s=p.s,d.t=p.t),Ze.vertEq(d,n)||Ze.vertEq(d,o)?(e.checkForRightSplice(t,i),!1):!Ze.vertEq(l,t.event)&&Ze.edgeSign(l,t.event,d)>=0||!Ze.vertEq(h,t.event)&&Ze.edgeSign(h,t.event,d)<=0?h===t.event?(t.mesh.splitEdge(s.Sym),t.mesh.splice(a.Sym,s),i=e.topLeftRegion(t,i),s=e.regionBelow(i).eUp,e.finishLeftRegions(t,e.regionBelow(i),r),e.addRightEdges(t,i,s.Oprev,s,s,!0),!0):l===t.event?(t.mesh.splitEdge(a.Sym),t.mesh.splice(s.Lnext,a.Oprev),r=i,i=e.topRightRegion(i),f=e.regionBelow(i).eUp.Rprev,r.eUp=a.Oprev,a=e.finishLeftRegions(t,r,null),e.addRightEdges(t,i,a.Onext,s.Rprev,f,!0),!0):(Ze.edgeSign(l,t.event,d)>=0&&(e.regionAbove(i).dirty=i.dirty=!0,t.mesh.splitEdge(s.Sym),s.Org.s=t.event.s,s.Org.t=t.event.t),Ze.edgeSign(h,t.event,d)<=0&&(i.dirty=r.dirty=!0,t.mesh.splitEdge(a.Sym),a.Org.s=t.event.s,a.Org.t=t.event.t),!1):(t.mesh.splitEdge(s.Sym),t.mesh.splitEdge(a.Sym),t.mesh.splice(a.Oprev,s),s.Org.s=d.s,s.Org.t=d.t,s.Org.pqHandle=t.pq.insert(s.Org),e.getIntersectData(t,s.Org,n,l,o,h),e.regionAbove(i).dirty=i.dirty=r.dirty=!0,!1)},e.walkDirtyRegions=function(t,i){for(var r=e.regionBelow(i),s,a;;){for(;r.dirty;)i=r,r=e.regionBelow(r);if(!i.dirty&&(r=i,i=e.regionAbove(i),i===null||!i.dirty))return;if(i.dirty=!1,s=i.eUp,a=r.eUp,s.Dst!==a.Dst&&e.checkForLeftSplice(t,i)&&(r.fixUpperEdge?(e.deleteRegion(t,r),t.mesh.delete(a),r=e.regionBelow(i),a=r.eUp):i.fixUpperEdge&&(e.deleteRegion(t,i),t.mesh.delete(s),i=e.regionAbove(r),s=i.eUp)),s.Org!==a.Org)if(s.Dst!==a.Dst&&!i.fixUpperEdge&&!r.fixUpperEdge&&(s.Dst===t.event||a.Dst===t.event)){if(e.checkForIntersect(t,i))return}else e.checkForRightSplice(t,i);s.Org===a.Org&&s.Dst===a.Dst&&(e.addWinding(a,s),e.deleteRegion(t,i),t.mesh.delete(s),i=e.regionAbove(r))}},e.connectRightVertex=function(t,i,r){var s,a=r.Onext,n=e.regionBelow(i),o=i.eUp,l=n.eUp,h=!1;if(o.Dst!==l.Dst&&e.checkForIntersect(t,i),Ze.vertEq(o.Org,t.event)&&(t.mesh.splice(a.Oprev,o),i=e.topLeftRegion(t,i),a=e.regionBelow(i).eUp,e.finishLeftRegions(t,e.regionBelow(i),n),h=!0),Ze.vertEq(l.Org,t.event)&&(t.mesh.splice(r,l.Oprev),r=e.finishLeftRegions(t,n,null),h=!0),h){e.addRightEdges(t,i,r.Onext,a,a,!0);return}Ze.vertLeq(l.Org,o.Org)?s=l.Oprev:s=o,s=t.mesh.connect(r.Lprev,s),e.addRightEdges(t,i,s,s.Onext,s.Onext,!1),s.Sym.activeRegion.fixUpperEdge=!0,e.walkDirtyRegions(t,i)},e.connectLeftDegenerate=function(t,i,r){var s,a,n,o,l;if(s=i.eUp,Ze.vertEq(s.Org,r)){ht(!1),e.spliceMergeVertices(t,s,r.anEdge);return}if(!Ze.vertEq(s.Dst,r)){t.mesh.splitEdge(s.Sym),i.fixUpperEdge&&(t.mesh.delete(s.Onext),i.fixUpperEdge=!1),t.mesh.splice(r.anEdge,s),e.sweepEvent(t,r);return}ht(!1),i=e.topRightRegion(i),l=e.regionBelow(i),n=l.eUp.Sym,a=o=n.Onext,l.fixUpperEdge&&(ht(a!==n),e.deleteRegion(t,l),t.mesh.delete(n),n=a.Oprev),t.mesh.splice(r.anEdge,n),Ze.edgeGoesLeft(a)||(a=null),e.addRightEdges(t,i,n.Onext,o,a,!0)},e.connectLeftVertex=function(t,i){var r,s,a,n,o,l,h=new Ug;if(h.eUp=i.anEdge.Sym,r=t.dict.search(h).key,s=e.regionBelow(r),!!s){if(n=r.eUp,o=s.eUp,Ze.edgeSign(n.Dst,i,n.Org)===0){e.connectLeftDegenerate(t,r,i);return}if(a=Ze.vertLeq(o.Dst,n.Dst)?r:s,r.inside||a.fixUpperEdge){if(a===r)l=t.mesh.connect(i.anEdge.Sym,n.Lnext);else{var c=t.mesh.connect(o.Dnext,i.anEdge);l=c.Sym}a.fixUpperEdge?e.fixUpperEdge(t,a,l):e.computeWinding(t,e.addRegionBelow(t,r,l)),e.sweepEvent(t,i)}else e.addRightEdges(t,r,i.anEdge,i.anEdge,null,!0)}},e.sweepEvent=function(t,i){t.event=i,e.debugEvent(t);for(var r=i.anEdge;r.activeRegion===null;)if(r=r.Onext,r===i.anEdge){e.connectLeftVertex(t,i);return}var s=e.topLeftRegion(t,r.activeRegion);ht(s!==null);var a=e.regionBelow(s),n=a.eUp,o=e.finishLeftRegions(t,a,null);o.Onext===n?e.connectRightVertex(t,s,o):e.addRightEdges(t,s,o.Onext,n,n,!0)},e.addSentinel=function(t,i,r,s){var a=new Ug,n=t.mesh.makeEdge();n.Org.s=r,n.Org.t=s,n.Dst.s=i,n.Dst.t=s,t.event=n.Dst,a.eUp=n,a.windingNumber=0,a.inside=!1,a.fixUpperEdge=!1,a.sentinel=!0,a.dirty=!1,a.nodeUp=t.dict.insert(a)},e.initEdgeDict=function(t){t.dict=new n9(t,e.edgeLeq);var i=t.bmax[0]-t.bmin[0],r=t.bmax[1]-t.bmin[1],s=t.bmin[0]-i,a=t.bmax[0]+i,n=t.bmin[1]-r,o=t.bmax[1]+r;e.addSentinel(t,s,a,n),e.addSentinel(t,s,a,o)},e.doneEdgeDict=function(t){for(var i,r=0;(i=t.dict.min().key)!==null;)i.sentinel||(ht(i.fixUpperEdge),ht(++r===1)),ht(i.windingNumber===0),e.deleteRegion(t,i)},e.removeDegenerateEdges=function(t){var i,r,s,a=t.mesh.eHead;for(i=a.next;i!==a;i=r)r=i.next,s=i.Lnext,Ze.vertEq(i.Org,i.Dst)&&i.Lnext.Lnext!==i&&(e.spliceMergeVertices(t,s,i),t.mesh.delete(i),i=s,s=i.Lnext),s.Lnext===i&&(s!==i&&((s===r||s===r.Sym)&&(r=r.next),t.mesh.delete(s)),(i===r||i===r.Sym)&&(r=r.next),t.mesh.delete(i))},e.initPriorityQ=function(t){var i,r,s,a=0;for(s=t.mesh.vHead,r=s.next;r!==s;r=r.next)a++;for(a+=8,i=t.pq=new a9(a,Ze.vertLeq),s=t.mesh.vHead,r=s.next;r!==s;r=r.next)r.pqHandle=i.insert(r);return r!==s?!1:(i.init(),!0)},e.donePriorityQ=function(t){t.pq=null},e.removeDegenerateFaces=function(t,i){var r,s,a;for(r=i.fHead.next;r!==i.fHead;r=s)s=r.next,a=r.anEdge,ht(a.Lnext!==a),a.Lnext.Lnext===a&&(e.addWinding(a.Onext,a),t.mesh.delete(a));return!0},e.computeInterior=function(t,i){i===void 0&&(i=!0);var r,s;if(e.removeDegenerateEdges(t),!e.initPriorityQ(t))return!1;for(e.initEdgeDict(t);(r=t.pq.extractMin())!==null;){for(;s=t.pq.min(),!(s===null||!Ze.vertEq(s,r));)s=t.pq.extractMin(),e.spliceMergeVertices(t,r.anEdge,s.anEdge);e.sweepEvent(t,r)}return t.event=t.dict.min().key.eUp.Org,e.debugEvent(t),e.doneEdgeDict(t),e.donePriorityQ(t),e.removeDegenerateFaces(t,t.mesh)?(i&&t.mesh.check(),!0):!1},e})(),l9=(function(){function e(){this.mesh=new R_,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=Gt.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return e.prototype.dot_=function(t,i){return t[0]*i[0]+t[1]*i[1]+t[2]*i[2]},e.prototype.normalize_=function(t){var i=t[0]*t[0]+t[1]*t[1]+t[2]*t[2];if(!i)throw"Zero-size vector!";i=Math.sqrt(i),t[0]/=i,t[1]/=i,t[2]/=i},e.prototype.longAxis_=function(t){var i=0;return Math.abs(t[1])>Math.abs(t[0])&&(i=1),Math.abs(t[2])>Math.abs(t[i])&&(i=2),i},e.prototype.computeNormal_=function(t){var i,r,s,a,n,o,l=[0,0,0],h=[0,0,0],c=[0,0,0],u=[0,0,0],d=[0,0,0],p=[null,null,null],f=[null,null,null],m=this.mesh.vHead;i=m.next;for(var g=0;g<3;++g)a=i.coords[g],h[g]=a,f[g]=i,l[g]=a,p[g]=i;for(i=m.next;i!==m;i=i.next)for(var v=0;v<3;++v)a=i.coords[v],a<h[v]&&(h[v]=a,f[v]=i),a>l[v]&&(l[v]=a,p[v]=i);var y=0;if(l[1]-h[1]>l[0]-h[0]&&(y=1),l[2]-h[2]>l[y]-h[y]&&(y=2),h[y]>=l[y]){t[0]=0,t[1]=0,t[2]=1;return}for(o=0,r=f[y],s=p[y],c[0]=r.coords[0]-s.coords[0],c[1]=r.coords[1]-s.coords[1],c[2]=r.coords[2]-s.coords[2],i=m.next;i!==m;i=i.next)u[0]=i.coords[0]-s.coords[0],u[1]=i.coords[1]-s.coords[1],u[2]=i.coords[2]-s.coords[2],d[0]=c[1]*u[2]-c[2]*u[1],d[1]=c[2]*u[0]-c[0]*u[2],d[2]=c[0]*u[1]-c[1]*u[0],n=d[0]*d[0]+d[1]*d[1]+d[2]*d[2],n>o&&(o=n,t[0]=d[0],t[1]=d[1],t[2]=d[2]);o<=0&&(t[0]=t[1]=t[2]=0,t[this.longAxis_(c)]=1)},e.prototype.checkOrientation_=function(){for(var t=this.mesh.fHead,i,r=this.mesh.vHead,s,a=0,n=t.next;n!==t;n=n.next)if(s=n.anEdge,!(s.winding<=0))do a+=(s.Org.s-s.Dst.s)*(s.Org.t+s.Dst.t),s=s.Lnext;while(s!==n.anEdge);if(a<0){for(i=r.next;i!==r;i=i.next)i.t=-i.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},e.prototype.projectPolygon_=function(){var t=this.mesh.vHead,i=[0,0,0],r,s,a=!1;i[0]=this.normal[0],i[1]=this.normal[1],i[2]=this.normal[2],!i[0]&&!i[1]&&!i[2]&&(this.computeNormal_(i),a=!0),r=this.sUnit,s=this.tUnit;var n=this.longAxis_(i);r[n]=0,r[(n+1)%3]=1,r[(n+2)%3]=0,s[n]=0,s[(n+1)%3]=0,s[(n+2)%3]=i[n]>0?1:-1;for(var o=t.next;o!==t;o=o.next)o.s=this.dot_(o.coords,r),o.t=this.dot_(o.coords,s);a&&this.checkOrientation_();for(var l=!0,h=t.next;h!==t;h=h.next)l?(this.bmin[0]=this.bmax[0]=h.s,this.bmin[1]=this.bmax[1]=h.t,l=!1):(h.s<this.bmin[0]&&(this.bmin[0]=h.s),h.s>this.bmax[0]&&(this.bmax[0]=h.s),h.t<this.bmin[1]&&(this.bmin[1]=h.t),h.t>this.bmax[1]&&(this.bmax[1]=h.t))},e.prototype.addWinding_=function(t,i){t.winding+=i.winding,t.Sym.winding+=i.Sym.winding},e.prototype.tessellateMonoRegion_=function(t,i){var r,s;if(r=i.anEdge,!(r.Lnext!==r&&r.Lnext.Lnext!==r))throw"Mono region invalid";for(;Ze.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;Ze.vertLeq(r.Org,r.Dst);r=r.Lnext);s=r.Lprev;for(var a=void 0;r.Lnext!==s;)if(Ze.vertLeq(r.Dst,s.Org)){for(;s.Lnext!==r&&(Ze.edgeGoesLeft(s.Lnext)||Ze.edgeSign(s.Org,s.Dst,s.Lnext.Dst)<=0);)a=t.connect(s.Lnext,s),s=a.Sym;s=s.Lprev}else{for(;s.Lnext!==r&&(Ze.edgeGoesRight(r.Lprev)||Ze.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)a=t.connect(r,r.Lprev),r=a.Sym;r=r.Lnext}
3139if(s.Lnext===r)throw"Mono region invalid";for(;s.Lnext.Lnext!==r;)a=t.connect(s.Lnext,s),s=a.Sym;return!0},e.prototype.tessellateInterior_=function(t){for(var i,r=t.fHead.next;r!==t.fHead;r=i)if(i=r.next,r.inside&&!this.tessellateMonoRegion_(t,r))return!1;return!0},e.prototype.discardExterior_=function(t){for(var i,r=t.fHead.next;r!==t.fHead;r=i)i=r.next,r.inside||t.zapFace(r)},e.prototype.setWindingNumber_=function(t,i,r){for(var s,a=t.eHead.next;a!==t.eHead;a=s)s=a.next,a.Rface.inside!==a.Lface.inside?a.winding=a.Lface.inside?i:-i:r?t.delete(a):a.winding=0},e.prototype.getNeighbourFace_=function(t){return!t.Rface||!t.Rface.inside?-1:t.Rface.n},e.prototype.outputPolymesh_=function(t,i,r,s){var a,n=0,o=0,l;r>3&&t.mergeConvexFaces(r);for(var h=t.vHead.next;h!==t.vHead;h=h.next)h.n=-1;for(var c=t.fHead.next;c!==t.fHead;c=c.next)if(c.n=-1,!!c.inside){a=c.anEdge,l=0;do{var h=a.Org;h.n===-1&&(h.n=o,o++),l++,a=a.Lnext}while(a!==c.anEdge);if(l>r)throw"Face vertex greater that support polygon";c.n=n,++n}this.elementCount=n,i===Oi.CONNECTED_POLYGONS&&(n*=2),this.elements=[],this.elements.length=n*r,this.vertexCount=o,this.vertices=[],this.vertices.length=o*s,this.vertexIndices=[],this.vertexIndices.length=o;for(var h=t.vHead.next;h!==t.vHead;h=h.next)if(h.n!==-1){var u=h.n*s;this.vertices[u+0]=h.coords[0],this.vertices[u+1]=h.coords[1],s>2&&(this.vertices[u+2]=h.coords[2]),this.vertexIndices[h.n]=h.idx}for(var d=0,c=t.fHead.next;c!==t.fHead;c=c.next)if(c.inside){a=c.anEdge,l=0;do{var h=a.Org;this.elements[d++]=h.n,l++,a=a.Lnext}while(a!==c.anEdge);for(var p=l;p<r;++p)this.elements[d++]=-1;if(i===Oi.CONNECTED_POLYGONS){a=c.anEdge;do this.elements[d++]=this.getNeighbourFace_(a),a=a.Lnext;while(a!==c.anEdge);for(var f=l;f<r;++f)this.elements[d++]=-1}}},e.prototype.outputContours_=function(t,i){var r,s,a=0,n=0;this.vertexCount=0,this.elementCount=0;for(var o=t.fHead.next;o!==t.fHead;o=o.next)if(o.inside){s=r=o.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==s);this.elementCount++}this.elements=[],this.elements.length=this.elementCount*2,this.vertices=[],this.vertices.length=this.vertexCount*i,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var l=0,h=0,c=0;a=0;for(var o=t.fHead.next;o!==t.fHead;o=o.next)if(o.inside){n=0,s=r=o.anEdge;do this.vertices[l++]=r.Org.coords[0],this.vertices[l++]=r.Org.coords[1],i>2&&(this.vertices[l++]=r.Org.coords[2]),this.vertexIndices[h++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,n++,r=r.Lnext;while(r!==s);this.elements[c++]=a,this.elements[c++]=n,a+=n}},e.prototype.addContour=function(t,i){this.mesh===null&&(this.mesh=new R_),t<2&&(t=2),t>3&&(t=3);for(var r=null,s=0;s<i.length;s+=t)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=i[s+0],r.Org.coords[1]=i[s+1],t>2?r.Org.coords[2]=i[s+2]:r.Org.coords[2]=0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},e.prototype.tesselate=function(t,i,r,s,a,n){if(t===void 0&&(t=Gt.ODD),i===void 0&&(i=Oi.POLYGONS),n===void 0&&(n=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,a&&(this.normal[0]=a[0],this.normal[1]=a[1],this.normal[2]=a[2]),this.windingRule=t,s<2&&(s=2),s>3&&(s=3),!this.mesh)return!1;this.projectPolygon_(),o9.computeInterior(this,n);var o=this.mesh;return i===Oi.BOUNDARY_CONTOURS?this.setWindingNumber_(o,1,!0):this.tessellateInterior_(o),n&&o.check(),i===Oi.BOUNDARY_CONTOURS?this.outputContours_(o,s):this.outputPolymesh_(o,i,r,s),!0},e})();function $n(e){var t=e.windingRule,i=t===void 0?Gt.ODD:t,r=e.elementType,s=r===void 0?Oi.POLYGONS:r,a=e.polySize,n=a===void 0?3:a,o=e.vertexSize,l=o===void 0?2:o,h=e.normal,c=h===void 0?[0,0,1]:h,u=e.contours,d=u===void 0?[]:u,p=e.strict,f=p===void 0?!0:p,m=e.debug,g=m===void 0?!1:m;if(!d&&f)throw new Error("Contours can't be empty");if(d){var v=new l9;e.edgeCreateCallback&&(v.edgeCreateCallback=e.edgeCreateCallback),e.vertexIdCallback&&(v.vertexIdCallback=e.vertexIdCallback);for(var y=0;y<d.length;y++)v.addContour(l||2,d[y]);return v.tesselate(i,s,n,l,c,f),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:g?v.mesh:void 0}}}Gt.ODD;Gt.NONZERO;Gt.POSITIVE;Gt.NEGATIVE;Gt.ABS_GEQ_TWO;Oi.POLYGONS;Oi.CONNECTED_POLYGONS;Oi.BOUNDARY_CONTOURS;var py=class{constructor(e=256,t=!1){this.capacity=e,this.size=0,this.debug=t,this.debug&&console.log(`allocating with cap ${e}`);let i=e*py.eSize;this.buffer=new ArrayBuffer(i);let r=Float32Array.BYTES_PER_ELEMENT,s=0;this.positions=new Float32Array(this.buffer,s*r,3*e),s+=3*e,this.normals=new Float32Array(this.buffer,s*r,3*e),s+=3*e,this.uvs=new Float32Array(this.buffer,s*r,2*e)}realloc(e,t=!1){if(e<this.size)throw Error("cannot shrink buffer");if(e<=this.capacity&&!t)return;this.debug&&console.log(`resizing from ${this.capacity} → ${e}`);let i=e*py.eSize,r=new ArrayBuffer(i),s=Float32Array.BYTES_PER_ELEMENT,a=0,n=new Float32Array(r,a*s,3*e);a+=3*e;let o=new Float32Array(r,a*s,3*e);a+=3*e;let l=new Float32Array(r,a*s,2*e);t?(n.set(this.positions.subarray(0,this.size*3)),o.set(this.normals.subarray(0,this.size*3)),l.set(this.uvs.subarray(0,this.size*2))):(n.set(this.positions),o.set(this.normals),l.set(this.uvs)),this.buffer=r,this.positions=n,this.normals=o,this.uvs=l,this.capacity=e}get(e=1){let t=this.size+e;if(t>this.capacity){let r=this.capacity;for(;t>r;)r*=2;this.realloc(r)}let i=this.size;return this.size=t,i}reserve(e){let t=this.size+e;t>this.capacity&&this.realloc(t)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} → ${this.size}`),this.realloc(this.size,!0)}},XC=py;XC.eSize=8*Float32Array.BYTES_PER_ELEMENT;var h9=class{constructor(e=[],t=(i,r)=>i<r?-1:i>r?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:i}=this,r=t[e];for(;e>0;){let s=e-1>>1,a=t[s];if(i(r,a)>=0)break;t[e]=a,e=s}t[e]=r}_down(e){let{data:t,compare:i}=this,r=this.length>>1,s=t[e];for(;e<r;){let a=(e<<1)+1,n=a+1;if(n<this.length&&i(t[n],t[a])<0&&(a=n),i(t[a],s)>=0)break;t[e]=t[a],e=a}t[e]=s}};function c9(e,t,i=1,r=!1){let s=1/0,a=1/0,n=-1/0,o=-1/0;for(let[y,x]of e[0])y<s&&(s=y),x<a&&(a=x),y>n&&(n=y),x>o&&(o=x);let l=n-s,h=o-a,c=Math.max(i,Math.min(l,h));if(c===i){let y=[s,a];return y.distance=0,y.distance}let u=new h9([],(y,x)=>x.max-y.max),d=d9(e),p=new kf(s+l/2,a+h/2,0,e);p.d>d.d&&(d=p);let f=2;function m(y,x,w){let S=new kf(y,x,w,e);if(f++,S.max>d.d+i&&u.push(S),S.d>d.d&&(d=S,r&&console.log(`found best ${Math.round(1e4*S.d)/1e4} after ${f} probes`),d.d>t))return t}let g=c/2;for(let y=s;y<n;y+=c)for(let x=a;x<o;x+=c)m(y+g,x+g,g);for(;u.length;){let{max:y,x,y:w,h:S}=u.pop();if(y-d.d<=i)break;g=S/2,m(x-g,w-g,g),m(x+g,w-g,g),m(x-g,w+g,g),m(x+g,w+g,g)}r&&console.log(`num probes: ${f} 3140best distance: ${d.d}`);let v=[d.x,d.y];return v.distance=d.d,v.distance}function kf(e,t,i,r){this.x=e,this.y=t,this.h=i,this.d=u9(e,t,r),this.max=this.d+this.h*Math.SQRT2}function u9(e,t,i){let r=!1,s=1/0;for(let a of i)for(let n=0,o=a.length,l=o-1;n<o;l=n++){let h=a[n],c=a[l];h[1]>t!=c[1]>t&&e<(c[0]-h[0])*(t-h[1])/(c[1]-h[1])+h[0]&&(r=!r),s=Math.min(s,p9(e,t,h,c))}return s===0?0:(r?1:-1)*Math.sqrt(s)}function d9(e){let t=0,i=0,r=0,s=e[0];for(let n=0,o=s.length,l=o-1;n<o;
3140l=n++){let h=s[n],c=s[l],u=h[0]*c[1]-c[0]*h[1];i+=(h[0]+c[0])*u,r+=(h[1]+c[1])*u,t+=u*3}let a=new kf(i/t,r/t,0,e);return t===0||a.d<0?new kf(s[0][0],s[0][1],0,e):a}function p9(e,t,i,r){let s=i[0],a=i[1],n=r[0]-s,o=r[1]-a;if(n!==0||o!==0){let l=((e-s)*n+(t-a)*o)/(n*n+o*o);l>1?(s=r[0],a=r[1]):l>0&&(s+=n*l,a+=o*l)}return n=e-s,o=t-a,n*n+o*o}var lx={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},YC={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},QC={vertices:[-160,160,160,-160,160,160,-160,-160],vertexIndices:[1,3,0,2],vertexCount:4,elements:[0,1,2,1,0,3],elementCount:2,mesh:void 0},Ng=(e,t)=>([i,r])=>(r<i&&(r+=t),(e>=i?e:e+t)<=r),hx=class extends He{constructor(e,t,i=0,r=12,s=3,a=Gt.ODD,n=!1){super(),this.forPathBevel=n,this.type="ShapeGeometry",this.vertexCache={},this._shape=e,this._depth=t,this._curveSegments=r,this._bevelSegmentsInput=s;let o=this._shape.extractShapePointsToFlatArray([],r),l=this._shape.shapeHoles.map(A=>{let C=A.extractShapePointsToFlatArray([],r),T=[];for(let I=C.length-1;I>=1;I-=2){let P=C[I-1],O=C[I-0];T.push(P,O)}return T}),h=[],c=[];for(let A=0;A<o.length;A+=2)c.push([o[A],o[A+1]]);h.push(c);for(let A=0;A<l.length;A++){let C=l[A],T=[];for(let I=0;I<C.length;I+=2)T.push([C[I],C[I+1]]);h.push(T)}let u;e.isText?u=new u1().setFromPoints(e.points.map(A=>A.position)).getSize(new H).length()*.1:h[0].length===0?u=i:i>0?u=c9(h,i):u=1e-5,i<=0?(this._bevel=0,this._bevelSegments=0):(this._bevel=Math.min(i,u,t/2),this._bevelSegments=Math.floor(s));let d;try{d=$n({windingRule:a,elementType:Oi.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[o]})}catch{d=lx}let p;try{p=$n({windingRule:Gt.ODD,elementType:Oi.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...l]})}catch{p=YC}if(!d)throw new Error("error generating geometry");let f=d.elementCount;if(p){d.elementCount+=p.elementCount;for(let A=0;A<p.elements.length;A++){let C=p.elements[A],T=A%2===0?d.vertexCount:0;d.elements.push(C+T)}for(let A=0;A<p.vertexIndices.length;A++){let C=p.vertexIndices[A],T=d.vertexCount;d.vertexIndices.push(C+T)}for(let A=0;A<p.vertices.length;A++){let C=p.vertices[A];d.vertices.push(C)}}let m=1/0,g=-1/0,v=1/0,y=-1/0;for(let A=0,C=d.vertexCount;A<C;A++){let T=A*2,I=d.vertices[T+0],P=d.vertices[T+1];I<m&&(m=I),I>g&&(g=I),P<v&&(v=P),P>y&&(y=P)}this._minX=m,this._minY=v,this._width=g-m,this._height=y-v,this._buffer=new XC(this._computeBufferEstimatedSize(d));let x=[],w=[];for(let A=d.elementCount-1;A>=0;A--){let C=A>=f,T=A*2,I=d.elements[T+0],P=d.elements[T+1],O=I+P,k={start:I,count:P,normals:[],continuous:[],concave:[]},G=I,B=O-1,U=I+1,Q=this._shape.roundedCurves.length;do{let K=G-I,Z=d.vertices[B*2+0],W=d.vertices[B*2+1],re=d.vertices[G*2+0],$=d.vertices[G*2+1],ne=d.vertices[U*2+0],ie=d.vertices[U*2+1],ve=re-Z,de=$-W,we=Math.sqrt(ve*ve+de*de);ve/=we,de/=we;let Re=re-ne,Me=$-ie,Ve=Math.sqrt(Re*Re+Me*Me);Re/=Ve,Me/=Ve,k.normals[K*2+0]=-Me,k.normals[K*2+1]=Re,k.concave[K]=ve*Me-de*Re>0;let Ne=d.vertexIndices[G];if(Array.isArray(Ne))k.continuous[K]=!1;else{let[Oe,Ee]=this._shape.getCurveIndexFromVertexId(Ne-1,!0);if(Ee>0&&Ee<1)k.continuous[K]=!0;else{let Qe=Ee===1?Oe+1:Oe-1;Qe=(Qe+Q)%Q;let qe=Ee===1?0:1,V=this._shape.roundedCurves[Oe].getTangent(Ee),z=this._shape.roundedCurves[Qe].getTangent(qe);k.continuous[K]=V.dot(z)>.95}}C&&(k.normals[K*2+0]*=-1,k.normals[K*2+1]*=-1),[B,G,U]=[G,U,U+1],U>=O&&(U-=P)}while(U!==I+1);let q=[];q.push({bevelI:0,angle:0,size:0,boundary:{vertices:d.vertices.slice(I*2,O*2),vertexCount:P,vertexIndices:new Array(P).fill(!0).map((K,Z)=>[Z,Z]),elements:[0,P],elementCount:1,mesh:null},reverseMap:[],insetPoints:d.vertices.slice(I*2,O*2)});let j=0;for(let K=1;K<=this._bevelSegments;K++){let Z=K/this._bevelSegments*Math.PI/2,W=(1-Math.cos(Z))*this._bevel,re=[],$=[],ne=0;for(let ve=0;ve<P;ve++){let de=ve*2,we=(ve-1+P)%P*2,Re=d.vertices[k.start*2+de+0],Me=d.vertices[k.start*2+de+1],Ve=-k.normals[we+0]*W,Ne=-k.normals[we+1]*W,Oe=-k.normals[de+0]*W,Ee=-k.normals[de+1]*W;if(k.concave[ve]||!k.concave[ve]&&C){let Qe=Math.atan2(Ne,Ve),qe=Math.atan2(Ee,Oe);qe>Qe&&(qe-=Math.PI*2);let V=qe-Qe;
3140if(k.continuous[ve]||C){let z=Qe+V/2,oe=Math.cos(z)*W,Se=Math.sin(z)*W;re[2*ne+0]=Re+oe*(C?-1:1),re[2*ne+1]=Me+Se*(C?-1:1),$[ne]=ve,ne++}else{let z=Math.max(1,Math.floor(r/4*Math.abs(V)/Math.PI));for(let oe=0;oe<=z;oe++){let Se=Qe+V*(oe/z),R=Math.cos(Se)*W,Ae=Math.sin(Se)*W;re[2*ne+0]=Re+R,re[2*ne+1]=Me+Ae,$[ne]=ve,ne++}}}else re[2*ne+0]=Re+Ve,re[2*ne+1]=Me+Ne,$[ne]=ve,ne++,re[2*ne+0]=Re,re[2*ne+1]=Me,$[ne]=ve,ne++,re[2*ne+0]=Re+Oe,re[2*ne+1]=Me+Ee,$[ne]=ve,ne++}let ie=$n({windingRule:Gt.POSITIVE,elementType:Oi.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[re],edgeCreateCallback:ve=>{let de=ve.Org.idx,we=$[de],Re=$[(de+1)%$.length];ve.idx=[we,Re],ve.Sym.idx=[Re,we]},vertexIdCallback:ve=>{let de=ve.Lprev.idx;return[de?de[1]:0,ve.idx?ve.idx[0]:0]}});if(!ie)throw console.log("Error"),new Error(`error generating bevel geometry for ${K}'th loop`);if(!ie.vertexCount){let ve=(K-1)/this._bevelSegments*Math.PI/2;j=(1-Math.sin(ve))*this._bevel;break}for(let ve=0;ve<ie.vertexIndices.length;ve++){let[de,we]=ie.vertexIndices[ve];if(de===we)continue;let Re=we;we<de&&(Re+=P);for(let Me=de;Me<Re;Me++){let Ve=Me%P,Ne=(Me+1)%P;if(!k.continuous[Ve]||!k.continuous[Ne]){ie.vertexIndices[ve]=[de,Ve],ie.vertexIndices.splice(ve+1,0,[Ne,we]),ie.vertices.splice((ve+1)*2,0,ie.vertices[ve*2],ie.vertices[ve*2+1]);break}}}q.push({bevelI:K,angle:Z,size:W,boundary:ie,reverseMap:$,insetPoints:re})}let X=(K,Z,W)=>{let re=0,$=K.boundary.vertexIndices.length;for(;re<$&&W(K.boundary.vertexIndices[Z]);)Z=(Z+1)%$,re++;return re},te=x.length;for(let K=1;K<q.length;K++){let Z=q[K-1],W=q[K],re=Z.boundary.vertexIndices.length,$=W.boundary.vertexIndices.length;if(!re||!$)break;let ne=k.concave.length,ie=0,ve=Ng(ie,P);for(;!Z.boundary.vertexIndices.filter(ve).length||!W.boundary.vertexIndices.filter(ve).length;)ie++,ve=Ng(ie,P);let de=Z.boundary.vertexIndices.findIndex(ve),we=W.boundary.vertexIndices.findIndex(ve);do de=(de+1)%re;while(ve(Z.boundary.vertexIndices[de]));do we=(we+1)%$;while(ve(W.boundary.vertexIndices[we]));ie=(ie+1)%P;let Re=ie,Me=0,Ve=this._buildBevelVert(k,Z,(de-1+re)%re,void 0,Me),Ne=this._buildBevelVert(k,W,(we-1+$)%$,void 0,Me),Oe=Ve,Ee=Ne,Qe,qe,V=!1;do{Me=(ie||ne)/ne,ve=Ng(ie,P);let z=X(Z,de,ve),oe=X(W,we,ve),Se=V;if(V=!1,z&&!oe){for(let R=0;R<z;R++)Qe=this._buildBevelVert(k,Z,(de+R)%re,R/(z-1),Me),x.push(Oe.topN,Qe.topP,Ee.topN),n===!1&&x.push(Qe.bottomP,Oe.bottomN,Ee.bottomN),Oe=Qe;V=!0}else if(!z&&oe)for(let R=0;R<oe;R++)qe=this._buildBevelVert(k,W,(we+R)%$,R/(oe-1),Me),x.push(Ee.topN,Oe.topP,qe.topP),n===!1&&x.push(Oe.bottomP,Ee.bottomN,qe.bottomP),Ee=qe;else if(z&&oe)if(Qe=this._buildBevelVert(k,Z,de,0,Me),qe=this._buildBevelVert(k,W,we,0,Me),Se?(x.push(Oe.topN,qe.topP,Ee.topN),x.push(Oe.topN,Qe.topP,qe.topP),n===!1&&(x.push(qe.bottomP,Oe.bottomN,Ee.bottomN),x.push(qe.bottomP,Qe.bottomP,Oe.bottomN))):(x.push(Ee.topN,Oe.topN,Qe.topP),x.push(Ee.topN,Qe.topP,qe.topP),n===!1&&(x.push(Qe.bottomP,Oe.bottomN,Ee.bottomN),x.push(Qe.bottomP,Ee.bottomN,qe.bottomP))),Oe=Qe,Ee=qe,z===oe)for(let R=1;R<z;R++)Qe=this._buildBevelVert(k,Z,(de+R)%re,R/(z-1),Me),qe=this._buildBevelVert(k,W,(we+R)%$,R/(oe-1),Me),x.push(Oe.topN,Qe.topP,Ee.topN),x.push(Ee.topN,Qe.topP,qe.topP),n===!1&&(x.push(Qe.bottomP,Oe.bottomN,Ee.bottomN),x.push(Qe.bottomP,Ee.bottomN,qe.bottomP)),Oe=Qe,Ee=qe;else if(z>oe){let R=z/oe,Ae=0;for(let ke=1;ke<z;ke++)Qe=this._buildBevelVert(k,Z,(de+ke)%re,ke/(z-1),Me),x.push(Oe.topN,Qe.topP,Ee.topN),n===!1&&x.push(Qe.bottomP,Oe.bottomN,Ee.bottomN),Oe=Qe,ke>(Ae+1)*R&&(Ae++,qe=this._buildBevelVert(k,W,(we+Ae)%$,Ae/(oe-1),Me),x.push(Ee.topN,Qe.topP,qe.topP),n===!1&&x.push(Qe.bottomP,Ee.bottomN,qe.bottomP),Ee=qe)}else{let R=oe/z,Ae=0;for(let ke=1;ke<oe;ke++)qe=this._buildBevelVert(k,W,(we+ke)%$,ke/(oe-1),Me),x.push(Ee.topN,Qe.topP,qe.topP),n===!1&&x.push(Qe.bottomP,Ee.bottomN,qe.bottomP),Ee=qe,ke>(Ae+1)*R&&(Ae++,Qe=this._buildBevelVert(k,Z,(de+Ae)%re,Ae/(z-1),Me),x.push(Oe.topN,Qe.topP,Ee.topN),n===!1&&x.push(Qe.bottomP,Oe.bottomN,Ee.bottomN),Oe=Qe)}de=(de+z)%re,we=(we+oe)%$,ie=(ie+1)%ne}while(ie!==Re)}if(n===!1&&this._depth>this._bevel*2&&this._buildWall(q,k,x),C){let K=[];for(let Z=x.length-1;Z>=te+2;Z-=3){let W=x[Z-2],re=x[Z-1],$=x[Z-0];K.push($,re,W)}x.splice(te,x.length-te,...K)}if(C){let K=[];for(let Z=q[q.length-1].boundary.vertices.length-1;Z>=1;Z-=2){let W=q[q.length-1].boundary.vertices[Z-1],re=q[q.length-1].boundary.vertices[Z-0];K.push(W,re)}w.push(K)}if(!C){let K=q[q.length-1],Z;try{Z=$n({windingRule:q.length>1?Gt.POSITIVE:Gt.ODD,elementType:Oi.POLYGONS,vertexSize:2,strict:!0,contours:[K.insetPoints,...w]})}catch{Z=QC}if(!Z)throw new Error("Error generating geometry for surface");l.length===0&&this._bevel<u&&Object.assign(this,{useNgonForTopBottomFaceDuringBake:!0});for(let W=0;W<Z.elementCount*3;W+=3){let re=this._buildSurfaceVert(Z,Z.elements[W+0],j),$=this._buildSurfaceVert(Z,Z.elements[W+1],j),ne=this._buildSurfaceVert(Z,Z.elements[W+2],j);x.push(re.top,$.top,ne.top),n===!1&&x.push(ne.bottom,$.bottom,re.bottom)}}this.vertexCache={}}this._buffer.shrink();let S=new tt(Uint32Array.from(x),1),b=new tt(this._buffer.positions,3),E=new tt(this._buffer.normals,3),_=new tt(this._buffer.uvs,2);b.needsUpdate=!0,E.needsUpdate=!0,_.needsUpdate=!0,S.needsUpdate=!0,this.setAttribute("position",b),this.setAttribute("normal",E),this.setAttribute("uv",_),this.setIndex(S)}_computeBufferEstimatedSize(e){return e.vertexCount*2*(2+this._bevelSegments)}_buildWall(e,t,i){let r=e[0];for(let s=0,a=r.boundary.vertexCount;s<a;s++){let n=this._buildBevelVert(t,r,s),o=this._buildBevelVert(t,r,(s+1)%a);i.push(o.topP,n.topN,n.bottomN),i.push(o.topP,n.bottomN,o.bottomP)}}_buildSurfaceVert(e,t,i){let r=t.toString();if(r in this.vertexCache)return this.vertexCache[r];let s=e.vertices[t*2+0],a=e.vertices[t*2+1],n=(s-this._minX)/this._width,o=(a-this._minY)/this._height;this.forPathBevel&&(o=1);let l=this._buffer.get(this.forPathBevel?1:2),h=l*3,c=l*2,u={top:l+0,bottom:l+1};return this._buffer.positions[h+0]=s,this._buffer.positions[h+1]=a,this._buffer.positions[h+2]=this.forPathBevel?this._bevel:this._depth-i,this._buffer.normals[h+0]=0,this._buffer.normals[h+1]=0,this._buffer.normals[h+2]=1,this._buffer.uvs[c+0]=n,this._buffer.uvs[c+1]=o,this.forPathBevel===!1&&(this._buffer.positions[h+3]=s,this._buffer.positions[h+4]=a,this._buffer.positions[h+5]=i,this._buffer.normals[h+3]=0,this._buffer.normals[h+4]=0,this._buffer.normals[h+5]=-1,this._buffer.uvs[c+2]=n,this._buffer.uvs[c+3]=o),this.vertexCache[r]=u,u}_buildBevelVert(e,t,i,r=1,s){let a=`${t.bevelI}
3140:${i}`;if(a in this.vertexCache&&s!==0&&s!==1&&(!s||s===this.vertexCache[a].pathBevelUCoord))return this.vertexCache[a];let[n,o]=t.boundary.vertexIndices[i],l,h,c,u;n!==o?(h=n,l=o,u=!1,c=e.continuous[h]&&e.continuous[l]):(l=n,h=(l-1+e.count)%e.count,u=e.concave[l]&&t.bevelI>0,c=e.continuous[l]||u);let d=Math.cos(t.angle),p=Math.sin(t.angle),f=i*2,m=l*2,g=h*2,v=t.boundary.vertices[f+0],y=t.boundary.vertices[f+1],x=(1-p)*this._bevel,w=(v-this._minX)/this._width,S=(y-this._minY)/this._height;this.forPathBevel&&(s!==void 0&&(w=s),S=1);let b=e.normals[m+0],E=e.normals[m+1],_=e.normals[g+0],A=e.normals[g+1];if(u){let O=_-b,k=A-E;b=b+O*(1-r),E=E+k*(1-r);let G=Math.sqrt(b*b+E*E);b/=G,E/=G}let C=this.forPathBevel?this._buffer.get(c?1:2):this._buffer.get(c?2:4),T=C*3,I=C*2,P={i,fi:l,topP:C+0,topN:C+0,bottomP:C+1,bottomN:C+1,pathBevelUCoord:s};return this._buffer.positions[T+0]=v,this._buffer.positions[T+1]=y,this._buffer.positions[T+2]=(this.forPathBevel?this._bevel:this._depth)-x,this._buffer.normals[T+0]=b*d,this._buffer.normals[T+1]=E*d,this._buffer.normals[T+2]=p,this._buffer.uvs[I+0]=w,this._buffer.uvs[I+1]=S,this.forPathBevel===!1&&(this._buffer.positions[T+3]=v,this._buffer.positions[T+4]=y,this._buffer.positions[T+5]=x,this._buffer.normals[T+3]=b*d,this._buffer.normals[T+4]=E*d,this._buffer.normals[T+5]=-p,this._buffer.uvs[I+2]=S,this._buffer.uvs[I+3]=w),c||(this.forPathBevel?(C+=1,T+=3,I+=2):(C+=2,T+=6,I+=4),P.topP=C+0,P.bottomP=C+1,this._buffer.positions[T+0]=v,this._buffer.positions[T+1]=y,this._buffer.positions[T+2]=(this.forPathBevel?this._bevel:this._depth)-x,this._buffer.normals[T+0]=_*d,this._buffer.normals[T+1]=A*d,this._buffer.normals[T+2]=p,this._buffer.uvs[I+0]=w,this._buffer.uvs[I+1]=S,this.forPathBevel===!1&&(this._buffer.positions[T+3]=v,this._buffer.positions[T+4]=y,this._buffer.positions[T+5]=x,this._buffer.normals[T+3]=_*d,this._buffer.normals[T+4]=A*d,this._buffer.normals[T+5]=-p,this._buffer.uvs[I+2]=S,this._buffer.uvs[I+3]=w)),this.vertexCache[a]=P,P}clone(){let e=new hx(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=hm(this.userData),e}},KC=class extends He{constructor(e,t=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=Gt.ODD,this.elementType=Oi.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=e,this._curveSegments=t,this._triangulationOptions=Object.assign({windingRule:Gt.ODD,elementType:Oi.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let r=this._shape.extractShapePointsToFlatArray([],this._curveSegments),s=this._shape.shapeHoles.map(d=>d.extractShapePointsToFlatArray([],this._curveSegments)),a,n=!0,o=!0,l,h;for(let d=0,p=r.length/2;d<p;d++){let f=d*2,m=r[f+0],g=r[f+1];if(l!==void 0&&m!==l&&(n=!1),h!==void 0&&g!==h&&(o=!1),l=m,h=g,!n&&!o)break}if(!n&&!o)try{a=$n({contours:[r,...s],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{a=lx}let c=a?.vertexCount??1,u=a?.elementCount??1;if(this._positionAttribute=new tt(new Float32Array(c*3),3),this._normalAttribute=new tt(new Float32Array(c*3),3),this._uvAttribute=new tt(new Float32Array(c*2),2),this._indexAttribute=new tt(new Uint32Array(u*3),1),a){let d=1/0,p=-1/0,f=1/0,m=-1/0;for(let y=0,x=c;y<x;y++){let w=y*2,S=a.vertices[w+0],b=a.vertices[w+1];S<d&&(d=S),S>p&&(p=S),b<f&&(f=b),b>m&&(m=b)}let g=p-d,v=m-f;for(let y=0,x=c;y<x;y++){let w=y*2,S=a.vertices[w+0],b=a.vertices[w+1],E=(S-d)/g,_=(b-f)/v;this._positionAttribute.setXYZ(y,S,b,0),this._normalAttribute.setXYZ(y,0,0,1),this._uvAttribute.setXY(y,E,_)}for(let y=0,x=u;y<x;y++){let w=y*3,S=a.elements[w+0],b=a.elements[w+1],E=a.elements[w+2];this._indexAttribute.setX(w+0,S),this._indexAttribute.setX(w+1,b),this._indexAttribute.setX(w+2,E)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,(a?.elementCount??1)*3)}clone(){let e=new KC(this._shape,this._curveSegments);return e.userData=hm(this.userData),e}},ZC=class extends hx{constructor(e,t,i=0,r=12,s=3,a=Gt.ODD){super(e,t,i,r,s,a),this.type="ShapeGeometry"}_computeBufferEstimatedSize(e){return e.vertexCount*2*(2+this._bevelSegments)}_buildWall(e,t,i){let r=e[0];for(let s=0,a=r.boundary.vertexCount;s<a;s++){let n=this._buildBevelVert(t,r,s),o=this._buildBevelVert(t,r,(s+1)%a);i.push(o.topP,n.topN,n.bottomN),i.push(o.topP,n.bottomN,o.bottomP)}}clone(){let e=new ZC(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=hm(this.userData),e}},ul=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:Gt.ODD},e.parameters),r=Math.abs(i.width),s=Math.abs(i.height??i.width),a=Math.abs(i.depth??0),n=e.shape??t?.shape,o=n?.roundness??i.roun
vendor: 7,097 bytes, line 3140
3140dness;n!==void 0&&(n instanceof mi?(n.width!==r||n.height!==s)&&n.applySize(r,s):n=new mi(r,s).fromJSON(n),e.parameters?.roundness!==void 0&&e.parameters?.roundness>0&&n.update());let l=n??new mi(r,s);return{parameters:Object.assign(i,{width:r,height:s,depth:a,roundness:o}),shape:l}}static build(e){let{depth:t,extrudeBevelSize:i,extrudeBevelSegments:r,subdivisions:s,roundness:a,windingRule:n}=e.parameters;e.shape.roundness=a;let o;return t<=0?o=new KC(e.shape,s,{windingRule:n}):o=new ZC(e.shape,t,i,s,r,n),Object.assign(o,{userData:{...e,type:"VectorGeometry"}})}},JC=Math.PI*2,cx=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return i.angle=Te.clamp(i.angle,0,360),{shape:e.shape&&e.shape instanceof mi?e.shape:new mi,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i,spikes:r,angle:s,innerRadius:a,depth:n,extrudeBevelSize:o,extrudeBevelSegments:l}=e.parameters,h=e.shape,c=t*.5,u=i*.5,d=f9(h,c,u,s*Math.PI/180,r,a);h.isClosed=!0,h.update();let p;return s===0?(p=new He,p.setAttribute("position",new De([],3))):p=ul.create({shape:h,parameters:{subdivisions:d,depth:n,extrudeBevelSize:o,extrudeBevelSegments:l}}),Object.assign(p,{userData:{...e,type:"EllipseGeometry"}})}};function f9(e,t,i,r,s,a){if(r>=JC)return s>30||s%4===0?(g9(e,t,i,a),Math.round(s/4)):F_(e,r,s,t,i,a);r=Math.max(r,.001);let n={x:0,y:i},o=r+Math.PI*.5,l={x:Math.cos(o)*t,y:Math.sin(o)*i},h=s9({px:n.x,py:n.y,cx:l.x,cy:l.y,rx:t,ry:i,largeArcFlag:r>Math.PI,sweepFlag:!0});return s>30||s%h.length===0?m9(e,n.x,n.y,h,s,t,i,a):F_(e,r,s,t,i,a)}function m9(e,t,i,r,s,a,n,o){let l=Math.round(s/r.length);e.addPoint(mh(t,i));for(let h=0,c=r.length;h<c;h++){let u=r[h],d=e.points[h],p=mh(u.x,u.y);d.controls[1].position.set(u.x1,u.y1),p.controls[0].position.set(u.x2,u.y2),e.addPoint(p)}return o>0?$C(e,a,n,o):e.addPoint(mh(0,0)),l}function F_(e,t,i,r,s,a){let n=-t/i;for(let o=0;o<=i;o++){let l=n*o,h=Math.sin(l)*r,c=Math.cos(l)*s;e.addPoint(mh(h,c))}return t<JC?a>0?$C(e,r,s,a):e.addPoint(mh(0,0)):(e.removePoint(e.points[e.points.length-1]),a>0&&eT(e,r,s,a)),1}function g9(e,t,i,r=0,s=0,a=0){let n=.5522847498,o=t*n,l=i*n;e.addPoint(qd(s-t,a,s-t,a-l,s-t,a+l)),e.addPoint(qd(s,a+i,s-o,a+i,s+o,a+i)),e.addPoint(qd(s+t,a,s+t,a+l,s+t,a-l)),e.addPoint(qd(s,a-i,s+o,a-i,s-o,a-i)),r>0&&eT(e,t,i,r)}function mh(e,t){return new fh(Te.generateUUID(),new H(e,t))}function qd(e,t,i,r,s,a){let n=mh(e,t);return n.controls[0].position.set(i,r),n.controls[1].position.set(s,a),n}function $C(e,t,i,r){tT(e,t,i,r).forEach(s=>e.addPoint(s))}function eT(e,t,i,r){let s=tT(e,t,i,r),a=new mi;s.forEach(n=>a.addPoint(n)),a.isClosed=!0,e.shapeHoles.push(a)}function tT(e,t,i,r){let s=r*t/100,a=s*(Math.abs(i)/Math.abs(t)),n=new H(s/t,a/i),o=e.points.map(l=>{let h=l.clone();return h.uuid=Te.generateUUID(),h}).reverse();return o.forEach(l=>{l.position.multiply(n);let h=l.controls[0].position.clone().multiply(n),c=l.controls[1].position.clone().multiply(n);l.controls[0].position.copy(c),l.controls[1].position.copy(h)}),o}var v9=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},e.parameters),r=Math.abs(i.width),s=Math.abs(i.height??r),a=Math.abs(i.depth??r),n=Math.abs(Math.min(r,a))/2;return{parameters:Object.assign(i,{width:r,height:s,depth:a,radius:n,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(e){let{width:t,height:i,depth:r,radius:s,revolutions:a,segments:n,pathRadius:o,pathType:l,pathSegments:h,cornerRadius:c,cornerSegments:u}=e.parameters,d=new iT(!1,t,i,r,s,a,n,o,l,h,c,u);return Object.assign(d,{userData:{...e,type:"HelixGeometry"}})}},Vg=new lh([0,0,0],1),iT=class extends He{constructor(e=!0,t=1,i=1,r=1,s=1,a=1,n=1,o=1,l=1,h=1,c=1,u=1){if(super(),a===0)return;let d=e&&a===1;d&&(u=0),c>100&&(c=100),c===0&&(u=0);let p=()=>new M,f=new M,m=p(),g=p(),v=p(),y,x,w,S,b,E,_,A,C=p(),T=p(),I=p(),P=p(),O=p(),k=p(),G=p(),B=p(),U=i-2*o+.001,Q=U/a,q=Math.ceil(n*a),j=q+1,X=U/q,te=-U/2,K=h+1,Z=2*Math.PI/h,W=Math.PI/2/u,re=.01,$=Math.min((1-c/100)*o,o-re),ne=o-$,ie=0,ve=2,de=u*ve+ve,we=K*de/ve,Re=we+K*j,Me=Math.max(0,K*(j+de)),[Ve,Ne,Oe]=[3,3,2].map(ce=>Array(Me*ce).fill(0)),Ee=[],Qe=s-o;function qe(ce,je){let Le=Math.PI/2;E=je*X,A=2*Math.PI*(E%Q)/Q+Le,E+=te,_=Math.sin(A)*Qe,b=Math.cos(A)*Qe,e?ce.set(b,_,E):ce.set(b,E,_)}qe(f,-1e-10),qe(m,0),C.copy(f),qe(f,1);let V=f.distanceTo(m),z=d?0:ne+$,oe=V*q+2*z,Se=$,R=oe-z;for(let ce=0;ce<=q;ce++){qe(g,ce),B.subVectors(g,C).normalize(),C.copy(g),k.copy(g).setComponent(+e+1,0).normalize(),G.crossVectors(B,k).normalize();let je=ce===0,Le=ce===q,Xe=je?3*Math.PI/2:W,it=je?Se:R,Ke=je?K:Re,$e=je?0:Me-K,qt=B.clone().multiplyScalar(je?-ne:ne).add(g),hi=B.clone().multiplyScalar(je?-1:1).normalize();for(let J=0;J<K;J++){let fe=J*Z;if(T.addVectors(f.copy(k).multiplyScalar(o*Math.cos(fe)),m.copy(G).multiplyScalar(o*Math.sin(fe))),I.copy(T).normalize(),je||Le){d||(ie=$e+J,[0,1,2].forEach(be=>{Ve[ie*3+be]=qt.getComponent(be),Ne[ie*3+be]=hi.getComponent(be)}),Oe[ie*2]=+Le,Oe[ie*2+1]=J/h),m.copy(I).multiplyScalar($),v.addVectors(g,m);for(let be=0;be<u;be++){let ze=be*W+Xe;P.addVectors(f.copy(B).multiplyScalar(ne*Math.sin(ze)),m.copy(I).multiplyScalar(ne*Math.cos(ze))),O.copy(P).normalize(),m.addVectors(v,P),P.normalize(),ie=Ke+be*K+J,[0,1,2].forEach(Et=>{Ve[ie*3+Et]=m.getComponent(Et),Ne[ie*3+Et]=O.getComponent(Et)});let lt=+je+Math.sin(ze);Oe[ie*2]=(it+ne*lt)/oe,Oe[ie*2+1]=J/h}}m.addVectors(g,T),ie=we+ce*K+J,[0,1,2].forEach(be=>{Ve[ie*3+be]=m.getComponent(be),Ne[ie*3+be]=I.getComponent(be)}),Oe[ie*2]=(z+ce*V)/oe,Oe[ie*2+1]=J/h}}let Ae=j+2*u+ve,[ke,Ie]=[+d,Ae-1];for(let ce=ke;ce<=Ie-1;ce++){let je=d&&ce===Ie-1;for(let Le=0;Le<K-1;Le++)y=ce*K+Le,x=y+1,w=(je?Le:y)+K,S=(je?Le+1:x)+K,ce===0?Ee.push(x,S,w):ce===Ae-2?Ee.push(y,x,w):Ee.push(y,x,w,x,S,w)}this.setIndex(Ee),this.setAttribute("position",new De(Ve,3)),this.setAttribute("normal",new De(Ne,3)),this.setAttribute("uv",new De(Oe,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let e=this.userData.parameters,t=Math.ceil(e.tubularSegments),i=e.radialSegments+1,r=Array.from(this.getIndex().array),s,a,n,o,l=6*(t-1)*e.radialSegments,h=t,c=h===t;for(let u=0;u<e.radialSegments;u++)s=h*i+u,a=s+1,n=(c?u:s)+i,o=(c?u+1:a)+i,r[l++]=s,r[l++]=a,r[l++]=n,r[l++]=a,r[l++]=o,r[l++]=n;return r.length=l,Vg.array=r,Vg.count=r.length,Vg}},y9=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}
3140static build(e){let{width:t,height:i,depth:r,detail:s,corner:a,cornerSides:n}=e.parameters,o=s===0&&a!==0?new rT(t*.5,a,n):new LM(t*.5,s);return o.scale(1,i/t,r/t),Object.assign(o,{userData:{...e,type:"IcosahedronGeometry"}})}},rT=class extends ax{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,s=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,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],n="IcosahedronGeometry";super(s,a,n,e,t,i),this.type=n}static fromJSON(e){return new rT(e.radius,e.corner,e.cornerSides)}},x9=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){(e.parameters?.points??[]).forEach(r=>{Array.isArray(r)&&(r.x=r[0],r.y=r[1])});let i=Object.assign({},t?.parameters??{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{points:t,segments:i,verticalSegments:r}=e.parameters,s=new Zp;s.moveTo(t[0].x,t[0].y),s.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y);let a=new TM(s.extractPoints(r).shape,i);return a.rotateZ(Math.PI),Object.assign(a,{userData:{...e,type:"LatheGeometry"}})}},Js=new xe,jg=new Vt,Xd=new M,Uf=class extends or{constructor(){super(),this.uuid=Te.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}applyMatrix4(e){let t=new Ii().getNormalMatrix(e);for(let i=0,r=this.vertices.length;i<r;i++)this.vertices[i].applyMatrix4(e);for(let i=0,r=this.faces.length;i<r;i++){let s=this.faces[i];s.normal.applyMatrix3(t).normalize();for(let a=0,n=s.vertexNormals.length;a<n;a++)s.vertexNormals[a].applyMatrix3(t).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this}rotateX(e){return Js.makeRotationX(e),this.applyMatrix4(Js),this}rotateY(e){return Js.makeRotationY(e),this.applyMatrix4(Js),this}rotateZ(e){return Js.makeRotationZ(e),this.applyMatrix4(Js),this}translate(e,t,i){return Js.makeTranslation(e,t,i),this.applyMatrix4(Js),this}scale(e,t,i){return Js.makeScale(e,t,i),this.applyMatrix4(Js),this}lookAt(e){return jg.lookAt(e),jg.updateMatrix(),this.applyMatrix4(jg.matrix),this}fromBufferGeometry(e){let t=this,i=e.index!==null?e.index:void 0,r=e.attributes;if(r.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;let s=r.position,a=r.normal,n=r.color,o=r.uv,l=r.uv2;l!==void 0&&(this.faceVertexUvs[1]=[]);for(let u=0;u<s.count;u++)t.vertices.push(new M().fromBufferAttribute(s,u)),n!==void 0&&t.colors.push(new Je().fromBufferAttribute(n,u));function h(u,d,p,f){let m=n===void 0?[]:[t.colors[u].clone(),t.colors[d].clone(),t.colors[p].clone()],g=a===void 0?[]:[new M().fromBufferAttribute(a,u),new M().fromBufferAttribute(a,d),new M().fromBufferAttribute(a,p)],v=new fy(u,d,p,g,m,f);t.faces.push(v),o!==void 0&&t.faceVertexUvs[0].push([new H().fromBufferAttribute(o,u),new H().fromBufferAttribute(o,d),new H().fromBufferAttribute(o,p)]),l!==void 0&&t.faceVertexUvs[1].push([new H().fromBufferAttribute(l,u),new H().fromBufferAttribute(l,d),new H().fromBufferAttribute(l,p)])}let c=e.groups;if(c.length>0)for(let u=0;u<c.length;u++){let d=c[u],p=d.start,f=d.count;for(let m=p,g=p+f;m<g;m+=3)i!==void 0?h(i.getX(m),i.getX(m+1),i.getX(m+2),d.materialIndex):h(m,m+1,m+2,d.materialIndex)}else if(i!==void 0)for(let u=0;u<i.count;u+=3)h(i.getX(u),i.getX(u+1),i.getX(u+2));else for(let u=0;u<s.count;u+=3)h(u,u+1,u+2);return this.computeFaceNormals(),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Xd).negate(),this.translate(Xd.x,Xd.y,Xd.z),this}normalize(){this.computeBoundingSphere();let e=this.boundingSphere.center,t=this.boundingSphere.radius,i=t===0?1:1/t,r=new xe;return r.set(i,0,0,-i*e.x,0,i,0,-i*e.y,0,0,i,-i*e.z,0,0,0,1),this.applyMatrix4(r),this}computeFaceNormals(){let e=new M,t=new M;for(let i=0,r=this.faces.length;i<r;i++){let s=this.faces[i],a=this.vertices[s.a],n=this.vertices[s.b],o=this.vertices[s.c];e.subVectors(o,n),t.subVectors(a,n),e.cross(t),e.normalize(),s.normal.copy(e)}}computeVertexNormals(e=!0){let t=new Array(this.vertices.length);for(let i=0,r=this.vertices.length;i<r;i++)t[i]=new M;if(e){let i=new M,r=new M;for(let s=0,a=this.faces.length;s<a;s++){let n=this.faces[s],o=this.vertices[n.a],l=this.vertices[n.b],h=this.vertices[n.c];i.subVectors(h,l),r.subVectors(o,l),i.cross(r),t[n.a].add(i),t[n.b].add(i),t[n.c].add(i)}}else{this.computeFaceNormals();for(let i=0,r=this.faces.length;i<r;i++){let s=this.faces[i];t[s.a].add(s.normal),t[s.b].add(s.normal),t[s.c].add(s.normal)}}for(let i=0,r=this.vertices.length;i<r;i++)t[i].normalize();for(let i=0,r=this.faces.length;i<r;i++){let s=this.faces[i],a=s.vertexNormals;a.length===3?(a[0].copy(t[s.a]),a[1].copy(t[s.b]),a[2].copy(t[s.c])):(a[0]=t[s.a].clone(),a[1]=t[s.b].clone(),a[2]=t[s.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let i=this.faces[e],r=i.vertexNormals;r.length===3?(r[0].copy(i.normal),r[1].copy(i.normal),r[2].copy(i.normal)):(r[0]=i.normal.clone(),r[1]=i.normal.clone(),r[2]=i.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let t=0,i=this.faces.length;t<i;t++){let r=this.faces[t];
3140r.__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]);for(let s=0,a=r.vertexNormals.length;s<a;s++)r.__originalVertexNormals[s]?r.__originalVertexNormals[s].copy(r.vertexNormals[s]):r.__originalVertexNormals[s]=r.vertexNormals[s].clone()}let e=new Uf;e.faces=this.faces;for(let t=0,i=this.morphTargets.length;t<i;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];let s=this.morphNormals[t].faceNormals,a=this.morphNormals[t].vertexNormals;for(let n=0,o=this.faces.length;n<o;n++){let l=new M,h={a:new M,b:new M,c:new M};s.push(l),a.push(h)}}let r=this.morphNormals[t];e.vertices=this.morphTargets[t].vertices,e.computeFaceNormals(),e.computeVertexNormals();for(let s=0,a=this.faces.length;s<a;s++){let n=this.faces[s],o=r.faceNormals[s],l=r.vertexNormals[s];o.copy(n.normal),l.a.copy(n.vertexNormals[0]),l.b.copy(n.vertexNormals[1]),l.c.copy(n.vertexNormals[2])}}for(let t=0,i=this.faces.length;t<i;t++){let r=this.faces[t];
3140r.normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals}}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new yi),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new is),this.boundingSphere.setFromPoints(this.vertices)}merge(e,t,i=0){if(!(e&&e.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);return}let r,s=this.vertices.length,a=this.vertices,n=e.vertices,o=this.faces,l=e.faces,h=this.colors,c=e.colors;t!==void 0&&(r=new Ii().getNormalMatrix(t));for(let u=0,d=n.length;u<d;u++){let p=n[u].clone();t!==void 0&&p.applyMatrix4(t),a.push(p)}for(let u=0,d=c.length;u<d;u++)h.push(c[u].clone());for(let u=0,d=l.length;u<d;u++){let p=l[u],f,m,g=p.vertexNormals,v=p.vertexColors,y=new fy(p.a+s,p.b+s,p.c+s);y.normal.copy(p.normal),r!==void 0&&y.normal.applyMatrix3(r).normalize();for(let x=0,w=g.length;x<w;x++)f=g[x].clone(),r!==void 0&&f.applyMatrix3(r).normalize(),y.vertexNormals.push(f);y.color.copy(p.color);for(let x=0,w=v.length;x<w;x++)m=v[x],y.vertexColors.push(m.clone());y.materialIndex=p.materialIndex+i,o.push(y)}for(let u=0,d=e.faceVertexUvs.length;u<d;u++){let p=e.faceVertexUvs[u];this.faceVertexUvs[u]===void 0&&(this.faceVertexUvs[u]=[]);for(let f=0,m=p.length;f<m;f++){let g=p[f],v=[];for(let y=0,x=g.length;y<x;y++)v.push(g[y].clone());this.faceVertexUvs[u].push(v)}}}mergeMesh(e){if(!(e&&e.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)}mergeVertices(e=4){let t={},i=[],r=[],s=Math.pow(10,e);for(let o=0,l=this.vertices.length;o<l;o++){let h=this.vertices[o],c=Math.round(h.x*s)+"_"+Math.round(h.y*s)+"_"+Math.round(h.z*s);t[c]===void 0?(t[c]=o,i.push(this.vertices[o]),r[o]=i.length-1):r[o]=r[t[c]]}let a=[];for(let o=0,l=this.faces.length;o<l;o++){let h=this.faces[o];h.a=r[h.a],h.b=r[h.b],h.c=r[h.c];let c=[h.a,h.b,h.c];for(let u=0;u<3;u++)if(c[u]===c[(u+1)%3]){a.push(o);break}}for(let o=a.length-1;o>=0;o--){let l=a[o];this.faces.splice(l,1);for(let h=0,c=this.faceVertexUvs.length;h<c;h++)this.faceVertexUvs[h].splice(l,1)}let n=this.vertices.length-i.length;return this.vertices=i,n}setFromPoints(e){this.vertices=[];for(let t=0,i=e.length;t<i;t++){let r=e[t];this.vertices.push(new M(r.x,r.y,r.z||0))}return this}sortFacesByMaterialIndex(){let e=this.faces,t=e.length;for(let o=0;o<t;o++)e[o]._id=o;function i(o,l){return o.materialIndex-l.materialIndex}e.sort(i);let r=this.faceVertexUvs[0],s=this.faceVertexUvs[1],a,n;r&&r.length===t&&(a=[]),s&&s.length===t&&(n=[]);for(let o=0;o<t;o++){let l=e[o]._id;a&&a.push(r[l]),n&&n.push(s[l])}a&&(this.faceVertexUvs[0]=a),n&&(this.faceVertexUvs[1]=n)}toJSON(){let e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),this.parameters!==void 0){let p=this.parameters;for(let f in p)p[f]!==void 0&&(e[f]=p[f]);return e}let t=[];for(let p=0;p<this.vertices.length;p++){let f=this.vertices[p];t.push(f.x,f.y,f.z)}let i=[],r=[],s={},a=[],n={},o=[],l={};for(let p=0;p<this.faces.length;p++){let f=this.faces[p],m=!0,g=!1,v=this.faceVertexUvs[0][p]!==void 0,y=f.normal.length()>0,x=f.vertexNormals.length>0,w=f.color.r!==1||f.color.g!==1||f.color.b!==1,S=f.vertexColors.length>0,b=0;if(b=h(b,0,0),b=h(b,1,m),b=h(b,2,g),b=h(b,3,v),b=h(b,4,y),b=h(b,5,x),b=h(b,6,w),b=h(b,7,S),i.push(b),i.push(f.a,f.b,f.c),i.push(f.materialIndex),v){let E=this.faceVertexUvs[0][p];i.push(d(E[0]),d(E[1]),d(E[2]))}if(y&&i.push(c(f.normal)),x){let E=f.vertexNormals;i.push(c(E[0]),c(E[1]),c(E[2]))}if(w&&i.push(u(f.color)),S){let E=f.vertexColors;i.push(u(E[0]),u(E[1]),u(E[2]))}}function h(p,f,m){return m?p|1<<f:p&~(1<<f)}function c(p){let f=p.x.toString()+p.y.toString()+p.z.toString();return s[f]!==void 0||(s[f]=r.length/3,r.push(p.x,p.y,p.z)),s[f]}function u(p){let f=p.r.toString()+p.g.toString()+p.b.toString();return n[f]!==void 0||(n[f]=a.length,a.push(p.getHex())),n[f]}function d(p){let f=p.x.toString()+p.y.toString();return l[f]!==void 0||(l[f]=o.length/2,o.push(p.x,p.y)),l[f]}return e.data={},e.data.vertices=t,e.data.normals=r,a.length>0&&(e.data.colors=a),o.length>0&&(e.data.uvs=[o]),e.data.faces=i,e}clone(){return new Uf().copy(this)}copy(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;let t=e.vertices;for(let u=0,d=t.length;u<d;u++)this.vertices.push(t[u].clone());let i=e.colors;for(let u=0,d=i.length;u<d;u++)this.colors.push(i[u].clone());let r=e.faces;for(let u=0,d=r.length;u<d;u++)this.faces.push(r[u].clone());for(let u=0,d=e.faceVertexUvs.length;u<d;u++){let p=e.faceVertexUvs[u];this.faceVertexUvs[u]===void 0&&(this.faceVertexUvs[u]=[]);for(let f=0,m=p.length;f<m;f++){let g=p[f],v=[];for(let y=0,x=g.length;y<x;y++){let w=g[y];v.push(w.clone())}this.faceVertexUvs[u].push(v)}}let s=e.morphTargets;for(let u=0,d=s.length;u<d;u++){let p={};if(p.name=s[u].name,s[u].vertices!==void 0){p.vertices=[];for(let f=0,m=s[u].vertices.length;f<m;f++)p.vertices.push(s[u].vertices[f].clone())}if(s[u].normals!==void 0){p.normals=[];for(let f=0,m=s[u].normals.length;f<m;f++)p.normals.push(s[u].normals[f].clone())}this.morphTargets.push(p)}let a=e.morphNormals;for(let u=0,d=a.length;u<d;u++){let p={};if(a[u].vertexNormals!==void 0){p.vertexNormals=[];for(let f=0,m=a[u].vertexNormals.length;f<m;f++){let g=a[u].vertexNormals[f],v={};v.a=g.a.clone(),v.b=g.b.clone(),v.c=g.c.clone(),p.vertexNormals.push(v)}}if(a[u].faceNormals!==void 0){p.faceNormals=[];for(let f=0,m=a[u].faceNormals.length;f<m;f++)p.faceNormals.push(a[u].faceNormals[f].clone())}this.morphNormals.push(p)}let n=e.skinWeights;for(let u=0,d=n.length;u<d;u++)this.skinWeights.push(n[u].clone());let o=e.skinIndices;for(let u=0,d=o.length;u<d;u++)this.skinIndices.push(o[u].clone());let l=e.lineDistances;for(let u=0,d=l.length;u<d;u++)this.lineDistances.push(l[u]);let h=e.boundingBox;h!==null&&(this.boundingBox=h.clone());let c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this}toBufferGeometry(){let e=new b9().fromGeometry(this),t=new He,i=new Float32Array(e.vertices.length*3);if(t.setAttribute("position",Yd.call(new tt(i,3),e.vertices)),e.normals.length>0){let r=new Float32Array(e.normals.length*3);t.setAttribute("normal",Yd.call(new tt(r,3),e.normals))}if(e.colors.length>0){let r=new Float32Array(e.colors.length*3);t.setAttribute("color",k_.call(new tt(r,3),e.colors))}if(e.uvs.length>0){let r=new Float32Array(e.uvs.length*2);t.setAttribute("uv",U_.call(new tt(r,2),e.uvs))}if(e.uvs2.length>0){let r=new Float32Array(e.uvs2.length*2);t.setAttribute("uv2",U_.call(new tt(r,2),e.uvs2))}t.groups=e.groups;for(let r in e.morphTargets){let s=[],a=e.morphTargets[r];for(let n=0,o=a.length;n<o;n++){let l=a[n],h=new De(l.data.length*3,3);h.name=l.name,s.push(Yd.call(h,l.data))}t.morphAttributes[r]=s}if(e.skinIndices.length>0){let r=new De(e.skinIndices.length*4,4);t.setAttribute("skinIndex",N_.call(r,e.skinIndices))}if(e.skinWeights.length>0){let r=new De(e.skinWeights.length*4,4);t.setAttribute("skinWeight",N_.call(r,e.skinWeights))}
3140return e.boundingSphere!==null&&(t.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(t.boundingBox=e.boundingBox.clone()),t}computeTangents(){console.error("THREE.Geometry: .computeTangents() has been removed.")}computeLineDistances(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}applyMatrix(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}dispose(){this.dispatchEvent({type:"dispose"})}static createBufferGeometryFromObject(e){let t=new He,i=e.geometry;if(e.isPoints||e.isLine){let r=new De(i.vertices.length*3,3),s=new De(i.colors.length*3,3);if(t.setAttribute("position",Yd.call(r,i.vertices)),t.setAttribute("color",k_.call(s,i.colors)),i.lineDistances&&i.lineDistances.length===i.vertices.length){let a=new De(i.lineDistances.length,1);t.setAttribute("lineDistance",w9.call(a,i.lineDistances))}i.boundingSphere!==null&&(t.boundingSphere=i.boundingSphere.clone()),i.boundingBox!==null&&(t.boundingBox=i.boundingBox.clone())}else e.isMesh&&(t=i.toBufferGeometry());return t}};Uf.prototype.isGeometry=!0;var b9=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){let t=[],i,r,s,a=e.faces;for(r=0;r<a.length;r++){let n=a[r];n.materialIndex!==s&&(s=n.materialIndex,i!==void 0&&(i.count=r*3-i.start,t.push(i)),i={start:r*3,materialIndex:s})}i!==void 0&&(i.count=r*3-i.start,t.push(i)),this.groups=t}fromGeometry(e){let t=e.faces,i=e.vertices,r=e.faceVertexUvs,s=r[0]&&r[0].length>0,a=r[1]&&r[1].length>0,n=e.morphTargets,o=n.length,l;if(o>0){l=[];for(let g=0;g<o;g++)l[g]={name:n[g].name,data:[]};this.morphTargets.position=l}let h=e.morphNormals,c=h.length,u;if(c>0){u=[];for(let g=0;g<c;g++)u[g]={name:h[g].name,data:[]};this.morphTargets.normal=u}let d=e.skinIndices,p=e.skinWeights,f=d.length===i.length,m=p.length===i.length;i.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let g=0;g<t.length;g++){let v=t[g];this.vertices.push(i[v.a],i[v.b],i[v.c]);let y=v.vertexNormals;if(y.length===3)this.normals.push(y[0],y[1],y[2]);else{let w=v.normal;this.normals.push(w,w,w)}let x=v.vertexColors;if(x.length===3)this.colors.push(x[0],x[1],x[2]);else{let w=v.color;this.colors.push(w,w,w)}if(s===!0){let w=r[0][g];w!==void 0?this.uvs.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",g),this.uvs.push(new H,new H,new H))}if(a===!0){let w=r[1][g];w!==void 0?this.uvs2.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",g),this.uvs2.push(new H,new H,new H))}for(let w=0;w<o;w++){let S=n[w].vertices;l[w].data.push(S[v.a],S[v.b],S[v.c])}for(let w=0;w<c;w++){let S=h[w].vertexNormals[g];u[w].data.push(S.a,S.b,S.c)}f&&this.skinIndices.push(d[v.a],d[v.b],d[v.c]),m&&this.skinWeights.push(p[v.a],p[v.b],p[v.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}},fy=class{constructor(e,t,i,r,s,a=0){this.a=e,this.b=t,this.c=i,this.normal=r&&r.isVector3?r:new M,this.vertexNormals=Array.isArray(r)?r:[],this.color=s&&s.isColor?s:new Je,this.vertexColors=Array.isArray(s)?s:[],this.materialIndex=a}clone(){return new this.constructor().copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,i=e.vertexNormals.length;t<i;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,i=e.vertexColors.length;t<i;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}};function w9(e){return this.array.set(e),this}function k_(e){let t=this.array,i=0;for(let r=0,s=e.length;r<s;r++){let a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new Je),t[i++]=a.r,t[i++]=a.g,t[i++]=a.b}return this}function U_(e){let t=this.array,i=0;for(let r=0,s=e.length;r<s;r++){let a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new H),t[i++]=a.x,t[i++]=a.y}return this}function Yd(e){let t=this.array,i=0;for(let r=0,s=e.length;r<s;r++){let a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new M),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z}return this}function N_(e){let t=this.array,i=0;for(let r=0,s=e.length;r<s;r++){let a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new ot),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z,t[i++]=a.w}return this}var S9=["a","b","c"];function _9(e,t){switch(t){case"c":return e.c;case"b":return e.b;default:return e.a}}function Hg(e,t,i){let r=Math.min(e,t),s=Math.max(e,t),a=r+"_"+s;return i.get(a)}function Gg(e,t,i,r,s,a){let n=Math.min(e,t),o=Math.max(e,t),l=n+"_"+o,h;if(r.has(l))h=r.get(l);else{let c=i[n],u=i[o];h={a:c,b:u,newEdge:null,faces:[]},r.set(l,h)}h.faces.push(s),a[e].edges.push(h),a[t].edges.push(h)}function A9(e,t,i,r){let s,a,n;for(s=0,a=e.length;s<a;s++)i[s]={edges:[]};for(s=0,a=t.length;s<a;s++)n=t[s],Gg(n.a,n.b,e,r,n,i),Gg(n.b,n.c,e,r,n,i),Gg(n.c,n.a,e,r,n,i)}function Qd(e,t,i,r,s){e.push(new fy(t,i,r,void 0,void 0,s))}function Ll(e,t){return Math.abs(t-e)/2+Math.min(e,t)}function Kd(e,t,i,r){e.push([t.clone(),i.clone(),r.clone()])}var M9=class{constructor(e=1){this.subdivisions=e}modify(e){e instanceof He?e=new Uf().fromBufferGeometry(e):e=e.clone(),e.mergeVertices();let t=this.subdivisions;for(;t-- >0;)this._smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e}_smooth(e){let t=new M,i,r,s,a,n,o=e.vertices,l=e.faces,h=e.faceVertexUvs[0],c=h!==void 0&&h.length>0,u=[],d=new Map;A9(o,l,u,d);let p=[],f,m,g,v,y,x,w;for(let re of Array.from(d.keys())){for(m=d.get(re),g=new M,y=3/8,x=1/8,w=m.faces.length,w!=2&&(y=.5,x=0,w!=1),g.addVectors(m.a,m.b).multiplyScalar(y),t.set(0,0,0),a=0;a<w;a++){for(v=m.faces[a],n=0;n<3&&(f=o[_9(v,S9[n])],!(f!==m.a&&f!==m.b));n++);f&&t.add(f)}t.multiplyScalar(x),g.add(t),m.newEdge=p.length,p.push(g)}let S,b,E,_,A,C,T,I=[];for(r=0,s=o.length;r<s;r++){for(C=o[r],A=u[r].edges,i=A.length,i==3?S=3/16:i>3&&(S=3/(8*i)),b=1-i*Number(S),E=S,i<=2&&(i==2?(b=3/4,E=1/8):i==1||i==0),T=C.clone().multiplyScalar(b),t.set(0,0,0),a=0;a<i;a++)_=A[a],f=_.a!==C?_.a:_.b,t.add(f);t.multiplyScalar(Number(E)),T.add(t),I.push(T)}let P=I.concat(p),O=I.length,k,G,B,U=[],Q=[],q,j,X,te,K=new H,Z=new H,W=new H;for(r=0,s=l.length;r<s;r++)v=l[r],k=Number(Hg(v.a,v.b,d).newEdge)+O,G=Number(Hg(v.b,v.c,d).newEdge)+O,B=Number(Hg(v.c,v.a,d).newEdge)+O,Qd(U,k,G,B,v.materialIndex),Qd(U,v.a,k,B,v.materialIndex),Qd(U,v.b,G,k,v.materialIndex),Qd(U,v.c,B,G,v.materialIndex),c&&(q=h[r],j=q[0],X=q[1],te=q[2],K.set(Ll(j.x,X.x),Ll(j.y,X.y)),Z.set(Ll(X.x,te.x),Ll(X.y,te.y
vendor: 39,276 bytes, lines 3140-3154
3140)),W.set(Ll(j.x,te.x),Ll(j.y,te.y)),Kd(Q,K,Z,W),Kd(Q,j,K,W),Kd(Q,X,Z,K),Kd(Q,te,W,Z));e.vertices=P,e.faces=U,c&&(e.faceVertexUvs[0]=Q)}},Ui=new M,E9=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=e.geometry??t?.geometry??new He().copy(new Hs(100,100,100)),r;t===void 0?(i.computeBoundingBox(),i.boundingBox.getSize(Ui),r={width:Ui.x,height:Ui.y,depth:Ui.z,subdivisions:0}):r=t.parameters;let s={...r,...e.parameters};return{parameters:{width:Math.abs(s.width),height:Math.abs(s.height),depth:Math.abs(s.depth),subdivisions:Math.abs(s.subdivisions)},geometry:i}}static build(e){let{width:t,height:i,depth:r,subdivisions:s}=e.parameters,a=e.geometry??new He().copy(new Hs(100,100,100)),n=a.userData.parameters;n===void 0?(a.boundingBox=C9(a),a.boundingBox.getSize(Ui)):Ui.set(n.width,n.height,n.depth),(t!==Ui.x||i!==Ui.y||r!==Ui.z)&&a.scale(Ui.x===0?1:t/Ui.x,Ui.y===0?1:i/Ui.y,Ui.z===0?1:r/Ui.z);let o=a.originalGeometry;try{s>0?(o===void 0||n?.subdivisions!==s)&&(o===void 0&&(o=a),a=new M9(s).modify(o).toBufferGeometry()):(o!==void 0&&(a=o),o=void 0,a.getAttribute("normal")===void 0&&a.computeVertexNormals())}catch{o!==void 0&&(a=o),o=void 0,a.getAttribute("normal")===void 0&&a.computeVertexNormals()}return o!==void 0&&Object.assign(a,{originalGeometry:o}),delete e.geometry,Object.assign(a,{userData:{...e,type:"NonParametricGeometry"}})}static loadFromUrl(e,t,i){new HM(i).load(e,r=>{let s=this.normalizeInputs({geometry:r});r.boundingBox.getSize(Ui);let a=100/Ui.x;Object.assign(s.parameters,{width:100,height:Ui.y*a,depth:Ui.z*a}),t(this.build(s))})}};function C9(e){let t=new yi,i=e.attributes.position;return i?(t.setFromBufferAttribute(i),t):(t.makeEmpty(),t)}var sT=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},e.parameters);return{shape:e.shape&&e.shape instanceof mi?e.shape:new mi,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i,spikes:r,cornerRadius:s,depth:a,extrudeBevelSize:n,extrudeBevelSegments:o}=e.parameters,l=e.shape,h=t*.5,c=i*.5,u=0,d=0,p=2*Math.PI/r;for(let m=0;m<r;m++){let g=p*m,v=u+Math.sin(g)*h,y=d+Math.cos(g)*c;l.addPoint(l.createPoint(v,y))}l.isClosed=!0;for(let m=0,g=l.points.length;m<g;m++)l.points[m].roundness=s;l.roundness=s,l.update();let f=ul.create({shape:l,parameters:{roundness:s,depth:a,extrudeBevelSize:n,extrudeBevelSegments:o}});return Object.assign(f,{userData:{...e,type:"PolygonGeometry"}})}},T9=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,radialSegments:s,heightSegments:a,openEnded:n,cornerRadius:o,cornerSegments:l}=e.parameters,h=new D9(t*.5,i,s,a,n,o,l);return h.scale(1,1,r/t),Object.assign(h,{userData:{...e,type:"PyramidGeometry"}})}};function Sc(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}function Wg(e,t,i,r,s,a){let n=t.clone().sub(e),o=i.clone().sub(e),l=n.angleTo(o);if(n.normalize(),o.normalize(),r===s){let h=n.add(o).normalize();a.copy(e).addScaledVector(h,r/Math.sin(l/2))}else{let h=n.angleTo(o);a.copy(e),a.addScaledVector(n,s/Math.sin(h)),a.addScaledVector(o,r/Math.sin(h))}}function P9(e,t,i){let r=e.clone().sub(t),s=i.clone().sub(t);return r.projectOnVector(s),r.add(t)}var D9=class extends He{constructor(e=.5,t=1,i=4,r=1,s=!1,a=0,n=4){super(),i=Math.floor(Math.max(3,i)),r=Math.floor(r),n=Math.floor(n);let o=[],l=[],h=[],c=[],u=0,d=t/2,p=Math.PI/i,f=e*Math.cos(Math.PI/i),m=2*Math.PI/i,g=(i-2)*Math.PI/i,v=Math.PI-g,y=new M(0,-d,0),x=new M(0,d,0),w=new H(e,-d),S=new H(f,-d),b=new H(0,x.y).sub(S),E=new H(0,x.y).sub(w),_=new H(b.y,-b.x).normalize(),A=new H(E.y,-E.x).normalize(),C=e*Math.cos(Math.PI/i)*Math.tan((Math.PI-b.angle())/2)-1e-8;a=Math.min(a,C);let T;{let B=new M(_.x,_.y,0),U=new M(Math.cos(m)*B.x,B.y,Math.sin(m)*B.x);T=B.angleTo(U)}let I=a/Math.tan((Math.PI-b.angle())/2),P=a/Math.tan((Math.PI-T)/2),O=new M;if(!s){l.push(y.x,y.y,y.z),h.push(0,-1,0),c.push(0,0);let B=u++,U=[],Q=w.clone(),q=I/Math.cos(Math.PI/i);Q.x-=q;for(let j=0;j<i;j++){let X=j/i*Math.PI*2+p,te=new H(Math.sin(X),Math.cos(X));Sc(Q,te,O),l.push(O.x,O.y,O.z),h.push(0,-1,0),c.push(0,0),U.push(u++)}for(let j=0;j<U.length;j++)o.push(U[j],B,U[(j+1)%U.length])}{let B=new M,U=new M,Q=new M,q=new M,j=new M,X=new M;for(let te=0;te<i;te++){let K=te/i*Math.PI*2+p,Z=(te+.5)/i*Math.PI*2+p,W=(te+1)/i*Math.PI*2+p,re=new H(Math.sin(K),Math.cos(K)),$=new H(Math.sin(Z),Math.cos(Z)),ne=new H(Math.sin(W),Math.cos(W));Sc(w,re,U),Sc(w,ne,Q),Sc(_,$,B),Wg(x,U,Q,P,P,q),l.push(q.x,q.y,q.z),Wg(U,x,Q,P,I,j),l.push(j.x,j.y,j.z),Wg(Q,U,x,I,P,X),l.push(X.x,X.y,X.z),h.push(B.x,B.y,B.z),h.push(B.x,B.y,B.z),h.push(B.x,B.y,B.z),c.push(0,0),c.push(0,0),c.push(0,0);let ie=u++,ve=u++,de=u++;if(o.push(ie,ve,de),a>0){{let Me=U.clone().add(Q).multiplyScalar(.5),Ve=x.clone().sub(Me).normalize(),Ne=y.clone().sub(Me).normalize().add(Ve).normalize().multiplyScalar(-1),Oe=X.clone().sub(j);k(Me,Oe,Ne,b.angle())}let we,Re;{let Me=new M;Sc(A,ne,Me);let Ve=X.clone().add(q).multiplyScalar(.5);Ve=P9(Ve,Q,x);let Ne=X.clone().sub(q);[we,Re]=k(Ve,Ne,Me,T,q.y)}{let Me=we,Ve=Me.clone().setY(0).normalize(),Ne=new M(0,-1,0),Oe=Ve.clone().cross(Ne);G(Me,Ve,Ne,Oe)}{let Me=b.angle(),Ve=Math.PI-Me,Ne=x.clone();Ne.y-=a/Math.sin(Me-Math.PI/2);let Oe=new M,Ee=[];for(let qe=0;qe<n;qe++){let V=[],z=Math.PI/2-Ve*qe/n,oe=Math.cos(z),Se=Math.sin(z),R=Z;for(let Ae=0;Ae<=qe;Ae++){let ke=Math.cos(R),Ie=Math.sin(R);B.x=oe*Ie,B.y=Se,B.z=oe*ke,Oe.copy(Ne).addScaledVector(B,a),l.push(Oe.x,Oe.y,Oe.z),h.push(B.x,B.y,B.z),c.push(0,0),V.push(u++),R+=Math.PI*2/qe/i}Ee.push(V)}Re.reverse(),Ee.push(Re);let Qe=Ee.length-1;for(let qe=0;qe<Qe;qe++){let V=Ee[qe],z=Ee[qe+1],oe=V.length-1;o.push(z[1],V[0],z[0]);for(let Se=1;Se<=oe;Se++)o.push(V[Se],V[Se-1],z[Se]),o.push(z[Se+1],V[Se],z[Se])}}}}}this.setIndex(o),this.setAttribute("position",new De(l,3)),this.setAttribute("normal",new De(h,3)),this.setAttribute("uv",new De(c,2));function k(B,U,Q,q,j){let X=-q/2,te=(Math.PI-q)/2,K=U.clone().normalize().cross(Q);B.addScaledVector(Q,-a/Math.sin(te));let Z=new M,W=new M,re=1,$=u,ne=[];for(let ie=0;ie<=n;ie++){let ve=X+ie/n*q;W.set(0,0,0),W.addScaledVector(K,Math.sin(ve)),W.addScaledVector(Q,Math.cos(ve));for(let de=0;de<=re;de++){let we=de/re-.5;if(Z.copy(B),Z.addScaledVector(U,we),Z.addScaledVector(W,a),j!=null){let Re=Math.max(0,Z.y-j);Z.addScaledVector(U,-Re/U.y)}l.push(Z.x,Z.y,Z.z),h.push(W.x,W.y,W.z),c.push(0,0),de===0&&ne.push(u),u++}}for(let ie=0;ie<n;ie++)for(let ve=0;ve<re;ve++){let de=$+ve+(re+1)*ie,we=de+(re+1),Re=we+1,Me=de+1;o.push(de,we,Me),o.push(we,Re,Me)}return[B.clone().addScaledVector(U,.5),ne]}function G(B,U,Q,q){let j=Math.PI/2,X=E.angle()-j,te=[],K=new M,Z=new M;for(let re=0;re<=n;re++){let $=[],ne=re/n;for(let ie=0;ie<=re;ie++){let ve=((re?ie/re:0)-.5)*v,de=Math.cos(ve),we=Math.sin(ve),Re=Math.atan(Math.tan(X)*de),Me=(j+Re)*ne,Ve=Math.cos(Me),Ne=Math.sin(Me);K.set(0,0,0),K.addScaledVector(U,Ne*de),K.addScaledVector(Q,Ve),K.addScaledVector(q,Ne*we),Z.copy(B).addScaledVector(K,a),l.push(Z.x,Z.y,Z.z),h.push(K.x,K.y,K.z),c.push(0,0),$.push(u++)}te.push($)}let W=te.length-1;for(let re=0;re<W;re++){let $=te[re],ne=te[re+1],ie=$.length-1;o.push($[0],ne[1],ne[0]);for(let ve=1;ve<=ie;ve++)o.push($[ve-1],$[ve],ne[ve]),o.push($[ve],ne[ve+1],ne[ve])}}}},ux=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters),r=Object.assign(t?.ui??{enabledIndieCorners:!1},e.ui);return{shape:e.shape&&e.shape instanceof mi?e.shape:new mi,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)}),ui:r}}static build(e){let t=e.shape,{width:i,height:r,cornerRadius:s,cornerType:a,depth:n,extrudeBevelSize:o,extrudeBevelSegments:l}=e.parameters,h={x:i*.5,y:r*.5},c={x:-h.x,y:-h.y},u={x:h.x,y:h.y};function d(w,S,b){return S>i&&b>r?Math.min(w*i/S,w*r/b):S>i?w*i/S:b>r?w*r/b:w}let p=[];p[0]=s[0]===0?0:d(s[0],s[0]+s[3],s[0]+s[1]),p[1]=s[1]===0?0:d(s[1],s[1]+s[2],s[1]+s[0]),p[2]=s[2]===0?0:d(s[2],s[2]+s[1],s[2]+s[3]),p[3]=s[3]===0?0:d(s[3],s[3]+s[0],s[3]+s[2]);let f=c.x,m=u.x,g=u.y,v=c.y;t.addPoint(t.createPoint(f,g)),t.addPoint(t.createPoint(m,g)),t.addPoint(t.createPoint(m,v)),t.addPoint(t.createPoint(f,v)),t.isClosed=!0;let y=!0;for(let w=0,S=t.points.length;w<S;w++)t.points[w].roundness=p[w],w>0&&p[w]!==p[w-1]&&(y=!1);y&&(t.roundness=p[0]),t.useCubicForRoundedCorners=a!==1,t.update();let x=ul.create({shape:t,parameters:{depth:n,extrudeBevelSize:o,extrudeBevelSegments:l}});return Object.assign(x,{userData:{...e,type:"RectangleGeometry"}})}},O9=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},e.parameters);return i.thetaLength=Te.clamp(i.thetaLength,0,180),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t=100,height:i=t,depth:r=t,widthSegments:s=64,heightSegments:a=64,phiStart:n,phiLength:o,thetaStart:l,thetaLength:h}=e.parameters,c;return h===0?(c=new He,c.setAttribute("position",new De([],3))):c=new hh(.5*t,s,a,n,o,l,h*Te.DEG2RAD),c.scale(1,i/t,r/t),Object.assign(c,{userData:{...e,type:"SphereGeometry"}})}},I9=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(e){let{width:t=100,height:i=t,widthSegments:r=8,heightSegments:s=8}=e.parameters,a=new Sa(t,i,r,s);return a.scale(1,1,1),Object.assign(a,{userData:{...e,type:"PlaneGeometry"}})}},R9=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,angle:s,cornerRadius:a,cornerSegments:n}=e.parameters,o=new L9(t,i,r,s,a,n);return Object.assign(o,{userData:{...e,type:"BackdropGeometry"}})}},L9=class extends He{constructor(e=1,t=1,i=1,r=90,s=10,a=24){super(),this.type="BackdropGeometry";let n=[],o=[],l=[],h=.001;s==0&&(a=1),a=Math.max(1,Math.floor(a)),s=Math.min(s,100),r=Math.min(180-h,r),r*=Math.PI/180;let c=[],u=Math.PI/2,d=(re=0,$=0,ne=0)=>new M(re,$,ne),p=d(),f=d(),[m,g,v]=[t/2,e/2,i/2],y=-g,x=+g,[w,S,b]=[d(y,-m,+v),d(y,-m,-v),d(y,+m,-v)],E=(re,$=!1)=>Math.sin(re-Math.PI/(1+ +$)),_=(re,$=!1)=>Math.cos(re-Math.PI/(1+ +$));b.y=Math.sin(r)*t-m;let A=Math.cos(r)*t-v,C=w.z-h;r<=u?(b.z=Math.min(A,C),b.z==C&&(b.y-=(A-C)/Math.tan(u-r))):S.z=Math.min(S.z-A-v,w.z-h),p.subVectors(w,S),f.subVectors(b,S);let T=Math.min(p.length(),f.length())*s/100,I=T*Math.tan(r/2),P=T/Math.cos(r/2),O=p.clone().normalize().add(f.normalize()).setLength(P).add(S);p.set(0,E(r,!0),_(r,!0)),c.push([b,p.clone()]);let k=(Math.PI-r)/a;for(let re=0;re<=a;re++){let $=u+r+re*k;p.set(0,Math.sin($)*I,Math.cos($)*I),p.add(O),f.set(0,E($),_($)),c.push([p.clone(),f.clone()])}c.push([w,d(0,1,0)]);let G=Math.sin(k/2)*I*2,B=c.length-1,U=c[0][0].distanceTo(c[1][0]),Q=c[B-1][0].distanceTo(c[B][0]),q=U+G*a+Q;c[0].push(1);for(let re=0;re<=a;re++)c[re+1].push(1-(U+re*G)/q);c[B].push(0);let[j,X,te]=c[0],K,Z,W;for(let re=1;re<c.length;re++)[K,Z,W]=c[re],n.push(y,j.y,j.z,y,K.y,K.z,x,j.y,j.z,x,j.y,j.z,y,K.y,K.z,x,K.y,K.z),o.push(0,X.y,X.z,0,Z.y,Z.z,0,X.y,X.z,0,X.y,X.z,0,Z.y,Z.z,0,Z.y,Z.z),l.push(0,te,0,W,1,te,1,te,0,W,1,W),[j,X,te]=[K,Z,W];this.setAttribute("position",new De(n,3)),this.setAttribute("normal",new De(o,3)),this.setAttribute("uv",new De(l,2))}},aT=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return{shape:e.shape&&e.shape instanceof mi?e.shape:new mi,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i,innerRadiusPercent:r,spikes:s,cornerRadius:a,angle:n,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}=e.parameters,c=e.shape,u=t*.5,d=i*.5,p=0,f=0,m=n*Math.PI/360/s,g=Math.PI/2*3*-1,v=u*r/100,y=d*r/100;if(s===3&&r===50){m=2*Math.PI/s;for(let w=0;w<s;w++){let S=m*w,b=p+Math.sin(S)*u,E=f+Math.cos(S)*d;c.addPoint(c.createPoint(b,E))}}else for(let w=0;w<s;w++){let S=p+Math.cos(g)*u,b=f+Math.sin(g)*d;c.addPoint(c.createPoint(S,b)),g+=m,S=p+Math.cos(g)*v,b=f+Math.sin(g)*y,c.addPoint(c.createPoint(S,b)),g+=m}c.isClosed=!0;for(let w=0,S=c.points.length;w<S;w++)c.points[w].roundness=a;c.roundness=a,c.update();let x=ul.create({shape:c,parameters:{roundness:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}});return Object.assign(x,{userData:{...e,type:"StarGeometry"}})}},z9=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i}=e.parameters,r=new Sa(t,i);return Object.assign(r,{userData:{...e,type:"TextFrameGeometry"}})}},B9=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},e.parameters),r=Math.abs(i.width),s=Math.abs(i.height??i.width);i.shapeBlendNode&&(s=r);let a=Math.round(Math.abs(i.depth??i.width*.25));return{parameters:Object.assign(i,{width:r,height:s,depth:a})}}static build(e){let{width:t,height:i,depth:r,radialSegments:s,tubularSegments:a,arc:n,cornerRadius:o,cornerSegments:l}=e.parameters,h=F9(t,i,r,t*.5,n,a,0,0,s,o,l);return h.scale(1,i/t,1),Object.assign(h,{userData:{...e,type:"TorusGeometry"}})}};function F9(e,t,i,r,s,a,n,o,l,h,c){[t,i]=[i,t],n=t/2;let u=Te.clamp(s/360,0,1);if(u===0){let d=new He;return d.setAttribute("position",new De([],3)),d}return u===1&&(h=0),new iT(!0,e,t,i,r,u,a,n,o,l,h,c)}var k9=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width),tube:i.tube??i.width*.125})}}static build(e){let{width:t,tube:i,tubularSegments:r,radialSegments:s,p:a,q:n}=e.parameters,o=t*.5;o!==i&&(o-=i);let l=new BM(o,i,r,s,a,n);return Object.assign(l,{userData:{...e,type:"TorusKnotGeometry"}})}},U9=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},e.parameters);return{shape:e.shape&&e.shape instanceof mi?e.shape:new mi,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width*(i.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t=100,height:i,cornerRadius:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:n,isRect:o}=e.parameters,l=e.shape,h=t*.5,c=i*.5;o?(l.addPoint(l.createPoint(-h,c)),l.addPoint(l.createPoint(h,-c)),l.addPoint(l.createPoint(-h,-c))):(l.addPoint(l.createPoint(0,c)),l.addPoint(l.createPoint(h,-c)),l.addPoint(l.createPoint(-h,-c))),l.isClosed=!0;for(let d=0,p=l.points.length;d<p;d++)l.points[d].roundness=r;l.roundness=r,l.update();let u=ul.create({shape:l,parameters:{roundness:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:n}});return Object.assign(u,{userData:{...e,type:"TriangleGeometry"}})}};function N9(e,t){let i=2*Math.PI;return(e%i+i)%i===(t%i+i)%i}function V9(e){return/^(rgba)?\(\s*(\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(e.toLowerCase())}function j9(e,t,i){let r,s,a,n=Math.floor(e*6),o=e*6-n,l=i*(1-t),h=i*(1-o*t),c=i*(1-(1-o)*t);switch(n%6){case 0:r=i,s=c,a=l;break;case 1:r=h,s=i,a=l;break;case 2:r=l,s=i,a=c;break;case 3:r=l,s=h,a=i;break;case 4:r=c,s=l,a=i;break;default:r=i,s=l,a=h;break}return{r:r*255,g:s*255,b:a*255}}function H9(e,t,i){e/=255,t/=255,i/=255;let r=Math.max(e,t,i),s=Math.min(e,t,i),a=r,n=r-s,o=r==0?0:n/r,l;if(r==s)l=0;else{switch(r){case e:l=(t-i)/n+(t<i?6:0);break;case t:l=(i-e)/n+2;break;case i:default:l=(e-t)/n+4;break}l/=6}return{h:l,s:o,v:a}}function G9(e){return e=Math.floor(e),{r:e>>16&255,g:e>>8&255,b:e&255}}function W9(e,t,i){return(e<<16)+(t<<8)+i}function q9(e,t,i){return e=Math.round(e),t=Math.round(t),i=Math.round(i),"#"+[e,t,i].map(r=>r.toString(16).padStart(2,"0")).join("").toUpperCase()}function X9(e){let t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(t,(r,s,a,n)=>String(s+s+a+a+n+n));let i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return i?{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16)}:null}var Y9={parseRgba:V9,hsvToRgb:j9,rgbToHsv:H9,hexToRgb:G9,rgbToHex:W9,rgbToHexString:q9,hexStringToRgb:X9},Q9=class{add(e,t,i){if(typeof arguments[0]!="string")for(let r in arguments[0])this.add(r,arguments[0][r],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(r){this[r]=this[r]||[],t&&this[r][i?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(i){i.call(t&&t.context?t.context:t,t)})}},K9=class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(t=>{if(typeof t!="object"||!t.name||!t.init)throw new Error("Invalid JSEP plugin format");this.registered[t.name]||(t.init(this.jsep),this.registered[t.name]=t)})}},ue=class{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+ue.version}static addUnaryOp(e){return ue.max_unop_len=Math.max(e.length,ue.max_unop_len),ue.unary_ops[e]=1,ue}static addBinaryOp(e,t,i){return ue.max_binop_len=Math.max(e.length,ue.max_binop_len),ue.binary_ops[e]=t,i?ue.right_associative.add(e):ue.right_associative.delete(e),ue}static addIdentifierChar(e){return ue.additional_identifier_chars.add(e),ue}static addLiteral(e,t){return ue.literals[e]=t,ue}static removeUnaryOp(e){return delete ue.unary_ops[e],e.length===ue.max_unop_len&&(ue.max_unop_len=ue.getMaxKeyLen(ue.unary_ops)),ue}static removeAllUnaryOps(){return ue.unary_ops={},ue.max_unop_len=0,ue}static removeIdentifierChar(e){return ue.additional_identifier_chars.delete(e),ue}static removeBinaryOp(e){return delete ue.binary_ops[e],e.length===ue.max_binop_len&&(ue.max_binop_len=ue.getMaxKeyLen(ue.binary_ops)),ue.right_associative.delete(e),ue}static removeAllBinaryOps(){return ue.binary_ops={},ue.max_binop_len=0,ue}static removeLiteral(e){return delete ue.literals[e],ue}static removeAllLiterals(){return ue.literals={},ue}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new ue(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(t=>t.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return ue.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!ue.binary_ops[String.fromCharCode(e)]||ue.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return ue.isIdentifierStart(e)||ue.isDecimalDigit(e)}throwError(e){let t=new Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(ue.hooks[e]){let i={context:this,node:t};return ue.hooks.run(e,i),i.node}return t}searchHook(e){if(ue.hooks[e]){let t={context:this};return ue.hooks[e].find(function(i){return i.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===ue.SPACE_CODE||e===ue.TAB_CODE||e===ue.LF_CODE||e===ue.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=e.length===1?e[0]:{type:ue.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t=[],i,r;for(;this.index<this.expr.length;)if(i=this.code,i===ue.SEMCOL_CODE||i===ue.COMMA_CODE)this.index++;else if(r=this.gobbleExpression())t.push(r);else if(this.index<this.expr.length){if(i===e)break;this.throwError('Unexpected "'+this.char+'"')}return t}gobbleExpression(){let e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,ue.max_binop_len),t=e.length;for(;t>0;){if(ue.binary_ops.hasOwnProperty(e)&&(!ue.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!ue.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,i,r,s,a,n,o,l;if(a=this.gobbleToken(),!a||(t=this.gobbleBinaryOp(),!t))return a;for(s={value:t,prec:ue.binaryPrecedence(t),right_a:ue.right_associative.has(t)},n=this.gobbleToken(),n||this.throwError("Expected expression after "+t),r=[a,s,n];t=this.gobbleBinaryOp();){if(i=ue.binaryPrecedence(t),i===0){this.index-=t.length;break}s={value:t,prec:i,right_a:ue.right_associative.has(t)},l=t;let h=c=>s.right_a&&c.right_a?i>c.prec:i<=c.prec;for(;r.length>2&&h(r[r.length-2]);)n=r.pop(),t=r.pop().value,a=r.pop(),e={type:ue.BINARY_EXP,operator:t,left:a,right:n},r.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+l),r.push(s,e)}for(o=r.length-1,e=r[o];o>1;)e={type:ue.BINARY_EXP,operator:r[o-1].value,left:r[o-2],right:e},o-=2;return e}gobbleToken(){let e,t,i,r;if(this.gobbleSpaces(),r=this.searchHook("gobble-token"),r)return this.runHook("after-token",r);if(e=this.code,ue.isDecimalDigit(e)||e===ue.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===ue.SQUOTE_CODE||e===ue.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(e===ue.OBRACK_CODE)r=this.gobbleArray();else{for(t=this.expr.substr(this.index,ue.max_unop_len),i=t.length;i>0;){if(ue.unary_ops.hasOwnProperty(t)&&(!ue.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!ue.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=i;let s=this.gobbleToken();return s||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:ue.UNARY_EXP,operator:t,argument:s,prefix:!0})}t=t.substr(0,--i)}ue.isIdentifierStart(e)?(r=this.gobbleIdentifier(),ue.literals.hasOwnProperty(r.name)?r={type:ue.LITERAL,value:ue.literals[r.name],raw:r.name}:r.name===ue.this_str&&(r={type:ue.THIS_EXP})):e===ue.OPAREN_CODE&&(r=this.gobbleGroup())}return r?(r=this.gobbleTokenProperty(r),this.runHook("after-token",r)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===ue.PERIOD_CODE||t===ue.OBRACK_CODE||t===ue.OPAREN_CODE||t===ue.QUMARK_CODE;){let i;if(t===ue.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==ue.PERIOD_CODE)break;i=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===ue.OBRACK_CODE?(e={type:ue.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()},this.gobbleSpaces(),t=this.code,t!==ue.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===ue.OPAREN_CODE?e={type:ue.CALL_EXP,arguments:this.gobbleArguments(ue.CPAREN_CODE),callee:e}:(t===ue.PERIOD_CODE||i)&&(i&&this.index--,this.gobbleSpaces(),e={type:ue.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),i&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e="",t,i;for(;ue.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===ue.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);ue.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(t=this.char,t==="e"||t==="E"){for(e+=this.expr.charAt(this.index++),t=this.char,(t==="+"||t==="-")&&(e+=this.expr.charAt(this.index++));ue.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);ue.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return i=this.code,ue.isIdentifierStart(i)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(i===ue.PERIOD_CODE||e.length===1&&e.charCodeAt(0)===ue.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:ue.LITERAL,value:parseFloat(e),raw:e}}gobbleStringLiteral(){let e="",t=this.index,i=this.expr.charAt(this.index++),r=!1;for(;this.index<this.expr.length;){let s=this.expr.charAt(this.index++);if(s===i){r=!0;break}else if(s==="\\")switch(s=this.expr.charAt(this.index++),s){case"n":e+=` 3141`;break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=s}else e+=s}return r||this.throwError('Unclosed quote after "'+e+'"'),{type:ue.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(ue.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,ue.isIdentifierPart(e));)this.index++;return{type:ue.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],i=!1,r=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let s=this.code;if(s===e){i=!0,this.index++,e===ue.CPAREN_CODE&&r&&r>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}else if(s===ue.COMMA_CODE){if(this.index++,r++,r!==t.length){if(e===ue.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===ue.CBRACK_CODE)for(let a=t.length;a<r;a++)t.push(null)}}else if(t.length!==r&&r!==0)this.throwError("Expected comma");else{let a=this.gobbleExpression();(!a||a.type===ue.COMPOUND)&&this.throwError("Expected comma"),t.push(a)}}return i||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(ue.CPAREN_CODE);if(this.code===ue.CPAREN_CODE)return this.index++,e.length===1?e[0]:e.length?{type:ue.SEQUENCE_EXP,expressions:e}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:ue.ARRAY_EXP,elements:this.gobbleArguments(ue.CBRACK_CODE)}}},Z9=new Q9;Object.assign(ue,{hooks:Z9,plugins:new K9(ue),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});ue.max_unop_len=ue.getMaxKeyLen(ue.unary_ops);ue.max_binop_len=ue.getMaxKeyLen(ue.binary_ops);var Bh=e=>new ue(e).parse(),J9=Object.getOwnPropertyNames(ue);J9.forEach(e=>{Bh[e]===void 0&&e!=="prototype"&&(Bh[e]=ue[e])});Bh.Jsep=ue;var $9="ConditionalExpression",e7={name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let i=t.node,r=this.gobbleExpression();if(r||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let s=this.gobbleExpression();if(s||this.throwError("Expected expression"),t.node={type:$9,test:i,consequent:r,alternate:s},i.operator&&e.binary_ops[i.operator]<=.9){let a=i;for(;a.right.operator&&e.binary_ops[a.right.operator]<=.9;)a=a.right;t.node.test=a.right,a.right=t.node,t.node=i}}else this.throwError("Expected :")}})}};Bh.plugins.register(e7);function bm(e){return{all:e=e||new Map,on:function(t,i){var r=e.get(t);r?r.push(i):e.set(t,[i])},off:function(t,i){var r=e.get(t);r&&(i?r.splice(r.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var r=e.get(t);r&&r.slice().map(function(s){s(i)}),(r=e.get("*"))&&r.slice().map(function(s){s(t,i)})}}}var nT=class{constructor(e,t,i){this.id=e,this.userAPI=t,this.result=void 0,this.error="null",this.isPrefetched=!1,this.isLoading=!1,this.isLoaded=!1,this.prefetchPromise=new Promise(r=>r()),this.emitter=bm(),this._innerCallUserAPI=async r=>{this.emitter.emit("start",{userAPIId:this.id}),this.isLoading=!0,this.isLoading=!1;try{this.result=await a7(this.userAPI,r),this.error="null",this.emitter.emit("success",{userAPIId:this.id})}catch(s){let a=s.message?.split("_:_")?.[0]?.replace("status:","")??"null";this.error=a,this.result=null,this.emitter.emit("error",{userAPIId:this.id})}this.isLoading=!1,this.isPrefetched=!0,this.isLoaded=!0},t?.integration?.type==="OpenAI"?this.result={content:""}:t.method==="GET"&&t.url!==""&&(this.prefetchPromise=this.prefetch(i)),this._debouncedCallUserAPI=this._innerCallUserAPI,this._updateDebouncedCallUserAPI(),this._debouncedPrefetch=bu(this.prefetch,1e3,{trailing:!0})}_updateDebouncedCallUserAPI(){this._debouncedCallUserAPI=this.userAPI.debounce!==void 0&&this.userAPI.debounce>0?bu(this._innerCallUserAPI,this.userAPI.debounce,{leading:!0,trailing:!0}):this._innerCallUserAPI}async prefetch(e){await this.callUserAPI(e)}async callUserAPI(e){await this._debouncedCallUserAPI(e)}update(e,t,i=!0){this.userAPI=e,this._updateDebouncedCallUserAPI(),this.userAPI.url!==""&&this.userAPI.method==="GET"&&i&&this._debouncedPrefetch(t)}retrieveValue(e){if(this.result)try{return Hi.zoom(this.result,e)}catch(t){console.error(t)}}retrieveZoomedKeyValues(e){if(this.result){let t=e&&e.length?Hi.zoom(this.result,e):this.result;if(s7(t))return Object.entries(t);if(r7(t))return t.map((i,r)=>[r.toString(),i]);throw i7(t)?new Error("This path points to a value, use retrieveValue() instead. "+e?.join(".")):new Error("Path error"+e?.join("."))}}dispose(){}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}get autostart(){return this.userAPI.autoStart}};function t7(e){let t=new Headers;return e.headers.forEach(i=>{i.data.key!==""&&t.append(i.data.key,i.data.value)}),t}function i7(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e===null}function r7(e){return Array.isArray(e)}function s7(e){return typeof e=="object"&&e!==null}async function a7(e,t,i=new AbortController){let r,s=e.url,a=e.proxy?.enabled??!1,n;if(e.integration?.type==="OpenAI"){let l=jc(e.integration.prompt===""?[]:JSON.parse(e.integration.prompt),t),h=e.integration.behavior===""?[]:jc(JSON.parse(e.integration.behavior),t);n=`{ 3142 "model": "${e.integration.model}", 3143 "messages": [${e.integration.useBehavior?` 3144 { 3145 "role": "system", 3146 "content": "${h}" 3147 },`:""} 3148 { 3149 "role": "user", 3150 "content": "${l}" 3151 } 3152 ] 3153 }`}if(a){s=`https://apis.spline.design/file/${e.proxy.fileId}/external-api/request?uuidexternalapi=${e.proxy.proxyId}`;let l;n!==void 0?l=n:e.method==="POST"&&e.body&&(l=jc(JSON.parse(e.body),t)),l!==void 0&&(s+=`&data=${encodeURIComponent(l.replace(/(\r\n|\n|\r|\t)/gm,""))}`)}else e.integration?.type==="OpenAI"?r=n:e.method==="POST"&&e.body&&(r=jc(JSON.parse(e.body),t));let o=await fetch(s,{method:a?"GET":e.method,headers:a?void 0:t7(e),signal:i.signal,body:r});if(!o.ok)throw new Error("status:"+o.status+"_:_"+o.statusText);if(e.integration?.type==="OpenAI"){let l=await o.json();return a&&(l=l.response),{content:l.choices[0].message.content}}else{let l=await o.json();return a&&(l=l.response),l}}var oT=(e,t)=>{if(typeof e=="string"){let i=t.getVariable(e);if(i)return oT(i,t)}return gr.isBoolean(e)?gr.getDisplayedValue(e).toLowerCase():gr.getDisplayedValue(e)},jc=(e,t)=>e.map((i,r)=>{if("text"in i)return i.text;if("type"in i){if(i.type==="paragraph")return(r>0?` 3154`:"")+jc(i.children,t);if(i.type==="variable"){let s=t.getVariable(i.variableId);if(s!==void 0)return oT(s,t)}}return""}).join(""),n7=["+","-","*","/","(",")","==","!=",">","<",">=","<=","and","or","!","%","^",","],o7=["0","1","2","3","4","5","6","7","8","9","."],l7=["sin","cos","tan","asin","acos","atan","atan2","sqrt","abs","log","exp","floor","ceil","round","min","max","random"];function h7(e){return typeof e!="string"?!1:!isNaN(e)&&!isNaN(parseFloat(e))}Bh.addBinaryOp("^",11,!0);function lT(e,t,i="number"){let r="";for(let n=0;n<e.length;n++){let o=e[n];if("objType"in o&&o.objType==="api"){let l=JSON.parse(o.id),h=l[0],c=t.getUserAPI(h);if(c!==void 0&&c instanceof nT){let u=c.retrieveValue(l.slice(1));u!==void 0&&(r+=u)}continue}if("objType"in o&&o.objType==="webhook"){let l=JSON.parse(o.id),[h,c]=l,u=t.getUserWebhook(h);if(u!==void 0){let d=u.getParameterValue(c);d!==void 0&&(r+=d)}continue}if("objType"in o&&o.objType==="aiAssistant"){let l=t.openAIRealtime;if("objId"in o&&o.objId!==void 0){let h;if(t.scene.data.objects.traverse((c,u)=>{let d=u.events?.find(p=>p.id===o.objId);d&&(h=d)}),h!==void 0&&h.data.type==="AIAssistantListener"){let c=l?.computeAnalysisForListenerEvent(h.data);if(c!==void 0){r+=c;continue}}}r+=l?.voice??0;continue}if("id"in o){let l=e[n-1];if(n>0&&"id"in l){console.error("Two variables in a row",e);return}let h=t.getVariable(o.id),c=gr.getDisplayedValue(h);i==="number"&&gr.isTextValue(h)&&Array.isArray(h.textValue)&&h.textValue.length===1?c=parseFloat(c).toString():i==="boolean"&&gr.isBoolean(h)?c=h?"true":"false":i==="boolean"&&gr.isTextValue(h)&&!Array.isArray(h.textValue)&&(c='"'+c+'"'),r+=c;continue}else if(i==="string"){o.name!=='"'&&(o.name!=="+"||o.escaped)&&(r+=o.name),o.name==="+"&&!o.escaped&&r[r.length-1]==="\\"&&(r=r.slice(0,-1)+o.name);continue}if(o.name==="and"){r+="&&";continue}if(o.name==="or"){r+="||";continue}if(o.name==="True"){r+="true";continue}if(o.name==="False"){r+="false";continue}if(i==="boolean"&&!h7(o.name)&&!o7.includes(o.name)&&!n7.includes(o.name)&&!l7.includes(o.name.replace(/\($/g,""))){r+='"'+o.name+'"';continue}r+=o.name}if(i==="string")return r;if(e.length===0){if(i==="number")return 0;if(i==="boolean")return!1}let s;try{s=Bh(r)}catch(n){console.error(r,n);return}let a;try{a=Rt(s)}catch(n){console.error(r,s,n)}return a}function Rt(e){switch(e.type){case"BinaryExpression":switch(e.operator){case"==":return+(Rt(e.left)===Rt(e.right));case"!=":return+(Rt(e.left)!==Rt(e.right));case">":return+(Rt(e.left)>Rt(e.right));case">=":return+(Rt(e.left)>=Rt(e.right));case"<":return+(Rt(e.left)<Rt(e.right));case"<=":return+(Rt(e.left)<=Rt(e.right));case"+":return Rt(e.left)+Rt(e.right);case"-":return Rt(e.left)-Rt(e.right);case"*":return Rt(e.left)*Rt(e.right);case"/":return Rt(e.left)/Rt(e.right);case"%":return Rt(e.left)%Rt(e.right);case"&&":return Rt(e.left)&&Rt(e.right);case"||":return Rt(e.left)||Rt(e.right);case"^":return Math.pow(Rt(e.left),Rt(e.right));default:throw new Error("Unknown operator: "+e.operator)}case"UnaryExpression":switch(e.operator){case"-":return-Rt(e.argument);case"!":return+!Rt(e.argument);default:throw new Error("Unknown operator: "+e.operator)}case"Identifier":throw new Error("Unknown identifier: "+e.name);case"Literal":return e.value;case"CallExpression":if(e.callee.type==="Identifier"){if(e.callee.name==="random"){let t=0,i=1;if(e.arguments.length>=1)try{t=Rt(e.arguments[0])}catch(r){console.warn(r)}if(e.arguments.length>=2)try{i=Rt(e.arguments[1])}catch(r){console.warn(r)}return t=Math.min(i,t),i=Math.max(i,t),t+Math.random()*(i-t)}return Math[e.callee.name].apply(null,e.arguments.map(Rt))}else throw new Error("Unknown node");default:throw new Error("Unknown node type: "+e.type)}}var c7=new xe,u7=new xe;function d7(e,t,i){let r=[new M,new M,new M],s=[new M,new M,new M];return e.extractBasis(r[0],r[1],r[2]),t.extractBasis(s[0],s[1],s[2]),r.forEach((a,n)=>{let o=s[n],l=Te.lerp(a.length(),o.length(),i);a.lerp(o,i).setLength(l)}),new xe().makeBasis(r[0],r[1],r[2])}var p7=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,height:100,depth:1,subdivisions:12,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3},e.parameters),r=Math.abs(i.width),s=Math.abs(i.height??i.width),a=Math.abs(i.depth??0),n=t?.shapeData??cx.create({parameters:{...Ql,width:typeof Ql.width=="number"?Ql.width:100,height:typeof Ql.height=="number"?Ql.height:100}}).userData.shape;return{path:e.path??_f.defaultData(),parameters:Object.assign(i,{width:r,height:s,depth:a,extrusion:{...fC,...i.extrusion}}),shapeData:n}}static build(e){if(e.path.points.length>=2){let t=new f7(e);return Object.assign(t,{userData:{...e,type:"PathGeometry"}})}else return Object.assign(new He,{userData:{...e,type:"PathGeometry"}})}},f7=class extends He{constructor(e){super(),this.type="PathExtrusionGeometry",this.inputs=e,this.build()}_isGeometryClosed(){return this.inputs.path.isClosed&&this.inputs.parameters.extrusion.depth===1}_isOpenEnded(){let e=this.inputs.parameters.extrusion;return!(this.inputs.path.isClosed&&e.depth===1)||!N9(e.twist,0)||e.startScale!==e.endScale}build(){let e=this._extractPathPoints();if(e.length<2)return;let t=this._computeBasisMatrices(e),{depth:i,offset:r}=this.inputs.parameters.extrusion;i=Math.max(0,Math.min(i,1)),r=Math.max(0,Math.min(r,1));let s=this.inputs.path.isClosed?e.length:e.length-1,a=Math.floor(r*s),n=this.inputs.path.isClosed?Math.ceil((i+r)*s):Math.ceil(Math.min(1,i+r)*s),o=Math.min(Math.max(2,n-a+1),s+2),l=[],h=[];for(let B=0;B<o;B++){let U=this.inputs.path.isClosed?(B+a)%e.length:Math.min(B+a,e.length-1);l.push(e[U].clone()),h.push(t[U].clone())}let c=(B,U,Q)=>{l[B]=l[B].clone().lerp(l[U],Q),h[B]=d7(h[B],h[U],Q)},u=0,d=r*s%1;(!this.inputs.path.isClosed||i<=1)&&(d||r===0)&&(u=d,c(0,1,u));let p=0,f=(r+i)*s%1;if((this.inputs.path.isClosed&&i<=1||!this.inputs.path.isClosed&&r+i<1)&&f&&(p=f,c(l.length-1,l.length-2,1-p)),i===0){let B=l.length-1;l[B].copy(l[0]),h[B].copy(h[0])}this._applyPathModifiers(h,u,p);let{bevel:m,bevelSides:g}=this.inputs.parameters.extrusion,v=m>0?this.inputs.parameters.extrusion.capType:"flat",y=5;this.inputs.parameters.extrusion.shape.type==="Custom"&&(y=this.inputs.parameters.extrusion.shape.shapeQuality==="low"?5:12);let{regions:x,infos:w,vertices:S}=this._computeShapePoints(y),b=0,E;v==="round"&&(E=new hx(this.inputs.shapeData,2*m,m,y,g,void 0,!0),b=E.getAttribute("position").count);let _=0,A=0;w.sort((B,U)=>
3154B.start-U.start),w.forEach(B=>{B.verticesStart=_,B.verticesCount=B.continuous.reduce((U,Q,q)=>U+(q===0||!Q?2:1),0),A+=B.verticesCount,_=A});let C=A*o,T,I=0;if(this._isOpenEnded()&&v==="flat"){try{T=$n({windingRule:Gt.ODD,elementType:Oi.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:x})}catch{T=QC}I=T.vertexCount}let P=C+2*I+b*2,O=C+2*I,k={positions:new Float32Array(P*3),normals:new Float32Array(P*3),uvs:new Float32Array(P*2)},G=[];if(w.forEach(B=>{this._extrudeRegion(B,S,h,l,k,G,this._isGeometryClosed()&&!this._isOpenEnded())}),T&&(this._closeEnd(T,C,G,k,h[0],l[0],!1),this._closeEnd(T,C+I,G,k,h[h.length-1],l[l.length-1],!0)),E){k.positions.set(E.getAttribute("position").array,O*3),k.normals.set(E.getAttribute("normal").array,O*3),k.uvs.set(E.getAttribute("uv").array,O*2);for(let q=O;q<O+b;q++)k.uvs[q*2+1]=1e-4;let B=G.length;G.push(...E.getIndex().array.map(q=>q+O)),O+=b,k.positions.set(E.getAttribute("position").array,O*3),k.normals.set(E.getAttribute("normal").array,O*3),k.uvs.set(E.getAttribute("uv").array,O*2);let U=G.length;G.push(...E.getIndex().array.map(q=>q+O)),this.setAttribute("position",new tt(k.positions,3)),this.setAttribute("normal",new tt(k.normals,3)),this.setAttribute("uv",new tt(k.uvs,2)),this.setIndex(G);let Q=c7;Q.copy(h[h.length-1]).setPosition(l[l.length-1]),this.applyMatrix4OnRange(Q,O,P),Q.copy(h[0]).setPosition(l[0]).multiply(u7.makeScale(1,1,-1)),this.applyMatrix4OnRange(Q,O-b,O),this.reverseIndicesOnRange(B,U)}else this.setAttribute("position",new tt(k.positions,3)),this.setAttribute("normal",new tt(k.normals,3)),this.setAttribute("uv",new tt(k.uvs,2)),this.setIndex(G)}_extractPathPoints(){let e=UC(this.inputs.path),t=this.inputs.path.subdivisions,i=this.inputs.path.subdivisionMode==="uniform"?e.getSpacedPoints(t*4):e.getPoints(t);if(i.length<2)return[];let r=[i[0]];return i.forEach(s=>{r[r.length-1].distanceToSquared(s)>.001&&r.push(s)}),this.inputs.path.isClosed&&r[r.length-1].distanceTo(r[0])<.001&&r.pop(),r}_computeBasisMatrices(e){let t=[],i=e.length,r=this.inputs.path.isClosed,s=new M,a=new M,n=new M,o=new M,l=new M(0,1,0);for(let f=0;f<i;f++){let m=e[f],g;f===0?g=r?e[e.length-2]:m.clone().multiplyScalar(2).sub(e[1]):g=e[f-1];let v;f===i-1?v=r?e[1]:m.clone().multiplyScalar(2).sub(e[f-1]):v=e[f+1];let y=m.clone().sub(g).normalize(),x=v.clone().sub(m).normalize(),w=y.clone().add(x).normalize();n.copy(w),f===0&&(w.equals(l)||w.clone().negate().equals(l))&&l.set(0,0,1);let S=l.clone().cross(w).normalize(),b=w.clone().cross(S).normalize();l.copy(b),o.copy(S),f===0&&(s.copy(b),a.copy(w));let E=new xe().makeBasis(S,b,w);t.push(E)}let h=r?a:n,c=r?s:new M(0,1,0),u=h.clone().cross(o).normalize(),d=Math.acos(c.dot(u));if(isNaN(d))return t;let p=c.clone().cross(u);h.dot(p)>0&&(d*=-1);for(let f=1;f<t.length;f++){let m=new xe().makeRotationZ(d*f/t.length);t[f].multiply(m)}return t}_applyPathModifiers(e,t,i){let r=e.length,{angle:s,twist:a,startScale:n,endScale:o}=this.inputs.parameters.extrusion,l=new xe,h=new xe;return e.forEach((c,u)=>{let d=u===0?0:u===r-1?1:(u-t)/(r-(i===0?0:1)-(t+(1-i)));l.makeRotationZ(Te.lerp(s,s+a,d)*Te.DEG2RAD);let p=Te.lerp(n,o,d);h.makeScale(p,p,p),c.multiply(l).multiply(h)}),e}_computeShapePoints(e=12,t=Gt.ODD){let i=this.inputs.shapeData,r=i.extractShapePointsToFlatArray([],e),s=i.shapeHoles.map(h=>{let c=h.extractShapePointsToFlatArray([],e),u=[];for(let d=c.length-1;d>=1;d-=2){let p=c[d-1],f=c[d-0];u.push(p,f)}return u}),a;try{a=$n({windingRule:t,elementType:Oi.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[r]})}catch{a=lx}let n;try{n=$n({windingRule:Gt.ODD,elementType:Oi.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...s]})}catch{n=YC}if(!a)throw new Error("error generating geometry");let o=a.elementCount;if(n){a.elementCount+=n.elementCount;for(let h=0;h<n.elements.length;h++){let c=n.elements[h],u=h%2===0?a.vertexCount:0;a.elements.push(c+u)}for(let h=0;h<n.vertexIndices.length;h++){let c=n.vertexIndices[h],u=a.vertexCount;a.vertexIndices.push(c+u)}for(let h=0;h<n.vertices.length;h++){let c=n.vertices[h];a.vertices.push(c)}}for(let h=0,c=a.vertexCount;h<c;h++){let u=h*2;a.vertices[u+0],a.vertices[u+1]}let l=[];for(let h=a.elementCount-1;h>=0;h--){let c=h>=o,u=h*2,d=a.elements[u+0],p=a.elements[u+1],f=d+p,m={start:d,count:p,normals:[],isHole:c,continuous:[],verticesStart:0,verticesCount:0};l.push(m);let g=d,v=f-1,y=d+1,x=i.roundedCurves.length;do{let w=g-d;a.vertices[v*2+0],a.vertices[v*2+1];let S=a.vertices[g*2+0],b=a.vertices[g*2+1],E=a.vertices[y*2+0],_=a.vertices[y*2+1],A=S-E,C=b-_,T=Math.sqrt(A*A+C*C);A/=T,C/=T,m.normals[w*2+0]=-C,m.normals[w*2+1]=A;let I=a.vertexIndices[g];if(Array.isArray(I))m.continuous[w]=!1;else{let[P,O]=i.getCurveIndexFromVertexId(I-1,!0);if(O>0&&O<1)m.continuous[w]=!0;else{let k=O===1?P+1:P-1;k=(k+x)%x;let G=O===1?0:1,B=i.roundedCurves[P].getTangent(O),U=i.roundedCurves[k].getTangent(G);m.continuous[w]=B.dot(U)>.95}}c&&(m.normals[w*2+0]*=-1,m.normals[w*2+1]*=-1),[v,g,y]=[g,y,y+1],y>=f&&(y-=p)}while(y!==d+1)}return{regions:[r,...s],infos:l,vertices:a.vertices}}_insertVertex(e,t,i,r,s){let a=t*2,n=t*3;e.positions[n+0]=i.x,e.positions[n+1]=i.y,e.positions[n+2]=i.z,e.normals[n+0]=r.x,e.normals[n+1]=r.y,e.normals[n+2]=r.z,e.uvs[a+0]=s.x,e.uvs[a+1]=s.y}_extrudeRegion(e,t,i,r,s,a,n){let o=new M,l=new M,h=new M,c=new M,u=new H;
3154i.forEach((p,f)=>{let m=r[f],g=e.verticesStart*i.length+e.verticesCount*f;for(let v=0;v<e.count;v++){let y=(e.start+v)*2;if(o.set(t[y+0],t[y+1],0),h.copy(o).applyMatrix4(p).add(m),e.continuous[v])c.set(e.normals[v*2+0],e.normals[v*2+1],0);else{let x=v===0?(e.start+e.count-1)*2:y-2;l.set(t[x+0],t[x+1],0),c.copy(o).sub(l),c.set(-c.y,c.x,0),e.isHole||c.negate()}if(c.applyMatrix4(p).normalize(),u.set(v===0?1:v/e.count,f/(i.length-1)),this._insertVertex(s,g,h,c,u),g++,!e.continuous[v]||v===0){if(v===0)c.set(e.normals[v*2+0],e.normals[v*2+1],0),u.set(0,f/(i.length-1));else{let x=v===e.count-1?e.start*2:y+2;l.set(t[x+0],t[x+1],0),c.copy(l).sub(o),c.set(-c.y,c.x,0),e.isHole||c.negate()}c.applyMatrix4(p).normalize(),this._insertVertex(s,g,h,c,u),g++}}});let d=i.length-1;for(let p=0;p<d;p++){let f=e.verticesStart*i.length+e.verticesCount*p,m=e.verticesStart*i.length+e.verticesCount*(p+1),g=0;for(let v=0;v<e.count;v++){(!e.continuous[v]||v===0)&&g++;let y=v===e.count-1?0:g+1,x=f+g,w=f+y,S=m+y,b=m+g;e.isHole?a.push(x,S,w,x,b,S):a.push(x,w,S,x,S,b),g++}}}_closeEnd(e,t,i,r,s,a,n){let o=e.vertexCount,l=new M(0,0,n?-1:1).applyMatrix4(s),h=new M,c=new H;for(let d=0;d<o;d++){let p=2*d;h.set(e.vertices[p+0],e.vertices[p+1],0).applyMatrix4(s).add(a),this._insertVertex(r,t+d,h,l,c)}let u=e.elements;for(let d=0;d<e.elementCount;d++){let p=3*d,f=u[p+0]+t,m=u[p+(n?1:2)]+t,g=u[p+(n?2:1)]+t;i.push(f,m,g)}}applyMatrix4OnRange(e,t,i){let r=e.elements,s=new Ii().getNormalMatrix(e).elements,a,n,o,l,h=this.attributes.position,c=this.attributes.normal;if(!h||!c)return;let u=h.array,d=c.array,p=h.itemSize;for(let f=t*p,m=i*p;f<m;f+=p){if(f===t)debugger;a=u[f+0],n=u[f+1],o=u[f+2],l=1/(r[3]*a+r[7]*n+r[11]*o+r[15]),u[f+0]=(r[0]*a+r[4]*n+r[8]*o+r[12])*l,u[f+1]=(r[1]*a+r[5]*n+r[9]*o+r[13])*l,u[f+2]=(r[2]*a+r[6]*n+r[10]*o+r[14])*l,a=d[f+0],n=d[f+1],o=d[f+2],d[f+0]=s[0]*a+s[3]*n+s[6]*o,d[f+1]=s[1]*a+s[4]*n+s[7]*o,d[f+2]=s[2]*a+s[5]*n+s[8]*o}h.needsUpdate=!0,c.needsUpdate=!0}reverseIndicesOnRange(e,t){let i=this.index;if(i){for(let r=e;r<t;r+=3){let s=i.getX(r),a=i.getX(r+1),n=i.getX(r+2);i.setXYZ(r,n,a,s)}i.needsUpdate=!0}}};function hT(){let e=new He;return e.setAttribute("position",new tt(new Float32Array([]),3)),e.setIndex(new tt(new Uint16Array([]),1)),e}var m7=hT().attributes,g7=12,v7=1,my=class extends He{constructor(e,t){super(),this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],Object.assign(this.attributes,m7),this.userData={parameters:e,type:"TextGeometry"};let i=t.getFont(e.font);i?.isLoaded?(this.font=i,this.update(e,t)):this.updateFont(e.font,t).then(()=>{this.update(e,t),t?.requestRender()})}async updateFont(e,t){let i=t.getFont(e);i&&(this.font=i,await i.loadingPromise)}update(e,t){let i=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!i?.isLoaded){console.warn("Cannot update text because its font is not loaded");return}let{width:r,height:s,depth:a,extrudeBevelSize:n,extrudeBevelSegments:o,text:l,textTransform:h}=e,c=gr.getDisplayedValue(l),u=h===2?c.toUpperCase():h===3?c.toLowerCase():c,d=y7(e,i,u,t),{shapes:p,charWidths:f,charCoords:m}=i.generateShapes(d,e,t),g=(typeof r=="number"?r:Number(t.getVariable(r)))*.5,v=(typeof s=="number"?s:Number(t.getVariable(s)))*.5,y=p.map(S=>new mi().fromShape(S,!0));this.vectorShapes=y;let x=y.map(S=>ul.create({shape:S,parameters:{depth:a,extrudeBevelSegments:o,extrudeBevelSize:n,windingRule:a<=0?Gt.NONZERO:Gt.ODD,subdivisions:this.isLowResolution&&a>0?v7:g7}})),w=x.length?jo(x):hT();w.translate(-g,v,0),this.dispose(),this.wrappedText=d,this.charCoords=m,this.charWidths=f,this.deleteAttribute("extrudeNormal"),Object.entries(w.attributes).forEach(([S,b])=>{this.setAttribute(S,b)}),this.setIndex(w.index),this.computeBoundingSphere()}clone(){let e=Kr(new He,my.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach(([t,i])=>{this.setAttribute(t,i)}),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e,t){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:e}},t)}get text(){return this.userData.parameters.text??""}};function y7(e,t,i,r){let s=typeof e.width=="string"?Number(r.getVariable(e.width)):e.width,a=[""],n="";for(let o of i)n+=o,o===" "||o===` 3155`?(a[a.length-1]+=n,n="",o===` 3156`&&a.push("")):t.getTextWidth(a[a.length-1]+n,e)>s&&(a[a.length-1].length&&a.push(""),t.getTextWidth(a[a.length-1]+n,e)>s&&(n.length===1?(a[a.length-1]+=n,n=""):(a[a.length-1]+=n.slice(0,-1),n=n[n.length-1],a.push(""))));return a[a.length-1]+=n,a}var cT,uT=new Promise(e=>{cT=e}),V_=!1,Zd;function x7(e){if(V_)return;if(Zd)return Zd;async function t(){let i=e??"https://unpkg.com/@splinetool/[email protected]/build",r=fo(()=>import("./process-VPR0TfJD.js"),[]),[s,a]=await Promise.all([r,fetch(`${i}/process.wasm`).then(l=>l.arrayBuffer())]),n=s.default,o=await n({wasmBinary:a});cT(o),V_=!0}return Zd=t(),Zd}var b7=["font"];function Fh(e,t,i,r){let s,a,n;e.type==="PathGeometry"?(a=JSON.parse(JSON.stringify(e)),n=[[],["extrusion"]]):(a={...e},n=[[]]);for(let h of n){let c=a;for(let u of h)c=c[u];for(s in c){let u=c[s];DS(u)&&!b7.includes(s)&&(c[s]=t.getVariable(u,[r.uuid,"geometry",...h,s]),DS(c[s])&&(c[s]=1))}}let o={parameters:a,type:a.type};if(a.type==="PathGeometry")o.path=a.path;else if(a.type==="VectorGeometry"){let h=mi.createFromState(a.shape,a.width,a.height);o.shape=h}else if(a.type==="NonParametricGeometry"){if(a.data.groups&&a.data.groups?.forEach(h=>h.materialIndex=Math.max(h.materialIndex??0,0)),o.geometry=new HM().parse(a),o.geometry.groups.length===0){let h=o.geometry;h.addGroup(0,Math.max(h.getIndex()?.count??0,h.getAttribute("position").count),0)}}else if(a.type==="SubdivGeometry"){let h=new Ir(a,i);return h.data=e,h}else{if(a.type==="TextGeometry")return new my(a,t);
vendor: 8,670 bytes, line 3156
3156if(a.type==="InputGeometry")return new my(a,t);if(a.type==="UIGeometry")return ux.create({parameters:{width:a.width,height:a.height,cornerRadius:a.cornerRadius,cornerType:a.cornerType}})}let l;try{l=q_(o)}catch(h){console.error(h),console.error(`Error generating geometry with inputs: ${o}`);let c=mi.createFromState(Sf.defaultData(),100,100);o.shape=c,o.type="VectorGeometry",l=q_(o)}return l}var w7=new xe;function gy(e,t,i,r){let s=e.position.array,a=e.normal.array,n=w7.makeScale(t,i,r).invert().elements,o,l,h;for(var c=0,u=s.length;c<u;c+=3)s[c]*=t,s[c+1]*=i,s[c+2]*=r,o=a[c],l=a[c+1],h=a[c+2],a[c]=n[0]*o+n[4]*l+n[8]*h,a[c+1]=n[1]*o+n[5]*l+n[9]*h,a[c+2]=n[2]*o+n[6]*l+n[10]*h;e.position.needsUpdate=!0,e.normal.needsUpdate=!0}var Jd=new yi,zl=new M,rt;uT.then(e=>{rt=e});var j_=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),H_=new Uint32Array([0,1,2,3]),G_=new Uint8Array([4]),Ir=class extends He{constructor(e,t){super(),this.data=e,this.flatShading=t,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,t){this.freeSubdivPointer();let i=this.data.scaleBaked.map(n=>typeof n=="number"?n:1),r=ao.div(t.map(n=>typeof n=="number"?n:0),i);if(r.every(n=>n===1))return;this.subdividedGeometry&&gy(this.subdividedGeometry.attributes,...r),this.originalGeometry&&gy(this.originalGeometry.attributes,...r),this.data=e;let s=this.userData.parameters;this.userData.parameters={width:s.width*r[0],height:s.height*r[1],depth:s.depth*r[2]},this.originalGeometry.boundingSphere.center.multiply(zl.fromArray(r));let a=zl.set(s.width,s.height,s.depth).length();this.originalGeometry.boundingSphere.radius=a/2}ensureSubdivPointer(){return this.subdivPointer===0&&this.rebuild(),this.subdivPointer}rebuild(){let e,t,i;try{({originalGeometry:e,subdividedGeometry:t,subdivPointer:i}=Ir.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new Hs(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=e,this.subdividedGeometry=t??void 0;let r=this.subdividedGeometry??this.originalGeometry;Object.assign(this,r),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Ir.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new is,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;Jd.setFromBufferAttribute(t),Jd.getCenter(i),e.boundingSphere.radius=i.distanceTo(Jd.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Jd.getSize(zl);let r={width:zl.x,height:zl.y,depth:zl.z};return this.userData.parameters=r,r}static build(e,t,i,r){let s,a,n,o=e?.phongAngle??35;i===!1&&(o=-1),t&&(rt.free_bvh(t),rt.free_subdivision_surface(t));try{s=Ir.allocate(e,r)}catch(l){console.error(l,e),s=Ir.allocate({positionWASM:j_,indexWASM:H_,verticesPerFaceWASM:G_},r)}if(rt.set_destination_refinement_level(s,0),a=Ir.buildLevel(s,!0,o),e.subdivisions>0)try{rt.set_destination_refinement_level(s,e.subdivisions),n=Ir.buildLevel(s,!1,o)}catch{try{rt.set_destination_refinement_level(s,e.subdivisions-1),n=Ir.buildLevel(s,!1,o)}catch{n=null}}else n=null;return{subdivPointer:s,originalGeometry:a,subdividedGeometry:n}}static primitiveToQuads(e,t,i){e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),e.type==="DodecahedronGeometry"&&(e.detail=0);let r=e.shape!==void 0||e.path!==void 0?t.geometry:Fh(e,i,!1,t),s;e.type==="TorusGeometry"&&e.arc===Math.PI*2?s=r.getClosedTorusIndicesForBooleanOrSubdiv():s=r.getIndex();let a,n,o,l;({positions:a,triIndices:l}=wm(r.getAttribute("position"),s));let h;if(e.type==="CylinderGeometry"&&e.cornerRadius===0&&e.hollow===0&&e.openEnded===!1){let c=e.radialSegments*e.heightSegments*3*2,u=c+e.radialSegments*3;h=[c,u]}return{indices:n,verticesPerFace:o}=dT(a,l,r,h),{positions:a,indices:n,verticesPerFace:o}}static allocate(e,t){let i,r,s,a=[],n=[];e.positionWASM&&e.positionWASM.length>0?(i=e.positionWASM,r=e.indexWASM,s=e.verticesPerFaceWASM):(i=j_,r=H_,s=G_);let o=i.length,l=r.length,h=s.length,c=i.length+a.length+n.length,u=r.length+s.length,d=c*Float32Array.BYTES_PER_ELEMENT+u*Uint32Array.BYTES_PER_ELEMENT,p=c*Float32Array.BYTES_PER_ELEMENT,f=rt._malloc(d),m=new Float32Array(rt.HEAPF32.buffer,f,c),g=new Uint32Array(rt.HEAPU32.buffer,f+p,u);m.set(i,0),m.set(a,i.length),m.set(n,i.length+a.length),g.set(r,0),g.set(s,r.length);let v;e?.scaleBaked?.some(x=>x!==1)&&(v=new xe().makeScale(...e.scaleBaked.map(x=>typeof x=="number"?x:1))),t&&(v?v.premultiply(t):v=t);let y=v?rt.alloc_subdivision_surface2(f,o,f+p,l,f+p+r.length*Uint32Array.BYTES_PER_ELEMENT,h,v.elements):rt.alloc_subdivision_surface(f,o,f+p,l,f+p+r.length*Uint32Array.BYTES_PER_ELEMENT,h);return rt._free(f),y}static buildLevel(e,t,i,r,s){let a=s?rt.get_mesh_data2(e,t?rt.Level.CONTROL:rt.Level.REFINED,i,s.elements):rt.get_mesh_data(e,t?rt.Level.CONTROL:rt.Level.REFINED,i),n=8,o=rt.HEAPU32.subarray(a>>2,(a>>2)+n),l=o.subarray(4,8),h=0,c=rt.HEAPU32[o[h]>>2],u=rt.HEAPF32.subarray(c>>2,(c>>2)+l[h]);h++;let d=rt.HEAPU32[o[h]>>2],p=rt.HEAPF32.subarray(d>>2,(d>>2)+l[h]);h++;let f=rt.HEAPU32[o[h]>>2],m=rt.HEAPU32.subarray(f>>2,(f>>2)+l[h]);h++;let g=rt.HEAPU32[o[h]>>2],v=rt.HEAPU32.subarray(g>>2,(g>>2)+l[h]);if(h++,r===void 0){let y=new He;if(y.setIndex(new lh(v,1)),y.setAttribute("position",new De(u,3)),y.setAttribute("normal",new De(p,3)),t){y.setAttribute("faceMap",new lh(m,1));let x=new Float32Array(p.length/3*4).fill(0);y.setAttribute("color",new tt(x,4))}return rt.free_mesh_data(a),y.userData.type="SubdivGeometry",y}r.getAttribute("position").copyArray(u),r.getAttribute("normal").copyArray(p),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,rt.free_mesh_data(a)}static freeSubdivPointer(e){rt.free_bvh(e),rt.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let r=rt.get_wireframe_data_for_base_level(e),s=4,a=rt.HEAPU32.subarray(r>>2,(r>>2)+s),n=a.subarray(2,4),o=0,l=rt.HEAPU32[a[o]>>2],h=rt.HEAPF32.subarray(l>>2,(l>>2)+n[o]);o++;let c=rt.HEAPU32[a[o]>>2],u=rt.HEAPU32.subarray(c>>2,(c>>2)+n[o]);if(t===void 0){let d=new He;d.setAttribute("position",new De(h,3));let p=new Float32Array(h.length);for(let f=0,m=h.length;f<m;)p[f++]=i.r,p[f++]=i.g,p[f++]=i.b;return d.setAttribute("color",new tt(p,3)),d.setIndex(new lh(u,1)),rt.free_wireframe_data_for_base_level(r),d}t.getAttribute("position").copyArray(h),t.attributes.position.needsUpdate=!0,rt.free_wireframe_data_for_base_level(r)}static updateCollabMesh(e,t,i){let r=t===0;r||rt.set_destination_refinement_level(e,t);let s=i?rt.get_topological_data2(e,r?rt.Level.CONTROL:rt.Level.REFINED,i.elements):rt.get_topological_data(e,r?rt.Level.CONTROL:rt.Level.REFINED),a=6,n=rt.HEAPU32.subarray(s>>2,(s>>2)+a),o=n.subarray(3,6),l=0,h=rt.HEAPU32[n[l]>>2],c=new Float32Array(rt.HEAPF32.subarray(h>>2,(h>>2)+o[l]));l++;let u=rt.HEAPU32[n[l]>>2],d=new Uint32Array(rt.HEAPU32.subarray(u>>2,(u>>2)+o[l]));l++;let p=rt.HEAPU32[n[l]>>2],f=new Uint8Array(rt.HEAPU32.subarray(p>>2,(p>>2)+o[l]));return rt.free_topological_data(s),{positions:c,indices:d,verticesPerFace:f}}},W_=["getX","getY","getZ"];function wm(e,t){let i={},r=t?t.count:e.count,s=0,a=[],n=[],o=1e4;for(let h=0;h<r;h++){let c=t?t.getX(h):h,u="";for(let d=0;d<3;d++)u+=`${~~(e[W_[d]](c)*o)},`;if(u in i)a.push(i[u]);else{for(let d=0;d<3;d++)n.push(e[W_[d]](c));i[u]=s,a.push(s),s++}}let l=[];for(let h=0;h<a.length;h+=3)a[h]===a[h+1]||a[h]===a[h+2]||a[h+1]===a[h+2]||l.push(a[h],a[h+1],a[h+2]);return{positions:n,triIndices:l}}var $d=new M,qg=new M,Xg=new M,Yg=new M;function dT(e,t,i,r){let s=[],a=[];if(i.userData.shape!==void 0&&i.userData.parameters.depth===0&&i.userData.shape.shapeHoles.length===0){let l=i.userData.shape.extractShapePointsToFlatArray([]),h=i.userData.parameters.spikes;if(i.userData.type==="EllipseGeometry"&&h<=24&&h%4===0&&i.userData.parameters.angle>=360){let d=l.length/2/h;l=l.filter((p,f)=>Math.floor(f/2)%d===0)}let c=0;for(let d=0;d<l.length;d+=2)c+=(l[d]-l[(d===0?l.length:d)-2])*(l[d+1]+l[(d===0?l.length:d)-1]);e.length=0;let u=0;if(c<0)for(let d=0;d<l.length;d+=2)e.push(l[d],l[d+1],0),s.push(u++);else for(let d=l.length-2;d>=0;d-=2)e.push(l[d],l[d+1],0),s.push(u++);return a.push(u),{indices:s,verticesPerFace:a}}let n=new Float32Array([i.userData.parameters.depth])[0],o=0;for(;o<t.length;){if(i.useNgonForTopBottomFaceDuringBake){let l=0;
3156if((e[t[o]*3+2]===n||e[t[o]*3+2]===0)&&l++,(e[t[o+1]*3+2]===n||e[t[o+1]*3+2]===0)&&l++,(e[t[o+2]*3+2]===n||e[t[o+2]*3+2]===0)&&l++,l===3)break}if(t[o+1]===t[o+3]&&t[o+2]===t[o+5]||t[o+0]===t[o+3]&&t[o+2]===t[o+4]){$d.set(e[t[o]*3],e[t[o]*3+1],e[t[o]*3+2]),qg.set(e[t[o+1]*3],e[t[o+1]*3+1],e[t[o+1]*3+2]),Xg.set(e[t[o+4]*3],e[t[o+4]*3+1],e[t[o+4]*3+2]),Yg.set(e[t[o+5]*3],e[t[o+5]*3+1],e[t[o+5]*3+2]),qg.sub($d).normalize(),Xg.sub($d).normalize(),Yg.sub($d).normalize();let l=qg.cross(Xg).dot(Yg),h=o;Math.abs(l)>.005||r&&r.some((c,u)=>u%2===1?!1:h>=r[u]&&h<r[u+1])?(s.push(t[o],t[o+1],t[o+2]),a.push(3),o+=3):(s.push(t[o],t[o+1],t[o+4],t[o+5]),a.push(4),o+=6)}else s.push(t[o],t[o+1],t[o+2]),a.push(3),o+=3}if(i.useNgonForTopBottomFaceDuringBake){let l=[],h=[],c=0;for(let u=0,d=0;u<e.length;u+=3,d++)e[u+2]===0&&(l.push(d),c++),e[u+2]===n&&h.push(d);if(i.userData.parameters.extrudeBevelSize===0){let u=h[0];h[0]=h[1],h[1]=u}l.reverse(),s.push(...l,...h),a.push(c,c)}return{indices:s,verticesPerFace:a}}var Xa={};SD(Xa,{calcBoolean:()=>E7,calcBooleanTopological:()=>M7,freeMeshSet:()=>D7,getMeshSet:()=>C7,hasOpenEdges:()=>T7,transformMeshSet:()=>P7});var pT,S7=new Promise(e=>{pT=e}),ep;function _7(e){if(ep)return ep;async function t(){let i=e??"https://unpkg.com/@splinetool/[email protected]/build",r=fo(()=>import("./boolean-DnW06Vcs.js"),[]),[s,a]=await Promise.all([r,fetch(`${i}/boolean.wasm`).then(l=>l.arrayBuffer())]),n=s.default,o=await n({wasmBinary:a});pT(o)}return ep=t(),ep}var Ct,gh;S7.then(e=>Ct=e);function A7(e,t,i){let r,s;e.userData.parameters.type==="TorusGeometry"&&e.userData.parameters.arc===Math.PI*2?s=e.getClosedTorusIndicesForBooleanOrSubdiv():s=e.getIndex();let{positions:a,triIndices:n}=wm(e.getAttribute("position"),s),o;if(t&&i){let{indices:l,verticesPerFace:h}=dT(a,n,e);o=h.length,r=[];for(let c=0,u=0;c<o;c++){r.push(h[c]);for(let d=0;d<h[c];d++)r.push(l[u++])}}else{let l=n.length;r=Array(l+l/3),o=0;for(let h=0,c=0;c<r.length;)r[c++]=3,o++,r[c++]=n[h++],r[c++]=n[h++],r[c++]=n[h++]}return{positions:a,faceIndices:r,nFaces:o}}function fT(e){let t=e.length,i=t*Uint32Array.BYTES_PER_ELEMENT,r=t*Float32Array.BYTES_PER_ELEMENT,s=Number.isInteger(e[0])?i:r,a=Ct._malloc(s);return(Number.isInteger(e[0])?new Uint32Array(Ct.HEAPU32.buffer,a,t):new Float32Array(Ct.HEAPF32.buffer,a,t)).set(e,0),a}function mT(e){switch(e){case 0:return Ct.OP.UNION;case 1:return Ct.OP.INTERSECTION;case 2:return Ct.OP.A_MINUS_B;default:throw new Error("Unknown boolean operation "+e)}}function M7(e,t){gh===void 0&&(gh=Ct.init_csg());let i=fT(e),r=Ct.csg_calc_topological(gh,i,e.length,mT(t));Ct._free(i);let s=6,a=Ct.HEAPU32.subarray(r>>2,(r>>2)+s),n=a.subarray(3,6),o=0,l=Ct.HEAPU32[a[o]>>2],h=new Float32Array(Ct.HEAPF32.subarray(l>>2,(l>>2)+n[o]));o++;let c=Ct.HEAPU32[a[o]>>2],u=new Uint32Array(Ct.HEAPU32.subarray(c>>2,(c>>2)+n[o]));o++;let d=Ct.HEAPU32[a[o]>>2],p=new Uint8Array(Ct.HEAPU32.subarray(d>>2,(d>>2)+n[o]));return Ct.free_mesh_data(r),{positions:h,indices:u,verticesPerFace:p}}function E7(e,t,i,r){gh===void 0&&(gh=Ct.init_csg());let s=fT(e),a=Ct.csg_calc(gh,s,e.length,r,mT(t));Ct._free(s);let n=5,o=Ct.HEAPU32.subarray(a>>2,(a>>2)+n),l=o.subarray(2,5),h=0,c=Ct.HEAPU32[o[h]>>2],u=Ct.HEAPF32.subarray(c>>2,(c>>2)+l[h]);h++;let d=Ct.HEAPU32[o[h]>>2],p=Ct.HEAPF32.subarray(d>>2,(d>>2)+l[h]);h++;let f=l[h];i.setAttribute("position",new De(u,3)),i.setAttribute("normal",new De(p,3));let m=Ct.HEAPF32.subarray((a>>2)+5,(a>>2)+5+6);return i.boundingSphere===null&&(i.boundingSphere=new is),i.boundingSphere.center.set(m[0],m[1],m[2]),i.boundingSphere.radius=(m[3]**2+m[4]**2+m[5]**2)**.5,i.userData.parameters={width:m[3]*2,height:m[4]*2,depth:m[5]*2},Ct.free_mesh_data(a),f}function C7(e,t,i){if(Ct===void 0)return-1;let r,s,a;if(t&&e.userData.positions!==void 0){let g=e.userData;a=g.verticesPerFace.length,r=g.positions,s=Array(g.verticesPerFace.reduce((v,y)=>v+y,0)+a);for(let v=0,y=0,x=0;v<g.verticesPerFace.length;v++){s[x++]=g.verticesPerFace[v];for(let w=0;w<g.verticesPerFace[v];w++)s[x++]=g.indices[y++]}}else({positions:r,faceIndices:s,nFaces:a}=A7(e,t,i));let n=r.length,o=s.length,l=r.length,h=s.length,c=l*Float32Array.BYTES_PER_ELEMENT+h*Uint32Array.BYTES_PER_ELEMENT,u=l*Float32Array.BYTES_PER_ELEMENT,d=Ct._malloc(c),p=new Float32Array(Ct.HEAPF32.buffer,d,l),f=new Uint32Array(Ct.HEAPU32.buffer,d+u,h);p.set(r,0),f.set(s,0);let m=Ct.get_csg_mesh(d,n,d+u,o,a);return Ct._free(d),m}
vendor: 46,899 bytes, lines 3156-3399
3156function T7(e){return Ct.has_open_edges(e)}function P7(e,t){Ct.transform_csg_mesh(e,t.elements)}function D7(e){Ct.free_csg_mesh(e)}var O7={ConeGeometry:I8,CubeGeometry:R8,CylinderGeometry:NC,DodecahedronGeometry:z8,EllipseGeometry:cx,HelixGeometry:v9,IcosahedronGeometry:y9,LatheGeometry:x9,NonParametricGeometry:E9,PolygonGeometry:sT,PyramidGeometry:T9,RectangleGeometry:ux,SphereGeometry:O9,PlaneGeometry:I9,BackdropGeometry:R9,StarGeometry:aT,TextFrameGeometry:z9,TorusGeometry:B9,TorusKnotGeometry:k9,TriangleGeometry:U9,PathGeometry:p7,VectorGeometry:ul},q_=e=>O7[e.type].create(e);function Bl(e){return e!==null&&"booleanOp"in e}var gT=class extends sx(Zt){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new xe}updateVisible(e){super.updateVisible(e),this.visible=!Bl(this.parent)&&this.visible,Bl(this.parent)&&this.parent.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Xa.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Bl(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof gT&&(e.freeBooleanPointer(),Bl(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,t){let i=super.updateTransformState(e,t);return i&&Bl(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(e=!1){super.onVariableUpdate(e),Bl(this.parent)&&this.invalidateDownstreamBooleanData(!0)}},tp=new yi;function dx(e,t=0,i=e.count,r,s){let a=1/0,n=1/0,o=1/0,l=-1/0,h=-1/0,c=-1/0;for(let u=t;u<i;u++){let d=e.getX(u),p=e.getY(u),f=e.getZ(u);d<a&&(a=d),p<n&&(n=p),f<o&&(o=f),d>l&&(l=d),p>h&&(h=p),f>c&&(c=f)}tp.min.set(a,n,o),tp.max.set(l,h,c),tp.getCenter(r),tp.getSize(s).multiplyScalar(.5)}var I7=new He,R7=new pn,xr=class extends gT{constructor(e,t){super(I7,R7),this.super_Entity(e,t)}updateState(e,t){this.updateState_Entity(e,t)}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");i!==void 0?dx(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}},Un=class{constructor(e){if(this.hashProperties=void 0,this.isNode=!0,this.shortcuts={},Un.uuidContext===null)throw new Error("plz startContext");Un.uuidContext===Un.globalContext?this.uuid="_gid"+Un.uuidContext.nodeContextUuid++:this.uuid="_uid"+Un.uuidContext.nodeContextUuid++,this.type=e,this.name=""}static startContext(e){this.uuidContext===null||this.uuidContext===Un.globalContext?this.uuidContext=e:console.error("Can't start context twice")}static endContext(e){this.uuidContext!==e&&console.error("Can't end context twice"),this.uuidContext=null}analyze(e,t){t=t??{},e.analyzing=!0,this.build(e.addFlow(t.slot,t.cache,t.context),"v4"),e.clearVertexNodeCode(),e.clearFragmentNodeCode(),e.removeFlow(),e.analyzing=!1}analyzeAndFlow(e,t,i){return i=i??{},this.analyze(e,i),this.flow(e,t,i)}flow(e,t,i){i=i??{},e.addFlow(i.slot,i.cache,i.context);let r={result:this.build(e,t),code:e.clearNodeCode(),extra:e.context.extra};return e.removeFlow(),r}build(e,t,i){t=t??this.getType(e,t);let r=e.getNodeData(i??this);return e.analyzing&&this.appendDepsNode(e,r,t),e.nodes.indexOf(this)===-1&&e.nodes.push(this),this.updateFrame!==void 0&&e.updaters.indexOf(this)===-1&&e.updaters.push(this),this.generate(e,t,i)}updateFrame(e){}generateReadonly(e,t,i,r,s,a){return""}generate(e,t,i,r,s){return""}parse(e,t,i,r){}appendDepsNode(e,t,i){t.deps=(t.deps||0)+1;let r=e.getTypeLength(i);(r>(t.outputMax||0)||this.getType(e,i))&&(t.outputMax=r,t.output=i)}setName(e){this.name=e}getName(){return this.name}getType(e,t){return t==="sampler2D"||t==="samplerCube"?t:this.type}},ji=Un;ji.globalContext={nodeContextUuid:0},ji.uuidContext=Un.globalContext;var X_=class{constructor(e){e=e??{},this.name=e.name,this.type=e.type,this.node=e.node,this.size=e.size,this.needsUpdate=e.needsUpdate}get value(){return this.node.value}set value(e){this.node.value=e}},L7=class{constructor(){this.nodes={},this.keywords={}}add(e){this.nodes[e.name]=e}addKeyword(e,t,i){i=i!==void 0?i:!0,this.keywords[e]={callback:t,cache:i}}remove(e){delete this.nodes[e.name]}removeKeyword(e){delete this.keywords[e]}get(e){return this.nodes[e]}getKeyword(e,t){return this.keywords[e].callback(t)}getKeywordData(e){return this.keywords[e]}contains(e){return this.nodes[e]!==void 0}containsKeyword(e){return this.keywords[e]!==void 0}},qr=new L7,Wt=class extends ji{constructor(e,t){super(e),this.scope="",t=t??{},this.shared=t.shared!==void 0?t.shared:!0,this.unique=t.unique!==void 0?t.unique:!1}build(e,t,i,r){if(t=t??this.getType(e),this.getShared(e,t)){let s=this.getUnique(e,t);s&&this.uuid===void 0&&(this.uuid=Te.generateUUID()),i=e.getUUID(i??this.getUUID(),!s);let a=e.getNodeData(i),n=a.output||this.getType(e);if(e.analyzing)return(a.deps||0)>0||this.getLabel()?(this.appendDepsNode(e,a,t),this.generate(e,t,i)):super.build(e,t,i);if(s)return a.name=a.name||super.build(e,t,i),a.name;if(!this.getLabel()&&(!this.getShared(e,n)||e.context.ignoreCache||a.deps===1))return super.build(e,t,i);i=this.getUUID(!1);let o=this.getTemp(e,i);if(o)return e.format(o,n,t);{o=super.generate(e,t,i,a.output,r);let l=this.generate(e,n,i);return e.addNodeCode(o+" = "+l+";"),e.format(o,n,t)}}return super.build(e,t,i)}getShared(e,t){return t!=="sampler2D"&&t!=="samplerCube"&&this.shared}getUnique(e,t){return this.unique}setLabel(e){return this.label=e,this}getLabel(){return this.label}getUUID(e){let t=this.uuid;return typeof this.scope=="string"&&(t=this.scope+"-"+t),t}getTemp(e,t){t=t||this.uuid;let i=e.getVars()[t];return i?i.name:void 0}generate(e,t,i,r,s){return this.getShared(e,t)||console.error("TempNode is not shared"),i=i??this.uuid,e.getTempVar(i,r??this.getType(e),s,this.getLabel()).name}},Zr=class extends Wt{constructor(e,t){t=t??{},t.shared=t.shared!==void 0?t.shared:!1,super(e,t),this.readonly=!1}setReadonly(e){return this.readonly=e,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}generate(e,t,i,r,s,a){i=e.getUUID(i??this.getUUID()),r=r??this.getType(e);let n=e.getNodeData(i);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(e,t,i,r,s,a):e.isShader("vertex")?(n.vertex||(n.vertex=e.createVertexUniform(r,this,s,a,this.getLabel())),e.format(n.vertex.name,r,t)):(n.fragment||(n.fragment=e.createFragmentUniform(r,this,s,a,this.getLabel())),e.format(n.fragment.name,r,t))}},dr=class extends Zr{constructor(e=0,t){super("v2"),this.nodeType="Vector2",this.value=e instanceof H?e:new H(e,t)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}generateReadonly(e,t,i,r,s,a){return e.format("vec2("+this.value.x+", "+this.value.y+")",r,t)}},ds=class extends Zr{constructor(e=0,t,i){super("v3"),this.nodeType="Vector3",this.value=e instanceof M?e:new M(e,t,i)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}get z(){return this.value.z}set z(e){this.value.z=e}generateReadonly(e,t,i,r,s,a){return e.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",r,t)}},Ya=class extends Zr{constructor(e){super("v4"),this.nodeType="Vector4",this.value=e instanceof Wi?e:new Wi(e.r,e.g,e.b,e.a)}generateReadonly(e,t,i,r,s,a){return e.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",r,t)}},z7=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,Y_=/[a-z_0-9]+/gi,Pe=class extends Wt{constructor(e,t,i,r,s){super(s),this.src="",this.nodeType="Function",this.useKeywords=!0,this.includes=[],this.extensions={},this.keywords={},this.isMethod=s===void 0,this.isInterface=!1,this.parse(e,t,i,r)}getShared(e,t){return!this.isMethod}getType(e){return e.getTypeByFormat(this.type)}getInputByName(e){if(this.inputs){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}}getIncludeByName(e){if(this.includes){let t=this.includes.length;for(;t--;)if(this.includes[t].name===e)return this.includes[t]}}generate(e,t,i,r,s){let a,n=0,o=this.src;if(this.includes)for(let h=0;h<this.includes.length;h++)e.include(this.includes[h],this);for(let h in this.extensions)e.extensions[h]=!0;let l=[];for(;a=Y_.exec(this.src);)l.push(a);for(let h=0;h<l.length;h++){let c=l[h],u=c[0],d=this.isMethod?!this.getInputByName(u):!0,p=u;if(this.keywords[u]||this.useKeywords&&d&&qr.containsKeyword(u)){let f=this.keywords[u];if(!f){let m=qr.getKeywordData(u);m.cache&&(f=e.keywords[u]),f=f||qr.getKeyword(u,e),m.cache&&(e.keywords[u]=f)}p=f.build(e)}u!==p&&o[c.index+n-1]!=="."&&(o=o.substring(0,c.index+n)+p+o.substring(c.index+u.length+n),n+=p.length-u.length),this.getIncludeByName(p)===void 0&&qr.contains(p)&&e.include(qr.get(p))}return t==="source"?o:this.isMethod?(this.isInterface||e.include(this,void 0,o),this.name):e.format("( "+o+" )",this.getType(e),t)}parse(e,t,i,r){if(this.src=e||"",this.includes=t??[],this.extensions=i??{},this.keywords=r??{},this.isMethod){let s=z7.exec(this.src);if(this.inputs=[],s&&s.length==4){this.type=s[1],this.name=s[2];let a=s[3].match(Y_);if(a){let n=0;for(;n<a.length;){let o=a[n++],l;o==="in"||o==="out"||o==="inout"?l=a[n++]:(l=o,o="");let h=a[n++];this.inputs.push({name:h,type:l,qualifier:o})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}},B7=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,vT=class extends Wt{constructor(e="",t){super(),this.src="",this.useDefine=!1,this.nodeType="Const",this.parse(e||vT.PI,void 0,void 0,void 0,t)}getType(e){return e.getTypeByFormat(this.type)}parse(e,t,i,r,s){this.src=e||"";let a,n,o="",l=B7.exec(e);this.useDefine=s??this.src.charAt(0)==="#",l&&l.length>1?(n=l[1],a=l[2],o=l[3]):(a=this.src,n="f"),this.name=a,this.type=n,this.value=o}build(e,t){if(t==="source"){if(this.value)return this.useDefine?"#define "+this.name+" "+this.value:"const "+this.type+" "+this.name+" = "+this.value+";";if(this.useDefine)return this.src}return e.include(this),e.format(this.name,this.getType(e),t)}generate(e,t,i,r,s){return e.format(this.name,this.getType(e),t)}},kt=vT;kt.PI="PI",kt.PI2="PI2",kt.RECIPROCAL_PI="RECIPROCAL_PI",kt.RECIPROCAL_PI2="RECIPROCAL_PI2",kt.LOG2="LOG2",kt.EPSILON="EPSILON";var F7=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.| 3157)*?)}`,"gim"),k7=new RegExp("s*(w*?)s*(w*?)(=|;)","gim"),yT=class extends Wt{constructor(e=""){super(),this.inputs=[],this.src="",this.nodeType="Struct",this.parse(e)}getType(e){return e.getTypeByFormat(this.name)}getInputByName(e){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}generate(e,t,i,r,s){return t==="source"?this.src+";":e.format("( "+this.src+" )",this.getType(e),t)}parse(e=""){this.src=e,this.inputs=[];let t=F7.exec(e);if(t){let i=t[2],r;for(;r=k7.exec(i);)this.inputs.push({type:r[1],name:r[2]});this.name=t[1]}else this.name="";this.type=this.name}},px=class extends Wt{constructor(e){super("v2",{shared:!1}),this.nodeType="UV",this.index=e??0}generate(e,t){e.requires.uv[this.index]=!0;let i=this.index>0?this.index+1:"",r=e.isShader("vertex")?"uv"+i:"vUv"+i;return e.format(r,this.getType(e),t)}};qr.addKeyword("uv",function(){return new px});qr.addKeyword("uv2",function(){return new px(1)});var Jl=class extends Wt{constructor(e,t){super("v4"),this.nodeType="ColorSpace",this.input=e,this.method=t??Jl.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(e){switch(e){case js:return["Linear"];case gt:return["sRGB"];default:return[]}}generate(e,t){let i=this.input.build(e,"v4"),r=this.getType(e),s=Jl.Nodes[this.method],a=e.include(s);if(a===Jl.LINEAR_TO_LINEAR)return e.format(i,r,t);if(s.inputs?.length===2){let n=this.factor.build(e,"f");return e.format(a+"( "+i+", "+n+" )",r,t)}else return e.format(a+"( "+i+" )",r,t)}fromEncoding(e){let t=Jl.getEncodingComponents(e);this.method="LinearTo"+t[0],this.factor=t[1]}fromDecoding(e){let t=Jl.getEncodingComponents(e);this.method=t[0]+"ToLinear",this.factor=t[1]}},va=Jl;va.Nodes={LinearToLinear:new Pe(["vec4 LinearToLinear( in vec4 value ) {"," return value;","}"].join(` 3158`)),sRGBToLinear:new Pe(["vec4 sRGBToLinear( in vec4 value ) {"," return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );","}"].join(` 3159`)),LinearTosRGB:new Pe(["vec4 LinearTosRGB( in vec4 value ) {"," return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );","}"].join(` 3160`))},va.LINEAR_TO_LINEAR="LinearToLinear",va.SRGB_TO_LINEAR="sRGBToLinear",va.LINEAR_TO_SRGB="LinearTosRGB";var ti=class extends Pe{constructor(e="",t,i,r,s){super(e,s,r,i,t),this.nodeType="Expression"}},tn=class extends Zr{constructor(e=new li,t,i,r){super("v4",{shared:!0}),this.nodeType="Texture",this.value=e,this.uv=t??new px,this.bias=i,this.project=r!==void 0?r:!1}getTexture(e,t){return super.generate(e,t,this.value.uuid,"t")}generate(e,t){if(t==="sampler2D")return this.getTexture(e,t);let i=this.getTexture(e,t),r=this.uv.build(e,this.project?"v4":"v2"),s=this.bias?this.bias.build(e,"f"):void 0;s===void 0&&e.context.bias&&(s=e.context.bias.setTexture(this).build(e,"f"));let a,n;this.project?a="texture2DProj":a=s?"tex2DBias":"tex2D",s?n=a+"( "+i+", "+r+", "+s+" )":n=a+"( "+i+", "+r+" )";let o={include:e.isShader("vertex"),ignoreCache:!0},l=this.getType(e);return e.addContext(o),this.colorSpace=this.colorSpace??new va(new ti("",l)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(n),n=this.colorSpace.build(e,l),e.removeContext(),e.format(n,l,t)}},Be=class extends Zr{constructor(e){super("f"),this.nodeType="Float",this.value=e??0}generateReadonly(e,t,i,r,s,a){return e.format(this.value+(this.value%1?"":".0"),r,t)}},Q_=class extends Wt{constructor(e,t){super(),this.inputs=[],this.nodeType="FunctionCall",this.value=e,this.inputs=t??[]}getFunction(){return this.value}getType(e){return this.value.getType(e)}generate(e,t,i,r,s){r=this.getType(e);let a=this.value,n=a.build(e,t)+"( ",o=[];if(a.inputs){for(let l=0;l<a.inputs.length;l++){let h=a.inputs[l],c=this.inputs[l]||this.inputs[h.name];o.push(c.build(e,e.getTypeByFormat(h.type)))}n+=o.join(", ")+" )"}return e.format(n,r,t)}},xT=class extends Wt{constructor(e,t,i=xT.ADD){super(),this.nodeType="Operator",this.type=e.type,this.a=e,this.b=t,this.op=i}getType(e){let t=this.a.getType(e),i=this.b.getType(e);return e.isTypeMatrix(t)?"v4":e.getTypeLength(i)>e.getTypeLength(t)?i:t}generate(e,t){let i=this.getType(e);this.type=i;let r=this.a.build(e,i),s=this.b.build(e,i);return e.format("( "+r+" "+this.op+" "+s+" )",i,t)}},jr=xT;jr.ADD="+",jr.SUB="-",jr.MUL="*",jr.DIV="/";var jt=class extends Wt{constructor(e,t=jt.ABS,i,r){super(),this.nodeType="Math",this.a=e,typeof t!="string"?this.b=t:r=t,typeof i!="string"?this.c=i:r=i,this.method=r,this.hashProperties=["method"]}getNumInputs(e){switch(this.method){case jt.MIX:case jt.CLAMP:case jt.REFRACT:case jt.SMOOTHSTEP:case jt.FACEFORWARD:return 3;case jt.MIN:case jt.MAX:case jt.MOD:case jt.STEP:case jt.REFLECT:case jt.DISTANCE:case jt.DOT:case jt.CROSS:case jt.POW:return 2;default:return 1}}getInputType(e){let t=e.getTypeLength(this.a.getType(e)),i=this.b?e.getTypeLength(this.b.getType(e)):0,r=this.c?e.getTypeLength(this.c.getType(e)):0;return t>i&&t>r?this.a.getType(e):i>r?this.b.getType(e):this.c.getType(e)}getType(e){switch(this.method){case jt.LENGTH:case jt.DISTANCE:case jt.DOT:return"f";case jt.CROSS:return"v3"}return this.getInputType(e)}generate(e,t){let i,r,s,a=this.a?e.getTypeLength(this.a.getType(e)):0,n=this.b?e.getTypeLength(this.b.getType(e)):0,o=this.c?e.getTypeLength(this.c.getType(e)):0,l=this.getInputType(e),h=this.getType(e);switch(this.type=h,this.method){case jt.NEGATE:return e.format("( -"+this.a.build(e,l)+" )",l,t);case jt.INVERT:return e.format("( 1.0 - "+this.a.build(e,l)+" )",l,t);case jt.CROSS:i=this.a.build(e,"v3"),r=this.b.build(e,"v3");break;case jt.STEP:i=this.a.build(e,a===1?"f":l),r=this.b.build(e,l);break;case jt.MIN:case jt.MAX:case jt.MOD:i=this.a.build(e,l),r=this.b.build(e,n===1?"f":l);break;case jt.REFRACT:i=this.a.build(e,l),r=this.b.build(e,l),s=this.c.build(e,"f");break;case jt.MIX:i=this.a.build(e,l),r=this.b.build(e,l),s=this.c.build(e,o===1?"f":l);break;default:i=this.a.build(e,l),this.b&&(r=this.b.build(e,l)),this.c&&(s=this.c.build(e,l));break}let c=[];c.push(i),r&&c.push(r),s&&c.push(s);let u=this.getNumInputs(e);if(c.length!==u)throw Error(`Arguments not match used in "${this.method}". Require ${u}, currently ${c.length}.`);return e.format(this.method+"( "+c.join(", ")+" )",h,t)}},ft=jt;ft.RAD="radians",ft.DEG="degrees",ft.EXP="exp",ft.EXP2="exp2",ft.LOG="log",ft.LOG2="log2",ft.SQRT="sqrt",ft.INV_SQRT="inversesqrt",ft.FLOOR="floor",ft.CEIL="ceil",ft.NORMALIZE="normalize",ft.FRACT="fract",ft.SATURATE="saturate",ft.SIN="sin",ft.COS="cos",ft.TAN="tan",ft.ASIN="asin",ft.ACOS="acos",ft.ARCTAN="atan",ft.ABS="abs",ft.SIGN="sign",ft.LENGTH="length",ft.NEGATE="negate",ft.INVERT="invert",ft.MIN="min",ft.MAX="max",ft.MOD="mod",ft.STEP="step",ft.REFLECT="reflect",ft.DISTANCE="distance",ft.DOT="dot",ft.CROSS="cross",ft.POW="pow",ft.MIX="mix",ft.CLAMP="clamp",ft.REFRACT="refract",ft.SMOOTHSTEP="smoothstep",ft.FACEFORWARD="faceforward";var Hc=class extends Wt{constructor(e,t,i){super("v4"),this.nodeType="TextureCubeUV",this.value=e,this.uv=t,this.bias=i}bilinearCubeUV(e,t,i,r){let s=new Q_(Hc.Nodes.bilinearCubeUV,[t,i,r]);this.colorSpaceTL=this.colorSpaceTL??new va(new ti("","v4")),this.colorSpaceTL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTL.input.parse(s.build(e)+".tl"),this.colorSpaceTR=this.colorSpaceTR??new va(new ti("","v4")),this.colorSpaceTR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTR.input.parse(s.build(e)+".tr"),this.colorSpaceBL=this.colorSpaceBL??new va(new ti("","v4")),this.colorSpaceBL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBL.input.parse(s.build(e)+".bl"),this.colorSpaceBR=this.colorSpaceBR??new va(new ti("","v4")),this.colorSpaceBR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBR.input.parse(s.build(e)+".br");let a={include:e.isShader("vertex"),ignoreCache:!0};e.addContext(a),this.colorSpaceTLExp=new ti(this.colorSpaceTL.build(e,"v4"),"v4"),this.colorSpaceTRExp=new ti(this.colorSpaceTR.build(e,"v4"),"v4"),this.colorSpaceBLExp=new ti(this.colorSpaceBL.build(e,"v4"),"v4"),this.colorSpaceBRExp=new ti(this.colorSpaceBR.build(e,"v4"),"v4"),e.removeContext();let n=new ti("mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )","v4");return n.keywords.cubeUV_TL=this.colorSpaceTLExp,n.keywords.cubeUV_TR=this.colorSpaceTRExp,n.keywords.cubeUV_BL=this.colorSpaceBLExp,n.keywords.cubeUV_BR=this.colorSpaceBRExp,n.keywords.cubeUV=s,n}generate(e,t){if(e.isShader("fragment")){let i=this.uv,r=this.bias||e.context.roughness,s=new Q_(Hc.Nodes.roughnessToMip,[r]),a=new ft(s,Hc.Nodes.m0,Hc.Nodes.cubeUV_maxMipLevel,ft.CLAMP),n=new ft(a,ft.FLOOR),o=new ft(a,ft.FRACT),l=this.bilinearCubeUV(e,this.value,i,n),h=this.bilinearCubeUV(e,this.value,i,new jr(n,new Be(1).setReadonly(!0),jr.ADD)),c=new ft(l,h,o,ft.MIX);return e.format(c.build(e),"v4",t)}else return console.warn("TextureCubeUVNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t)}},vy=Hc;vy.Nodes=(function(){let e=new yT(`struct TextureCubeUVData { 3161 vec4 tl; 3162 vec4 tr; 3163 vec4 br; 3164 vec4 bl; 3165 vec2 f; 3166 }`),t=new kt("float cubeUV_maxMipLevel 8.0",!0),i=new kt("float cubeUV_minMipLevel 4.0",!0),r=new kt("float cubeUV_maxTileSize 256.0",!0),s=new kt("float cubeUV_minTileSize 16.0",!0),a=new Pe(`float getFace(vec3 direction) { 3167 vec3 absDirection = abs(direction); 3168 float face = -1.0; 3169 if (absDirection.x > absDirection.z) { 3170 if (absDirection.x > absDirection.y) 3171 face = direction.x > 0.0 ? 0.0 : 3.0; 3172 else 3173 face = direction.y > 0.0 ? 1.0 : 4.0; 3174 } else { 3175 if (absDirection.z > absDirection.y) 3176 face = direction.z > 0.0 ? 2.0 : 5.0; 3177 else 3178 face = direction.y > 0.0 ? 1.0 : 4.0; 3179 } 3180 return face; 3181 }`);a.useKeywords=!1;let n=new Pe(`vec2 getUV(vec3 direction, float face) { 3182 vec2 uv; 3183 if (face == 0.0) { 3184 uv = vec2(direction.z, direction.y) / abs(direction.x); // pos x 3185 } else if (face == 1.0) { 3186 uv = vec2(-direction.x, -direction.z) / abs(direction.y); // pos y 3187 } else if (face == 2.0) { 3188 uv = vec2(-direction.x, direction.y) / abs(direction.z); // pos z 3189 } else if (face == 3.0) { 3190 uv = vec2(-direction.z, direction.y) / abs(direction.x); // neg x 3191 } else if (face == 4.0) { 3192 uv = vec2(-direction.x, direction.z) / abs(direction.y); // neg y 3193 } else { 3194 uv = vec2(direction.x, direction.y) / abs(direction.z); // neg z 3195 } 3196 return 0.5 * (uv + 1.0); 3197 }`);n.useKeywords=!1;let o=new Pe(`TextureCubeUVData bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) { 3198 float face = getFace(direction); 3199 float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0); 3200 mipInt = max(mipInt, cubeUV_minMipLevel); 3201 float faceSize = exp2(mipInt); 3202 float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize); 3203 vec2 uv = getUV(direction, face) * (faceSize - 1.0); 3204 vec2 f = fract(uv); 3205 uv += 0.5 - f; 3206 if (face > 2.0) { 3207 uv.y += faceSize; 3208 face -= 3.0; 3209 } 3210 uv.x += face * faceSize; 3211 if(mipInt < cubeUV_maxMipLevel){ 3212 uv.y += 2.0 * cubeUV_maxTileSize; 3213 } 3214 uv.y += filterInt * 2.0 * cubeUV_minTileSize; 3215 uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize); 3216 uv *= texelSize; 3217 vec4 tl = texture2D(envMap, uv); 3218 uv.x += texelSize; 3219 vec4 tr = texture2D(envMap, uv); 3220 uv.y += texelSize; 3221 vec4 br = texture2D(envMap, uv); 3222 uv.x -= texelSize; 3223 vec4 bl = texture2D(envMap, uv); 3224 return TextureCubeUVData( tl, tr, br, bl, f ); 3225 }`,[e,a,n,t,i,r,s]);o.useKeywords=!1;let l=new kt("float r0 1.0",!0),h=new kt("float v0 0.339",!0),c=new kt("float m0 -2.0",!0),u=new kt("float r1 0.8",!0),d=new kt("float v1 0.276",!0),p=new kt("float m1 -1.0",!0),f=new kt("float r4 0.4",!0),m=new kt("float v4 0.046",!0),g=new kt("float m4 2.0",!0),v=new kt("float r5 0.305",!0),y=new kt("float v5 0.016",!0),x=new kt("float m5 3.0",!0),w=new kt("float r6 0.21",!0),S=new kt("float v6 0.0038",!0),b=new kt("float m6 4.0",!0),E=[l,h,c,u,d,p,f,m,g,v,y,x,w,S,b],_=new Pe(`float roughnessToMip(float roughness) { 3226 float mip = 0.0; 3227 if (roughness >= r1) { 3228 mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0; 3229 } else if (roughness >= r4) { 3230 mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1; 3231 } else if (roughness >= r5) { 3232 mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4; 3233 } else if (roughness >= r6) { 3234 mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5; 3235 } else { 3236 mip = -2.0 * log2(1.16 * roughness);// 1.16 = 1.79^0.25 3237 } 3238 return mip; 3239 }`,E);return{bilinearCubeUV:o,roughnessToMip:_,m0:c,cubeUV_maxMipLevel:t}})();var $l=class extends Wt{constructor(e){super("v3"),this.nodeType="Normal",this.scope=e??$l.VIEW}getShared(){return this.scope===$l.WORLD}build(e,t,i,r){let s=e.context[this.scope+"Normal"];return s?s.build(e,t,i,r):super.build(e,t,i)}generate(e,t,i,r,s){let a;switch(this.scope){case $l.VIEW:e.isShader("vertex")?a="transformedNormal":a="geometryNormal";break;case $l.LOCAL:e.isShader("vertex")?a="objectNormal":(e.requires.normal=!0,a="vObjectNormal");break;case $l.WORLD:e.isShader("vertex")?a="inverseTransformDirection( transformedNormal, viewMatrix ).xyz":(e.requires.worldNormal=!0,a="vWNormal");break}return e.format(a,this.getType(e),t)}},Xr=$l;Xr.LOCAL="local",Xr.WORLD="world",Xr.VIEW="view",Xr.NORMAL="normal";qr.addKeyword("viewNormal",function(){return new Xr(Xr.VIEW)});qr.addKeyword("localNormal",function(){return new Xr(Xr.NORMAL)});qr.addKeyword("worldNormal",function(){return new Xr(Xr.WORLD)});var Wa=class extends Wt{constructor(e){super("v3"),this.nodeType="Position",this.scope=e??Wa.LOCAL}getType(){return this.scope===Wa.PROJECTION?"v4":this.type}getShader(){switch(this.scope){case Wa.LOCAL:case Wa.WORLD:return!1}return!0}generate(e,t,i,r,s){let a;switch(this.scope){case Wa.LOCAL:e.isShader("vertex")?a="transformed":(e.requires.position=!0,a="vPosition");break;case Wa.WORLD:if(e.isShader("vertex"))return"( modelMatrix * vec4( transformed, 1.0 ) ).xyz";e.requires.worldPosition=!0,a="vWPosition";break;case Wa.VIEW:a=e.isShader("vertex")?"-mvPosition.xyz":"vViewPosition";break;case Wa.PROJECTION:a=e.isShader("vertex")?"( projectionMatrix * modelViewMatrix * vec4( position, 1.0 ) )":"vec4( 0.0 )";break}return e.format(a,this.getType(),t)}},Us=Wa;Us.LOCAL="local",Us.WORLD="world",Us.VIEW="view",Us.PROJECTION="projection";qr.addKeyword("position",function(){return new Us});qr.addKeyword("worldPosition",function(){return new Us(Us.WORLD)});qr.addKeyword("viewPosition",function(){return new Us(Us.VIEW)});var na=class extends Wt{constructor(e){super("v3"),this.nodeType="Reflect",this.scope=e??na.CUBE}getUnique(e){return!e.context.viewNormal}getType(){return this.scope===na.SPHERE?"v2":this.type}generate(e,t){let i=this.getUnique(e);if(e.isShader("fragment")){let r;switch(this.scope){case na.VECTOR:{let s=new Xr(Xr.VIEW),a=e.context.roughness,n=s.build(e,"v3"),o=new Us(Us.VIEW).build(e,"v3"),l=a?a.build(e,"f"):void 0,h=`reflect( -normalize( ${o} ), ${n} )`;l&&(h=`normalize( mix( ${h}, ${n}, ${l} * ${l} ) )`);let c=`inverseTransformDirection( ${h}, viewMatrix )`;i?(e.addNodeCode(`vec3 reflectVec = ${c};`),r="reflectVec"):r=c;break}case na.CUBE:{let s=new na(na.VECTOR).build(e,"v3"),a="vec3( -"+s+".x, "+s+".yz )";i?(e.addNodeCode(`vec3 reflectCubeVec = ${a};`),r="reflectCubeVec"):r=a;break}case na.SPHERE:{let s="normalize( ( viewMatrix * vec4( "+new na(na.VECTOR).build(e,"v3")+", 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) ).xy * 0.5 + 0.5";i?(e.addNodeCode(`vec2 reflectSphereVec = ${s};`),r="reflectSphereVec"):r=s;break}}return e.format(r,this.getType(),t)}else return console.warn("ReflectNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.type,t)}},vh=na;vh.CUBE="cube",vh.SPHERE="sphere",vh.VECTOR="vector";var U7=class extends Wt{constructor(e=new tn,t,i){super("v4"),this.nodeType="TextureCube",this.value=e,this.radianceNode=new vy(this.value,t??new vh(vh.VECTOR),i),this.irradianceNode=new vy(this.value,new Xr(Xr.WORLD),new Be(1).setReadonly(!0))}generate(e,t){return e.isShader("fragment")?(e.require("irradiance"),e.context.bias&&e.context.bias.setTexture(this.value),(e.slot==="irradiance"?this.irradianceNode:this.radianceNode).build(e,t)):(console.warn("TextureCubeNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t))}},N7=class extends Zr{constructor(e=new $y,t,i){super("v4",{shared:!0}),this.nodeType="CubeTexture",this.value=e,this.uv=t??new vh,this.bias=i}getTexture(e,t){return super.generate(e,t,this.value.uuid,"tc")}generate(e,t){if(t==="samplerCube")return this.getTexture(e,t);let i=this.getTexture(e,t),r=this.uv?.build(e,"v3"),s=this.bias?this.bias.build(e,"f"):void 0;s===void 0&&e.context.bias&&(s=e.context.bias.setTexture(this).build(e,"f"));let a;s?a="texCubeBias( "+i+", "+r+", "+s+" )":a="texCube( "+i+", "+r+" )";let n={include:e.isShader("vertex"),ignoreCache:!0},o=this.getType(e);return e.addContext(n),this.colorSpace=this.colorSpace??new va(new ti("",o)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(a),a=this.colorSpace.build(e,o),e.removeContext(),e.format(a,o,t)}},V7=` 3240uniform int frameIndex; 3241uniform vec2 resolution; 3242uniform mat4 previousModelViewMatrix; 3243uniform mat4 previousProjectionMatrix; 3244 3245varying vec4 vCurrentPosition; 3246varying vec4 vPreviousPosition; 3247`,j7=` 3248layout(location = 1) out vec4 gVelocity; 3249 3250uniform int frameIndex; 3251uniform vec2 resolution; 3252 3253varying vec4 vCurrentPosition; 3254varying vec4 vPreviousPosition; 3255 3256const vec2 haltonSequence[16] = vec2[16]( 3257vec2( 0.000000,-0.333334), 3258vec2(-0.500000, 0.333334), 3259vec2( 0.500000,-0.777778), 3260vec2(-0.750000,-0.111112), 3261vec2( 0.250000, 0.555556), 3262vec2(-0.250000,-0.555556), 3263vec2( 0.750000, 0.111112), 3264vec2(-0.875000, 0.777778), 3265vec2(0.125000, -0.925926), 3266vec2(-0.375000, -0.259260), 3267vec2(0.625000, 0.407408), 3268vec2(-0.625000, -0.703704), 3269vec2(0.375000, -0.037038), 3270vec2(-0.125000, 0.629630), 3271vec2(0.875000, -0.481482), 3272vec2(-0.937500, 0.185186)); 3273 3274vec2 vogelDiskSample(int sampleIndex, int sampleCount, float angle) { 3275 const float goldenAngle = 2.399963f; // radians 3276 float r = sqrt(float(sampleIndex) + 0.5f) / sqrt(float(sampleCount)); 3277 float theta = float(sampleIndex) * goldenAngle + angle; 3278 float sine = sin(theta); 3279 float cosine = cos(theta); 3280 return vec2(cosine, sine) * r; 3281} 3282 3283// Derived from the interleaved gradient function from Jimenez 2014 http:goo.gl/eomGso 3284float getNoiseInterleavedGradient(vec2 screenPos) { 3285 vec3 magic = vec3(0.06711056f, 0.00583715f, 52.9829189f); 3286 return fract(magic.z * fract(dot(screenPos, magic.xy))); 3287} 3288 3289`,H7=` 3290// TODO: This could be generated CPU side and passed to the shader every frame 3291const vec2 haltonSequence[16] = vec2[16]( 3292vec2( 0.000000,-0.333334), 3293vec2(-0.500000, 0.333334), 3294vec2( 0.500000,-0.777778), 3295vec2(-0.750000,-0.111112), 3296vec2( 0.250000, 0.555556), 3297vec2(-0.250000,-0.555556), 3298vec2( 0.750000, 0.111112), 3299vec2(-0.875000, 0.777778), 3300vec2(0.125000, -0.925926), 3301vec2(-0.375000, -0.259260), 3302vec2(0.625000, 0.407408), 3303vec2(-0.625000, -0.703704), 3304vec2(0.375000, -0.037038), 3305vec2(-0.125000, 0.629630), 3306vec2(0.875000, -0.481482), 3307vec2(-0.937500, 0.185186)); 3308 3309// TODO: Pass correct view size 3310vec2 offset = haltonSequence[frameIndex]; 3311offset.x /= resolution.x; 3312offset.y /= resolution.y; 3313 3314vec4 currentPosition = gl_Position; 3315vec4 currentPositionJittered = currentPosition + (vec4(offset.x, offset.y, 0.0, 0.0) * currentPosition.w); 3316 3317// We want to calculate the velocity with unjittered positions 3318// so that things that are not moving get a velocity = 0 3319vCurrentPosition = currentPosition; 3320vPreviousPosition = previousProjectionMatrix * previousModelViewMatrix * vec4(transformed, 1.0); 3321#ifdef OUTLINE_COMPENSATION 3322vPreviousPosition.xy += OUTLINE_COMPENSATION; 3323#endif 3324gl_Position = currentPositionJittered; 3325 3326`,G7=` 3327vec2 oldPos = vPreviousPosition.xy; 3328 oldPos /= vPreviousPosition.w; 3329 oldPos.xy = (oldPos.xy+1.)/2.0; 3330 3331vec2 newPos = vCurrentPosition.xy; 3332 newPos /= vCurrentPosition.w; 3333 newPos.xy = (newPos.xy+1.)/2.0; 3334 3335vec2 velocity = (newPos - oldPos); 3336 3337// Discard fully transparent pixels 3338if (gl_FragColor.a <= 0.0) discard; 3339 3340gVelocity = vec4(velocity, 0.0, 1.0); 3341`,W7=` 3342layout(location = 1) out vec4 gVelocity; 3343`,q7=` 3344 // Discard fully transparent pixels 3345 if (gl_FragColor.a <= 0.0) discard; 3346 3347 gVelocity = vec4(0.0, 0.0, 0.0, 1.0); 3348`,K_=["x","y","z","w"],X7=["float","vec2","vec3","vec4"],Y7={float:"f",vec2:"v2",vec3:"v3",vec4:"v4",mat4:"v4",int:"i",bool:"b","float[]":"f[]","vec4[]":"v4[]"},Q7={t:"sampler2D",tc:"samplerCube",b:"bool",i:"int",f:"float",c:"vec3",v2:"vec2",v3:"vec3",v4:"vec4",m3:"mat3",m4:"mat4","f[]":"float[]","v4[]":"vec4[]"},bT=class{constructor(){this.includes={consts:{},functions:{},structs:{}},this.cache="",this.slot="",this.shader="",this.context={},this.needsJitter=!0,this.getIncludesCode=(function(){function e(t,i){return t.deps.length-i.deps.length}return function(t,i){let r=this.getIncludes(t,i);if(!r)return"";let s="";r=r.sort(e);for(let a=0;a<r.length;a++)r[a].src&&(s+=r[a].src+` 3349`);return s}})(),this.slots=[],this.caches=[],this.contexts=[],this.keywords={},this.nodeData={},this.fragmentVariables={},this.fragmentParsVariables={},this.vertexParsVariables={},this.requires={uv:[],color:[],transparent:!1,irradiance:!1,position:!1,worldPosition:!1,normal:!1,worldNormal:!1,vWorldViewDir:!1,modelMatrix:!1,viewMatrix:!1,projectionMatrix:!1},this.includes={consts:[],functions:[],structs:[]},this.attributes={},this.prefixCode=["#ifdef TEXTURE_LOD_EXT"," #define texCube(a, b) textureCube(a, b)"," #define texCubeBias(a, b, c) textureCubeLodEXT(a, b, c)"," #define tex2D(a, b) texture2D(a, b)"," #define tex2DBias(a, b, c) texture2DLodEXT(a, b, c)","#else"," #define texCube(a, b) textureCube(a, b)"," #define texCubeBias(a, b, c) textureCube(a, b, c)"," #define tex2D(a, b) texture2D(a, b)"," #define tex2DBias(a, b, c) texture2D(a, b, c)","#endif",` 3350 // NOTE: Include Spline's blending modes. This could be part of BlendNode 3351 #define SPE_BLENDING_NORMAL 0 3352 #define SPE_BLENDING_MULTIPLY 1 3353 #define SPE_BLENDING_SCREEN 2 3354 #define SPE_BLENDING_OVERLAY 3 3355 3356 vec3 spe_normalBlend( vec3 a, vec3 b, float alpha ) { 3357 return mix( a, b, alpha ); 3358 } 3359 3360 vec3 spe_multiplyBlend( vec3 a, vec3 b, float alpha ) { 3361 return mix( a, a * b, alpha ); 3362 } 3363 3364 vec3 spe_screenBlend( vec3 a, vec3 b, float alpha ) { 3365 vec3 tmp = 1.0 - ( 1.0 - a ) * ( 1.0 - b ); 3366 return mix( a, tmp, alpha ); 3367 } 3368 3369 vec3 spe_overlayBlend( vec3 a, vec3 b, float alpha ) { 3370 vec3 tmp = mix( 1. - 2. * (1. - a) * (1. - b), 2. * a * b, step( a, vec3(.5) ) ); 3371 return clamp( mix( a, tmp, alpha ), 0.0, 1.0 ); 3372 } 3373 3374 vec3 spe_blend( vec3 a, vec3 b, float alpha, int mode ) { 3375 if ( mode == SPE_BLENDING_NORMAL ) return spe_normalBlend( a, b, alpha ); 3376 else if ( mode == SPE_BLENDING_MULTIPLY ) return spe_multiplyBlend( a, b, alpha ); 3377 else if ( mode == SPE_BLENDING_SCREEN ) return spe_screenBlend( a, b, alpha ); 3378 else if ( mode == SPE_BLENDING_OVERLAY ) return spe_overlayBlend( a, b, alpha ); 3379 return vec3( 1.0 ); 3380 } 3381 `,"#include <packing>","#include <common>"].join(` 3382`),this.parsCode={vertex:["float neighbor_offset = 0.0001;",""].join(` 3383`),fragment:["float accumAlpha = 0.0;",`void accumulateAlpha(float alpha) { 3384 accumAlpha += (1.0 - accumAlpha) * alpha; 3385 }`,""].join(` 3386`)},this.code={vertex:"",fragment:""},this.nodeCode={vertex:"",fragment:""},this.resultCode={vertex:"",fragment:""},this.finalCode={vertex:"",fragment:""},this.inputs={uniforms:{list:[],vertex:[],fragment:[]},arrayUniforms:{list:[],vertex:[],fragment:[]},vars:{varying:[],vertex:[],fragment:[]}},this.defines={},this.uniforms={},this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.updaters=[],this.nodes=[],this.analyzing=!1}build(e,t){this.addVertexParsCode(V7),this.addFragmentParsCode(j7),this.buildShader("vertex",e),this.buildShader("fragment",t);for(let i=0;i<this.requires.uv.length;i++)if(this.requires.uv[i]){let r=i>0?i+1:"";this.addVaryCode("varying vec2 vUv"+r+";"),i>0&&this.addVertexParsCode("attribute vec2 uv"+r+";"),this.addVertexFinalCode("vUv"+r+" = uv"+r+";")}return this.requires.color[0]&&(this.addVaryCode("varying vec4 vColor;"),this.addVertexParsCode("attribute vec4 color;"),this.addVertexFinalCode("vColor = color;")),this.requires.color[1]&&(this.addVaryCode("varying vec4 vColor2;"),this.addVertexParsCode("attribute vec4 color2;"),this.addVertexFinalCode("vColor2 = color2;")),this.requires.position&&(this.addVaryCode("varying vec3 vPosition;"),this.addVertexFinalCode("vPosition = transformed;")),this.requires.worldPosition,this.requires.normal&&(this.addVaryCode("varying vec3 vObjectNormal;"),this.addVertexFinalCode(` 3387 #ifndef SHAPEBLEND 3388 vObjectNormal = normal; 3389 #else 3390 vObjectNormal = objectNormal; 3391 #endif 3392 `)),this.requires.modelMatrix&&this.addFragmentParsCode("uniform mat4 modelMatrix;"),this.requires.viewMatrix&&this.addFragmentParsCode("uniform mat4 viewMatrix;"),this.requires.projectionMatrix&&this.addFragmentParsCode("uniform mat4 projectionMatrix;"),this.requires.worldNormal&&(this.addVaryCode("varying vec3 vWNormal;"),this.addVertexFinalCode("vWNormal = inverseTransformDirection( transformedNormal, viewMatrix ).xyz;")),this.requires.vWorldViewDir&&(this.addVaryCode("varying vec3 vWorldViewDir;"),this.addVertexFinalCode("vWorldViewDir = isPerspectiveMatrix( projectionMatrix ) ? ( (modelMatrix * vec4(position, 1.0)).xyz - cameraPosition ) : vec3( -viewMatrix[0][2], -viewMatrix[1][2], -viewMatrix[2][2] );")),this.needsJitter&&(this.addVertexFinalCode(H7),this.addFragmentFinalCode(G7)),this}buildShader(e,t){this.resultCode[e]=t.build(this.setShader(e),"v4")}setMaterial(e,t){return this.defines={},this}addFlow(e,t,i){return this.addSlot(e).addCache(t).addContext(i)}removeFlow(){return this.removeSlot().removeCache().removeContext()}addCache(e){return this.cache=e??"",this.caches.push(this.cache),this}removeCache(){return this.caches.pop(),this.cache=this.caches[this.caches.length-1]||"",this}addContext(e){return this.context=Object.assign({},this.context,e),this.context.extra=this.context.extra||{},this.contexts.push(this.context),this}removeContext(){return this.contexts.pop(),this.context=this.contexts[this.contexts.length-1]||{},this}addSlot(e){return this.slot=e||"",this.slots.push(this.slot),this}removeSlot(){return this.slots.pop(),this.slot=this.slots[this.slots.length-1]||"",this}addFragmentVariable(e,t){this.fragmentVariables[e]===void 0&&(this.addFragmentCode(`${t} ${e};`),this.fragmentVariables[e]="")}addFragmentParsVariable(e,t){this.fragmentParsVariables[e]===void 0&&(this.addFragmentParsCode(`${t} ${e};`),this.fragmentParsVariables[e]="")}addVertexParsVariable(e,t){this.vertexParsVariables[e]===void 0&&(this.addVertexParsCode(`${t} ${e};`),this.vertexParsVariables[e]="")}addVertexCode(e){this.addCode(e,"vertex")}addFragmentCode(e){this.addCode(e,"fragment")}addCode(e,t){this.code[t??this.shader]+=e+` 3393`}addVertexNodeCode(e){this.addNodeCode(e,"vertex")}addFragmentNodeCode(e){this.addNodeCode(e,"fragment")}addNodeCode(e,t){this.nodeCode[t??this.shader]+=e+` 3394`}clearNodeCode(e){e=e??this.shader;let t=this.nodeCode[e];return this.nodeCode[e]="",t}clearVertexNodeCode(){return this.clearNodeCode("vertex")}clearFragmentNodeCode(){return this.clearNodeCode("fragment")}addVertexFinalCode(e){this.addFinalCode(e,"vertex")}addFragmentFinalCode(e){this.addFinalCode(e,"fragment")}addFinalCode(e,t){this.finalCode[t??this.shader]+=e+` 3395`}addVertexParsCode(e){this.addParsCode(e,"vertex")}addFragmentParsCode(e){this.addParsCode(e,"fragment")}addParsCode(e,t){this.parsCode[t??this.shader]+=e+` 3396`}addVaryCode(e){this.addVertexParsCode(e),this.addFragmentParsCode(e)}isCache(e){return this.caches.indexOf(e)!==-1}isSlot(e){return this.slots.indexOf(e)!==-1}define(e,t){this.defines[e]=t===void 0?1:t}require(e){this.requires[e]=!0}isDefined(e){return this.defines[e]!==void 0}getVar(e,t,i,r="varying",s="V",a=""){let n=this.getVars(r),o=n[e];if(!o){let l=n.length;o={name:i||"node"+s+l+(a?"_"+a:""),type:t},n.push(o),n[e]=o}return o}getTempVar(e,t,i,r){return this.getVar(e,t,i,this.shader,"T",r)}getAttribute(e,t){if(!this.attributes[e]){let i=this.getVar(e,t);this.addVertexParsCode("attribute "+t+" "+e+";"),this.addVertexFinalCode(i.name+" = "+e+";"),this.attributes[e]={varying:i,name:e,type:t}}return this.attributes[e]}getCode(e){return[this.prefixCode,this.parsCode[e],this.getVarListCode(this.getVars("varying"),"varying"),this.getVarListCode(this.inputs.uniforms[e],"uniform"),this.getVarListCode(this.inputs.arrayUniforms[e],"uniform"),this.getIncludesCode("consts",e),this.getIncludesCode("structs",e),this.getIncludesCode("functions",e),"void main() {",this.getVarListCode(this.getVars(e)),this.code[e],this.resultCode[e],this.finalCode[e],"}"].join(` 3397`)}getVarListCode(e,t){t=t??"";let i="";for(let r=0,s=e.length;r<s;++r){let a=e[r],n=a.type,o=a.name,l=a.size,h=this.getFormatByType(n);if(h===void 0)throw new Error("Node pars "+h+" not found.");h.includes("[]")?i+=t+" "+h.substring(0,h.length-2)+" "+o+`[${l}]; 3398`:i+=t+" "+h+" "+o+`; 3399`}return i}getVars(e){return this.inputs.vars[e??this.shader]}getNodeData(e){let t=e instanceof ji?e.uuid:e;return this.nodeData[t]=this.nodeData[t]||{}}createUniform(e,t,i,r,s,a){if(t.includes("[]")){let n=this.inputs.arrayUniforms,o=n.list.length,l=new X_({type:t,size:i.size,name:r||"nodeUA"+o+(a?"_"+a:""),node:i,needsUpdate:s});return n.list.push(l),n[e].push(l),n[e][l.name]=l,this.uniforms[l.name]=l,l}else{let n=this.inputs.uniforms,o=n.list.length,l=new X_({type:t,name:r||"nodeU"+o+(a?"_"+a:""),node:i,needsUpdate:s});return n.list.push(l),n[e].push(l),n[e][l.name]=l,this.uniforms[l.name]=l,l}}createVertexUniform(e,t,i,r,s){return this.createUniform("vertex",e,t,i,r,s)}createFragmentUniform(e,t,i,r,s){return this.createUniform("fragment",e,t,i,r,s)}include(e,t,i){let r;if(e=typeof e=="string"?qr.get(e):e,this.context.include===!1)return e.name;e instanceof Pe?r=this.includes.functions:e instanceof kt?r=this.includes.consts:e instanceof yT&&(r=this.includes.structs);let s=r[this.shader]=r[this.shader]||[];if(e){let a=s[e.name];if(a||(a=s[e.name]={node:e,deps:[]},s.push(a),a.src=e.build(this,"source")),e instanceof Pe&&t&&s[t.name]&&s[t.name].deps.indexOf(e)===-1&&(s[t.name].deps.push(e),e.includes?.length)){let n=0;do this.include(e.includes[n++],t);while(n<e.includes.length)}return i&&(a.src=i),e.name}else throw new Error("Include not found.")}colorToVectorProperties(e){return e.replace("r","x").replace("g","y").replace("b","z").replace("a","w")}colorToVector(e){return e.replace(/c/g,"v3")}getIncludes(e,t){return this.includes[e][t||this.shader]}getConstructorFromLength(e){return X7[e-1]}isTypeMatrix(e){return/^m/.test(e)}getTypeLength(e){return e==="f"?1:parseInt(this.colorToVector(e).substr(1))}getTypeFromLength(e){return e===1?"f":"v"+e}findNode(...e){for(let t=0;t<arguments.length;t++){let i=e[t];if(i?.isNode)return i}}resolve(...e){for(let t=0;t<arguments.length;t++){let i=e[t];if(i!==void 0){if(i.isNode)return i;if(i.isTexture)switch(i.mapping){case Jo:case $o:return new N7(i);case Lu:return new U7(new tn(i));default:return new tn(i)}else{if(i.isVector2)return new dr(i);if(i.isVector3)return new ds(i);if(i.isVector4)return new Ya(i)}}}}format(e,t,i){switch(this.colorToVector(i+" <- "+t)){case"f <- v2":return e+".x";case"f <- v3":return e+".x";case"f <- v4":return e+".x";case"f <- i":case"f <- b":return"float( "+e+" )";case"v2 <- f":return"vec2( "+e+" )";case"v2 <- v3":return e+".xy";case"v2 <- v4":return e+".xy";case"v2 <- i":case"v2 <- b":return"vec2( float( "+e+" ) )";case"v3 <- f":return"vec3( "+e+" )";case"v3 <- v2":return"vec3( "+e+", 0.0 )";case"v3 <- v4":return e+".xyz";case"v3 <- i":case"v3 <- b":return"vec2( float( "+e+" ) )";case"v4 <- f":return"vec4( "+e+" )";case"v4 <- v2":return"vec4( "+e+", 0.0, 1.0 )";case"v4 <- v3":return"vec4( "+e+", 1.0 )";case"v4 <- i":case"v4 <- b":return"vec4( float( "+e+" ) )";case"i <- f":case"i <- b":return"int( "+e+" )";case"i <- v2":return"int( "+e+".x )";case"i <- v3":return"int( "+e+".x )";case"i <- v4":return"int( "+e+".x )";case"b <- f":return"( "+e+" != 0.0 )";case"b <- v2":return"( "+e+" != vec2( 0.0 ) )";case"b <- v3":return"( "+e+" != vec3( 0.0 ) )";case"b <- v4":return"( "+e+" != vec4( 0.0 ) )";case"b <- i":return"( "+e+" != 0 )"}return e}getTypeByFormat(e){return Y7[e]||e}getFormatByType(e){return Q7[e]||e}getUUID(e,t){return t=t!==void 0?t:!0,t&&this.cache&&(e=this.cache+"-"+e),e}getElementByIndex(e){return K_[e]}getIndexByElement(e){return K_.indexOf(e)}isShader(e){return this.shader===e}setShader(e){return this.shader=e,this}mergeDefines(e){for(let t in e)this.defines[t]=e[t];return this.defines}mergeUniform(e){for(let t in e)this.uniforms[t]=e[t];return this.uniforms}getTextureEncodingFromMap(e){let t;return e?e.isTexture&&(t=e.encoding):t=js,t===js&&this.context.gamma&&(t=gt),t}},gi=class extends Zr{constructor(e=0,t,i,r){super("c"),this.nodeType="Color",this.value=e instanceof Wi?e:new Wi(e||0,t,i,r)}setRGBA(e){this.value.setRGBA(e.r,e.g,e.b,e.a)}generate(e,t,i,r,s,a){i=e.getUUID(i??this.getUUID()),r=r??this.getType(e);let n=e.getNodeData(i),o=this.getReadonly()&&this.generateReadonly!==void 0;if(this.alpha){let l=this.alpha.build(e,"f");e.addFragmentNodeCode(`accumAlpha += ( 1.0 - accumAlpha ) * ${l};`)}return o?this.generateReadonly(e,t,i,r,s,a):e.isShader("vertex")?(n.vertex||(n.vertex=e.createVertexUniform(r,this,s,a,this.getLabel())),e.format(n.vertex.name,r,t)):(n.fragment||(n.fragment=e.createFragmentUniform(r,this,s,a,this.getLabel())),e.format(n.fragment.name,r,t))}generateReadonly(e,t,i,r,s,a){return e.format("vec3("+this.value.r+", "+this.value.g+", "+this.value.b+")",r,t)}},Yt=class extends Zr{constructor(e){super("i"),this.nodeType="Int",this.value=Math.floor(e??0)}generateReadonly(e,t,i,r,s,a){return e.format(this.value.toString(),r,t)}},Sr=class extends Zr{constructor(e){super("b"),this.nodeType="Bool",this.value=e??!1}generateReadonly(e,t,i,r){return e.format(this.value?"true":"false",r,t)}},Do=class extends Zr{constructor(e=1,t){super("f[]"),this.nodeType="FloatArray",this.size=e,this.value=Array.isArray(t)?t:typeof t=="number"?new Array(e).fill(t):new Array(e).fill(0)}},fx=class extends Zr{},K7=class extends fx{constructor(e){super("v3"),this.image=e,this._value=new M}get value(){return this._value.x=this.image.isVideo?this.image.img.videoWidth??0:this.image.img.width,this._value.y=this.image.isVideo?this.image.img.videoHeight??0:this.image.img.height,this._value}},yy=class extends fx{constructor(e,t,i=1008,r=1006){super("t"),this.image=e,this.wrap=t,this.minFilter=i,this.magFilter=r}get value(){return this.image.getTexture(this.wrap,this.minFilter,this.magFilter)}},wT=class extends Zr{constructor(e){super("m3"),this.nodeType="Matrix3",this.value=e??new Ii}generateReadonly(e,t,i,r,s,a){return e.format("mat3("+this.value.elements.join(", ")+")",r,t)}get elements(){return this.value.elements}set elements(e){this.value.fromArray(e)}},Ma=class extends Zr{constructor(e){super("m4"),this.nodeType="Matrix4",this.value=e??new xe}generateReadonly(e,t,i,r,s,a){return e.format("mat4("+this.value.elements.join(", ")+")",r,t)}get elements(){return this.value.elements}set elements(e){this.value.fromArray(e)}};function Z_(e,t,i,r=0){e.setUvTransform(i[0],i[1],t[0],t[1],0,0,0).premultiply(new Ii().makeRotation(r*Te.DEG2RAD))}var Z7=class extends wT{constructor(e,t,i=0){super(new Ii),this.repeat=e,this.offset=t,this.rotation=i,Z_(this.value,e,t,i)}updateMatrix(){Z_(this.value,this.repeat,this.offset,this.rotation)}},Oo=class extends Zr{constructor(e=1,t){super("v4[]"),this.nodeType="Vector4Array",this.size=e,this.value=Array.isArray(t)?t:t instanceof ot?new Array(e).fill(t):new Array(e).fill(new ot(0))}},J_=class extends Wt{constructor(e,t,i,r){super("v3"),this.nodeType="Blend",this.a=e,this.b=t,this.alpha=i,this.mode=r}generate(e,t){if(e.isShader("fragment")){let i=[];return i.push(this.a.build(e,"c")),i.push(this.b.build(e,"c")),i.push(this.alpha.build(e,"f")),i.push(this.mode.build(e,"i")),e.format("spe_blend("
3399+i.join(",")+")",this.getType(e),t)}else return console.warn("BlendNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},ST=class extends Wt{constructor(e,t){super("v3"),this.nodeType="CustomColor",this.color=e,this.alpha=t,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.isShader("fragment")){let i=e.include(ST.Nodes.customColor);e.addFragmentVariable(this.calpha,"float");let r=[];return r.push(this.color.build(e,"v3")),r.push(this.mask?`luminance(${this.mask.build(e,"v3")})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}else return console.warn("CustomColorNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},xy=ST;xy.Nodes=(function(){return{customColor:new Pe(`vec3 customColor(vec3 color, float mask, float alpha, out float calpha) { 3400 float lalpha = alpha * mask; 3401 calpha = lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0); 3402 accumAlpha += (1.0 - accumAlpha) * lalpha; 3403 3404 return color; 3405 }`)}})();var _T=class extends Wt{constructor(e,t){super("v3"),this.nodeType="CustomNormal",this.cnormal=e,this.alpha=t,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.isShader("fragment")){let i=e.include(_T.Nodes.customNormal);e.addFragmentVariable(this.calpha,"float");let r=[];return r.push(this.cnormal.build(e,"v3")),r.push("normal"),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}else return console.warn("CustomNormalNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},AT=_T;AT.Nodes=(function(){return{customNormal:new Pe(`vec3 customNormal(vec3 cnormal, vec3 norm, float mask, float alpha, out float calpha) { 3406 vec3 normal = packNormalToRGB( norm ).rgb; 3407 normal *= step( vec3(0.5), cnormal ); 3408 3409 float lalpha = alpha * mask; 3410 calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 ); 3411 accumAlpha += ( 1.0 - accumAlpha ) * lalpha; 3412 3413 return normal; 3414 }`)}})();var Gc=class extends Wt{constructor(e,t,i,r,s,a,n,o,l,h,c,u){super("v3"),this.nodeType="CustomTexture",this.texture=e,this.textureSize=t,this.crop=i,this.projection=r,this.axis=s,this.side=a,this.size=n,this.blending=o,this.mat=l,this.isMask=u,this.alpha=h,this.mode=c,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){e.require("position"),e.require("normal"),e.require("uv"),e.requires.uv=[!0],e.extensions.shaderTextureLOD=!0,e.extensions.derivatives=!0;let i=`g${this.uuid.toString().replace(/-/g,"")}`,r;switch(this.projection.value){case 3:r=e.include(Gc.Nodes.cylindrical);break;case 2:r=e.include(Gc.Nodes.spherical);break;case 1:let a=["vec3(1.0, 0.0, 0.0)","vec3(0.0, 1.0, 0.0)","vec3(0.0, 0.0, 1.0)"][this.axis.value],n=["zy","xz","xy"][this.axis.value],o=new Pe(` 3415 vec3 ${i}_planarTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUv) { 3416 vec2 projected = (1. + (position.${n})) / 2.; 3417 vec2 uvs = ( mat * vec3( (projected * 2. - 1.) / (size * .5), 1. ) / 2. + 0.5 ).xy; 3418 writeUv = uvs; 3419 3420 vec4 tmp = texture2D( tex, uvs ); 3421 3422 vec3 col = tmp.rgb; 3423 float lalpha = alpha * tmp.a; 3424 ${this.side.value===2?"":`lalpha *= step(0.0, ${this.side.value===1?"-1.0 * ":""}dot(vObjectNormal, ${a}));`} 3425 3426 if ( crop > 0.5 ) { 3427 if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) { 3428 lalpha = 0.0; 3429 } 3430 } 3431 3432 lalpha *= mask; 3433 3434 calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 ); 3435 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3436 3437 return col; 3438 }`);r=e.include(o);break;case 4:r=e.include(Gc.Nodes.triplanar);break;default:r=e.include(Gc.Nodes.uv);break}e.addFragmentVariable(this.calpha,"float");let s=[];if(s.push("normal"),s.push(this.texture.generate(e,"t")),s.push(this.textureSize.build(e,"v2")),s.push(this.crop.build(e,"f")),s.push(this.mat.build(e,"mat3")),s.push(this.size.build(e,"v2")),s.push(this.blending.build(e,"f")),s.push(this.isMask.build(e,"b")),s.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),s.push(this.alpha.build(e,"f")),s.push(this.mode.build(e,"i")),s.push(this.calpha),this.projection.value===4){let a=`${i}_writeUvs`,n=a+"0",o=a+"1",l=a+"2",h=`${i}_triplanarWeights`;e.addFragmentVariable(n,"vec2"),e.addFragmentVariable(o,"vec2"),e.addFragmentVariable(l,"vec2"),e.addFragmentVariable(h,"vec3"),s.push(n),s.push(o),s.push(l),s.push(h)}else{let a=`${i}_writeUvs`;e.addFragmentVariable(a,"vec2"),s.push(a)}return e.format(r+"("+s.join(",")+")",this.getType(e),t)}},mx=Gc;mx.Nodes=(function(){let e=new Pe(` 3439vec3 cylindricalTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUv) { 3440 vec3 posN = normalize(position); 3441 float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415); 3442 float scaledHeight = position.y / (size.y * 0.5); 3443 float v = (scaledHeight / 2.) + .5; 3444 3445 vec2 calculatedUv = vec2(u,v); 3446 vec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy; 3447 writeUv = uvs; 3448 3449 vec2 df = fwidth(uvs); 3450 if(df.x > 0.5) df.x = 0.; 3451 3452 #ifdef GL_EXT_shader_texture_lod 3453 vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y))); 3454 #else 3455 vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y))); 3456 #endif 3457 3458 vec3 col = tmp.rgb;
3459 float lalpha = alpha * tmp.a; 3460 if ( crop > 0.5 ) { 3461 if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) { 3462 lalpha = 0.0; 3463 } 3464 } 3465 3466 lalpha *= mask; 3467 3468 calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 ); 3469 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3470 3471 return col; 3472 } 3473`),t=new Pe(` 3474vec3 sphericalTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUv) { 3475 vec3 posN = normalize(vPosition); 3476 float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415); 3477 float v = 0.5 + asin(posN.y) / 3.1415; 3478 3479 vec2 calculatedUv = vec2(u,v); 3480 vec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy; 3481 writeUv = uvs; 3482 3483 vec2 df = fwidth(uvs); 3484 if(df.x > 0.5) df.x = 0.; 3485 #ifdef GL_EXT_shader_texture_lod 3486 vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y))); 3487 #else 3488 vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y))); 3489 #endif 3490 3491 vec3 col = tmp.rgb; 3492 float lalpha = alpha * tmp.a; 3493 if ( crop > 0.5 ) { 3494 if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) { 3495 lalpha = 0.0; 3496 } 3497 } 3498 3499 lalpha *= mask; 3500 3501 calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 ); 3502 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3503 3504 return col; 3505 } 3506`),i=new Pe(`vec3 uvTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUv) { 3507 vec2 uvs = ( mat * vec3( vUv * 2. - 1., 1. ) / 2. + 0.5 ).xy; 3508 writeUv = uvs; 3509 3510 vec4 tmp = texture2D( tex, uvs ); 3511 3512 vec3 col = tmp.rgb; 3513 3514 float lalpha = alpha * tmp.a; 3515 if ( crop > 0.5 ) { 3516 if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) { 3517 lalpha = 0.0; 3518 } 3519 } 3520 3521 lalpha *= mask; 3522 3523 calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 ); 3524 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3525 3526 return col; 3527 }`),r=new Pe(`vec3 triplanarTexture(vec3 normal, sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float blending, bool isMask, float mask, float alpha, int mode, out float calpha, out vec2 writeUvs0, out vec2 writeUvs1, out vec2 writeUvs2, out vec3 writeWeights) { 3528 vec3 p = position; 3529 vec2 uv0 = (1.0 + p.xy) / 2.0; 3530 vec2 uv1 = (1.0 + p.zy) / 2.0; 3531 vec2 uv2 = (1.0 + p.xz) / 2.0; 3532 3533 uv0 = (mat * vec3((uv0 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy; 3534 uv1 = (mat * vec3((uv1 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy; 3535 uv2 = (mat * vec3((uv2 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy; 3536 3537 // Range from 3 to 128 seems to be good 3538 float exponent = (1.0 - blending) * 125.0 + 3.0; 3539 3540 vec3 n = vObjectNormal; 3541 vec3 weights = abs(normalize(n)); 3542 weights = pow(weights, vec3(exponent)); 3543 weights /= dot(weights, vec3(1.0)); 3544 3545 // Write out all sets of UVs that we generated 3546 writeUvs0 = uv0; 3547 writeUvs1 = uv1; 3548 writeUvs2 = uv2; 3549 writeWeights = weights; 3550 3551 // Derivatives for LOD 3552 vec2 df0 = fwidth(uv0); 3553 vec2 df1 = fwidth(uv1); 3554 vec2 df2 = fwidth(uv2); 3555 if (df0.x > 0.5) df0.x = 0.0; 3556 if (df1.x > 0.5) df1.x = 0.0; 3557 if (df2.x > 0.5) df2.x = 0.0; 3558 3559 #ifdef GL_EXT_shader_texture_lod 3560 vec4 tmp = 3561 texture2DLodEXT(tex, uv0, log2(max(df0.x, df0.y)*min(textureSize.x, textureSize.y))) * weights.z + 3562 texture2DLodEXT(tex, uv1, log2(max(df1.x, df1.y)*min(textureSize.x, textureSize.y))) * weights.x + 3563 texture2DLodEXT(tex, uv2, log2(max(df2.x, df2.y)*min(textureSize.x, textureSize.y))) * weights.y; 3564 #else 3565 vec4 tmp = 3566 textureLod(tex, uv0, log2(max(df0.x, df0.y)*min(textureSize.x, textureSize.y))) * weights.z + 3567 textureLod(tex, uv1, log2(max(df1.x, df1.y)*min(textureSize.x, textureSize.y))) * weights.x + 3568 textureLod(tex, uv2, log2(max(df2.x, df2.y)*min(textureSize.x, textureSize.y))) * weights.y; 3569 #endif 3570 3571 vec3 col = tmp.rgb;
3572 float lalpha = alpha * tmp.a; 3573 3574 // Apply cropping across all 3 planes 3575 if ( crop > 0.5 ) { 3576 if ( uv0.x < 0.0 || uv0.x > 1.0 || uv0.y < 0.0 || uv0.y > 1.0 ) { 3577 lalpha = 0.0; 3578 } 3579 if ( uv1.x < 0.0 || uv1.x > 1.0 || uv1.y < 0.0 || uv1.y > 1.0 ) { 3580 lalpha = 0.0; 3581 } 3582 if ( uv2.x < 0.0 || uv2.x > 1.0 || uv2.y < 0.0 || uv2.y > 1.0 ) { 3583 lalpha = 0.0; 3584 } 3585 } 3586 3587 lalpha *= mask; 3588 calpha = lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0); 3589 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3590 3591 return col;//n * 0.5 + 0.5; 3592 } 3593 `);return{cylindrical:e,spherical:t,uv:i,triplanar:r}})();var Wc=class extends Wt{constructor(e,t,i,r,s,a,n,o,l,h,c,u){super("v3"),this.nodeType="Depth",this.gradientType=e,this.smooth=t,this.near=i,this.far=r,this.isVector=s,this.isWorldSpace=a,this.origin=n,this.direction=o,this.colors=l,this.steps=h,this.isMask=u,this.alpha=c,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){let i=`g${this.uuid.toString().replace(/-/g,"")}`,r=new Pe(`vec3 ${i}_sdepth(float near, float far, vec3 origin, vec3 direction, vec4 colors[${i}_MAX_COLORS], float steps[${i}_MAX_COLORS], bool isMask, float mask, float alpha, out float calpha) { 3594 vec4 color = colors[0]; 3595 #ifdef ${i}_IS_VECTOR 3596 #ifdef ${i}_LINEAR 3597 #ifdef ${i}_WORLDSPACE 3598 float depth = vectorLinearWorldSpaceDepth(direction, origin, near, far); 3599 #else 3600 float depth = vectorLinearObjectSpaceDepth(direction, origin, near, far); 3601 #endif 3602 #else 3603 #ifdef ${i}_WORLDSPACE 3604 float depth = vectorSphericalWorldSpaceDepth(origin, near, far); 3605 #else 3606 float depth = vectorSphericalObjectSpaceDepth(origin, near, far); 3607 #endif 3608 #endif 3609 #else 3610 float dist = length(vWPosition - cameraPosition); 3611 float depth = ( dist - near ) / ( far - near ); 3612 #endif 3613 3614 3615 float p; 3616 #ifdef ${i}_SMOOTH 3617 for ( int i = 1; i < ${i}_MAX_COLORS; i++ ) { 3618 p = clamp( ( depth - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 ); 3619 color = mix(color, colors[i], smoothstep(0.0, 1.0, p)); 3620 } 3621 #else 3622 for ( int i = 1; i < ${i}_MAX_COLORS; i++ ) { 3623 p = clamp(( depth - steps[i - 1] ) / ( steps[i] - steps[i - 1] ), 0.0, 1.0); 3624 color = mix(color, colors[i], p); 3625 } 3626 #endif 3627 3628 float lalpha = alpha * color.a * mask; 3629 calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask)); 3630 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3631 3632 return color.rgb; 3633 }`,[Wc.Nodes.vectorLinearWorldSpaceDepth,Wc.Nodes.vectorLinearObjectSpaceDepth,Wc.Nodes.vectorSphericalObjectSpaceDepth,Wc.Nodes.vectorSphericalWorldSpaceDepth]);if(e.isShader("fragment")){e.define(`${i}_MAX_COLORS`,this.colors.value.length),this.smooth.value&&e.define(`${i}_SMOOTH`),this.isVector.value>.5&&e.define(`${i}_IS_VECTOR`),this.gradientType.value===0&&e.define(`${i}_LINEAR`),this.isWorldSpace.value>.5&&e.define(`${i}_WORLDSPACE`),e.require("worldPosition"),e.addFragmentVariable(this.calpha,"float");let s=e.include(r),a=[];return a.push(this.near.build(e,"f")),a.push(this.far.build(e,"f")),a.push(this.origin.build(e,"v3")),a.push(this.direction.build(e,"v3")),a.push(this.colors.build(e,"v4[]")),a.push(this.steps.build(e,"f[]")),a.push(this.isMask.build(e,"b")),a.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),a.push(this.alpha.build(e,"f")),a.push(this.calpha),e.format(s+"("+a.join(",")+")",this.getType(e),t)}else return console.warn("DepthNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},MT=Wc;MT.Nodes=(function(){let e=new Pe(`float vectorLinearWorldSpaceDepth(vec3 direction, vec3 origin, float near, float far) { 3634 vec3 n = normalize(direction); 3635 float dist = (n.x*(vWPosition.x - origin.x) + n.y*(vWPosition.y - origin.y) + n.z*(vWPosition.z - origin.z)); 3636 return ( dist - near ) / ( far - near ); 3637 }`),t=new Pe(`float vectorLinearObjectSpaceDepth(vec3 direction, vec3 origin, float near, float far) { 3638 vec3 n = normalize(direction); 3639 float dist = (n.x*(position.x - origin.x) + n.y*(position.y - origin.y) + n.z*(position.z - origin.z)); 3640 return ( dist - near ) / ( far - near ); 3641 }`),i=new Pe(`float vectorSphericalWorldSpaceDepth(vec3 origin, float near, float far) { 3642 float dist = length(vWPosition - origin); 3643 return ( dist - near ) / ( far - near ); 3644 }`),r=new Pe(`float vectorSphericalObjectSpaceDepth(vec3 origin, float near, float far) { 3645 float dist = length(position - origin); 3646 return ( dist - near ) / ( far - near ); 3647 }`);return{vectorLinearWorldSpaceDepth:e,vectorLinearObjectSpaceDepth:t,vectorSphericalWorldSpaceDepth:i,vectorSphericalObjectSpaceDepth:r}})();var J7=class extends Wt{constructor(e,t,i,r,s,a,n,o){super("v3"),this.nodeType="Fresnel",this.color=e,this.bias=t,this.scale=i,this.intensity=r,this.factor=s,this.isMask=o,this.alpha=a,this.mode=n,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("vWorldViewDir"),e.require("worldNormal"),e.isShader("fragment")){e.addFragmentVariable(this.calpha,"float");
vendor: 5,055 bytes, lines 3647-3703
3647let i=new Pe(`vec3 fresnel(vec3 color, float bias, float scale, float intensity, float factor, bool isMask, float mask, float alpha, int mode, out float calpha) { 3648 float fresnel = bias + scale * pow( abs( factor + dot( normalize( vWorldViewDir ), normalize( vWNormal ) ) ), intensity ); 3649 3650 float lalpha = clamp(fresnel, 0.0, 1.0) * alpha * mask; 3651 calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask)); 3652 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3653 3654 return color; 3655 }`),r=e.include(i),s=[];return s.push(this.color.build(e,"c")),s.push(this.bias.build(e,"f")),s.push(this.scale.build(e,"f")),s.push(this.intensity.build(e,"f")),s.push(this.factor.build(e,"f")),s.push(this.isMask.build(e,"b")),s.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),s.push(this.alpha.build(e,"f")),s.push(this.mode.build(e,"i")),s.push(this.calpha),e.format(r+"("+s.join(",")+")",this.getType(e),t)}else return console.warn("FresnelNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},ET=class extends Wt{constructor(e,t,i,r,s,a,n,o,l){super("v3"),this.nodeType="Gradient",this.gradientType=e,this.smooth=t,this.colors=i,this.steps=r,this.offset=s,this.morph=a,this.angle=n,this.isMask=l,this.alpha=o,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.isShader("fragment")){e.define("GRAD_MAX",10),e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let i=e.include(ET.Nodes.gradient),r=[];return r.push(this.gradientType.build(e,"i")),r.push(this.smooth.build(e,"b")),r.push(this.colors.build(e,"v4[]")),r.push(this.steps.build(e,"f[]")),r.push(this.offset.build(e,"v2")),r.push(this.morph.build(e,"v2")),r.push(this.angle.build(e,"f")),r.push(this.isMask.build(e,"b")),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}else return console.warn("GradientNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},CT=ET;CT.Nodes=(function(){return{gradient:new Pe(`vec3 gradient(int gradientType, bool smoothed, vec4 colors[GRAD_MAX], float steps[GRAD_MAX], vec2 offset, vec2 morph, float angle, bool isMask, float mask, float alpha, out float calpha) { 3656 vec4 color = colors[0]; 3657 vec2 m = morph / vUv.xy; 3658 vec2 rot = vec2( 0.5 + m.x, m.y ); 3659 vec2 dt = vec2( 3660 cos( angle ) * rot.x - sin( angle ) * rot.y, 3661 sin( angle ) * rot.x + cos( angle ) * rot.y 3662 ); 3663 vec2 pt = ( vUv - 0.5 + offset ) / 2.0 + dt / 2.0; 3664 float t = dot( pt, dt ) / dot( dt, dt ); 3665 if ( gradientType == 1 ) { 3666 t = distance ( 3667 ( vUv + morph ) * 3.0, 3668 ( vUv + offset ) + 1.0 3669 ) + angle; 3670 } else if ( gradientType == 2 ) { 3671 float polar = atan( 3672 vUv.x + morph.x - 0.5 + offset.x, 3673 vUv.y + morph.y - 0.5 + offset.y 3674 ) * -1.0; 3675 t = fract( ( angle / PI / -2.0 ) + 0.5 * ( polar / PI ) ); 3676 } 3677 3678 float p; 3679 if (smoothed) { 3680 for ( int i = 1; i < GRAD_MAX; i++ ) { 3681 p = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 ); 3682 color = mix(color, colors[i], smoothstep(0.0, 1.0, p)); 3683 } 3684 3685 } else { 3686 for ( int i = 1; i < GRAD_MAX; i++ ) { 3687 p = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 ); 3688 color = mix(color, colors[i], p); 3689 } 3690 } 3691 3692 float lalpha = alpha * color.a * mask; 3693 calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask)); 3694 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3695 3696 return color.xyz; 3697 }`)}})();var TT=class extends Wt{constructor(e,t,i,r,s){super("v3"),this.nodeType="Matcap",this.texture=e,this.isMask=r,this.alpha=t,this.mode=i,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`,this.rotation=s}generate(e,t){if(e.isShader("fragment")){e.addFragmentVariable(this.calpha,"float");let i=e.include(TT.Nodes.matcap);e.require("normal"),e.requires.normal=!0;let r=[];return r.push(this.texture.generate(e,"t")),r.push("normal"),r.push(this.isMask.build(e,"b")),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.mode.build(e,"i")),r.push(this.calpha),r.push(this.rotation.build(e,"f")),e.format(i+"("+r.join(",")+")",this.getType(e),t)}else return console.warn("MatcapNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},PT=TT;PT.Nodes=(function(){return{matcap:new Pe(`vec3 matcap(sampler2D matcapTex, vec3 normal, bool isMask, float mask, float alpha, int mode, out float calpha, float rotation) { 3698 vec3 viewDir = normalize( vViewPosition ); 3699 vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); 3700 vec3 y = cross( viewDir, x ); 3701 vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ); 3702 uv = mat2( cos(rotation), sin(rotation), -sin(rotation), cos(rotation) ) * uv; 3703 uv = uv * 0.495 + 0.5;
3704 vec4 matcapColor = texture2D( matcapTex, uv ); 3705 3706 float lalpha = alpha * mask; 3707 calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask)); 3708 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 3709 3710 return matcapColor.rgb; 3711 }`)}})();var Gr=(function(){let e=new Pe(`vec3 random3(vec3 c) { 3712 float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0))); 3713 vec3 r; 3714 r.z = fract(512.0*j); 3715 j *= .125; 3716 r.x = fract(512.0*j); 3717 j *= .125; 3718 r.y = fract(512.0*j); 3719 return r-0.5; 3720 }`),t=new Pe(`float simplexFast(vec3 p) { 3721 vec3 s = floor(p + dot(p, vec3(F3))); 3722 mediump vec3 x = p - s + dot(s, vec3(G3)); 3723 mediump vec3 hs = s; 3724 3725 mediump vec3 e = step(vec3(0.0), x - x.yzx); 3726 mediump vec3 i1 = e*(1.0 - e.zxy); 3727 mediump vec3 i2 = 1.0 - e.zxy*(1.0 - e); 3728 3729 mediump vec3 x1 = x - i1 + G3; 3730 mediump vec3 x2 = x - i2 + 2.0*G3; 3731 mediump vec3 x3 = x - 1.0 + 3.0*G3; 3732 3733 mediump vec4 w, d; 3734 3735 w.x = dot(x, x); 3736 w.y = dot(x1, x1); 3737 w.z = dot(x2, x2);
3738 w.w = dot(x3, x3); 3739 3740 w = max(0.6 - w, 0.0); 3741 3742 d.x = dot(random3(hs), x); 3743 d.y = dot(random3(hs + i1), x1); 3744 d.z = dot(random3(hs + i2), x2); 3745 d.w = dot(random3(hs + 1.0), x3); 3746 3747 w *= w; 3748 w *= w; 3749 d *= w; 3750 3751 return dot(d, vec4(52.0)); 3752 }`,[e]);t.keywords.F3=new kt("float F3 0.3333333"),t.keywords.G3=new kt("float G3 0.1666667");let i=new Pe(`float simplexPrecise(vec3 p) { 3753 vec3 s = floor(p + dot(p, vec3(F3))); 3754 vec3 x = p - s + dot(s, vec3(G3)); 3755 3756 vec3 e = step(vec3(0.0), x - x.yzx); 3757 vec3 i1 = e*(1.0 - e.zxy); 3758 vec3 i2 = 1.0 - e.zxy*(1.0 - e); 3759 3760 vec3 x1 = x - i1 + G3; 3761 vec3 x2 = x - i2 + 2.0*G3; 3762 vec3 x3 = x - 1.0 + 3.0*G3; 3763 3764 vec4 w, d; 3765 3766 w.x = dot(x, x); 3767 w.y = dot(x1, x1); 3768 w.z = dot(x2, x2); 3769 w.w = dot(x3, x3); 3770 3771 w = max(0.6 - w, 0.0); 3772 3773 d.x = dot(random3(s), x); 3774 d.y = dot(random3(s + i1), x1); 3775 d.z = dot(random3(s + i2), x2); 3776 d.w = dot(random3(s + 1.0), x3); 3777 3778 w *= w; 3779 w *= w; 3780 d *= w; 3781 3782 return dot(d, vec4(52.0)); 3783 }`,[e]);i.keywords.F3=new kt("float F3 0.3333333"),i.keywords.G3=new kt("float G3 0.1666667");let r=new Pe(`float simplexFractal(vec3 m) { 3784 mat3 rot1 = mat3(-0.37, 0.36, 0.85,-0.14,-0.93, 0.34,0.92, 0.01,0.4); 3785 mat3 rot2 = mat3(-0.55,-0.39, 0.74, 0.33,-0.91,-0.24,0.77, 0.12,0.63); 3786 mat3 rot3 = mat3(-0.71, 0.52,-0.47,-0.08,-0.72,-0.68,-0.7,-0.45,0.56); 3787 return 0.5333333 * simplexFast(m * rot1) 3788 + 0.2666667 * simplexFast(2.0 * m * rot2) 3789 + 0.1333333 * simplexFast(4.0 * m * rot3) 3790 + 0.0666667 * simplexFast(8.0 * m); 3791 }`,[t]),s=new Pe("vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}"),a=new Pe("vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}"),n=new Pe(`float simplexAshima(vec3 v) { 3792 const vec2 C = vec2(1.0/6.0, 1.0/3.0) ; 3793 const vec4 D = vec4(0.0, 0.5, 1.0, 2.0); 3794 vec3 i = floor(v + dot(v, C.yyy) ); 3795 vec3 x0 = v - i + dot(i, C.xxx) ; 3796 vec3 g = step(x0.yzx, x0.xyz); 3797 vec3 l = 1.0 - g; 3798 vec3 i1 = min( g.xyz, l.zxy ); 3799 vec3 i2 = max( g.xyz, l.zxy ); 3800 vec3 x1 = x0 - i1 + 1.0 * C.xxx; 3801 vec3 x2 = x0 - i2 + 2.0 * C.xxx; 3802 vec3 x3 = x0 - 1. + 3.0 * C.xxx; 3803 i = mod(i, 289.0 ); 3804 vec4 p = permute( permute( permute( 3805 i.z + vec4(0.0, i1.z, i2.z, 1.0 )) 3806 + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) 3807 + i.x + vec4(0.0, i1.x, i2.x, 1.0 )); 3808 float n_ = 1.0/7.0; // N=7 3809 vec3 ns = n_ * D.wyz - D.xzx; 3810 vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N) 3811 vec4 x_ = floor(j * ns.z); 3812 vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N) 3813 vec4 x = x_ *ns.x + ns.yyyy; 3814 vec4 y = y_ *ns.x + ns.yyyy; 3815 vec4 h = 1.0 - abs(x) - abs(y); 3816 vec4 b0 = vec4( x.xy, y.xy ); 3817 vec4 b1 = vec4( x.zw, y.zw ); 3818 vec4 s0 = floor(b0)*2.0 + 1.0; 3819 vec4 s1 = floor(b1)*2.0 + 1.0; 3820 vec4 sh = -step(h, vec4(0.0)); 3821 vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ; 3822 vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ; 3823 vec3 p0 = vec3(a0.xy,h.x); 3824 vec3 p1 = vec3(a0.zw,h.y); 3825 vec3 p2 = vec3(a1.xy,h.z); 3826 vec3 p3 = vec3(a1.zw,h.w); 3827 vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3))); 3828 p0 *= norm.x; 3829 p1 *= norm.y; 3830 p2 *= norm.z; 3831 p3 *= norm.w; 3832 vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0); 3833 m = m * m; 3834 return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), 3835 dot(p2,x2), dot(p3,x3) ) ); 3836 }`,[s,a]),o=new Pe("vec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;}"),l=new Pe("vec4 perm(vec4 x){return mod289(((x * 34.0) + 1.0) * x);}",[o]),h=new Pe(`float noise(vec3 p){ 3837 vec3 a = floor(p); 3838 vec3 d = p - a; 3839 d = d * d * (3.0 - 2.0 * d); 3840 vec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0); 3841 vec4 k1 = perm(b.xyxy); 3842 vec4 k2 = perm(k1.xyxy + b.zzww); 3843 vec4 c = k2 + a.zzzz; 3844 vec4 k3 = perm(c); 3845 vec4 k4 = perm(c + 1.0); 3846 vec4 o1 = fract(k3 * (1.0 / 41.0)); 3847 vec4 o2 = fract(k4 * (1.0 / 41.0)); 3848 vec4 o3 = o2 * d.z + o1 * (1.0 - d.z); 3849 vec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x); 3850 return o4.y * d.y + o4.x * (1.0 - d.y); 3851 }`,[l]),c=new Pe(`float fbm(vec3 x) { 3852 float v = 0.0; 3853 float a = 0.5; 3854 vec3 shift = vec3(100); 3855 for (int i = 0; i < NUM_OCTAVES; ++i) { 3856 v += a * noise(x); 3857 x = x * 2.0 + shift; 3858 a *= 0.5; 3859 } 3860 return v; 3861 }`,[h]);c.keywords.NUM_OCTAVES=new kt("int NUM_OCTAVES 5");let u=new Pe("vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}
3861"),d=new Pe(`float perlin(vec3 P){ 3862 vec3 Pi0 = floor(P); 3863 vec3 Pi1 = Pi0 + vec3(1.0); 3864 Pi0 = mod(Pi0, 289.0); 3865 Pi1 = mod(Pi1, 289.0); 3866 vec3 Pf0 = fract(P); 3867 vec3 Pf1 = Pf0 - vec3(1.0); 3868 vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x); 3869 vec4 iy = vec4(Pi0.yy, Pi1.yy); 3870 vec4 iz0 = Pi0.zzzz; 3871 vec4 iz1 = Pi1.zzzz; 3872 vec4 ixy = permute(permute(ix) + iy); 3873 vec4 ixy0 = permute(ixy + iz0); 3874 vec4 ixy1 = permute(ixy + iz1); 3875 vec4 gx0 = ixy0 / 7.0; 3876 vec4 gy0 = fract(floor(gx0) / 7.0) - 0.5; 3877 gx0 = fract(gx0); 3878 vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0); 3879 vec4 sz0 = step(gz0, vec4(0.0)); 3880 gx0 -= sz0 * (step(0.0, gx0) - 0.5); 3881 gy0 -= sz0 * (step(0.0, gy0) - 0.5); 3882 vec4 gx1 = ixy1 / 7.0; 3883 vec4 gy1 = fract(floor(gx1) / 7.0) - 0.5; 3884 gx1 = fract(gx1); 3885 vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1); 3886 vec4 sz1 = step(gz1, vec4(0.0)); 3887 gx1 -= sz1 * (step(0.0, gx1) - 0.5); 3888 gy1 -= sz1 * (step(0.0, gy1) - 0.5); 3889 vec3 g000 = vec3(gx0.x,gy0.x,gz0.x); 3890 vec3 g100 = vec3(gx0.y,gy0.y,gz0.y); 3891 vec3 g010 = vec3(gx0.z,gy0.z,gz0.z); 3892 vec3 g110 = vec3(gx0.w,gy0.w,gz0.w); 3893 vec3 g001 = vec3(gx1.x,gy1.x,gz1.x); 3894 vec3 g101 = vec3(gx1.y,gy1.y,gz1.y); 3895 vec3 g011 = vec3(gx1.z,gy1.z,gz1.z); 3896 vec3 g111 = vec3(gx1.w,gy1.w,gz1.w); 3897 vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); 3898 g000 *= norm0.x; 3899 g010 *= norm0.y; 3900 g100 *= norm0.z; 3901 g110 *= norm0.w; 3902 vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); 3903 g001 *= norm1.x; 3904 g011 *= norm1.y; 3905 g101 *= norm1.z; 3906 g111 *= norm1.w; 3907 float n000 = dot(g000, Pf0); 3908 float n100 = dot(g100, vec3(Pf1.x, Pf0.yz)); 3909 float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z)); 3910 float n110 = dot(g110, vec3(Pf1.xy, Pf0.z)); 3911 float n001 = dot(g001, vec3(Pf0.xy, Pf1.z)); 3912 float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z)); 3913 float n011 = dot(g011, vec3(Pf0.x, Pf1.yz)); 3914 float n111 = dot(g111, Pf1); 3915 vec3 fade_xyz = fade(Pf0); 3916 vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z); 3917 vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y); 3918 float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); 3919 return 2.2 * n_xyz; 3920 }`,[s,a,u]),p=new Pe(`float hashwithoutsine13(vec3 p3) 3921 { 3922 p3 = fract(p3 * .1031); 3923 p3 += dot(p3, p3.yzx + 33.33); 3924 return fract((p3.x + p3.y) * p3.z); 3925 }`),f=new Pe(`vec3 hashwithoutsine33(vec3 p3) 3926 { 3927 p3 = fract(p3 * vec3(.1031, .1030, .0973)); 3928 p3 += dot(p3, p3.yxz+33.33); 3929 return fract((p3.xxy + p3.yxx)*p3.zyx); 3930 }`),m=new Pe(`float metric(in vec3 p) 3931 { 3932 // L2 3933 return length(p); 3934 3935 // Chebyshev 3936 // vec3 a = abs(p); 3937 // return max(a.x, max(a.y, a.z)); 3938 }`),g=new Pe(`float smin( float a, float b, float k ) 3939 { 3940 float h = smoothstep(0.0, 1.0, 0.5 + 0.5 * (b - a) / k); 3941 float correction = k * h * (1.0 - h); 3942 return mix(b, a, h) - correction; 3943 }`),v=new Pe(`float smax( float a, float b, float k ) 3944 { 3945 float h = smoothstep(1.0, 0.0, 0.5 + 0.5 * (a - b) / k); 3946 float correction = k * h * (1.0 - h); 3947 return mix(a, b, h) + correction; 3948 }`),y=new Pe(`float remap(float value, float input_min, float input_max, float output_min, float output_max) { 3949 // Compute width of each interval 3950 float input_width = input_max - input_min; 3951 float output_width = output_max - output_min; 3952 3953 // Convert input range into a 0-1 range 3954 float scaled = (value - input_min) / input_width; 3955 3956 // Convert the 0-1 range into a value in output range 3957 return output_min + (scaled * output_width); 3958 }`),x=new Pe(`float voronoi(in vec3 x, in int style, in float smoothness, in float seed, in int quality) 3959 { 3960 // Integer and fractional parts of this point's coordinates 3961 ivec3 p = ivec3(floor(x)); 3962 vec3 f = fract(x); 3963 3964 // Different variables that we will use to construct noise: 3965 // 3966 // f1: distance to the closest feature point 3967 // f2: distance to the second closest feature point 3968 // e: distance to the closest edge (cell boundary) 3969 // 3970 // We also compute "smooth" versions of all of the above quantites, essentially 3971 // replacing "hard" minimums with "smooth" minimums (described by IQ) 3972 float f1_smooth = 8.0; 3973 float f1 = 8.0; 3974 float f2_smooth = 8.0; 3975 float f2 = 8.0; 3976 float e_smooth = 8.0; 3977 float e = 8.0; 3978 3979 // Variables stored from closest cell 3980 ivec3 mb; 3981 vec3 mr; 3982 3983 int steps = quality; 3984 3985 for (int x = -steps; x <= steps; x++) 3986 for (int y = -steps; y <= steps; y++) 3987 for (int z = -steps; z <= steps; z++) 3988 { 3989 ivec3 b = ivec3(x, y, z); 3990 vec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f; 3991 float d = length(r); 3992 3993 f1_smooth = smin(d, f1_smooth, smoothness); 3994 3995 // Store un-smoothed distances too 3996 if (d < f1) 3997 { 3998 f2 = f1; 3999 f1 = d; 4000 4001 mb = ivec3(x, y, z); 4002 mr = r; 4003 } 4004 else if (d < f2) 4005 { 4006 f2 = d; 4007 } 4008 } 4009 4010 // Second pass for edge distance 4011 // skip for styles don't need 4012 if (style != 0 && style != 5 && style != 7) 4013 for (int x = -steps; x <= steps; x++) 4014 for (int y = -steps; y <= steps; y++) 4015 for (int z = -steps; z <= steps; z++) 4016 { 4017 // Start search at the cell that contains the closest point to "x" (found in 1st pass) 4018 ivec3 b = mb + ivec3(x, y, z); 4019 vec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f; 4020 float d1 = dot(0.5 * (mr + r), (r - mr)); // IQ normalizes "r - mr" but that breaks things for the smooth version? 4021 float d2 = dot(0.5 * (mr + r), normalize(r - mr)); 4022 4023 e_smooth = smin(d1, e_smooth, smoothness); 4024 4025 e = min(e, d2); 4026 4027 // Also compute a smooth version of F2 in this pass 4028 { 4029 ivec3 b = ivec3(x, y, z); 4030 if (b != mb) 4031 { 4032 vec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f; 4033 float d = length(r); 4034 4035 f2_smooth = smin(d, f2_smooth, smoothness); 4036 } 4037 } 4038 } 4039 4040 // Different visualization modes 4041 if (style == 0) 4042 { 4043 return f1_smooth; 4044 } 4045 if (style == 1) 4046 { 4047 return f2_smooth; 4048 } 4049 if (style == 2) 4050 { 4051 return f2_smooth - f1_smooth; 4052 4053 // "Pebbles" also cool 4054 //return step(0.2, f2_smooth - f1_smooth); 4055 } 4056 if (style == 3) 4057 {
4058 // This one is really good for rock / stone effects 4059 float a = f1; 4060 float b = f2; 4061 float k = 3.0; 4062 float h = max(k - abs(a - b), 0.0) / k; 4063 float final = min(a, b) - h * h * k * (1.0 / 4.0); 4064 return final; 4065 } 4066 if (style == 4) 4067 { 4068 // Some random adjustments to make this style stand out more 4069 return exp(5.0 * e_smooth); 4070 } 4071 if (style == 5) 4072 { 4073 return pow(f1_smooth, 3.0); 4074 } 4075 if (style == 6) 4076 { 4077 const float eps = 0.0125; 4078 4079 // Thicker lines as the user increases the smoothness slider 4080 float thickness = smoothness * 0.25 + eps; 4081 4082 // Blurrier lines as the user increases the smoothness slider 4083 float blur = pow(smoothness, 3.0) * 0.25 + eps; 4084 4085 return smoothstep( 4086 thickness - thickness * blur, 4087 thickness + thickness * blur, 4088 e 4089 ); 4090 } 4091 if (style == 7) 4092 { 4093 return hashwithoutsine13(vec3(p + mb) + seed); 4094 } 4095 } 4096 `,[p,f,m,g,v,y]);return{simplexFast:t,simplexPrecise:i,simplexFractal:r,simplexAshima:n,fbm:c,perlin:d,voronoi:x}})(),DT=class extends Wt{constructor(e,t,i,r,s,a,n,o,l,h,c,u,d,p,f,m,g,v,y){super("v3"),this.nodeType="Noise",this.scale=e,this.size=t,this.move=i,this.fA=r,this.fB=s,this.distortion=a,this.colorA=n,this.colorB=o,this.colorC=l,this.colorD=h,this.noiseType=u,this.voronoiStyle=p,this.highCut=f,this.lowCut=m,this.smoothness=g,this.seed=v,this.quality=y,this.isMask=d,this.alpha=c,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t,i,r,s){e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let a=["simplexFast","simplexFractal","simplexAshima","fbm","perlin","voronoi"][this.noiseType.value],n=a=="voronoi"?` 4097 float v = ${a}(st + move, voronoiStyle, smoothness, seed, quality); 4098 4099 // Apply clipping to colors 4100 v = remap(v, lowCut, highCut, 0.0, 1.0); 4101 v = smax(v, 0.0, smoothness * 0.25); 4102 v = smin(v, 1.0, smoothness * 0.25); 4103 4104 // Note that the voronoi mode only uses colors "A" and "C" from the UI 4105 vec4 color = mix(colorA, colorC, v); 4106 `:` 4107 vec3 q = vec3(${a}(st), 4108 ${a}(st + vec3(1.0)), 4109 ${a}(st + vec3(1.0))); 4110 vec3 r = vec3(${a}(st + vec3(distortion, 1.0) * q + vec3(fA, 1.0) + move), 4111 ${a}(st + vec3(distortion, 1.0) * q + vec3(fB, 1.0) + move), 4112 ${a}(st * q)); 4113 float f = ${a}(st + r); 4114 vec4 color; 4115 color = mix(colorA, colorB, clamp((f * f) * 4.0, 0.0, 1.0)); 4116 color = mix(color, colorC, clamp(length(q), 0.0, 1.0)); 4117 color = mix(color, colorD, clamp(length(r.x), 0.0, 1.0));
4118 `,o=new Pe(`vec3 ${a}customNoise(float scale, vec3 size, float move, vec2 fA, vec2 fB, vec2 distortion, vec4 colorA, vec4 colorB, vec4 colorC, vec4 colorD, int voronoiStyle, float highCut, float lowCut, float smoothness, float seed, int quality, bool isMask, float mask, float alpha, out float calpha) 4119 { 4120 // Prevent scale of zero 4121 scale = max(abs(scale), 0.001); 4122 4123 vec3 st = position / size; 4124 st /= scale; 4125 4126 ${n} 4127 4128 float lalpha = alpha * color.a * mask; 4129 calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask)); 4130 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 4131 4132 return clamp(color, 0.0, 1.0).rgb; 4133 }`,[Gr.simplexFast,Gr.simplexFractal,Gr.simplexAshima,Gr.fbm,Gr.perlin,Gr.voronoi]),l=e.include(o),h=[];return h.push(this.scale.build(e,"f")),h.push(this.size.build(e,"v3")),h.push(this.move.build(e,"f")),h.push(this.fA.build(e,"v2")),h.push(this.fB.build(e,"v2")),h.push(this.distortion.build(e,"v2")),h.push(this.colorA.build(e,"v4")),h.push(this.colorB.build(e,"v4")),h.push(this.colorC.build(e,"v4")),h.push(this.colorD.build(e,"v4")),h.push(this.voronoiStyle.build(e,"i")),h.push(this.highCut.build(e,"f")),h.push(this.lowCut.build(e,"f")),h.push(this.smoothness.build(e,"f")),h.push(this.seed.build(e,"f")),h.push(this.quality.build(e,"i")),h.push(this.isMask.build(e,"b")),h.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),h.push(this.alpha.build(e,"f")),h.push(this.calpha),e.format(l+"("+h.join(",")+")",this.getType(e),t)}};DT.numOctaves=5;var OT=class extends Wt{constructor(e,t,i,r,s,a,n,o,l,h,c,u,d,p,f,m){super("v3"),this.nodeType="Outline",this.firstTime=!0,this.outlineColor=e,this.contourColor=t,this.outlineWidth=i,this.contourWidth=r,this.contourThreshold=s,this.outlineThreshold=a,this.contourFrequency=n,this.outlineSmoothing=o,this.contourDirection=l,this.positionalLines=h,this.compensation=c,this.resolution=u,this.normalMap=d,this.depthMap=p,this.pixelRatio=f,this.alpha=m,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){let i=`g${this.uuid.toString().replace(/-/g,"")}`;if(e.require("vWorldViewDir"),e.require("worldNormal"),e.extensions.derivatives=!0,this.compensation.value&&e.define("OUTLINE_COMPENSATION",`${i}_offset`),this.firstTime){let r=this.outlineWidth.build(e,"f"),s=this.resolution.build(e,"v2"),a=this.compensation.build(e,"b"),n=this.pixelRatio.build(e,"f");e.addVertexParsVariable("randomColor","attribute vec3"),e.addVertexParsVariable("extrudeNormal","attribute vec3"),e.addVertexParsVariable(r,"uniform float"),e.addVertexParsVariable(s,"uniform vec2"),e.addVertexParsVariable(a,"uniform bool"),e.addVertexParsVariable(n,"uniform float"),e.addVertexParsVariable("vID","flat out float"),e.addFragmentParsVariable("vID","flat in float"),e.addVertexFinalCode(` 4134 vID = randomColor.r; 4135 vec2 ${i}_offset = vec2(0.0); 4136 if (${a}) { 4137 vec4 ${i}_clipPosition = projectionMatrix * (modelViewMatrix * vec4(transformed, 1.0)); 4138 // NOTE: For certain shapes, like spheres, we get incorrect extrusion when the 4139 // normals face the camera directly. So we hackily fix this by offsetting the normal 4140 // by a tiny amount. 4141 vec3 ${i}_clipNormal = mat3(projectionMatrix) * (mat3(modelViewMatrix) * extrudeNormal) + 0.0000001; 4142 ${i}_offset = normalize(${i}_clipNormal.xy) / ${s} * (${r} / 2.0) * ${i}_clipPosition.w * 2.0 * ${n}; 4143 ${i}_clipPosition.xy += ${i}_offset; 4144 // TODO(MAX): To handle multiple outline layers, we only want to extrude 4145 // if this offset is the biggest of all the potential offsets 4146 gl_Position = ${i}_clipPosition; 4147 } 4148 `)}if(e.isShader("fragment")){e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let r=e.include(OT.Nodes.outline),s=[];return s.push(this.outlineColor.build(e,"c")),s.push(this.contourColor.build(e,"c")),s.push(this.outlineWidth.build(e,"f")),s.push(this.contourWidth.build(e,"f")),s.push(this.contourThreshold.build(e,"f")),s.push(this.outlineThreshold.build(e,"f")),s.push(this.contourFrequency.build(e,"f")),s.push(this.outlineSmoothing.build(e,"f")),s.push(this.contourDirection.build(e,"v3")),s.push(this.positionalLines.build(e,"b")),s.push(this.resolution.build(e,"v2")),s.push(this.normalMap.getTexture(e,"t")),s.push(this.depthMap.getTexture(e,"t")),s.push(this.pixelRatio.build(e,"f")),s.push(this.compensation.build(e,"b")),s.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),s.push(this.alpha.build(e,"f")),s.push(this.calpha),this.firstTime=!this.firstTime,e.format(r+"("+s.join(",")+")",this.getType(e),t)}else return console.warn("OutlineNode is not compatible with "+e.shader+" shader."),""}},IT=OT;IT.Nodes=(function(){let e=new Pe(` 4149float sobelSample(sampler2D t, sampler2D d, vec2 uv, vec2 resolution, float outlineWidth, float pixelRatio) 4150{ 4151 vec2 halton = haltonSequence[frameIndex]; 4152 float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton); 4153 float temporalAngle = temporalOffset * PI2; 4154 4155 vec2 texelSize = (vec2(1.0) / resolution); 4156 vec2 offsetSize = texelSize * outlineWidth * pixelRatio; 4157 4158 vec2 uvSamples[9]; 4159 vec4 normalSamples[9]; 4160 4161 uvSamples[0] = uv + vec2( -offsetSize.x, -offsetSize.y) + (vogelDiskSample(0, 9, temporalAngle) * texelSize); 4162 uvSamples[1] = uv + vec2(0.0, -offsetSize.y) + (vogelDiskSample(1, 9, temporalAngle) * texelSize); 4163 uvSamples[2] = uv + vec2( offsetSize.x, -offsetSize.y) + (vogelDiskSample(2, 9, temporalAngle) * texelSize);
4164 uvSamples[3] = uv + vec2( -offsetSize.x, 0.0) + (vogelDiskSample(3, 9, temporalAngle) * texelSize); 4165 uvSamples[4] = uv; 4166 uvSamples[5] = uv + vec2( offsetSize.x, 0.0) + (vogelDiskSample(5, 9, temporalAngle) * texelSize); 4167 uvSamples[6] = uv + vec2( -offsetSize.x, offsetSize.y) + (vogelDiskSample(6, 9, temporalAngle) * texelSize); 4168 uvSamples[7] = uv + vec2(0.0, offsetSize.y) + (vogelDiskSample(7, 9, temporalAngle) * texelSize); 4169 uvSamples[8] = uv + vec2( offsetSize.x, offsetSize.y) + (vogelDiskSample(8, 9, temporalAngle) * texelSize); 4170 4171 4172 normalSamples[0] = texture2D(t, uvSamples[0]); 4173 normalSamples[1] = texture2D(t, uvSamples[1]); 4174 normalSamples[2] = texture2D(t, uvSamples[2]); 4175 normalSamples[3] = texture2D(t, uvSamples[3]); 4176 normalSamples[4] = texture2D(t, uvSamples[4]); 4177 normalSamples[5] = texture2D(t, uvSamples[5]); 4178 normalSamples[6] = texture2D(t, uvSamples[6]); 4179 normalSamples[7] = texture2D(t, uvSamples[7]); 4180 normalSamples[8] = texture2D(t, uvSamples[8]); 4181 4182 float depthBias = 0.0001; 4183 // TODO(MAX): Can we somehow reduce the number of conditionals here with MATH?! 4184 if (normalSamples[0].a != vID && normalSamples[0].a != 0.0) { 4185 float depthAtSample = texture2D(d, uvSamples[0]).r + depthBias; 4186 if (gl_FragCoord.z > depthAtSample) { 4187 return 0.0; 4188 } 4189 } 4190 4191 if (normalSamples[1].a != vID && normalSamples[1].a != 0.0) { 4192 float depthAtSample = texture2D(d, uvSamples[1]).r + depthBias; 4193 if (gl_FragCoord.z > depthAtSample) { 4194 return 0.0; 4195 } 4196 } 4197 4198 if (normalSamples[2].a != vID && normalSamples[2].a != 0.0) { 4199 float depthAtSample = texture2D(d, uvSamples[2]).r + depthBias; 4200 if (gl_FragCoord.z > depthAtSample) { 4201 return 0.0; 4202 } 4203 } 4204 4205 if (normalSamples[3].a != vID && normalSamples[3].a != 0.0) { 4206 float depthAtSample = texture2D(d, uvSamples[3]).r + depthBias; 4207 if (gl_FragCoord.z > depthAtSample) { 4208 return 0.0; 4209 } 4210 } 4211 4212 4213 if (normalSamples[4].a != vID && normalSamples[4].a != 0.0) { 4214 float depthAtSample = texture2D(d, uvSamples[4]).r + depthBias; 4215 if (gl_FragCoord.z > depthAtSample) { 4216 return 0.0; 4217 } 4218 } 4219 4220 if (normalSamples[5].a != vID && normalSamples[5].a != 0.0) { 4221 float depthAtSample = texture2D(d, uvSamples[5]).r + depthBias; 4222 if (gl_FragCoord.z > depthAtSample) { 4223 return 0.0; 4224 } 4225 } 4226 4227 if (normalSamples[6].a != vID && normalSamples[6].a != 0.0) { 4228 float depthAtSample = texture2D(d, uvSamples[6]).r + depthBias; 4229 if (gl_FragCoord.z > depthAtSample) { 4230 return 0.0; 4231 } 4232 } 4233 4234 if (normalSamples[7].a != vID && normalSamples[7].a != 0.0) { 4235 float depthAtSample = texture2D(d, uvSamples[7]).r + depthBias; 4236 if (gl_FragCoord.z > depthAtSample) { 4237 return 0.0; 4238 } 4239 } 4240 4241 if (normalSamples[8].a != vID && normalSamples[8].a != 0.0) { 4242 float depthAtSample = texture2D(d, uvSamples[8]).r + depthBias; 4243 if (gl_FragCoord.z > depthAtSample) { 4244 return 0.0; 4245 } 4246 } 4247 4248 vec3 sobel_edge_h = normalSamples[2].rgb + (2.0*normalSamples[5].rgb) + normalSamples[8].rgb - (normalSamples[0].rgb + (2.0*normalSamples[3].rgb) + normalSamples[6].rgb); 4249 vec3 sobel_edge_v = normalSamples[0].rgb + (2.0*normalSamples[1].rgb) + normalSamples[2].rgb - (normalSamples[6].rgb + (2.0*normalSamples[7].rgb) + normalSamples[8].rgb); 4250 4251 float edgeNormal = sqrt(dot(sobel_edge_h, sobel_edge_h) + dot(sobel_edge_v, sobel_edge_v)); 4252 return edgeNormal; 4253} 4254`);return{outline:new Pe(`vec3 outline(vec3 outlineColor, vec3 contourColor, float outlineWidth, float contourWidth, float outlineThreshold, float contourThreshold, float outlineSmoothing, float contourFrequency, vec3 contourDirection, bool positionalLines, vec2 resolution, sampler2D normalMap, sampler2D depthMap, float pixelRatio, bool compensation, float mask, float alpha, out float calpha) { 4255 vec3 result = outlineColor; 4256 float resultAlpha = 0.0; 4257 4258 vec3 N = normalize(vWNormal); 4259 vec2 nuv = (gl_FragCoord.xy / resolution); 4260 float sobelSample = compensation ? sobelSample(normalMap, depthMap, nuv, resolution, outlineWidth / 2., pixelRatio) : sobelSample(normalMap, depthMap, nuv, resolution, outlineWidth, pixelRatio); 4261 resultAlpha = smoothstep(outlineThreshold - outlineSmoothing, outlineThreshold + outlineSmoothing, sobelSample); 4262 4263 //resultAlpha = 1.0; 4264 //result = vec3(sobelSample); 4265 4266 float t = 1.0 - contourThreshold; 4267 if(positionalLines) { 4268 vec3 NDir = position * contourDirection; 4269 float NT = NDir.x + NDir.y + NDir.z; 4270 float f = fract(NT * contourFrequency * 0.01); 4271 float df = fwidth(NT * contourFrequency); 4272 4273 float g = smoothstep(df * (contourWidth * 0.01), df * (contourWidth * 0.01 * 2.0), f); 4274 if (g < 1.0 && resultAlpha == 0.0) { 4275 result = contourColor; 4276 resultAlpha = 1.0; 4277 } 4278 } 4279 else { 4280 vec3 NDir = N * contourDirection; 4281 float NT = NDir.x + NDir.y + NDir.z; 4282 float df = fwidth(NT * contourThreshold); 4283 float f = sin(NT * 1.0 * contourFrequency); 4284 float g = smoothstep(0.0, df * contourWidth, 1.0 - f); 4285 4286 if (df > (t * 0.5) && g < 1.0 && resultAlpha == 0.0) { 4287 result = contourColor; 4288 resultAlpha = 1.0 - g; 4289 } 4290 } 4291
4292 float lalpha = alpha * resultAlpha * mask; 4293 calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 ); 4294 accumAlpha += ( 1.0 - accumAlpha ) * lalpha; 4295 4296 return result; 4297 }`,[e])}})();var qa=class extends Wt{constructor(e,t,i,r,s,a,n,o,l,h,c,u,d,p,f,m,g,v){super("v3"),this.nodeType="Pattern",this.style=e,this.projection=t,this.axis=i,this.blending=r,this.offset=s,this.colorA=a,this.colorB=n,this.frequency=o,this.size=l,this.variation=h,this.smoothness=c,this.zigzag=u,this.rotation=d,this.vertical=p,this.horizontal=f,this.sides=m,this.isMask=v,this.alpha=g,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.isShader("fragment")){e.require("position"),e.require("uv"),e.requires.uv=[!0],e.require("normal"),e.requires.normal=!0,e.addFragmentVariable(this.calpha,"float");let i;switch(this.style.value){case 0:i="circle";break;case 1:i="ring";break;case 2:i="polygon";break;case 3:i="xcross";break;case 4:i="diamond";break;case 5:i="checkerboard";break;case 6:i="line";break;case 7:i="wave";break;default:i="circle";break}let r=`g${this.uuid.toString().replace(/-/g,"")}`,s=new Pe(`float hashwithoutsine12(vec2 p) 4298 { 4299 vec3 p3 = fract(vec3(p.xyx) * .1031); 4300 p3 += dot(p3, p3.yzx + 33.33); 4301 return fract((p3.x + p3.y) * p3.z); 4302 }`),a=new Pe(`vec2 rotate_uv(in vec2 uv, float a, bool repeat) 4303 { 4304 const float mid = 0.5; 4305 float radians = a * (PI / 180.0); 4306 vec2 rotated = vec2( 4307 cos(radians) * (uv.x - mid) + sin(radians) * (uv.y - mid) + mid, 4308 cos(radians) * (uv.y - mid) - sin(radians) * (uv.x - mid) + mid 4309 ); 4310 return repeat ? fract(rotated): rotated; 4311 }`),n="";if(this.projection.value===4){let c=this.style.value===2?`${i}(uv0, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv0, frequency, size, variation, smoothness_remapped, zigzag, rotation)`,u=this.style.value===2?`${i}(uv1, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv1, frequency, size, variation, smoothness_remapped, zigzag, rotation)`,d=this.style.value===2?`${i}(uv2, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv2, frequency, size, variation, smoothness_remapped, zigzag, rotation)`;n=` 4312 vec3 p = position; 4313 float factor = 0.0125; 4314 vec2 uv0 = fract(p.xy * factor); 4315 vec2 uv1 = fract(p.zy * factor); 4316 vec2 uv2 = fract(p.xz * factor); 4317 4318 uv0 = rotate_uv(uv0 + offset, rotation, true); 4319 uv1 = rotate_uv(uv1 + offset, rotation, true); 4320 uv2 = rotate_uv(uv2 + offset, rotation, true); 4321 4322 float d0 = ${c}; 4323 float d1 = ${u}; 4324 float d2 = ${d}; 4325 4326 // Range from 3 to 128 seems to be good 4327 float exponent = (1.0 - blending) * 125.0 + 3.0; 4328 4329 vec3 n = vObjectNormal; 4330 vec3 weights = abs(normalize(n)); 4331 weights = pow(weights, vec3(exponent)); 4332 weights /= dot(weights, vec3(1.0)); 4333 d0 *= weights.z; 4334 d1 *= weights.x; 4335 d2 *= weights.y; 4336 float draw = d0 + d1 + d2; 4337 4338 vec2 custom_uv = uv0 * weights.z + uv1 * weights.x + uv2 * weights.y; 4339 `}else{let c=this.style.value===2?`${i}(custom_uv, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(custom_uv, frequency, size, variation, smoothness_remapped, zigzag, rotation)`,u="";this.axis.value===0?u=`float radius = length(p); 4340 float theta = atan(p.y, p.z); 4341 float phi = acos(p.x / radius);`:this.axis.value===1?u=`float radius = length(p); 4342 float theta = atan(p.x, p.z); 4343 float phi = acos(p.y / radius);`:(this.axis.value,u=`float radius = length(p); 4344 float theta = atan(p.y, p.x); 4345 float phi = acos(p.z / radius);`);let d="";switch(this.projection.value){case 0:d="custom_uv = vUv.st;";break;case 1:break;case 2:d=` 4346 vec3 p = position; 4347 ${u} 4348 custom_uv = vec2(theta, phi); 4349 custom_uv /= PI; 4350 `;break}n=` 4351 vec2 custom_uv; 4352 ${d} 4353 4354 custom_uv += offset; 4355 custom_uv = fract(custom_uv); 4356 custom_uv = rotate_uv(custom_uv, rotation, true); 4357 4358 float draw = ${c}; 4359 `}
vendor: 4,305 bytes, lines 4359-4432
4359let o=new Pe(`vec3 ${r}_pattern(vec3 normal, float blending, int style, vec2 offset, vec4 colorA, vec4 colorB, vec2 frequency, float size, float variation, float smoothness, float zigzag, float rotation, vec2 vertical, vec2 horizontal, int sides, bool isMask, float mask, float alpha, out float calpha) { 4360 const float TWO_PI = PI * 2.0; 4361 float smoothness_remapped = pow(smoothness, 5.0); 4362 4363 ${n} 4364 4365 // Construct final output color 4366 vec4 color = mix(colorA, colorB, draw); 4367 color.a = clamp(color.a, 0.0, 1.0); 4368 4369 // Apply cuts 4370 color.a *= 4371 step(vertical.x, custom_uv.y) * 4372 step(custom_uv.y, vertical.y); 4373 color.a *= 4374 step(horizontal.x, abs(custom_uv.x)) * 4375 step(abs(custom_uv.x), horizontal.y); 4376 4377 // Accumulate alpha 4378 float lalpha = alpha * clamp(color.a, 0.0, 1.0) * mask; 4379 calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask)); 4380 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 4381 4382 return clamp(color, 0.0, 1.0).rgb; 4383 }`,[a,s,qa.DrawFunctions.circle,qa.DrawFunctions.ring,qa.DrawFunctions.polygon,qa.DrawFunctions.cross,qa.DrawFunctions.diamond,qa.DrawFunctions.checkerboard,qa.DrawFunctions.line,qa.DrawFunctions.wave]),l=e.include(o),h=[];return h.push("normal"),h.push(this.blending.build(e,"f")),h.push(this.style.build(e,"i")),h.push(this.offset.build(e,"v2")),h.push(this.colorA.build(e,"v4")),h.push(this.colorB.build(e,"v4")),h.push(this.frequency.build(e,"v2")),h.push(this.size.build(e,"f")),h.push(this.variation.build(e,"f")),h.push(this.smoothness.build(e,"f")),h.push(this.zigzag.build(e,"f")),h.push(this.rotation.build(e,"f")),h.push(this.vertical.build(e,"v2")),h.push(this.horizontal.build(e,"v2")),h.push(this.sides.build(e,"i")),h.push(this.isMask.build(e,"b")),h.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),h.push(this.alpha.build(e,"f")),h.push(this.calpha),e.format(l+"("+h.join(",")+")",this.getType(e),t)}else return console.warn("PatterNode is not compatible with "+e.shader+" shader."),e.format("vec3(0.0)",this.getType(e),t)}},RT=qa;RT.DrawFunctions=(function(){let e=new Pe(`float hashwithoutsine12(vec2 p) { 4384 vec3 p3 = fract(vec3(p.xyx) * 0.1031); 4385 p3 += dot(p3, p3.yzx + 33.33); 4386 return fract((p3.x + p3.y) * p3.z); 4387 }`),t=new Pe(`vec2 tile_and_center(in vec2 uv, in vec2 frequency, in float variation, in float zigzag, in float rotation) { 4388 // Create tiles in UV-space 4389 uv *= frequency; 4390 4391 // Integer coords 4392 vec2 i = floor(uv); 4393 4394 // Offset every other row based on zigzag param, then compute fractional coords 4395 float row_offset = mod(i.y, 2.0); 4396 uv.x += row_offset * zigzag; 4397 vec2 f = fract(uv); 4398 4399 // Rotate the tile itself: 4400 // const float mid = 0.5; 4401 // f = vec2( 4402 // cos(rotation) * (f.x - mid) + sin(rotation) * (f.y - mid) + mid, 4403 // cos(rotation) * (f.y - mid) - sin(rotation) * (f.x - mid) + mid 4404 // ); 4405 // f = fract(f); 4406 4407 f = f * 2.0 - 1.0; 4408 4409 // Recompute integer coords after shifting - then, random value per tile 4410 i = floor(uv); 4411 float rand = (hashwithoutsine12(i) * 5.0 + 1.0); 4412 float jitter = mix(1.0, rand, variation); 4413 f *= jitter; 4414 4415 return f; 4416 }`,[e]),i=new Pe(`float circle(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) { 4417 vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation); 4418 return smoothstep( 4419 -smoothness, 4420 smoothness, 4421 length(f) - size 4422 ); 4423 }`,[t]),r=new Pe(`float ring(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) { 4424 vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation); 4425 4426 float d = length(f); 4427 const float inner_width = 0.5; 4428 4429 float outer = smoothstep(-smoothness, smoothness, d - size); 4430 float inner = smoothstep(-smoothness, smoothness, d - size * inner_width); 4431 return outer + (1.0 - inner); 4432 }
4432`,[t]),s=new Pe(`float sdf_ngon(in vec2 p, in float r, in int n) { 4433 float an = (PI * 2.0) / float(n); 4434 float he = r * tan(0.5 * an); 4435 4436 // Rotate to first sector 4437 p = -p.yx; 4438 float bn = an * floor((atan(p.y, p.x) + 0.5 * an) / an); 4439 vec2 cs = vec2(cos(bn), sin(bn)); 4440 p = mat2(cs.x, -cs.y, cs.y, cs.x)*p; 4441 4442 // Side of polygon 4443 return length(p - vec2(r, clamp(p.y, -he, he))) * sign(p.x - r); 4444 } 4445 4446 float polygon(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation, in int sides) { 4447 vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation); 4448 return smoothstep(-smoothness, smoothness, sdf_ngon(f, size, sides)); 4449 }`,[t]),a=new Pe(`float sdf_cross(in vec2 p, in vec2 b, float r ) { 4450 p = abs(p); 4451 p = (p.y > p.x) ? p.yx : p.xy; 4452 vec2 q = p - b; 4453 float k = max(q.y, q.x); 4454 vec2 w = (k > 0.0) ? q : vec2(b.y - p.x, -k); 4455 return sign(k) * length(max(w, 0.0)) + r; 4456 } 4457 4458 // Avoid namespace conflicts 4459 float xcross(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) { 4460 vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation); 4461 return smoothstep(-smoothness, smoothness, sdf_cross(f, vec2(size, size * 0.25), smoothness)); 4462 }`,[t]),n=new Pe(`float ndot(vec2 a, vec2 b) { 4463 return a.x*b.x - a.y*b.y; 4464 } 4465 4466 float sdf_diamond(in vec2 p, in vec2 b) { 4467 p = abs(p); 4468 float h = clamp(ndot(b - 2.0 * p, b) / dot(b, b), -1.0, 1.0); 4469 float d = length(p - 0.5 * b * vec2(1.0 - h, 1.0 + h)); 4470 return d * sign(p.x * b.y + p.y * b.x - b.x * b.y); 4471 } 4472 4473 float diamond(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) { 4474 vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation); 4475 return smoothstep(-smoothness, smoothness, sdf_diamond(f, vec2(size))); 4476 }`,[t]),o=new Pe(`float checkerboard(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) { 4477 uv *= frequency; 4478 vec2 i = floor(uv); 4479 4480 float offset = mod(i.y, 2.0); 4481 4482 uv.x += offset + zigzag * offset; 4483 float x = floor(uv.x); 4484 4485 return mod(x, 2.0); 4486 }`),l=new Pe(`float line(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) { 4487 vec2 f = tile_and_center(uv, frequency, 0.0, zigzag, rotation); 4488 4489 // Different approach for variation param here 4490 float row = floor(uv * frequency).y; 4491 float rand = hashwithoutsine12(vec2(row)); 4492 float s = mix(size, size * rand, variation); 4493 4494 return smoothstep( 4495 s - smoothness, 4496 s + smoothness, 4497 abs(f.y) 4498 ); 4499 }`,[t]),h=new Pe(`// Uses bisection 4500 float udf_cos(in vec2 p, in float a, in float b, in float c, in float d) { 4501 // Convert all data to a primitive cosine wave 4502 p = c * (p - vec2(d, a)); 4503 4504 const float TWO_PI = PI * 2.0; 4505 4506 // Reduce to principal half cycle 4507 p.x = mod(p.x, TWO_PI); 4508 if (p.x > PI) { 4509 p.x = TWO_PI - p.x; 4510 } 4511 4512 // Find zero of derivative (minimize distance) 4513 float xa = 0.0; 4514 float xb = TWO_PI; 4515 4516 // 24 bit precision 4517 for (int i = 0; i < 24; i++) { 4518 float x = 0.5 * (xa + xb); 4519 float y = x - p.x + b * c * sin(x) * (p.y - b * c * cos(x)); 4520 if (y < 0.0) xa = x; 4521 else xb = x; 4522 } 4523 float x = 0.5 * (xa + xb); 4524 4525 // Compute distance 4526 vec2 q = vec2(x, b * c * cos(x)); 4527 return length(p - q) / c; 4528 } 4529 4530 float wave(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) { 4531 float repeat = frequency.x; 4532 uv *= repeat; 4533 vec2 i = floor(uv); 4534 float row_offset = mod(i.y, 2.0); 4535 uv.x += row_offset * zigzag; 4536 vec2 f = vec2(uv.x, fract(uv.y)); 4537 4538 // Generalized cosine: y(x) = a + b * cos(cx + d) 4539 const float amplitude = 0.125; 4540 float wave_frequency = frequency.y * 0.1; 4541 float distance_estimate = udf_cos(f, 0.50, amplitude, wave_frequency * (2.0 * PI), 0.0); 4542 4543 // Different approach for variation param here 4544 float rand = hashwithoutsine12(vec2(i.y)); 4545 float s = mix(size, size * rand, variation); 4546 4547 return smoothstep(-smoothness, smoothness, distance_estimate - s * 0.5); 4548 }`);return{tileAndCenter:t,circle:i,ring:r,polygon:s,cross:a,diamond:n,checkerboard:o,line:l,wave:h}})();var LT=class extends Wt{constructor(e,t,i,r,s,a,n,o){super("v3"),this.nodeType="Rainbow",this.filmThickness=e,this.movement=t,this.wavelengths=i,this.noiseStrength=r,this.noiseScale=s,this.offset=a,this.isMask=o,this.alpha=n,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("vWorldViewDir"),e.require("worldNormal"),e.isShader("fragment")){e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let i=e.include(LT.Nodes.rainbow),r=[];return r.push(this.filmThickness.build(e,"f")),r.push(this.movement.build(e,"f")),r.push(this.wavelengths.build(e,"v3")),r.push(this.noiseStrength.build(e,"f")),r.push(this.noiseScale.build(e,"f")),r.push(this.offset.build(e,"v3")),r.push(this.isMask.build(e,"b")),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}else return console.warn("RainbowNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},zT=LT;zT.Nodes=(function(){let e=new Pe(`vec3 attenuation(vec3 wavelengths, float filmThickness, float movement, float noiseStrength, float noiseScale, vec3 offset) { 4549 float f = 0.0; 4550 4551 if (noiseStrength != 0.0) { 4552 vec3 st = position / noiseScale; 4553 float noise = simplexFast(1.6 * st + vec3(1.8, 1.5, 1.9) * simplexFast(st) + vec3(1.7, 9.2, 1.0)); 4554 f = noise * noiseStrength; 4555 } 4556 4557 vec3 waves = wavelengths * vec3(1.0, 0.8, 0.6) + 1.0; 4558 float angle = dot(normalize(vWorldViewDir + (offset * -0.001)), normalize(vWNormal)); 4559 4560 mediump vec3 color = cos((((filmThickness + f) / waves) * angle) + movement); 4561 return .5 + .5 * color; 4562 }`,[Gr.simplexFast]);
vendor: 4,703 bytes, lines 4562-4655
4562return{rainbow:new Pe(`vec3 rainbow(float filmThickness, float movement, vec3 wavelengths, float noiseStrength, float noiseScale, vec3 offset, bool isMask, float mask, float alpha, out float calpha) { 4563 mediump vec3 res = clamp(attenuation(wavelengths, filmThickness, movement, noiseStrength, noiseScale, offset), 0.0, 2.0); 4564 4565 float rainbowContribution = clamp(res.r + res.g + res.b, 0.0, 1.0); 4566 4567 float lalpha = alpha * rainbowContribution * mask; 4568 calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask)); 4569 accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask)); 4570 4571 return res; 4572 }`,[e])}})();var BT=class extends Wt{constructor(e,t,i,r,s,a,n,o,l,h){super("v3"),this.nodeType="Toon",this.positioning=e,this.colors=t,this.steps=i,this.source=r,this.isWorldSpace=s,this.noiseStrength=a,this.noiseScale=n,this.shadowColor=o,this.offset=l,this.alpha=h,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("worldNormal"),e.require("worldPosition"),e.isShader("fragment")){e.define("COLORS_MAX",10),e.addFragmentVariable(this.calpha,"float");let i=e.include(BT.Nodes.toon),r=[];return r.push(this.positioning.build(e,"i")),r.push(this.colors.build(e,"v4[]")),r.push(this.steps.build(e,"f[]")),r.push(this.source.build(e,"v3")),r.push(this.isWorldSpace.build(e,"b")),r.push(this.noiseStrength.build(e,"f")),r.push(this.noiseScale.build(e,"f")),r.push(this.shadowColor.build(e,"v4")),r.push(this.offset.build(e,"v3")),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}else return console.warn("ToonNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},FT=BT;FT.Nodes=(function(){let e=new Pe(`float rand(float n) { 4573 return fract(sin(n) * 43758.5453123); 4574 }`),t=new Pe(`float hash1(float p) { 4575 p = fract(p * 0.011); 4576 p *= p + 7.5; 4577 p *= p + p; 4578 return fract(p); 4579 }`),i=new Pe(`float valueNoise(vec3 x) { 4580 const vec3 step = vec3(110, 241, 171); 4581 4582 vec3 i = floor(x); 4583 vec3 f = fract(x); 4584 4585 // For performance, compute the base input to a 1D hash from the integer part of the argument and the 4586 // incremental change to the 1D based on the 3D -> 1D wrapping 4587 float n = dot(i, step); 4588 4589 vec3 u = f * f * (3.0 - 2.0 * f); 4590 return mix(mix(mix( hash1(n + dot(step, vec3(0, 0, 0))), hash1(n + dot(step, vec3(1, 0, 0))), u.x), 4591 mix( hash1(n + dot(step, vec3(0, 1, 0))), hash1(n + dot(step, vec3(1, 1, 0))), u.x), u.y), 4592 mix(mix( hash1(n + dot(step, vec3(0, 0, 1))), hash1(n + dot(step, vec3(1, 0, 1))), u.x), 4593 mix( hash1(n + dot(step, vec3(0, 1, 1))), hash1(n + dot(step, vec3(1, 1, 1))), u.x), u.y), u.z); 4594 }`,[t]),r=new Pe(`vec3 hash3(vec3 x) { 4595 x = vec3(dot(x,vec3(127.1, 311.7, 74.7)), 4596 dot(x,vec3(269.5, 183.3, 246.1)), 4597 dot(x,vec3(113.5, 271.9, 124.6))); 4598 4599 return fract(sin(x)*43758.5453123); 4600 }`),s=new Pe(`vec3 voronoiNoise(in vec3 x) 4601 { 4602 vec3 p = floor(x); 4603 vec3 f = fract(x); 4604 4605 float id = 0.0; 4606 vec2 res = vec2(100.0); 4607 4608 for(int k=-1; k<=1; k++) 4609 for(int j=-1; j<=1; j++) 4610 for(int i=-1; i<=1; i++) 4611 { 4612 vec3 b = vec3(float(i), float(j), float(k)); 4613 4614 // Comment out the "+ hash(p + b);" part below to get "square" cells 4615 vec3 r = vec3(b) - f + hash3(p + b); 4616 float d = dot(r, r); 4617 4618 if (d < res.x) 4619 { 4620 id = dot(p + b, vec3(1.0, 57.0, 113.0)); 4621 res = vec2(d, res.x); 4622 } 4623 else if (d < res.y) 4624 { 4625 res.y = d; 4626 } 4627 } 4628 4629 return vec3(sqrt(res), abs(id)); 4630 } 4631 `,[r]);return{toon:new Pe(`vec3 toon(int positioning, vec4 colors[COLORS_MAX], float steps[COLORS_MAX], vec3 source, bool isWorldSpace, float noiseStrength, float noiseScale, vec4 shadowColor, vec3 offset, float mask, float alpha, out float calpha) { 4632 float t = 0.0; 4633 float shadow = 1.0; 4634 4635 if (positioning == 0) { 4636 4637 // Can't do this mode if lighting is "none" 4638 #if (defined(PHONG) || defined(LAMBERT) || defined(STANDARD)) 4639 4640 // Algorithm from Chapter 10 of Graphics Shaders 4641 const vec3 weights = vec3(0.2125, 0.7154, 0.0721); 4642 vec3 lpos; 4643 vec3 l; 4644 float dproduct; 4645 4646 #if (NUM_POINT_LIGHTS > 0) 4647 4648 #if defined(USE_SHADOWMAP) && (NUM_POINT_LIGHT_SHADOWS > 0) 4649 PointLightShadow pointLightShadow; 4650 #endif 4651 4652 #pragma unroll_loop_start 4653 for (int i = 0; i < NUM_POINT_LIGHTS; i++) { 4654 // Light positions are in view-space for some reason? 4655 lpos = (inverse(viewMatrix) * vec4(pointLights[UNROLLED_LOOP_INDEX].position, 1.0
4655)).xyz; 4656 l = normalize(lpos - worldPosition); 4657 4658 dproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5; 4659 4660 // TODO: we want to use "intensity" but it isn't available in the shader code 4661 //dproduct += dot(pointLights[UNROLLED_LOOP_INDEX].color, weights); 4662 4663 t = max(t, dproduct); 4664 4665 // Accumulate shadow contribution 4666 #if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS) 4667 pointLightShadow = pointLightShadows[UNROLLED_LOOP_INDEX]; 4668 shadow *= getPointShadow( 4669 pointShadowMap[UNROLLED_LOOP_INDEX], 4670 pointLightShadow.shadowMapSize, 4671 pointLightShadow.shadowBias, 4672 pointLightShadow.shadowRadius, 4673 vPointShadowCoord[UNROLLED_LOOP_INDEX], 4674 pointLightShadow.shadowCameraNear, 4675 pointLightShadow.shadowCameraFar); 4676 #endif 4677 } 4678 #pragma unroll_loop_end 4679 4680 #endif 4681 4682 #if NUM_DIR_LIGHTS > 0 4683 4684 #if defined(USE_SHADOWMAP) && (NUM_DIR_LIGHT_SHADOWS > 0) 4685 DirectionalLightShadow directionalLightShadow; 4686 #endif 4687 4688 #pragma unroll_loop_start 4689 for (int i = 0; i < NUM_DIR_LIGHTS; i++) { 4690 // Use the direction vector for directional lights instead 4691 l = (inverse(viewMatrix) * vec4(directionalLights[UNROLLED_LOOP_INDEX].direction, 0.0)).xyz; 4692 4693 dproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5; 4694 t = max(t, dproduct); 4695 4696 // Accumulate shadow contribution 4697 #if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS) 4698 directionalLightShadow = directionalLightShadows[UNROLLED_LOOP_INDEX]; 4699 shadow *= getShadow( 4700 UNROLLED_LOOP_INDEX, 4701 directionalShadowMap[UNROLLED_LOOP_INDEX], 4702 directionalLightShadow.shadowMapSize, 4703 directionalLightShadow.shadowBias, 4704 directionalLightShadow.shadowRadius, 4705 vDirectionalShadowCoord[UNROLLED_LOOP_INDEX]); 4706 #endif 4707 } 4708 #pragma unroll_loop_end 4709 4710 #endif 4711 4712 #if NUM_SPOT_LIGHTS > 0 4713 4714 #if defined(USE_SHADOWMAP) && (NUM_SPOT_LIGHT_SHADOWS > 0) 4715 SpotLightShadow spotLightShadow; 4716 #endif 4717 4718 #pragma unroll_loop_start 4719 for (int i = 0; i < NUM_SPOT_LIGHTS; i++) { 4720 lpos = (inverse(viewMatrix) * vec4(spotLights[UNROLLED_LOOP_INDEX].position, 1.0)).xyz; 4721 l = normalize(lpos - worldPosition); 4722 4723 dproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5; 4724 t = max(t, dproduct); 4725 4726 // Accumulate shadow contribution 4727 #if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS) 4728 spotLightShadow = spotLightShadows[UNROLLED_LOOP_INDEX]; 4729 shadow *= getShadow( 4730 UNROLLED_LOOP_INDEX, 4731 spotShadowMap[UNROLLED_LOOP_INDEX], 4732 spotLightShadow.shadowMapSize, 4733 spotLightShadow.shadowBias, 4734 spotLightShadow.shadowRadius, 4735 vSpotLightCoord[UNROLLED_LOOP_INDEX]); 4736 #endif 4737 } 4738 #pragma unroll_loop_end 4739 4740 #endif 4741 4742 t = clamp(t, 0.0, 1.0); 4743 4744 #endif 4745 4746 } else if (positioning == 1) { 4747 4748 vec3 origin = mix(position, worldPosition, float(isWorldSpace)); 4749 vec3 direction = normalize(source - origin); 4750 t = dot(direction, normalize(worldNormal)) * 0.5 + 0.5; 4751 4752 } else { 4753 4754 vec3 origin = worldPosition; 4755 vec3 source = cameraPosition - offset; 4756 vec3 direction = normalize(source - origin); 4757 t = dot(direction, normalize(worldNormal)) * 0.5 + 0.5; 4758 4759 } 4760 4761 if (noiseStrength > 0.0) { 4762 // Distort with noise 4763 vec3 st = position / noiseScale; 4764 4765 // Voronoi "smooth" noise 4766 float noise = 1.0 - voronoiNoise(st).x; 4767 4768 // Voronoi cellular noise 4769 //float noise = 1.0 - rand(voronoiNoise(st).z); 4770 4771 // Position warp noise 4772 // vec3 offset = vec3( 4773 // simplexFast(st), 4774 // simplexFast(st + vec3(111.1, 143.89, 217.19)), 4775 // simplexFast(st + vec3(171.1, 247.89, 117.23)) 4776 // ); 4777 // st += offset; 4778 // float noise = valueNoise(st); 4779 4780 t += noise * noiseStrength; 4781 } 4782 4783 t = clamp(t, 0.0, 1.0); 4784 4785 // Compute ramp color 4786 float p; 4787 vec4 color = colors[0]; 4788 for (int i = 1; i < COLORS_MAX; i++) { 4789 p = clamp((t - steps[i-1]) / (steps[i] - steps[i-1]), 0.0, 1.0); 4790 color = mix(color, colors[i], smoothstep(0.0, 1.0, p)); 4791 } 4792 4793 // Incorporate custom shadow color 4794 if (positioning == 0) { 4795 4796 vec3 blendedShadow = mix(color.rgb, shadowColor.rgb, shadowColor.a); 4797 color.rgb = mix(blendedShadow, color.rgb, shadow); 4798 4799 } 4800 4801 // Accumulate alpha as usual
4802 float lalpha = alpha * color.a * mask; 4803 calpha = lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0); 4804 accumAlpha += (1.0 - accumAlpha) * lalpha; 4805 4806 return color.xyz; 4807 4808 }`,[Gr.simplexFast,e,i,s])}})();var $7=(function(){return{textureBicubic:new Pe(`float w0( float a ) { 4809 return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); 4810 } 4811 4812 float w1( float a ) { 4813 return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); 4814 } 4815 4816 float w2( float a ){ 4817 return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); 4818 } 4819 4820 float w3( float a ) { 4821 return ( 1.0 / 6.0 ) * ( a * a * a ); 4822 } 4823 4824 // g0 and g1 are the two amplitude functions 4825 float g0( float a ) { 4826 return w0( a ) + w1( a ); 4827 } 4828 4829 float g1( float a ) { 4830 return w2( a ) + w3( a ); 4831 } 4832 4833 // h0 and h1 are the two offset functions 4834 float h0( float a ) { 4835 return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); 4836 } 4837 4838 float h1( float a ) { 4839 return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); 4840 } 4841 4842 vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { 4843 uv = uv * texelSize.zw + 0.5; 4844 4845 vec2 iuv = floor( uv ); 4846 vec2 fuv = fract( uv ); 4847 4848 float g0x = g0( fuv.x ); 4849 float g1x = g1( fuv.x ); 4850 float h0x = h0( fuv.x ); 4851 float h1x = h1( fuv.x ); 4852 float h0y = h0( fuv.y ); 4853 float h1y = h1( fuv.y ); 4854 4855 vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 4856 vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; 4857 vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 4858 vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; 4859 4860 return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 4861 g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); 4862 } 4863 4864 vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { 4865 vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); 4866 vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); 4867 vec2 fLodSizeInv = 1.0 / fLodSize; 4868 vec2 cLodSizeInv = 1.0 / cLodSize; 4869 vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); 4870 vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); 4871 return mix( fSample, cSample, fract( lod ) ); 4872 }`)}})();function eq(e,t){return e>=t?new H(t/e,1):new H(1,e/t)}var kT=class extends Wt{constructor(e,t,i,r,s,a,n,o){super("v3"),this.nodeType="Transmission",this.thickness=e,this.ior=t,this.roughness=i,this.transmissionSamplerSize=r,this.transmissionSamplerMap=s,this.transmissionDepthMap=a,this.aspectRatio=n,this.alpha=o,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.extensions.shaderTextureLOD=!0,e.extensions.derivatives=!0,e.isShader("fragment")){e.define("NUM_SAMPLES",6),e.define("BLUR_SLOD",Math.pow(2,Ye.transmissionLod.value)),e.require("worldPosition"),e.requires.worldNormal=!0,e.requires.modelMatrix=!0,e.requires.projectionMatrix=!0,e.addFragmentVariable(this.calpha,"float");let i=e.include(kT.Nodes.transmission),r=[];return r.push(this.thickness.build(e,"f")),r.push(this.ior.build(e,"f")),r.push(this.roughness.build(e,"f")),r.push(this.transmissionSamplerSize.build(e,"v2")),r.push(this.transmissionSamplerMap.getTexture(e,"t")),r.push(this.transmissionDepthMap.getTexture(e,"t")),r.push(this.aspectRatio.build(e,"v2")),r.push("normal"),r.push(this.mask?`luminance(${this.mask.flow(e,"v3").result})`:"1.0"),r.push(this.alpha.build(e,"f")),r.push(this.calpha),e.format(i+"("+r.join(",")+")",this.getType(e),t)}else return console.warn("TransmissionNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},UT=kT;
4872UT.Nodes=(function(){let e=new Pe(`vec3 blur(sampler2D sp, vec2 U, vec2 scale, float lod, sampler2D dm, vec2 unrefractedU, vec2 aspectRatio) { 4873 // Slightly modified version of this: 4874 // https://www.shadertoy.com/view/ltScRG 4875 4876 // Special case for blur == 0.0 4877 if (lod == 0.0) { 4878 #ifdef TEXTURE_LOD_EXT 4879 return texture2DLodEXT( sp, U, 0.0).rgb; 4880 #else 4881 return textureLod( sp, U, 0.0).rgb; 4882 #endif 4883 } 4884 4885 vec2 texelSize = vec2(1.0) / resolution; 4886 vec2 halton = haltonSequence[frameIndex]; 4887 float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton); 4888 float temporalAngle = temporalOffset * PI2; 4889 vec3 res = vec3(0.0); 4890 vec2 uv = vec2(0.0); 4891 vec2 offset = vec2(0.0); 4892 vec2 vogelSample = vec2(0.0); 4893 for (int i = 0; i < NUM_SAMPLES; i++) { 4894 vogelSample = vogelDiskSample(i, NUM_SAMPLES, temporalAngle) * texelSize; 4895 offset = vogelSample * scale * (lod * 10.0); // TODO: used to be hardcoded to 20 4896 uv = U + offset; 4897 float opaqueDepth = unpackRGBAToDepth(textureLod(dm, uv, lod)); 4898 if (opaqueDepth != 0.0 && opaqueDepth < gl_FragCoord.z) { 4899 uv = unrefractedU; 4900 lod = lod > 4.0 ? lod : lod / 2.0; 4901 } 4902 res += textureLod(sp, uv, lod).rgb; 4903 } 4904 return res / float(NUM_SAMPLES); 4905 }`),t=new Pe(`vec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) { 4906 // Direction of refracted light. 4907 vec3 refractionVector = refract( -v, n, 1.0 / ior ); 4908 4909 // Compute rotation-independant scaling of the model matrix. 4910 vec3 modelScale; 4911 modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); 4912 modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); 4913 modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); 4914 4915 // The thickness is specified in local space 4916 return normalize( refractionVector ) * thickness * modelScale; 4917 }`),i=new Pe(`float applyIorToRoughness( float roughness, float ior ) { 4918 // Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and 4919 // an IOR of 1.5 results in the default amount of microfacet refraction. 4920 return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); 4921 }`),r=new Pe(`vec3 getTransmissionSample( vec2 fragCoord, float roughness, float ior, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 unrefractedCoords, vec2 aspectRatio) { 4922 // Threejs exports do not pass a depth map to this shader, so we have to fallback to the "Threejs method of blurring" - see 4923 // also the code in convertTransmission.ts, which runs during export 4924 #ifdef IS_THREEJS_EXPORT 4925 float lod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness / 5.0, ior); 4926 return textureBicubic(transmissionSamplerMap, fragCoord.xy, lod).rgb; 4927 #else 4928 float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); 4929 float lod = applyIorToRoughness(roughness, ior); 4930 return blur(transmissionSamplerMap, fragCoord, vec2(lod), min(framebufferLod / 5.5, 8.5), transmissionDepthMap, unrefractedCoords, aspectRatio); 4931 #endif 4932 }`,[$7.textureBicubic,i,e]),s=new Pe(`vec3 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 aspectRatio ) { 4933 vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); 4934 vec3 refractedRayExit = position + transmissionRay; 4935 4936 // Project refracted vector on the framebuffer, while mapping to normalized device coordinates. 4937 vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); 4938 vec2 refractionCoords = ndcPos.xy / ndcPos.w; 4939 refractionCoords += 1.0; 4940 refractionCoords /= 2.0; 4941 4942 vec4 ndcPosUnrefracted = projMatrix * viewMatrix * vec4(position, 1.0 ); 4943 vec2 unrefractedCoords = ndcPosUnrefracted.xy / ndcPosUnrefracted.w; 4944 unrefractedCoords += 1.0; 4945 unrefractedCoords /= 2.0; 4946 4947 // Sample framebuffer to get pixel the refracted ray hits. 4948 return getTransmissionSample( refractionCoords, roughness, ior, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, unrefractedCoords, aspectRatio ); 4949 }`,[r,t]);
vendor: 4,468 bytes, lines 4949-4990
4949return{transmission:new Pe(`vec3 transmission(float thickness, float ior, float roughness, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 aspectRatio, vec3 normal, float mask, float alpha, out float calpha) { 4950 vec3 v = vec3(0.); 4951 if (isOrthographic) { 4952 v = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); 4953 } else { 4954 v = normalize(vWPosition - cameraPosition); 4955 } 4956 vec3 transmission = getIBLVolumeRefraction(vWNormal, -v, roughness, vWPosition, modelMatrix, viewMatrix, projectionMatrix, ior, thickness, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, aspectRatio ); 4957 4958 float lalpha = alpha * mask; 4959 calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 ); 4960 accumAlpha += ( 1.0 - accumAlpha ) * alpha; 4961 4962 return transmission; 4963 }`,[s])}})();var by=(e=>(e.NOISE="noise",e.MAP="map",e))(by||{}),NT=class extends Wt{constructor(e,t,i,r,s,a,n,o,l,h,c){super("v3"),this.displacementTypeIndex=new Yt(0),this.nodeType="VertexDisplacement",this.intensity=e,this.movementOrTexture=t,Object.values(by)[this.displacementTypeIndex.value]==="map"&&(this.mat=new wT(this.movementOrTexture.value.matrix)),this.cropOrOffset=i,this.scale=h,this.noiseFunctionIndex=c,this.voronoiStyle=r,this.smoothness=s,this.seed=a,this.highCut=n,this.lowCut=o,this.quality=l}generate(e,t){if(e.isShader("vertex")){e.define("USE_LAYER_DISPLACE");let i,r=[];switch(r.push("displaced_position"),r.push("displaced_normal"),Object.values(by)[this.displacementTypeIndex.value]){case"map":{i=e.include(NT.Nodes.map),r.push(this.movementOrTexture.getTexture(e,"t")),r.push("uv"),r.push(this.cropOrOffset.build(e,"f")),this.mat&&r.push(this.mat.build(e,"mat3"));break}case"noise":{let s=["simplexPrecise","simplexFractal","simplexAshima","fbm","perlin","voronoi"][this.noiseFunctionIndex.value],a=new Pe(`vec3 orthogonal(vec3 v) { 4964 return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y)); 4965 }`),n=s=="voronoi"?` 4966 float v = ${s}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1), voronoiStyle, smoothness, seed, quality); 4967 v = remap(v, lowCut, highCut, 0.0, 1.0); 4968 v = smax(v, 0.0, smoothness * 0.25); 4969 v = smin(v, 1.0, smoothness * 0.25); 4970 4971 return p + n * v * intensity; 4972 `:` 4973 return p + n * ${s}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1)) * intensity; 4974 `,o=new Pe(`vec3 distorted(vec3 p, vec3 n, float scale, float intensity, vec3 offset, float neighbour_offset, float movement, int voronoiStyle, float smoothness, float seed, float highCut, float lowCut, int quality) { 4975 ${n} 4976 }`,[Gr.simplexPrecise,Gr.simplexFractal,Gr.simplexAshima,Gr.fbm,Gr.perlin,Gr.voronoi]),l=new Pe(`vec3 vertexDisplacementNoise(vec3 position, vec3 normal, float scale, vec3 offset, float movement, int voronoiStyle, float smoothness, float seed, float highCut, float lowCut, int quality, float intensity, out vec3 displaced_normal) { 4977 vec3 displaced_position = distorted(position, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality); 4978 vec3 tangent1 = orthogonal(normal); 4979 vec3 tangent2 = normalize(cross(normal, tangent1)); 4980 4981 // TODO(Max): The distance to the neighbors was originally scaled by 0.1. 4982 // This caused some small oval/circular visual artifacts in the lighting. 4983 // For now, simply using neighbors further away betters the problem, 4984 // but we should figure out the underlying cause when we have some time. 4985 // Maybe its related to how we calculate the tangent and bitangent? 4986 vec3 nearby1 = position + tangent1; 4987 vec3 nearby2 = position + tangent2; 4988 vec3 distorted1 = distorted(nearby1, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality); 4989 vec3 distorted2 = distorted(nearby2, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality); 4990 displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));
4991 return displaced_position; 4992 }`,[o,a]);i=e.include(l),r.push(this.scale.build(e,"f")),r.push(this.cropOrOffset.build(e,"v3")),r.push(this.movementOrTexture.build(e,"f")),r.push(this.voronoiStyle.build(e,"i")),r.push(this.smoothness.build(e,"f")),r.push(this.seed.build(e,"f")),r.push(this.highCut.build(e,"f")),r.push(this.lowCut.build(e,"f")),r.push(this.quality.build(e,"i"));break}}return r.push(this.intensity.build(e,"f")),r.push("displaced_normal"),e.format(i+"("+r.join(",")+")",this.getType(e),t)}else return console.warn("VertexDisplacementNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}},VT=NT;VT.Nodes=(function(){let e=new Pe(`vec3 orthogonal(vec3 v) { 4993 return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y)); 4994 }`),t=new Pe(`float displacementMapTexture(sampler2D tex, float crop, vec2 uv, mat3 mat, vec2 offset) { 4995 vec2 uvs = (mat * vec3(uv * 2.0 - 1.0, 1.0) / 2.0 + 0.5).xy + offset; 4996 vec4 tmp = texture2D(tex, uvs); 4997 vec3 col = tmp.rgb; 4998 if (crop > 0.5) { 4999 if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 ) { 5000 return 0.0; 5001 } 5002 } 5003 return col.r; 5004 }`);return{map:new Pe(`vec3 vertexDisplacementMap(vec3 position, vec3 normal, sampler2D tex, vec2 uv, float crop, mat3 mat, float intensity, out vec3 displaced_normal) { 5005 vec3 displaced_position = position + normal * displacementMapTexture(tex, crop, uv, mat, vec2(0.0)) * intensity; 5006 vec3 tangent1 = normalize(orthogonal(normal)); 5007 vec3 tangent2 = normalize(cross(normal, tangent1)); 5008 vec3 nearby1 = position + tangent1 * 0.1; 5009 vec3 nearby2 = position + tangent2 * 0.1; 5010 vec3 distorted1 = nearby1 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity; 5011 vec3 distorted2 = nearby2 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity; 5012 displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position)); 5013 return displaced_position; 5014 }`,[e,t])}})();var Ye={normalRenderTarget:new tn,normalRenderTargetDepth:new tn,transmissionRenderTarget:new tn,aspectRatio:new dr,transmissionSize:new dr(2048,2048),transmissionRenderTargetDepth:new tn,aoRenderTarget:new tn,aoEnabled:new Sr,pixelRatioNode:new Be(1),resolution:new dr,penumbraSize:new Do(5,.5),frameIndex:new Yt(0),transmissionLod:new Yt(2),taaEnabled:new Sr(!0)};for(let e of Object.values(Ye))e.isRenderGlobal=!0;var jT={skiaWasmUrl:"https://unpkg.com/@splinetool/[email protected]/build/ui.wasm"},gx=class extends ji{constructor(){super("basic"),this.nodeType="Basic",this.color=new gi(ss),this.shadingAlpha=new Be(1),this.shadingBlend=new Yt(0),this.previousModelViewMatrix=new Ma,this.previouseProjectionMatrix=new Ma}get category(){return"phong"}generate(e){let t;if(e.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:Ye.frameIndex}),e.mergeUniform({resolution:Ye.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(Vh.merge([Ce.fog])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>"].join(` 5015`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",` 5016 #include <skinbase_vertex> 5017 #include <skinnormal_vertex> 5018 #if !defined( USE_LAYER_DISPLACE ) 5019 #include <defaultnormal_vertex> 5020 #endif 5021 5022 vec3 displaced_position = position; 5023 vec3 displaced_normal = normal; 5024 5025 #if defined( USE_LAYER_DISPLACE ) 5026 vec3 transformed; 5027 vec3 transformedNormal; 5028 #endif 5029 `,"#include <normal_vertex>",` 5030 #if !defined( USE_LAYER_DISPLACE ) 5031 #include <begin_vertex> 5032 #endif /* !USE_LAYER_DISPLACE */ 5033 `];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5033":""),r.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),r.push("#include <project_vertex>","#include <fog_vertex>","#include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;","#include <worldpos_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(` 5034`)}else{this.color===void 0&&(this.color=new gi(ss)),this.color.analyze(e,{slot:"color"}),this.alpha&&this.alpha.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"});let i=this.color.flow(e,"c",{slot:"color"}),r=this.alpha?this.alpha.flow(e,"f"):void 0,s=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0,a=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0;e.requires.transparent=r!==void 0,e.addParsCode(["varying vec3 vWPosition;","#include <fog_pars_fragment>","#include <dithering_pars_fragment>","varying vec3 vViewPosition;","#include <normal_pars_fragment>"].join(` 5035`));let n=["#include <normal_fragment_begin>",i.code];r&&n.push(r.code,"#ifdef ALPHATEST"," if ( "+r.result+" <= ALPHATEST ) discard;","#endif"),a?n.push(a.code,`vec3 outgoingLight = ${i.result};`,`vec3 finalColor = spe_blend(outgoingLight, ${a.result}, 1.0, SPE_BLENDING_NORMAL);`):n.push(`vec3 finalColor = ${i.result};`);let o="1.0";this.mask&&(this.mask.analyze(e),o=`luminance(${this.mask.flow(e,"v3").result})`),r?n.push(`gl_FragColor = vec4( finalColor, accumAlpha * ${r.result} * ${o} );`):n.push("gl_FragColor = vec4("+i.result+", 1.0 );"),s&&n.push(`gl_FragColor.a *= ${s.result};`),n.push("#include <fog_fragment>","#include <dithering_fragment>"),t=n.join(` 5036`)}return t}},tq=class extends ji{constructor(){super("lambert"),this.nodeType="Lambert",this.color=new gi(ss),this.emissive=new gi(0),this.emissiveIntensity=new Be(1),this.previousModelViewMatrix=new Ma,this.previouseProjectionMatrix=new Ma,this.shadingAlpha=new Be(1),this.shadingBlend=new Yt(0),this.occlusion=new Sr(!0)}get category(){return"lambert"}build(e){let t;if(e.define("LAMBERT"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:Ye.frameIndex}),e.mergeUniform({resolution:Ye.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(Vh.merge([Ce.fog,Ce.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED"," #define DOUBLE_SIDED","#endif","#ifdef DOUBLE_SIDED"," varying vec3 vLightBack;"," varying vec3 vIndirectBack;","#endif","#include <bsdfs>","#include <lights_pars_begin>","#include <color_pars_vertex>","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(` 5037`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",` 5038 #include <skinbase_vertex> 5039 #include <skinnormal_vertex> 5040 #ifndef USE_LAYER_DISPLACE 5041 #include <defaultnormal_vertex> 5042 #endif 5043 5044 vec3 displaced_position = position; 5045 vec3 displaced_normal = objectNormal; 5046 5047 #ifdef USE_LAYER_DISPLACE 5048 vec3 transformed; 5049 vec3 transformedNormal; 5050 #endif 5051 `,"#include <normal_vertex>",` 5052 #ifndef USE_LAYER_DISPLACE 5053 #include <begin_vertex> 5054 #endif 5055 `];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5055":""),r.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),r.push(" #include <project_vertex>"," #include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;"," #include <worldpos_vertex>",` 5056 vec3 diffuse = vec3( 1.0 ); 5057 GeometricContext geometry; 5058 geometry.position = mvPosition.xyz; 5059 geometry.normal = normalize( transformedNormal ); 5060 geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz ); 5061 `),r.push(` 5062 GeometricContext backGeometry; 5063 backGeometry.position = geometry.position; 5064 backGeometry.normal = -geometry.normal; 5065 backGeometry.viewDir = geometry.viewDir; 5066 vLightFront = vec3( 0.0 ); 5067 vIndirectFront = vec3( 0.0 ); 5068 #ifdef DOUBLE_SIDED 5069 vLightBack = vec3( 0.0 ); 5070 vIndirectBack = vec3( 0.0 ); 5071 #endif 5072 IncidentLight directLight; 5073 float dotNL; 5074 vec3 directLightColor_Diffuse; 5075 vIndirectFront += getAmbientLightIrradiance( ambientLightColor ); 5076 vIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal ); 5077 #ifdef DOUBLE_SIDED 5078 vIndirectBack += getAmbientLightIrradiance( ambientLightColor ); 5079 vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal ); 5080 #endif 5081 #if NUM_POINT_LIGHTS > 0 5082 #pragma unroll_loop_start 5083 for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { 5084 getPointLightInfo( pointLights[ i ], geometry, directLight ); 5085 dotNL = dot( geometry.normal, directLight.direction ); 5086 directLightColor_Diffuse = directLight.color; 5087 vLightFront += saturate( dotNL ) * directLightColor_Diffuse; 5088 #ifdef DOUBLE_SIDED 5089 vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; 5090 #endif 5091 } 5092 #pragma unroll_loop_end 5093 #endif 5094 #if NUM_SPOT_LIGHTS > 0 5095 #pragma unroll_loop_start 5096 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { 5097 getSpotLightInfo( spotLights[ i ], geometry, directLight ); 5098 dotNL = dot( geometry.normal, directLight.direction ); 5099 directLightColor_Diffuse = directLight.color; 5100 vLightFront += saturate( dotNL ) * directLightColor_Diffuse; 5101 #ifdef DOUBLE_SIDED 5102 vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; 5103 #endif 5104 } 5105 #pragma unroll_loop_end 5106 #endif 5107 #if NUM_DIR_LIGHTS > 0 5108 #pragma unroll_loop_start 5109 for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { 5110 getDirectionalLightInfo( directionalLights[ i ], geometry, directLight ); 5111 dotNL = dot( geometry.normal, directLight.direction ); 5112 directLightColor_Diffuse = directLight.color; 5113 vLightFront += saturate( dotNL ) * directLightColor_Diffuse; 5114 #ifdef DOUBLE_SIDED 5115 vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; 5116 #endif 5117 } 5118 #pragma unroll_loop_end 5119 #endif 5120 #if NUM_HEMI_LIGHTS > 0 5121 #pragma unroll_loop_start 5122 for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { 5123 vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); 5124 #ifdef DOUBLE_SIDED 5125 vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal ); 5126 #endif 5127 } 5128 #pragma unroll_loop_end 5129 #endif 5130 `," #include <shadowmap_vertex>"," #include <fog_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(` 5131`)}else{e.mergeUniform({penumbraSize:Ye.penumbraSize}),e.mergeUniform({frameIndex:Ye.frameIndex}),e.mergeUniform({aoMap:Ye.aoRenderTarget}),e.mergeUniform({aoEnabled:Ye.aoEnabled}),this.color===void 0&&(this.color=new gi(ss)),this.color.analyze(e,{slot:"color"}),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let i=this.color.flow(e,"c",{slot:"color"}),r=this.emissive.flow(e,"c",{slot:"emissive"}),s=this.emissiveIntensity.flow(e,"f",{slot:"emissive"}),a=this.occlusion.flow(e,"b",{slot:"occlusion"}
vendor: 4,562 bytes, lines 5131-5178
5131),n=this.shadingAlpha.flow(e,"f"),o=this.shadingBlend.flow(e,"i"),l=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,h=this.alpha?this.alpha.flow(e,"f"):void 0,c=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0;e.requires.transparent=h!==void 0,e.addParsCode(["uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","varying vec3 vViewPosition;","varying vec3 vWPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED"," #define DOUBLE_SIDED","#endif","#include <normal_pars_fragment>","#ifdef DOUBLE_SIDED"," varying vec3 vLightBack;"," varying vec3 vIndirectBack;","#endif","#include <bsdfs>","#include <lights_pars_begin>","#include <fog_pars_fragment>","#include <shadowmap_pars_fragment>","#include <shadowmask_pars_fragment>","#include <clipping_planes_pars_fragment>","#include <dithering_pars_fragment>"].join(` 5132`));let u=["#include <normal_fragment_begin>",` 5133 // NOTE: gl_FrontFacing alternative using face normal estimation. 5134 vec3 viewdx = dFdx(vViewPosition); 5135 vec3 viewdy = dFdy(vViewPosition); 5136 vec3 faceNormal = normalize(cross(viewdx, viewdy)); 5137 bool isFrontFacing = (dot(normal, faceNormal) >= 0.0); 5138 `,"#include <clipping_planes_fragment>"];u.push(i.code,"vec3 diffuseColor = "+i.result+";","ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );"),h&&u.push(h.code,"#ifdef ALPHATEST","if ( "+h.result+" <= ALPHATEST ) discard;","#endif"),u.push("#ifdef DOUBLE_SIDED"," reflectedLight.indirectDiffuse += ( isFrontFacing ) ? vIndirectFront : vIndirectBack;","#else"," reflectedLight.indirectDiffuse += vIndirectFront;","#endif","#include <lightmap_fragment>","reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );","#ifdef DOUBLE_SIDED"," reflectedLight.directDiffuse = ( isFrontFacing ) ? vLightFront : vLightBack;","#else"," reflectedLight.directDiffuse = vLightFront;","#endif","reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();"),r&&u.push(r.code,"reflectedLight.directDiffuse += "+r.result+" * "+s.result+";"),u.push("vec3 ao = aoEnabled && "+a.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = (reflectedLight.directDiffuse + reflectedLight.indirectDiffuse) ;");let d="1.0";this.mask&&(this.mask.analyze(e),d=`luminance(${this.mask.flow(e,"v3").result})`),u.push(` 5139 if (outgoingLight != diffuseColor) { 5140 float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 ); 5141 accumAlpha += ( 1.0 - accumAlpha ) * ${n.result} * ${d} * lightAccu; 5142 outgoingLight = spe_blend( diffuseColor, outgoingLight, ${n.result} * ${d}, ${o.result} ); 5143 5144 outgoingLight *= ao; 5145 } 5146 `),l&&u.push(l.code,`outgoingLight = spe_blend(outgoingLight, ${l.result}, 1.0, SPE_BLENDING_NORMAL);`),h?u.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${h.result} );`):u.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),c&&u.push(`gl_FragColor.a *= ${c.result};`),u.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=u.join(` 5147`)}return t}},kh=(function(){let e=new Pe(`vec2 dHdxy(sampler2D bumpMap, vec2 bumpMapUv, float bumpScale) { 5148 5149 // Gradient of UVs w.r.t. X coordinate (in screen-space) 5150 vec2 dSTdx = dFdx(bumpMapUv); 5151 5152 // Gradient of UVs w.r.t. Y coordinate (in screen-space) 5153 vec2 dSTdy = dFdy(bumpMapUv); 5154 5155 // Forward differencing 5156 float Hll = bumpScale * luminance(texture(bumpMap, bumpMapUv).rgb); 5157 float dBx = bumpScale * luminance(texture(bumpMap, bumpMapUv + dSTdx).rgb) - Hll; 5158 float dBy = bumpScale * luminance(texture(bumpMap, bumpMapUv + dSTdy).rgb) - Hll; 5159 5160 return vec2( dBx, dBy ); 5161 }`),t=new Pe(`vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) { 5162 vec3 vSigmaX = dFdx( surf_pos.xyz ); 5163 vec3 vSigmaY = dFdy( surf_pos.xyz ); 5164 vec3 vN = surf_norm; // normalized 5165 5166 vN = normalize(vN); 5167 5168 vec3 R1 = cross( vSigmaY, vN ); 5169 vec3 R2 = cross( vN, vSigmaX ); 5170 5171 R1 = normalize(R1); 5172 R2 = normalize(R2); 5173 5174 float fDet = dot( vSigmaX, R1 ) * faceDirection; 5175 5176 vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); 5177 return normalize( abs( fDet ) * vN - vGrad ); 5178 }`);
vendor: 1,698 bytes, lines 5178-5197
5178return{dHdxy:e,perturbNormalArb:t}})(),iq=class extends ji{constructor(){super("phong"),this.nodeType="Phong",this.color=new gi(ss),this.specular=new gi(1118481),this.shininess=new Be(30),this.previousModelViewMatrix=new Ma,this.previouseProjectionMatrix=new Ma,this.shadingAlpha=new Be(1),this.shadingBlend=new Yt(0),this.occlusion=new Sr(!0)}get category(){return"phong"}build(e){let t;if(e.define("PHONG"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:Ye.frameIndex}),e.mergeUniform({resolution:Ye.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(Vh.merge([Ce.fog,Ce.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(` 5179`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",` 5180 #include <skinbase_vertex> 5181 #include <skinnormal_vertex> 5182 #ifndef USE_LAYER_DISPLACE 5183 #include <defaultnormal_vertex> 5184 #endif 5185 5186 vec3 displaced_position = position; 5187 vec3 displaced_normal = objectNormal; 5188 5189 #ifdef USE_LAYER_DISPLACE 5190 vec3 transformed; 5191 vec3 transformedNormal; 5192 #endif 5193 `,"#include <normal_vertex>",` 5194 #ifndef USE_LAYER_DISPLACE 5195 #include <begin_vertex> 5196 #endif 5197 `];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5197":""),r.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),r.push(" #include <project_vertex>"," #include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;"," #include <worldpos_vertex>"," #include <shadowmap_vertex>"," #include <fog_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(` 5198`)}else{e.mergeUniform({penumbraSize:Ye.penumbraSize}),e.mergeUniform({frameIndex:Ye.frameIndex}),e.mergeUniform({aoMap:Ye.aoRenderTarget}),e.mergeUniform({aoEnabled:Ye.aoEnabled}),this.color===void 0&&(this.color=new gi(ss)),this.color.analyze(e,{slot:"color"}),this.specular.analyze(e),this.shininess.analyze(e);let i=this.occlusion.flow(e,"b",{slot:"occlusion"});this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let r=this.color.flow(e,"c",{slot:"color"}),s=this.specular.flow(e,"c"),a=this.shininess.flow(e,"f"),n=this.shadingAlpha.flow(e,"f"),o=this.shadingBlend.flow(e,"i"),l=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,h=this.alpha?this.alpha.flow(e,"f"):void 0,c=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0;e.requires.transparent=h!==void 0,e.addParsCode(["varying vec3 vWPosition;","uniform vec3 emissive;","uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","#include <normal_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <lights_phong_pars_fragment>","#include <shadowmap_pars_fragment>","#include <dithering_pars_fragment>"].join(` 5199`));let u=["#include <normal_fragment_begin>",` 5200 // NOTE: gl_FrontFacing alternative using face normal estimation. 5201 vec3 viewdx = dFdx(vViewPosition); 5202 vec3 viewdy = dFdy(vViewPosition); 5203 vec3 faceNormal = normalize(cross(viewdx,viewdy)); 5204 if (dot(normal, faceNormal) < 0.0) { 5205 normal *= -1.0; 5206 } 5207 `," BlinnPhongMaterial material;"];if(this.bumpMap){e.include(kh.dHdxy),e.include(kh.perturbNormalArb);let p=this.bumpMap.texture.flow(e,"t"),f=this.bumpMap.flow(e,"v3"),m=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",g="";this.bumpMap.projection.value===4?g=` 5208 vec3 bumpNormal = vec3(0.0); 5209 { 5210 vec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0; 5211 vec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1; 5212 vec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2; 5213 vec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights; 5214 5215 vec2 grad0 = dHdxy(${p.result}, uv0, ${m}); 5216 vec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection); 5217 5218 vec2 grad1 = dHdxy(${p.result}, uv1, ${m}); 5219 vec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection); 5220 5221 vec2 grad2 = dHdxy(${p.result}, uv2, ${m}); 5222 vec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection); 5223 5224 bumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y; 5225 bumpNormal = normalize(bumpNormal); 5226 } 5227 5228 normal = bumpNormal; 5229 `:g=` 5230 vec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs; 5231 vec2 grad = dHdxy(${p.result}, bumpMapCachedUv, ${m}); 5232 normal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection ); 5233 `,u.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates 5234 ${f.result}; 5235 ${g} 5236 `)}u.push(r.code," vec3 diffuseColor = "+r.result+";"," ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );"," vec3 totalEmissiveRadiance = emissive;",s.code," vec3 specular = "+s.result+";",a.code," float shininess = max( 0.0001, "+a.result+" );"," float specularStrength = 1.0;"),h&&u.push(h.code,"#ifdef ALPHATEST","if ( "+h.result+" <= ALPHATEST ) discard;","#endif"),u.push("material.diffuseColor = diffuseColor;"),u.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include <lights_fragment_begin>","#include <lights_fragment_end>"),u.push("vec3 ao = aoEnabled && "+i.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = ((reflectedLight.directDiffuse + reflectedLight.indirectDiffuse)) + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;");let d="1.0";this.mask&&(this.mask.analyze(e),d=`luminance(${this.mask.flow(e,"v3").result})`),u.push(` 5237 if (outgoingLight != diffuseColor) { 5238 float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 ); 5239 accumAlpha += ( 1.0 - accumAlpha ) * ${n.result} * ${d} * lightAccu; 5240 outgoingLight = spe_blend( diffuseColor, outgoingLight, ${n.result} * ${d}, ${o.result} ); 5241 5242 outgoingLight *= ao; 5243 } 5244 `),l&&u.push(l.code,`outgoingLight = spe_blend(outgoingLight, ${l.result}, 1.0, SPE_BLENDING_NORMAL);`),h?u.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${h.result});`):u.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),c&&u.push(`gl_FragColor.a *= ${c.result};`),u.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=u.join(` 5245`)}return t}},rq=class extends ji{constructor(){super("standard"),this.nodeType="Standard",this.color=new gi(ss),this.roughness=new Be(.3),this.metalness=new Be(0),this.reflectivity=new Be(.5),this.previousModelViewMatrix=new Ma,this.previouseProjectionMatrix=new Ma,this.shadingAlp
vendor: 1,586 bytes, lines 5245-5264
5245ha=new Be(1),this.shadingBlend=new Yt(0),this.occlusion=new Sr(!0)}get category(){return"physical"}build(e){let t;if(e.define("STANDARD"),e.requires.lights=!0,e.extensions.derivatives=!0,e.extensions.shaderTextureLOD=!0,e.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:Ye.frameIndex}),e.mergeUniform({resolution:Ye.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(Vh.merge([Ce.fog,Ce.lights])),Ce.LTC_1&&(e.uniforms.ltc_1={value:void 0},e.uniforms.ltc_2={value:void 0}),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(` 5246`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",` 5247 #include <skinbase_vertex> 5248 #include <skinnormal_vertex> 5249 #if !defined( USE_LAYER_DISPLACE ) 5250 #include <defaultnormal_vertex> 5251 #endif 5252 5253 vec3 displaced_position = position; 5254 vec3 displaced_normal = objectNormal; 5255 5256 #if defined( USE_LAYER_DISPLACE ) 5257 vec3 transformed; 5258 vec3 transformedNormal; 5259 #endif 5260 `,"#include <normal_vertex>",` 5261 #if !defined( USE_LAYER_DISPLACE ) 5262 #include <begin_vertex> 5263 #endif /* !USE_LAYER_DISPLACE */ 5264 `];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5264":""),r.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),r.push("#include <project_vertex>","#include <fog_vertex>","#include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;","#include <worldpos_vertex>","#include <shadowmap_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(` 5265`)}else{e.mergeUniform({penumbraSize:Ye.penumbraSize}),e.mergeUniform({frameIndex:Ye.frameIndex}),e.mergeUniform({aoMap:Ye.aoRenderTarget}),e.mergeUniform({aoEnabled:Ye.aoEnabled});let i={gamma:!0};this.color===void 0&&(this.color=new gi(ss)),this.color.analyze(e,{slot:"color",context:i}),this.roughness.analyze(e),this.metalness.analyze(e);let r=this.occlusion.flow(e,"b",{slot:"occlusion"});this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e),this.reflectivity&&this.reflectivity.analyze(e);let s=this.color.flow(e,"c",{slot:"color",context:i}),a=this.roughness.flow(e,"f"),n=this.metalness.flow(e,"f"),o=this.shadingAlpha.flow(e,"f"),l=this.shadingBlend.flow(e,"i"),h=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,c=this.alpha?this.alpha.flow(e,"f"):void 0,u=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0,d=this.reflectivity?this.reflectivity.flow(e,"f"):void 0;e.requires.transparent=c!==void 0,e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","#include <normal_pars_fragment>","#include <dithering_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <lights_physical_pars_fragment>","#include <shadowmap_pars_fragment>"].join(` 5266`));let p=["#include <clipping_planes_fragment>"," #include <normal_fragment_begin>",` 5267 // NOTE: gl_FrontFacing alternative using face normal estimation. 5268 vec3 viewdx = dFdx(vViewPosition); 5269 vec3 viewdy = dFdy(vViewPosition); 5270 vec3 faceNormal = normalize(cross(viewdx,viewdy)); 5271 if (dot(normal, faceNormal) < 0.0) { 5272 normal *= -1.0; 5273 } 5274 `," PhysicalMaterial material;"," material.diffuseColor = vec3( 1.0 );"];if(this.bumpMap){e.include(kh.dHdxy),e.include(kh.perturbNormalArb);let m=this.bumpMap.texture.flow(e,"t"),g=this.bumpMap.flow(e,"v3"),v=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",y="";this.bumpMap.projection.value===4?y=` 5275 vec3 bumpNormal = vec3(0.0); 5276 { 5277 vec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0; 5278 vec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1; 5279 vec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2; 5280 vec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights; 5281 5282 vec2 grad0 = dHdxy(${m.result}, uv0, ${v}); 5283 vec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection); 5284 5285 vec2 grad1 = dHdxy(${m.result}, uv1, ${v}); 5286 vec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection); 5287 5288 vec2 grad2 = dHdxy(${m.result}, uv2, ${v}); 5289 vec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection); 5290 5291 bumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y; 5292 bumpNormal = normalize(bumpNormal); 5293 } 5294 5295 normal = bumpNormal; 5296 `:y=` 5297 vec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs; 5298 vec2 grad = dHdxy(${m.result}, bumpMapCachedUv, ${v}); 5299 normal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection ); 5300 `,p.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates 5301 ${g.result}; 5302 ${y} 5303 `)}if(p.push(s.code," vec3 diffuseColor = "+s.result+";"," ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",n.code," float metalnessFactor = "+n.result+";"),this.roughnessMap){let m=this.roughnessMap.texture.flow(e,"t"),g=this.roughnessMap.flow(e,"v3"),v="";this.roughnessMap.projection.value===4?v=` 5304 float roughnessChange = 1.0; 5305 { 5306 vec2 uv0 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs0; 5307 vec2 uv1 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs1; 5308 vec2 uv2 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs2; 5309 vec3 weights = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_triplanarWeights; 5310 5311 float r0 = luminance(texture(${m.result}, uv0).rgb) * roughnessScale; 5312 float r1 = luminance(texture(${m.result}, uv1).rgb) * roughnessScale; 5313 float r2 = luminance(texture(${m.result}, uv2).rgb) * roughnessScale; 5314 5315 roughnessChange = (r0 * weights.z + r1 * weights.x + r2 * weights.y); 5316 } 5317 float roughnessFactor = roughnessChange * ${a.result}; 5318 `:v=` 5319 vec2 roughnessMapCachedUv = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs; 5320 5321 vec4 vals = texture(${m.result}, roughnessMapCachedUv); 5322 float roughnessFactor = luminance(vals.rgb) * ${a.result}; 5323 `,p.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates 5324 ${g.result}; 5325 5326 const float roughnessScale = 1.0; 5327 5328 ${v} 5329 `)}else p.push(a.code," float roughnessFactor = "+a.result+";");c&&p.push(c.code,"#ifdef ALPHATEST"," if ( "+c.result+" <= ALPHATEST ) discard;","#endif"),p.push("vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );"),p.push("material.diffuseColor = diffuseColor * ( 1.0 - metalnessFactor );","material.roughness = max( roughnessFactor, 0.0525 );","material.roughness += geometryRoughness;","material.roughness = min( material.roughness, 1.0 );","material.roughness = clamp( roughnessFactor, 0.04, 1.0 );"),d?p.push(d.code,"material.specularColor = mix( vec3( 0.16 * pow2( "+d.result+" ) ), diffuseColor, metalnessFactor );"):p.push("material.specularColor = mix( vec3( 0.04 ), diffuseColor, metalnessFactor );"),p.push("#include <lights_fragment_begin>"),p.push("#include <lights_fragment_end>"),p.push("vec3 ao = aoEnabled && "+r.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = ((reflectedLight.directDiffuse + reflectedLight.indirectDiffuse)) + reflectedLight.directSpecular + reflectedLight.indirectSpecular;");let f="1.0";this.mask&&(this.mask.analyze(e),f=`luminance(${this.mask.flow(e,"v3").result})`),p.push(` 5330 if (outgoingLight != diffuseColor) { 5331 float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 ); 5332 accumAlpha += ( 1.0 - accumAlpha ) * ${o.result} * ${f} * lightAccu; 5333 outgoingLight = spe_blend( diffuseColor, outgoingLight, ${o.result} * ${f}, ${l.result} ); 5334 5335 outgoingLight *= ao; 5336 } 5337 `),h&&p.push(h.code,`outgoingLight = spe_blend(outgoingLight, ${h.result}, 1.0, SPE_BLENDING_NORMAL);`),c?p.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${c.result} );`):p.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),u&&p.push(`gl_FragColor.a *= ${u.result};`),p.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=p.join(` 5338`)}return t}},sq=class extends ji{constructor(){super("toon"),this.nodeType="Toon",this.color=new gi(ss),this.specular=new gi(1118481),this.shininess=new Be(30),this.previousModelViewMatrix=new Ma,this.previouseProjectionMatrix=new Ma,this.shadingAlp
vendor: 1,393 bytes, lines 5338-5357
5338ha=new Be(1),this.shadingBlend=new Yt(0)}get category(){return"toon"}build(e){let t;if(e.define("TOON"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){let i=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform({frameIndex:Ye.frameIndex}),e.mergeUniform({resolution:Ye.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(Vh.merge([Ce.fog,Ce.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vWPosition;","#include <fog_pars_vertex>","#include <skinning_pars_vertex>","#include <normal_pars_vertex>","#include <morphtarget_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(` 5339`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",` 5340 #include <skinbase_vertex> 5341 #include <skinnormal_vertex> 5342 #ifndef USE_LAYER_DISPLACE 5343 #include <defaultnormal_vertex> 5344 #endif 5345 5346 vec3 displaced_position = position; 5347 vec3 displaced_normal = objectNormal; 5348 5349 #ifdef USE_LAYER_DISPLACE 5350 vec3 transformed; 5351 vec3 transformedNormal; 5352 #endif 5353 `,"#include <normal_vertex>",` 5354 #ifndef USE_LAYER_DISPLACE 5355 #include <begin_vertex> 5356 #endif 5357 `];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5357":""),r.push("transformed = displaced_position;","#include <morphtarget_vertex>","#include <skinning_vertex>","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),r.push(" #include <project_vertex>"," #include <fog_vertex>"," #include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;"," #include <worldpos_vertex>"," #include <shadowmap_vertex>"," #include <fog_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(` 5358`)}else{e.mergeUniform({penumbraSize:Ye.penumbraSize}),e.mergeUniform({frameIndex:Ye.frameIndex}),e.mergeUniform({aoMap:Ye.aoRenderTarget}),e.mergeUniform({aoEnabled:Ye.aoEnabled}),this.color===void 0&&(this.color=new gi(ss)),this.color.analyze(e,{slot:"color"}),this.specular.analyze(e),this.shininess.analyze(e),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let i=this.color.flow(e,"c",{slot:"color"}),r=this.specular.flow(e,"c"),s=this.shininess.flow(e,"f"),a=this.shadingAlpha.flow(e,"f"),n=this.shadingBlend.flow(e,"i"),o=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,l=this.alpha?this.alpha.flow(e,"f"):void 0,h=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0;e.requires.transparent=l!==void 0,e.addParsCode(["uniform float penumbraSize[5];","uniform sampler2D aoMap;","uniform bool aoEnabled;","varying vec3 vWPosition;","#include <normal_pars_fragment>","#include <gradientmap_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <dithering_pars_fragment>",` 5359 varying vec3 vViewPosition; 5360 struct ToonMaterial { 5361 vec3 diffuseColor; 5362 vec3 specularColor; 5363 float specularShininess; 5364 float specularStrength; 5365 }; 5366 void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 5367 vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; 5368 5369 reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 5370 reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; 5371 } 5372 void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { 5373 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); 5374 } 5375 #define RE_Direct RE_Direct_Toon 5376 #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon 5377 #define Material_LightProbeLOD( material ) (0) 5378 `,"#include <shadowmap_pars_fragment>","#include <bumpmap_pars_fragment>","#include <normalmap_pars_fragment>"].join(` 5379`));let c=["#include <normal_fragment_begin>",` 5380 // NOTE: gl_FrontFacing alternative using face normal estimation. 5381 vec3 viewdx = dFdx(vViewPosition); 5382 vec3 viewdy = dFdy(vViewPosition); 5383 vec3 faceNormal = normalize(cross(viewdx,viewdy)); 5384 if (dot(normal, faceNormal) < 0.0) { 5385 normal *= -1.0; 5386 } 5387 `," ToonMaterial material;"];if(this.bumpMap){e.include(kh.dHdxy),e.include(kh.perturbNormalArb);let d=this.bumpMap.texture.flow(e,"t"),p=this.bumpMap.flow(e,"v3"),f=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",m="";this.bumpMap.projection.value===4?m=` 5388 vec3 bumpNormal = vec3(0.0); 5389 { 5390 vec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0; 5391 vec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1; 5392 vec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2; 5393 vec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights; 5394 5395 vec2 grad0 = dHdxy(${d.result}, uv0, ${f}); 5396 vec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection); 5397 5398 vec2 grad1 = dHdxy(${d.result}, uv1, ${f});
5399 vec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection); 5400 5401 vec2 grad2 = dHdxy(${d.result}, uv2, ${f}); 5402 vec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection); 5403 5404 bumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y; 5405 bumpNormal = normalize(bumpNormal); 5406 } 5407 5408 normal = bumpNormal; 5409 `:m=` 5410 vec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs; 5411 vec2 grad = dHdxy(${d.result}, bumpMapCachedUv, ${f}); 5412 normal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection ); 5413 `,c.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates 5414 ${p.result}; 5415 ${m} 5416 `)}c.push(i.code," vec3 diffuseColor = "+i.result+";"," ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",r.code," vec3 specular = "+r.result+";",s.code," float shininess = max( 0.0001, "+s.result+" );"," float specularStrength = 1.0;"),l&&c.push(l.code,"#ifdef ALPHATEST","if ( "+l.result+" <= ALPHATEST ) discard;","#endif"),c.push("material.diffuseColor = diffuseColor;"),c.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include <lights_fragment_begin>","#include <lights_fragment_end>"),c.push("vec3 ao = aoEnabled ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = ((reflectedLight.directDiffuse + reflectedLight.indirectDiffuse) * ao) + reflectedLight.directSpecular;");let u="1.0";this.mask&&(this.mask.analyze(e),u=`luminance(${this.mask.flow(e,"v3").result})`),c.push(` 5417 if (outgoingLight != diffuseColor) { 5418 float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 ); 5419 accumAlpha += ( 1.0 - accumAlpha ) * ${a.result} * ${u} * lightAccu; 5420 outgoingLight = spe_blend( diffuseColor, outgoingLight, ${a.result} * ${u}, ${n.result} ); 5421 } 5422 `),o&&c.push(o.code,`outgoingLight = spe_blend(outgoingLight, ${o.result}, 1.0, SPE_BLENDING_NORMAL);`),l?c.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${l.result} );`):c.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),h&&c.push(`gl_FragColor.a *= ${h.result};`),c.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=c.join(` 5423`)}return t}},aq=class{constructor(e=1e3*10){this.timeout=e,this.cache=new Map,this.head={data:null,time:0,src:null,next:null,prev:null},this.tail={data:null,time:1/0,src:null,next:null,prev:null},this.hasClean=!1,this.cleanupTimer=null,this.head.next=this.tail,this.tail.prev=this.head}log(...e){}remove(e){let t=this.cache.get(e);t&&(this.dispose(e,t.data),this.cache.delete(e),t.prev.next=t.next,t.next.prev=t.prev,t.next=null,t.prev=null,t.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let e=Date.now(),t=this.head.next;for(;t.time<e-this.timeout;){this.dispose(t.src,t.data),this.cache.delete(t.src);let i=t;t=t.next,t.prev=this.head,this.head.next=t,i.next=null,i.prev=null,i.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(e){return this.cache.get(e)?.data}load(e){let t=Date.now(),i=this.cache.get(e);return i===void 0?(i={data:this.create(e),src:e,time:t,next:null,prev:null},this.cache.set(e,i)):(i.time=t,i.prev.next=i.next,i.next.prev=i.prev),i.prev=this.tail.prev,i.next=this.tail,this.tail.prev.next=i,this.tail.prev=i,this.scheduleCleanup(),i.data}disposeAll(){this.cleanupTimer!==null&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((e,t)=>{this.dispose(t,e.data),e.next=null,e.prev=null,e.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}},nq=class extends aq{create(e){return URL.createObjectURL(new Blob([e]))}dispose(e,t){URL.revokeObjectURL(t)}},ru;function oq(e){return typeof e=="string"?e:(ru||(ru=new nq),ru.load(e))}function lq(){ru&&ru.disposeAll()}var hq=class{constructor(e,t){this.data=e,this.cache=t,this.refCount=0}deref(){this.refCount,this.refCount-=1,this.refCount===0&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},cq=class{constructor(){this.cache=new Map}remove(e){this.cache.delete(e.data)}load(e){let t=this.cache.get(e);return t===void 0&&(t=this.create(e),this.cache.set(e,t)),t.refCount+=1,t}},HT=class extends hq{constructor(e,t){super(e,t.imageHolderCache),this.data=e,this.shared=t,this.loaded=!1,this.isVideo=!1,this.isBuffer=!1,this._cache={1e3:{},1001:{},1002:{}},this.isVideo=e.type==="video",this.isBuffer=e.isWebGLRenderTarget===!0,this.loadPromise=this.updateSrc(this.isBuffer?e:e.data)}async updateSrc(e){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1;let t=()=>{this.loaded=!0;for(let r of Object.values(this._cache))for(let s of Object.values(r))for(let a of Object.values(s))a&&(a.image=this.img,a.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=e,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInl
5423ine=!0,this.img.currentTime=.01,typeof e!="string"){var i=new FileReader;i.readAsDataURL(new Blob([e],{type:"video/mp4"}));let r;await new Promise(s=>{i.onloadend=a=>{r=a.target?.result,s(null)}}),this.img.src=r}else this.img.src=e;this.img.onloadeddata=()=>{t()}}else this.img=new Image,this.img.src=oq(e),this.img.onload=t,await new Promise(r=>{this.img.onload=()=>{t(),r(null)}})}getTexture(e,t=1008,i=1006){let r=this._cache[e]?.[t]?.[i];if(r)return r;{let s;return this.isBuffer?s=this.img.texture:this.isVideo?s=new Fz(this.img,void 0,e,e):s=new li(this.img,void 0,e,e,i,t),this.loaded&&(s.needsUpdate=!0),this._cache[e]===void 0&&(this._cache[e]={}),this._cache[e][t]===void 0&&(this._cache[e][t]={}),this._cache[e][t][i]=s,s}}setNeedsUpdate(e){for(let t of Object.values(this._cache))for(let i of Object.values(t))for(let r of Object.values(i))r&&(r.needsUpdate=e)}disposeTextures(){for(let[e,t]of Object.entries(this._cache))for(let[i,r]of Object.entries(t))for(let[s,a]of Object.entries(r))a?.dispose(),this._cache[e]!==void 0&&this._cache[e][i]!==void 0&&(this._cache[e][i][s]=void 0)}dispose(){super.dispose(),this.disposeTextures()}},qn=class extends HT{};function uq(e,t){var i=mq(t);return i.formatToParts?pq(i,e):fq(i,e)}var dq={year:0,month:1,day:2,hour:3,minute:4,second:5};function pq(e,t){try{for(var i=e.formatToParts(t),r=[],s=0;s<i.length;s++){var a=dq[i[s].type];a>=0&&(r[a]=parseInt(i[s].value,10))}return r}catch(n){if(n instanceof RangeError)return[NaN];throw n}}function fq(e,t){var i=e.format(t).replace(/\u200E/g,""),r=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(i);return[r[3],r[1],r[2],r[4],r[5],r[6]]}var Qg={};function mq(e){if(!Qg[e]){var t=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:"America/New_York",year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z")),i=t==="06/25/2014, 00:00:00"||t==="‎06‎/‎25‎/‎2014‎ ‎00‎:‎00‎:‎00";Qg[e]=i?new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}return Qg[e]}function GT(e,t,i,r,s,a,n){var o=new Date(0);return o.setUTCFullYear(e,t,i),o.setUTCHours(r,s,a,n),o}var $_=36e5,gq=6e4,Kg={timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-]\d{2}):?(\d{2})$/};function WT(e,t,i){var r,s;if(!e||(r=Kg.timezoneZ.exec(e),r))return 0;var a;if(r=Kg.timezoneHH.exec(e),r)return a=parseInt(r[1],10),eA(a)?-(a*$_):NaN;if(r=Kg.timezoneHHMM.exec(e),r){a=parseInt(r[1],10);var n=parseInt(r[2],10);return eA(a,n)?(s=Math.abs(a)*$_+n*gq,a>0?-s:s):NaN}if(xq(e)){t=new Date(t||Date.now());var o=i?t:vq(t),l=wy(o,e),h=i?l:yq(t,l,e);return-h}return NaN}function vq(e){return GT(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function wy(e,t){var i=uq(e,t),r=GT(i[0],i[1]-1,i[2],i[3]%24,i[4],i[5],0).getTime(),s=e.getTime(),a=s%1e3;return s-=a>=0?a:1e3+a,r-s}function yq(e,t,i){var r=e.getTime(),s=r-t,a=wy(new Date(s),i);if(t===a)return t;s-=a-t;var n=wy(new Date(s),i);return a===n?a:Math.max(a,n)}function eA(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}var tA={};function xq(e){if(tA[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),tA[e]=!0,!0}catch{return!1}}var bq=mo(MD(),1),iA=mo(ED(),1),wq=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,Sq=wq,Zg=36e5,rA=6e4,_q=2,Lr={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:Sq};function Aq(e,t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(e===null)return new Date(NaN);var i={},r=i.additionalDigits==null?_q:(0,bq.default)(i.additionalDigits);if(r!==2&&r!==1&&r!==0)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]")return new Date(e.getTime());if(typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]")return new Date(e);if(!(typeof e=="string"||Object.prototype.toString.call(e)==="[object String]"))return new Date(NaN);var s=Mq(e),a=Eq(s.date,r),n=a.year,o=a.restDateString,l=Cq(o,n);if(isNaN(l))return new Date(NaN);if(l){var h=l.getTime(),c=0,u;if(s.time&&(c=Tq(s.time),isNaN(c)))return new Date(NaN);if(s.timeZone||i.timeZone){if(u=WT(s.timeZone||i.timeZone,new Date(h+c)),isNaN(u))return new Date(NaN)}else u=(0,iA.default)(new Date(h+c)),u=(0,iA.default)(new Date(h+c+u));return new Date(h+c+u)}else return new Date(NaN)}function Mq(e){var t={},i=Lr.dateTimePattern.exec(e),r;if(i?(t.date=i[1],r=i[3]):(i=Lr.datePattern.exec(e),i?(t.date=i[1],r=i[2]):(t.date=null,r=e)),r){var s=Lr.timeZone.exec(r);s?(t.time=r.replace(s[1],""),t.timeZone=s[1].trim()):t.time=r}return t}function Eq(e,t){var i=Lr.YYY[t],r=Lr.YYYYY[t],s;if(s=Lr.YYYY.exec(e)||r.exec(e),s){var a=s[1];return{year:parseInt(a,10),restDateString:e.slice(a.length)}}if(s=Lr.YY.exec(e)||i.exec(e),s){var n=s[1];return{year:parseInt(n,10)*100,restDateString:e.slice(n.length)}}return{year:null}}function Cq(e,t){if(t===null)return null;var i,r,s,a;if(e.length===0)return r=new Date(0),r.setUTCFullYear(t),r;if(i=Lr.MM.exec(e),i)return r=new Date(0),s=parseInt(i[1],10)-1,aA(t,s)?(r.setUTCFullYear(t,s),r):new Date(NaN);if(i=Lr.DDD.exec(e),i){r=new Date(0);var n=parseInt(i[1],10);return Oq(t,n)?(r.setUTCFullYear(t,0,n),r):new Date(NaN)}if(i=Lr.MMDD.exec(e),i){r=new Date(0),s=parseInt(i[1],10)-1;var o=parseInt(i[2],10);return aA(t,s,o)?(r.setUTCFullYear(t,s,o),r):new Date(NaN)}if(i=Lr.Www.exec(e),i)return a=parseInt(i[1],10)-1,nA(t,a)?sA(t,a):new Date(NaN);if(i=Lr.WwwD.exec(e),i){a=parseInt(i[1],10)-1;var l=parseInt(i[2],10)-1;return nA(t,a,l)?sA(t,a,l):new Date(NaN)}return null}function Tq(e){var t,i,r;if(t=Lr.HH.exec(e),t)return i=parseFloat(t[1].replace(",",".")),Jg(i)?i%24*Zg:NaN;if(t=Lr.HHMM.exec(e),t)return i=parseInt(t[1],10),r=parseFloat(t[2].replace(",",".")),Jg(i,r)?i%24*Zg+r*rA:NaN;
5423if(t=Lr.HHMMSS.exec(e),t){i=parseInt(t[1],10),r=parseInt(t[2],10);var s=parseFloat(t[3].replace(",","."));return Jg(i,r,s)?i%24*Zg+r*rA+s*1e3:NaN}return null}function sA(e,t,i){t=t||0,i=i||0;var r=new Date(0);r.setUTCFullYear(e,0,4);var s=r.getUTCDay()||7,a=t*7+i+1-s;return r.setUTCDate(r.getUTCDate()+a),r}var Pq=[31,28,31,30,31,30,31,31,30,31,30,31],Dq=[31,29,31,30,31,30,31,31,30,31,30,31];function qT(e){return e%400===0||e%4===0&&e%100!==0}function aA(e,t,i){if(t<0||t>11)return!1;if(i!=null){if(i<1)return!1;var r=qT(e);if(r&&i>Dq[t]||!r&&i>Pq[t])return!1}return!0}function Oq(e,t){if(t<1)return!1;var i=qT(e);return!(i&&t>366||!i&&t>365)}function nA(e,t,i){return!(t<0||t>52||i!=null&&(i<0||i>6))}function Jg(e,t,i){return!(e!=null&&(e<0||e>=25)||t!=null&&(t<0||t>=60)||i!=null&&(i<0||i>=60))}function Iq(e,t,i){var r=Aq(e,i),s=WT(t,r,!0),a=new Date(r.getTime()-s),n=new Date(0);return n.setFullYear(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()),n.setHours(a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds()),n}function Br(e,t){return t.color(e)}function oA(e=new Date,t){let i=t.format,r=e.getSeconds(),s=e;t&&t.timeZone!==null&&(s=Iq(new Date,t.timeZone));let a=s.getHours(),n=s.getMinutes(),o;t.format12h24h==="12ampm"&&(o=a>=12?"PM":"AM");let l=a;t.format12h24h!=="24"&&(l=a%12,l===0&&(l=12));let h,c;switch(i){case"HH:mm:ss":h=[l,n,r];break;case"HH:mm":h=[l,n];break;case"HH":h=[l],o=void 0;break;case"mm":h=[n],o=void 0;break;case"ss":h=[r],o=void 0;break;case"year":c=s.getFullYear();break;case"month":c=s.getMonth()+1;break;case"dayOfYear":c=Math.floor((s.getTime()-new Date(s.getFullYear(),0,0).getTime())/864e5);break;case"dayOfMonth":c=s.getDate();break;case"secondOfDay":c=a*60*60+n*60+r;break;default:console.error("Unknown time format",i),c=0;break}return h!==void 0?{textValue:h,suffix:o}:c}function Rq(e,t){switch(e.type){case"fresnel":return Bq(e,t);case"gradient":return Fq(e,t);case"depth":return kq(e,t);case"normal":return Uq(e,t);case"noise":return Nq(e,t);case"rainbow":return Vq(e,t);case"toon":return jq(e,t);case"outline":return Hq(e,t);case"transmission":return Gq(e,t);case"pattern":return Wq(e,t);default:return zq(e,t)}}function Lq(e){return{type:e.type}}function Ws(e,t){let{alpha:i,mode:r,isMask:s}=e,a=typeof i=="string"?(Number(t.getVariable(i))??100)/100:i;return{...Lq(e),alpha:a,mode:r,isMask:s}}function zq(e,t){return{...Ws(e,t),color:Br(e.color,t)}}function Bq(e,t){let{bias:i,scale:r,intensity:s,factor:a,color:n}=e;return{...Ws(e,t),color:Br(n,t),bias:i,scale:r,intensity:s,factor:a}}function Fq(e,t){let{gradientType:i,smooth:r,colors:s,steps:a,angle:n,offset:o,morph:l}=e;return{...Ws(e,t),gradientType:i,smooth:r,colors:s.map(h=>new ot(h[0],h[1],h[2],h[3])),num:s.length,steps:a,offset:new H(...o.map(h=>typeof h=="number"?h:0)),morph:new H(...l.map(h=>typeof h=="number"?h:0)),angle:n}}function kq(e,t){let{gradientType:i,near:r,far:s,isVector:a,isWorldSpace:n,origin:o,direction:l,colors:h,steps:c,smooth:u}=e;return{...Ws(e,t),gradientType:i,near:r,far:s,isVector:a,isWorldSpace:n,origin:new M(...o),direction:l?new M(...l):new M(1,0,0),colors:h.map(d=>d!==void 0?new ot(d[0],d[1],d[2],d[3]):new ot(0,0,0,0)),steps:c.slice(0,h.length),smooth:u}}function Uq(e,t){let{cnormal:i}=e;return{...Ws(e,t),cnormal:new M(i[0],i[1],i[2])}}function Nq(e,t){return{...Ws(e,t),scale:e.scale,move:e.move,fA:new H(...e.fA.map(i=>typeof i=="number"?i:0)),fB:new H(...e.fB.map(i=>typeof i=="number"?i:0)),size:new M(...e.size),distortion:new H(...e.distortion.map(i=>typeof i=="number"?i:0)),colorA:Br(e.colorA,t),colorB:Br(e.colorB,t),colorC:Br(e.colorC,t),colorD:Br(e.colorD,t),noiseType:e.noiseType,voronoiStyle:e.voronoiStyle,highCut:e.highCut,lowCut:e.lowCut,smoothness:e.smoothness,seed:e.seed,quality:e.quality}}function Vq(e,t){return{...Ws(e,t),filmThickness:e.filmThickness,movement:e.movement,wavelengths:new M(...e.wavelengths),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:new M(...e.offset)}}function jq(e,t){return{...Ws(e,t),positioning:e.positioning,colors:e.colors.map(i=>new ot(i[0],i[1],i[2],i[3])),num:e.colors.length,steps:e.steps,source:new M(...e.source),isWorldSpace:e.isWorldSpace,noiseStrength:e.n
vendor: 49,190 bytes, lines 5423-5427
5423oiseStrength,noiseScale:e.noiseScale,shadowColor:Br(e.shadowColor,t),offset:new M(...e.offset)}}function Hq(e,t){return{...Ws(e,t),outlineColor:Br(e.outlineColor,t),contourColor:Br(e.contourColor,t),outlineWidth:e.outlineWidth,contourWidth:e.contourWidth,outlineThreshold:e.outlineThreshold,contourThreshold:e.contourThreshold,outlineSmoothing:e.outlineSmoothing,contourFrequency:e.contourFrequency,contourDirection:new M(...e.contourDirection),positionalLines:e.positionalLines,compensation:e.compensation}}function Gq(e,t){return{...Ws(e,t),thickness:e.thickness,ior:e.ior,roughness:e.roughness}}function Wq(e,t){return{...Ws(e,t),style:e.style,projection:e.projection,axis:e.axis,blending:e.blending,offset:new H(...e.offset.map(i=>typeof i=="number"?i:0)),colorA:Br(e.colorA,t),colorB:Br(e.colorB,t),frequency:new H(...e.frequency.map(i=>typeof i=="number"?i:0)),size:e.size,variation:e.variation,smoothness:e.smoothness,zigzag:e.zigzag,rotation:e.rotation,vertical:new H(...e.vertical.map(i=>typeof i=="number"?i:0)),horizontal:new H(...e.horizontal.map(i=>typeof i=="number"?i:0)),sides:e.sides}}var Nf=class extends Wi{},qq={noise:["noiseType"],texture:["projection","axis","side"],video:["projection","axis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"]},Xq={depth:["colors"]};function Yq(e,t,i){if(t==="isMask")return!0;let r=qq[e.type],s=Xq[e.type];if(s!==void 0){let a=e.color;if(s.includes(t)){let n=a[t]?.value?.length;if(n!==void 0&&n!==i.length)return!0}}return r!==void 0?r.includes(t):!1}function $g(e,t){if(Array.isArray(t)){if(!Array.isArray(e)||e.length!==t.length)return!1;for(let[s,a]of t.entries()){let n=e[s];if(typeof a=="string"||typeof a=="number"&&typeof n=="string")return!0}return!1}let i=typeof e=="string",r=typeof t=="string";return i!==r||i&&r}function vx(e,t,i){let r=i.uniforms[`f${i.id}_texture`];if(!r)return!1;let s=!1,a=e;if("image"in a){let n=a.image,o=t.image(n),l=r;l.image instanceof qn||l.image.deref(),l.image=o}if("video"in a){let n=a.video,o=t.video(n),l=r;l.image instanceof qn||l.image.deref(),l.image=o}if("wrapping"in a){let n=r;n.wrap=a.wrapping}if("minFilter"in a){let n=r;n.minFilter=a.minFilter}if("magFilter"in a){let n=r;n.magFilter=a.magFilter}if("rotation"in a&&i.uniforms[`f${i.id}_rotation`])return i.uniforms[`f${i.id}_rotation`].value=(st(a.rotation??0,t)??0)*Te.DEG2RAD,s;if("repeat"in a||"offset"in a||"rotation"in a){let n="mat",o=i.uniforms[`f${i.id}_${n}`];if(!o)return s;if("repeat"in a){let l=a.repeat;$g(i.data.texture.repeat,l)&&(s=!0),o.repeat=su(l,t).map((h,c)=>typeof l[c]=="string"?1/h:h)}if("offset"in a){let l=a.offset;$g(i.data.texture.offset,l)&&(s=!0),o.offset=su(l,t).map((h,c)=>typeof l[c]=="string"?-h:h)}if("rotation"in a){let l=i.data.texture.rotation,h=a.rotation??0;(l===void 0||$g(l,h))&&(s=!0),o.rotation=st(h,t)??0}o.updateMatrix()}return s}function Qq(e,t,i,r){let s=!1;for(let[a,n]of Object.entries(e)){if(a==="bumpMap"||a==="roughnessMap"){s=!0;continue}if(!a||n===void 0)continue;if(YT(a,i,r,t)){a==="visible"&&i.type==="light"&&(s=!0);continue}i.visible=r.visible;let o=i.uniforms[`f${i.id}_${a}`];if(o&&!(o instanceof fx))switch(s=s||Yq(i,a,n),o.constructor){case gi:if(typeof n=="string"){let l=t.getColor(n);l&&(o.value=l);break}else{let l=n;o.value instanceof Nf?o.value=new Wi(l.r,l.g,l.b,l.a):o.setRGBA(l);break}case Ya:if(typeof n=="string"){let l=t.getColor(n);l&&(o.value=l);break}else{let l=n;o.value instanceof Nf?o.value=new Wi(l.r,l.g,l.b,l.a):o.value.setRGBA(l.r,l.g,l.b,l.a);break}case dr:{let l=n;o.value.setX(l[0]),o.value.setY(l[1]);break}case ds:{let l=n;o.value.setX(l[0]),o.value.setY(l[1]),o.value.setZ(l[2]);break}case tn:{vx(n,t,i);break}case Oo:{o.value=n.map(l=>new ot(...l));break}default:{o.value=n;break}}}return s}var sl=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof e=="number"?e*100:e,i)??100)/100))??1,st=(e,t,i)=>typeof e=="number"?e:t.getVariable(e,i),Pn=(e,t)=>(e||(e=new M),e.x=st(e.x,t)??0,e.y=st(e.y,t)??0,e.z=st(e.z,t)??0,e),ka=(e,t)=>(e||(e=new H),e.x=st(e.x,t)??0,e.y=st(e.y,t)??0,e),su=(e,t)=>{let i=e.map(r=>st(r,t)??0);return[i[0],i[1]]},Hu=class{constructor(e,t,i,r,s){this.id=e,this.uuid=t,this.data=i,this.uniforms={};for(let a in r)this.uniforms[`f${this.id}_${a}`]=r[a];for(let a in i)YT(a,this,i,s)}get type(){return this.data.type}static create(e,t,i,r){if(i.type==="light")return la.createLightLayer(e,t,i,r);if(i.type==="texture"||i.type==="video"){let s=i.type==="texture"?r.uiBuffer(i.texture.image)??r.image(i.texture.image):r.video(i.texture.video),a=new yy(s,i.texture.wrapping,i.texture.minFilter??1008,i.texture.magFilter??1006),n=new K7(s),o=new Z7(su(i.texture.repeat,r),su(i.texture.offset,r),st(i.texture.rotation??0,r)),l=new Be(i.crop?1:0),h=new Yt(i.projection??0),c=new Yt(["x","y","z"].indexOf(i.axis)??0),u=new Yt(i.side??0),d=new dr(i.size?new H(...su(i.size,r)):new H(100,100)),p=new Be(i.blending??0),f=new Be(sl(i.alpha,r)),m=new Yt(i.mode??0),g=new Sr(i.isMask??!1),v=new mx(a,n,l,h,c,u,d,p,o,f,m,g),y=new ti(v.calpha,"f");return new pi(e,t,i,{texture:a,textureSize:n,crop:l,projection:h,axis:c,side:u,size:d,blending:p,mat:o,alpha:f,mode:m,isMask:g},v,m,y,g,r)}else if(i.type==="matcap"){let s=r.image(i.texture.image),a=new yy(s,i.texture.wrapping,i.texture.minFilter??1008,i.texture.magFilter??1006),n=new Be(sl(i.alpha,r)),o=new Yt(i.mode??0),l=new Sr(i.isMask??!1),h=new Be((st(i.texture.rotation??0,r)??0)*Te.DEG2RAD),c=new PT(a,n,o,l,h),u=new ti(c.calpha,"f");return new pi(e,t,i,{texture:a,alpha:n,mode:o,isMask:l,rotation:h},c,o,u,l,r)}else if(i.type==="displace")if(i.displacementType==="noise"){let s=new ds(new M(...i.offset.map(g=>st(g,r)??0))),a=new Be(st(i.scale,r)??10),n=new Be(st(i.intensity,r)??8),o=new Be(st(i.movement,r)??1),l=new Yt(i.noiseType??0),h=new Yt(i.voronoiStyle??0),c=new Be(st(i.smoothness,r)??.5),u=new Be(st(i.seed,r)??0),d=new Be(st(i.highCut,r)??1),p=new Be(st(i.lowCut,r)??0),f=new Yt(st(i.quality,r)??1),m=new VT(n,o,s,h,c,u,d,p,f,a,l);return new XT(e,t,i,{offset:s,scale:a,intensity:n,movement:o,noiseType:l,voronoiStyle:h,smoothness:c,seed:u,highCut:d,lowCut:p,quality:f},m,r)}else throw new Error;else return Jq(e,t,i,r)}updateByOp(e,t,i){let r=e,s=!1;if(r.path[0]===void 0){for(let a of Object.keys(r.props))try{let n=this.data[a],o=t[a];if(Array.isArray(n)&&Array.isArray(o)){for(let[l,h]of o.entries()){let c=n[l];if(typeof h=="string"||typeof h=="number"&&typeof c=="string"){s=!0;break}}if(s)break}else if(typeof o=="string"&&typeof n=="number"||typeof o=="number"&&typeof n=="string"||typeof o=="string"&&typeof n=="string"&&o!==n){s=!0;break}}catch(n){console.error(n)}if(r.type===0)return"type"in r.props||"category"in r.props||"visible"in r.props||"noiseType"in r.props?(i.scene.markNeedsUpdateRendererDirty(),!0):Qq(r.props,i.shared,this,t)||s}else if(r.path[0]==="texture")return"texture"in t||"video"in t?vx(r.props,i.shared,this)||s:!0;return s}dispose(){if(Kq(this)){let e=this.uniforms[`f${this.id}_texture`];if(!e)return!1;let t=e;t.image instanceof qn||t.image.deref()}}hasValueByKey(e){return this.uniforms[e]!==void 0}hasValue(e){return this.hasValueByKey(`f${this.id}_${e}`)}setValue(e,t){let i=`f${this.id}_${e}`;this.hasValueByKey(i)&&t!==void 0&&(this.uniforms[i].value=t)}getNode(e){let t=`f${this.id}_${e}`;if(this.hasValueByKey(t))return this.uniforms[t]}getValue(e){let t=`f${this.id}_${e}`;if(this.hasValueByKey(t))return this.uniforms[t].value}getName(e){let t=/f\d+_(.*)/.exec(e);if(t&&t.length>1)return t[1];console.log(`Layer.getName: error ${e}`)}getNames(){let e=[];for(let t in this.uniforms){let i=this.getName(t);i&&e.push(i)}return e}},pi=class extends Hu{constructor(e,t,i,r,s,a,n,o,l){super(e,t,i,r,l),this.params=r,this.color=s,this.mode=a,this.alpha=n,this.isMask=o}},XT=class extends Hu{constructor(e,t,i,r,s,a){super(e,t,i,r,a),this.position=s}},la=class extends Hu{constructor(e,t,i,r,s,a){super(e,t,i,s,a),this.node=r}static createLightLayer(e,t,i,r){let s,a=new Be(sl(i.alpha,r)),n=new Yt(i.mode),o=new Be(i.bumpMapIntensity),l=new Be(sl(i.alphaOverride,r)),h;if(!i.visible)s=new gx,h={};else if(i.category==="lambert"){s=new tq;let c=new gi(r.color(i.emissive)??0),u=new Sr(i.occlusion??!0);h={emissive:c,occlusion:u},s.emissive=c,s.occlusion=u}else if(i.category==="toon"){s=new sq;let c=new Be(i.shininess??30),u=new gi(r.color(i.specular)??1118481);h={shininess:c,specular:u},s.shininess=c,s.specular=u}else if(i.category==="physical"){s=new rq;let c=new Be(i.roughness??.3),u=new Be(i.metalness??0),d=new Be(i.reflectivity??.5),p=new Sr(i.occlusion??!0);h={roughness:c,metalness:u,reflectivity:d,occlusion:p},s.roughness=c,s.metalness=u,s.reflectivity=d,s.occlusion=p}else{s=new iq;let c=new Be(i.shininess??30),u=new gi(i.specular!==void 0?r.color(i.specular)??1118481:1118481),d=new Sr(i.occlusion??!0);h={shininess:c,specular:u,occlusion:d},s.shininess=c,s.specular=u,s.occlusion=d}return s.alpha=new Be(1),s.shadingAlpha=a,s.shadingBlend=n,s.bumpMapIntensity=o,s.alphaOverride=l,h.alpha=s.shadingAlpha,h.mode=s.shadingBlend,h.bumpMapIntensity=s.bumpMapIntensity,h.alphaOverride=s.alphaOverride,new la(e,t,i,s,h,r)}get category(){return this.node.category}};function Kq(e){let t=e instanceof Hu?e.type:e;return t==="texture"||t==="video"||t==="displace_map"||t==="matcap"}function ls(e){return{alpha:new Be(e.alpha??1),mode:new Yt(e.mode??0),isMask:new Sr(e.isMask??!1)}}function Zq(e,t,i,r,s){switch(e.type){case"color":{let a=new gi(r.color??ss),n=ls(r),o=new xy(a,n.alpha),l=new ti(o.calpha,"f");return new pi(t,i,e,{color:a,...n},o,n.mode,l,n.isMask,s)}case"fresnel":{let a=new gi(r.color??16777215),n=new Be(st(r.bias,s)??.1),o=new Be(st(r.scale,s)??1),l=new Be(st(r.intensity,s)??2),h=new Be(st(r.factor,s)??1),c=ls(r),u=new J7(a,n,o,l,h,c.alpha,c.mode,c.isMask),d=new ti(u.calpha,"f");return new pi(t,i,e,{color:a,bias:n,scale:o,intensity:l,factor:h,...c},u,c.mode,d,c.isMask,s)}case"rainbow":{let a=new Be(st(r.filmThickness,s)??30),n=new Be(st(r.movement,s)??0),o=new ds(Pn(r.wavelengths,s)),l=new Be(st(r.noiseStrength,s)??0),h=new Be(st(r.noiseScale,s)??1),c=new ds(Pn(r.offset,s)),u=ls(r),d=new zT(a,n,o,l,h,c,u.alpha,u.isMask),p=new ti(d.calpha,"f");return new pi(t,i,e,{filmThickness:a,movement:n,wavelengths:o,noiseStrength:l,noiseScale:h,offset:c,...u},d,u.mode,p,u.isMask,s)}case"transmission":{let a=new Be(st(r.thickness??10,s)),n=new Be(st(r.ior??1.5,s)),o=new Be(st(r.roughness??.5,s)),l=Ye.transmissionSize,h=Ye.transmissionRenderTarget,c=Ye.transmissionRenderTargetDepth,u=window.innerWidth,d=window.innerHeight,p=u>=d?new dr(d/u,1):new dr(1,u/d),f=ls(r),m=new UT(a,n,o,l,h,c,p,f.alpha),g=new ti(m.calpha,"f");return new pi(t,i,e,{thickness:a,ior:n,roughness:o,aspectRatio:p,...f},m,f.mode,g,f.isMask,s)}case"toon":{let a=new Yt(r.positioning??0),n;r.colors?n=new Oo(r.colors.length,r.colors):(n=new Oo(10,new ot(0,0,0,1)),n.value[1]=new ot(1,1,1,1));let o;r.steps?o=new Do(r.steps.length,r.steps):(o=new Do(10,1),o.value[0]=0);let l=new ds(Pn(r.source??new M(0,0,0),s)),h=new Sr(r.isWorldSpace??!0),c=new Be(st(r.noiseStrength??0,s)),u=new Be(st(r.noiseScale??1,s)),d=new Ya(r.shadowColor),p=new ds(Pn(r.offset??new M(0,0,0),s)),f=ls(r),m=new FT(a,n,o,l,h,c,u,d,p,f.alpha),g=new ti(m.calpha,"f");return new pi(t,i,e,{positioning:a,colors:n,steps:o,source:l,isWorldSpace:h,noiseStrength:c,noiseScale:u,shadowColor:d,offset:p,...f},m,f.mode,g,f.isMask,s)}case"outline":{let a=new gi(r.outlineColor??16777215),n=new gi(r.contourColor??16777215),o=new Be(st(r.outlineWidth??.1,s)),l=new Be(st(r.contourWidth??.1,s)),h=new Be(st(r.outlineThreshold??.1,s)),c=new Be(st(r.contourThreshold??.1,s)),u=new Be(st(r.outlineSmoothing??.1,s)),d=new Be(st(r.contourFrequency??.1,s)),p=new ds(Pn(r.contourDirection??new M(0,1,0),s)),f=new Sr(r.positionalLines??!1),m=new Sr(r.compensation??!0),g=Ye.normalRenderTarget,v=Ye.normalRenderTargetDepth,y=Ye.pixelRatioNode,x=Ye.resolution,w=ls(r),S=new IT(a,n,o,l,h,c,u,d,p,f,m,x,g,v,y,w.alpha),b=new ti(S.calpha,"f");return new pi(t,i,e,{outlineColor:a,contourColor:n,outlineWidth:o,contourWidth:l,outlineThreshold:h,contourThreshold:c,outlineSmoothing:u,contourFrequency:d,contourDirection:p,positionalLines:f,compensation:m,...w},S,w.mode,b,w.isMask,s)}case"depth":{let a=new Yt(r.gradientType??0),n=new Sr(r.smooth??!1),o=new Be(st(r.near,s)??50),l=new Be(st(r.far,s)??200),h=new Be(r.isVector??1),c=new Be(r.isWorldSpace??0),u=new ds(Pn(r.origin,s)),d=new ds(Pn(r.direction,s)),p;r.colors?p=new Oo(r.colors.length,r.colors):(p=new Oo(2,new ot(0,0,0,1)),p.value[1]=new ot(1,1,1,1));let f;r.steps?f=new Do(r.steps.length,r.steps):(f=new Do(2,1),f.value[0]=0);let m=ls(r),g=new MT(a,n,o,l,h,c,u,d,p,f,m.alpha,m.isMask),v=new ti(g.calpha,"f");return new pi(t,i,e,{gradientType:a,smooth:n,near:o,far:l,isVector:h,isWorldSpace:c,origin:u,direction:d,colors:p,steps:f,...m},g,m.mode,v,m.isMask,s)}case"noise":{let a=new Be(st(r.scale,s)??1),n=new ds(Pn(r.size??new M(100,100,100),s)),o=new Be(st(r.move,s)??1),l=new dr(ka(r.fA??new H(1.7,9.2),s)),h=new dr(ka(r.fB??new H(8.3,2.8),s)),c=new dr(ka(r.distortion??new H(1,1),s)),u=new Ya(r.colorA),d=new Ya(r.colorB),p=new Ya(r.colorC),f=new Ya(r.colorD),m=new Yt(r.noiseType??0),g=new Yt(r.voronoiStyle??0),v=new Be(st(r.highCut,s)??1),y=new Be(st(r.lowCut,s)??0),x=new Be(st(r.smoothness,s)??.5),w=new Be(st(r.seed,s)??.5),S=new Yt(r.quality??1),b=ls(r),E=new DT(a,n,o,l,h,c,u,d,p,f,b.alpha,m,b.isMask,g,v,y,x,w,S),_=new ti(E.calpha,"f");return new pi(t,i,e,{scale:a,size:n,move:o,fA:l,fB:h,distortion:c,colorA:u,colorB:d,colorC:p,colorD:f,noiseType:m,...b,voronoiStyle:g,highCut:v,lowCut:y,smoothness:x,seed:w,quality:S},E,b.mode,_,b.isMask,s)}case"normal":{let a=new ds(r.cnormal??new M(1,1,1)),n=ls(r),o=new AT(a,n.alpha),l=new ti(o.calpha,"f");return new pi(t,i,e,{cnormal:a,...n},o,n.mode,l,n.isMask,s)}case"gradient":{let a=new Yt(r.gradientType??0),n=new Sr(r.smooth??!1),o;r.colors?o=new Oo(r.colors.length,r.colors):(o=new Oo(10,new ot(0,0,0,1)),o.value[1]=new ot(1,1,1,1));let l;r.steps?l=new Do(r.steps.length,r.steps):(l=new Do(10,1),l.value[0]=0);let h=new dr(ka(r.offset??new H(0,0),s)),c=new dr(ka(r.morph??new H(0,0),s)),u=new Be(st(r.angle??0,s)),d=ls(r),p=new CT(a,n,o,l,h,c,u,d.alpha,d.isMask),f=new ti(p.calpha,"f");return new pi(t,i,e,{gradientType:a,smooth:n,colors:o,steps:l,offset:h,morph:c,angle:u,...d},p,d.mode,f,d.isMask,s)}case"pattern":{let a=new Yt(r.style??0),n=new Yt(r.projection??0),o=new Yt(["x","y","z"].indexOf(r.axis)??0),l=new Be(st(r.blending??0,s)),h=new dr(ka(r.offset,s)),c=new Ya(r.colorA),u=new Ya(r.colorB),d=new dr(ka(r.frequency??new H(10,10),s)),p=new Be(st(r.size??.5,s)),f=new Be(st(r.variation??0,s)),m=new Be(st(r.smoothness??.5,s)),g=new Be(st(r.zigzag??0,s)),v=new Be(st(r.rotation??0,s)),y=new dr(ka(r.vertical??new H(0,1),s)),x=new dr(ka(r.horizontal??new H(0,1),s)),w=new Yt(r.sides??6),S=ls(r),b=new RT(a,n,o,l,h,c,u,d,p,f,m,g,v,y,x,w,S.alpha,S.isMask),E=new ti(b.calpha,"f");return new pi(t,i,e,{style:a,projection:n,axis:o,blending:l,offset:h,colorA:c,colorB:u,frequency:d,size:p,variation:f,smoothness:m,zigzag:g,rotation:v,vertical:y,horizontal:x,sides:w,...S},b,S.mode,E,S.isMask,s)}default:{let a=new gi(1,0,0,1),n=ls(r),o=new xy(a,n.alpha),l=new ti(o.calpha,"f");return new pi(t,i,e,{color:a,...n},o,n.mode,l,n.isMask,s)}}}function Jq(e,t,i,r){let s=Rq(i,r);return Zq(i,e,t,s,r)}function YT(e,t,i,r){if(i.type==="displace"&&(e==="intensity"||e==="visible")){let s=t.uniforms[`f${t.id}_intensity`];return s?(s.value=(st(i.intensity,r)??1)*(i.visible?1:0),s):void 0}if(i.type!=="displace"&&(e==="alpha"||e==="visible")){let s=t.uniforms[`f${t.id}_alpha`];if(!s)return;if(s.value=sl(i.alpha,r)*(i.visible?1:0),i.type==="outline"&&e==="visible"){let a=t.uniforms[`f${t.id}_compensation`];a&&(a.value=i.compensation&&i.visible)}return s}}function Nr(e,t,i,r,s,a,n=[]){let o=i;for(let l of n)l in o&&(o=o[l]);for(let l of e)l in o&&s.getVariable(o[l],["material",a,"layer",r,...n,String(l)]);for(let l of t)l in o&&o[l].forEach((h,c)=>{s.getVariable(h,["material",a,"layer",r,...n,String(l),c===0?"x":c===1?"y":"z"])})}function nh(e,t){let i=0,r=e.layers.find(s=>s.data.type==="light");if(r){let s=r.data,a=Number(t.getVariable(s.alphaOverride));if((typeof s.alphaOverride=="string"?a/100:s.alphaOverride)<1)return!0}for(let s of e.layers){if(s.data.type!=="displace"&&s.data.isMask)return!0;if(s.data.type!=="displace"&&"alpha"in s.data&&s.data.type!=="light"&&s.data.type!=="fresnel"&&s.data.type!=="texture"&&s.data.type!=="matcap"&&s.data.type!=="rainbow"&&s.data.type!=="outline"&&s.data.type!=="pattern"){let a=s.data.visible?s.data.alpha:0;if(typeof a=="string"&&(a=Math.max(0,Math.min(1,Number(t.getVariable(a)??100)/100))),a===1&&s.data.type==="depth"||s.data.type==="gradient"){for(let n of s.data.colors)if(n[3]<1){a=n[3];break}}else if(a===1&&s.data.type==="noise"){let n=t.color(s.data.colorA).a,o=t.color(s.data.colorB).a,l=t.color(s.data.colorC).a,h=t.color(s.data.colorD).a,c=Math.min(n,Math.min(o,Math.min(l,h)));c<1&&(a=c)}i+=(1-i)*a}}return i<1}var yn=class extends Dt{constructor(){super(void 0),this.flatShading=!1,this.needsJitter=!0,this.shadersPatchedForShapeBlend=!1,this.nodeContextUuid=0,this.fog=!0,this.dithering=!0,this.vertexColors=!0,this.transparent=!0}customProgramCacheKey(){return""}},$q=class extends yn{constructor(e,t,i,r){super(),this.flatShading=e,this.side=t,this.wireframe=i,this.root=r}updateAfterBuild(){let e=this.root;this.lights=e.lights,this.vertexShader=e.vertexShader,this.fragmentShader=e.fragmentShader,Object.assign(this.defines,e.defines),Object.assign(this.uniforms,e.uniforms),this.extensions=e.extensions,this.transparent=e.transparent,this.cacheKey=e.customProgramCacheKey()+"flat"+this.flatShading+this.side}onBeforeCompile(e,t){this.root.onBeforeCompile(e)}get data(){return this.root.data}get category(){return this.root.category}get hasAO(){return this.root.hasAO}getFlavor(e,t,i,r){return this.root.getFlavor(e,t,i,r)}get layers(){return this.root.layers}get fragment(){return this.root.fragment}getLayersOfType(e){return this.root.getLayersOfType(e)}getLayerByUuid(e){return this.root.getLayerByUuid(e)}updateByOp(e,t,i){this.root.updateByOp(e,t,i)}nodeMaterialDispose(){this.root.nodeMaterialDispose()}},yx=class extends yn{constructor(e,t,i=!0){super(),this.data=e,this.allowVariableSaves=i,this.layerIdGen=0,this.flavors=[],this.masks={},this.type="NodeMaterial",this.updaters=[],this.needsJitter=t.shared.needsJitter,ji.startContext(this),this.reset0(e,t),ji.endContext(this)}get nodeMaterial(){return this}getFlavor(e,t,i,r){let s=i?6:(e?3:0)+t;if(s+=((r?.resolutionLevel??0)-(r?.useChildrenColors?4:0))*7,s===0)return this;this.flavors===void 0&&(this.flavors=[]),s-=1;let a=this.flavors[s];return a===void 0&&(a=new $q(e,t,i,this),a.needsJitter=this.needsJitter,this.flavors[s]=a,a.flatShading=e,a.side=t,a.updateAfterBuild(),r&&(a.defines.SHAPEBLEND=r.resolutionLevel,a.defines.SHAPEBLEND_C=r.useChildrenColors?1:0)),a}get fragment(){return this.lightLayer.node}get category(){return this.lightLayer.category}get hasAO(){return this.lightLayer.getNode("occlusion")?.value??!1}reset(e,t,i=!1){ji.startContext(this),(this.data!==e||i)&&this.reset0(e,t),ji.endContext(this)}reset0(e,t){this.data=e;let i=e.layers??rr.defaultTwoLayerData("phong").layers;try{this.layers=i.map(r=>Hu.create(this.layerIdGen++,r.id,r.data,t.shared))}catch{this.layers=[]}this.layers.reverse(),this.name=e.name??"Untitled Material",this.onUpdate(t.shared),this.transparent=nh(e,t.shared),this.saveVariableLocations(t)}onVariableUpdate(e,t,i){if(e[0]==="alphaOverride")this.transparent=nh(this.data,i.shared),this.lightLayer.setValue("alphaOverride",Math.max(0,Math.min(Number(t)/100,1)));else if(e[0]==="layer"){let r=e[1],s=e[2];if(r&&s){let a=this.layers.find(n=>n.uuid===r);if(a?.hasValue(s))if(s==="alpha")this.transparent=nh(this.data,i.shared),a.setValue(s,Math.max(0,Math.min(Number(t)/100,1)));else{let n=a.getValue(s),o=e[3],l=e[4];if(n instanceof li){let h=n[o],c;typeof h=="number"?c=Number(t):h.isVector2&&(c=h.toArray(),l==="x"?c[0]=Number(t):l==="y"&&(c[1]=Number(t))),vx({[o]:c},i.shared,a);return}(o==="x"||o==="y"||o==="z")&&n.isVector3||(o==="x"||o==="y")&&n.isVector2?n[o]=Number(t):a.setValue(s,t)}}}}saveVariableLocations(e){if(!this.allowVariableSaves)return;let t=this.data.layers.find(i=>i.data.type==="light");t&&e.shared.getVariable(t.data.alphaOverride,["material",this.uuid,"alphaOverride"]),this.data.layers.forEach(i=>{"alpha"in i.data&&typeof i.data.alpha=="string"&&e.shared.getVariable(i.data.alpha,["material",this.uuid,"layer",i.id,"alpha"]),i.data.type==="displace"?i.data.displacementType==="noise"?Nr(["intensity","scale","movement","smoothness","seed","highCut","lowCut"],["offset"],i.data,i.id,e.shared,this.uuid):Nr(["intensity"],[],i.data,i.id,e.shared,this.uuid):i.data.type==="depth"?Nr(["near","far"],["origin","direction"],i.data,i.id,e.shared,this.uuid):i.data.type==="fresnel"?Nr(["bias","scale","intensity","factor"],[],i.data,i.id,e.shared,this.uuid):i.data.type==="rainbow"?Nr(["filmThickness","movement","noiseStrength","noiseScale"],["offset","wavelengths"],i.data,i.id,e.shared,this.uuid):i.data.type==="noise"?Nr(["scale","move","seed","highCut","lowCut","smoothness"],["size","distortion","fA","fB"],i.data,i.id,e.shared,this.uuid):i.data.type==="pattern"?Nr(["blending","size","variation","smoothness","zigzag","rotation"],["offset","frequency","vertical","horizontal"],i.data,i.id,e.shared,this.uuid):i.data.type==="outline"?Nr(["outlineWidth","contourWidth","outlineThreshold","contourThreshold","outlineSmoothing","contourFrequency"],["contourDirection"],i.data,i.id,e.shared,this.uuid):i.data.type==="toon"?Nr(["noiseStrength","noiseScale"],["offset","source"],i.data,i.id,e.shared,this.uuid):i.data.type==="transmission"?Nr(["roughness","thickness","ior"],[],i.data,i.id,e.shared,this.uuid):i.data.type==="texture"||i.data.type==="video"?(Nr([],["size"],i.data,i.id,e.shared,this.uuid),Nr(["rotation"],["repeat","offset"],i.data,i.id,e.shared,this.uuid,["texture"])):i.data.type==="gradient"?Nr(["angle"],["offset","morph"],i.data,i.id,e.shared,this.uuid):i.data.type==="matcap"&&Nr(["rotation"],[],i.data,i.id,e.shared,this.uuid,["texture"])})}getLayersOfType(e){return this.layers.filter(t=>t.type===e)}getLayerByUuid(e){return this.layers.find(t=>t.uuid===e)}onUpdate(e){this.lightLayer=this.layers.find(t=>t instanceof la),this.lightLayer===void 0&&(this.lightLayer=new la(0,"",{..._i.defaultData("light","phong"),visible:!1},new gx,{},e)),this.dispose();for(let t of this.flavors)t&&t.dispose();this.applyTextureMaps(),this.applyMasks(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),this.build(),this.nodeContextUuid=0}applyTextureMaps(){let e=this.layers.find(s=>s instanceof la);if(!e)return;let t=e.data,i=t.bumpMap,r=t.roughnessMap;e.node.bumpMap=void 0,e.node.roughnessMap=void 0;for(let s=0;s<this.layers.length;++s){let a=this.layers[s];a instanceof pi&&a.color instanceof mx&&(a.uuid===i&&(e.node.bumpMap=a.color),a.uuid===r&&(e.node.roughnessMap=a.color))}}updateByOp(e,t,i){if(ji.startContext(this),t!==void 0?this.data=t:t=this.data,this.transparent=nh(t,i.shared),e.path[0]==="layers"){let r=i.shared,s=e.path[1];if(s===void 0)i.scene.markNeedsUpdateRendererDirty(),this.reset0(t,i);else{e.type===0&&e.props.occlusion!==void 0&&i.scene.markNeedsUpdateRendererDirty();let a=this.layers.find(n=>n.uuid===s);if(a){let n=t.layers.data(s),o;e.type===0&&("alpha"in e.props||"alphaOverride"in e.props)&&("alpha"in e.props?o={...e.props,alpha:sl(e.props.alpha,r,["material",this.uuid,"layer",s,"alpha"])}:o={...e.props,alphaOverride:sl(e.props.alphaOverride,r,["material",this.uuid,"alphaOverride"])}),a.updateByOp({...e,...o?{props:o}:{},path:e.path.slice(2)},n,i)&&this.reset0(t,i)}}}else this.reset0(t,i);ji.endContext(this)}applyMasks(){for(let e=0;e<this.layers.length;++e){let t=this.layers[e];t instanceof pi?t.color.mask=void 0:t instanceof la&&(t.node.mask=void 0)}for(let e=0;e<this.layers.length;++e){let t=this.layers[e];if(t instanceof pi&&t.isMask.value&&t.data.visible&&e>0){let i=e-1,r=this.layers[i];r instanceof la?r.node.mask=new jr(t.color,t.alpha,jr.MUL):r instanceof pi&&(r.isMask.value||(r.color.mask=new jr(t.color,t.alpha,jr.MUL)))}}}blendColors(){let e=this.layers.findIndex(i=>i instanceof pi),t=this.layers.findIndex(i=>i instanceof la);if(e!==-1&&e<t){let i=this.layers[e].color;for(let r=e+1;r<t;++r){let s=this.layers[r];if(s instanceof pi){if(s.isMask.value)continue;i=new J_(i,s.color,s.alpha,s.mode)}}this.fragment.color=i}else this.fragment.color=void 0}blendAfterColors(){let e=new ti("outgoingLight","f"),t=this.layers.findIndex(i=>i instanceof la);if(this.layers.length>t+1){for(let i=t+1;i<this.layers.length;++i){let r=this.layers[i];if(r instanceof pi){if(r.isMask.value)continue;e=new J_(e,r.color,r.alpha,r.mode)}}this.fragment.afterColor=e}else this.fragment.afterColor=void 0}blendPositions(){let e=this.layers.filter(t=>t instanceof XT);if(e.length>0){let t=e[0].position;for(let i=1;i<e.length;++i)e[i]&&(t=new jr(t,e[i].position,jr.ADD),t=new jr(t,new Be(.5).setReadonly(!0),jr.MUL));this.fragment.position=t}else this.fragment.position=void 0}getDefines(){return this.defines}getUniforms(){return this.uniforms}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}onBeforeCompile(e){this.shapeBlendhack&&this.shapeBlendhack(this),e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.extensionDerivatives=this.extensions.derivatives===!0,e.extensionFragDepth=this.extensions.fragDepth===!0,e.extensionDrawBuffers=this.extensions.drawBuffers===!0,e.extensionShaderTextureLOD=this.extensions.shaderTextureLOD===!0}clampUniformsForPreview(e,t){let i=(r,s,a)=>Math.min(Math.max(r,s),a);for(let r of this.layers)if(r.type==="displace"){let s=i(r.uniforms[`f${r.id}_intensity`].value,e,t);r.uniforms[`f${r.id}_intensity`].value=s}}updateFrame(e){for(let t=0;t<this.updaters.length;++t)e.updateNode(this.updaters[t])}build(){let e=new bT;e.needsJitter=this.needsJitter,this.lights=this.lightLayer.data.visible,e.build(this.fragment,this.fragment),this.vertexShader=e.getCode("vertex"),this.fragmentShader=e.getCode("fragment"),this.defines=e.defines,this.uniforms=e.uniforms,this.extensions=e.extensions,this.updaters=e.updaters;for(let t of this.flavors)t&&t.updateAfterBuild();return this.shadersPatchedForShapeBlend=!1,this}nodeMaterialDispose(){this.layers.forEach(e=>e.dispose()),super.dispose();for(let e of this.flavors)e&&e.dispose()}assetsLoaded(){for(let e of this.layers)if(e instanceof pi){let t=e.params.texture;if(t instanceof yy&&!t.image.loaded)return!1}return!0}};Object.defineProperties(yn.prototype,{properties:{get:function(){return this.fragment.properties}}});var Sy=class extends yx{constructor(e,t,i){super(e,t,!1),this.uuid=i,this.allowVariableSaves=!0,this.saveVariableLocations(t)}},lA=new Map;function eX(e){if(typeof e=="string")return e;let t=lA.get(e);return t||(t={url:URL.createObjectURL(new Blob([e]))},lA.set(e,t)),t.url}var QT,tX=new Promise(e=>{QT=e}),hA=!1,ip;function iX(){if(hA)return;if(ip)return ip;async function e(){await fo(()=>import("./howler-CrsrBD9T.js").then(t=>t.h),[]),QT(window!==void 0?window:global),hA=!0}return ip=e(),ip}var KT;tX.then(e=>KT=e);function cA(e,t){e.forEach(i=>{"dragDropActions"in i.data?(t.push(...i.data.dragDropActions.drag),t.push(...i.data.dragDropActions.drop)):"inActions"in i.data?(t.push(...i.data.inActions),t.push(...i.data.outActions)):"gameActions"in i.data?(t.push(...i.data.gameActions.idle),t.push(...i.data.gameActions.move),t.push(...i.data.gameActions.jump),t.push(...i.data.gameActions.run)):"breakpoints"in i.data?i.data.breakpoints.forEach(r=>{t.push(...r.data.actions)}):"actions"in i.data&&(t.push(...i.data.actions),i.data.actions.forEach(r=>{r.data.type==="Conditional"&&r.data.ifActions&&(t.push(...r.data.ifActions),t.push(...r.data.elseActions))}))})}function rX(e){let t=!1,i=[];return e.scene.objects.traverse((r,s)=>{if(s.type==="Page"&&s.uiScene!==void 0&&s.uiScene.objects.traverse((a,n)=>{if(n.events===void 0||Array.isArray(n.events)===!1)return!0;cA(n.events,i),t=t||i.some(o=>o.data.type==="Audio")}),s.events===void 0||Array.isArray(s.events)===!1)return!0;cA(s.events,i),t=t||i.some(a=>a.data.type==="Audio")}),t}var qc=class{constructor({src:e,volume:t,delay:i,loop:r}){this._volume=1,this.delay=0,this._loop=1,this.loopsRemaining=0,this._status="stopped",this.onEnd=()=>{this.loopsRemaining===1/0?this.replay():this.loopsRemaining>1?(this.replay(),this.loopsRemaining--):(this._status="stopped",this.loopsRemaining=this._loop)};let s;typeof e=="string"?s={src:e}:s={src:eX(e),format:"wav"},this.sound=new KT.Howl(s),this.sound.on("end",this.onEnd),this.src=e,t!==void 0&&(this.volume=t),i!==void 0&&(this.delay=i),r!==void 0&&(this.loop=r)}get status(){return this._status}get volume(){return this._volume}set volume(e){this._volume=e,this.sound.volume(e)}get loop(){return this._loop}set loop(e){this._loop=e,this.loopsRemaining=e}replay(){this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)}fade(e,t=1e3){e?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,t),this.clearFade()},e)):this.sound.fade(this._volume,0,t)}on(e,t,i){this.sound.on(e,t,i)}off(e,t,i){this.sound.off(e,t,i)}play(){this._status==="playing"||this.sound.playing()||(this._status==="paused"?(this.sound.seek()===0?this.replay():this.sound.play(),this._status="playing"):this._status==="stopped"&&(this.replay(),this._status="playing"))}pause(){this._status==="playing"&&(this.sound.pause(),this.clearFade(),this.clearDelay(),this._status="paused")}stop(){this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay(),this._status="stopped"}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(e=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}},sX=class{constructor(){this.type="ShapePath",this.color=new Je,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Kp,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath?.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath?.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,a){return this.currentPath?.bezierCurveTo(e,t,i,r,s,a),this}splineThru(e){return this.currentPath?.splineThru(e),this}toShapes(){let e={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},t={loc:e.ORIGIN,t:0};function i(p,f,m,g){let v=p.x,y=f.x,x=m.x,w=g.x,S=p.y,b=f.y,E=m.y,_=g.y,A=(w-x)*(S-E)-(_-E)*(v-x),C=(y-v)*(S-E)-(b-S)*(v-x),T=(_-E)*(y-v)-(w-x)*(b-S),I=A/T,P=C/T;if(T===0&&A!==0||I<=0||I>=1||P<0||P>1)return null;if(A===0&&T===0){for(let O=0;O<2;O++)if(r(O===0?m:g,p,f),t.loc===e.ORIGIN){let k=O===0?m:g;return{x:k.x,y:k.y,t:t.t}}else if(t.loc===e.BETWEEN){let k=+(v+t.t*(y-v)).toPrecision(10),G=+(S+t.t*(b-S)).toPrecision(10);return{x:k,y:G,t:t.t}}return null}else{for(let G=0;G<2;G++)if(r(G===0?m:g,p,f),t.loc===e.ORIGIN){let B=G===0?m:g;return{x:B.x,y:B.y,t:t.t}}let O=+(v+I*(y-v)).toPrecision(10),k=+(S+I*(b-S)).toPrecision(10);return{x:O,y:k,t:I}}}function r(p,f,m){let g=m.x-f.x,v=m.y-f.y,y=p.x-f.x,x=p.y-f.y,w=g*x-y*v;if(p.x===f.x&&p.y===f.y){t.loc=e.ORIGIN,t.t=0;return}if(p.x===m.x&&p.y===m.y){t.loc=e.DESTINATION,t.t=1;return}if(w<-Number.EPSILON){t.loc=e.LEFT;return}if(w>Number.EPSILON){t.loc=e.RIGHT;return}if(g*y<0||v*x<0){t.loc=e.BEHIND;return}if(Math.sqrt(g*g+v*v)<Math.sqrt(y*y+x*x)){t.loc=e.BEYOND;return}let S;g!==0?S=y/g:S=x/v,t.loc=e.BETWEEN,t.t=S}function s(p,f){let m=[],g=[];for(let v=1;v<p.length;v++){let y=p[v-1],x=p[v];for(let w=1;w<f.length;w++){let S=f[w-1],b=f[w],E=i(y,x,S,b);E!==null&&m.find(_=>_.t<=E.t+Number.EPSILON&&_.t>=E.t-Number.EPSILON)===void 0&&(m.push(E),g.push(new H(E.x,E.y)))}}return g}function a(p,f,m){let g=new H;f.getCenter(g);let v=[];return m.forEach(y=>{y.boundingBox.containsPoint(g)&&s(p,y.points).forEach(x=>{v.push({identifier:y.identifier,isCW:y.isCW,point:x})})}),v.sort((y,x)=>y.point.x-x.point.x),v}function n(p,f,m,g,v){(v==null||v==="")&&(v="nonzero");let y=new H;p.boundingBox.getCenter(y);let x=[new H(m,y.y),new H(g,y.y)],w=a(x,p.boundingBox,f);w.sort((C,T)=>C.point.x-T.point.x);let S=[],b=[];w.forEach(C=>{C.identifier===p.identifier?S.push(C):b.push(C)});let E=S[0].point.x,_=[],A=0;for(;A<b.length&&b[A].point.x<E;)_.length>0&&_[_.length-1]===b[A].identifier?_.pop():_.push(b[A].identifier),A++;if(_.push(p.identifier),v==="evenodd"){let C=_.length%2===0,T=_[_.length-2];return{identifier:p.identifier,isHole:C,for:T}}else if(v==="nonzero"){let C=!0,T=null,I=null;for(let P=0;P<_.length;P++){let O=_[P];f[O]&&(C?(I=f[O].isCW,C=!1,T=O):I!==f[O].isCW&&(I=f[O].isCW,C=!0))}return{identifier:p.identifier,isHole:C,for:T}}else console.warn('fill-rule: "'+v+'" is currently not implemented.')}let o=0,l=999999999,h=-999999999,c=[];this.subPaths.forEach(p=>{let f=p.getPoints(),m=-999999999,g=999999999,v=-999999999,y=999999999;for(let x=0;x<f.length;x++){let w=f[x];w.y>m&&(m=w.y),w.y<g&&(g=w.y),w.x>v&&(v=w.x),w.x<y&&(y=w.x)}h<=v&&(h=v+1),l>=y&&(l=y-1),f.length&&c.push({curves:p.curves,points:f,isCW:RM.isClockWise(f),identifier:o++,boundingBox:new u1(new H(y,g),new H(v,m))})});let u=c.map(p=>n(p,c,l,h,this.userData?.style.fillRule)),d=[];return c.forEach(p=>{let f=u[p.identifier];if(f&&!f.isHole){let m=new Zp;m.curves=p.curves,u.filter(g=>g?.isHole&&g.for===p.identifier).forEach(g=>{if(g){let v=c[g.identifier],y=new Kp;y.curves=v.curves,m.holes.push(y)}}),d.push(m)}}),d}},ZT=!1,JT,uA=new Promise(e=>{JT=e}),dA=!1,rp;function aX(){if(ZT=!0,dA)return;if(rp)return rp;async function e(){let t=await fo(()=>import("./opentype-U-0Y99ve.js"),[]);JT(t),dA=!0}return rp=e(),rp}var nX=class{async load(e,t,i=()=>{}){let{load:r}=await uA;r(e,(s,a)=>{s||!a?i(s??"Something went wrong"):t(a)})}async parse(e){let{parse:t,Bidi:i}=await uA;try{let r=t(e),s=new i,a=n=>r.charToGlyphIndex(n.char);return s.registerModifier("glyphIndex",null,a),s.applyFeatures(r,r.defaultRenderOptions.features),{font:r,bidi:s}}catch(r){console.error(r)}}};async function oX(e){return await(await fetch(e)).arrayBuffer()}var lX=new nX;async function pA(e){let t,i,r=!1;if(e.url?(t=await oX(e.url),i=e.url,r=e.url.startsWith("/")):e.data&&(t=e.data.buffer.slice(e.data.byteOffset,e.data.byteOffset+e.data.byteLength)),t)if(ZT){let s=await lX.parse(t);if(s)return{font:s.font,url:i,intercepted:r,arr:t,bidi:s.bidi}}else return{font:void 0,url:i,intercepted:r,arr:t,bidi:null}}function hX(e,t){return t.state.glyphIndex===e||t.state.fina===e||t.state.medi===e||t.state.init===e}var cX=class{constructor(e){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=pA(e).then(t=>{t&&(this._arrayBuffer=t.arr,this._url=t.url,this.font=t.font,this._intercepted=t.intercepted,this._isLoaded=!0,this._bidi=t.bidi)})}update(e){this._isLoaded=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=pA(e).then(t=>{t&&(this._arrayBuffer=t.arr,this._url=t.url,this.font=t.font,this._intercepted=t.intercepted,this._isLoaded=!0,this._bidi=t.bidi)})}get url(){return this._url}get intercepted(){return this._intercepted}get isLoaded(){return this._isLoaded}get loadingPromise(){return this._loadingPromise}reverseLigaturesTable(e,t,i){if(!this._bidi)return[];let r=this._bidi;r.getTextGlyphs(t);let s=r.tokenizer.tokens,a=[],n=0,o=i.length===s.length;for(let l=0;l<i.length;l++){let h=i[l].index,c=String.fromCharCode(i[l].unicode),u=s[n];if(hX(h,u)||o)a.push({char:c,index:h,replacements:[u.state.glyphIndex],replacementChars:[u.char]}),n++;else{let d=u.char,p="",f=[u.state.glyphIndex],m=[],g=!1;for(;!g;)n++,p=t.charAt(n),d+=p,f.push(e.charToGlyphIndex(p)),m=e.stringToGlyphs(d),m.length===1&&m[0].index===h&&(g=!0),n>t.length&&(g=!0);a.push({char:c,index:h,replacements:f,replacementChars:Array.from(d)}),n++}}return a}generateShapes(e,t,i){if(!this._isLoaded)return;let r=this.font,s=t.fontSize/this.unitsPerEm,a=t.fontSize*t.lineHeight,n=e.map(v=>this.getTextWidth(v,t)),o=typeof t.width=="string"?Number(i.getVariable(t.width)):t.width,l=typeof t.height=="string"?Number(i.getVariable(t.height)):t.height,h=this.getCharWidth(` 5424`,t),c=t.horizontalAlign===1?h:0,u=this.getLineInitialOffsetX(n[0],o,t.horizontalAlign,e[0],h),d=this.getLineInitialOffsetY(a,e.length,l,s,t.verticalAlign),p=[],f=e.map(v=>[]),m=e.map(v=>[]);for(let v=0;v<e.length;v++){let y=e[v],x={features:{liga:!0},letterSpacing:t.letterSpacing},w=[];try{w=r.stringToGlyphs(y,x)}catch(A){console.warn(A)}u=this.getLineInitialOffsetX(n[v],o,t.horizontalAlign,y,h);let S=[];try{S=this.reverseLigaturesTable(r,y,w)}catch(A){console.warn(A)}let b=this.computeSpaceWidthForLine(e,v,t,i),E=0,_=w[0];_&&t.horizontalAlign===2&&_.leftSideBearing!==void 0&&(u-=_.leftSideBearing*s),this.font?.forEachGlyph(y,u,d,t.fontSize,x,(A,C,T,I,P)=>{let O=A.index===0?` 5425`:A.unicode?String.fromCharCode(A.unicode):void 0,k=S[E],G=0;if(O===` 5426`)G=c;else if(O===" ")G=b;else{let B=this.createPath(A,s,C,T,t);B&&(G=B.offsetX,p.push(B.path))}if(k.replacements.length===1)m[v].push([C,T]),f[v].push(G);else{let B=k.replacements.map(j=>(r.glyphs.get(j).advanceWidth??0)*s),U=B.reduce((j,X)=>j+=X,0),Q=B.map(j=>j/U),q=C;for(let j=0;j<Q.length;j++){let X=G*Q[j];m[v].push([q,T]),f[v].push(X),q+=X}}E++}),d-=a}let g=[];for(let v=0,y=p.length;v<y;v++)g.push(...p[v].toShapes());return{shapes:g,charWidths:f,lineWidths:n,charCoords:m}}get isUserFont(){return this._isUserFont}get arrayBuffer(){return this._arrayBuffer}get ascender(){return this.font?.ascender??0}get descender(){return this.font?.descender??0}get familyName(){return this.font?.names.fontFamily??""}get subfamilyName(){return this.font?.names.fontSubfamily??""}get unitsPerEm(){return this.font?.unitsPerEm??1}getLineInitialOffsetX(e,t,i,r,s){return(i===3||i===2)&&r.indexOf(` 5427`)>=0&&(e-=s),i===3?t*.5-e*.5:i===2?t-e:0}getLineInitialOffsetY(e,t,i,r,s){let a=t*e,n=Math.abs(this.ascender-this.descender)*r,o=e-n,l=-this.ascender*r-o/2;return s===3?-(i-a-l):s===2?-(i*.5-a*.5-l):l}createPath(e,t,i,r,s){let a=e.getPath(i,-r,s.fontSize,{kerning:!1,letterSpacing:s.letterSpacing});if(!a){console.error('THREE.Font: character "'+e+'" does not exists in font family '+this.familyName+".");return}let n=new sX,o=(e.advanceWidth??1)*t;if(e)for(let l of a.commands){let h=n.currentPath?.currentPoint;if(!(h&&l.type!=="Z"&&h.x===l.x&&-h.y===l.y))switch(l.type){case"M":n.moveTo(l.x,-l.y);break;case"L":n.lineTo(l.x,-l.y);break;case"Q":n.quadraticCurveTo(l.x1,-l.y1,l.x,-l.y);break;case"C":n.bezierCurveTo(l.x1,-l.y1,l.x2,-l.y2,l.x,-l.y);break}}return n.subPaths.forEach(l=>{let h=uX(l.curves);h!==void 0&&l.currentPoint.distanceTo(h)>0&&l.lineTo(h.x,h.y)}),{offsetX:o,path:n}}getCharWidth(e,t){return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}getTextWidth(e,t){return this.font?.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing})??0}computeSpaceWidthForLine(e,t,i,r){let s=this.getCharWidth(" ",i),a=e[t];if(a){let n=this.countSpaces(a.trimEnd());if(i.horizontalAlign===4&&t<e.length-1&&n){let o=typeof i.width=="string"?Number(r.getVariable(i.width)):i.width,l=this.getTextWidth(a,i);return(o-(l-n*s))/n}}return s}countSpaces(e){return(e.match(/ /g)||[]).length}};function uX(e){if(e.length){let t=e[0];if(t instanceof Ns)return t.v1;if(t instanceof Fs||t instanceof ho)return t.v0}}var dX=class{constructor(){this.objects=new Map,this.unreachable=new Set}getCached(e){return this.objects.get(e)}get size(){return this.objects.size}get(e,t,i){let r=this.objects.get(e);return r===void 0?(r=this.createObject(e,t,i),this.objects.set(e,r)):r.isShared=!0,r}forceDelete(e){let t=this.objects.get(e);t&&(this.disposeObject(t),this.objects.delete(e))}mutateIfUnique(e,t){let i=this.objects.get(e);if(i&&i.isShared!==!0)return this.objects.delete(e),this.objects.set(t,i),i}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(e,t){let i=this.objects.get(e);t===i&&this.unreachable.delete(e)}endGc(){this.unreachable.forEach(e=>{this.disposeObject(this.objects.get(e)),this.objects.delete(e)}),this.unreachable.clear()}dispose(){this.objects.forEach(e=>{this.disposeObject(e)}),this.objects.clear()}},fA=class extends dX{constructor(e){super(),this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,t,i){let r=Fh(e,t,this.flatShading,i);return r.computeBoundingSphere(),r}},pX={markNeedsUpdateRendererDirty:()=>{}},zp=1e3,mA=512*zp;function fX(e,t){let i=typeof e;return!!((t==="string"||t==="number")&&i===t||t==="boolean"&&(e==="true"||e==="false"||e===!0||e===!1)||t==="image"&&i==="string"&&e.startsWith("http"))}var mX="https://hooks.spline.design",gX=`${mX}/events?hashFile=`,vX=class{constructor(e,t){this.id=e,this.userWebhook=t,this.result=void 0,this._connected=!1,this.emitter=bm(),this.reconnectWaitFor=zp,this._onError=i=>{this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this._scheduleReconnect()},this._onConnected=i=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=zp,this._connected=!0},this._onDisconnected=()=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=zp,this._connected=!1},this._onMessage=i=>{let r=i.data,s;try{s=JSON.parse(r)}catch(a){console.error("Error parsing webhook message",a)}if(s){let a=!1;this.userWebhook.parametersSchemas.forEach(({data:n})=>{s[n.name]!==void 0&&fX(s[n.name],n.type)&&(this.result===void 0&&(this.result={}),this.result[n.name]=s[n.name],a=!0)}),a&&this.emitter.emit("message",{userWebhookId:this.id})}}}connect(){clearTimeout(this.scheduledReconnectHandle),this.userWebhook.url&&(this.eventSource=new EventSource(gX+this.userWebhook.url),this.eventSource.addEventListener("message",this._onMessage),this.eventSource.addEventListener("error",this._onError),this.eventSource.addEventListener("open",this._onConnected))}disconnect(){this.eventSource?.removeEventListener("message",this._onMessage),this.eventSource?.removeEventListener("error",this._onError),this.eventSource?.removeEventListener("open",this._onConnected),this.eventSource?.close(),this._onDisconnected(),clearTimeout(this.scheduledReconnectHandle)}_scheduleReconnect(){this.reconnectWaitFor*=2,this.reconnectWaitFor>mA&&(this.reconnectWaitFor=mA),clearTimeout(this.scheduledReconnectHandle),this.scheduledReconnectHandle=setTimeout(()=>{this.scheduledReconnectHandle=void 0,this.connect()},this.reconnectWaitFor)}update(e){this.userWebhook=e}dispose(){this._connected&&this.disconnect()}get connected(){return this._connected}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}getParametersKeys(){return this.userWebhook.parametersSchemas.map(e=>e.data.name)}getParameterValue(e){if(this.getParametersKeys().includes(e)){if(this.result)return this.result?.[e];for(let t of this.userWebhook.parametersSchemas)if(t.data.name===e)return G0.defaultParameterValueByType(t.data.type)}}},gA=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],yX=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],lo=[],xx=[];for(let e=1;e<=8;e++)for(let t=0;t<gA.length;t++){let i=gA[t];lo.push(i/Math.pow(2,8-e)),xx.push(yX[t]+e)}var Vf=[32,2e3],vA=lo.filter((e,t)=>lo[t]>Vf[0]&&lo[t]<Vf[1]),xX=xx.filter((e,t)=>lo[t]>Vf[0]&&lo[t]<Vf[1]),bX=class{static getFrequencies(e,t,i,r="frequency",s=-100,a=-30){i||(i=new Float32Array(e.frequencyBinCount),e.getFloatFrequencyData(i));let n=t/2,o=1/i.length*n,l,h,c;if(r==="music"||r==="voice"){let d=r==="voice"?vA:lo,p=Array(d.length).fill(s);for(let f=0;f<i.length;f++){let m=f*o,g=i[f];for(let v=d.length-1;v>=0;v--)if(m>d[v]){p[v]=Math.max(p[v],g);break}}l=p,h=r==="voice"?vA:lo,c=r==="voice"?xX:xx}else l=Array.from(i),h=l.map((d,p)=>o*p),c=h.map(d=>`${d.toFixed(2)} Hz`);let u=l.map(d=>Math.max(0,Math.min((d-s)/(a-s),1)));return{values:new Float32Array(u),frequencies:h,labels:c}}},wX="gpt-4o-realtime-preview-2024-12-17",SX=()=>"https://relayserver.spline.design/";async function _X(e){try{return(await(await fetch(SX()+"session?uuidfile="+e)).json()).token}catch(t){console.error("Token generation error:",t)}}var AX=class{constructor(e){this.value=0,this.frequencies=new Float32Array(0);let t=new AudioContext;this.source=t.createMediaStreamSource(e),this.analyser=t.createAnalyser(),this.source.connect(this.analyser),this.analyser.fftSize=8192,this.analyser.smoothingTimeConstant=.1}getFrequencies(e=-100,t=-30){if(!this.analyser)throw new Error("Not connected, please call .connect() first");return bX.getFrequencies(this.analyser,44100,void 0,"voice",e,t)}update(){let e=this.getFrequencies(),t=e.values.reduce((i,r)=>i+r,0)/e.values.length;this.value=t,this.frequencies=e.values}disconnect(){this.source.disconnect(),this.analyser.disconnect()}},yA=class{constructor(e,t,i){this.data=e,this.id=t,this.shared=i,this.emitter=bm(),this.rafId=0,this.voice=0,this.frequencies=new Float32Array([0]),this.events=[],this.isConnected=!1,this.isToolsAdded=!1,this.tools=[],this.onMessage=r=>{let s=JSON.parse(r.data);if(this.appendEvent(s),s.type==="session.created"&&this.onSessionCreated(),s.type==="response.done"&&s.response?.output){for(let a of s.response.output)if(a.type==="function_call")for(let[n,o]of this.tools)a.name===n.name&&(o(JSON.parse(a.arguments)),setTimeout(()=>{this.sendClientEvent({type:"response.create",response:{instructions:"notice the user about what you just did"}})}))}},this.onSessionCreated=()=>{this.isToolsAdded||this.registerTools()},this.onOpen=()=>{this.events=[],this.isConnected=!0,this.sendClientEvent({type:"response.create",response:{instructions:"Say hi"}})},this.animate=()=>{if(this.rafId=requestAnimationFrame(this.animate),this.isConnected&&this.analyser){this.analyser.update();let r=this.analyser.value,s=this.analyser.frequencies;this.voice=r,this.frequencies=s,this.emitter.emit("voice",{value:r,frequencies:s})}}}update(e){this.data=e}setColorByName(e,t){let i=this.shared.getColorByName(e);if(i){let{id:r}=i,{r:s,g:a,b:n}=Y9.hexStringToRgb(t)??{r:0,g:0,b:0};this.shared.updateColor(r,{r:s/255,g:a/255,b:n/255})}}async connect(){if(this.isConnected)return;let e=await _X(this.data.integration.hash);this.pc=new RTCPeerConnection,this.audioElement=document.createElement("audio"),this.audioElement.autoplay=!0,this.pc.ontrack=s=>{let a=s.streams[0];this.audioElement.srcObject=a,this.analyser=new AX(a)};let t=await navigator.mediaDevices.getUserMedia({audio:!0});this.pc.addTrack(t.getTracks()[0]),this.dc=this.pc.createDataChannel("oai-events"),this.dc.addEventListener("message",this.onMessage),this.dc.addEventListener("open",this.onOpen);let i=await this.pc.createOffer();await this.pc.setLocalDescription(i);let r={type:"answer",sdp:await(await fetch(`https://api.openai.com/v1/realtime?model=${wX}`,{method:"POST",body:i.sdp,headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/sdp"}})).text()};await this.pc.setRemoteDescription(r),this.animate()}appendEvent(e){this.events=[e,...this.events]}sendClientEvent(e){this.dc?(e.event_id=e.event_id||crypto.randomUUID(),this.dc.send(JSON.stringify(e)),this.appendEvent(e)):console.error("Failed to send message - no data channel available",e)}registerTools(){this.isToolsAdded=!0,this.registerTool({type:"function",name:"set_personality_color",description:"returns a color based on the voice personality of the ai assistant. This should be called by the voice assistant each time it is asks to speak differently. If a color cannot be associated to the personality, the color should be a neutral color.",parameters:{type:"object",properties:{color:{type:"string",description:"css hex color string, reflecting the personality"},personality:{type:"string",description:"the personality of the voice assistant"}},required:["color","personality"]}},({color:s})=>{this.setColorByName("Voice Assistant Color",s)});let e=this.shared.getVariablesNames().join(", ");this.registerTool({type:"function",name:"set_variable",description:"Sets a Spline variable value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the variable that needs to be set. Here's a list of available variables: ${e}. It the variable does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"The new value for this variable, should always be a string even for number and boolean variables, assume that the value will be cast to the proper type afterwards."}},required:["name","value","type"]}},({name:s,value:a})=>{let n=this.shared.getVariableByName(s);if(n){let o=this.shared.getVariable(n.id),l;typeof o=="number"?l=parseFloat(a):typeof o=="boolean"?l=a.toLowerCase()==="true":l={textValue:a}
5427,this.shared.updateVariable(n.id,l)}});let t=this.shared.getColorNames().join(", ");this.registerTool({type:"function",name:"set_color",description:"Sets a Spline color asset value when asked by the user.",parameters:{type:"object",properties:{name:{type:"string",description:`The name of the color asset that needs to be set. Here's a list of available color assets: ${t}. It the color asset does not exist, don't call the function and warn the user about it.`},value:{type:"string",description:"css hex color string"}},required:["name","value"]}},({name:s,value:a})=>{this.setColorByName(s,a)});let i=this.shared.scene,r=[];i.traverseEntity(s=>{s.data.events.forEach(a=>{if(a.data.type==="AIAssistantTrigger"){let{description:n}=a.data;r.push(n)}})}),this.registerTool({type:"function",name:"trigger_event",description:"Trigger an event by name, here are the available events, please match what the user is asking for to one of these if it applies, otherwise don't call the function and warn the user.",parameters:{type:"object",properties:{description:{type:"string",description:`The name of the event that needs to be triggered. Here's a list of available events: ${JSON.stringify(r)}.`},direction:{type:"string",description:"default is forward, but can be forward or backward. Always set to forward unless the user ask to reverse or cancel the event, then set to backward."}},required:["description","direction"]}},({description:s,direction:a})=>{this.emitter.emit("trigger_event",{description:s,direction:a})}),this.sendClientEvent({type:"session.update",session:{tools:this.tools.map(([s])=>s)}})}registerTool(e,t){this.tools.push([e,t])}disconnect(){cancelAnimationFrame(this.rafId),this.analyser?.disconnect(),this.voice=0,this.isConnected=!1,this.isToolsAdded=!1,this.dc?.removeEventListener("message",this.onMessage),this.dc?.removeEventListener("open",this.onOpen),this.dc?.close(),this.pc?.getSenders().forEach(e=>{e.track&&e.track.stop()}),this.pc?.close(),this.pc=void 0}computeAnalysisForListenerEvent(e){if(e.analysis==="range"){let t=this.frequencies.slice(...e.analysisRange);return t.reduce((i,r)=>i+r,0)/t.length}return e.analysis==="single"?this.frequencies[e.analysisSingle]:this.voice}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}};function _y(e){return"variable_"+e}var MX=class extends cq{constructor(e){super(),this.shared=e}create(e){return new HT(e,this.shared)}},bx=class{constructor(e,t={},i=!0,r=!1){if(this.data=e,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new fA(!0),this.geometryCache2=new fA(!1),this.imageHolderCache=new MX(this),this.thisContext={scene:pX,shared:this},this.deletedMaterial=new Sy(rr.defaultTwoLayerData("phong"),this.thisContext,""),this.deletedImage=new qn(X0.emptyImage,this),this.deletedVideo=new qn(wf.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.timelineAnimations={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},t.images)for(let[s,a]of Object.entries(t.images))this.addImage(s,a);if(t.videos)for(let[s,a]of Object.entries(t.videos))this.addVideo(s,a);if(t.audios)for(let[s,a]of Object.entries(t.audios))this.addAudio(s,a);if(t.particles)for(let[s,a]of Object.entries(t.particles))this.addParticle(s,a);this.reset(e)}setRequestRender(e){this._requestRender=e}getImageLoadPromises(){return Object.values(this.images).map(e=>e.loadPromise)}setEntityOpContext(e){this.entityOpContext=e}reset(e,t=!1,i=!1){this.data=e,this.resetLib(e.lib);for(let{id:r,data:s}of e.variables)this.addVariableHolder(r,s),t&&this.updateVariableHolder(r,s);for(let[r,s]of Object.entries(e.userAPIs??{}))this.addUserAPI(r,s);for(let[r,s]of Object.entries(e.userWebhooks??{}))this.addUserWebhook(r,s);if(!i){for(let[r,s]of Object.entries(e.images))this.addImage(r,s);for(let[r,s]of Object.entries(e.videos))this.addVideo(r,s)}
vendor: 4,663 bytes, line 5427
5427for(let[r,s]of Object.entries(e.colors))this.addColor(r,s);for(let[r,s]of Object.entries(e.materials))this.addMaterial(r,s);for(let[r,s]of Object.entries(e.audios))this.addAudio(r,s);for(let[r,s]of Object.entries(e.particles))this.addParticle(r,s);for(let[r,s]of Object.entries(e.fonts))this.addFont(r,s);for(let[r,s]of Object.entries(e.timelineAnimations??{}))this.addAnimation(r,s)}addMaterial(e,t){if(this.materials[e]){let i=this.materials[e];i.reset(t,this.thisContext),i.dispose()}else{let i=new Sy(t,this.thisContext,e);this.materials[e]=i}}deleteMaterial(e){this.materials[e]&&(this.materials[e].nodeMaterialDispose(),delete this.materials[e])}getMaterial(e){return this.materials[e]}getMaterialOrDeletedPlaceholder(e){return this.materials[e]??this.deletedMaterial}material(e){return typeof e=="string"?this.getMaterialOrDeletedPlaceholder(e):e==null?(console.error("material is undefined or null"),this.deletedMaterial):new yx(e,this.thisContext)}getMaterials(){return this.materials}addImage(e,t){return this.images[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[e].updateSrc(t.data),!0):(this.images[e]=new qn(t,this),!1)}deleteImage(e){let t=this.images[e];t&&(t.dispose(),delete this.images[e])}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]??this.deletedImage}image(e){return typeof e=="string"?this.getImage(e):this.imageHolderCache.load(e)}addUIBuffer(e,t){return this.uiBuffers[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[e].updateSrc(t),!0):(this.uiBuffers[e]=new qn(t,this),!1)}uiBuffer(e){return this.uiBuffers[e]}addVideo(e,t){return this.videos[e]?(this.videos[e].updateSrc(t.data),!0):(this.videos[e]=new qn(t,this),!1)}deleteVideo(e){let t=this.videos[e];t&&(t.dispose(),delete this.videos[e])}getVideo(e){return this.videos[e]??this.deletedVideo}video(e){return typeof e=="string"?this.getVideo(e):this.imageHolderCache.load(e)}addColor(e,t){return this.colors[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new Nf(t.r,t.g,t.b,t.a):this.colors[e]=new Nf(t.r,t.g,t.b,1),!1)}updateColor(e,t){if(this.colors[e]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[e];return this.colors[e].r=t.r??i.r,this.colors[e].g=t.g??i.g,this.colors[e].b=t.b??i.b,this.colors[e].a=t.a??i.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}getColorNames(){return Object.values(this.data.colors).map(e=>e.name)}getColorByName(e){for(let t in this.data.colors)if(this.data.colors[t].name===e)return{color:this.colors[t],id:t}}color(e){let t;if(typeof e=="string"){let i=this.getColor(e);i?t=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new Wi(0,0,0,0))}else return"a"in e?new Wi(e.r,e.g,e.b,e.a):new Wi(e.r,e.g,e.b,1);return t}addAudio(e,t){this.audios[e]=t}getAudio(e){let t=this.audios[e];if(t instanceof qc)return t;{let i=new qc({src:t.data});return this.audios[e]=i,i}}addParticle(e,t){this.particles[e]=t}getParticle(e){return this.particles[e]}deleteParticle(e){this.particles[e]&&delete this.particles[e]}deleteAudio(e){let t=this.audios[e];t&&(t instanceof qc&&t.dispose(),delete this.audios[e])}addFont(e,t){this.fonts[e]=new cX(t),this.fonts[e].loadingPromise.then(()=>this.requestRender())}getFont(e){return this.fonts[e]}deleteFont(e){this.fonts[e]&&delete this.fonts[e]}addAnimation(e,t){this.timelineAnimations[e]=t}getAnimation(e){return this.timelineAnimations[e]}deleteAniamtion(e){this.timelineAnimations[e]&&delete this.timelineAnimations[e]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof qc&&e.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(e,t){if(this.variables[e]===void 0){let i=t.value;if(this.enableLocalStorageForPersistentVariables&&t.persistent){let r=localStorage.getItem(_y(e));i=r!==null?JSON.parse(r):t.value}return this.variables[e]={value:i,locations:[],persistent:t.persistent},"dynamicVariableType"in t&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0),!0}return this.variables[e].value=t.value,!1}resetDynamicVariablePlayState(){for(let e in this.variables)this.variables[e].dynamicVariablePlayState!==void 0&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0)}
vendor: 4,230 bytes, line 5427
5427updateVariableHolder(e,t){this.updateVariable(e,t.value)}updateVariable(e,t){if(this.variables[e]===void 0)return!1;this.variables[e].value=t,this.enableLocalStorageForPersistentVariables&&this.variables[e].persistent&&localStorage.setItem(_y(e),JSON.stringify(t));let i=t;for(;typeof i=="string";)i=this.variables[i].value;let r=this.entityOpContext.scene;for(let s=this.variables[e].locations.length-1;s>=0;s--){let a=this.variables[e].locations[s];if(a[0]==="material"){let n=a[1],o=i,l={scene:r,shared:this},h=a.slice(2);r.traverseMaterial(u=>{let d=u.root??u;d.uuid===n&&d.onVariableUpdate(h,o,l)});let c=this.materials[n];c&&c.onVariableUpdate(h,o,l)}else{let n=r.find(a[0]);if(n===void 0){this.variables[e].locations.splice(s,1);continue}if(a[1]!=="geometry"&&a[1]!=="particles"){for(let o=1;o<a.length-1;o++)n=n[a[o]];a[1]==="rotation"?n[a[a.length-1]]=i*Te.DEG2RAD:n[a[a.length-1]]=i}if(n=r.find(a[0]),n.type==="ParticleEmitter"&&n.updateVariableState(i,a),Tt.is(n))if(a[1]==="position"||a[1]==="rotation"||a[1]==="scale")n.onVariableUpdate();else if(a[1]==="geometry"){let o=n;n.component&&(o=n.component);let l=o.dataPatched;o.chooseGeoemtryCache(this).forceDelete(l.geometry),o.createGeometryDelayed(this.entityOpContext),o.onVariableUpdate(!0),o.invalidateDownstreamBooleanData(),o.instances.forEach(h=>{let c=h.dataPatched;h.chooseGeoemtryCache(this).forceDelete(c.geometry),h.createGeometryDelayed(this.entityOpContext),h.onVariableUpdate(!0),h.invalidateDownstreamBooleanData()})}else a[1]==="morphTargetInfluences"&&n.updateMorphInfluences(a[2],i)}}return this.requestRender(),!0}deleteVariable(e){this.variables[e]&&delete this.variables[e]}getVariable(e,t){if(Array.isArray(e)){if(e[0]==="mouse")return this.mouseProperty?.[e[1]]??0;if(e[0]==="raycast")return this.raycastProperty?.[e[1]]??0;let i=this.entityOpContext.scene.find(e[0]);if(e[1]==="width"||e[1]==="height"||e[1]==="depth")return i.geometry.userData.parameters[e[1]];for(let r=1;r<e.length;r++)i=i[e[r]];return e[1]==="rotation"&&(i*=Te.RAD2DEG),i}for(let i in this.variables){if(t===void 0)break;let r=this.variables[i],s=r.locations?.findIndex(a=>Hi.equal(a,t));s!==void 0&&s!==-1&&r.locations.splice(s,1)}if(typeof e=="string"){let i=e,r=e;do{if(r=i,this.variables[i]===void 0)break;let s=this.variables[i].value;t&&this.variables[r]!==void 0&&this.variables[r].locations.push(t),i=s}while(typeof i=="string");return i}else return e}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(e=>e.data.name)}getVariableByName(e){for(let t of this.data.variables)if(t.data.name===e)return{variable:t.data,id:t.id}}getDynamicVariablePlayState(e){return this.variables[e]?.dynamicVariablePlayState}setDynamicVariablePlayState(e,t){this.variables[e]!==void 0&&(this.variables[e].dynamicVariablePlayState=t)}getDynamicVariableToggleIsForward(e){return this.variables[e]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(e,t){this.variables[e]!==void 0&&(this.variables[e].dynamicVariableToggleIsForward=t)}resetLib(e){for(let[t,i]of Object.entries(e.images))this.addImage(t,i.asset);for(let[t,i]of Object.entries(e.audios))this.addAudio(t,i.asset);for(let[t,i]of Object.entries(e.particles))this.addParticle(t,i.asset);for(let[t,i]of Object.entries(e.colors))this.addColor(t,i.asset);for(let[t,i]of Object.entries(e.fonts))this.addFont(t,i.asset);for(let[t,i]of Object.entries(e.materials))this.addMaterial(t,i.asset);for(let[t,i]of Object.entries(e.videos))this.addVideo(t,i.asset);for(let[t,i]of Object.entries(e.variables))this.addVariableHolder(t,i.asset)}updateLibByOp(e,t){e.path[0]==="images"?e.path.length===1&&e.type===1?this.addImage(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteImage(e.id):e.path[0]==="videos"?e.path.length===1&&e.type===1?this.addVideo(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteVideo(e.id):e.path[0]==="audios"?e.path.length===1&&e.type===1?this.addAudio(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteAudio(e.id):e.path[0]==="particles"?e.path.length===1&&e.type===1?this.addParticle(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteParticle(e.id):e.path[0]==="colors"?e.path.length===1&&e.type===1?this.addColor
vendor: 22,526 bytes, line 5427
5427(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteColor(e.id):e.path[0]==="materials"?e.path.length===1&&e.type===1?this.addMaterial(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteMaterial(e.id):e.path[0]==="fonts"?e.path.length===1&&e.type===1?this.addFont(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteFont(e.id):e.path[0]==="variables"?e.path.length===1&&e.type===1?this.addVariableHolder(e.id,e.data.asset):e.path.length===1&&e.type===2&&this.deleteVariable(e.id):e.path[0]==="components"&&t.updateByLibOp(e,this)}updateByOp(e,t,i){if(this.data=t,e.path[0]==="images")e.path.length===2&&e.type===0?e.props.data&&this.getImage(e.path[1]).updateSrc(e.props.data):e.path.length===1&&e.type===1?this.addImage(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteImage(e.id);else if(e.path[0]==="videos")e.path.length===2&&e.type===0?e.props.data&&this.getVideo(e.path[1]).updateSrc(e.props.data):e.path.length===1&&e.type===1?this.addVideo(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteVideo(e.id);else if(e.path[0]==="audios")e.path.length===2&&e.type===0?e.props.data&&this.addAudio(e.path[1],t.audios[e.path[1]]):e.path.length===1&&e.type===1?this.addAudio(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteAudio(e.id);else if(e.path[0]==="particles")e.path.length===2&&e.type===0?e.props.data&&this.addParticle(e.path[1],t.particles[e.path[1]]):e.path.length===1&&e.type===1?this.addParticle(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteParticle(e.id);else if(e.path[0]==="colors")e.path.length===2&&e.type===0?this.updateColor(e.path[1],e.props):e.path.length===1&&e.type===1?this.addColor(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteColor(e.id);else if(e.path[0]==="materials")e.path.length===1&&e.type===1?this.addMaterial(e.id,e.data):e.path.length===1&&e.type===2?this.deleteMaterial(e.id):e.path.length>1&&this.getMaterial(e.path[1]).updateByOp(ir.drop(e,2),t.materials[e.path[1]],{shared:this,scene:i});else if(e.path[0]==="fonts")e.path.length===2&&e.type===0?this.updateFont(e.path[1],e,i):e.path.length===1&&e.type===1?this.addFont(e.id,e.data):e.path.length===1&&e.type===2&&this.deleteFont(e.id);else if(e.path[0]==="variables")e.path.length===2&&e.type===0?"value"in e.props?this.updateVariable(e.path[1],e.props.value):"persistent"in e.props&&(this.variables[e.path[1]].persistent=e.props.persistent):e.path.length===1&&e.type===4?this.addVariableHolder(e.id,e.data):e.path.length===1&&e.type===5&&this.deleteVariable(e.id);else if(e.path[0]==="userAPIs"){if(e.path.length===1&&e.type===1)this.addUserAPI(e.id,e.data);else if(e.path.length===1&&e.type===2)this.deleteUserAPI(e.id);else if(typeof e.path[1]=="string"){let r=t.userAPIs[e.path[1]];if(r){let s=e.type===0&&e.props.debounce===void 0,a=this.getUserAPI(e.path[1]);a instanceof yA?a.update(r):a?.update(r,this,s)}}}else if(e.path[0]==="userWebhooks"){if(e.path.length===1&&e.type===1)this.addUserWebhook(e.id,e.data);else if(e.path.length===1&&e.type===2)this.deleteUserWebhook(e.id);else if(typeof e.path[1]=="string"){let r=t.userWebhooks[e.path[1]];r&&this.getUserWebhook(e.path[1])?.update(r)}}else e.path[0]==="lib"&&this.updateLibByOp(ir.drop(e,1),i)}updateFont(e,t,i){if(t.props.url){let r=this.getFont(e),s={...this.data.fonts[e],url:t.props.url};r.update(s),r.loadingPromise.then(()=>this.requestRender()),i.updateFont(e,this)}}addUserAPI(e,t){return this.userAPIs[e]?(this.userAPIs[e].update(t,this),!0):this.openAIRealtime?.id===e?(this.openAIRealtime.update(t),!0):t.integration?.type==="VoiceAssistant"?(this.openAIRealtime=new yA(t,e,this),!1):(this.userAPIs[e]=new nT(e,t,this),!1)}getUserAPI(e){return this.openAIRealtime?.id===e?this.openAIRealtime:this.userAPIs[e]}getUserAPIs(){return this.userAPIs}deleteUserAPI(e){let t=this.userAPIs[e];t&&(t.dispose(),delete this.userAPIs[e])}addUserWebhook(e,t){return this.userWebhooks[e]?(this.userWebhooks[e].update(t),!0):(this.userWebhooks[e]=new vX(e,t),!1)}getUserWebhook(e){return this.userWebhooks[e]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(e){let t=this.userWebhooks[e];t&&(t.dispose(),delete this.userWebhooks[e])}get scene(){return this.entityOpContext.scene}};new bx(ms.emptyData());var uo=class extends xr{updateByPatchedOp(e,t,i){if(super.updateByPatchedOp(e,t,i),CH(e.path,["materials"])!==null&&e.type===0&&Array.isArray(this.material))for(let[r,s]of Object.entries(e.props)){let a=i.shared.material(s);this.material[Number(r)]=a}else if(Qt(e.path,["material"])&&this.material instanceof yn)"material"in t&&typeof t.material!="string"&&this.material.updateByOp(ir.drop(e,1),t.material,i);else if(Qt(e.path,["materials","*"])&&Array.isArray(this.material)){let r=e.path[1];if("materials"in t&&r<this.material.length){let s=t.materials[r];typeof s!="string"&&this.material[r].updateByOp(ir.drop(e,2),s,i)}}}get needsAO(){return this.material!==void 0?(Array.isArray(this.material)?this.material[0]:this.material).hasAO:!1}updateState(e,t){super.updateState(e,t),e.castShadow!==void 0&&(this.castShadow=e.castShadow),e.receiveShadow!==void 0&&(this.receiveShadow=e.receiveShadow);let i=this.dataPatched;this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.shapeBlendNode&&this.layers.set(9);let r;this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(r={resolutionLevel:this.dataPatched.geometry.resolutionLevel,useChildrenColors:this.dataPatched.geometry.useChildrenColors}),e.geometry?.type!=="NonParametricGeometry"&&"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=t.shared.material(e.material).getFlavor(i.flatShading,i.side,i.wireframe,r),t.scene.markNeedsUpdateRendererDirty()),(e.geometry?.type==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&e.materials!==void 0?(this.disposeMaterial(),this.material=e.materials.map(a=>t.shared.material(a).getFlavor(i.flatShading,i.side,i.wireframe)),t.scene.markNeedsUpdateRendererDirty()):"material"in e&&e.material!==void 0&&(this.disposeMaterial(),this.material=[t.shared.material(e.material).getFlavor(i.flatShading,i.side,i.wireframe)],t.scene.markNeedsUpdateRendererDirty()));let s=this.data;if(s.geometry?.type!=="NonParametricGeometry"&&"materials"in s&&s.materials!==void 0&&(this.disposeMaterial(),this.material=t.shared.material(s.materials[0]).getFlavor(i.flatShading,i.side,i.wireframe)),e.flatShading!==void 0||e.wireframe!==void 0||e.side!==void 0)if(Array.isArray(this.material))for(let a=0;a<this.material.length;a++)this.material[a]=this.material[a].getFlavor(i.flatShading,i.side,i.wireframe);else this.material=this.material.getFlavor(i.flatShading,i.side,i.wireframe,r)}disposeMaterial(){this.material&&UE(this.material).forEach(e=>{e instanceof yn&&(e instanceof Sy||e.nodeMaterialDispose())})}dispose(){this.disposeMaterial(),super.dispose()}},xA=new M,bA=new ot,wA=new ot,EX=new M,SA=new xe,ai=class extends uo{constructor(e,t,i){super(e,t),this.data=t,this.isSkinnedMesh=!1,this.localGeometry=void 0,t.bindMode&&t.bindMatrix&&(this.bindMode=t.bindMode,this.bindMatrix=new xe().fromArray(t.bindMatrix),this.bindMatrixInverse=new xe)}chooseGeoemtryCache(e){return e.geometryCache}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof He&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof bx){let e=this.geometryCreateDeleyed,t=this.chooseGeoemtryCache(e);this.geometryCreateDeleyed=t.get(this.dataPatched.geometry,e,this)}return this.geometryCreateDeleyed}set geometry(e){this.localGeometry=e}get is2DAndNoDepth(){let e=this.dataPatched.geometry;return Af.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return Af.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),Qt(e.path,["geometry"])&&this.updateByPatchedOpGeometry(ir.drop(e,1),t.geometry,i)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}updateGeometryInteractions(e,t){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let r=e;if(this.localGeometry===void 0){let u={...this.data.geometry,...r};this.localGeometry=Fh(u,t,this.data.flatShading,this)}let s,a,n;r.scaleBaked?[s,a,n]=r.scaleBaked:{width:s,height:a,depth:n}=r;let o=this.localGeometry.userData,l=typeof s=="number"?s:1,h=typeof a=="number"?a:1,c=typeof n=="number"?n:1;o.sxPrev!==void 0&&gy(this.localGeometry.attributes,l/o.sxPrev,h/o.syPrev,c/o.szPrev),o.sxPrev=l,o.syPrev=h,o.szPrev=c}else{let r={...this.data.geometry,...e};this.localGeometry?.dispose(),this.localGeometry=Fh(r,t,this.data.flatShading,this)}}refreshAttachedClonersInteractions(e){for(let t of this.attachedSurfaceCloners)t.update(e)}refreshAttachedCloners(e){for(let t of this.attachedSurfaceCloners)e.scene.addPendingUpdateCloner(t.object)}refreshAttachedPaths(e){for(let t of this.attachedPaths)e.scene.addPendingCommand(()=>t.updateShape())}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e)}updateByPatchedOpGeometry(e,t,i){let r=!1;e.type===0&&e.path.length===0&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Ir&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(t,e.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),r||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,t){this.createGeometryDelayed(t)}updateState(e,t){e.geometry!==void 0&&this.updateGeometryOnStateUpdate(e.geometry,t);let i=e.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:r,value:s}}of i)this.updateMorphInfluences(r,t.shared.getVariable(s,[this.uuid,"morphTargetInfluences",r]))}super.updateState(e,t)}updateMorphInfluences(e,t){if(this.morphTargetDictionary===void 0)return;let i=this.morphTargetDictionary[e];i!==void 0&&(this.morphTargetInfluences[i]=t)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(e,t){let i=this.geometry.userData.parameters;this.is2DType?e.set(0,0,i.depth*.5):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?e.fromArray(i.centerOffset):e.setScalar(0),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,t){this.skeleton=e,this.isSkinnedMesh=!0,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let t=new ot,i=this.geometry.attributes.skinWeight;for(let r=0,s=i.count;r<s;r++){t.fromBufferAttribute(i,r);let a=1/t.manhattanLength();a!==1/0?t.multiplyScalar(a):t.set(1,0,0,0),i.setXYZW(r,t.x,t.y,t.z,t.w)}}boneTransform(e,t){let i=this.skeleton;if(i===void 0)return;let r=this.geometry;bA.fromBufferAttribute(r.attributes.skinIndex,e),wA.fromBufferAttribute(r.attributes.skinWeight,e),xA.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){let a=wA.getComponent(s);if(a!==0){let n=bA.getComponent(s);SA.multiplyMatrices(i.bones[n].matrixWorld,i.boneInverses[n]),t.addScaledVector(EX.copy(xA).applyMatrix4(SA),a)}}return t.applyMatrix4(this.bindMatrixInverse)}};function CX(e){if(e.geometry.attributes.extrudeNormal||!e.geometry.attributes.position||!e.geometry.attributes.normal)return;let t=new Map,i=e.geometry.attributes,r=i.position.array,s=i.normal.array,a=new Float32Array(r.length);for(let n=0;n<r.length;n+=3){let o=`${r[n]}_${r[n+1]}_${r[n+2]}`,l=new M(s[n],s[n+1],s[n+2]);t.has(o)?t.get(o)?.normals.push(l):t.set(o,{normals:[l],result:new M})}t.forEach((n,o)=>{for(let l of n.normals)n.result.add(l);n.result.divideScalar(n.normals.length)});for(let n=0;n<r.length;n+=3){let o=`${r[n]}_${r[n+1]}_${r[n+2]}`,l=t.get(o)?.result;l&&(a[n]=l.x,a[n+1]=l.y,a[n+2]=l.z)}e.geometry.setAttribute("extrudeNormal",new De(a,3))}function TX(e){if(e.geometry.attributes.extrudeNormals||!e.geometry.attributes.position)return;let t=e.geometry.attributes.position.array,i=new Float32Array(t.length),r=new M;for(let s=0;s<t.length;s+=3)r.set(t[s],t[s+1],t[s+2]).normalize(),i[s]=r.x,i[s+1]=r.y,i[s+2]=r.z;e.geometry.setAttribute("extrudeNormal",new De(i,3))}function wx(e){if(Array.isArray(e.material)){for(let t of e.material)if(t.getLayersOfType("outline").length===0)return}else if(!(e.material instanceof yn)||e.material.getLayersOfType("outline").length===0)return;e instanceof ai&&e.is2DAndNoDepth?TX(e):CX(e)}function Sx(e){if(!e.geometry.attributes.position)return;let t=e.geometry.attributes.position.array,i=new Float32Array(t.length),r=parseInt(e.uuid.replace(/\D/g,"")),s=[Te.seededRandom(r),Te.seededRandom(r+1e4),Te.seededRandom(r+2e4)];for(let a=0;a<t.length;a++)i[a]=s[a%3];e.geometry.setAttribute("randomColor",new tt(i,3))}var $s=new yi,_c=new M;function PX(e){let t=!1;return e.scene.objects.traverse((i,r)=>{r.type==="Mesh"&&r.geometry.type==="SubdivGeometry"&&(t=!0)}),t}var Iu=class extends ai{constructor(e,t,i){super(e,t,i),this.data=t,this.hiddenMatrixOld=new xe,this.smoothShading=!0,this.skipReactionUpdate=!1}chooseGeoemtryCache(e){return this.dataPatched.flatShading?e.geometryCache:e.geometryCache2}get subdivPointerNew(){return this.localGeometry!==void 0?this.subdivPointer:this.geometry.ensureSubdivPointer()}get originalGeometryNew(){return this.localGeometry!==void 0?this.originalGeometry:this.geometry.originalGeometry}get phongAngle(){return this.data.geometry.phongAngle??45}updateEntityBoxSize(e,t){let i=this.geometry.userData.parameters;e.copy(this.originalGeometryNew.boundingSphere.center),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}createGeometryByControls(e){if(this.skipReactionUpdate===!0)return;let t=this.localGeometry?.uuid,{originalGeometry:i,subdividedGeometry:r,subdivPointer:s}=Ir.build(e,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=s,i!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=i),r!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=r??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,wx(this),Sx(this),this.calcBoundingBox(),t&&(this.localGeometry.uuid=t)}updateState(e,t){if(super.updateState(e,t),e.flatShading!==void 0){let i=this.material;this.material=Array.isArray(i)?i.map(r=>r.getFlavor(!1,r.side,r.wireframe)):i.getFlavor(!1,i.side,i.wireframe),this.smoothShading=!e.flatShading,this.createGeometryDelayed(t)}}updateMesh(e=!1){Ir.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0),this.subdividedGeometry&&Ir.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){this.originalGeometry.dispose(),this.originalGeometry=Ir.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Ir.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.localGeometry=this.subdividedGeometry??this.originalGeometry}raycast(e,t){let i=this.localGeometry;this.localGeometry=this.originalGeometryNew,xr.prototype.raycast.call(this,e,t),this.localGeometry=i}activateSVDCompensation(){!this.hasNonUniformScale||(this.matrix.copy(this.matrixWorldRigid),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateSVDCompensation(){!this.hasNonUniformScale||(this.updateMatrix(),this.hasNonUniformScale=void 0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new is,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;$s.setFromBufferAttribute(t),$s.getCenter(i),e.boundingSphere.radius=i.distanceTo($s.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),$s.getSize(_c),this.hasNonUniformScale&&_c.divide(this.scale);let r={width:_c.x,height:_c.y,depth:_c.z};return this.geometry.userData.parameters=r,r}updateBoundingSphere(e){let t=this.originalGeometry;$s.min.set(e[0],e[2],e[4]),$s.max.set(e[1],e[3],e[5]),this.hasNonUniformScale&&($s.min.applyMatrix4(this.shearScaleInv),$s.max.applyMatrix4(this.shearScaleInv)),t.boundingSphere===null&&(t.boundingSphere=new is);let i=t.boundingSphere.center;$s.getCenter(i),t.boundingSphere.radius=i.distanceTo($s.max)}freeSubdivPointer(){this.subdivPointer&&(Ir.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,this.originalGeometry?.dispose(),this.subdividedGeometry?.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateByPatchedOpGeometry(e,t,i){super.updateByPatchedOpGeometry(e,t,i),this.localGeometry&&this.createGeometryByControls(t)}},_A=-1,DX=1,OX={x:[1,0,0],"-x":[-1,0,0],y:[0,1,0],"-y":[0,-1,0],z:[0,0,1],"-z":[0,0,-1]},IX={polygon_center:0,edge:1,vertex:2},sp=(e,t)=>(i,r)=>!t||i===0||e===0?0:e*r/100,mt=(e,t)=>{let i=Math.abs(t),r=i*-1;return(e-_A)*(i-r)/(DX-_A)+r},RX=new M,ap=new M,LX=new M,zX=new M;function yh(e,t){let i=LX.fromArray(e),r=zX.fromArray(t);ap.copy(r).sub(i);let s=ap.length();return ap.normalize().multiplyScalar(s*.5),RX.copy(i).add(ap).toArray()}var gs=new fr,np=new M,jf=new M,zo=new M;function BX(e){let t=[];for(let i=0;i<=e.index.count;i++)if(np.fromArray(e.index.array,i*3),gs.setFromAttributeAndIndices(e.attributes.position,np.x,np.y,np.z),gs.getNormal(jf),gs.getMidpoint(zo),!(isNaN(zo.x)||isNaN(zo.y)||isNaN(zo.z))){let{a:r,b:s,c:a}=gs,n=r.toArray(),o=s.toArray(),l=a.toArray(),h=r.distanceTo(s),c=s.distanceTo(a),u=a.distanceTo(r),d=yh(n,o),p=yh(o,l),f=yh(l,n),m=[h,c,u],g=Math.max(...m),v=m.filter(w=>Math.round(w)===Math.round(g)).length>1,y=[],x=gs.getMidpoint(zo).toArray();g===h&&!v&&(y=[p,f,f],x=d),g===c&&!v&&(y=[d,f,f],x=p),g===u&&!v&&(y=[d,p,p],x=f),v&&(y=[d,p,f]),t.push({vertices:[n,o,l],faceCenters:y,midpoint:x,norm:gs.getNormal(jf).toArray()})}return t}function FX(e){let t=[],{position:i}=e.attributes;for(let r=0;r<i.count;r++){gs.setFromAttributeAndIndices(i,r*3,r*3+1,r*3+2),gs.getNormal(jf),gs.getMidpoint(zo);let s=gs.a.toArray(),a=gs.b.toArray(),n=gs.c.toArray();t.push({vertices:[s,a,n],faceCenters:[yh(s,a),yh(a,n),yh(n,s)],midpoint:zo.toArray(),norm:jf.toArray()})}return t}var kX=4,UX=.5,ev=e=>.5*(1-Math.cos(e*Math.PI)),NX=class{constructor(){this.perlin=new Array(4096)}noise(e,t=0,i=0){if(this.perlin==null){this.perlin=new Array(4096);for(let g=0;g<4096;g++)this.perlin[g]=Math.random()}e<0&&(e=-e),t<0&&(t=-t),i<0&&(i=-i);let r=Math.floor(e),s=Math.floor(t),a=Math.floor(i),n=e-r,o=t-s,l=i-a,h,c,u=0,d=.5,p,f,m;for(let g=0;g<kX;g++){let v=r+(s<<4)+(a<<8);h=ev(n),c=ev(o),p=this.perlin[v&4095],p+=h*(this.perlin[v+1&4095]-p),f=this.perlin[v+16&4095],f+=h*(this.perlin[v+16+1&4095]-f),p+=c*(f-p),v+=256,f=this.perlin[v&4095],f+=h*(this.perlin[v+1&4095]-f),m=this.perlin[v+16&4095],m+=h*(this.perlin[v+16+1&4095]-m),f+=c*(m-f),p+=ev(l)*(f-p),u+=p*d,d*=UX,r<<=1,n*=2,s<<=1,o*=2,a<<=1,l*=2,n>=1&&(r++,n--),o>=1&&(s++,o--),l>=1&&(a++,l--)}return u}noiseSeed(e){let t=(()=>{let i,r;return{setSeed(s){r=i=(s??Math.random()*4294967296)>>>0},getSeed(){return i},rand(){return r=(1664525*r+1013904223)%4294967296,r/4294967296}}})();t.setSeed(e),this.perlin=new Array(4096);for(let i=0;i<4096;i++)this.perlin[i]=t.rand()}},VX=NX,AA=new M,MA=new xe,EA=new Nh;function CA(e){let t=!1;return e.scene.objects.traverse((i,r)=>{r.type==="Mesh"&&(r.geometry.type==="TextGeometry"||r.geometry.type==="InputGeometry")&&(t=!0)}),t}var _x=class extends ai{constructor(e,t,i){super(e,t,i),this.data=t}get textGeometry(){return this.geometry}get charWidths(){return this.textGeometry.charWidths}get charCoords(){return this.textGeometry.charCoords}get wrappedText(){return this.textGeometry.wrappedText}get font(){return this.textGeometry.font}get initialOffsetY(){let e=this.dataPatched;return this.font?.getLineInitialOffsetY(this.lineHeight,this.wrappedText.length,typeof e.geometry.height=="number"?e.geometry.height:1,this.fontScale,e.geometry.verticalAlign)??0}get fontScale(){let e=this.dataPatched;return this.font?e.geometry.fontSize/this.font.unitsPerEm:1}get AD(){return Math.abs(this.ascender-this.descender)}get ascender(){return(this.font?.ascender??1)*this.fontScale}get descender(){return(this.font?.descender??1)*this.fontScale}get lineHeight(){let e=this.dataPatched;return e.geometry.fontSize*e.geometry.lineHeight}raycast(e,t){let{matrixWorld:i}=this;if(!(isNaN(e.ray.origin.x)||this.scale.x===0||this.scale.y===0||this.scale.z===0)&&(MA.copy(i).invert(),EA.copy(e.ray).applyMatrix4(MA),EA.intersectBox(this.singleBBox,AA))){let r=AA.applyMatrix4(i),s=e.ray.origin.distanceTo(r);t.push({distance:s,point:r.clone(),object:this})}}},Pr=1e-4,ea,$T,eP,tP,TA=new M,PA=new M;uT.then(e=>{ea=e,$T=[ea.get_face_center,ea.get_edge_midpoint,ea.get_vertex_position],eP=[ea.get_face_normal,ea.get_edge_normal,ea.get_vertex_normal],tP=[ea.face_count,ea.edge_count,ea.vertex_count]});var jX=new xe,HX=new xe,Dn=new M,op=new M,Ac=new M,tv=new M,GX=new M,WX=new M;function ni(e,t){return[typeof e?.[0]=="number"?e[0]:typeof e?.[0]=="string"&&t?parseFloat(String(t.shared.getVariable(e[0])??"0")):0,typeof e?.[1]=="number"?e[1]:typeof e?.[1]=="string"&&t?parseFloat(String(t.shared.getVariable(e[1])??"0")):0,typeof e?.[2]=="number"?e[2]:typeof e?.[2]=="str
5427ing"&&t?parseFloat(String(t.shared.getVariable(e[2])??"0")):0]}var qX=class{constructor(e,t){this.data=e,this.is3D=t,this.perlin=new VX,e.noiseType==="perlin"?(this.perlin.noiseSeed(e.seed),t?this.noise=(i,r,s)=>this.perlin.noise(i,r,s):this.noise=i=>this.perlin.noise(i)):t?this.noise=y8((0,ly.default)(e.seed)):this.noise=v8((0,ly.default)(e.seed??""))}},ys=class extends rx(Vt){constructor(e,t){super(),this.parameters=t,this.objectForSample=void 0,this._pendingMediaLoad=!1,this.random=null,this.object=e}resetOnMove(){this.removeFromParent(),this.parent=null}expandClones(e){if(this.parent===null)this.updateState(this.parameters,e);else for(let t of this.children)t instanceof vr&&t.expand()}invalidateTransform(e){this.matrixWorldNeedsUpdate=!0,this.traverse(t=>{t instanceof vr&&t.object===e&&(t.matrixWorldNeedsUpdate=!0)})}onObjUpdateMatrix(){this.parameters.type!=="toObject"&&(this.matrixWorldNeedsUpdate=!0)}update(e){switch(this._updateCount(e),this.parameters.type){case"radial":this._updateRadial(this.parameters,e);break;case"linear":this._updateLinear(this.parameters,e);break;case"grid":this._updateGrid(this.parameters,e);break;case"toObject":this._updateToObject(this.parameters,e)}for(let t of this.children)t.updateMatrix(),t.hasNonUniformScale&&(t.updateMatrixWorld(),t.updateMatrixWorldSVD())}_updateCount(e,t){let i;if(t!==void 0)i=t;else{let r=ni(this.parameters.grid.count,e);i=this.parameters.type==="grid"?Math.round(r[0])*Math.round(r[1])*Math.round(r[2]):this.parameters.count}if(this.parameters.type==="toObject"){if(!this.parameters.toObject.object)i=0;else if(t===void 0&&this.parameters.toObject.spreadType!=="random")return}if(this.parameters.type==="toObject"&&this.objectForSample){let r=this.children;if(r.length===i)return;if(r.length<i)for(let s=0,a=i-r.length;s<a;++s){let n=new vr(this.object);n.expand(),this.add(n)}else for(let s=0,a=r.length-i;s<a;++s)this.remove(r[s])}else{if(this.children.length===i)return;if(this.children.length<i)for(let r=0,s=i-this.children.length;r<s;++r){let a=new vr(this.object);a.expand(),this.add(a)}else for(let r=0,s=this.children.length-i;r<s;++r)this.remove(this.children[r])}}getRandom(e,t=!1){return(this.random===null||this.random.data.seed!==e.seed||this.random.is3D!==t)&&(this.random=new qX(e,t)),this.random}_updateRadial(e,t){let i=e.radial,r=i.start*Te.DEG2RAD,s=i.end*Te.DEG2RAD,a=r-s,n=ni(i.rotation,t),o=new Di(n[0],n[1],n[2]),l;switch(i.axis){case"z":l=new M(0,0,1);break;case"y":l=new M(0,1,0);break;default:case"x":l=new M(1,0,0);break}let h=e.randomnessObject??Qn.defaultData([1,1,1]).randomnessObject,c=this.getRandom(h),u=sp(h.strength,this.parameters.randomness);for(let[d,p]of this.children.entries()){let f=d*(h.freqScale/10)+h.movement,m=c.noise(f,f,f),g=d+1,v=ni(i.scale,t),y=ni(h.scale,t);p.scale.x=v[0]+u(g,mt(m,y[0]))||Pr,p.scale.y=v[1]+u(g,mt(m,y[1]))||Pr,p.scale.z=v[2]+u(g,mt(m,y[2]))||Pr,p.position.setScalar(0);let x=a/e.count*d-r;switch(i.axis){case"x":p.rotation.set(0,x,0);break;case"y":p.rotation.set(0,0,x);break;case"z":p.rotation.set(x,0,0);break}p.translateOnAxis(l,i.radius);let w=ni(i.position,t),S=ni(h.position,t);p.position.x+=w[0]+u(g,mt(m,S[0])),p.position.y+=w[1]+u(g,mt(m,S[1])),p.position.z+=w[2]+u(g,mt(m,S[2]));let b=ni(h.rotation,t),E=u(g,mt(m,b[0])),_=u(g,mt(m,b[1])),A=u(g,mt(m,b[2]));i.alignment===!0?(p.rotation.x+=o.x+E,p.rotation.y+=o.y+_,p.rotation.z+=o.z+A):p.rotation.set(o.x+E,o.y+_,o.z+A)}}_updateLinear(e,t){if(e.type!=="linear")throw new Error;let i=e.linear,r=ni(i.rotation,t),s=ni(i.scale,t),a=ni(i.position,t),n=new Di(r[0]??0,r[1]??0,r[2]??0),o=e.randomnessObject??Qn.defaultData([1,1,1]).randomnessObject,l=ni(o.rotation,t),h=ni(o.scale,t),c=ni(o.position,t),u=this.getRandom(o),d=sp(o.strength,this.parameters.randomness);for(let[p,f]of this.children.entries()){let m=p*(o.freqScale/10)+o.movement,g=u.noise(m,m,m),v=p+1,y=d(v,mt(g,l[0])),x=d(v,mt(g,l[1])),w=d(v,mt(g,l[2]));f.scale.x=1+(s[0]-1)*p+d(v,mt(g,h[0]))||Pr,f.scale.y=1+(s[1]-1)*p+d(v,mt(g,h[1]))||Pr,f.scale.z
5427=1+(s[2]-1)*p+d(v,mt(g,h[2]))||Pr,f.rotation.x=n.x*p+y,f.rotation.y=n.y*p+x,f.rotation.z=n.z*p+w,f.position.x=a[0]*p+d(v,mt(g,c[0])),f.position.y=a[1]*p+d(v,mt(g,c[1])),f.position.z=a[2]*p+d(v,mt(g,c[2]))}}_updateGrid(e,t){let i=0,r=e.grid,s=e.randomnessObject??Qn.defaultData([1,1,1]).randomnessObject,a=ni(s.scale,t),n=ni(s.rotation,t),o=ni(s.position,t),l=this.getRandom(s,!0),h=sp(s.strength,this.parameters.randomness),c=ni(r.count,t),u=ni(r.size,t);if(r.useCenter===!0){let d={x:c[0]%2===0?2:1,y:c[1]%2===0?2:1,z:c[2]%2===0?2:1},p=new M(u[0]*(c[0]-d.x)*.5,u[1]*(c[1]-d.y)*.5,u[2]*(c[2]-d.z)*.5);for(let f=0;f<c[0];f++)for(let m=0;m<c[1];m++)for(let g=0;g<c[2];g++){let v=l.noise((f+1)*(s.freqScale/10)+s.movement,(m+1)*(s.freqScale/10)+s.movement,(g+1)*(s.freqScale/10)+s.movement),y=this.children[i++];if(!y)continue;y.scale.x=1+h(i,mt(v,a[0]))||Pr,y.scale.y=1+h(i,mt(v,a[1]))||Pr,y.scale.z=1+h(i,mt(v,a[2]))||Pr;let x=h(i,mt(v,n[0])),w=h(i,mt(v,n[1])),S=h(i,mt(v,n[2]));y.rotation.set(x,w,S),y.position.x=u[0]*f-p.x+h(i,mt(v,o[0])),y.position.y=u[1]*m-p.y+h(i,mt(v,o[1])),y.position.z=u[2]*g-p.z+h(i,mt(v,o[2]))}}else for(let d=0;d<c[0];d++)for(let p=0;p<c[1];p++)for(let f=0;f<c[2];f++){let m=l.noise((d+1)*(s.freqScale/10)+s.movement,(p+1)*(s.freqScale/10)+s.movement,(f+1)*(s.freqScale/10)+s.movement),g=this.children[i++];if(!g)continue;g.scale.x=1+h(i,mt(m,a[0]))||Pr,g.scale.y=1+h(i,mt(m,a[1]))||Pr,g.scale.z
5427=1+h(i,mt(m,a[2]))||Pr;let v=h(i,mt(m,n[0])),y=h(i,mt(m,n[1])),x=h(i,mt(m,n[2]));g.rotation.set(v,y,x),g.position.x=u[0]*d+h(i,mt(m,o[0])),g.position.y=-u[1]*p+h(i,mt(m,o[1])),g.position.z=-u[2]*f+h(i,mt(m,o[2]))}}_updateToObject(e,t){if(e.type!=="toObject")throw new Error;let{toObject:i}=e,r=ni(i.rotation,t),s=ni(i.position,t),a=ni(i.scale,t),n=new Di(r[0],r[1],r[2]),o=e.randomnessObject??Qn.defaultData([1,1,1]).randomnessObject,l=ni(o.rotation,t),h=ni(o.position,t),c=ni(o.scale,t),u=this.getRandom(o),d=sp(o.strength,this.parameters.randomness);if(!i.object){for(let[,v]of this.children.entries())v.position.set(0,0,0),v.scale.setScalar(1),v.rotation.set(0,0,0);this.objectForSample=void 0;return}if(!this.objectForSample)return;if(this.objectForSample instanceof _x)if(!this.objectForSample.font?.isLoaded||this.objectForSample.geometry.attributes.position===void 0){this._pendingMediaLoad=!0;return}else this._pendingMediaLoad=!1;if(this.objectForSample.geometry===void 0&&this.objectForSample.isAncestorOf(this.object.uuid)){console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) seem to be a child/descendant of the object it's being cloned to. Please re-parent it so that they are siblings instead.`);return}let p=this.getSubdivData();if(p.length>0){let v=Math.round(p.length*i.count/100);this._updateCount(t,v)}else{let v=this.objectForSample.geometry.getAttribute("position");if(!v||isNaN(v.count)||v.count===0){console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) cannot be cloned on the surface of "${this.objectForSample.name}" (${this.objectForSample.uuid}) because the latter does not have a valid geometry.`);return}}this.objectForSample.updateMatrixWorld();let f=new x8(this.objectForSample).build(),m=OX[i.axis],g=this.children;f.setRandomGenerator((0,ly.default)(this.object.uuid+i.seed));for(let[v,y]of g.entries()){let x=v*(o.freqScale/10)+o.movement,w=u.noise(x,x,x),S=v+1,b=d(S,mt(w,l[0])),E=d(S,mt(w,l[1])),_=d(S,mt(w,l[2]));i.spreadType==="random"?f.sample(Ac,tv):(p.length&&(Ac.fromArray(p[v].pos),tv.fromArray(p[v].norm)),this.objectForSample instanceof Iu&&Ac.applyMatrix4(jX.copy(this.objectForSample.matrixWorld).invert())),Ac.applyMatrix4(this.object.hiddenMatrix.clone().invert()),y.position.copy(Ac),Dn.fromArray(m);let A=i.align==="normal"?tv:this.object.getWorldDirection(WX),C=op.fromArray(s);op.x+=d(S,mt(w,h[0])),op.y+=d(S,mt(w,h[1])),op.z+=d(S,mt(w,h[2]));let T=Math.acos(A.dot(Dn)),I=GX.crossVectors(Dn,A).normalize(),P=HX.makeRotationAxis(I,T),O=A.clone().cross(this.object.up).normalize(),k=O.clone().cross(A).normalize(),G=new xe().makeBasis(O,A,k),B=new M(Dn.y,Dn.z,Dn.x).normalize(),U=B.clone().cross(Dn).normalize(),Q=new xe().makeBasis(B,Dn,U).invert(),q=new xe().multiplyMatrices(G,Q);y.rotation.setFromRotationMatrix(q),C.applyMatrix4(P),y.position.add(C),y.rotation.x=y.rotation.x+n.x+b,y.rotation.y=y.rotation.y+n.y+E,y.rotation.z=y.rotation.z+n.z+_,y.scale.setScalar(1),y.scale.x=y.scale.x+a[0]+d(S,mt(w,c[0]))||Pr,y.scale.y=y.scale.y+a[1]+d(S,mt(w,c[1]))||Pr,y.scale.z=y.scale.z+a[2]+d(S,mt(w,c[2]))||Pr,y.scale.multiply(this.object.scale),y.hiddenMatrix=this.object.hiddenMatrix}}getSubdivData(){if(!this.objectForSample)return[];let e=this.parameters.toObject.spreadType,t=new Map,i=(s,a)=>{let n=Math.round(s[0]*1e4)+"_"+Math.round(s[1]*1e4)+"_"+Math.round(s[2]*1e4),o=t.get(n);o?(o.pos[0]+=s[0],o.pos[1]+=s[1],o.pos[2]+=s[2],o.norm[0]+=a[0],o.norm[1]+=a[1],o.norm[2]+=a[2],o.count+=1):t.set(n,{pos:[...s],norm:[...a],count:1})};if(e==="random")return[];if(this.objectForSample instanceof Iu){let s=this.objectForSample,a=IX[e],n=tP[a],o=$T[a],l=eP[a],h=n(s.subdivPointerNew);for(let c=0;c<=h-1;c++){let u=o(s.subdivPointerNew,c),d=l(s.subdivPointerNew,c);TA.fromArray(u).applyMatrix4(s.matrixWorld),PA.fromArray(d),i(TA.toArray(),PA.toArray())}}else(this.objectForSample.geometry.index?BX(this.objectForSample.geometry):FX(this.objectForSample.geometry)).forEach((s,a)=>{e==="polygon_center"&&i(s.midpoint,s.norm),e==="vertex"&&(i(s.vertices[0],s.norm),i(s.vertices[1],s.norm),i(s.vertices[2],s.norm)),e==="edge"&&(i(s.faceCenters[0],s.norm),i(s.faceCenters[1],s.norm),i(s.faceCenters[2],s.norm))});let r=Array.from(t.values());for(let s of r)s.pos[0]/=s.count,s.pos[1]/=s.count,s.pos[2]/=s.count,s.norm[0]/=s.count,s.norm[1]/=s.count,s.norm[2]/=s.count;return r}updateState(e,t){if(this.parameters=hm(e),this.parameters.type!=="toObject")(this.parent===null||this.parent!==this.object)&&(this.removeFromParent(),this.object.parent?.add(this),this.matrix=this.object.matrix,this.hiddenMatrix=this.object.hiddenMatrix,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1);else if(this.parent===null||this.parent.uuid!==this.parameters.toObject.object){this.removeFromParent();let i=t.scene.find(this.parameters.toObject.object);i instanceof xr?this.objectForSample=i:this.objectForSample=void 0,this.matrix=new xe,this.hiddenMatrix=new xe,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1,i&&i.add(this)}this.update(t)}get pendingMediaLoad(){return this._pendingMediaLoad}},Gu=e=>{var t;return t=class extends e{},t.geometryHelper=new Hs(30,30,30),t},lp=new Nh,iv=new is,DA=new xe,Wu=(e,t,i,r,s=!1,a=e)=>{let n=t,o=a.matrixWorld;if(n.boundingSphere===null&&n.computeBoundingSphere(),iv.copy(n.boundingSphere),iv.applyM
vendor: 30,610 bytes, lines 5427-5544
5427atrix4(o),i.ray.intersectsSphere(iv)===!1||(DA.copy(o).invert(),lp.copy(i.ray).applyMatrix4(DA),n.boundingBox!==null&&lp.intersectsBox(n.boundingBox)===!1))return;let l,h,c,u,d=n.index,p=n.attributes.position,f=n.drawRange,m,g;if(s===!1){let y=Math.max(0,f.start),x=Math.min(d.count,f.start+f.count);for(m=y,g=x;m<g;m+=3)if(h=d.getX(m),c=d.getX(m+1),u=d.getX(m+2),l=v(e,i,lp,p,h,c,u),l){l.faceIndex=Math.floor(m/3),r.push(l);return}}else{let y=n.attributes.position,x=new M,w=new M,S=new M,b=new M,E=2,_=1/((a.scale.x+a.scale.y+a.scale.z)/3),A=_*_,C=Math.max(0,f.start),T=Math.min(y.count,f.start+f.count);for(let I=C,P=T-1;I<P;I+=E){if(x.fromBufferAttribute(y,I),w.fromBufferAttribute(y,I+1),lp.distanceSqToSegment(x,w,b,S)>A)continue;b.applyMatrix4(a.matrixWorld);let O=i.ray.origin.distanceTo(b);O<i.near||O>i.far||r.push({distance:O,point:S.clone().applyMatrix4(a.matrixWorld),object:e})}}function v(y,x,w,S,b,E,_){let A=new M,C=new M,T=new M,I=new M,P=new M;if(A.fromBufferAttribute(S,b),C.fromBufferAttribute(S,E),T.fromBufferAttribute(S,_),w.intersectTriangle(A,C,T,!1,I)===null)return null;P.copy(I),P.applyMatrix4(y.matrixWorld);let O=x.ray.origin.distanceTo(P);return O<x.near||O>x.far?null:{faceIndex:1,distance:O,point:P.clone(),object:y}}},hp=new M,hs=new go,XX=class extends Bu{constructor(e){let t=new He,i=new vo({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],a={},n=new Je(15711266),o=new Je(15711266),l=new Je(2857471);h("n1","n2",n),h("n2","n4",n),h("n4","n3",n),h("n3","n1",n),h("f1","f2",n),h("f2","f4",n),h("f4","f3",n),h("f3","f1",n),h("n1","f1",n),h("n2","f2",n),h("n3","f3",n),h("n4","f4",n),h("p","n1",o),h("p","n2",o),h("p","n3",o),h("p","n4",o),h("u1","u2",l),h("u2","u3",l),h("u3","u1",l);function h(u,d,p){c(u,p),c(d,p)}function c(u,d){r.push(0,0,0),s.push(d.r,d.g,d.b),a[u]===void 0&&(a[u]=[]),a[u].push(r.length/3-1)}t.setAttribute("position",new De(r,3)),t.setAttribute("color",new De(s,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let e=this.geometry,t=this.pointMap;hs.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=1,r=1,s=.8;Ts("n1",t,e,hs,-i,-r,s),Ts("n2",t,e,hs,i,-r,s),Ts("n3",t,e,hs,-i,r,s),Ts("n4",t,e,hs,i,r,s);let a=s;Ts("f1",t,e,hs,-i,-r,a),Ts("f2",t,e,hs,i,-r,a),Ts("f3",t,e,hs,-i,r,a),Ts("f4",t,e,hs,i,r,a);let n=a,o=.5;Ts("u1",t,e,hs,i*.7*o,r*1.1,n),Ts("u2",t,e,hs,-i*.7*o,r*1.1,n),Ts("u3",t,e,hs,0,r*(1.1+.9*o),n),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function Ts(e,t,i,r,s,a,n){hp.set(s,a,n).unproject(r);let o=t[e];if(o!==void 0){let l=i.getAttribute("position");for(let h=0,c=o.length;h<c;h++)l.setXYZ(o[h],hp.x,hp.y,hp.z)}}var YX=class extends Gu(XX){constructor(e){super(e),this.object=e,this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,t){Wu(this.object,this.geometry,e,t,!0)}},Ay;(e=>e.is=t=>"objectHelper"in t)(Ay||(Ay={}));var tc=(e,t)=>class extends sx(e){constructor(){super(...arguments),this.objectHelper=new t(this),this.gizmos={}}get geometryHelper(){return t.geometryHelper}raycast(i,r){this.objectHelper.raycast(i,r)}showGizmos(){for(let i in this.gizmos){let r=this.gizmos[i];r instanceof rf&&(r.visible=!0)}}updateEntityBoxSize(i,r){this.objectHelper.visible&&this.geometryHelper instanceof Hs?(i.setScalar(0),r.set(this.geometryHelper.parameters.width,this.geometryHelper.parameters.height,this.geometryHelper.parameters.height).multiplyScalar(.5)):super.updateEntityBoxSize(i,r)}hideGizmos(){for(let i in this.gizmos){let r=this.gizmos[i];r instanceof rf&&(r.visible=!1)}}},cp=790,Fl=new M,rv=new M,sv=new nt,av=new M,Mc=new M,nv=new M,qi=class extends tc(go,YX){constructor(e="",t={...Mu.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=Ph.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this.super_Entity(e,t),this.previousProjectionMatrix=new xe,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,r=this.height;this.orthoCamera=new $f(i*-.5,i*.5,r*.5,r*-.5,-5e4,1e4),this.perspCamera=new wr(45,i/r,50,1e4),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.objectHelper.update()}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}set fov(e){this.perspCamera.fov=e}get fov(){return this.perspCamera.fov}setNear(e,t){e==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}setZoom(e,t){t>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e,t,i){typeof e=="number"&&(e=new M(e,t,i)),super.lookAt(e),this.getWorldPosition(Fl),this.targetOffset=Fl.distanceTo(e)}getTarget(e=new M){return this.getWorldDirection(rv),this.getWorldPosition(Fl),rv.multiplyScalar(this.targetOffset),e.copy(Fl).add(rv),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(Fl),Fl.distanceTo(e)}updateUp(){this.getWorldQuaternion(sv),av.set(0,0,1).applyQuaternion(sv),Mc.copy(Vt.DEFAULT_UP),this.isUpVectorFlipped&&Mc.negate(),Mc.applyQuaternion(sv),nv.copy(Vt.DEFAULT_UP).projectOnPlane(av),this.angleOffsetFromUp=nv.angleTo(Mc),this.angleOffsetFromUp*=nv.cross(Mc).dot(av)>=0?1:-1}updateTransformState(e,t){let i=super.updateTransformState(e,t);return e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateUp(),i}getViewFrontToObject(e){let t=e.getWorldPosition(new M),i=e.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:t.clone().add(i),target:t}}getViewToTarget(e){let t=this.getWorldDirection(new M).multiplyScalar(this.targetOffset);return{position:e.clone().sub(t),target:e}}getViewToObject(e){let t=new M;return e.getWorldPosition(t),this.getViewToTarget(t)}setViewplaneSize(e,t,i=!1){if(this.aspect=e/t,i){let r=e>t?this.aspect:1,s=e>t?1:this.aspect;this.left=-cp*.5*r,this.right=cp*.5*r,this.top=cp*.5*(1/s),this.bottom=-cp*.5*(1/s)}else this.left=-e*.5,this.right=e*.5,this.top=t*.5,this.bottom=-t*.5;this.updateProjectionMatrix()}copyViewPlaneSize(e){this.aspect=e.aspect,this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this.objectHelper&&this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,t,i,r,s,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,t,i,r,s,a):this.orthoCamera.setViewOffset(e,t,i,r,s,a)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}copyHistory(){this.previousProjectionMatrix&&this.previousProjectionMatrix.copy(this.projectionMatrix)}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,t){return super.copy(e,t),this.parent=e.parent,this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}toCameraState(e=[]){let t={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return u0(t,e)}updateCameraSubtype(e,t){let i=e==="perspective"?"PerspectiveCamera":"OrthographicCamera";t.zoom!==void 0&&this.setZoom(i,t.zoom),t.near!==void 0&&this.setNear(i,t.near),t.fov!==void 0&&i==="PerspectiveCamera"&&(this.fov=t.fov)}updateState(e,t){this.updateCameraState(e,t)}updateCameraState(e,t){this.updateState_Entity(e,t),e.far!==void 0&&(this.far=e.far),e.orthographic!==void 0&&this.updateCameraSubtype("orthographic",e.orthographic),e.perspective!==void 0&&this.updateCameraSubtype("perspective",e.perspective),e.type!==void 0&&(this.cameraType=e.type),e.up!==void 0&&this.up.fromArray(e.up.map(i=>typeof i=="number"?i:0)),e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix()}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),e.path.length===1&&e.type===0&&this.updateCameraSubtype(e.path[0],e.props)}toState(e){return{...super.toState(e),...this.toCameraState(e),type:this.cameraType}}},kl=new xe,QX=new xe;function OA(e){let t=!1;return e.scene.objects.traverse((i,r)=>{r.geometry?.type==="BooleanGeometry"&&(t=!0)}),t}var al=class extends uo{constructor(e,t,i){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new He,this.onAfterRender=(r,s,a,n,o,l)=>{super.onAfterRender(r,s,a,n,o,l),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),e.path.length===1&&e.path[0]==="geometry"&&e.type===0&&e.props.operation!==void 0&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(e,t=!0){if(this.booleanMeshSetAddress!==-1&&!e)return;for(let r=0;r<this.children.length;r++){let s=this.children[r];s instanceof al&&s.dataPatched.visible===!0&&s.recomputeBoolean(e===!0,t)}this.meshSetAddresses=[];for(let r=0;r<this.children.length;r++){let s=this.children[r];if(s instanceof xr&&s.dataPatched.visible===!0&&s.geometry.attributes.position?.count>0&&s.geometry.drawRange.count>0&&s.booleanMeshSetAddress!==0){kl.multiplyMatrices(s.hiddenMatrix,s.matrix).multiply(s.pivotMatrix);try{if(s.booleanMeshSetAddress===-1){if((s.geometry.index??s.geometry.getAttribute("position")).count/3<15e5&&(s.booleanMeshSetAddress=Xa.getMeshSet(s.geometry,e===!0,t)),s.booleanMeshSetAddress===-1)return;Xa.transformMeshSet(s.booleanMeshSetAddress,kl),s.booleanMatrixInvOld.copy(kl).invert(),s.booleanWasTransformed=!1}else s instanceof al&&s.needsTransformForDownstream===!0?(Xa.transformMeshSet(s.booleanMeshSetAddress,kl),s.needsTransformForDownstream=!1):s.booleanWasTransformed===!0&&(Xa.transformMeshSet(s.booleanMeshSetAddress,QX.multiplyMatrices(kl,s.booleanMatrixInvOld)),s.booleanMatrixInvOld.copy(kl).invert(),s.booleanWasTransformed=!1)}catch(a){console.error(a),s.booleanMeshSetAddress=0,s.geometry.userData.booleanOperationDidFail=!0;continue}Xa.hasOpenEdges(s.booleanMeshSetAddress)===!1||r===this.children.length-1&&this.booleanOp===2?(this.meshSetAddresses.push(s.booleanMeshSetAddress),s.geometry.userData.booleanOperationDidFail=!1):s.geometry.userData.booleanOperationDidFail="openEdges"}}if(this.meshSetAddresses.length===0){this.geometry.setAttribute("position",new De([],0)),this.geometry.setDrawRange(0,0);return}if(e===!0)return Xa.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new He,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=Xa.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(r){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(r)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,wx(this),Sx(this)}dispose(){super.dispose(),this.geometry.dispose()}},Hf;(e=>{function t(i){return Tt.is(i)&&i instanceof Uu}e.is=t})(Hf||(Hf={}));var Ax=(e,t)=>class extends tc(e,t){updateState_Light(i,r){this.updateState_Entity(i,r),i.color!==void 0&&(this.color=r.shared.color(i.color)),i.intensity!==void 0&&(this.intensity=i.intensity),i.depth!==void 0&&(this.shadow.camera.far=i.depth,this.shadow.needsUpdate=!0),i.shadows!==void 0&&(this.castShadow=i.shadows)}},fa=e=>e instanceof xr,ln=e=>e!==null&&e instanceof al,My=e=>Ay.is(e),KX=new M(1,1,1),IA=new M,ZX=new M,RA=new nt,qu=class extends Gu(YB){constructor(e,t=15){super(t),this.object=e,this.dummy=new nn,this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=this.dummy.matrixWorld,this.matrixAutoUpdate=!1,this.object.isBone&&(this.visible=!1)}raycast(e,t){Wu(this.object,qu.geometryHelper,e,t,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(IA,RA,ZX),this.matrix.compose(IA,RA,KX),super.updateMatrixWorld(e)}updateWorldMatrix(e,t){}},xh=class extends tc(nn,qu){constructor(e,t){super(),this.super_Entity(e,t),this.objectHelper.update()}updateState(e,t){this.updateState_Entity(e,t),"buffer"in e&&Object.keys(e).length===1&&t.scene.reloadSplats()}},au=class extends tc(nn,qu){constructor(e,t,i){super(),this.super_Entity(e,t),this.context=i,this.objectHelper.update()}updateState(e,t){this.updateState_Entity(e,t)}},iP={RED:0,GREEN:1},Xu="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",JX=`#ifdef FRAMEBUFFER_PRECISION_HIGH 5428uniform mediump sampler2D inputBuffer; 5429#else 5430uniform lowp sampler2D inputBuffer; 5431#endif 5432uniform lowp sampler2D cocBuffer;uniform vec2 texelSize;uniform float scale;uniform vec4 kernel64[32];varying vec2 vUv;void main(){ 5433#ifdef FOREGROUND 5434vec2 CoCNearFar=texture2D(cocBuffer,vUv).rg;float CoC=CoCNearFar.r*scale; 5435#else 5436float CoC=texture2D(cocBuffer,vUv).g*scale; 5437#endif 5438if(CoC==0.0){gl_FragColor=texture2D(inputBuffer,vUv);}else{ 5439#ifdef FOREGROUND 5440vec2 step=texelSize*max(CoC,CoCNearFar.g*scale); 5441#else 5442vec2 step=texelSize*CoC; 5443#endif 5444vec4 acc=vec4(0.0);for(int i=0;i<32;++i){vec4 kernel=kernel64[i];vec2 uv=step*kernel.xy+vUv;acc+=texture2D(inputBuffer,uv);uv=step*kernel.zw+vUv;acc+=texture2D(inputBuffer,uv);}gl_FragColor=acc/64.0;}}`,up=class extends Dt{constructor(e=!1,t=!1){super({name:"BokehMaterial",defines:{PASS:e?"2":"1"},uniforms:{kernel64:new ge(null),kernel16:new ge(null),inputBuffer:new ge(null),cocBuffer:new ge(null),texelSize:new ge(new H),scale:new ge(1)},blending:Ri,depthWrite:!1,depthTest:!1,fragmentShader:JX,vertexShader:Xu}),this.toneMapped=!1,t&&(this.defines.FOREGROUND="1"),this.generateKernel()}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}set cocBuffer(e){this.uniforms.cocBuffer.value=e}setCoCBuffer(e){this.uniforms.cocBuffer.value=e}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(e){return this.uniforms.scale.value=e}setScale(e){this.uniforms.scale.value=e}generateKernel(){let e=2.39996323,t=new Float32Array(128),i=new Float32Array(32),r=0,s=0;for(let o=0;o<80;++o){let l=o*e,h=Math.sqrt(o)/Math.sqrt(80),c=h*Math.cos(l),u=h*Math.sin(l);o%5===0?(i[s++]=c,i[s++]=u):(t[r++]=c,t[r++]=u)}let a=[],n=[];for(let o=0;o<128;)a.push(new ot(t[o++],t[o++],t[o++],t[o++]));for(let o=0;o<32;)n.push(new ot(i[o++],i[o++],i[o++],i[o++]));this.uniforms.kernel64.value=a,this.uniforms.kernel16.value=n}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}};function LA(e,t,i){return e*(t-i)-t}function Ey(e,t,i){return Math.min(Math.max((e+t)/(t-i),0),1)}var $X=`#include <common> 5445#include <packing> 5446#ifdef GL_FRAGMENT_PRECISION_HIGH 5447uniform highp sampler2D depthBuffer; 5448#else 5449uniform mediump sampler2D depthBuffer; 5450#endif 5451uniform float focusDistance;uniform float focusRange;uniform float cameraNear;uniform float cameraFar;varying vec2 vUv;float readDepth(const in vec2 uv){ 5452#if DEPTH_PACKING == 3201 5453return unpackRGBAToDepth(texture2D(depthBuffer,uv)); 5454#else 5455return texture2D(depthBuffer,uv).r; 5456#endif 5457}void main(){float depth=readDepth(vUv); 5458#ifdef PERSPECTIVE_CAMERA 5459float viewZ=perspectiveDepthToViewZ(depth,cameraNear,cameraFar);float linearDepth=viewZToOrthographicDepth(viewZ,cameraNear,cameraFar); 5460#else 5461float linearDepth=depth; 5462#endif 5463float signedDistance=linearDepth-focusDistance;float magnitude=smoothstep(0.0,focusRange,abs(signedDistance));gl_FragColor.rg=magnitude*vec2(step(signedDistance,0.0),step(0.0,signedDistance));}`,eY=class extends Dt{constructor(e){super({name:"CircleOfConfusionMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new ge(null),focusDistance:new ge(0),focusRange:new ge(0),cameraNear:new ge(.3),cameraFar:new ge(1e3)},blending:Ri,depthWrite:!1,depthTest:!1,fragmentShader:$X,vertexShader:Xu}),this.toneMapped=!1,this.uniforms.focalLength=this.uniforms.focusRange,this.adoptCameraSettings(e)}get near(){return this.uniforms.cameraNear.value}get far(){return this.uniforms.cameraFar.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=xn){this.depthBuffer=e,this.depthPacking=t}get focusDistance(){return this.uniforms.focusDistance.value}set focusDistance(e){this.uniforms.focusDistance.value=e}get worldFocusDistance(){return-LA(this.focusDistance,this.near,this.far)}set worldFocusDistance(e){this.focusDistance=Ey(-e,this.near,this.far)}getFocusDistance(e){this.uniforms.focusDistance.value=e}setFocusDistance(e){this.uniforms.focusDistance.value=e}get focalLength(){return this.focusRange}set focalLength(e){this.focusRange=e}get focusRange(){return this.uniforms.focusRange.value}set focusRange(e){this.uniforms.focusRange.value=e}get worldFocusRange(){return-LA(this.focusRange,this.near,this.far)}set worldFocusRange(e){this.focusRange=Ey(-e,this.near,this.far)}getFocalLength(e){return this.focusRange}setFocalLength(e){this.focusRange=e}adoptCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof wr?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},tY=`#include <common> 5464#include <dithering_pars_fragment> 5465#ifdef FRAMEBUFFER_PRECISION_HIGH 5466uniform mediump sampler2D inputBuffer; 5467#else 5468uniform lowp sampler2D inputBuffer; 5469#endif 5470varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25; 5471#include <encodings_fragment> 5472#include <dithering_fragment> 5473}`,iY="uniform vec2 texelSize;uniform vec2 halfTexelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize*vec2(kernel)+halfTexelSize)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}",zA=class extends Dt{constructor(e=new H){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new ge(null),texelSize:new ge(new H),halfTexelSize:new ge(new H),kernel:new ge(0),scale:new ge(1)},blending:Ri,depthWrite:!1,depthTest:!1,fragmentShader:tY,vertexShader:iY}),this.toneMapped=!1,this.setTexelSize(e.x,e.y)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.inputBuffer=e}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(){return this.uniforms.scale.value}setScale(e){this.uniforms.scale.value=e}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(e){this.uniforms.kernel.value=e}setKernel(e){this.kernel=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t),this.uniforms.halfTexelSize.value.set(e,t).multiplyScalar(.5)}setSize(e,t){let i=this.uniforms;i.texelSize.value.set(1/e,1/t),i.halfTexelSize.value.copy(i.texelSize.value).multiplyScalar(.5)}},rY=`#ifdef FRAMEBUFFER_PRECISION_HIGH 5474uniform mediump sampler2D inputBuffer; 5475#else 5476uniform lowp sampler2D inputBuffer; 5477#endif 5478uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel; 5479#include <encodings_fragment> 5480}`,sY=class extends Dt{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new ge(null),opacity:new ge(1)},blending:Ri,depthWrite:!1,depthTest:!1,fragmentShader:rY,vertexShader:Xu}),this.toneMapped=!1}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}getOpacity(e){return this.uniforms.opacity.value}setOpacity(e){this.uniforms.opacity.value=e}},aY=`varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1; 5481#if THREE_REVISION < 143 5482#define luminance(v) linearToRelativeLuminance(v) 5483#endif 5484#if EDGE_DETECTION_MODE != 0 5485varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5; 5486#endif 5487#if EDGE_DETECTION_MODE == 1 5488#include <common> 5489#endif 5490#if EDGE_DETECTION_MODE == 0 || PREDICATION_MODE == 1 5491#ifdef GL_FRAGMENT_PRECISION_HIGH 5492uniform highp sampler2D depthBuffer; 5493#else 5494uniform mediump sampler2D depthBuffer; 5495#endif 5496float readDepth(const in vec2 uv){ 5497#if DEPTH_PACKING == 3201 5498return unpackRGBAToDepth(texture2D(depthBuffer,uv)); 5499#else 5500return texture2D(depthBuffer,uv).r; 5501#endif 5502}vec3 gatherNeighbors(){float p=readDepth(vUv);float pLeft=readDepth(vUv0);float pTop=readDepth(vUv1);return vec3(p,pLeft,pTop);} 5503#elif PREDICATION_MODE == 2 5504uniform sampler2D predicationBuffer;vec3 gatherNeighbors(){float p=texture2D(predicationBuffer,vUv).r;float pLeft=texture2D(predicationBuffer,vUv0).r;float pTop=texture2D(predicationBuffer,vUv1).r;return vec3(p,pLeft,pTop);} 5505#endif 5506#if PREDICATION_MODE != 0 5507vec2 calculatePredicatedThreshold(){vec3 neighbours=gatherNeighbors();vec2 delta=abs(neighbours.xx-neighbours.yz);vec2 edges=step(PREDICATION_THRESHOLD,delta);return PREDICATION_SCALE*EDGE_THRESHOLD*(1.0-PREDICATION_STRENGTH*edges);} 5508#endif 5509#if EDGE_DETECTION_MODE != 0 5510uniform sampler2D inputBuffer; 5511#endif 5512void main(){ 5513#if EDGE_DETECTION_MODE == 0 5514const vec2 threshold=vec2(DEPTH_THRESHOLD); 5515#elif PREDICATION_MODE != 0 5516vec2 threshold=calculatePredicatedThreshold(); 5517#else 5518const vec2 threshold=vec2(EDGE_THRESHOLD); 5519#endif 5520#if EDGE_DETECTION_MODE == 0 5521vec3 neighbors=gatherNeighbors();vec2 delta=abs(neighbors.xx-vec2(neighbors.y,neighbors.z));vec2 edges=step(threshold,delta);if(dot(edges,vec2(1.0))==0.0){discard;}gl_FragColor=vec4(edges,0.0,1.0); 5522#elif EDGE_DETECTION_MODE == 1 5523float l=luminance(texture2D(inputBuffer,vUv).rgb);float lLeft=luminance(texture2D(inputBuffer,vUv0).rgb);float lTop=luminance(texture2D(inputBuffer,vUv1).rgb);vec4 delta;delta.xy=abs(l-vec2(lLeft,lTop));vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}float lRight=luminance(texture2D(inputBuffer,vUv2).rgb);float lBottom=luminance(texture2D(inputBuffer,vUv3).rgb);delta.zw=abs(l-vec2(lRight,lBottom));vec2 maxDelta=max(delta.xy,delta.zw);float lLeftLeft=luminance(texture2D(inputBuffer,vUv4).rgb);float lTopTop=luminance(texture2D(inputBuffer,vUv5).rgb);delta.zw=abs(vec2(lLeft,lTop)-vec2(lLeftLeft,lTopTop));maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges.xy*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0); 5524#elif EDGE_DETECTION_MODE == 2 5525vec4 delta;vec3 c=texture2D(inputBuffer,vUv).rgb;vec3 cLeft=texture2D(inputBuffer,vUv0).rgb;vec3 t=abs(c-cLeft);delta.x=max(max(t.r,t.g),t.b);vec3 cTop=texture2D(inputBuffer,vUv1).rgb;t=abs(c-cTop);delta.y=max(max(t.r,t.g),t.b);vec2 edges=step(threshold,delta.xy);if(dot(edges,vec2(1.0))==0.0){discard;}vec3 cRight=texture2D(inputBuffer,vUv2).rgb;t=abs(c-cRight);delta.z=max(max(t.r,t.g),t.b);vec3 cBottom=texture2D(inputBuffer,vUv3).rgb;t=abs(c-cBottom);delta.w=max(max(t.r,t.g),t.b);vec2 maxDelta=max(delta.xy,delta.zw);vec3 cLeftLeft=texture2D(inputBuffer,vUv4).rgb;t=abs(c-cLeftLeft);delta.z=max(max(t.r,t.g),t.b);vec3 cTopTop=texture2D(inputBuffer,vUv5).rgb;t=abs(c-cTopTop);delta.w=max(max(t.r,t.g),t.b);maxDelta=max(maxDelta.xy,delta.zw);float finalDelta=max(maxDelta.x,maxDelta.y);edges*=step(finalDelta,LOCAL_CONTRAST_ADAPTATION_FACTOR*delta.xy);gl_FragColor=vec4(edges,0.0,1.0); 5526#endif 5527}`,nY=`uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1; 5528#if EDGE_DETECTION_MODE != 0 5529varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5; 5530#endif 5531void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,0.0);vUv1=vUv+texelSize*vec2(0.0,-1.0); 5532#if EDGE_DETECTION_MODE != 0 5533vUv2=vUv+texelSize*vec2(1.0,0.0);vUv3=vUv+texelSize*vec2(0.0,1.0);vUv4=vUv+texelSize*vec2(-2.0,0.0);vUv5=vUv+texelSize*vec2(0.0,-2.0); 5534#endif 5535gl_Position=vec4(position.xy,1.0,1.0);}`,Sm={COLOR:2},oY={DISABLED:0},lY=class extends Dt{constructor(e=new H,t=Sm.COLOR){super({name:"EdgeDetectionMaterial",defines:{THREE_REVISION:Uh.replace(/\D+/g,""),LOCAL_CONTRAST_ADAPTATION_FACTOR:"2.0",EDGE_THRESHOLD:"0.1",DEPTH_THRESHOLD:"0.01",PREDICATION_MODE:"0",PREDICATION_THRESHOLD:"0.01",PREDICATION_SCALE:"2.0",PREDICATION_STRENGTH:"1.0",DEPTH_PACKING:"0"},uniforms:{inputBuffer:new ge(null),depthBuffer:new ge(null),predicationBuffer:new ge(null),texelSize:new ge(e)},blending:Ri,depthWrite:!1,depthTest:!1,fragmentShader:aY,vertexShader:nY}),this.toneMapped=!1,this.edgeDetectionMode=t}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=xn){this.depthBuffer=e,this.depthPacking=t}get edgeDetectionMode(){return Number(this.defines.EDGE_DETECTION_MODE)}set edgeDetectionMode(e){this.defines.EDGE_DETECTION_MODE=e.toFixed(0),this.needsUpdate=!0}getEdgeDetectionMode(){return this.edgeDetectionMode}setEdgeDetectionMode(e){this.edgeDetectionMode=e}get localContrastAdaptationFactor(){return Number(this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR)}set localContrastAdaptationFactor(e){this.defines.LOCAL_CONTRAST_ADAPTATION_FACTOR=e.toFixed("6"),this.needsUpdate=!0}getLocalContrastAdaptationFactor(){return this.localContrastAdaptationFactor}setLocalContrastAdaptationFactor(e){this.localContrastAdaptationFactor=e}get edgeDetectionThreshold(){return Number(this.defines.EDGE_THRESHOLD)}set edgeDetectionThreshold(e){this.defines.EDGE_THRESHOLD=e.toFixed("6"),this.defines.DEPTH_THRESHOLD=(e*.1).toFixed("6"),this.needsUpdate=!0}getEdgeDetectionThreshold(){return this.edgeDetectionThreshold}setEdgeDetectionThreshold(e){this.edgeDetectionThreshold=e}get predicationMode(){return Number(this.defines.PREDICATION_MODE)}set predicationMode(e){this.defines.PREDICATION_MODE=e.toFixed(0),this.needsUpdate=!0}getPredicationMode(){return this.predicationMode}setPredicationMode(e){this.predicationMode=e}set predicationBuffer(e){this.uniforms.predicationBuffer.value=e}setPredicationBuffer(e){this.uniforms.predicationBuffer.value=e}get predicationThreshold(){return Number(this.defines.PREDICATION_THRESHOLD)}set predicationThreshold(e){this.defines.PREDICATION_THRESHOLD=e.toFixed("6"),this.needsUpdate=!0}getPredicationThreshold(){return this.predicationThreshold}setPredicationThreshold(e){this.predicationThreshold=e}get predicationScale(){return Number(this.defines.PREDICATION_SCALE)}set predicationScale(e){this.defines.PREDICATION_SCALE=e.toFixed("6"),this.needsUpdate=!0}getPredicationScale(){return this.predicationScale}setPredicationScale(e){this.predicationScale=e}get predicationStrength(){return Number(this.defines.PREDICATION_STRENGTH)}set predicationStrength(e){this.defines.PREDICATION_STRENGTH=e.toFixed("6"),this.needsUpdate=!0}getPredicationStrength(){return this.predicationStrength}setPredicationStrength(e){this.predicationStrength=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},hY=`#include <common> 5536#include <packing> 5537#include <dithering_pars_fragment> 5538#define packFloatToRGBA(v) packDepthToRGBA(v) 5539#define unpackRGBAToFloat(v) unpackRGBAToDepth(v) 5540#ifdef FRAMEBUFFER_PRECISION_HIGH 5541uniform mediump sampler2D inputBuffer; 5542#else 5543uniform lowp sampler2D inputBuffer; 5544#en
5544dif 5545#ifdef GL_FRAGMENT_PRECISION_HIGH 5546uniform highp sampler2D depthBuffer; 5547#else 5548uniform mediump sampler2D depthBuffer; 5549#endif 5550uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv; 5551#if THREE_REVISION < 143 5552#define luminance(v) linearToRelativeLuminance(v) 5553#endif 5554#if THREE_REVISION >= 137 5555vec4 sRGBToLinear(const in vec4 value){return vec4(mix(pow(value.rgb*0.9478672986+vec3(0.0521327014),vec3(2.4)),value.rgb*0.0773993808,vec3(lessThanEqual(value.rgb,vec3(0.04045)))),value.a);} 5556#endif 5557float readDepth(const in vec2 uv){ 5558#if DEPTH_PACKING == 3201 5559return unpackRGBAToDepth(texture2D(depthBuffer,uv)); 5560#else 5561return texture2D(depthBuffer,uv).r; 5562#endif 5563}float getViewZ(const in float depth){ 5564#ifdef PERSPECTIVE_CAMERA 5565return perspectiveDepthToViewZ(depth,cameraNear,cameraFar); 5566#else 5567return orthographicDepthToViewZ(depth,cameraNear,cameraFar); 5568#endif 5569}FRAGMENT_HEADvoid main(){FRAGMENT_MAIN_UVvec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGEgl_FragColor=color0; 5570#ifdef ENCODE_OUTPUT 5571#include <encodings_fragment> 5572#endif 5573#include <dithering_fragment> 5574}`,cY="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEADvoid main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORTgl_Position=vec4(position.xy,1.0,1.0);}",Ps={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},Cy=class extends Dt{constructor(e,t,i,r,s=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:Uh.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new ge(null),depthBuffer:new ge(null),resolution:new ge(new H),texelSize:new ge(new H),cameraNear:new ge(.3),cameraFar:new ge(1e3),aspect:new ge(1),time:new ge(0)},blending:Ri,depthWrite:!1,depthTest:!1,dithering:s}),this.toneMapped=!1,e&&this.setShaderParts(e),t&&this.setDefines(t),i&&this.setUniforms(i),this.adoptCameraSettings(r)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=xn){this.depthBuffer=e,this.depthPacking=t}setShaderParts(e){return this.fragmentShader=hY.replace(Ps.FRAGMENT_HEAD,e.get(Ps.FRAGMENT_HEAD)).replace(Ps.FRAGMENT_MAIN_UV,e.get(Ps.FRAGMENT_MAIN_UV)).replace(Ps.FRAGMENT_MAIN_IMAGE,e.get(Ps.FRAGMENT_MAIN_IMAGE)),this.vertexShader=cY.replace(Ps.VERTEX_HEAD,e.get(Ps.VERTEX_HEAD)).replace(Ps.VERTEX_MAIN_SUPPORT,e.get(Ps.VERTEX_MAIN_SUPPORT)),this.needsUpdate=!0,this}setDefines(e){for(let t of e.entries())this.defines[t[0]]=t[1];return this.needsUpdate=!0,this}setUniforms(e){for(let t of e.entries())this.uniforms[t[0]]=t[1];return this}setExtensions(e){this.extensions={};for(let t of e)this.extensions[t]=!0;return this}get encodeOutput(){return this.defines.ENCODE_OUTPUT!==void 0}set encodeOutput(e){this.encodeOutput!==e&&(e?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(e){return this.encodeOutput}setOutputEncodingEnabled(e){this.encodeOutput=e}get time(){return this.uniforms.time.value}set time(e){this.uniforms.time.value=e}setDeltaTime(e){this.uniforms.time.value+=e}adoptCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof wr?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){let i=this.uniforms;i.resolution.value.set(e,t),i.texelSize.value.set(1/e,1/t),i.aspect.value=e/t}static get Section(){return Ps}},uY=`#include <common> 5575#if THREE_REVISION < 143 5576#define luminance(v) linearToRelativeLuminance(v) 5577#endif 5578#ifdef FRAMEBUFFER_PRECISION_HIGH 5579uniform mediump sampler2D inputBuffer; 5580#else 5581uniform lowp sampler2D inputBuffer; 5582#endif 5583#ifdef RANGE 5584uniform vec2 range; 5585#elif defined(THRESHOLD) 5586uniform float threshold;uniform float smoothing; 5587#endif 5588varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb); 5589#ifdef RANGE 5590float low=step(range.x,l);float high=step(l,range.y);l*=low*high; 5591#elif defined(THRESHOLD) 5592l=smoothstep(threshold,threshold+smoothing,l); 5593#endif 5594#ifdef COLOR 5595gl_FragColor=vec4(texel.rgb*l,l); 5596#else 5597gl_FragColor=vec4(l); 5598#endif 5599}`,dY=class extends Dt{constructor(e=!1,t=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:Uh.replace(/\D+/g,"")},uniforms:{inputBuffer:new ge(null),threshold:new ge(0),smoothing:new ge(1),range:new ge(null)},blending:Ri,depthWrite:!1,depthTest:!1,fragmentShader:uY,vertexShader:Xu}),this.toneMapped=!1,this.colorOutput=e,this.luminanceRange=t}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get threshold(){return this.uniforms.threshold.value}set threshold(e){this.smoothing>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=e}getThreshold(){return this.threshold}setThreshold(e){this.threshold=e}get smoothing(){return this.uniforms.smoothing.value}set smoothing(e){this.threshold>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=e}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(e){this.smoothing=e}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(e){}get colorOutput(){return this.defines.COLOR!==void 0}set colorOutput(e){e?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(e){return this.colorOutput}setColorOutputEnabled(e){this.colorOutput=e}get useRange(){return this.luminanceRange!==null}set useRange(e){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(e){e!==null?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=e,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(e){this.luminanceRange=e}},pY=`#ifdef FRAMEBUFFER_PRECISION_HIGH 5600uniform mediump sampler2D inputBuffer; 5601#else 5602uniform lowp sampler2D inputBuffer; 5603#endif 5604#ifdef MASK_PRECISION_HIGH 5605uniform mediump sampler2D maskTexture; 5606#else 5607uniform lowp sampler2D maskTexture; 5608#endif 5609#if MASK_FUNCTION != 0 5610uniform float strength; 5611#endif 5612varying vec2 vUv;void main(){ 5613#if COLOR_CHANNEL == 0 5614float mask=texture2D(maskTexture,vUv).r; 5615#elif COLOR_CHANNEL == 1 5616float mask=texture2D(maskTexture,vUv).g; 5617#elif COLOR_CHANNEL == 2 5618float mask=texture2D(maskTexture,vUv).b; 5619#else 5620float mask=texture2D(maskTexture,vUv).a; 5621#endif 5622#if MASK_FUNCTION == 0 5623#ifdef INVERTED 5624mask=step(mask,0.0); 5625#else 5626mask=1.0-step(mask,0.0); 5627#endif 5628#else 5629mask=clamp(mask*strength,0.0,1.0); 5630#ifdef INVERTED 5631mask=1.0-mask; 5632#endif 5633#endif 5634#if MASK_FUNCTION == 2 5635gl_FragColor=vec4(mask*texture2D(inputBuffer,vUv).rgb,mask); 5636#else 5637gl_FragColor=mask*texture2D(inputBuffer,vUv); 5638#endif 5639}`,rP={DISCARD:0,MULTIPLY:1},fY=class extends Dt{constructor(e=null){super({name:"MaskMaterial",uniforms:{maskTexture:new ge(e),inputBuffer:new ge(null),strength:new ge(1)},blending:Ri,depthWrite:!1,depthTest:!1,fragmentShader:pY,vertexShader:Xu}),this.toneMapped=!1,this.setColorChannel(iP.RED),this.setMaskFunction(rP.DISCARD)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}set maskTexture(e){this.uniforms.maskTexture.value=e,delete this.defines.MASK_PRECISION_HIGH,e.type!==Mr&&(this.defines.MASK_PRECISION_HIGH="1"),this.needsUpdate=!0}setMaskTexture(e){this.maskTexture=e}set colorChannel(e){this.defines.COLOR_CHANNEL=e.toFixed(0),this.needsUpdate=!0}setColorChannel(e){this.colorChannel=e}set maskFunction(e){this.defines.MASK_FUNCTION=e.toFixed(0),this.needsUpdate=!0}setMaskFunction(e){this.maskFunction=e}get inverted(){return this.defines.INVERTED!==void 0}set inverted(e){this.inverted&&!e?delete this.defines.INVERTED:e&&(this.defines.INVERTED="1"),this.needsUpdate=!0}isInverted(){return this.inverted}setInverted(e){this.inverted=e}get strength(){return this.uniforms.strength.value}set strength(e){this.uniforms.strength.value=e}getStrength(){return this.strength}setStrength(e){this.strength=e}},mY
vendor: 7,736 bytes, lines 5639-5664
5639=`#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize) 5640#if __VERSION__ < 300 5641#define round(v) floor(v + 0.5) 5642#endif 5643#ifdef FRAMEBUFFER_PRECISION_HIGH 5644uniform mediump sampler2D inputBuffer; 5645#else 5646uniform lowp sampler2D inputBuffer; 5647#endif 5648uniform lowp sampler2D areaTexture;uniform lowp sampler2D searchTexture;uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}vec2 decodeDiagBilinearAccess(in vec2 e){e.r=e.r*abs(5.0*e.r-5.0*0.75);return round(e);}vec4 decodeDiagBilinearAccess(in vec4 e){e.rb=e.rb*abs(5.0*e.rb-5.0*0.75);return round(e);}vec2 searchDiag1(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 searchDiag2(const in vec2 texCoord,const in vec2 dir,out vec2 e){vec4 coord=vec4(texCoord,-1.0,1.0);coord.x+=0.25*texelSize.x;vec3 t=vec3(texelSize,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(coord.z<float(MAX_SEARCH_STEPS_DIAG_INT-1)&&coord.w>0.9)){break;}coord.xyz=t*vec3(dir,1.0)+coord.xyz;e=texture2D(inputBuffer,coord.xy).rg;e=decodeDiagBilinearAccess(e);coord.w=dot(e,vec2(0.5));}return coord.zw;}vec2 areaDiag(const in vec2 dist,const in vec2 e,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE_DIAG,AREATEX_MAX_DISTANCE_DIAG)*e+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.x+=0.5;texCoord.y+=AREATEX_SUBTEX_SIZE*offset;return texture2D(areaTexture,texCoord).rg;}vec2 calculateDiagWeights(const in vec2 texCoord,const in vec2 e,const in vec4 subsampleIndices){vec2 weights=vec2(0.0);vec4 d;vec2 end;if(e.r>0.0){d.xz=searchDiag1(texCoord,vec2(-1.0,1.0),end);d.x+=float(end.y>0.9);}else{d.xz=vec2(0.0);}d.yw=searchDiag1(texCoord,vec2(1.0,-1.0),end);if(d.x+d.y>2.0){vec4 coords=vec4(-d.x+0.25,d.x,d.y,-d.y-0.25)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.xy=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).rg;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).rg;c.yxwz=decodeDiagBilinearAccess(c.xyzw);vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.z);}d.xz=searchDiag2(texCoord,vec2(-1.0,-1.0),end);if(sampleLevelZeroOffset(inputBuffer,texCoord,vec2(1,0)).r>0.0){d.yw=searchDiag2(texCoord,vec2(1.0),end);d.y+=float(end.y>0.9);}else{d.yw=vec2(0.0);}if(d.x+d.y>2.0){vec4 coords=vec4(-d.x,-d.x,d.y,d.y)*texelSize.xyxy+texCoord.xyxy;vec4 c;c.x=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(-1,0)).g;c.y=sampleLevelZeroOffset(inputBuffer,coords.xy,vec2(0,-1)).r;c.zw=sampleLevelZeroOffset(inputBuffer,coords.zw,vec2(1,0)).gr;vec2 cc=vec2(2.0)*c.xz+c.yw;movec(bvec2(step(0.9,d.zw)),cc,vec2(0.0));weights+=areaDiag(d.xy,cc,subsampleIndices.w).gr;}return weights;}float searchLength(const in vec2 e,const in float offset){vec2 scale=SEARCHTEX_SIZE*vec2(0.5,-1.0);vec2 bias=SEARCHTEX_SIZE*vec2(offset,1.0);scale+=vec2(-1.0,1.0);bias+=vec2(0.5,-0.5);scale*=1.0/SEARCHTEX_PACKED_SIZE;bias*=1.0/SEARCHTEX_PACKED_SIZE;return texture2D(searchTexture,scale*e+bias).r;}float searchXLeft(in vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x>end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(-2.0,0.0)*texelSize+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.0)+3.25;return texelSize.x*offset+texCoord.x;}float searchXRight(vec2 texCoord,const in float end){vec2 e=vec2(0.0,1.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.x<end&&e.g>0.8281&&e.r==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(2.0,0.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e,0.5)+3.25;return-texelSize.x*offset+texCoord.x;}float searchYUp(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;++i){if(!(texCoord.y>end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=-vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.0)+3.25;return texelSize.y*offset+texCoord.y;}float searchYDown(vec2 texCoord,const in float end){vec2 e=vec2(1.0,0.0);for(int i=0;i<MAX_SEARCH_STEPS_INT;i++){if(!(texCoord.y<end&&e.r>0.8281&&e.g==0.0)){break;}e=texture2D(inputBuffer,texCoord).rg;texCoord=vec2(0.0,2.0)*texelSize.xy+texCoord;}float offset=-(255.0/127.0)*searchLength(e.gr,0.5)+3.25;return-texelSize.y*offset+texCoord.y;}vec2 area(const in vec2 dist,const in float e1,const in float e2,const in float offset){vec2 texCoord=vec2(AREATEX_MAX_DISTANCE)*round(4.0*vec2(e1,e2))+dist;texCoord=AREATEX_PIXEL_SIZE*texCoord+0.5*AREATEX_PIXEL_SIZE;texCoord.y=AREATEX_SUBTEX_SIZE*offset+texCoord.y;return texture2D(areaTexture,texCoord).rg;}void detectHorizontalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){ 5649#if !defined(DISABLE_CORNER_DETECTION) 5650vec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,1)).r;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).r;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(0,-2)).r;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,-2)).r;weights*=clamp(factor,0.0,1.0); 5651#endif 5652}void detectVerticalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){ 5653#if !defined(DISABLE_CORNER_DETECTION) 5654vec2 leftRight=step(d.xy,d.yx);vec2 rounding=(1.0-CORNER_ROUNDING_NORM)*leftRight;rounding/=leftRight.x+leftRight.y;vec2 factor=vec2(1.0);factor.x-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(1,0)).g;factor.x-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(1,1)).g;factor.y-=rounding.x*sampleLevelZeroOffset(inputBuffer,texCoord.xy,vec2(-2,0)).g;factor.y-=rounding.y*sampleLevelZeroOffset(inputBuffer,texCoord.zw,vec2(-2,1)).g;weights*=clamp(factor,0.0,1.0); 5655#endif 5656}void main(){vec4 weights=vec4(0.0);vec4 subsampleIndices=vec4(0.0);vec2 e=texture2D(inputBuffer,vUv).rg;if(e.g>0.0){ 5657#if !defined(DISABLE_DIAG_DETECTION) 5658weights.rg=calculateDiagWeights(vUv,e,subsampleIndices);if(weights.r==-weights.g){ 5659#endif 5660vec2 d;vec3 coords;coords.x=searchXLeft(vOffset[0].xy,vOffset[2].x);coords.y=vOffset[1].y;d.x=coords.x;float e1=texture2D(inputBuffer,coords.xy).r;coords.z=searchXRight(vOffset[0].zw,vOffset[2].y);d.y=coords.z;d=round(resolution.xx*d+-vPixCoord.xx);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.zy,vec2(1,0)).r;weights.rg=area(sqrtD,e1,e2,subsampleIndices.y);coords.y=vUv.y;detectHorizontalCornerPattern(weights.rg,coords.xyzy,d); 5661#if !defined(DISABLE_DIAG_DETECTION) 5662}else{e.r=0.0;} 5663#endif 5664}if(e.r>0.0){vec2 d;vec3 coords;coords.y=searchYUp(vOffset[1].xy,vOffset[2].z);coords.x=vOffset[0].x;d.x=coords.y;float e1=texture2D(inputBuffer,coords.xy).g;coords.z=searchYDown(vOffset[1].zw,vOffset[2].w);d.y=coords.z;d=round(resolution.yy*d-vPixCoord.yy);vec2 sqrtD=sqrt(abs(d));float e2=sampleLevelZeroOffset(inputBuffer,coords.xz,vec2(0,1)).g;weights.ba=area(sqrtD,e1,e2,subsampleIndices.x);coords.x=vUv.x;detectVerticalCornerPattern(weights.ba,coords.xyxz,d);}gl_FragColor=weights;}`,
vendor: 14,932 bytes, line 5664
5664gY="uniform vec2 texelSize;uniform vec2 resolution;varying vec2 vUv;varying vec4 vOffset[3];varying vec2 vPixCoord;void main(){vUv=position.xy*0.5+0.5;vPixCoord=vUv*resolution;vOffset[0]=vUv.xyxy+texelSize.xyxy*vec4(-0.25,-0.125,1.25,-0.125);vOffset[1]=vUv.xyxy+texelSize.xyxy*vec4(-0.125,-0.25,-0.125,1.25);vOffset[2]=vec4(vOffset[0].xz,vOffset[1].yw)+vec4(-2.0,2.0,-2.0,2.0)*texelSize.xxyy*MAX_SEARCH_STEPS_FLOAT;gl_Position=vec4(position.xy,1.0,1.0);}",vY=class extends Dt{constructor(e=new H,t=new H){super({name:"SMAAWeightsMaterial",defines:{MAX_SEARCH_STEPS_INT:"16",MAX_SEARCH_STEPS_FLOAT:"16.0",MAX_SEARCH_STEPS_DIAG_INT:"8",MAX_SEARCH_STEPS_DIAG_FLOAT:"8.0",CORNER_ROUNDING:"25",CORNER_ROUNDING_NORM:"0.25",AREATEX_MAX_DISTANCE:"16.0",AREATEX_MAX_DISTANCE_DIAG:"20.0",AREATEX_PIXEL_SIZE:"(1.0 / vec2(160.0, 560.0))",AREATEX_SUBTEX_SIZE:"(1.0 / 7.0)",SEARCHTEX_SIZE:"vec2(66.0, 33.0)",SEARCHTEX_PACKED_SIZE:"vec2(64.0, 16.0)"},uniforms:{inputBuffer:new ge(null),searchTexture:new ge(null),areaTexture:new ge(null),resolution:new ge(t),texelSize:new ge(e)},blending:Ri,depthWrite:!1,depthTest:!1,fragmentShader:mY,vertexShader:gY}),this.toneMapped=!1}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get searchTexture(){return this.uniforms.searchTexture.value}set searchTexture(e){this.uniforms.searchTexture.value=e}get areaTexture(){return this.uniforms.areaTexture.value}set areaTexture(e){this.uniforms.areaTexture.value=e}setLookupTextures(e,t){this.searchTexture=e,this.areaTexture=t}get orthogonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_INT)}set orthogonalSearchSteps(e){let t=Math.min(Math.max(e,0),112);this.defines.MAX_SEARCH_STEPS_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setOrthogonalSearchSteps(e){this.orthogonalSearchSteps=e}get diagonalSearchSteps(){return Number(this.defines.MAX_SEARCH_STEPS_DIAG_INT)}set diagonalSearchSteps(e){let t=Math.min(Math.max(e,0),20);this.defines.MAX_SEARCH_STEPS_DIAG_INT=t.toFixed("0"),this.defines.MAX_SEARCH_STEPS_DIAG_FLOAT=t.toFixed("1"),this.needsUpdate=!0}setDiagonalSearchSteps(e){this.diagonalSearchSteps=e}get diagonalDetection(){return this.defines.DISABLE_DIAG_DETECTION===void 0}set diagonalDetection(e){e?delete this.defines.DISABLE_DIAG_DETECTION:this.defines.DISABLE_DIAG_DETECTION="1",this.needsUpdate=!0}isDiagonalDetectionEnabled(){return this.diagonalDetection}setDiagonalDetectionEnabled(e){this.diagonalDetection=e}get cornerRounding(){return Number(this.defines.CORNER_ROUNDING)}set cornerRounding(e){let t=Math.min(Math.max(e,0),100);this.defines.CORNER_ROUNDING=t.toFixed("4"),this.defines.CORNER_ROUNDING_NORM=(t/100).toFixed("4"),this.needsUpdate=!0}setCornerRounding(e){this.cornerRounding=e}get cornerDetection(){return this.defines.DISABLE_CORNER_DETECTION===void 0}set cornerDetection(e){e?delete this.defines.DISABLE_CORNER_DETECTION:this.defines.DISABLE_CORNER_DETECTION="1",this.needsUpdate=!0}isCornerRoundingEnabled(){return this.cornerDetection}setCornerRoundingEnabled(e){this.cornerDetection=e}setSize(e,t){let i=this.uniforms;i.texelSize.value.set(1/e,1/t),i.resolution.value.set(e,t)}},yY=new go,On=null;function xY(){if(On===null){let e=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),t=new Float32Array([0,0,2,0,0,2]);On=new He,On.setAttribute!==void 0?(On.setAttribute("position",new tt(e,3)),On.setAttribute("uv",new tt(t,2))):(On.addAttribute("position",new tt(e,3)),On.addAttribute("uv",new tt(t,2)))}return On}var kr=class{constructor(e="Pass",t=new Qr,i=yY){this.name=e,this.renderer=null,this.scene=t,this.camera=i,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){let t=this.getFullscreenMaterial();t!==null&&(t.needsUpdate=!0),this.rtt=!e}}setRenderer(e){this.renderer=e}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}get fullscreenMaterial(){return this.screen!==null?this.screen.material:null}set fullscreenMaterial(e){let t=this.screen;t!==null?t.material=e:(t=new Zt(xY(),e),t.frustumCulled=!1,this.scene===null&&(this.scene=new Qr),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}setDepthTexture(e,t=xn){}render(e,t,i,r,s){throw new Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,i){}dispose(){for(let e of Object.keys(this)){let t=this[e];if(t!==null&&typeof t=="object"&&typeof t.dispose=="function"){if(t instanceof Qr||t===this.renderer)continue;this[e].dispose()}}}},Ty=class extends kr{constructor(e,t=!0){super("CopyPass"),this.fullscreenMaterial=new sY,this.needsSwap=!1,this.renderTarget=e,e===void 0&&(this.renderTarget=new Pt(1,1,{minFilter:xt,magFilter:xt,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=t}get resize(){return this.autoResize}set resize(e){this.autoResize=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(e){this.autoResize=e}render(e,t,i,r,s){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){this.autoResize&&this.renderTarget.setSize(e,t)}initialize(e,t,i){i!==void 0&&(this.renderTarget.texture.type=i,i!==Mr?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":e.outputEncoding===gt&&(this.renderTarget.texture.encoding=gt))}},bY=class extends kr{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(e,t,i,r,s){let a=e.state.buffers.stencil;a.setLocked(!1),a.setTest(!1)}},ov=new Je,Mx=class extends kr{constructor(e=!0,t=!0,i=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=e,this.depth=t,this.stencil=i,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(e,t,i){this.color=e,this.depth=t,this.stencil=i}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(e){this.overrideClearColor=e}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(e){this.overrideClearAlpha=e}render(e,t,i,r,s){let a=this.overrideClearColor,n=this.overrideClearAlpha,o=e.getClearAlpha(),l=a!==null,h=n>=0;l?(ov.copy(e.getClearColor(ov)),e.setClearColor(a,h?n:o)):h&&e.setClearAlpha(n),e.setRenderTarget(this.renderToScreen?null:t),e.clear(this.color,this.depth,this.stencil),l?e.setClearColor(ov,o):h&&e.setClearAlpha(o)}},In=-1,Yr=class extends or{constructor(e,t=In,i=In,r=1){super(),this.resizable=e,this.base=new H(1,1),this.preferred=new H(t,i),this.target=this.preferred,this.s=r}get width(){let{base:e,preferred:t,scale:i}=this,r;return t.width!==In?r=t.width:t.height!==In?r=Math.round(t.height*(e.width/Math.max(e.height,1))):r=Math.round(e.width*i),r}set width(e){this.preferredWidth=e}get height(){let{base:e,preferred:t,scale:i}=this,r;return t.height!==In?r=t.height:t.width!==In?r=Math.round(t.width/Math.max(e.width/Math.max(e.height,1),1)):r=Math.round(e.height*i),r}set height(e){this.preferredHeight=e}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(e){this.s!==e&&(this.s=e,this.preferred.setScalar(In),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getScale(){return this.scale}setScale(e){this.scale=e}get baseWidth(){return this.base.width}set baseWidth(e){this.base.width!==e&&(this.base.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getBaseWidth(){return this.base.width}setBaseWidth(e){this.base.width!==e&&(this.base.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}get baseHeight(){return this.base.height}set baseHeight(e){this.base.height!==e&&(this.base.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(e){this.baseHeight=e}setBaseSize(e,t){(this.base.width!==e||this.base.height!==t)&&(this.base.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}get preferredWidth(){return this.preferred.width}set preferredWidth(e){this.preferred.width!==e&&(this.preferred.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(e){this.preferredWidth=e}get preferredHeight(){return this.preferred.height}set preferredHeight(e){this.preferred.height!==e&&(this.preferred.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(e){this.preferredHeight=e}setPreferredSize(e,t){(this.preferred.width!==e||this.preferred.height!==t)&&(this.preferred.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height))}copy(e){this.base.set(e.getBaseWidth(),e.getBaseHeight()),this.preferred.set(e.getPreferredWidth(),e.getPreferredHeight()),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.base.width,this.base.height)}static get AUTO_SIZE(){return In}},lv=!1,BA=class{constructor(e=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(e),this.meshCount=0,this.replaceMaterial=t=>{if(t.isMesh){let i;if(t.material.flatShading)switch(t.material.side){case Ar:i=this.materialsFlatShadedDoubleSide;break;case sr:i=this.materialsFlatShadedBackSide;break;default:i=this.materialsFlatShaded;break}else switch(t.material.side){case Ar:i=this.materialsDoubleSide;break;case sr:i=this.materialsBackSide;break;default:i=this.materials;break}this.originalMaterials.set(t,t.material),t.isSkinnedMesh?t.material=i[2]:t.isInstancedMesh?t.material=i[1]:t.material=i[0],++this.meshCount}}}setMaterial(e){if(this.disposeMaterials(),this.material=e,e!==null){let t=this.materials=[e.clone(),e.clone(),e.clone()];for(let i of t)i.uniforms=Object.assign({},e.uniforms),i.side=Vs;t[2].skinning=!0,this.materialsBackSide=t.map(i=>{let r=i.clone();return r.uniforms=Object.assign({},e.uniforms),r.side=sr,r}),this.materialsDoubleSide=t.map(i=>{let r=i.clone();return r.uniforms=Object.assign({},e.uniforms),r.side=Ar,r}),this.materialsFlatShaded=t.map(i=>{let r=i.clone();return r.uniforms=Object.assign({},e.uniforms),r.flatShading=!0,r}),this.materialsFlatShadedBackSide=t.map(i=>{let r=i.clone();return r.uniforms=Object.assign({},e.uniforms),r.flatShading=!0,r.side=sr,r}),this.materialsFlatShadedDoubleSide=t.map(i=>{let r=i.clone();return r.uniforms=Object.assign({},e.uniforms),r.flatShading=!0,r.side=Ar,r})}}render(e,t,i){let r=e.shadowMap.enabled;if(e.shadowMap.enabled=!1,lv){let s=this.originalMaterials;this.meshCount=0,t.traverse(this.replaceMaterial),e.render(t,i);for(let a of s)a[0].material=a[1];this.meshCount!==s.size&&s.clear()}else{let s=t.overrideMaterial;t.overrideMaterial=this.material,e.render(t,i),t.overrideMaterial=s}e.shadowMap.enabled=r}disposeMaterials(){if(this.material!==null){let e=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(let t of e)t.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return lv}static set workaroundEnabled(e){lv=e}},wY=class extends kr{constructor(e,t,i=null){super("RenderPass",e,t),this.needsSwap=!1,this.clearPass=new Mx,this.overrideMaterialManager=i===null?null:new BA(i),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}get renderToScreen(){return super.renderToScreen}set renderToScreen(e){super.renderToScreen=e,this.clearPass.renderToScreen=e}get overrideMaterial(){let e=this.overrideMaterialManager;return e!==null?e.material:null}set overrideMaterial(e){let t=this.overrideMaterialManager;e!==null?t!==null?t.setMaterial(e):this.overrideMaterialManager=new BA(e):t!==null&&(t.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(e){this.overrideMaterial=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getSelection(){return this.selection}setSelection(e){this.selection=e}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(e){this.ignoreBackground=e}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(e){this.skipShadowMapUpdate=e}getClearPass(){return this.clearPass}render(e,t,i,r,s){let a=this.scene,n=this.camera,o=this.selection,l=n.layers.mask,h=a.background,c=e.shadowMap.autoUpdate,u=this.renderToScreen?null:t;o!==null&&n.layers.set(o.getLayer()),this.skipShadowMapUpdate&&(e.shadowMap.autoUpdate=!1),(this.ignoreBackground||this.clearPass.overrideClearColor!==null)&&(a.background=null),this.clearPass.enabled&&this.clearPass.render(e,t),e.setRenderTarget(u),this.overrideMaterialManager!==null?this.overrideMaterialManager.render(e,a,n):e.render(a,n),n.layers.mask=l,a.background=h,e.shadowMap.autoUpdate=c}},FA=class extends kr{constructor(e,t,{resolutionScale:i=1,width:r=Yr.AUTO_SIZE,height:s=Yr.AUTO_SIZE,renderTarget:a}={}){super("DepthPass"),this.needsSwap=!1,this.renderPass=new wY(e,t,new SM({depthPacking:oM}));let n=this.renderPass;n.skipShadowMapUpdate=!0,n.ignoreBackground=!0;let o=n.getClearPass();o.overrideClearColor=new Je(16777215),o.overrideClearAlpha=1,this.renderTarget=a,this.renderTarget===void 0&&(this.renderTarget=new Pt(1,1,{minFilter:St,magFilter:St,stencilBuffer:!1}),this.renderTarget.texture.name="DepthPass.Target");let l=this.resolution=new Yr(this,r,s,i);l.addEventListener("change",h=>this.setSize(l.baseWidth,l.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,i,r,s){let a=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,a)}setSize(e,t){let i=this.resolution;i.setBaseSize(e,t),this.renderTarget.setSize(i.width,i.height)}},It={SKIP:0,ADD:1,ALPHA:2,AVERAGE:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,EXCLUSION:8,LIGHTEN:9,MULTIPLY:10,DIVIDE:11,NEGATION:12,NORMAL:13,OVERLAY:14,REFLECT:15,SCREEN:16,SOFT_LIGHT:17,SUBTRACT:18},SY="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x+y,1.0)*opacity+x*(1.0-opacity);}",_Y="vec3 blend(const in vec3 x,const in vec3 y,const in float opacity){return y*
5664opacity+x*(1.0-opacity);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){float a=min(y.a,opacity);return vec4(blend(x.rgb,y.rgb,a),max(x.a,a));}",AY="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y)*0.5*opacity+x*(1.0-opacity);}",MY="float blend(const in float x,const in float y){return(y==0.0)?y:max(1.0-(1.0-x)/y,0.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",EY="float blend(const in float x,const in float y){return(y==1.0)?y:min(x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",CY="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x,y)*opacity+x*(1.0-opacity);}",TY="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return abs(x-y)*opacity+x*(1.0-opacity);}",PY="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y-2.0*x*y)*opacity+x*(1.0-opacity);}",DY="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x,y)*opacity+x*(1.0-opacity);}",OY="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return x*y*opacity+x*(1.0-opacity);}",IY="float blend(const in float x,const in float y){return(y>0.0)?min(x/y,1.0):1.0;}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",RY="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-abs(1.0-x-y))*opacity+x*(1.0-opacity);}",LY="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y*opacity+x*(1.0-opacity);}",zY="float blend(const in float x,const in float y){return(x<0.5)?(2.0*x*y):(1.0-2.0*(1.0-x)*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",BY="float blend(const in float x,const in float y){return(y==1.0)?y:min(x*x/(1.0-y),1.0);}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",FY="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(1.0-(1.0-x)*(1.0-y))*opacity+x*(1.0-opacity);}",kY="float blend(const in float x,const in float y){return(y<0.5)?(2.0*x*y+x*x*(1.0-2.0*y)):(sqrt(x)*(2.0*y-1.0)+2.0*x*(1.0-y));}vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=vec4(blend(x.r,y.r),blend(x.g,y.g),blend(x.b,y.b),blend(x.a,y.a));return z*opacity+x*(1.0-opacity);}",UY="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x+y-1.0,0.0)*opacity+x*(1.0-opacity);}",NY=new Map([[It.SKIP,null],[It.ADD,SY],[It.ALPHA,_Y],[It.AVERAGE,AY],[It.COLOR_BURN,MY],[It.COLOR_DODGE,EY],[It.DARKEN,CY],[It.DIFFERENCE,TY],[It.EXCLUSION,PY],[It.LIGHTEN,DY],[It.MULTIPLY,OY],[It.DIVIDE,IY],[It.NEGATION,RY],[It.NORMAL,LY],[It.OVERLAY,zY],[It.REFLECT,BY],[It.SCREEN,FY],[It.SOFT_LIGHT,kY],[It.SUBTRACT,UY]]),VY=class extends or{constructor(e,t=1){super(),this.f=e,this.opacity=new ge(t)}getOpacity(){return this.opacity.value}setOpacity(e){this.opacity.value=e}get blendFunction(){return this.f}set blendFunction(e){this.f=e,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(e){this.blendFunction=e}getShaderCode(){return NY.get(this.blendFunction)}},ba={NONE:0,DEPTH:1,CONVOLUTION:2},Ta=class extends or{constructor(e,t,{attributes:i=ba.NONE,blendFunction:r=It.SCREEN,defines:s=new Map,uniforms:a=new Map,extensions:n=null,vertexShader:o=null}={}){super(),this.name=e,this.renderer=null,this.attributes=i,this.fragmentShader=t,this.vertexShader=o,this.defines=s,this.uniforms=a,this.extensions=n,this.blendMode=new VY(r),this.blendMode.addEventListener("change",l=>this.setChanged())}getName(){return this.name}setRenderer(e){this.renderer=e}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}
vendor: 16,536 bytes, lines 5664-5684
5664getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(e){this.attributes=e,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(e){this.fragmentShader=e,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(e){this.vertexShader=e,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(e,t=xn){}update(e,t,i){}setSize(e,t){}initialize(e,t,i){}dispose(){for(let e of Object.keys(this)){let t=this[e];if(t!==null&&typeof t=="object"&&typeof t.dispose=="function"){if(t instanceof Qr||t===this.renderer)continue;this[e].dispose()}}}};function kA(e,t,i){for(let r of t){let s="$1"+e+r.charAt(0).toUpperCase()+r.slice(1),a=new RegExp("([^\\.])(\\b"+r+"\\b)","g");for(let n of i.entries())n[1]!==null&&i.set(n[0],n[1].replace(a,s))}}function jY(e,t,i,r,s,a,n){let o=new Map([["fragment",t.getFragmentShader()],["vertex",t.getVertexShader()]]),l=o.get("fragment")!==void 0&&/mainImage/.test(o.get("fragment")),h=o.get("fragment")!==void 0&&/mainUv/.test(o.get("fragment")),c=[],u=[],d=!1,p=!1;if(o.get("fragment")===void 0)console.error("Missing fragment shader",t);else if(h&&(n&ba.CONVOLUTION)!==0)console.error("Effects that transform UV coordinates are incompatible with convolution effects",t);else if(!l&&!h)console.error("The fragment shader contains neither a mainImage nor a mainUv function",t);else{let f=/(?:\w+\s+(\w+)\([\w\s,]*\)\s*{[^}]+})/g,m=Cy.Section;if(h){let v=` ${e}MainUv(UV); 5665`;i.set(m.FRAGMENT_MAIN_UV,i.get(m.FRAGMENT_MAIN_UV)+v),d=!0}if(o.get("vertex")!==null&&/mainSupport/.test(o.get("vertex"))){let v=` ${e}MainSupport(`;v+=/mainSupport *\([\w\s]*?uv\s*?\)/.test(o.get("vertex"))?`vUv); 5666`:`); 5667`,i.set(m.VERTEX_MAIN_SUPPORT,i.get(m.VERTEX_MAIN_SUPPORT)+v),c=c.concat([...o.get("vertex").matchAll(/(?:varying\s+\w+\s+(\w*))/g)].map(y=>y[1])),u=u.concat(c).concat([...o.get("vertex").matchAll(f)].map(y=>y[1]))}u=u.concat([...o.get("fragment").matchAll(f)].map(v=>v[1])),u=u.concat([...t.defines.keys()].map(v=>v.replace(/\([\w\s,]*\)/g,""))),u=u.concat([...t.uniforms.keys()]),t.uniforms.forEach((v,y)=>a.set(e+y.charAt(0).toUpperCase()+y.slice(1),v)),t.defines.forEach((v,y)=>s.set(e+y.charAt(0).toUpperCase()+y.slice(1),v)),kA(e,u,s),kA(e,u,o);let g=t.blendMode;if(r.set(g.blendFunction,g),l){let v=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/,y=`${e}MainImage(color0, UV, `;(n&ba.DEPTH)!==0&&v.test(o.get("fragment"))&&(y+="depth, ",p=!0),y+=`color1); 5668 `;let x=e+"BlendOpacity";a.set(x,g.opacity),y+=`color0 = blend${g.blendFunction}(color0, color1, ${x}); 5669 5670 `,i.set(m.FRAGMENT_MAIN_IMAGE,i.get(m.FRAGMENT_MAIN_IMAGE)+y),y=`uniform float ${x}; 5671 5672`,i.set(m.FRAGMENT_HEAD,i.get(m.FRAGMENT_HEAD)+y)}i.set(m.FRAGMENT_HEAD,i.get(m.FRAGMENT_HEAD)+o.get("fragment")+` 5673`),o.get("vertex")!==null&&i.set(m.VERTEX_HEAD,i.get(m.VERTEX_HEAD)+o.get("vertex")+` 5674`)}return{varyings:c,transformedUv:d,readDepth:p}}var Gf=class extends kr{constructor(e,...t){super("EffectPass"),this.fullscreenMaterial=new Cy(null,null,null,e),this.effects=t.sort((i,r)=>r.attributes-i.attributes),this.skipRendering=!1,this.uniformCount=0,this.varyingCount=0,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(e){this.fullscreenMaterial.encodeOutput=e}get dithering(){return this.fullscreenMaterial.dithering}set dithering(e){let t=this.fullscreenMaterial;t.dithering=e,t.needsUpdate=!0}verifyResources(){let e=this.renderer.capabilities,t=Math.min(e.maxFragmentUniforms,e.maxVertexUniforms);this.uniformCount>t&&console.warn("The current rendering context doesn't support more than "+t+" uniforms, but "+this.uniformCount+" were defined"),t=e.maxVaryings,this.varyingCount>t&&console.warn("The current rendering context doesn't support more than "+t+" varyings, but "+this.varyingCount+" were defined")}updateMaterial(){let e=Cy.Section,t=new Map([[e.FRAGMENT_HEAD,""],[e.FRAGMENT_MAIN_UV,""],[e.FRAGMENT_MAIN_IMAGE,""],[e.VERTEX_HEAD,""],[e.VERTEX_MAIN_SUPPORT,""]]),i=new Map,r=new Map,s=new Map,a=new Set,n=0,o=0,l=0,h=!1,c=!1;for(let d of this.effects)if(d.blendMode.blendFunction===It.SKIP)l|=d.getAttributes()&ba.DEPTH;else if((l&d.getAttributes()&ba.CONVOLUTION)!==0)console.error("Convolution effects cannot be merged",d);else{l|=d.getAttributes();let p="e"+n++,f=jY(p,d,t,i,r,s,l);if(o+=f.varyings.length,h=h||f.transformedUv,c=c||f.readDepth,d.extensions!==null)for(let m of d.extensions)a.add(m)}let u=/\bblend\b/g;for(let d of i.values()){let p=d.getShaderCode().replace(u,`blend${d.blendFunction}`);t.set(e.FRAGMENT_HEAD,t.get(e.FRAGMENT_HEAD)+p+` 5675`)}(l&ba.DEPTH)!==0?(c&&t.set(e.FRAGMENT_MAIN_IMAGE,`float depth = readDepth(UV); 5676 5677 `+t.get(e.FRAGMENT_MAIN_IMAGE)),this.needsDepthTexture=this.getDepthTexture()===null):this.needsDepthTexture=!1,h?(t.set(e.FRAGMENT_MAIN_UV,`vec2 transformedUv = vUv; 5678`+t.get(e.FRAGMENT_MAIN_UV)),r.set("UV","transformedUv")):r.set("UV","vUv"),t.forEach((d,p,f)=>f.set(p,d.trim().replace(/^#/,` 5679#`))),this.uniformCount=s.size,this.varyingCount=o,this.skipRendering=n===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderParts(t).setExtensions(a).setUniforms(s).setDefines(r)}recompile(){this.updateMaterial(),this.verifyResources()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(e,t=xn){this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t;for(let i of this.effects)i.setDepthTexture(e,t)}render(e,t,i,r,s){for(let a of this.effects)a.update(e,t,r);if(!this.skipRendering||this.renderToScreen){let a=this.fullscreenMaterial;a.inputBuffer=t.texture,a.time+=r,e.setRenderTarget(this.renderToScreen?null:i),e.render(this.scene,this.camera)}}setSize(e,t){this.fullscreenMaterial.setSize(e,t);for(let i of this.effects)i.setSize(e,t)}initialize(e,t,i){this.renderer=e;for(let r of this.effects)r.initialize(e,t,i),r.addEventListener("change",s=>this.handleEvent(s));this.updateMaterial(),this.verifyResources(),i!==void 0&&i!==Mr&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(let e of this.effects)e.dispose()}handleEvent(e){e.type==="change"&&this.recompile()}},HY=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],Ex=class extends kr{constructor({resolutionScale:e=.5,width:t=Yr.AUTO_SIZE,height:i=Yr.AUTO_SIZE,kernelSize:r=_m.LARGE}={}){super("KawaseBlurPass"),this.renderTargetA=new Pt(1,1,{minFilter:xt,magFilter:xt,stencilBuffer:!1,depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";let s=this.resolution=new Yr(this,t,i,e);s.addEventListener("change",a=>this.setSize(s.baseWidth,s.baseHeight)),this.blurMaterial=new zA,this.ditheredBlurMaterial=new zA,this.ditheredBlurMaterial.uniforms.scale=this.blurMaterial.uniforms.scale,this.ditheredBlurMaterial.dithering=!0,this.dithering=!1,this.kernelSize=r}getResolution(){return this.resolution}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get scale(){return this.blurMaterial.scale}set scale(e){this.blurMaterial.scale=e}getScale(){return this.blurMaterial.scale}setScale(e){this.blurMaterial.scale=e}getKernelSize(){return this.kernelSize}setKernelSize(e){this.kernelSize=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,i,r,s){let a=this.scene,n=this.camera,o=this.renderTargetA,l=this.renderTargetB,h=HY[this.kernelSize],c=this.blurMaterial,u=t,d,p;for(this.fullscreenMaterial=c,d=0,p=h.length-1;d<p;++d){let f=(d&1)===0?o:l;c.kernel=h[d],c.inputBuffer=u.texture,e.setRenderTarget(f),e.render(a,n),u=f}this.dithering&&(c=this.ditheredBlurMaterial,this.fullscreenMaterial=c),c.kernel=h[d],c.inputBuffer=u.texture,e.setRenderTarget(this.renderToScreen?null:i),e.render(a,n)}setSize(e,t){let i=this.resolution;i.setBaseSize(e,t);let r=i.width,s=i.height;this.renderTargetA.setSize(r,s),this.renderTargetB.setSize(r,s),this.blurMaterial.setSize(r,s),this.ditheredBlurMaterial.setSize(r,s)}initialize(e,t,i){i!==void 0&&(this.renderTargetA.texture.type=i,this.renderTargetB.texture.type=i,i!==Mr?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.ditheredBlurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):e.outputEncoding===gt&&(this.renderTargetA.texture.encoding=gt,this.renderTargetB.texture.encoding=gt))}static get AUTO_SIZE(){return Yr.AUTO_SIZE}},GY=class extends kr{constructor({width:e=Yr.AUTO_SIZE,height:t=Yr.AUTO_SIZE,renderTarget:i,luminanceRange:r,colorOutput:s}={}){super("LuminancePass"),this.fullscreenMaterial=new dY(s,r),this.needsSwap=!1,this.renderTarget=i,this.renderTarget===void 0&&(this.renderTarget=new Pt(1,1,{minFilter:xt,magFilter:xt,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target",this.renderTarget.texture.generateMipmaps=!1);let a=this.resolution=new Yr(this,e,t);a.addEventListener("change",n=>this.setSize(a.baseWidth,a.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(e,t,i,r,s){let a=this.fullscreenMaterial;a.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){let i=this.resolution;i.setBaseSize(e,t),this.renderTarget.setSize(i.width,i.height)}initialize(e,t,i){i!==void 0&&i!==Mr&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},WY=class extends kr{constructor(e,t){super("MaskPass",e,t),this.needsSwap=!1,this.clearPass=new Mx(!1,!1,!0),this.inverse=!1}get inverted(){return this.inverse}set inverted(e){this.inverse=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(e){this.inverted=e}render(e,t,i,r,s){let a=e.getContext(),n=e.state.buffers,o=this.scene,l=this.camera,h=this.clearPass,c=this.inverted?0:1,u=1-c;n.color.setMask(!1),n.depth.setMask(!1),n.color.setLocked(!0),n.depth.setLocked(!0),n.stencil.setTest(!0),n.stencil.setOp(a.REPLACE,a.REPLACE,a.REPLACE),n.stencil.setFunc(a.ALWAYS,c,4294967295),n.stencil.setClear(u),n.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?h.render(e,null):(h.render(e,t),h.render(e,i))),this.renderToScreen?(e.setRenderTarget(null),e.render(o,l)):(e.setRenderTarget(t),e.render(o,l),e.setRenderTarget(i),e.render(o,l)),n.color.setLocked(!1),n.depth.setLocked(!1),n.stencil.setLocked(!1),n.stencil.setFunc(a.EQUAL,1,4294967295),n.stencil.setOp(a.KEEP,a.KEEP,a.KEEP),n.stencil.setLocked(!0)}},vs=class extends kr{constructor(e,t="inputBuffer"){super("ShaderPass"),this.fullscreenMaterial=e,this.inputBufferUniform=null,this.setInput(t)}setInput(e){if(this.inputBufferUniform=null,this.fullscreenMaterial!==null){let t=this.fullscreenMaterial.uniforms;t!==void 0&&t[e]!==void 0&&(this.inputBufferUniform=t[e])}}render(e,t,i,r,s){this.inputBufferUniform!==null&&t!==null&&(this.inputBufferUniform.value=t.texture),e.setRenderTarget(this.renderToScreen?null:i),e.render(this.scene,this.camera)}initialize(e,t,i){i!==void 0&&i!==Mr&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},hv=1/1e3,qY=1e3,XY=class{constructor(){this.previousTime=0,this.currentTime=0,this.delta=0,this.fixedDelta=1e3/60,this.elapsed=0,this.timescale=1,this.fixedDeltaEnabled=!1,this.autoReset=!1}setFixedDeltaEnabled(e){return this.fixedDeltaEnabled=e,this}isAutoResetEnabled(e){return this.autoReset}setAutoResetEnabled(e){return typeof document<"u"&&document.hidden!==void 0&&(e?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this.autoReset=e),this}getDelta(){return this.delta*hv}getFixedDelta(){return this.fixedDelta*hv}setFixedDelta(e){return this.fixedDelta=e*qY,this}getElapsed(){return this.elapsed*hv}getTimescale(){return this.timescale}setTimescale(e){return this.timescale=e,this}update(e){return this.fixedDeltaEnabled?this.delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=e!==void 0?e:performance.now(),this.delta=this.currentTime-this.previousTime),this.delta*=this.timescale,this.elapsed+=this.delta,this}reset(){return this.delta=0,this.elapsed=0,this.currentTime=performance.now(),this}handleEvent(e){document.hidden||(this.currentTime=performance.now())}dispose(){this.setAutoResetEnabled(!1)}},_m={MEDIUM:2,LARGE:3,HUGE:5},YY=`#ifdef FRAMEBUFFER_PRECISION_HIGH 5680uniform mediump sampler2D map; 5681#else 5682uniform lowp sampler2D map; 5683#endif 5684uniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=clamp(texture2D(map,uv)*intensity,0.0,1.0);}`,QY=class extends Ta{constructor({blendFunction:e=It.SCREEN,luminanceThreshold:t=.9,luminanceSmoothing:i=.025,resolutionScale:r=.5,intensity:s=1,width:a=Yr.AUTO_SIZE,height:n=Yr.AUTO_SIZE,kernelSize:o=_m.LARGE}={}){super("BloomEffect",YY,{blendFunction:e,uniforms:new Map([["map",new ge(null)],["intensity",new ge(s)]])}),this.renderTarget=new Pt(1,1,{minFilter:xt,magFilter:xt,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.renderTarget.texture.generateMipmaps=!1,this.uniforms.get("map").value=this.renderTarget.texture,this.luminancePass=new GY({renderTarget:this.renderTarget,colorOutput:!0}),this.luminanceMaterial.threshold=t,this.luminanceMaterial.smoothingFactor=i,this.blurPass=new Ex({resolutionScale:r,width:a,height:n,kernelSize:o});let l=this.blurPass.getResolution();l.addEventListener("change",h=>this.setSize(l.baseWidth,l.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}get resolution(){return this.blurPass.resolution}getResolution(){return this.blurPass.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get dithering(){return this.blurPass.dithering}set dithering(e){this.blurPass.dithering=e}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(e){this.blurPass.kernelSize=e}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(e){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(e){this.uniforms.get("intensity").value=e}getIntensity(){return this.intensity}setIntensity(e){this.intensity=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}update(e,t,i){let r=this.renderTarget;this.luminancePass.enabled?(this.luminancePass.render(e,t,r),this.blurPass.render(e,r,r)):this.blurPass.render(e,t,r)}setSize(e,t){let i=this.resolution;i.setBaseSize(e,t),this.renderTarget.setSize(i.width,i.height),this.luminancePass.resolution.copy(i)}initialize(e,t,i){this.blurPass.initialize(e,t,i),i!==void 0&&(this.renderTarget.texture.type=i,e.outputEncoding===gt&&(this.renderTarget.texture.encoding=gt))}},KY="uniform float brightness;uniform float contrast;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=inputColor.rgb+vec3(brightness-0.5);if(contrast>0.0){color/=vec3(1.0-contrast);}else{color*=vec3(1.0+contrast);}outputColor=vec4(min(color+vec3(0.5),1.0),inputColor.a);}",ZY=class extends Ta{constructor({blendFunction:e=It.NORMAL,brightness:t=0,contrast:i=0}={}){super("BrightnessContrastEffect",KY,{blendFunction:e,uniforms:new Map([["brightness",new ge(t)],["contrast",new ge(i)]])})}get brightness(){return this.uniforms.get("brightness").value}set brightness(e){this.uniforms.get("brightness").value=e}getBrightness(e){return this.brightness}setBrightness(e){this.brightness=e}get contrast(){return this.uniforms.get("contrast").value}set contrast(e){this.uniforms.get("contrast").value=e}getContrast(e){return this.contrast}setContrast(e){this.contrast=e}},JY="void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=vec4(ve
5684c3(average(inputColor.rgb)),inputColor.a);}",$Y=class extends Ta{constructor(e=It.NORMAL){super("ColorAverageEffect",JY,{blendFunction:e})}},eQ="varying vec2 vUvR;varying vec2 vUvB;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec2 ra=texture2D(inputBuffer,vUvR).ra;vec2 ba=texture2D(inputBuffer,vUvB).ba;outputColor=vec4(ra.x,inputColor.g,ba.x,max(max(ra.y,ba.y),inputColor.a));}",tQ="uniform vec2 offset;varying vec2 vUvR;varying vec2 vUvB;void mainSupport(const in vec2 uv){vec2 shift=offset*vec2(1.0,aspect);vUvR=uv+shift;vUvB=uv-shift;}",iQ=class extends Ta{constructor({blendFunction:e=It.NORMAL,offset:t=new H(.001,5e-4)}={}){super("ChromaticAberrationEffect",eQ,{vertexShader:tQ,blendFunction:e,attributes:ba.CONVOLUTION,uniforms:new Map([["offset",new ge(t)]])})}get offset(){return this.uniforms.get("offset").value}set offset(e){this.uniforms.get("offset").value=e}getOffset(){return this.offset}setOffset(e){this.offset=e}},rQ=`#ifdef FRAMEBUFFER_PRECISION_HIGH 5685uniform mediump sampler2D nearColorBuffer;uniform mediump sampler2D farColorBuffer; 5686#else 5687uniform lowp sampler2D nearColorBuffer;uniform lowp sampler2D farColorBuffer; 5688#endif 5689uniform lowp sampler2D nearCoCBuffer;uniform float scale;void mainImage(const in vec4 inputColor,const in vec2 uv,const in float depth,out vec4 outputColor){vec4 colorNear=texture2D(nearColorBuffer,uv);vec4 colorFar=texture2D(farColorBuffer,uv);float CoCNear=texture2D(nearCoCBuffer,uv).r;CoCNear=min(CoCNear*scale,1.0);vec4 result=inputColor*(1.0-colorFar.a)+colorFar;result=mix(result,colorNear,CoCNear);outputColor=result;}`,sQ=class extends Ta{constructor(e,{blendFunction:t=It.NORMAL,worldFocusDistance:i,worldFocusRange:r,focusDistance:s=0,focalLength:a=.1,focusRange:n=a,bokehScale:o=1,width:l=Yr.AUTO_SIZE,height:h=Yr.AUTO_SIZE}={}){super("DepthOfFieldEffect",rQ,{blendFunction:t,attributes:ba.DEPTH,uniforms:new Map([["nearColorBuffer",new ge(null)],["farColorBuffer",new ge(null)],["nearCoCBuffer",new ge(null)],["scale",new ge(1)]])}),this.camera=e,this.renderTarget=new Pt(1,1,{minFilter:xt,magFilter:xt,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="DoF.Intermediate",this.renderTarget.texture.generateMipmaps=!1,this.renderTargetMasked=this.renderTarget.clone(),this.renderTargetMasked.texture.name="DoF.Masked.Far",this.renderTargetNear=this.renderTarget.clone(),this.renderTargetNear.texture.name="DoF.Bokeh.Near",this.uniforms.get("nearColorBuffer").value=this.renderTargetNear.texture,this.renderTargetFar=this.renderTarget.clone(),this.renderTargetFar.texture.name="DoF.Bokeh.Far",this.uniforms.get("farColorBuffer").value=this.renderTargetFar.texture,this.renderTargetCoC=this.renderTarget.clone(),this.renderTargetCoC.texture.name="DoF.CoC",this.renderTargetCoCBlurred=this.renderTargetCoC.clone(),this.renderTargetCoCBlurred.texture.name="DoF.CoC.Blurred",this.uniforms.get("nearCoCBuffer").value=this.renderTargetCoCBlurred.texture,this.cocPass=new vs(new eY(e));let c=this.cocMaterial;c.focusDistance=s,c.focusRange=n,i!==void 0&&(c.worldFocusDistance=i),r!==void 0&&(c.worldFocusRange=r),this.blurPass=new Ex({kernelSize:_m.MEDIUM,width:l,height:h});let u=this.blurPass.getResolution();u.addEventListener("change",p=>this.setSize(u.getBaseWidth(),u.getBaseHeight())),this.maskPass=new vs(new fY(this.renderTargetCoC.texture));let d=this.maskPass.fullscreenMaterial;d.maskFunction=rP.MULTIPLY,d.colorChannel=iP.GREEN,this.bokehNearBasePass=new vs(new up(!1,!0)),this.bokehNearBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehNearFillPass=new vs(new up(!0,!0)),this.bokehNearFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehFarBasePass=new vs(new up(!1,!1)),this.bokehFarBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.bokehFarFillPass=new vs(new up(!0,!1)),this.bokehFarFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.target=null,this.bokehScale=o}get cocTexture(){return this.renderTargetCoC.texture}get cocMaterial(){return this.cocPass.fullscreenMaterial}get circleOfConfusionMaterial(){return this.cocMaterial}getCircleOfConfusionMaterial(){return this.circleOfConfusionMaterial}getBlurPass(){return this.blurPass}get resolution(){return this.blurPass.getResolution()}getResolution(){return this.blurPass.getResolution()}get bokehScale(){return this.uniforms.get("scale").value}set bokehScale(e){let t=[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass];for(let i of t)i.fullscreenMaterial.setScale(e);this.maskPass.fullscreenMaterial.setStrength(e),this.uniforms.get("scale").value=e}getBokehScale(){return this.bokehScale}setBokehScale(e){this.bokehScale=e}getTarget(){return this.target}setTarget(e){this.target=e}calculateFocusDistance(e){let t=this.camera,i=t.position.distanceTo(e);return Ey(-i,t.near,t.far)}
vendor: 4,518 bytes, lines 5689-5695
5689setDepthTexture(e,t=xn){this.circleOfConfusionMaterial.depthBuffer=e,this.circleOfConfusionMaterial.depthPacking=t}update(e,t,i){let r=this.renderTarget,s=this.renderTargetCoC,a=this.renderTargetCoCBlurred,n=this.renderTargetMasked;if(this.target!==null){let o=this.calculateFocusDistance(this.target);this.circleOfConfusionMaterial.focusDistance=o}this.cocPass.render(e,null,s),this.blurPass.render(e,s,a),this.maskPass.render(e,t,n),this.bokehFarBasePass.render(e,n,r),this.bokehFarFillPass.render(e,r,this.renderTargetFar),this.bokehNearBasePass.render(e,t,r),this.bokehNearFillPass.render(e,r,this.renderTargetNear)}setSize(e,t){let i=this.resolution;i.setBaseSize(e,t);let r=i.width,s=i.height,a=[this.cocPass,this.blurPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass];a.push(this.renderTargetCoC,this.renderTargetMasked),a.forEach(n=>n.setSize(e,t)),a=[this.renderTarget,this.renderTargetNear,this.renderTargetFar,this.renderTargetCoCBlurred],a.forEach(n=>n.setSize(r,s)),[this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach(n=>n.fullscreenMaterial.setSize(r,s))}initialize(e,t,i){[this.cocPass,this.maskPass,this.bokehNearBasePass,this.bokehNearFillPass,this.bokehFarBasePass,this.bokehFarFillPass].forEach(r=>r.initialize(e,t,i)),this.blurPass.initialize(e,t,Mr),i!==void 0&&(this.renderTarget.texture.type=i,this.renderTargetNear.texture.type=i,this.renderTargetFar.texture.type=i,this.renderTargetMasked.texture.type=i,e.outputEncoding===gt&&(this.renderTarget.texture.encoding=gt,this.renderTargetNear.texture.encoding=gt,this.renderTargetFar.texture.encoding=gt,this.renderTargetMasked.texture.encoding=gt))}};new M;new xe;var aQ="uniform vec3 hue;uniform float saturation;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 color=vec3(dot(inputColor.rgb,hue.xyz),dot(inputColor.rgb,hue.zxy),dot(inputColor.rgb,hue.yzx));float average=(color.r+color.g+color.b)/3.0;vec3 diff=average-color;if(saturation>0.0){color+=diff*(1.0-1.0/(1.001-saturation));}else{color+=diff*-saturation;}outputColor=vec4(min(color,1.0),inputColor.a);}",nQ=class extends Ta{constructor({blendFunction:e=It.NORMAL,hue:t=0,saturation:i=0}={}){super("HueSaturationEffect",aQ,{blendFunction:e,uniforms:new Map([["hue",new ge(new M)],["saturation",new ge(i)]])}),this.hue=t}get saturation(){return this.uniforms.get("saturation").value}set saturation(e){this.uniforms.get("saturation").value=e}getSaturation(){return this.saturation}setSaturation(e){this.saturation=e}get hue(){let e=this.uniforms.get("hue").value;return Math.acos((e.x*3-1)/2)}set hue(e){let t=Math.sin(e),i=Math.cos(e);this.uniforms.get("hue").value.set((2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3)}getHue(){return this.hue}setHue(e){this.hue=e}};new Je;var oQ=`void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 noise=vec3(rand(uv*time)); 5690#ifdef PREMULTIPLY 5691outputColor=vec4(min(inputColor.rgb*noise,vec3(1.0)),inputColor.a); 5692#else 5693outputColor=vec4(noise,inputColor.a); 5694#endif 5695}`,lQ=class extends Ta{constructor({blendFunction:e=It.SCREEN,premultiply:t=!1}={}){super("NoiseEffect",oQ,{blendFunction:e}),this.premultiply=t}get premultiply(){return this.defines.has("PREMULTIPLY")}set premultiply(e){this.premultiply!==e&&(e?this.defines.set("PREMULTIPLY","1"):this.defines.delete("PREMULTIPLY"),this.setChanged())}isPremultiplied(){return this.premultiply}setPremultiplied(e){this.premultiply=e}},hQ="uniform bool active;uniform vec2 d;void mainUv(inout vec2 uv){if(active){uv=vec2(d.x*(floor(uv.x/d.x)+0.5),d.y*(floor(uv.y/d.y)+0.5));}}",cQ=class extends Ta{constructor(e=30){super("PixelationEffect",hQ,{uniforms:new Map([["active",new ge(!1)],["d",new ge(new H)]])}),this.resolution=new H,this.d=0,this.granularity=e}get granularity(){return this.d}set granularity(e){let t=Math.floor(e);t%2>0&&(t+=1),this.d=t,this.uniforms.get("active").value=t>0,this.setSize(this.resolution.width,this.resolution.height)}getGranularity(){return this.granularity}setGranularity(e){this.granularity=e}setSize(e,t){this.resolution.set(e,t),this.uniforms.get("d").value.setScalar(this.d).divide(this.resolution)}};new M;new M;var UA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAYAAACm53kpAAAAeElEQVRYR+2XSwqAMAxEJ168ePEqwRSKhIIiuHjJqiU0gWE+1CQdApcVAMUAuARaMGCX1MIL/Ow13++9lW2s3mW9MWvsnWc/2fvGygwPAN4E8QzAA4CXAB6AHjG4JTHYI1ey3pcx6FHnEfhLDOIBKAmUBK6/ANUDTlROXAHd9EC1AAAAAElFTkSuQmCC",NA
vendor: 6,469 bytes, line 5695
5695="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAYAAAABNmBHAAAgAElEQVR4Xuy9CbhlV1ktOvbpq09DkiIkUBI6kxASIH0DlAQiIK1wRfSJTx+i4JX7vKIigs8HXpXvqVcvrcC9agQ7IDTSSWgqCQQliDRBJKkkhDSkqVPNqVOnP+8b//rH3P+eZ+199tlznVTlvVrft7+1T7OaueZY42/m37QALKNk2wHg1pITlB17mC+Pp11W3X/LHyT32vhg48/5SOv+PnwpsHA70JoGlueB1iKApeqzvOzn44GatTB76Xzhd7suBR7+WWADgDEAwwCG/L54b/poDLrHuvvm70Z2Avhsc+PVcxscBU8F8C8ADg5+ipIjD/PlGwfgju8B924E5seARUfLsiNmqQW0IjL8+7L2NYD/7COBzfcCm+aB8SVgdAkYIRCXKyDax4EdAanL5PuNPllNvXDlAHwFgP8AcC2AhRIoDXbsYb48dl5WkVFTE3LGDcC9m4CZCWBuFFgeAZaGAYJQQCRqDHT+McJrVb8zwATUXH02MHYfMHEIGFsAxgjApQqACYQORjtd/B7Axt/z79sC0+cMPgjjlwPwVwHcA+DfAHzTxcVgWBroqMN8+cYBeM71wH0TwKExYHYUWCIAHYRLTlkCYgcIBcAgU/n3qy8GRu4HRgnAOWBkERhddPAJhGJDBxkvw7cqimr+zFM/ZLnZF64cgL8BYD+AWwB8x/dlWuWagHiYL984AJ/0RWBy1AE4AizyM1yxYAcTigW55xMbAkxEiwEdkJ/ZCQxPAiOHgBECcKEC4TBZcKkSv+mTieNcNPNC26mLNsj45QD8LQDTAO4GcJt/7iw2bfoG4WG+vAGwm9ExiEg69zpg/wgwPQLMjgALzn4E4aIzoJjQ9g4024uygkj+pyuAoX0VAIfngOH5NgCHMhAm8Sv2y3XDZeBhNIp8OzJE8OsBzAKYBHAXgDt8/4O+MVT0j4f58o0D8Pxrgf3DwMwIMEPQEYRkNwfgsuuDZLskip0No0gWMD/9HGDoADAkAC4Aw/wsAgZAgs2Z0ABI0GU6IVmKv+f28KDnHxkA/G0A8y6G73N9kOCjXnh/Ebb6OvgwX75xAF5wLTA1VIHPADgMLDj4yIA5AAm6aCUnv4oz46eeDwxNAUMzwJAz4BABSNDFTwSfg7DDKHE23MG5PqIY8A1u/dINs9dBdy8AgnGPM2NfUBrsnw7z5RsH4IXXAAcJviFgluAbygBINnSLWOAjGxJ4pgOKDV0v/OSLKp8iGXBovhLBBOCQM2ACoTOhnYrAdItYbCij5JFzRyIAqRccAnDAQUjg6UNQ7hsMXP0cRQAexss3DsCLCECCLwCQzMcPwUi2MwAScAKbfnY/YRLFQ8DHX+IAJAMSfDkAF13kLvleIjhjQQHxUVS3jjgGpKeeNzYVQEjgUS8k+PghONdhIwAP4+XXBYCHKIJbwJyDTgaIAdCBJx3Q2M8tYAHP9m4df/ylQOsQ0JqtRLCx30K1wtLBggScQOgsKBGcWHAJeOwRC0BSM1mQIKRbhh+Bj98JQP6t4U0APEyXXxcAEnxkQAFwoVUxID9kvQg+c1C7vidRbIDkc24B//hTQGumDcCWA5DgMxASdNIFBUI5pCML8v8API5zfEQx4BudgqiczviSnJhQwCP4BMCGl+wO8+U7AJi/W4O4YS6+pmK/2ciADsAOBhTIIiAJnPB7AvNjP+0AnANaYkAHX2JBAc+tYaJXOqBZv24Vc386XW5dtkHGW+4HFAJonpOe+YYQZAShgKjv3PNvPQaxVoI8zJdfFwASfPzMUwS3Kt1v0UFIlos6oDFdAGFcliMAP/ryAEAGNwQRnDOgLbdlIEwrIs6AZ/QgkMMHQF6ZAKQcJAsSYPwIeAIk9wJgoPK1gi7+PwF4GC/fOAAvIQPSs0URTPBJ/Pp3GSEGRHfBCIQ0xowBtUbcAj7ys5X4Jfu1HIAGQrIgQRXEsAFQIORDFhiDY/rMHmrU4QUgR08AkgUjCAW6CD6CkwBsAIQC4GG6fPMA3OXiNzCg2I9gNCMksmAAoemDzoimFwL48M85AKkiuQVMAAp8CYRRDAt8GQiJ67N6GJODAXAHlsGguscA2AJg1IPGYmxOpBxFWkRN9LsATgIwXnNs/v/5z/9XCf8BO3YAtxbc/46/KDt+5+ea1Yku2VUxHz/z0v24FwMGK1gWsK2OUUxHHdCBeRUB6OxHABr4ZICIBd0QWSF+XRdMTAjgCdTrG9cBNwE4F8CpDkICyYLGsuhFt6zs+gISwUen8zEAjgMw4cfx2H6O/90yAFo84Cbg4ID3/9TfLTt+5+ebnRABkODjx0SwPi5ec/FrYpmqSAxM8Dn60CsqAFI6GfhqAMiDE/gokmvEr0C4PgDkBQm40wE8zMFEUDKEVoxIMLl/KS73mE7H9d+vcKHQQcjwW0Yu9nP8m8sAmOIBuWY6wP2/4s0ezjjg8TuvaR6ABJ70vxUApGrm7EbGE+i472BAB+WHfqHS/eoAaEwY2E9+wLSXTqhI7CXgnB6LCoOJ4BiST+hTnG0HcCwAglCx3ARoZEVFXnBPp/O/A/hXACc7CPs9/i1lAOyIB+RDX+P9/+pbQjjjAMfv/PL6AFDs1wFAgs/9fgKfgdE/ZEpuiQlbwAde6QAMBgiRmsSwA9BY0JfjovGRDBMH4TlcXGhcBOc6HkF0gjPhZgchxTLZMAci/04W/B6Ab3t09EPXcPyflgFwRTwgJ2MN9/8bf5qFM67x+B/aW4XQz42FeL0YrRyikztUFw0704mf9kXgxhOAqc3AAsPyRxxQCs/PdXOFY0W1KHy3QIUGtx+6vdnx1vsB+dsTncm2AogglFgVEAlUWrOMB2RyEmMCGQ/Y7/HvKns6tfGAnJQ+r/9b76oJZ1zD8WdyQjYBh8aBhVEHjELouQ8ukQ7VRSCJAALwkr+sALhnGzDD3JAJYJHg9uhoi4bx8ytkWUtvHT/7+Zc4dw1uZ3612fH2dkQf7yxIEEockwkJQn4IQoq8unhAhmPRKKFx0uv4K8ueTs94wD7u//VX9ghn7OP4c+4G7h8HpseB+dF2AKlFLwuAIZ8jD6NPrOhAffmfA9/ZBuzZCkyRWSeqBCWyoYGQ5yQrBpDbum/ME1HoPo0XEkSD2zlfbna8q6+EUJcTCxKEtHL5EQjP6BEPyIgYAZBvYt3xHyx7OqvGA65y/7/9wVXCGVc5/sl7qxD66dEqiYgRzAqhN1A4CBNAAlDyAFI+iZ9/N3DLJuC+jcDUBmCWyUnOrmTYCMIOkNclLg0B8/RsNLg9+UvNjnd1APLmmQpFHyEBROuWACQT8nN+H/GAvY7/VNnT6SsesMf13/CpahGnZzhjj+PPmwX2MYdDIfQexWyBAwEUOQDrRDN/98p3A7dvAO6fAA5sqHJDBEAyoUVGkwEd6HR12XU4kwzfl6fCXTZzjy57vvnR513X7Hj7AyDvggAUi9EyFgiZqNxPQF6345nOWbD1HQ/Y5fpvuLa/2+82/vNHgAPDFQDnhoF5j2C2qBWCI8bw1eRw5CL5l94L3DEOTI4DB8Y9OWmsEu/zBJ3rgsaybqBob/7A4C7jtWcooRrczr+u2fH2D0AOQgAUCxKEP7aGgLy64+m6KdjWFA9Yc/03/Osa4glrjr+AupqHz1sEs0cxG0BC9HIePLoit9eNkVf9L+DuUWByDJgaq4ybGYLPAWgiXmLedUE7dwC7saL7CqfPKXi4NYdaykCD410bAHlDEsNiwZ9wAPYbkJcfz6T2gm3N8YDZ9d/wHxUA+739fPwXPrSKYGb+BuP3jAFDElFH9HIWwbzCIGkBr/or4J4RYO8oMOW6ZVcAuvi1Cgoha04BCwT5gfMKHm7NoRde2+x41w5A3hQZkADk5+cGiAeMx3+/7AENFA8Yrv/G71cAXFM4Yzj+otOAaQLQA0gZxaIIZtMDFTigKJV8H9Iq6aZ59ZXAvSPAvpEKgBTtBODcSCWCZeRYtpzrmLyeGNCAyFl1v+Hei8qeb370Rdc2O97BAMi7EgB/2QG41nhAHU9LuWAbOB7Qr//GPRUA13r7Gv9FZwIMoVcEswEwfDoimEP0shKKtIphaZQAXv1+YM+wA3DEdcvRKkGJADQQEsQuhi1Tjt95vBsh5nx2IO59SsHDrTmUOStNjndwAAqEry0IyCMICkOyiuIBNwBvPFQQT7gBuPjc9oRYAIHyOEL4vIFEYVNaOou5vCGE/tV/A0wOVcnpzI47NOri3QFIBpSeaSDUdYLOSWvYImSGgftpJDa4MWJbAGxivGUA5MAOc0Be6eVLj7/4Mk+hzCOYPYpZDBiNkLh+G/M3yFyv/ltgL3W3YQfgcFUhgRY2PwY+Z7/EhAR1SFyXCOb57r28QfQBsJQBMn5D4y0HYLPje9Cd7RIC0PM3EiMofF4gVCBp1P840ix/gyz56r+vAMjk9Gl375iB4+CzveuZdLkkEPJ8ZEfX/6R73vOjzT5Si9hucLxHAVg4PwJgRwh9CKOXK8YA4ZEqKZXSQWh5P+5AftXfA/uGKvYjCKn72cctbFrZNECka5L5CPwIPtMH3TVz17MLB5gdLgA2Nd6jACycHwLQxFEUSR5ASvARDB0h9AQb9bXIgCGk6lUfAPYTgEPAITKgg1BObk58srTJgG58WMkWMaAbQQT1nc8rHGANAJsc71EAFs4PAagQestgC1lsBJ4BMCSOK6dDUcwqqaFiQr/0QeAAAdjy+jBiQQeeMSBZT3nCPUDIa9z+/MIB1gCwyfEeBWDh/BCAeQSzgkjFfGLBBD5nxQ4DxN0wv3hVxX5TBGDwL5obxvVA5YqYL5BeMLd66YYxJpRB0gK+96LCAdYAsMnxHgVg4fwIgMrhUPKQ2C+Bz0PmBTqBMQehAbDlIjj4F80KJguSVZ0FuXpjoCOgXawLjALhbT9eOMAuAGxqvEcBWDg/l1IE05Ed0ygZnyHdz0VwCqEPIfNyx0QQvvLDFQCp+8nfZk5und8tXwIgWcHSNX0N2CJmnAl3v6RwgNnhl17T7HiPArBwfghAS7mV/hey2JS9FvM3BLpUUi1YwDRMXvkRYJoAlAh2l0dcZ04s6JUTDIjyBcrl4yDc/dLCAdYAsMnxHgVg4fxwKVwJgGEJNmWtxpQMpX9on2eRhVA+O56AjMfnP+e3Xvf3NwG4xIPTleiY55bpGh6UbafNU0l0z0p+5Jh5HqYJ6b51nP6XP8cx12XNHQVgIQB/bFPVg2OC7Q+WgVFWng/FvtWLI06uWh5oguKEcXVS/9sEAF//VGD7t4ETDgJbF4CNi8CGZWBs2fPL/H6Vwp2KEtVk4fJ+v/EIYPN9wKa5qu+IncfPwXHVZe/aOL3EbwS7xv8A1rQvnO0j8PArTgTGZ4BxFv9mIxhOCGsv+0OPYDRghcLfkWkEuq0+G00x4OtfDGz+d2DbHmDLjL8si8AYP/7CGIAiEEMTG92zXqSbH+d9R2aA0XnvO+JjthiIrOVDHHPOkBrzUQAWAPsZp3oPDpa/Xag6EVkLBK+5rAnJC3/nYk/APD704WiEAV8OTHwX2LQH2DgFbJgFNrBhjd8r79deGoEwsllgNBOzy8CdjweG9wBj08AIAci2D6HafmyAk4/Z7SJ72hGYRwFYAMDLTwOGp4FRFgD3HhzqRGQiyeurqOdG6r0Rm8IEZjzRlkiqCWoEgK8Axm4BJu4HJhyAbFhDxmbDGnZO4j0SgLGDkpibgEq66TJw/1nA0F5gdLpq+zDqFfd5LMeWqu5HNST0uJOIllg+qgMWgI+HPv0xwLA3gWHpW2sC441gCECbmKziaGrnUdMO4aHeh6MxAP4SMHI7ML4HGD8AjHvHJGNAgpDgY/ck3stipRemvVhc+uASMPUEYGh/9dIRgGx8Y+MNbR/00uVtH0wEx94j/v0oAxaA8Ed+GBieAYZZg5kADC0QWGOFzGJlcGPzl1BxNLXD8sk4xftwNAbA/wwM3wGMUmxOOQBnHXzetIYvibonmSiuYTNjriVg7glAiwBk0fNZH6+PmX9P6kfNmCXGpftJ7TgKwBIAnln14BAAYxMYm5C6RjCyCoOyr0qkD/c+HI0B8DXA8N3AyCQwesD1VQKH7EcASm1Q+y4CkN9pUKiVF5nLvy+fBbTUd8QBaH1HvNBROiZvfsNnrF4kcvPwpdsBLBeU18Nf7AB23Dp4ecHC8oBgUlJJecLS+7+WOpE3gbE+HKw+yoevCYkMGKqPJrdEKARutaFYRs1fiEZ0wP8CDN8LDO8FRqYq3W10pgKgfYLaYCzootgA6KXaTA90y374TKB1sBozy77xHFZ536utRgAmEaw6g5kUSFZwSXnA330qsOlfgHMPDlZesLA8IOjoLypPWHj/11EnCiVwkz7kAExtsGraYUWdSDX5TmsagL8KDBGA7Bd30JsW0oWivnEOQNP7yGTSB
vendor: 60,312 bytes, line 5695
5695R101AlZSUtGyfgZDkCWY1HnJdcBVe6325hTvelg2CQjZNDygG/2An0j1wKnL6y9vGBheUC8prQ8YeH9X39OVQSc7Mc6fCaKvAeHdCIVf4yMYCynTpX+nb97NJmlSQb8r8DQHm9YOFUZTKOzoXGhs6AxF0HIexcLBvWBuiHN8s2ne98R3qc6L4Vyb2oBVjfm9MIFHbjDCh6kPOBbQoG+oW8CO5bWVl6wsDwgfr20PGHh/X/1iaEIuDcCTIW/1Q4rFv8OnYiW3c+W2iKwUjKbyjQNwL1uuR6sAEgDgq1brXOmV81PxhNB6DUDBSYzQJwFtz623XcktX1Q1VWKaTF/zZhVazBVYA1tX5MazsGvobwe/jQr0Ne6BTh5uf/ygoXlAfG60vKEhff/rSe1i4DnTWDUACY1guFTDqLYdCBvf6DJYSMYATBfOx1kLfj1v1axH10nQ3Sd0GUkBnTfpemtBJgseIKQAHLQcVxa2TnuMW0Aqui5es8xBIegVdVVE8VhzHnLh65WMB9An+X18K6aAn2tO4ETl6vqbKuVFywsDwhevqg8YeH93/Rk70JE90nowxZbIJjvS3WYNSGUwGHJTpPxwwcbBuBrgRYBeKACn7VtpdUu/c0NJxO9BIxcKu4TTODzbkonPLoaL0vyUQRb2y8HsL1ckfWzMeuFi40Qezqi+yiPhyt7FOjr6/gCFwgP7Xb5vssTFt7/nQRg6MGRWmDRoeyTlpgw68GRTwgZgo1gGmXAX6/8dtaylSKY/koyID9BhzML3q1gAos2AcOrZYSoq/pJp1VtODRm9Z3LS/7WjVkvXOzEtOpKyGrlAT+4SoG+VY8vBGCvy/dVnrDw/vee65NBJiAjBIVcAJQjOm+DkCZEeiGAMw6sAwDZsJrAdhFM9rPGhd4904Co5oVuCZPV6kD40Ec6+9W8dBTBsfdc3nkpvnB82fp2RPcs79dHgb51LA9ofsDV6vut5/3PnxcAmLVBiDqgevDaJLkYrpuQxzcNwN8AWgIgRbB8loEBzXDwl4cGiDGft58SCOWGedgjvOJ+bPvgRkiuA+ZjzhnQQOiFNVbloa7l/fos0LdO5QENgEXlCfs8Qbf7HyMA3QVjYihYhLENgjX9y/qwxQmRU/asfd0ZcLU2CHVGyusJQLKfVi98CS12T5f7iECkHpsMkAhCF8+nshWH2I/jXsOYO144GV/9ApAIrS3vt4YCfetQHtAA2G+/4PW4/2PPbzMgmUMi2NoeSCRxIt2/FvuxWURIWCXg357gfTjEDNIHnTRXRCpH5ugKwGl3HpMBXQc0v6WLYVm/5limj04rG762K2uYY9jBkr9+rI03NL5ZbczS/dJ+LQyoga4o77fGAn0NlwdMAOy3vl/T938KAcj121z8Bn+Y9eWQJRz8Y6kNagDh2ey5EvxjxQD8TWdAuneCCO4An1vw5vdzQMmdktwq7pLZQR+dM34+ZumAxvY1Y04uqOAJ6FsExzeto7zfAAX6GiwPaLWR1lrfr8n7f/Rl3QGzmsis+/uO71V9OFgP2gpPhgr7TGRqRUT6dyvr4aIs/pm/2zVUNbBSv6G8e5pEv0Cvec7Po7+bTtjlBRlkvAMBkDeQyvsNWKCvofKACYBrre/X1P0/oWEAnnFD1YdjhtXxR73mX10FfCHHE9pVWcGAI/S0gKsfA2y+twrFZw6Hxf/F0Pk8Ri/kpGSnMuDx5T0iACgQHioo0NdAecBUHW6QdsV2/cL7v/Cyqr5gnc42CCOcfX1VIZ/V8We9IDmTzVXwPDJiXuKXPxtDBma8+lzP4WAgKkPxCUAPE4v5GzEuMX0PYJPLhB6FJsc7MAMmkVxaYC/K9gG+F1++8AQ7Gwbgk78I7GFpXgIwFiRXOwaJZPUbiR0yCUDRk+cHf+YpwMj9HgfI8ClGPyvsSiH0WSKRuYlitLb/zHM/JOSs5C/YIC9cMQDZr/dwxgOW9gtGYUBi0wA8l304vDQvAchilFbpIBQhZ7Ejq6ZQ0/Yhil8y4j89Axie9DAsD6FX9HOK3QtROTFkviN83kG4felIY8DCeLrSeMDSfsEovAECUFsTjHD+tcB+tkFgcXKvBRir7qtFl9owmO4Xy/1G3bAFfPrZHorFNWBFwHjQAFctIghj2kBarw06If/+MM9ZqTN6DgsDojCerjQesLRfMApvoGkAWh8Ob/tgAPSKWCp8ngNQtadjmTdltvNvn3peFYhgQQgh+iUmEaUAUoXM1yRLmWuFLaE9Z+XIAWBhPF1pPGBpv2AU3kDTALzwmqo6qtVh9kJErAudABia38TC5wJgS2xIhAwBn3yhByL4EhzXfRXxYsDTJ4IvrNN2JFMxZcBzVo4cABbG05XGA5b2C0bhDTQNQLZBYH1AVsQSAAU+imI1obHyblnjG/kJk3U8BHz8xVUQAhnQIl5CyNgKAGp5LKSSCoAySh5Jj79vTagcxUaIBeRNe79g9gq+DXig4wGzy+PONfT7RWFA4noAkGXZVAhcBckJQgNgrLiaNb3paIDo1vHHX+oA9LQBi4DxJcOUPJUnTgU2NJUyROs8irGARxQAC+PpCtsFd40H/AEf0gMQkLgeACT41PiGoLOKqyrJq3K/Ya9mNyr5FusN/uPLPIeDa8Bc+w3rtyl4VFHaMZc3i9RWBM9jjzgAFsbTFbYLRmm/YBTeQNMAtD4cBKDXBTQGdAB2MGBo8SCLmEuS1AFVAJ3A/NhPt0PoCcA8bSDG76XI7aySg6JYuGfKwJHFgH0E5B3ueMCe/Y4L+xVHAOZ+9EHcEgQgwbeiEYx6jwTdz4qfu7EhEJqxGqruf/RnHIAEnxgwBM0aC8aUAYWNBRCmoIll4HTqO122QcZbrgMWxtMVtgvuOx6wa7/jwhtoGoDWh4MBJ16WN4lfr8AqI0TVV1O1fa9BbQzovkAy4Ed+NgCQUSxZCFWvCOaOFREXyUwZOPIA2GdA3uGOB6wPaOz+QPv5S+MA3OXiN9aclghW+d3IgupBF2pPqxcxGenDPxfSRh2ASiKKiVP2PaZScvAKoA0VDc6cOlIB2GdA3uGOB1zR77iwX/F6AFB9ONSOQW0frA50sILVcckWJyIDSgwPAVcJgFbYuZ3FJvAlEHbJ3IsgJLGedeBIA+AAAXmHOx6wo99xYb/i9QKg2iAIfDJEJHqj4SExbEty0gkdhB/6P9oZbBZIGiKYVb9GKaN50lRHBLOvhDxh/5EKwDUG5B3ueMB2QGM/grb7/6wHAPNGMAY+GSGUjC52VX2f2CD4+HO0gqkZfegXKgBaHkcWtS0AWii9xG1ImrLlN5XR8L8fmQD05BVrmEENmpYSP9QX+KHiqj2/82+HqqDWwnbBRfGATdzAegGwru2DpRq7Mzq2fpAf0Nq0Rl2wBXzglZ4yUAPAmDSVWDBPHQjLcgTqOZ6zUvdKHh4ruDCerox/Dnu7YqwXAC1NI/QcEQuK6WK/kdgCTGC0PYAP/KIDMBgglq+hIkrOfsaCviLSofcJgJ5AdM7kkSaCj/HqQKVIGvD4swF8bcBjmzjsaQ2H5D/6acBd9wALB4DFWWB5AVherMp4GKIYEOp7+26UF0aSfT/xYuDG7wDjrIpAERytXf2vajj7ueryQXSFl10K/ON3gIWDwCLvjfGB8Z54O+Ee4ve6513uB2R1yzsqC+twbC8HcNVhfAeaBuDP/TvwtS3A/ePAIfYFVlPq2HHTuyulZCTlhbjhETF5yxTQGgPGhoHhIWC4VSXGD3n0tLkMHXHxu+YyB+MlPwDuZs5K6FlsbCzdVO9DuKfkHM8AEkP7B8fOkwDcD+B7np42+JkGOvKdAL4E4K8P0zvQdET0b14D3DgB3D0B7B8HZka9WzrD88N6sFm+YcUjrn7E1ZDvMtF9DBgeAYaHgSGB0PNHCD4BLwLRsByAyX/ij0/dDUxuqlIG5hix7eFhvLcOVUAtyPSydAFmOQNe6EYGV/9ZESiKgIEgtbaD/gHALQC4ovY5r5KwtjOU/XfTAHzzLuCmIeDuMWDvKHBwpMoN0WQzNtAaYSs0K4ZlOSAjGG9kPjCBRwZ0ABKEBJexYAZEAU3A7Oi1BeDym4EDnjQ1TwCGWMW8MXcKks0YOyZNlQOQjcgYIUHllEzYQ0ktm+r6oz8G4F4AXwXwRd8/kO9A0wB8y65KmPxgGJgcqYJTKYpTv2CCzyddQJRDOjKivn+Deh8BF8BnwBtaCUA+YYEyAU8h+c6Az9gNHHRmrgOgmDA3jHQ+iWupCeUAvNSrA9HNwqx+muk9nJVNg/CTfrmbAPwbgK8D+PcHkIibjob5o13A3XypWsAkG1cPA9PDFQDZM1id0i1KxsWfOrKnAFXlifCFFMMRcASigOcs2MGAIfE9iWXplS6On7UbmPaUUTXQrgsVMzcRj5Folg2V5ayUA5BWYKwOxKUafnosWjcJwk+7W5F2EKvlE3xcXaNYfiCYsGkA/smuqug6hcleAnAImPbO6YwRpMgjCAVAm/yQmKTv5hNsAf/i7SyNBSl2a8Qv/4/M1yF+BZSYlNQCnnVrpbC+mToAACAASURBVJcaI7sOSEY2NpaDXLqpR+vE/OVksDgImgGgghHoYJbTWc7oJtFWc65/cg2AYvh2ALsB3AzgVv95nS/f4QdsIkT9T3cBrGtITWZfC5hqtQHInsEGQn3UDDvEDEY/ICf7SxMOrAg8T+c00JGkvHGd2DABUYZIAONzCUDppCFhSukCBsLQrFtZe/IixYQpSyEoJoqnuPWrVRAubQh83HNlZB23z7j1ywmj6CIIqUPxw2Xeu9bx2jx10wz4Z7sqTYZaDD8EIDuoE3hMVEphWg66JIp90k0sBxBcy+iPIIaT1RtEsHS/yIAqw+VSNPWQfe5tlVEk8auXgVa5BUsEJuT5uoliAbE5AGotmIAjCPnR9xDG3TQernYAUupTdBGEFMf83OkApHG+XlvTAPwfuyrgSZOhas3u6cwTsUBVn2gTwyFMi8wjHZAA1M9fYGHDULJD1m8Cpa8fRxDad+l+Ykf/3XNvd11U+qiL39SxXevSsshdDFvgbI1O2AwAtRZMZzTBRuDFjxe1Xg8QEIB8yyj5yYIUxfQIkfkIRnmHCM712JoG4FsdgHHp3ACoMH2G6jM4lWzoQarSvwQ6MSB/vporVaFkh+mCLlpVR8Z+dqDZLoDOpHSiQeAFDkBjPrlgCHgCUaFifg67H/9uYjn4Ai1vpTERTAASBaoQJBAKeNqHlL6mwPDZYAOROag/EYRkPX34MwHIvzW9rQcA+TLpI22G7EcQKlJGsYIJhC6ClUMiXfBTbFUQAej6nPS/OuAl9pOOqIc2BLzg++3VmWgIEUz82cRuCAtLIHQQm0gO52uOAb22sC3JEWgRfPpZf2sQBQIgLydPEIFGwPEj8MlF2bSbsulghLftqsCXq9HGgHysznrGgi5qzTUTFH8FLhAUn3hIJwCN0HLncw37qaF2zoYvuKNivmQIuUNc7GvWt6sHNs26twA6vhyq8NEMAHlyntFrDCcQehyaPTl+FwAbXDcmAKMRThakEk8Q8kPg8SPL0qzLBl+A9QCgR6uZGs3vfHz8TtBZvkgGQrEPBVAUg2Sij50QAOjiVKI3saADJRm7dSLYWfSFDkCem/dhZeMy9pPY5QvSDYQyUJoDIK8qMezh3wY6fSL49PcGgCAA8pScJLIgAUYQEmz8RPA17StvGoBv39W24eREiBoNQSgWNI1HBkdgxJSw1AI+dFIbgOYmkjimQ1r6XXC3rAbCHycAgytohf8vsB/r2KRaRq7zpZ+D37HMX0s3DDcCUGLYaw53MJ4YUODzusqlGCQAOQCejuxA8UULUkxIwAmMAp8Wa3qkN/R9W+sBwOhIEPjk5SLr8HeKFbTQfb77csPIMHGl/4MPbReslPhNe4+MiTpi9AFGV4nI7MfvagNQLh/pfrYnDAS8aJQ42A2w4em2cAyWQUuJVQTGWLs1uL7DG9J1RjhA+jvYk4t3KXeMqijpzrud4At9z3XtP16yGfjKZmCGooYh1tZzvv8xXPFl4PoJYC97k9FlwZWD+Azi/deMZWeP13eQCGEyoERudChIjbb3mJYwH7V0QIKuCwj/gfMj0asn2I0FXRSHXfL/iRkNgLyeVj8ccMY//J1fyxzTAXT2+xoQViKYD/1hDqLxPiYxTgSvQrphphG97tz4Slqafnj7uk1kIQDZrvWTw8B3jwEW+RLxPgSiCERdPwPR7+wCPg/gulFgfruDkOMQkFc5x84e708JAMmCuRNBXi4TIg5CGRzGiBGE/D4E/C2r2vcAYJoify62i0aJSMhB+2IHoNwu0fkcjQ85pu3ack5nIBREqneYFyWLkAXIJHESe00Cyx5QyeL6F/tyEcDcrOW2n7fX8df0mME+/vQ/PQjhoy3gzo3AISYf80MQaQx1peH9wb7v2mrtmCBkIMMejp3jIJD1MsaxaMZ8v5N/67INAsB3BAYU4JL4DSo1J15AFPAEwuQHZJzkKfUAtOHLJSOQRWndBYQvCQA01cfnNopfsaCJaD2baBn79QjSTiOEP1EcawIpkq2kegBTNgHWEpOKF8Uwq2NRFPM4AqCf46/rA2U9/uVDvurB01zvAJpiiwOl3fEeciCGF+Ij11f+QkbSfMPfIzqw57mEFZ9Dl3Ps5HXWAYByHJAJKV7N+s0cCQQhwSlfm4lGZ0KB8C/rABgZUS6ZHITBSEhCowUYAAksF7cStWREyxRwtuPpOlgw+5s9sq6OaIJIIlUgEhA1edoTgHxa9HVw5jibZNF+j/9yGQA/7pbujZ4bwv2+cWB6tFo0NzYnkxFA+cvEAo43VBoEo2e+48EMXEOmD9F6xhCE8RwZEJ80VblKvDlmzwicfqy93/o+8K8TwB2jVSgW138FrJQTXBNlnJgmrjZwanow9CBP/rL9wF0jwAGWDtFyoN9PHutnIHT05mPXz93dMGQAPniJsjiBXiTbxDZFMF9NLUPQxKR5qezz1Y6/YZDH0D6GkdAkYJIvRalAdHAMmPZoYhb6NhDWvEyf/ma737CXN7R1ZC7hUbPgcFgqt/ZZjADnM1xqEVhYBpb4CUk5UsL7jQvj///5buDrLeCOEeD+YQchYwG9VIfyg1NaZszFiCH6DkRGLze5/dgk8IMWcMCjdCiCzR8od1B8OTwvJM8JEShFut1fzMhi+eRJr6LI7hYP2M/xVLwKNoZjUTwRMAQQmYyhWGQxsSADOflZ4kukj7PhZ75bETjBpkAGahMkcrGgwhsXeCyBHBj1wmOBQwvAwqKzoFeRV8ZaerjKYAuirmPY/o9X7q5Cyr7fAvYMAftCPGAEoYlBiVtFwLjtp2U4irj7yOANbi+crHyrfCbTquJV44O0F1FrwQGIMZFqdQDyP/gGSZ8TC0ZRRsOlVzzgasd/u+zpMByLehAfCgMQCDyGZJHFCCgLZ2f8mgI5qauEcVx9e5vACTgCTwEMWr5TdIpWKJb5MvrnoocDswvAPAG4VLGg6UKeqmi4iuDz4er30oX0FP7u5moMvIf7W8B+jwlUNAzFnlZCIhvGFRCeWzrgXSSIBreXTFZSgVLHAp4UHOFuociEEsn2PJwl/XEk0dzfSojeerFg1IOo5BKAveIBex1P67lgUzgWQaJwLAKRH04i14ItgDKEtGsRnWx49b2Vkk9wUefTGrKCF7R0JxZMqxN8cmPAxWcAcxGABKEAKPA5u9lEaAbCmKMI+sDN1X3z+ro24wEZFc0VEE64ABgT180PF9ZdBcDb6JpqcPtPk+1ACbmKjJnllwyuILunEAWjZHkBsrsRUnfD0qEiC5IJfyisgMhzWhcP2O14Ro4WbASgAMQJ48SJwchmBCDFa8qpyBbSP7OvU4PQ0p2W7+LSnSJUFOrI4V7w5IoBTQQTfJ6oTSYk2mQcpGRyH2syGjIF6EM3V/fM++C1CfwUExhCsmzCaQT43lZC3e1hBpEHh36XEqrB7Scmq5dV0XZxmV8WuDFzAF9iwhow9seAGoBcGtKjqAc+1l9rLb/1igesO55ysmCrC8ei6IxRMAKTWNBi6Xw98xNTFUi0jEcmpYgRAPhddpVi9OIEPP5cYD4CcLkCooHPwaW9kV+iwWrQHT8uA1fd3F7DFvgUHUP2k8jTiogAqLoxFpDgbMj9jXSuN7i9dLIdaxzBp5XVBMIMgFEnFAPKT9qPd6A9BIGI7MfPmf4U+40HzI8nWgq2PBxL4FEkjKJixGRRFyQQPzzd1iAUzCAQas1YOmAEoFjwkecDC/PAwhKw6CxIkCXwOdVJLxTobMjBdyIgfvimNvNJ7Evf4jWtdnRYD1YNGVuG93VWuWs4Jf+mlZCCZxwP/cnJ6mXVKk2+tK8lQQVHRTGc64SDAZB3Ey3JcxyACkToJx4wHl+YwqloGDICmYmTFgMQFBET8yyYzyAG/AfWX8mCGQg0BTRoHwt9KVaPE/HQ890AIfgWK+CRAaMRYnVdxHbhdY8Wslw1V93UDsmPIj9GxgiAioRRMIJNvoti+SW/Ikd0gwAU8+XxJcbGITJPDvI6XdCFREFSknTB83xka40H1PGF9dnycCxFwygkK0bASJQSVAbAYeD98xUAe5U3jKIwBosSgNsuABYogl3/IwgFPrOIg1Xc4ZrpAsSrvruykl2ucykapkMMh4CExD5DwJfWAYAxwk4MKPAJgOIjGSEGwuCakRhemw6Yv0UUwRf7L00L9pnsNx6Qx4feY4O8pDEcixOjsoTKKpMYjSFYYjOC8Eq3Wnnr0YYS+0Tmi2HysrPGLqwASNYzBnT2Mz2QD91laxLB0gs12GAh81cf/o/OcHyJ+qj0S/zxnhUZbSyYWaL8+Rq2S29wowiWkJPan4MvgrDDGAlRe7KIywDIgR3meEDWg9HbJgApNTkXo8o0i7oVgxnEgFr8F7jEdnU5GvqfJQKQKyEOPlsNIQvyvupAGHS/Okv4qv9oh+PHxMLk8ggBCRxvAmEN+AiEzz2iQfQBeNmkh4K52hJBKOaNe/FSLobLRXCz43rQnu2yi9oMSMDxs2jo8303ERz1wsCGZECF4kd3DwEYYwJjhoNlQrgIjlYodbBPrwMAZfEmyzcIv27gs6XDzC/IR1DOgA9a6DRz4wZAsZ+LYXvQYsHoD4ziOFklna6YD3+nnU6dZ7bGDAcBUImIAmEUw/zbJ1i/scGNDJiLXmle3RhQ+l/aq57gUQCWzwwBKPeLsZ/LFrGg/ShRXAe64Ajkv30kALAjF8R11Dy3K7KRwJcsUTaqWScARou3w/INVnCH+A36n8RvM3nB5XP4oD6DATBYwGb5ajlOLOh6X8JaBKRG77+7ygGYp1bn+V25/01AzBnwQ1ypanD7KWfA1QDYC3zJIj7KgOUzc9nFbetX/r+O5biwNhyX5uSEDr5o0xsJwLp8/m4A7GaJUv/j3/5+HQFYJ3oFPPkho/hNeqBcMkcB2BAA6XrxmMBkfFAci/m0JpwzXw0TXvXtzrz+PKc/Ml/ugzM9MDqCAbz/keVjjGcQA/YLvjoguo1mRslRI6RwfsiA5nqhL5D6nscF8gfTdfxpS+/hLzvWfzMQCoB1Fq/8b3VWaPIDZqsRV64DALsZHVHs1gEvsqFAeBSApQC8pHK90Oql4UEAyvCwNeGcBXNLOPMLftgZsI75ouUr9ousp2TEyIJ/sU4AzC1e+WIFshyAHPZREVwItrrD3wGAhibTYBhxVpe/xePyrNBuWaoNp3DgFwC81O+RAepK/a5Lfe51jxr7JwA83nPXYgq1asl0yX5N48+f4VEGLATlK1vAo5YB1gBSRmsM+NFE57lcfPD5pPFWCJImtyvGgGfOAacBYO59zFglgHgPefZsXV6/gPXBYeC0RVgyJNOGYuJjPka9eHWgjL9bWzhWk0/n/wPn+k8bgFNmgYcsVflZnBRmIShtJM/m7JGibGBoOIIez9wKPP4AcNpylfbNlGfdI+9NjBjz8JVzppckZuJ+dBw4aQ44drk6j1LIY9JkPD7P4s2lwVEGLHwJnncscNIh4Nh5YMsSsHm5ndOu1BGFThJ8/K6JrZtoslST2+XHA6ftB05ZAE5crgAups5TfaL6EF+UyIif3gAcOwtsXep82eIYY9JkXpMgMp/AeZQBC2b8OduBYw8C2+aALQvARgJwGZhY7swEzbNa88IRvAVO1qkF91J36DNOBE7eD2yfB45fqphLnevzdGeBKBfL8UX5/CZgyyyweRHYsFwxYHzRNK6oetSBMDLjUQAWTPqPngpsnQK2zgKbCMAlYMMSME4ALrcnR6JYQIwsoUnjpDRstOLy7cBJB4CHUGwuAtuW2nUDVH1EFUhycSwWjGD64mZg0xywcaECoI0z5P3X5P6nWlHdgHgUgAUAfOYOYMtBYNMssHEe2LgITBCADkIzSJZXpCOnIg25uPrhgnupO/TyhwLHHwSOmwW2LVSik2pCrDsQskzNIBGIpBdGI+VfNgMb5oENCxX4yPRjPj4xaJ0+WGeEHRXBDUz2Mx4FbDoIbJypADixUAFwzAFI8KUJChMV2SUaAGc1cE/xFJef3FYRti64nkqWDrqqEhbrsm5zvZCdPCd8nHzJOLZuABRz9hTHZwPL7LnLnoNMIY2VyaKcjtZLHOAbNgNPngKe4BacfGF1pnydD+hphQ/8XV5UiEueLGnDN1tWXj/3/4cTwAUzwGPcRcFJiDpPt3FLmf5vjwE2HAQ2zPrEzDv7OQg5OSM+ScYQy5Xbo8465u/ZfLTJ7fKHAdumKxVh8wKwealSE6inEoSy2MWCdbUHIghv3AqMzwHji9VLZuDzD8cXxxWZs5c7apmW0fMBnIHKn5X7d6I5npvRz94O7LgXuGIReJSb+Xl1tzqflybwRwqf9i97BQRWomWJQ7oZVFtJoqDX/b/oGODsvcBTATB9gsfGqmzdjtVz+G+PAyamgYmZCoDjFE2anCVg1CeJwOMnTRB/DmUINVkkgia3y08BtkwDW+YqAFJFMD1VAAw6XG61R31O9/fdrcDYPDDmY0zjc1UjivBuAMx1QdMB+WAYXU8dhEU16dOSkppbcHFSrng8MHwnsGMPcN5ypURHp2xMIa7zDz2z8Gn/kVe0YomO0wEwBYKujL7v/zHA6C3AxfOVh58g5AsZxx4fZM7sf3h6BcDxWWeGBZ+cMEFiwGEHHRnDzun7ONHs/djkRgBunql0VDOSHIDU3cxSD4aEajhFXS4H4S1bgVGN0V8we7E0Fh9jVDG6Obr1LJMRwn+kOCaTEYT0dsfqZHXl/p7PrLi9wIY7gO0H2yAgCAWCWCowKrYE8nMLn/a7PQn9X7zIJPPkCcK+758y7x7guNsB6l98gZjLLYet3Ay5n0sv4R+fCYxPA2MOwLEAQLIDPyP8uBg2cRYmzFweAYilKkn+OC8/Fdh0CNhEA4nGA40kd6FES13WLO8v1qHKAfh9B+DoYjU2Ak/js/8NAIwg7OUb7LCC+WAfB4CpBJoIiTRNRmS1l13kqWh3Adv2A8cdqqp1MB+aIOSxWv6pq5D2kkIAvt8rF7BLJksN/jMqfa7v+7/Ak4B3A6ceqpasKMq5akAmlLWY37t8ZW97PDB2qALg2BxgAFwANEGcnI5JcrDZRPlkaXL4u1KJUAfAjbTQ59x6dSvdLPXAgGYshZWR6JIRaXB/NwFI8C1WwLMXzMeSwLfcXuKrA2G+wrLCDcN/IIg4ERRn0qvyySAQX6mG1XuA4fuAbTOVwktRRr2MLCoQyvEZ/UY/WwjAj3jtFJZkU79g1ghkgEBf98+0Umb/3A2M3lkBl/fOcdMok2EjkZyv8773LAfgHDDKjwNwxEUw9yailpwdxBAEYhBbAuGzG3aKkQEJwAkCkOCjlb7Y6SYyf2UwlAS+vKYnAXjfNmDEX7DEfA5CjUcsnzvbu1nDtUMmCDkRZEEyGdlAk6G6lQTSa6m0MP6HuY73AxNTlcJLZ6WOJYC5/CNxLpHMgdKIKNl69Qvu6/75AjHOiTU87gKOOViJb748BKCWrnK/maTA+58AjM0Ao7PA6Lx/xBAupoYDC9okBRAmPdBZ47lNA/DhwMRsxX7mPgl+SrmK5EaRNRslXFQ9CKB9DkADn79cZtkHFkysJ103eBbqlh97DpmTQTYgk9VNxu+xYbXKU3lhFoJPOgdFGY+lPkgQxokkgF9Xgj4AvfoFs84eX4Ke9x9fIC+tRfDxvvniif358sSir2LCj5wNjBKAc8CIi2AxxLCzIAGY9L7AhGIKgpATw4l8wToB0JjPrfTkp+SLQbHrOqm5jNyajS6VCMIpApDAWwQ4LrGgXqzIfnq5cv0vN0ZXHTInME5GBNLb1DGdOYQsI7AfGKFjlgqve8wJwG4T+fuFAFytXzCLb+VgWnH/fIGYfc46Hs7iHC8ZkPcdXx4VfVXJw8+cA4wIgM6AHSLKWZCTESfLfg7WsIyRF3ckiRQ+HACXkwHptyP4KHrpJvKVGnOhRF9eBF9wE0mUEogz2wC+WGI/vVxiQQIxAs9+rmHA6E1YFYB8DJwQMZl0OrLZ++i7sfT8zroYHLS9df4RACWKxSZvLXzG/fQLZqk2gqn2/vUCUQ9UZaM9wDaPeSPrC4A5C1KV+NITKwCS/SiCR/jRBDlLmP7nHynsxno1IPwJSyRpbiMADXzuPDYfZfBTEoAmcuVQdiaW0zwXwQsCYDYmMaDA1wG8TBSvaoR0G77EcGSET6hjOvVApfRPAUN0zjr45JzVcSqiTxD+VeGzXku/4Nr7JwDJOkxFIwt6j6+RqUrlkO4bXzp1gCAAv04AzgLDDsBhKugLFUvQUhTwCEKbnKCw14HwJ9cDgGQ9WegRgDI8XEcVEDvAl7lVlglAgi+I4CR+Zf1mLGgMmDFhBGFfDCicRJFERviSABjLS7FC0MFKMU+07wOPE0kGvaoQgGvtF9z1/iODkwn3VWoEXxres5ib9xx1wZufBAwLgAQexbAD0JiQwJOuJBA68/H3Zhk6+3CifqqwWNMKN8wjKgbk6gWJgC+FMaBb5vJVmsUbV2vCqo3cRWZcCIACoax53+ulkqNd7iqOcU1WcC9cxEm5kQBUdZ+sTnSL/jEtTWngi21jhJNJBivZBukXvOL+yYBkcOqxKjJ4AGgxzMrBVwdAMmHrZOAYF2l6y/mwV6xD17zmWo6MbRyeWtOHwxJ91IIhr6rqZS70DPPLXDVUrfBwzHKr1EUp6/h0T/6L/GcCqslt4IhoTcwdAqDSs7I60WQH6R329pHuFyuXDJmEjuOSbdB+wSvuP5bGUjmsA5XoUvcvBXKKAQnApUdXwah0b8jXR2YzJTsC0ZHB33FL+2yiX3h/1YeD1fFZGT81g/H6yqkVa9YEpqMhTADle8erHA6t7Mh6j4ZBXdBGjFyO4CSIm9wGBiBvgqxwIAJQlXIyEJLyI/i0SkAG/FbhaEr6BXfcv+5dLKhCg4z1C1HEBJ8+BODQGZXfk/quAZC6ketAZEQCTWAU8PIJt0fgwHzZvVWNaKqi7JLOmtDWFy42g1FxH/XfqGkII0C+a0tnDkfsGxQjn3VPsk7tXmuy+Xp0JhtoJosAaFcUAJUYKiYJxcqHqKAH9rPlG2cMrmCUbMX9guMLpGTcCMKDlZGhMK8IPnPIn1X5PA2AwegwEEYmDGBMjOI5whGQP3NPBT7VJlRNaKvF4t2IWHbDErtDlSk1p4lJ7/zd246tglGZryIfrFhQ7pU8WCAX0ZENG+57U14Z4YrCeLrSxXdev6TfLwrbxT7znMrfKQXfHLQCnyvmRIv0Q3430ezMmL98P393G3wqz6am1NYzzoGn+svqRmTAU2citctqAX/2EI8F9ACEmLHXLZGoFxtSl2xyK2bAYwrj6Xr12+1noL/jUTCD9vvFrn6u0v1/nvGkaoVBAQi0eummMAuXQHMWJAA7gCixG8U0gFfcXdlBKk4Z6zELgAJfZEKrxpC1xOIl/+Sk7jkcdYlSco90y9+gK6vJrRiADD0piad7RuFo3udNCgft94vCdrGXn+tujgV3QAcHLcFnroelivHkchEL8ue0uQ74S3eubAITS3IQhKkMRjBMokgWG3L//2z3VSnP4VDgQWxUEEUxAZFHL0eR3HDfm3IRbDHkBfF0zy4EIKNhSvr9goGEBdvTz/MIYQLQdVsTwRTFDj5jQmdArRDYJQNDSs961R3tPhx5NXoVgoxleHnarjohgLec3D2HI492yQNvIwvqO9fJm9zKGbAwnu6FhaP5pFuMg/b7tTbpBdvTz68cz/zI8azVj8iAHTqgmFHXDUB89R2dtaC7tUGw4kDOgFb0R2wYRDGZ8g9O8aU4XwPOczhiwGlMjqqLWiFYGu570wADFsbTvaxg8nkow7E8nM/atfKzln6/1mS4YHv6BQ4+Z0BbqHcd0NwwYbVD3+1yWhXJxPBrbq8AqE/XApSqAxiBV2MZ/54DMOZwKE00rnDUWcR5KiV/brjtSAMALIyn+/mCyeehjIYp6fdrvVELth8RAClyHXxmhPi6r1m8FM0ucgk8+y4RHC1kAK/5XgW+2hZYofafWcPq1B5AqDqEYsQ3nepR2gqhV2yiol1COkD0C+aOaoGx4aL7DQCwMJ7uVwomn4fm7VrX2u/XAlELth+5sHPtN+l/Ap6sX2dCsZ/phZkIJgv9l++1wbcq+2WFv2NXIjNKAPzuw7MUAV8DTuynFIEsQy83RgTAhiv+NgBABaQOGE/3mwWTLwAqHnaQfr9GnwUbARgDNBUlkpzQboyYCyYDYdILdf0l4NduW9kGoa4geNdazLElKoA3Prx7DofiETtC6XvE7hGEzJlpcis3Qgrj6d5UOJoYDcMglrX2+y0NPtl5UZUjkfx/Hqbecoe0OZzdF1gHQrln9Bhee4s3f3Zxm4MvAk9VSFdUIw0i+Q2PaBtISiBSSFgCYMjMW00MP7pwvvLDmwFgQTzdHxcOSGvBg/b7ZRZByWYAlOERluKM3Ra9CKWc0q73dTBhMFT4ZwIw9l5Lrpes+HjeBiGCUOKXeuBvPcKTiEIOR0f+RhDBMYi0Lhea4GTaa5NbOQAVDzhgPB1La5RssV3rIP1+7yy5OAADoAchEHBkFbKfGRpiweAPtMs5IFNokyOGk/7rAYC9OhBFwNXVY1at5tftCBHaWVS2AJdEcEinrDNC+Lumiyc1B8AB4+muLARAXTDCWvr93lR4/Z0Xt6ODFQkj8WtumEwHTKDLQejAfN3uds/dfjoQdatGLxb8jQBAYz6/boxiFgAVudzNIc2/s3xLk1szAORoB4yn+2DhaATAGJCtbpkCYq9+v4V+aBgAQ4i66XtaC85YkDog/zdZvzUgfN1N7a633Xqv6fe9msDIHfNaB6Ay2JRE1AHAEDIfI5nzZCLeN4Nbm9yaA+CA8XSsul6yqV0rJ2WQfr+splCyCYBR/HJyKX4phs0PKBZ0lqOYTpvniAiUAmAd+HKjo1cvDjHgr+3wPJQsVCymUZrPMuRsRBDG4AQCsunyJtFGHwAAIABJREFUcc0BUJlxQoH62q8ST8cggpKNAFRGwCD9fkuvbwAkyGgJE3C+Nz1P1q9/T3F1EZBxvZh50s6AEYC5yyUHXt5/Q8zI5/KrAmAIkkipkyGPYwXz1aRT8v5ZO6jJrRyAvKOvNXlLazsXs9bo/ztc29Pohgotp5J49Rcj/pzfIwGS//3OM4CNd1dpntQpFUmjEH4LYIgnyn/OLjL8FeDGhwJbNgFjI8DIEDA8BAy1PFK7FSKf43cNKrvHx+8C/vmxwMgmYHgEaA35J0StpvvzL/nP8RbLAfhyT207TChgDRiu/ZL9DsfWNABvYzbhCDBKoBAk/pEobGWTqp819hzQ1/0k0PoaMDEJbJjxVZFgDad0SaUO5LksWVj+XScDmw5UEUDJ6U4d0nVbC91S3ovfVHp5al64cgC+k7mZAP768KCA0WD3A/ieLz090CDceVmlAuhBljLgrfcAw6PAyDAwPFwBkCAbItM4a/FiNtERjBl76W9ffD2AbwJDdwFj+6syImRXrd5Y2FjIYcnzWPLEqnsfC0zsr6qBMQmfIDR/pyJ6xMhKyMrSDiKD2xja6TADTt0/AGAs1KcAUCFrOLF6tbtiRVFavT/wuMCa7MfVTlH098YBeBcwNAIMEYAUlS4uBULOmK3LCnwOPANlEIOSoF9+C4DvVoWXhvdWZVOYqWgi3vOXDUQhgieB0EElViMYJ08HxqeqnG8D4IIDkAzo51DKQQJvBKUmKACzbM4+5hUivwrgiwC4LzvjmgCh6nBcgiMTcv9Abo0D8E6g5eCjfpUA6AxoQIzgi8ALmWwC4z//DxcPPwBak8DQFDB8yJPpPZHeGCyC0KN5DFCByfh9/+OAsekKgEzCTwD047X0SCPM1IYQjCv2E/MJoGVwUUQoPboq0MdqkWVn7RtDDMahB4g+P6qhXFpjVtkDtRGA2nKjos7IyOyHFUbIrXe0FXsTuzIYfNb4O2M3ATGIYQOmPn6hG6gi3eUkQQAeAIYOAUOzALMVh2pAlESqGFBAXAYOMQVjxll03iO/yYKRAT0FQXkwZkjp1pz51LO2XAT3KtD3AIAwj4Wg05kfiuUHYlsXAJLVnP0INLM0OYFx78AzcRySeTsw2AJueI+Dj2Fne4EWKz5MA0MzDkCCkAByUWqsJzarEanzj2zXwjEGFHuGY+pYsMojzZL1G9EBexXou339IRBrC3lJGmNDuSHX+w7WC4Cm6wWxm8DngLTImgC8pBcGBuTXf/1fXnyTugnFwxTQOgi0CECyIFlsvvJfEnh0mhsYI/s5uxFYi1xZof7oOqSAawwYjRGBzYGXbtWXaCIrlvHUagX6SP/ruMVYCEbEqECXAMjfree2HgA0ESur1/0vtnNwGSsG0RsZME20/+/XWH6Mugk/yngPAGy5GDYALjiIHIgRUIrsZjM7Ax+BSx1S4pfffQVIep8dL7dMDsTGjJB+CvQxTHmdtrw4l0CovFruC2NOe975egDQsCXRK/eK634JhBK90q2C7I1i+Gt0jxF40k1cPJAB7UP2m3MGJAAFQrGei9iUTH9yBUDTHfU3B5+BOIKQ43BWtNtPcWIOzEZE8FoK9K0DCGNxLi3FqaKA9gTgeoFwPQAoI0OulWT11oEwiFz7cwbErzNxWtEYBB+VY76Vh4DWrH8IOoGQ7Ocg1CqMRLPltmxvs1/SHaP4dcAJePYyyUCRIzrTB8tE8FoL9DUMwl61kQQ87Rmy2PS2rgB0a1ci18RudEJH57OsY02y/+83/sZdBKr4FXQTApBvprGgQCg9UEAM+h9F6ugJDkC3gJPBEvRGrYoYCBX9IxEcS5K4i6cZAHIw8oXQ4mLBb35YH5d7OekadtTV1UZSjaEIPH4nQzYNwgjAHNwDuWGYpZc7lzPfX1cQur5oBorfzDf+zi0yVTuSkuxBI2Q+PhQDIUEnMLo1TBCZLufGw/ixbQa0KB8CTODjPohdY78IQmfDjmW7Yo/doAX6GqIiAtDHaYswSmeMubV81kp11L6hy2PdAcgblfslOKC1IiKRmyRxZgV/8++DS8BFrxXi5Hd/U6MeSKdqEsEKhpBRsgRMbAtuG4KU/+9ry5brzP/lPVMv1EPOQegharrVcgZUhVHFxNPcp9VFtlOWkL437C0WABWypFRGsV0sb5Hn2zYBwvUGoKl10v1knDgo0y7XA8Pfv0UACnjaK33Co9gJQAOe64FkNvtZAHQdjz9v2Nz2GSa3jYej2W3KGuZ9ixGdIVSoKT13B2s5AHkGheST6qn0erHv5AIgAAU+LVfw/wq3CEAV7clBKDDGZG9/5oVXx/oyYARczcqH5GyH8eFplTawFvAtrtXLGpNrQDGbejupB3omlIHQGc/ErzOcGSRs8zrhAbbuL1Tco/JfbLlNwHOmi2kIcs3owbdwNpYtynDQhsFcgvuG9/YapGFvYX22zZcAU0/GwA2LJ/4AmGF9mwEbBu98Y3cMF+uAGQCj2HVp3BbPuo3IlqxAy5wHAq4OfARmEBXGfNIBa0BIsG0ecwC67merHgRpZLwocrWaovuTxew/V0txJQ2DWeae3WAGbdhb2DB4+wRw7w5g8Qpv88liyGtoWHzMi4C9fAEHbBi8kwUKu2xNAdBxaGBLbJdZux1LwAGECYAEm6wyfpelJrEgFnRDxESwgyUxIUsVMwjVy5AYO0bG89Auu1/5BF38KqjBHlUAYXsteNCGwTeWNuwtk4JMkrlzGNizA1hm69g1Nix+zDOBW0aBeRZZGqBh8M4emfWNADDT+zqMjQyESdQFHfDbZECCLRgdHeCTe8CBaKJY1rDnBRCIAuGW4TYAZeFG8ZuMkGiQ1IEwGCJtHZBmy1obBsvVMnDD3jIAerti3LEBOMjGcOpa3WfD4ic9t6oveDtLfw7QMHjnH6wPAybW6yaG4+8D4HIQfvtDIVtLejpBFsVvUI7NIBHw3DUjRzL3rDVtsYPOkAScuX3coNDynT2VYJCkn+PjqvUD8hVbS8NgjphGxcANe8sAGNoVY/824BCBtIaGxRe8pLKZdpMkTvXiJ2toGHzSNHDPScAyq3er4qPyGaNc7JCRXWLT2TjwGmCOeQashq6+qSpZmp8vojQpheF58ncdZVjLnjWPHr4VWKTKxrHGUqq97qXu3jp0wPy+eEC/DYNZsZAO6IEb9pY9lNCuGPcNV830ZmkM9dmw+OKfbdcXvJMPdY0Ng0/7GnDXKcDMccBS7MwdKz8KCAKQIgY0MWGCtr4TOHAasMwOkTqf6unyuLykfd254nkb7qsw/iVg7jhgmSX31Vpd9yRHeLx+zRhjEGRbB6wDYT8NdymyubzDzCCGfpMJWfSRYfr9HP/aMgBm7YoxNQHMbQHm+ID6aFh8yS93tAvGQb7da2gYfPoXgbtPAqaPA+a3AEubgGU1RM6B060fgkRoCzj+TcD+04CFE4BldZdRc4/YxlxgjJMewSiwN1zWfsOngdljq3EmY08vm5i/7j5yIMqpvupKyGoNg9lngYosl9wY/0dZdrMzYl8Ne8sAWNOu2MA3zw/F2CoNiy99XbvftrcLriz6PhsGn3U9cM9xMODObQYWCMANwPJ49UliuW6SaqqBn/gGYP8pwPyJwNIxwDK76ahDeN6uXYCuYyABkEza4LbpY5WEWdSLxjF26/dQB0SJ6r4ByAN6NQxmkWcqrnQ00x1DEDJFjR8CcNWGvWVPp6ZdMQ6OVOCb3wAscPJ6NCy+7PerkP5Q3tBY1PrT9tEw+JwbgPu2AlNbgVkCcCOwtAFYcgAuiwWlM/XqDjMEbP9t4MB2YO54YJFMo/5gHIcALV1TRZ17FXOhPtvgtvkqf9H4kvHDlyKK4l6VzvVSBF22uwjOb7pbw+CfcwBSkyeFEHAUx/yw9JTyEbo27C17Ol3aFWNuAlgIn9QxO2tYfNlbK6MvaxeMRYquvL9rTcPgJ30TuH8LcHAzMOugX3QALo21WXBZLEHwRF1OgHS2eOgbgIPHA7PHAezNu7QFWFZ7JnXJ5rnqxHEulvlzwyVNN3+wern5Yovl7SXLGwvn4riLWO4fgMRJXcPd/+pmOymELEhRzBxJAo9gVL4kwVnbsLccgHEpWi3epocCAMeBRU5eTcPiy/6qtl0wpvhA+2gYfO7NwOQm4OBGYGaDs+5ExYDGgqP+ccAkINaVpB8GTv4d4OBxwNw2YGFrxYCmV0YxLNYheCXau7EhV3ga3Lb8g4+R45uoGLADgHWqhsBXA8K1AZADyRvuvtkBSArh+i9DsQhCOtf0UUgW/7aiYW/Z0+nRrhizoxXwFhyAi5y4rGHxU66qAFhT3rDSIVdpGHzencDejcDBDcDsBDBP1uX1CMJRwFiQIBzxieL3KIY1YW5MPOxNwLRb8gs0aghAss1GZ1O+SFHsdRPt0i/PLHu++dFb/x4mXfhcbWxhfCtYMFr/uWvKxfDaAcg7ipPCvFOVpuo3HrCjYW/ZA+rRrti6TS6MVQ+L4NPH2nx698GnXF0BsKa8Iab4dFZpGHz+JLBvApieqAA4J8CPOQuOBBAOV0CUYbIskRkAecrvAdNbXc/aDCxSpyT4CEIyTgRgneiLIp3nP6fs+a4A4N8B8/48CUC+ZGJA29fpuLmxJW+5h5kNFg2jiWHSi0r0Uv4pCoZsxw8DUfnhd4Vk0XGdGvaWPaBV2hVjdjgA0BlpkQ/K9bmn/HOVqtClvKEBqlfD4AtmgP3jDsBxB6DA7tdbcvYzJvQJkii2n4NOeMpbgJktbYPGACiF3wFoEx1ZMNe/4jnPLXu+KwD4t/5SO/iMBcXuesHylyACMBPDgzGg7opM8mEHIGdwrfGA1rC37AH10a64Yr4APvvOSdwEPOVbKxu+K2pdKRTmdI3dqkPPVgbSTBGAY8AsATjWniBdx0QxJylOFCcr6HBiw1P/CDgU3EgEIMW52M8YkLolQRddIN1AyKWiBretf9MJQN6HsaCPxe4rvgDdHOcOxDIAcmDFDXvLnk4f7Yqt63gEIB/Yoj+4p9xaAbBHeUPM8qF2aRh84QQwNQYcGgdmx4C50WqCFngNsgSvQ+Dxu4MuiawhwIAXVk1O+e/A7CZgThY1dcno1nHL2oDIyZULpBsAFTBZ9pjT0QQgn2V6ufRicS8QRgbs5ZYpEsENDejBfpoLrwAOjgIzZMBRZ0AHoUC+SOA56xJwNlEyTFw5FxBPeWvlzpnbANCdQ1eSGTRybMuydgMggVBsKmtYoC6Mt8znZxsZMLzAxoAOvsh+ydDqtXx4FIDl8L/omQ7A0QqA82S/ERdTI22mNfaTuBIIxR4BhKe+y61punQC+MytI/Zz/c9EuvyBeetLAfGZ5WOMZ9j2/gqABB1fMLsHAVBqhfTcyH5d9MByEdzs+B50Z7voGZX+NzNSsd8cwUcG5ASRKYbdHRNYwhhDIHRgGmO0gFP+HJh15jOXjnyKblVT5Cbfoq+yJOszF8P8+VnNPlICkMAzds/YLxlYznrJwIpO6egTPMqA5ZNDAB6iCCYAyYBcBqTRQ0e4630SxZyQJQIvMJ8mSeLrYe+p/GzGfnTpEIBy6US/out+K1wg+brs88rHmDOgAVCMnrEfxxMte1Mt6j7u9zzKgIXzczEBOJIB0BnCJoqgIfDEhM58SWzJEPGJe9hfVH42un/Mfxl9bgSiBySIBWnAJBDGEDAB8QWFA8wO3/a+wH4+rg4RLPYLul8tCI8CsJmJMQAOuwFC9qMI9g9Z0CxhZz65K0wfFBPqu7PEyVdWAOTHVlTcpxhXHZLz1w0ZA6EDLhkCskRf0sw4dRYC0PQ/vVSRAYPo7QCdj7GqVOSMeBSAzUzMxZcDMwLgcKX/zbv45SQlHXDIgagJc+bjZBqAWhUoH/Y+B2D0J7rFa6LYDRmzomsAaOeKqxEvbWacHQB08JkRIteSXiSBLYJOLB+X4xrzAzY7vgfd2S4RAKkDDgPzNEAIxMASSWF38WsgkuXLyXTRSRCe/DduSZMBMwe6ObTd8JBj24Aot07uDObPP9XsIzUGFPs5+JJ/M6oT4buxHv9X7BeY8KgOWDg/Z58GTC9Xq5FxTXOw9c3Cm6k5fPcjgbHbgAlvVG2tH1T3Oavoq6BlniZ+12n5u/2sDbOvasqoFg8x2Lnbcd1GdhSAhXN+7qMrAC4sA8sORJ6yHwD28z+Ft4fdv8UyqUDrDmCEBcpZ39kLS6aq9l4D2rLb/KYsFTPWdfbvh86vQu2s1K/K+zIjTsXIVQ9a59Egs4Y6sZfIA/EcSp/jEXv8BWcAhxaA+SVgSQAkGAMICcwVlNLlqTc9Gbv/HAA7MrL4+f1VlXwrUq7SvCoyGcrrWpGhuur2fNGYwM8YT67hT3s1LaZvqn5MLM0bzmHMmIFSgdFNj/mIBct63NhFZwEzDsBFgpDPeanNgATfCtGsX9TIKwNrg9tuVkhlng7TI/YArX1VkXKrEe1l2SynN1RCsFJsqnQv3UIMxhwIRjU5AGN9QUteVz3BUAvahuNgjC3HxLAND7nBp/cgONXF5wCz8xUDGgCjKPbvevlzcKUHH2ag6cnYzepYBB9Zi2FxDJdjoXJv1WDFiLJ6MKqKZUzoQFTfj2HmwTKcTpVWvcxHKm6kKgoORAEvVclPD6NdzLXpMT8IYNPcLV7yJGB2AVhYrAC4SNA5AxKM9ryDPE5fs6eeVKWGZ2M3S3MQfEyJUKV8L1ZpJXpVJ9pLilmlAxWkVJHKwIhjjD9TtVXVm1HdOy/pJiaMFRWM+bo0rWl4yM1N7oPhTJecC8wRgAttBjQWdBBGESwgSiV0Pb9DRgu0TY19N+M1mRKh8niqFx3rRDsLqjgl9yaGXT80vcL1wnE252PAZCzAHQCoiqoW3yYWFIt664fUpKaREr1NPakH6XkuOQ+YDwy4FMSwgU8GSRSz0UJx3Vx/5vFNbrs/EiLRY+v4ACITww6iJEodQKwBIyBRv9vwhKzUW6z66TUGEwhDS3ezqusAyNxnJn8xa1KRPSFts9YfFB/QDZcAm78CnDBT5U8rCqjfc3yh8Gn/hGd/MsKf1+QzYJ4891Jye13iy1cAE9cDJ+6FpYrEkidxDN3OtXR+FwBGMezoMmxJLOumAuD4J4rxJrfdH/XCoLGFVKiUbw+LAPQqWWaMMLrd6/+JycSIm85w9lOpt1j1MwAwFTiqAWEUxeYH5ENn/jInUVHeMXQ/f/jRePvCa4DhTwLHfBc4frGqqaNJzLPw6iZxV+HTplFGvZrXZT45N39+HW3TujlZv8D6fp8HRq8Dts9XIOR5YtakgBgdrrrt5Qsq8Ssd0BhQ4HMwmVitAWHAY/LbLDQNQDaTVJ8Q6W4qVB51OOqDZDPVB3TLOBepW5jmqaLbec3jGgBGMSxvvemDYkQ9GoKF1ShUCSKCqBeQrvmfVZPC1keBjXcCmw911tTJ8q5XgOLaQgA+x/OdWA2EGZ98gbjleTHdQHQN+2iwls3nK3/Zhj3VeQhovYzdxmArSwQgDRA3QiSCJUrTnjfl4KozRCSCCeYmt90EoJJbVCk/1+FiCwFZxLk4dRfLFia6x8LbYkD9v9cXtLG6+O4AYQRfrgPygVIcqyhTXcWFOJH8fh3rz7EKwnUArq8mcGwK2MCC1i7WY7Zenh56feHT/jE3yliE4TZncd636gPFCKWavGhcRx2J+cvs9MlSw0Ty3cCm+c7n0G0MExdW4BMIbTXE9UCynvyCCX+Ovm4gbByA/xisVgJPpXrzLj4EoRJjJIZrWHArS9iprK+KcefgiyB0XVKGjOmCmW9xhRVMUSyRFnNeFGEdI2q+/HFXclkp9WsAbgTG9wGj08CI64WxRk/OTDcUAvBHXSLQxcVCDMQSWbzv+1e7WVbz+k5w2tJtsbcCYV6WJY7hmAsDA7r1Sz3OgOgoM+KTOJbcjSI5yGIaNE1uuwlAAU/MF+tF5/0sIghVLdVdM2S0bSzHx2Mi+FTxXf8X925NC4BycK8QwfmgVX1LlcFiykEMcL2BndJJ7aQfijKfxLGDwAhByM7aC5U4qwPzNwufNnNuOH4VZaCPlPo2AahqFqoPVFc14ga2m+WEEL0cAz9kdPrOmMu8r1o/rTsXz7f9oswFs+jO6LAqkvC3Ggg5Fg6mwW03CUI6X12h8lyfcz3QHqr3DIl64DbqaQKc9mI87QXACD6vpJqY0EVxz2CEyCI5eMSGX2e7VtI5J4yTRyZhscrvt1nQuivOAaNLlYESwcySgiVbr37Bfd0/u31yEgg2FVaiPCeVOguqAfGov0iR0R9JABJ0bnwk9nMxw+fOh55EbgRhzozrBUA1polN9CLwok5HEEUQBjFMQB7D+j656PW+IrJ8O/bBCo4sGFdGejqiyYCx3mKe9/JtTiBvmI5OFiTisg9LtJFF7gZGDrUbHKs79+hyu5hSaUvh1foFr3r/6vZJCiXgCDwVVFJ7MVmRLsrGltuFCc68yFdACMDAflwR4QM3HPoKgIExt4gz42SuaQb8hBOE2oZmlu+KFlKR3QSssMJxDPWbbjpfLoJrxG8CYT8MKGZSVTCxYFTIb84nkCxCIPLDiby30gXFghaF4c2ReR466Uu2fvoFr3r/fKAEFxvpqMcd9yonIrkuK5LLV7MVCM+/uDJCyIC2J8a0z1iwqyESgMl15Sa33QKgmtPEBnp11mwuXgO70Ud4DHWzfgDYC3zBEOk7HlA6XKyHQzb8HgGoCSQLqsxorIy1Bxie7Wx0rFaf+wr9Xv32C+56/7HbJ5VHtRYT+GJrsehHcya57PyKAQk6+vBkBZPpjPEExlwU59awg3C24W6KBsC6tqHR+MidyVG3i3rdAnAsH2T093XT+zLr197MTA80h3SfsZP2UqpCrPQ46oF317VrpeiKXTJ9MhMLkgGdCacKG/mupV9w1/vnwyGgCDCKWzJe3lqsyzLWZWe6/kc/oKzgKH4jC7oolhdC4jiuzM0WPo+cPQ2AsX1obFCTO5Jzn566PwbReiwnfTWjI4KvDoh1juh+aT+WKSYD3i8Aql2rJk+VsVQly5kkddv2FvHT61icqO7Fr71/IkLNXOi0FQjV0046oBy6wZ922Q95ICqDEaL4XWw3COcf9Mw73DFB9AqE6wZAAS8XuzGQIDKf+oVkqxt00ttAc+YT0PJ9qRFSB8xoye5Xu1ZVeCSgCLbYLVNswoncHxoeLwCzBGjBNki/4BX3z9lXgUCyIIGmhova83cRgO5Te9yLgP3MfmsBS8xs8/U67ePQOqy9umBUruDchqo8sHSd3PMfT5ifo+ack8eFHI6QEcnT5GvdOnVdXof+ptJ+BVPWceiaRHA8Us/nkACo8mzqlqmWrbFDppT5A5UIZm7CPA2Vgm3QfsEd909kKIqB1qJAKCBG8ZstZz3xHOAAiwmpDIdng1maZQAkZzsHZ537YfQrwNyxoQ+HakrnS0h1mUA1C96TdJTmORyhC3oeqdwROi+GDhkFI6bYNrcNDEDeAkXwQizPRpmnIs3OdqZPSaRFUcbchHlgie6agq2kX7Dd/+d8lUJVXuUzk8ERmS+2vfd4uvN2VOV5rSwb0y3JhgIh9wJeN3YMQCIgR78Q+nDEVYBYZUrUpbXFnM7COSdf7N4IPvtDnT2BY/h8Chh10MXQeYGS+7GGjaQiABpuNIFiECnzdWJMIUHcazLptC7YivsF8/7FgLFMqpiQL5TuNbKfA/DC46rqqAbAwIKWK+timRUBEiNGsOQsyQm+Gpjd4n046hbT84KPuYjOmHHyp92gcgDS2OoIuVIeh/xyUkaVwyEWdLrewHE3uBUDcKIwnq40HpDXL+n3CzbaKdguel5VnFJl2awaghLQBTzteZ0cjLq2A2n0M6EPh2pC57Wg41poLzZsAZNso0Hw6eVR/J8bF9YjWGmVCpGKwQLBRCcrbiSxNLgVAxCF8XSl8YDHHFPW7xeFBRwv/rGqOKUBkODzqgdWPYAM53vTASMQu4Bx9J+69OHIF+N71F1O1gUB+AsBfFqKC+4Wi4BWX+CYgOTAU36wdMVNVKka3MoBWBhPxyiuko3xkSX9fvGMkqsDlzzHC1N6SQ4DoINOe7KelWWTheziObeKCdARApD1AdVnRH048gKUAmAEYi6Oh4DJV4VoGDWqjq4XLbO5o1jBoimEPhPJmwu9FvnTLgdgYTwd2wyXbMyRKen3i2eXXB245FlVYUpVxUpGiLtmGBlrTEhVUwV8dEkVKAq3MHJ1uzRbRx+OOgDWFX6MsXJU/36lJoEoA2AKvw8+uwTEDIBbStdOs8ddDsDCeDom7ZdszBIs6fcL9ror2C75US9IxJJsEsHdGFBil4yYuUwknofJgF4XcEUfjrz+X7fKo4EJJ//PkMORO6FrVjQMeL5kJhZMMXzLwNZCt1nzDFgYT8cQwpLt4hDON0i/X7ys5OrAJVe0S/ISgFY7j9ZvnQ7I3+lyqpYaL98CWp/N+nDkZdhi6bW8An1kP3fRTLKVWlwF6RZCH2L4zDDR0k1IqeTNb2OQSYNbOQMWxtMxeqtkY6I+ny9VEz6btfb7xc+XXB249AoXv85+tIBVgJJ6n4lf6oV+mfjdDJNMH0wAVFX90GMk1f5TxlS3Fggh92DyN0IORy5665KIfCktsl+K3VsGtpVOWOMiuDCerlSnjQ2rB+n3C+pIBdulz8wqonrNPLKgwKaC5B3s53qhXVq6oDNg6sOhqvqhEr3V2VNLBjmnSSNdrOLJ1zkAu6VPRjFcFz4fXDJ8i45hG94Gt3IGjOFYA8TTlQZ/qGH1oP1+8ZtlT1MAtHK8mQg25zOZUSCLIliWcbw8wfW5Ln04ssqnHX04euiCk6/3de66MPpuAQVZAEFkw2MKFw6a1wEL4+lSBvmAOMhD8vkOkFX77feLNw14YT/ssmc4A6oOdHBEkwXlgjH2k4Nal6wB4fIuX9LzZjAmorNeHMo5Tc0OewHwDTUh9HXxfGJsYkAbAAAgAElEQVS/uvCpoAcew6zBBrdyBlQwwoDxdLZWXLDFkHyF8xGE/fb7xR8XXByAAVC1oB18HQYIT+8uGfP75SCUs1o64he8v4j6cIQ+IqkPhxrBCHjdjBH6AblQkAeY1ondukSiELmsUPpjbyp7XuvDgAXxdNZVvWCLIfmKg6Bbhrjup98v3lVwcQLw8gqA5v9zC9jErutltg8gMxDWWMBaMVkmANWFyEV6R0uH2I1IzW7ypbkQOTP5f2ch9KsFkwp0kQlDAOmxzHpscGuGAQvi6VD4RgmAg/b7xZVlT5MATNXwqQc6KGwf2U2uGV2uzg3D4ua7fDnPwZcKgIdq9GaIBPZb0YdD7hgyIFWMXiH0eQ5vXS5HcMkc++9lz2t9GLAgns7KxxZsCkgdtN8vWD+vYDMAUpcja7lOR9eLVcIP4tcuob/3AOHCdW02VTX62ApB4Mv1v24gnPy9HiH03fJ366KYHYTHsgBBg1s5AxbG0+HLZaOp65i+ln6/YM5EwdYBwGj1cmUkE7+8THLNdAHhwrUOXtcrO/pwhF4cct2oN68BMDCfmsJM/n6PEPoYPp8bH3kCkbtjji2tJJA962YAWBBPZ0WBCrbYsFoOf9pDAiENk179fkuvf9nTXewKcBSjsn7ldonWbgQpx+26otaLIwAlfi2QQSJY3Yjy5i9dmsFM/oEDMM/Z7Uf0RiYUA7J+ToNbOQC3e0WBBm9qLad6HICG1ZK1XB5PoxnuOOIcxSXe/Of8xHV/P+FpwN47gKUpYHmuSve0pKZgCKSq5wqniWE1WZz/xouBm74KTMwBI17lVBXwtWSs+8/vL45Ff3vhpcAnvwos8d48DZX3M2hx9XIAnu0IIO0chu35AOgLL0yuG/jOmwbg028G/mNz1YWdETbm4I5BrFlov+EtD2wIo7l+Atg8D2xY7iw3V5diEqO54mnj6XdMAYcU+6gon7A3NSO2qFjlyZYDkAX6uD5Iam44YaUfVNDNxaJcLIPXcGGpfi6PnZdVD1wPspQBX/wl4OaNwN6Jqg+xwrxslcVFuYJblehkcYYZGPS3L20BxueBcS8nwg5H5kZkx6TQSbXFZcCQKadx5Cz5mPurAFxrRaa17pAR2PFC+ElSHKQ/0QjQcgCyGyM9v3SnsDBRJgL6msWCf6IfWeUJac8UFlpY8500DcCfvgb43hiwZwyYVhd2D/VSrKGAmIDnBkiafEcN9cprHgKMzgNjS1V7rRjRlceyrqif6KAkMgXIM+6tAnDl+zSL36O9+U8p9jGHQo285/2XA/AnXeNnKAorDXH/AILwbSvLEz6Ql2+cAf/3XcCdw8DkKHBwpOpFbE2wadzIdyh3jjNQirYWEwYq+/zJwMh8pf+xKNSwM6DZMmzNRRbM2K+2Ii6TlFrAWfd5V3i/F7IgT2LBF5LbIdkqxLPWvtzlAGQ3RpU3Y7AiixMxLOUB2t7pKQ8M0qCTnp8HkojJgNqaMEJesQv4AR3Iw8DB4QqAs+6SWRiqgJgY0HVDAdBA4Ba4xN7ndlSFAAjAYX4IPO5dBDMAdS2i+Jx7XTf1eEdTDfgAQnR34p/wQkRmjNAoByDT/ugFphXAmjAEn8qaPQAgZCs0lSckCNmVigEbFMsPBBE3DcBX7gLuawH7hoAD7EM8DMw48AhATrjtQwiXoqkTEwWd7LOneXNCbz6Tiq/TInb2M8ZzIFrTQbGiy92oGz7pXl/7jvdAJnb2470IbB3T77Sai+hyAP5voTqW6sKwFAc/TAdc5+3dvcsTrvPVYSK4SQb8xV3+6IaAqSHg0FDVh3iOIFTIFxtit9orL5Z/LD1Q4s+B8OnHVuXwhhdd5DoLGsgCCJ04q66X/Ju/vSaeAxDPvbdtmdtKDV90gVEPIl/xySkviOhmAEjrlzSkwj40SlQZYZ39I+8JBMx8mZryhOsKwqYB+KpdVSDFvhYwPVR9BD7uyX4SwRS59nNI+bRck/DzJ05v12M0nY8fAk8iWL5BB5qASPGRCi8EVjzv3mqpkC9ACrrwhKukB67GhpqRRowQMqCiYbj8oOoHeUWpdYIBAUj8c8WjrjyhNIJ1unzjDPjqXdUjJAAP8TMEzLYq9uOHICQALe/EwWe+QgddAqCzzD8+vgIgg0qp+5nYjaDzCgjmnCYone0klqP4JSgvvK+6LoFPoFMlkPGh+0rPWta4RHTNJJQz4M8EAGoNTPVU8opS64CC9zoAWTFChcq7lCdch6s3L4J/2QFIEBKA1P9mHIBmhPh3Ai354RyAAmWsR/PRs6vOR8Z8FMPS97yxtIlYgVB/I7jC0rIKSfLXF1EEB+BFFjQ3jCLA49OWsRTTEPzvzQEwry7VrZ5KwzAQAPssT9jw1dcHgCrORQCS/bgn+1HsCYQSveaHkzvGv1scgU/6R55Y1YIxhvOm1EZekQWl8wVDxJgwc88QiJc6AKX/meHDawX9z16M/Em7bO8Q08GBP/jEkAEVjMBoAFWXUjRA3KtNwOBXW3EkAZhrALktpC6lKtTV4OU7RHB+3kHWgv/zrnYZl2kCkF4uF8MGQGc+MqEYUCA0n1tkwxbw4ScHAHr71Q7W4++c8czwcBAmHVB/c7Bcek9b3FuwbdD/kjGWgzJjQ3thGmVA3jhfOyU+RxB6FamOFp8NrhsTgLy8Cpzm5QlVptAU+6CiNgXCaIQ0BcDYV8b0P4pi30vfIxD5+w72C9aliegW8MHzqrmh/meuFhYi0pKbs6D9fsh/n1XFMrYMbPgUByCZz6J+uEknDA9AornWFRb01WZEsACoHhOqyC7wdetT0QAK2KqOb5MCUvPyhLE0oQxzqaYNXL5xBvyVXe12vByLADjXAvgxBvSPGFGMIjCmJbEW8HfntxtQmxT0cmxp9UPAdKAZ1upA6EB7qgDo6oCUxXRtPVSpAwJpnUhuxAqWCCYK1MBExZljY5S8SYr+pxAFAuBayhNG26jw8usCQLX0SAAkwwcAEngyQizaXoziIli+Oe7/9kJvNk1LmBMe9ECO3XRB7aPeF0EYHNVPdT8gj016YBcWtBfBVYJuz7mF7VgGY/pO8f5WdQ1/7U67nIKNS7j0wIbDPFZsyNHHY7od/xdlEHj8CcC3TgCWHgGAPSxiSdt4312u/8SPAl8/Dlh4pDeZW2PD4J1c9+uyDaIDkgEJQKnTfG/N8nUAmu5HUnMW5ARbPfEuIHy/ACjRK7FL5pOR4RaxgTHofKl8r/S1ZWBnAGDKefbn3AFIPRPXB7sFiVQimKVgGdl5ooNwLQ1/1U+DQGSXQ9r5Evy1q9rZbP1lGQDZsPpzI8APHgXgod7qUx11YtBbFzC+/C+BL7SAWwhgdoLkONSLqy5oLogYft3ZI1F7EAC+phsAnekokhP4HIzml/PvthQWmPB9LJ7jxkcSr14jWj4/0wFlgJD5eoDw6fe4DzAYPHokWhHJZ3TFSkn4h7YOSOBwEtiMTv1aY0uktFYTmI2/43EMQmCuAJmUE0gmVD8EFdPpdnxhVhqzDr8F4NMtYM9Jfg98EVTeNu9Q2OFZBX7vr9vtgm/lcezczZ61ZNN8DCvilYCdPXqNDQpAlfGTKm0M6AA0PTAyoMSx64cRfPQHXsniOTI+fEWDFGp+Qb9BeySRBV2kpl0QxxGAlHDmkI56X6z+EP7UDYSdRgh/IouwIZ36lHabBE0GJ0r10Rgb/xA/tt/j/6aMAf+7R4CxzuBXWRGULwBfIrY6UNfpvLae7n0I+LO/reoLMqiVMbW38oUhkNkQIzZO7tIweGePcmWlAFTjAYHPVGwXxWoLYblEDkLuTT8MDPhXLJ4jALpaJB+ggU6xfgJknT7IKXIQXh4Y0FZCog+wxiUTwSkXUbSMV1rB/A31OXWuFpPUda/mRHKi1e6U+hA7Zq7l+A+UAfDtHg/LrptkQpZ727cRWOL9542Pa3rOvuOqagUltgtmJM08j4/PILbIDKz6w5PAHsbraTnMGdZWIwIzxIfeK0rn578J3LAVuH8CODRahV/FFQ/1IumIvXP1QudNfyNT8oVqcHviPcBd48A0g2RDuoDqHdb2SalZAdG9dnfDkAE0gXnH5ijWCDbKCq5/MRiV0QD8HgHQ63jG0hdsLGxA3x9Bw1Asli7hO3BwApgng/Gjvq01IHrXJ7q3Cz7E++YziF2rs1ZLZ+8H9jJsSoECWXj6igmR87aLgfbGq4GvbgLu2gjsHwdmCEIPSI1h+SkCRjpfUC3iNWcpoRrcnrYbuGsUOMBo7QBCxSTG/igxVcBIVGPWM1h1JYQPnyKNExGZMDIJ9b66eEBGxPDY1Y5nv+GCjfGAxD+DDpiawphABWZPjwNzNLAEIH4XCH0M7/5c93bBfI8Yk2cgVAdvdT10ifDkBWC/r9lGH51NhIsnsWHOfPmEUKT94WeAG8eAO8aAfWPAwVEHISNQlKQUglJjJExqC+H6Nq93kOpUg9szbwLuHa66QzFWkaFieXxi6hgVHOMCYGRuJ+5V4jYJIDKI9KlsAvFDq8QDrnb8NWVPh9EwdFkQ79TlSMIsN0Mi5s9MoOGno4U6f3YAvefL7Y7rvdoFLxOANSA8f7xSgWmd0kCQbmZ6mTLEnJ0UqWLhUkxlrBn6n3wWuGkYuGukCsufGq2iojnRFpafsU7MDxErJuZhYCsJosHtWTcBe1oeq+hxigJgXBrMmTBPnJKLrr+VED54ibHYvZos8sO+DNcrHrDX8YVVyglAKud0LtMjFPtNMz6QLDY7VomLJd671AEH4Xu+3g7nWq28ISvX58/hguOBg8vtFQvV/hEzxfqOevuTfpjri8vAWz8L3NYCfjBc6ZYHmBcitnFd06pxyb8W4gPlgonBqffTtdTg9pybqiVNBssyUsdUD7eGO9amnf3sXtxQipl7Wg/sD4A8AwHIyZMYky50Tp/xgN2OL8y051qw2hXzwRCEdT2nmck1RxHG+w5jeO9NFQBpR6ldMIMXlFWgVndqF2dVFsJzuOgRwMElB6DcI6rznemD0RnbwQiSRS3g7Z+tVIl7PC9kahiYZm6IizuLigliT/VoUog+p8P9l3wJ7qGEanB77k3VczroUToWLCsABud4ypaLCUoxf9i/9w9ADiICULrQRWuIB6w7nuZrwaZwLBGwClSqSyz3AhHbaRGEFGOmC44D72UVgjW2C2Z4lIF4ArjodODQcqUGqAxfcpG4mJVuVqcL5tbs2z/veV0tYK/nhTAqesYNHdO5PCJZos+WuzxHJIViuXFyJxupNLg976ZK2lizUKodilGUgzyGhokF8yw5Mf+qRkjdjfuDtwkkm7DTkNaBaQ2ox1q3eMD8+B6O3H6em8Kx1Ccx9ptWl9iYIUAAWrI3I3nHgPdOtsO5eOuxXXBdj0V1vOL/so3Cxef60tlSpYwveKf0pAu6ohfdJ8k4CUqgvr5jV6VGTBKALeCAh+VbZLTnh5gu6D44A6H8cVlkNK95O1WkBrfn31R5HSy+JCwPplAxRegE/2T+AloGncNmbQyogUQx/KwB4gHj8YWNTwRAOW0FIIIndoqNkTAxz/bd09XDGLBdMM6/pLKi5whAX60gCK2ujxzEAqGL2pQ1Jis5AJEAFHvTujYAKjRf+SEugm1d2COQLU/DAwQ44caEw8AtZzSIPgAvuKkdrWMM6M7xCMBoiBn4YpCE2NCfxWAA5MEuwvCCEICwlnhAHV+YORfDsWJGgPpMKwg1b9QpFnzHbD2BK2JGul9s8KkYW17vLALQRTCBpzXZpS4gtCXXMAkduuAy8E7PijPWprXJ5CR38ygw1fJDohh2BlRAgq2OeN7uTWc1D0AFNtmL54ESBsCaJcLkDajxj5ZXRiCIGA0waDwgjy8sk5+HY+X9ppUbJSCp6TnFCMXwny1WAFQ8rUAc2wUrRL6mXTAefWnFfnz3FpbagQKLAqAzoZjAKkkpXkNO5GCEvOMLFXOnnC4xIKOjnQGNdWSM+GqHQGd7JSsxUf+JzQLwhTdV4je1nQvr1MkPGtlf9yP2Dy+gAqZ6rQytfvdHSDxgLwBF8AmAYjHWluEDiKGMiqOVvtejXTBOuRSYJwDJAARgZAGWL9Nk+IM3SzgTydE4eec1nZHbtDaNAf1Dpd/SMx2END6kD0oXtFhBXmcY+OY6AFChnKnzl7NfdMR3qCAae2B+VVMYXASvDs3/X/zHJZcB84vuiqABEo0QPnhnwqQLyRURmZBPytnwHde0M1vN2lR6picoKULaxHDIEdHkW2iWg4/7b5zb7DSQAVd0/griV2JYojfpwRGEYsGBrOBmx/OgP5sAKANkcbFzNWTRnX/GSGImMYH/LYlk+gGvdT+bW+SWH+Ig1GqL5QeTtR2EYj5LVHfjw/ZDwL8yJ6TB7UU3VVoTjTYxYDK+Ivv7dzNAZIxpZSiU8jjKgIWTcykZkBawDBBnQdMr5QeTKI5iWCB09AmEb7+ucnOQ/aTPWn6wuzyS4u+R0Ob6CUGqJpIDA97AdqINbgRgBJ69CG4Jp6q/ckjXqB/RKla4WpkO2ODgHoynigA0JiLwaNiEt95YQKJ4FRC+7brKzRH9jZbN6iJYuSHm9I5iOAOhHNJfZkh+gxsBKPbLu3+JgaWDdojhMO5kkDWSlNTg4B6MpyIAjf3IggJgMD4MCARjFMU9QCgAykhSKnUCYHB9JB0wy5aTRUxmup4h+Q1uAmDs+hpXgFLnB6ULONOn5xACNJqxghsc3IPxVBGAiQG9aLeilWUJW1FvVXEN0TKp1C6At19TMSCBpz1dHtT/JH7N9yaxp6QkF73KBxYIr10nAMproB44qQGTj6sjUrtOFPtLeFQHLES9AdDFrq1E6M13MaxVCTNAXNFThIylLcor40zxtgDAPKuVwDMrOKw+SBTbtR2MND7sZwC7Qvm4wqHa4T/uIrhb+7n0EgbQdTijoyg+agWXT8llDsAFWr/B8qP1K7bT0pvtVwHhW6+t2C/m8svvZlawi2CKe37nhFtapkDnILRqBQA+v04AjMyn79EIkXO/DnzyCBwVweX4wxs9B4rRZgyPVFqykgDd+5JSpBU5r0vHyHz+jsc3ub0KABsZMCyQgeExKyFPVIz3lmcM6OfPAGCADYPE67Jfs6h7G0o+xvi7oyK4cLZfOgpsXwC2Lq9MwuuVERonKn4nSJrcXnQKcM7dwMMXgYcsVxkSebJgzOWPqdB1ad2f3gpsnwK2LXWeR9m3danUIV1lBSCPArBwtp+7DThuBti6UDWDmWA/DvXk8LRptfPtNUlihYZTOPCi04GH3wFsnwGOW6iAs5n3GeJJ+KLoE+9VDClQ8R6vOQHYegDYwuY3S6H/iJ8jb11ck0q9Qhoc9QMWgPBZJwFbpoFN88DGRWBiqQIgWyJY3lPozaGJ1KTEPh36zpTkJrcXPRE44S7g+Cng2DlgyyKwaclfFoIwvCwx9Zn3Q1DmIPx/2/sSaMuusszvjfXq1ZRUElJkKsBEGQyYhJCBSkUqAW1tsBdpuxEVaBzowXZqe1g90G2LotjQdmMjKqtBxQERdAWUAkUlZNBGkQRNyIAEMAkxpFKpqjfUG3t9//m/c/+737njPq9uVeqcte66b7jnnn32/s6///3v//++Tz0dmD0KzC4DM6vAFpd/0L3Gh6yTDgnvLwKzAWDGiH/ThcC2OWDrErB1pRgQisIQhAa+AED+HEEY6uNLyrRnZLSl6tSbrgLOeBQ44yiw8ziwfaV4UGbdegmA5QMTLFlqsfn7XecDW+eAmePAltXiXnkuZSBkRcm4UGXtU2uo3xsAZgz6y54JzMwDWzkgBOAqMMVBCSAUObh8QuN/CiTgcWAuyWhL1amvvBbY+VgxbW477paa7gIBqCnUrbUBiQuhAKDUot13IbBlDtiyBEyvtO5VDxvvVfxW/JkWNFrCeK8NAGsY7BsvKQC4hQCkJNaKy2LRIsg6SJ3IQSe1onKKC2CsOYMeN+0Dtj0ObDsGbFsEZmWp5S74g2Ir2uA22BScAJGA+dJFwPQ8ML0ETAUAkgDTPq9zdK/+sMWpPF19NxYwA4g3PtsHxAE4SQC6FdSgmGWRRIJLZJll8EGKjHiX1jwaN10HzD4BbD0GzC4WrsKMW2pNobZoCu6CLCDfCTqzgg6sr+wFphaAKQfgZHKvpRSYg7HN5XCL2AbAZwPrZGaj6ippXhgn0kqmU1woxnHedg5AATuWHig2FE1uVRwoxoX+Wcbg89S3AqCKPONcCi8oPtVP+9++G3j+oSK2xRBFDElUxbTS+3nvc4FpDsjxllXQoJg8FgdCQoGJJTTicLcQ6vPL6wbg9cDM4cJv27oAzFA5ky9/UOSvmg8oP86n0dICBn25JwjARWDSAUgBHN6vfdbv10AbARh8X91vDM2ss+NvAECKPVLCsHoyUgRqrlbnRwB933OBc+4DXrIC0IEmiLnE75di8HsyAcjzWUVGUi6uICMpVwwJVMXdeOk3XAxc+Hng+vV2esAYw+sWoP31r3eLcLwQBeQUrEHh4Jo2h4vDmJPuAyMLGAeEn7uqbgB+I7DlSWBGCwe31Gb9aL20kGDb/EGRxY6WTz8f2wtM8l4pgL1SgM8esHCvsuylME4nn9cfQLtldg6TZ0kUKorAfij23vAPCmqp3fcCl60XFINid1PlZrf41/dnApB6wSQjutUfIDJR8CGIQOwWEH7DywpKrWc8CFzqRLHkVYrB2jS2FQH5vkuBycXCAlIUUAAkCM2iRBA6+ARCe7DjYmQduLYTleiQ/XTTS4DpI+6nLhZW2nzVCEBaMLd+soIGqjD1ampdugiYWCpeBKA9bBJC9ActAk8LES26SqsftInLZ44dQif4Igdhym5WLrPDyuYH/7HTCNwDnPko8LXrBccjQaioe6BiKad3+QY/MGTH6rS3OBvCnQDuAIyqhiDkQ9RX+29yE3on8IwjxQPI8zkTiApGU3oVkD/4fGDieAuAdMw5MFQjEgg1DYsUku+a3uI0TGBfV7PotwHwaOEmbHEATvuDIutni6UAQoFRIFRYhfe/dhEw7tbe9Of0Si1g8HkrwRcevDajz07gIJ7n05rYyWIpb4ya/7vv8PRdFpj/LXDmkQLAnA4jCCOlTBRN/rFMAJKgkkVHpGUjySSBSFeg7/azqk8EgbSEq8UDRACLKDXSyaQ7Br//DcA4LSCtwnKhTEkQcmAIQhtM+Uaajl0uS9NatITXWzpzfcdNB4DpY+6nBgDaCtanYLN6fCj4u1ay0QIqtML/EYC61wSA9tAJeP6eWsAoDysFpg1eB0HIQRCIIkVeCqQf/05P3WCB+UPA+CPAzvmCaFWDKEuYcl1yMN+Y2dckqGTeHPEvvWDSNhOAfbefX0A6rS8CUw8X9066bFIfdqMHJID++DJgLACQumyc3gyAEYRRKFCLD1eu5ODLF6QvXedx0w3A1BwwxdAJLTXjd8seQnGrZ9bPFxLyA7WIKON63tYtCQBN/sv9QPm6BkLp0vl9t/m6ietR6fbyBA4gnXtORwRRpNnTtPpW6gWLH83lKqcOFTEnDiKtoHwy8RNFhrefyeztbnrBfbWfgttsP+kIyO32ELD1cHHvInrlvWs6TsnB7qAUlg/suFtAWkE55zYQ0QpqcALoNCXTEt7A3KoaDwGQfqoAOEUBa7fUbKctltwCajVbxvSiyvoasM0BaBKwwdKb9fN7NfcqBWGiSWykWXER0umeacUEonQgCKRfIgDFjya5yq8Wfsfs8dYgiuMxgpAg/vnMzu6mF0z6Zj5APdvPQec0TEosnvQosGOhaLuIYvnwEYSithE52F1XFAA0p5yigD4otCqygFKnpHUpLYP0OcKURYv6Mj4MNR433QhM0gL6QongawOg+6rl9CswKoSkEIxPyTsuAPigCYBmAXVfYcVf+n0SRYw6dP1YwNgHsgSajiJP429RrpWOM6cxDiJB6NINM4w7LbUGMQUwB/M9mZ3dSy+YVG0EoBiDBST5ddZ+PkCsAiIlQZDa3LVatJ0WXG2PbL98AB+4omB3oP/HgTUhmGgBfRqWf2TTrUSjExDSP/qWzQDgfAFAWyzR8rkFtDAKX75jo6nUguZxZ8NByHbvvqBQ36T1swcsBaBAGGRg40Ir+rt9WUDhQ5ZAU7Es2e9LLzglqHRxNkbeuW+oQRRls5jaMjnK0a9ecNf2R4LAwO829kQB3LTtEYQPUwzQAWgW0AGo8AQH0ljp/V17pm0KRcEifGuNOnocO1rACQbKPXhs8TtNwVr5uh+n6Zf3wDgu29g2FdMtOc8B6PdpFj08ZFrplw+ZA5FTvAQQ0/BT36FPDkRqBT9Jag7xYlQItY0f88j78sZzCcKPZlrAQfSCK9uvB4h577SCotUiEJ8opq8IQFl/PUBPEoBLxbRE62LSqG4dFB8r5bHcOtiOQSqT5T7RKzYDgJx+BUCCTxZQCwhaQc9oKcEnEBKknj5FsJ1LAPo9xoWWPWDy+6IIoqbeaO0VA+zHB0zxIQDKkn1GgtXiRxMIAx0Vn0Db+lkuFjLRCt5WEwD71Qvu2H5OfekD5FaciQay/GIbFgBXriwAyGmJADR1ck3DwTE3TQ4B0LetzBJErTYAr2BBSI3HTS8tLKBZPo/fWQDZp197Z3scjGb5BDp/L3+njMweB6B83Gj9wj3atOsPWin9WgXCFlVO/3ctf4iD8XkBkH5USlAZlNPZAQqARr5vxu1yjmH0givbX0UQKI63o0Wun/xHuR8E4VnPK5JQLd4VNttTBvK2uoiKOUf/f+GjwMNBh0NMV6J0c0NpcRv7mrYv3kh8/uHxYp+bVpwLp3R7sts2YzouSq3KGa+q7+x7Co4nazAerRKsVlV1QitF59dyyFZaYY0HMu9mWL3gtvZXMbymBIFMZ1ov2h0B+LTLisxgW+Eq5uU92iZ72ud9vvR+4JFp4NjkRh2ONi0OB1/UBCkvEYRhfuNs4OmhhiPKnFQlx6aAjMnSXJUAACAASURBVPjmz1w41nnwO4cCIBvBwZgTAOUHRq3gyDExD4zRGVYEnpm5LqmQc0M5esFt7acFl0SlHiBxuTkYxxdaihUC4QVXFu5FCUD5QtJl85sjGA0ziQxqeu/fem+hw0F2fLLQGxFlYMRvo7v1WmIVtpt1DFkXvOR7LwJ2HSkyoZmEypoVVe8p7b6qEMnidGG/Vl/L2aPOIwuA1pAIQE3DAmFa4j9f7CPaFpCHKujr5xzZesGdHqAqKz5X+FLRAl58le+jui+kTBALMcgZ73CDBkpN2/7+bfcWOhwUyCEAjQTcAVhKdjkPc2RajewKyu/n1//qJcA2uhBMRGXQOcn9U6JIOjXHQqSYOsVoQp1HNgAvz8yny80H5PVz9H6RqVd849WtXQ/zA0Ow2ayGLJ474L0G79vvbulwkJi8BGCg4S01SKqofoNvSIC+5zkhFUupV8rUTpJN06KpaBkFQm5M1HlkA3AyM5/u9Zl38zrk6f0iU6/4hmscgK5ISUtCTowyDqb7UxwsqFJW3fo/vbuIBJEZ1YRgyHwQKNi0KEl1OKTCZJdxtPDn//v8ooaDaVgqFyiTD2IKfcjZS4Fo+7g+HXOPv84jG4DIzKfLzQf8KVfI/FNKrQ6h94tfz+vOA9cGAAbrpylY2SDlVTTt+uCnV3/V3a7DQQAysJAwobZJgUXi78Qayhd812WeiOAZzEyUiAkHMeu5BF5FwZQAWLPwknkLQy9CrPMy8+lIHZFzvN3T+YbV+8X7c64OHHix74V6zIxB+RJ0wQ+UU992tYoFy3fcXcTDxQkoPsCUhFIczKVCegSg5B8A/PILN9ZwxBSxtiKiUAOi7JW0dLTustF8AGbm0/1o3vjjnSGdj+lYlGwdRO8XN+c1wABIoHk6k61yuSCJITq3jDY9Vx0BqK++uwAfX6JkI/hME0SC1EGguiQ+isqcQRLrF6/0jO2w+6FMnZhyZYsQ1W50qOHgPX1NXndtODsfgMwHzMin+0+ZN0S9YOllMzWfLwKQSS396P3iY3kNOLDPM1y065H4gOW3p4uTDkB8zWdb7FgbdDhEgJkCUDRvogTmd/vPv3BVAUBuvylNzAAYi4hisVQnEHoIqWblrxqm4Mx8ujfljT+YjsWBYgIOc0oJPsq1slCpH71fKybJOEoAuuVTRSCnYlmU6P/Z4iSJEcbLv+Yu9/1EAh7JKEXDKxq4ChUiKymRbwjgHdcUWTARgLYXHSr2LOU+BV7MVwzxwOfkOWybYAGZD5iRT0edjpxD6VhcOQ6j94tP51wdOHBdMeXa9OqWRcmWXA1XLUIUH6zyCwlAs3z+YBkfs1u+VIejJEF3ckrjI9T0y/aMA2+/tgAg08VURKT8vbKMUgAMIGzzAcOi5HknHQAz8+l+MW/829KxhtH7tTz+jIMAJPCYMULAWd6fvi+EY9ouoZBM/Kx/4LUBgFLgNC5o16FrE8JJVJgkiFhaQQBv3+dVbMrWVsC8UxFRkjjaVsW2DtRdOJ/vAyohVYK7A+bTvTdj8HlqTMcaRu/XxHkzjgNkIOWuDr8jnYYDKDutgpUhra0uAlAyCCUAK8BXcjBXgLCk/h0D/hcByDxFAdAzoFUqUBYRJTUcMWdPP7ONL6i5bLQeALJRQ+bT/W7G4AuAOXq/lsGdcRgAY+glLkYclJVTsa6ptCX3uQjAKINQstFrAZKIwWxQIhIJuovB/Nx+r2LzFCwlj8Y0evl/MYk0kieVtcvrwGUnHQCVjjVkPl3mItQsIPuElx9G79dOzDgMgGkAWlNyBJn8xKprBRC+zgEo4LWRgcdVcOCjjlNvmx84DrzNAahaFZWLygKWxUNibIhTcPD9BMLLa65bzreAMSGVoXvJ/Cgh1WUfO+XTZS5CDYDs9GH1fnOrIDcAkABTTDCCLYK0Cwi/586WcKJUiEpC8CCBYDsiiSplqUIUmOjf+o2tIiKVUJbgU5uSWl4DWwX4+PcXnrQATBNS+8yny1yEopdcay+930y5YhgAg+9n2OoUeI5TdQer+32fdhmGoOBZanBo+g1yEKU4dYgFSvqB//vZBIBt9RshkTbW8ZZZ2hUgvDL3iU3uux4LSBM0ZD7dPRnTH08VAIfV+2XAOucQAMuVcKfFSD/+IAABsEoGwYAoHZIKEEYxRIHwLS8pUuhjFVs6/ZZhIVWyxVKBBIRXnbQATBNS+8ynI4tBzkEACv+chlUVIKE/5cRGsWmlKfIzudc3APLQSlg3E2OCyVRc1kpU3DgBmKoQsWtlBcswjPu+nfTYtBL+GQdgOf16GCZW6pXlBCqWSgqJypoOAFfXXDifbwFJLvi5HAjlnUsiIe6AjOp4iQNQHRlT2PlgJCUbbc2s+v/hFwFb/q7gm6HlYpBbmTV2sscQyy/qFBj2v0/cAdz/HGD7NDA1AUyOOU+1CwWOewNjKj6/O03F1/WuugW4/XJgfBoYmwDGdH7IxB5kLPIB+I8AfNwZgga5ck2fJbEm8V9zNWPfrasbgMuPAcuseJ8Exsb9FdBhA+7gaQNKB6TfcgCYug+YJT+g89aoBDMmIMScP12uTKj13uDv8zsKig/uJ1uQOsnojm3qB5P5ACRBH3OhPuzzRN9DV88HqQLEWPJnvTy5nm/t/1s4BcuSpRZtGAu4fi+wtBVYEyccrYwn6hF8/FkJp9bKxAKVFsn/d8urgbHPA9NPOEOWl4+2cfoFHhfVrJTZPKHSj5daOtup6JyCpPx8rHWRVQ7WOlrYCMx8AHIzlxkALPD9c0VB+x/A3E/+E2fUYHXdF7KTGwdvTd0AHP9r4PgWYG0KWBdfsBdsMPfPrKKsoL9XAVLAvO2fFylCE4cKliyrDVZNcGS1CqEYhWFiAZV+XntaURdTLmpCEbpchTYLqi6NrkMCzLzt5Xc4HwyJmmkJ+Z73jQOh4NWeDUZiK1K08f0EXt7CMHVawIk7gaVpYJUA9LI1Ao8bzKX1cytoFtFfpdCIWz7rgzHgth8u0oPGDwETc8CEMySUzFaikgtlpW1Ta8JqNba7lVljSRgW+Q6ZP/57WQvj6fydBjXfAjKbgEvMLwWCvhNoipgNpnQshlS4IGFWzIk6ylWwAz93ETLxGWB5ClidLABoIOS7pmGfG+33YAG5mND0G8F4678vkiPJczNOAC4UyQm2N8w94kirFlfIAl7i402d6dbPWWAtrsjOFiuCvAJZOQE0pHTFsckHYDeCvhNgipQNxoAz8/8IPr5nbvH2jd+6AThJAE4AqwTdZKEBLDoDgU4+YVkPHIBoPwareOt/BkDexsMFAFnbzNJYm0IDnVwbt4uyur1kwL7Tp+iZM/08WT9Rc7DHUmuYTr/x+6o4ovvu9fjBbgR9JyA+omwwxvZI5ULg6ZW7y9FPf9QNwKm/CgCcKABovh8ByVy/UCtJq2f+X1yYJPGU27lIZLbuEWDsWBHesZeDz4iURLUWa1TE47LqK12fZmd3OXidFctqm92KatVs1jAEsNv6sdymaa2g8+xUL4I+Pn2beCgbLGWHI/h8G3oTr45iK86POlbBU9yKI/AcfLR+ouQwH9BfmmbLlTHboOnZ/T9+5vaf8FUaAThXsFOQ45mUcgZCWTAxe0UQ+urYMO1/37GtxQmoLCBtRSp30LrDp2SFdzYMgk/R+VNwvwR9mwQDsaspGSfJgYDYNTbp8psCQFJxEIBkQjDrxt8dXCUIY+COH5MVFPi8SOn2n/QYLZ9Gp0cxANIP5IvAkzVzxivRydnKNzBa8fddM84b6AFyAriMF2pajk9kYIeoClXmA3AQgr5NQEHMBqMVFMNaIOayNRL/vhlH3RZwmhbQQUcAasrVVGz4EtjCu/3dfb/ID3PbT7uKAZ/MhcIC0vqRTo4W0IBIEAmEtFwCYqjW03bcmdwBYeoWgetUbrR8snrloiR2drpACf+rD4D9EvTVjIJu7HBV+781X752Czj9lwUZkTEgcPoNPp5Nv4oBRhCG6dd+1DkMz1JIhR1BAHJ7zwqO3fIRRM5tmDK5CoQKsSgOeBYBKFZULTqcB9r6Ni5KYmd3WKDUA0BlhNLM8EbT1QBXBU72aI5ZjUcVOxz7WLkQ8d37vsart/uA6RcPsxNSAtAXHDYNC1AEpf9s01kKwuBwGU7HgVt/1jtD1e60fgQigSe/j5bQp+KYpGB+H62jT7P8/ZypBIC8Dhcx8eY9wF015abhmnoAyJ5WSrKeNgKO9SHxnT/LSasJBim5lRjWBEIVeROInKL1qunybRawLgASdEy74qjaNNzJCgqEEYzBGvK0297mAFSHEIB6ebKDgc8J1ksmV8t29f1en6L5v6cxIK5iK6Xne/5jCTiFcTqVn/r/tWDPWwXnEPTVgIKUHU7ljASawKefIwDpMdRxRB+wFgD+RREDJABpwSzz2c0LfxczVjkVKwaYgtBBezu3SvX08d39P5uO3QKahXMQciourZRAGKZWar/YZ1xXRPe8wQr2AUK7TvbOVTZBXx4MBECRnConUBSFEXT6mf/TK+/qmzAF/0UBOPqBZYF52HrTFCw2LH5G8UCzJEko5nZqmRnPh/uCXmpnVpDTsIPPwKApOaSA2QLDLSHf97iPx0tpISLfz7bl4iFfsUsnj+HZWEeOYDCDnDmCvZkEgedcCjxGseIhBYt3vx049HwMLRh8gA9gh2MoH9ABqKJzxf0McO7XlSAU4HzhYYFq+5D7hwBu/98OQLlIBCKnW39SlXNY+nqeiq2dkQg+gnGPb9/ZpT0lq6MV5D96gLCwgDmCwbdnCvZmCgY/dxy47xxg5SWuUjigYPHFbwA+fyGwfr2rXrMvPB+vp3L3GHCgi9JOHQCkRVPppeUBigXLFymyejYTB4YsgfA20ofRAlYB0FfAlvQqP0/TsX5PLOB5DNu471cmIwiBaRww/F01J+mz2pqChxUMZvpJlmBv3iTocsW4dzewfhkGFix+2febXDAeJO/YEILBB7pU1g8LQFo98QASVGYNQ6DZfEG3fnEqrgLhbf/HV15anbkFNCvohWSl9XPQ2XTM/2s3I4DwPIZwBEDfgitH0Ek6N6x+u/iD7T4g/YdBBYPpWHEaHlqwNw+AQa4Yj54JrJO+aQDB4pt+oCAyYvOPEIQDCgYfeF/9U3AbAMX7ItAlVtAspKZdz5SOlvA2pstxjES3wJ+92NgAGK2gwi78QoVfEhBeQACqNNP1RdoA18kKdgDhxkUI/zKIYDCnqyzB3jwAJnLFOEIW7QEEi1/1Y21ywVglCAcQDD5/Efj7M4CVrZ5AKlkhxeQUaxBI4nvFzxf8IfCVC4HV7cC6ZEX5nen3VX1vAGLZq8ysrvHY+QBwbGfI2E6JpLvdX+ksthpUvQrmX/sVDGZVUJZgb17vJHLFeGQcmCdVb5+Cxd/5xjZ6QzzMLOQBBIOfTV2Ps4HFHQ7CLQUQmUrV0rgKJMsCjsxGAqTn/hzw0EXA4tnAyg5gbTYBorKkUyLnkB9YVhTxu+kT13iccwtwdBewPAus+b2ar9xJAafqfgMQO4dh+J9+BHe5gqZZZzYok1JJUcpaR6bp93P+W/N6p0KuGIemgEWKgPQhWPxdP7NBLhiHKYHUp2DwpZ8rLOD8tmJQVplOLxAqmbRKC6EDYC7/CeCRPcCx3cDSrsISrs04CPm9ArZk55UvKAspYLqPaPdR4/H0g8DRHcDyVr/X6VabLHk2PhjpPVZY7d5xwF6CwS9y/4LbbVyQsEKIufGiKe0p2JvXOx3kinF0GjhOQY+oNRtljji9TQPf/fOV9IZY4Gq4D8Hgy/4W+Oo2YG5bUUy04vUcLCqSJVRWszJbNgxSmMau+q/Ao2cBR88EjtOqbgNWWaTkIFz3YiWrF4nAjtN0nBZrJnU+/8PA3CxwfMYB6LUra3oglL0tps6wlVha5rLiqd9AdDfB4Je6U0s/0BXTDYh80Sr2FOzNA2AXuWIszABL1JaKWq1R+nwGeM17OsoFY5XTVw/B4Cv+Djg0C8xvLYqJCECzgsxmZlq9T8e0XGUyaUizavPtxoFr/zvw2BnA0Z3A8e2FVV3x6c4sqwObckeyhiXAowUSADhD1XhceDMwx37lvU4XxVN2n3rJIocygkr/Vbs7fe+EdBLcfaXXQ3IPWIrpBB6XlnwpR76jYG9e7/SQKzarxM7qJFj8mg8UarMV9IZ4gvNDD8HgKx8HDs8A8zMFAFnPYQPDl0Co2g4fpDZLqKCxT0/7fhJ4fCdwbFvhRiwRgJruCOwUgCpeCvUjZmEFxhfk9W969kW/B8xvKQqnVgg+B6CB0MsI7P70AHgmd2n1NQ0rv7FvALIlVYK73MnQCDLThSGZoDpuP7uCeuX5n8zroB5yxThGnQ0CgyBMxY63Aq/5aBHG6EBviDlOLV0Eg1+0AByZLgbl+HRxnZXJoqqttA4ODovlJZVuSjTQFtq+NwNPbHMAzramdVpVs6wEoPtdNg37wJfvsYiJP9NFqvHY+7vAwjSwxAeNxVO8T6aNVRRRlT6hHrJ0Ovaw0WDJCKng7g86APvNB9wg2JvXO33IFWOBgn8EIf2nRLD4tbe1+AU7yAWbZeskGHwVdd2mgAUCcNKnJgLQrZ/V9/Jnn5JUYmnAE3hCmv3+t8AWQfSzyPK/POOgJgDdsgqA5nfJAvLdLV+bz0kK4RqPZ3wQWJxyAPqDVhZQyQr7gyaXI9axWCFVAGLvRUhV46PgLnUWBs0HbBPszeudPuWKsTRZAJDTo8l8ui/42juL5veQC7ZpsEow+OrZQlqVVuH4FLA8WVyDAOTAmHUQCAWQkOlsQAwDt/9/AE8SgPQpNa07+AhAA6HLXbb5Xr4IaAMfv/eGvP5NzyYA7UGjBWTWjh40v9fSyscHLtaxhJWxFVsNNAXH1khw983+DYPmA5aCvXkdNIBccemfceooAfhAAcA+6A2xLuAGucxrzgKOMexDfV9OwbS2BB/BEoqLSrBoYGgJ3E8qLcIEsP/ngCPuUy7S13L3wb6PU56/m/Xj4Ps0TKCXQA6AXuNeZY3HMz5QANAeND1kwcKXlj6wOZQ+b7R+Pi0PD0DeFAfk590CKg8qncfoFzIRVWVqfFfBhgn25vXOAHLFWCDbvPstBsJZ4LUPt+jdesgFg+qVptWq11bg2gtgfuLiRAAgQeg+oEmsOujsXb5SsAoCIN/3vx04OlNM6Yv0tdx1MKvK7/TFjVmeCD4HQQQhf159eV7/pmc/kwCcKABoeYvR0oept7SEoZQ0Tr1lPuPQFlAtO0nyAcWhpzw/FSjFzGjLx+RGvxzoSeC1hwsA9klvaFN5FAy+9mJgnhaQ0qqagglADo4c9AhCDpJPl5ZommQ8738HcGw6AJBW1VecZv0cePwOY0/wl1lAD/WUCx0mMlDLr8bjmb+Dwp3x4nkDYbD0thIO5aNtfmDi/xGEeRawxhs7Vb/q2huABQJwAlhyy2cC0xoggjAAUCWWAkksOiIY978TmOOqeqqwqAx3WGhHK06n7TDwOcAV/iipPAKjwgrZm2o8nkUA0gKmAHTrp+o9MTrEYvq44o9pZIOtgmu8mafCV72YAKT/RwAy5OPOuVlAAk9Oule6xQRTWUKlWtkU/IvAHAHti5oIwDK841ZPFtCmdr0U8PaC9hVultd4CIC8P2Ztt/m5/qC11TJXlJDGGpfGAmYODgFoCxACkLpuWh3KCgqE8gNVZK4KtxgjJAB/2X1Krao1rfN7CWZf3LSBT4uAEIyWBVpipL7GgwA0AW25GbGENBTRx3rm1M2w39mmrFVwjTd1Kn+VAZALEE5LtIDyMWUBvbLNLGHgd5H/V07BDp7r3uU+Jadgn3ptxekA5MBri0/Wp4wzBjDbCnkMWMqVpE8GJwLQqvfc0pqbkVj5aNk7gbCxgJno30cAjntowtXNaZ1suvSKNhsYTcVKmw9F5xGE+94dfEoP+JYhD/8OC8eIPUsUHokVVKB78XszbzAF4Pvd//PCKVGIpOAr78mn4DZOm8YC1jco+w6EFTDDPJqeCEBZBa5GffVbhmQ8DtZW5TYOvPhXip0GTuu22lTMLSw+aAVl9QhEWjurI/aQiLJkTMLsX9R3r/ymZ73fp1+37OU9hunXSkdl7T3QrhKCtlCM59k2i5CMMSIAGdqxEIwrmptzTsCEut5yilKoJLAcxCq3fe8tLCDBFwO+tKjyuxSCMdYEXoeDrHcHvu0tTwLzmwHA4N/Gh6zNCqqeOSxC2lb8tQSiMwbuqXIqAcjFh2JjBKGJyShQG6ygVbfJegULWBYcMR3rvb6oCRaQwFPgl1M5rR7/JtBZOIZWx/0+s4QeY5z/1/X2tFnAxPpFELaVkdLN8MWGVr4pCBsfMHN8bmTKfCjZ0Ncp456/x58zLzfw6Qf3ABd8pUgEYmqk5bGyek06IQl1bkXScnlN/u8L24Gdx1qVq91KQvrpgwaAAw9p+wnXPw1YjyWMGtDo2ASOFGMU7SIEUzdYD34vMPmXwLbHgdkFYAtlGiim6DpxJtvq9LtlVr/aWKEB8pUXAOOPAFPzwBTZ9r04vdQ9Ts4pAZ3cd+yHxgfMAOH+vcA69/9Uxijmz/AerYpdar1lNSMYzV+vWY/34I8DY58Gph8Bpo8A04vAFEFIknIHohGVR62QhFRSYjQE6qFri2z3iaPAhHNNlxKwArI0Q1IAxwfReacbC5gBPp66/5ICgLKCtqnsrKKlrFZUFPKOr7osMTtdsxzqQRZ93Q1MPARMPllohUxRqkEK6gShOP0S+dY2hlRv99y+ovRi7IiTnTvLqmg6xDPYpqAUgRgsoR7MxgJmgHD/c4E1FXu7FRRbvEgd7evXWlbPpp9EgUjiJpwe6zwOMlvpAWCMVusJYPIYMOlSDZRpoGiNxKzbdIQlXONMWJbGtw4svdgz3El47nzTRvPrrKptAJT6ZrzfintvAJgx4vsvdQvIXK5VYF3sUZxmJUvgA1FOvwF8spKyBtM1y6EepI4LqVMedbEaTp0EIKdPKh5FqYYqSxgo2jgFr13j6XXHnOiSZOeBVSvyC8qC2r05FVvVw9cAMAOA178AWPMp2LJaaekiCPXExwHw660n1oB/niGQazwOkkSepbJ/72I1x4CJ+cJ6lYI1riccrVicUuVSmIW82pkwnHHVOKbFsOozQGkFkwewnBES37ABYMaAX39ZAUCCb82nIlo+40p2gNnvsoKunxH1xGwA/LOzdQOQJPIuHzV2GBg7Cow7AI0l33XfjOsv6oVodes6ISbBsAZMX+kJxU56KY7pkmFVhOciuvTzSt05v0+ryuT/9gDrZNe4wPMsI7VJP3GcP7gUOOdvgL1rRYJ0ZI5IV3hV4/wrGYPPU3/AiRhYusy2K7mU999P+z90ObD7LuBZK0Xdkeq9NSX2+o4HLwfWlopFCC0fgciBMtAFC8CGrYXVoVjnU2G7rTXrzh4kfRzLY1kyGwBoeiGcPiXb5eAzdXWnazPCSScb4j3xfmav8Cx2p50lAMW0VXINitCogl2r9H2dcctWwQxQsn6ZTBbMNtcgdKIbiZj51VcBk38CXPxoQcfCUg8pjcYgZScw/momACnXyr4leBhs5QaBTHpf7X8dMPYJYO8XgAv9e8QJlAZZq8D4xSuANYKPJQn0AR2AHKy1MACKe9nfFI6IEqduEWoHIJ9wlsVKLekoMCa9EAegSTYQeM4TXco2SEMkAHEbBZoj4bbYtdyCVrFqGXgTSxgXYTZeHLi9AMjEQRCVUXP/n4KUaaT8vVTi+Rtg7GPAuYcAWlMCgUVkQfJ2Q12yBvPXMwHImhDWwf81imsTiLSEvHZkr+jY/p9CQRD4p8DOBwteItai05qn31FFdfLlFxYWgCDUIkRkj/TxbCEi/89jfPZ3X2VqYSJQbmUNQY3HQT7hbv2sLoerVwKQHNEEoCsm8R4MhPRjXUGzVEIKIoY7yaEYuY4dgGb5RXruoSgtSCLLarkICQ9f6QNykGjFdjsIBaI4kGlt8W+Rg5g0HJ8qAp47nihAzFpuWtPIMBZJlASILvR6fQ0DCVbJCkJOJCqnk4pGpb99tZ8MopyiKDX7WWDiwYKXiEQOehCrgKh+eJQ+EQHo1Lby/zRlyf8TIbf9XS5ftIb8I92YugH4ay2pLusorl7dAoonWtMwQSTdOFuQSLTGHyIC8kxSIQuA4hwU2WUAoO4/grBcDbsfWElSzg+JCoYDoEGM1ixSkHzgF/wG7y8sIa3J7JPAGWuFJSQIaU01iJHUiYP4e33BrPOHmG/JMaOfTZVYRhwGav87vWKPJ9/rSH4IOGO5sITqg/ggxXs4TOaBAECbeoOsgfl+DrQShFqcEIhyyt0MbMusEkx76iAZXKM8BvXiZAGlF+KaIbaadYpem4aDgpJZQz6YJABV5VcHAJZ0v4FxX6KG5UpYs0KnqjhRuagEVgPglYAl9ciHf8mdUrJh0Qx9vkDBzBywfbkYQIGwahA/kglATsHsDzKA0BATiPyZ4NEDwIeoa/uFYKKXL2f24nQoIgd9R3yQCMTFqwIAfdBWI7+yB5ZLECYLETd85YJl+2YAUNosLIel/xYlu4Jsl6bhNhD6it4WJCvA2Zc4Gxo73RcgJeOqFmGR6rcChLYACyGojmEYdj59KnZ+tIQRhH9IvWA2hiREjDeRI9Cly7fMF3EtWRFawhQIf5IJwE56wdTIYdt7tp9ys1K8JnoJvod9Wn682PNkP4hUy1ndWgstAtBDMLYN5/6PAc5DGNoF4SrZfN+4+IhT8jqwg2Cp8ThIJ5vfSWBXAVCrWN9SMxDK+skaOvhoAc8me654pmUB3f0wyt+E8FyRAGmPlOEoiSD2qgvmAKoOm52fAuiTDHSyIRxx+lI0QxxADubfF5vffMmSajrWlP7nmZ3dSy+4r/ZzAUEHnQ8R70HsXlK+PgJsW68G4XYGZj0EY2EYATCAT6tAhmE0DXcC4faapcwMgAIfLb0kuzT9Qmw5uwAAIABJREFUSi+EfeALkSrpBovbrQDnkm8wAo8/E3i+CCsZ98NCpAp8cUekZyBavI4ET/TnaAk/RQCyAXy6uNSPA0i+wMeB6ePA5HFgZq2wpNGK3FUDAHmv3fSCe7afX8CB4UNEEOolVi/3obastNwJ9cO5BOBKEQMsAcifHWzRAigWWAlCn5K2bQYAOe1KMjTIR2kRUhKVS7IrLia0v+3xwHMZMCbYNP0KfG79zAqK5DxOvyEuWu6VD5KSHy2YAEQAfpaRdl5UkuUctIpBnCIIl4psD03FtIIP1ADAlBuJM47EqqUX3LX9kSBQcuuyftK78xUkHyQ+RLqHZ3Fv1KcgLj5kAQ1s0Qo6IA1nHhNLQzA8ZxvBXuNx8DcS5UYpNnoYxsCnUIqvZo0F3wPTMa7Hv53HOJVbS/l+5bumX7d+5WLE44hxIRJB2NMCqj9ixwuE90svWCaIA6bAp959EKeWChAyA0PTOV2unGMQveCO7bfqHbcS4rJR7Ewqnw5AWhLuImg2uFQAXAVs8RGmntW4+g2hB3P79L/EJ9zGvqrxOPibiVihAOgrWQOf/EBfBcsPNBBqW9Hv6zzGqFzmoXz3B9AePgXiq6bgiv4YOB9QHS8AfpkAFMMjrWAcQA0iO9XJiQyAnos2vV7ESHOOQfWCO7Zf7F40mZFQScRKAYBaSU6vAVcTgN7xXHiUFpDTMK2dFh56912BTiDcvpkATIXzCL4g3WXTZ4jpGfjoF/oihL+fx+0yWUABLwIwtYKKIabgCzHQvi2ggBKn0McEQDaKT5cGkIOo6SuyYzEfjQB0EM5nZgAPoxe8of3sgSqCQM3jkdFLvpRvR13+7UVRuhUFSavNO6otwp88ZZ3+t4M6HLtch6OT9AG/q9cmtf//gV1JDYcnQ2zY6/YakfSrU+Pg1M45NqPt3IEtoM7WFHokyrWKkooglCMWLYjiUXMtK3g8Uzd1WL3gDe3vRRCoUEYCwGtYFxxqgA2E/jI20F5hhmQod98BHNnlxOTig1aGiDanO21yV4DygWuB8YeB6fnC9WEtiKVVKeE0ZGiXWczeJoWMIig5a9V5DA1ANoKDeDylZ9NSXxyAsiKawrQqmCv2HVf5e8aRoxfc1n7xs+khItAUvojvyWryxVcWJZksVSyZoQRA3dcAoHzax4Gj2wtu6FVKM7gMgti02jbV476oUJJs1j/AbA1mQ3Pm8eTRsoZDtR+xZKCiEKmMXTIeXHPGdhYArX8FwG4DGMEnAHIK4yvT58nWC2b73cexaZgWWaEKgU1gjNbPP7PvOYGsUSBkv3hBtmRWNzxjTk9RWktvxp6POj0vARjY9sWkFel8RWxegjIF4RjwAOnZWMPBTGjqvHmszxJOBUD3xyznL2bqROvoP3N3q84jG4C7M/PpcvMBef0cvV9k6hXv+2Yno5QfGArRbaCC0mWv2YtF3ecerNDhkNZIIsXQRv5dlTtGADJSz2gEE1EJQM//026HdIEZLC8B6A0tk0g1Ja8DuzJdphS82QBEZj5dbj7gxZN5er/IZI+67pscgE7QaDOUMyC0Wb8+gXjuR4F5J6YsaXnFhBoAGEVvUhb60jISgCQnoh/OLBgvIrL8v7DdFkEYM5dtNg97tvz5zJqzdfIBmJlPl5sP+DJP5xtW7xffnzeh7H+Z+3+RpkyWT1YxuURJYVtx6T0fCTocouQV85VkHRIGegEuEv/YKpkA/JceVmL8kv6t5/9pu62tfiPWcFQVEa0DZ9WcLJEPwMx8uvfnjT9IgZyj94t/ldeA/S9tMaGa9SNdmsIxbvVscVJ1GScoMt4UPwhAsmMZ0aXzQBsvdGRBjQz0FUpEJRAJQOq4KAnBdz+sfiPJ3bOYn8fsykyVWMfiN3BOzckS+QDMzKe7OW/88aqQzsfE5kH1fvGjeQ0wADodmVGwOeiMsUqHrGOnS4UFy9P/wAEojkEnI+IqOIJQNLgpCXhcmLAtD/D+kgQE235L93tj+YBqgTX9BiCeW/NedT4AmQ+YkU/3sbzxBymQuZhm8g1T+QbV+wWFdjKO/Te2mEFNlCb6gPF708VJ1TXHgKd91GnZpDfi1k/gM2vqU3DUnCuBmNQe3P9vw6pe229KOvB0K1k+ZS+rnrfM2AlA3JMZtah/EZKZT3drxuDz1O/yxAwu9JgJxr3lQfR+8aa8Buy/wdWQZAVl+ZzCrG3q9c/YrkmHy3IRYryAAqAkEBIlopJxNNUbER+fA/H+/+AAdP9PmS9dazicJybm7mlB8nR2dI1HvgVkOlZGPt2nM29GCamcGZjAwlQ+vvrV+8X/zGsAAUiLVPp/wd+zaTMFWw+/kAA0GQQnpCw5mDsAMIrcRB5mC/+MAffTwgfwKY2KfmCZ6ZIkUShrxXxBX4yYaV8Hzmcn13jUA8CMfDqWYeQcSkhVOl8U6uxH7xekrsg49h8oiCENgC5TUG5vKxxT8f2aRtOtcAKQ1s8soPuOVUIwpchNlEEIOyNSIrrvv3hwnckWIZPZsnbcDyzTpvg3lU8mpZQqozyfK74aj3wAKh1LgrsD5tMxiz/nkGD1sHq/YNFOxkEAcuW7oqmXlisuQOT7VV2jwi/kTgj1RkoZhBje8Z83SCAEEJZW0C3gff8tADCt4VASaWIBK0HI9q8BF5yUAMzIp8tNx5Jg9bB6v/jdDPSRns0BWIZeUitIo9IhHmhXTvzCPQddccnZ76U1V/IvC4SBCFyg26DFNg7c++Mhhb6qiCikT7WVUmr6lYn2nRKyrdZ51GMBlZIc07GUBdMjny6XCiUmpA6j94vMZbgBMFo552pu27PXAqXTyAUQcitOQjAm9xX0N9pIwIPmSCmH5QuPqER0L4kDYgp9zOUL6fYxkbZcFceyAreAF3GlV+NRDwAz8uksnT3jiILVSmpWNlhMze+k94vMZfgGAPJeHDjpCrgM01Tdry9OzvmYAzAqLVWIwEShwzbRwwSEn+MqP6bQK5tZlWyhjCCCsC19Xv7gOnBRbgp7cu/5AOyVjqVMmA75dJZ9nHF0yohWNlhMxKnS+0XmMtwAmFq4imnYbrEqNJPc+9kfd62RKh0On8qV9hXZ9askEPgAfI56ziocUgVbzGT28lEtRMoKtg7lBHtznfZNA+CQ+XQWM8k4uglWK/NLYKzS+8U9GReXD0g/Tyvh4Ne17Yb4Zbr6g6y7/aNWcoPpjKRTsJIags5IJwkEAv6en05S6GUBfRWsUExZyVZVQCQwrgN7Wfdd41GPBczIp8ODeXfTSbBa6YYxlY8/p3q/udc3C+jTbtvqt2oadnB2m4oNgMn0W0p+hYWHWbwg9yU/0Kb9EIy+5y2hiCit4UgKyTeAkN8Valk4Le/ldlONRz4AWWBRM6fdIPfHstw/G+SE5rMnVQ/kA5AkLHS0ak7V7reXfhgACaBqDtD3e/nmc5k9kA/A80JReq+U38zGVp3ObJo/BvAOD3dtwiWar9zEHsgHIGlFubqSx7+Jja36anLLcDvvgwA+NDpDfILv+qlzuXwAXuSjrkKemlO2e3U1uWUYnL8dwB/5e2apca9LNv+vsQfyAUheX4VguB+mzIsaG9ntqxhF4Xbe3QD+n7/uHLAW9wQ1tblMRQ/UA0CaHC7plXEh+q4T0OWcfhleYTSHBK0EH/mi+fcRuKQn4I6fWpeoB4AevCz3HOOm9yb3F5mBlZBNclYCj1aRfyfrbgPCTR6AzK+vD4CyglX7jpmN7HY66d1E0ctdIrEEE4wEIMlam+Pk7YF6AMj7EwAVbU82vTerCwhAXopJN9zVI+AYrOeULLZgErY2x8nZA/kAJGWr0naUWdFpy2cT+oCWjpdjLFxE5UzYIBBpEUX5nLnlvAktb76SPVAfAOUHpiAMm96bsVtCAMaKALICMyxDq6cXfycA+b/mOLl6oF4AiqBRIEzBp7/X2Af0+fi1XIioMIlAI+AIPIGPmeROWV3j1Zuvyu2B+gHoFfZiDS2lC0LiY52WUADkQoTTMH1BFSYRdHoRfKSu5v9qrizMHYPT+vx6ARhSuDcAzzmDo5ZGHT1PAKYMwQxME2jiSo/gEwBrrq+u41ZOy++oD4BaCcsXTPiSI3ey8s4KGoG8QwCMFM+0ggQhLR0BF19SXuD/ayakz7uR0/TsMcxg3SjfqWNA0hsrga/ojaq/8WPcC+YIk4Ke4CMSuB2XVht1Oj8zIfXlU8BtU8DhmYRXWdfrdF1fgr3+S8At48CD04DVjXQSDO70PTUnaJ5uOCwsIIFHSSFy1pKPWCDsZxCpw8UVgKSPxLXM937OzxxAljzcPAbcswU4Qh4V3UN8mKoeKm/bu78IfKJQa8VD48CylHQiL3O3/qg5Rf30BKACMtJXjXKQcfBSK8Dfqc3KVCwuN2VFGRnm/yKZtq4Re5ifyQQgM2A+BeB3GHaZBo5MAIue0l7Kt3cC4xhw+5eL7TuCkJk1jBtyerbUfYG5ExjZ/pqrxE5fAOrOq5SmowVIrRp1IyT2R6+fg0bgVYG4CsyZe2UsaiOGKXr4Sfp9k8CxCYAFSKyvXeY1o1BxQux91yMtfsHPutgnnyUuUvhc0ZsgUXib+nVkq6+ZKaABIHsgVZnuwD9sVo66rrR4ImdhLGSQ8zPL/JgBQxeU1ouWkO9PTgDzbgmXxrzMkatl3keivfG5x4r4IRcz5BfkO5vEZ0kgpIfBZ8yKjlL17syy0tMNcOn9dl4Fy6dLFabj1Mpvow9Ify+I4Nlo9Xt+ZqU9VdJpqZh4QDDyxUyYOYJwHDg+DhgI/WUVZl7aSEt93+GO9Ia2iuZKOfA7lhp9JpvAVy61w2mOwO5hmCgMHC1H9O24gu6UD9jP+ZmbtLRaSsei9SL4XDPbAEh/kGQ/pSUcc0lbApFWb67lQUhpVnLBsoKqqZclFMmUtrxPcwxl3X7vOCAtYLSCcugFQmqhdssH7HU+RznjiOlYXA8wqkOfkItTAom+oKygca4ES8jY+N3z7fSG4hfUtp3ihUHruVSsFy1iRvNP+1N7A5BdJACmVpAgZPhGOyCigEjlPLudn7kvFtOxuB4g6OjD8UWLRkCZFRwrLCEXJQQhp2K+37lQeBCRX1A7KPQto1prFEmSYn2mB9EAsO+kYfk8KQhZF8yjVz5gp/MztyOUjiW9bCUhEBhKRCCgSis45uQ/PhX/xfFWMgOnWu2gxB0TF/o0kEZ/kCDM1Ts+3RHYnwVUL6XhDFrAswfIB6w6P1MrTulY0sum1VICglKwCEACqvQFCUK3gHcsFQCM/ILayqP1k9JshVqrncMalOYYvgcGAyCvIwuod8YBJQmZpmGJeyRwkGw4n8jJOJQNw3idLFhMRNB0SgASTJyKoy/4ieXCeFfJBUeV2SoAclFyR0bbm1OHTUiN0/DTAwD7zQeM52dqj8VsGEkVE2jKetG7AEhQ0frJAv6RC0trC1skl+IWlNinGLbSaZg7Mc0xfA8MbgF1LQV1z08A2G8+oM7PVF9Ms2GUE0gQyp+Lwu2yagLgR9ZaYpkSypQ6a6Q2DCqzpkvietXIFdoZfuieGmcOD0DeP0HEbBhNwYPmA/L8zJQsATAKnguEqS+XTqkE4YfWWwCUFZTksYAYwZfIBeN9Tw0cjOwu8gDIZqsoSSvhEeQDiiGYFoyWiSDRypWgi69UP5sc5fIcquSCNeXqe2X9ZAHfM7Khe2pcOB+AT41+aO5iRD3QAHBEHd9ctuiBBoANEkbaAw0AR9r9zcUbADYYGGkPNAAcafc3F28A2GBgpD3QAHCk3d9cvAFgg4GR9kADwJF2f3PxBoANBkbaAw0AR9r9zcUbADYYGGkPNAAcafc3F28A2GBgpD3QAHCk3d9cfOxqYJ2au9RdPtdp/khoEOlglDYT39V1PzQFXLsMXAlgt9PCxJKPbufyf8/KHIPfBPAZABf79Xc5XQ0ZQ1Q7360NbxoHrlsDvs5ZRsgo0une06by6X1mZvtP99PNAp4F4LsBXA5gjw8EGTeqaGF4QhzQF80CX7cAvGIdeDYAfhdZ2sTKUcVrpE7nd31N5gj8e2dIo2osk7NZpMdK0Z19tv+bJ4F9K8D1ACj8yfNSikHeg+5Z969m57Y/8/ZP+dPLKZhP/rcA+AYAF7g1oRUhEMUzFMt6eSJfX78b2DkPfM0i8GIAX+uWlAMppreUUErn8p2gzTl+2flg/sDbTkvIOik+CP20//mzwAXzwDcCuNTPJeFXpEpM6QEjIHm/zTF8D7T5gATYNQCe69aAloRTGulfBESBSYNyxR5g/Bhw7hKwZwl4vk9LnM5JmsBzUyDGAX3B8G23Mz/g9BuUa/0IiutfMkj7zwKmngAuXSvOpUvAWYBtF4BTnspIj/O8zPaf7qdvWITw6eZA0JLQEhKEGgxZhUj/dz3NzSKwbR44exnYvVKcy+mM5Km0JhxInUtrGkmzCPicg3W5LMGkQiZZTm9xS9Z3+4m2o8C5c4X15pTKW2Lb+fCx7WLtjYxzqiql29Icw/dA5SqYf6RTTilg+lYCIXmICKQ4IK9wxfSJY8AZK8CuFWDnanEua9ZTAMsaCog3Dt92O/MvnRGBtGwkqKRmMEkqCaa+2k+0LQDTh4rP88UHj74kF1WaATo9QHQ7mmP4HugYhtEKj4PB6ZQ+FS0hQahpldPya1kXTOqNY8DscgG+HavAttUCvBxInitrkgL4lcO33c7spBdM3kAuSnq2nx9gQfAh4JyVwvrxwel2z3p4aMlzH6DM2z/lT+8aB+Q/OT4EEqckWQSBkGD6EQKQnDCLwBSnYgcf32fXioGUFawC4esyu7CXXnDP9tOCsyD4KLB1rmgvX7zfbu2WG/Jtme0/3U/vKxBNAMoi0KcjkATCN3HOEr3UAjDrwOP71rXixYEkeKMFlSX8ocwR6KUXTJ7AaNE2tF8WfA4Ye7Kw1mwvX/yZn+eKnvcrfzC6IK/ObP/pfnpfAGQnySoISBqUXyAASS1AK0JfagWYcRDOrAF66TxZQU7jBOEbM0egH71gcgXSFZAV54NQtj9YcNIpbONCyh8Ygi8CVospApDuB63g92W2/3Q/vW8AsqM4gLIKBBIH8bcJwMCNMX68BTqBb8s6sGWtsIA6jwDk662ZI9CvXjA5A6NVa2t/IAicnC/aGV+8T74IQPm/AmGuBc+8/VP+9IEAyLslAKMV/LgAyIUInfnjwPQqMOOgI/DstQ5Mr7UAqMF8V2YXDqoXXNl+EQQ6N9v29aKdesUpWJZbAPyPme0/3U8fGIDssDid/pUASCvCaXgJmFguAEfgEXT27gDkuwaUg/nbmSMwjF7whvbLhSDL5TwwvdRqo9oqHzACkCB8U2b7T/fThwIgO01T1IMCoAZxGRhbKoAXQUcQTjkI+a4B5e5FzjGsXvCG9gdqrLGFYrpVG/UuHzBOw2/LaXxzbh43DKeoJwlAHqLndSs4udoCoIBHQE45EPk3DuitmYOQoxdctp8+rFwIWsGFYiFFoLGNchcEQC6e+OJC5J2Z7T/dTx/aApYdJ37AyJK/DIwvFxYvWr0IwEn/H1Opco5sveDUhSAAF4HJpQJkWixp6k2n4IYfMGf0amDHev2I8+l4/UbvNw8Eozw72wJePOJ8und7EkKj9ztKGA1/7WwATo44n45pWI3e7/AAGPWZ2QBkYHCU+XTMfGGQmYIxjd7vqOE0+PXzATjifDrKtTZ6v4MP/MlyRj4AR5xPF+VaqZLJF1UzKdPV6P2eLDDr3I58AI44n07ZMARbo/d78gMubWE+AEecT8e9YOn2Uheu0fs9tUCYD8AR59MpG6bR+z21gKfW1gNAz4geRT5dTEZo9H5PPRDmAzBmRM8BJzqfLiYjSKKr0fs9dYBYDwBHmE9XtRfMsIz04aQZ1+j9npygrA+Akqs8wfl0BCCTWRq935MTYL1aVQ8Ao1zlAnAi8+kEQGZTNXq/vYb75Pt/fQAcUT5dBGCj93vyAaxXi+oDoFLyT3A+3Rcavd9eY3xS/z8fgCQX/LPR3SOzkon55jg1eyAfgD8M4NcAPD6aDmBtB1e4NMDNcer1QD4AbwbwxwDe4UvRE9wHZG1gNSXDLlwLNcep1QP5APxzzwj9IIAPnXhT5ORc5EYCA9HNcWr1QD4AmRH6FQBMTSZZH98ZmD5Bh5g1FopiNns1x6nTA/kAvAfAEwDudnI+EvQxPfkEzYfaCXRSBluQMB7YHKdGD+QDsBNBH/9+AkAobqTADGK7Inw1x8nfA/kA7EXQt8kgrGAGMfBxZ5Cv5ji5eyAfgL0I+r68uR0QmUFoBQU8vfNvzXHy9kA9AORoMw7CdGQCjoUZDwL4kv/+8OZ1gJhBIjGDgMh3vTavBc035/RAPgD7JegjODfhiMwgoqeJwNPPTaB6Ezq/hq+sB4AcXeXEP+ZhGVo9vRimIQD5v5oPAZCupgDI9wg8/qz/1Xz55usyeyAfgMMQ9GU2Op4eAchpOIJQQEz/VuPlm6/K7IH6AMjgGzdl6QtyX5jWjpQFevF3lq3xf6yhrOlIAUgQCojR8gmE+l9Nl2++JrMH6gEgR5UA5KYsc+AZmCbQCDi+IvgEQMob1XBEAHIajgBMLV+0kCdws6aGu3zqfkV9AGTwjftg3JRVVRAtHQEXX/wbAcoXP5d5CID8GoJKvqDAloKOoIz/y7x8c3pmD4zhaqwjRzCYyQg5gr2ZgsFTLweWr8XQgsXjbwLWrnNtMlKgNoLBmZAa7PTCAuYIBlMvlWQswwr2UlUw45jdDSx8HbD+Ctd+HVCwePKbgJV9aASDM8Yg59TWFDysYPBtmYK91IbNOHaPA/M7gUXKXA4hWDz79cA8+W0aweCMURj+1HYfcBjBYO54MMY3tGDv8I3nmWSHOzYOLJ0LLPGXAQWLz3oB8MQUsEa16kYwOG8whjh74yJkUMFgbsNlCfYO0epwissVY34bsHw2sEIRkAEEi/dcU0SP5qhF1ggG5w3GEGdXr4L5134Fg4kAjuDQgr1DtDqcUmZETwArZwAru4BVqsv0KVh8/o3F4v0QXZBGMDhvMIY4u3MYhv95Zh+Cu1xBcxuOU/HfeDIq5cv7FuwdotXhlCBXjOXZAnyrO4BV6in0IVh8wStLuWCsUAyvEQzOG5ABz+4eB+R/ewnu/kOP/3G/l4kJTERlljQtIot2e53/IwO2OPl4FLtcnCqAp9cahT56CBZf+LpSLhhz1N5qBIPzBmTAs/sLRHcTDKbiNHdBGGymOC/3hglEvgjAnoK9A7Y4+XgiV4zVWYDAs/etxaubYPFFP1QkLtCIP8neaASD8wZkwLP7AyC/tJNg8L/xLNBu+YBdBXsHbHEFAINcMVamgdWZAoRrfPdXm8KitLdmgYveWAq+2y7iMqfuRjA4b1AGOLt/APJLqwSD3+y5T1yI0AoSbAxMMzGV1o8/My2ro2DvAK2t+GgiV4zj4+3AIwDXtwBrVJeuECze+9aW4Dut4PxkIhYsdetGMDhvoDqcPRgA+SWp4O4veQ5Uv/mAGwR78+6rQq4Yq9PAOi2fA4/vBkKudKVU7VZw77uKvWFuZbtcMNb5v0YwOG9g+jx7cADyi6Pg7gccgIxlcA5TKhaD01yYKBmVFpBZMfx/m2Bvny3t8LGqoqTliZbVI+gMgHwnMAnCIFi897cLAAZ6QyzFzzSCwXkD1OPs4QDIL5XgLmk5JHk/SD5gKdibd38VcsVYGmuBTaAzEHLHgyCcaokB7/1IkUET5IKxwF5pBIPzBqbPs4cHIC/AaeqvPL9pmHxAE+zts6VdLCD/lcgVY3UyWD0Bj1ZwqgCggXA7sPfWAoAJvaEtZBrB4Lyx6efsPADyCtmCvf00s/NnOsgVY3m8BTRZPZuGBUACdArY+5lWDqGmYbIrLHEx0ggG5w1OH2fnA7CPizQfaXqgUw80AGywMdIeaAA40u5vLt4AsMHASHugAeBIu7+5eAPABgMj7YEGgCPt/ubiDQAbDIy0BxoAjrT7m4s3AGwwMNIeaAA40u5vLt4AsMHASHugAeBIu7+5eAPABgMj7YEGgCPt/ubiDQAbDIy0B8ZYNMbkX+ZekpuIiOQrPar+xs889HJg6jZg5jAwvVZ8B+ll9PlO5/Fc/o+ECjnHfi8zYfkvM5ulmp4qJXVqx5deD4zfAkw/CGxdAZgoHfuh131QkaI5hu8Bs4Ds8B0AWLnIRGCBsFfn87JffDMwdjOw5R5g8giwZa34jnQQUwDo99wBfJ4TM7COiNdlaj2rA/jeV/vfDeATAP4UGH8I2Lrc6gc+SHqY4oMZ74VSKM0xfA+UUzB/oBUUCKMl6zSQ/PsXqZD5KQC/A0w/DEwcAcYXgYnVwppwADuBkefnCim90FmBWXwnK87Uen53BI8sbuwqaz9p5UgnQhBS+ZN1zE8Ak0utviCwq8DI8/nx5hi+Bzb4gJzKZE1SEFZZgS9/2pWR/gTAJ4HJQ8DEMWB8ARhfBsaWCwDquwQKvvNgHXvOcYVbPFJPkw+dDxC/W1Y4tWDpw/Rlgo4lo1T4/KxTihDNpJwj3/UiMLXemprjffC7eWpzDN8DlYsQDiKtVxzEqoHkyX9HRizW+nIgaQnvAiaeBCbmC0s4tgSMu2rMePAR9X252jXklaTFU108K0MHav/nvJ6ZxVVk9OI7GR2IZoGQNc/HgbHgIwqILIVujuF7oOMqWFawCoRxkfEIB5CWgkREBCNf9wMTc8A4QciBWyoGz16rwNgaML5eWKpctYZL3N+TWLX0gvtuP0HHk2n16JDyxXmVhfU0qywbJbr5GSuXKxA/sV5Y9UYWdnjwyS3qKKgarWA69Wg6fjQOIK0HadnIjPVFB+AiME4AuiUkCFnESyCSkmAuU7Cjm15wX+2X2ifBRn9A8mKcW2UFjULVQcgVDl80u40SYh763FfvquhLCxitoBYUsoJfjXKttByMq9CKcHn4sPuCbgXNJwyWkECcz5Q376UX3LNncZyQAAADEklEQVT9fFgIJs6lBBwtn3Tt6FpIz4RWnuQxPh2XIGzm4CwQ9hWIFgBTK0gQHiIAJddKq0ELQh+KL1qUR4MvSEsoENIKrgALHNiMox+94K7tl9qnnMio8MSf6SNwGpYVjCDk/Ju7isq496fCqX0BkDeqlWwKwic1gAQSpzGREnFgREz01eALLvvq2Kfi45m6cf3qBXdsfxRbJMho8dimqOhEK8cXQRr9QVpvPoDNMXQP9A3ACELFxPh+jACkP0fLIKFCCRRqKuPUdqjlC9o07JZwKVNHeBC94DQcZO0XAAkmgotAk9QYrR9f/BvByYfMSATDVMzwTXMM3QMDAVAgVHCZ7/MaQK4QZUHiNCbBQlqUw74YCb7gcmYkelC9YFlwvVv7RRAorTuBkECU9asCID9/x9B935zYzyKkqpfiNHxcA0gLQgvBAaPVkCqm3h2AtC5m/RyEqzw/4xhGL3hD++MmslgqCbgUfLKAcRrmTlBzDN0DA1tAXUlWcDm1IOIIJAjlT/Fd05lbFQFwjdtgGcewesFt7Rc/Gx8iWjUCjGCT1YvWT1MwgUqrf3NG45tTbcu0aximWx9xENcEQHGbcYAEwtSXSqY0gnCdgeuMI0cvuGx/FUGgFhwEYrR80QckWN+X0fjm1DwAWv8RgJFilJZBznz0pQg+AZAAlVWh1GvGka0XzB0cCQi30aSGVa9AF62fLOB7MhrfnJoPwPER59Px+o3e76mL5Kwp2G57xPl0kxc3er+nLvyKtLmhfUC78RHn081ONnq/pzcAR5xPR9mRRu/31IVgvgUccT4dNaobvd/TGYAjzqejumqj93s6A3DE+XRUg2VSCjdaGr3fUw+I+VPwiPPpqJjO8J1Nw43e7ymHwHoAKMFd7QErAeEE5NNJMb3R+z3lsGcNzgfgiPPpomJ6o/d76oGwPgCOKJ8uKqY3er+nKwBHmE+noqRG7/fUA199U/AI8+kEwEbv93QHoEhZTnA+nYqSGr3fBoAtaiqBUImdm5hPJwA2er+nKwBHnE+X1gUzSbnR+z11wPj/AeCpPDD3t7rvAAAAAElFTkSuQmCC"
vendor: 14,126 bytes, lines 5695-5728
5695,uQ="uniform sampler2D weightMap;varying vec2 vOffset0;varying vec2 vOffset1;void movec(const in bvec2 c,inout vec2 variable,const in vec2 value){if(c.x){variable.x=value.x;}if(c.y){variable.y=value.y;}}void movec(const in bvec4 c,inout vec4 variable,const in vec4 value){movec(c.xy,variable.xy,value.xy);movec(c.zw,variable.zw,value.zw);}void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec4 a;a.x=texture2D(weightMap,vOffset0).a;a.y=texture2D(weightMap,vOffset1).g;a.wz=texture2D(weightMap,uv).rb;vec4 color=inputColor;if(dot(a,vec4(1.0))>=1e-5){bool h=max(a.x,a.z)>max(a.y,a.w);vec4 blendingOffset=vec4(0.0,a.y,0.0,a.w);vec2 blendingWeight=a.yw;movec(bvec4(h),blendingOffset,vec4(a.x,0.0,a.z,0.0));movec(bvec2(h),blendingWeight,a.xz);blendingWeight/=dot(blendingWeight,vec2(1.0));vec4 blendingCoord=blendingOffset*vec4(texelSize,-texelSize)+uv.xyxy;color=blendingWeight.x*texture2D(inputBuffer,blendingCoord.xy);color+=blendingWeight.y*texture2D(inputBuffer,blendingCoord.zw);}outputColor=color;}",dQ="varying vec2 vOffset0;varying vec2 vOffset1;void mainSupport(const in vec2 uv){vOffset0=uv+texelSize*vec2(1.0,0.0);vOffset1=uv+texelSize*vec2(0.0,1.0);}",Bo={LOW:0,MEDIUM:1,HIGH:2,ULTRA:3},sP=class extends Ta{constructor({preset:e=Bo.MEDIUM,edgeDetectionMode:t=Sm.COLOR,predicationMode:i=oY.DISABLED}={}){super("SMAAEffect",uQ,{vertexShader:dQ,blendFunction:It.NORMAL,attributes:ba.CONVOLUTION|ba.DEPTH,uniforms:new Map([["weightMap",new ge(null)]])});let r,s;arguments.length>1&&(r=arguments[0],s=arguments[1],arguments.length>2&&(e=arguments[2]),arguments.length>3&&(t=arguments[3])),this.renderTargetEdges=new Pt(1,1,{minFilter:xt,stencilBuffer:!1,depthBuffer:!1}),this.renderTargetEdges.texture.name="SMAA.Edges",this.renderTargetWeights=this.renderTargetEdges.clone(),this.renderTargetWeights.texture.name="SMAA.Weights",this.uniforms.get("weightMap").value=this.renderTargetWeights.texture,this.clearPass=new Mx(!0,!1,!1),this.clearPass.overrideClearColor=new Je(0),this.clearPass.overrideClearAlpha=1,this.edgeDetectionPass=new vs(new lY),this.edgeDetectionMaterial.edgeDetectionMode=t,this.edgeDetectionMaterial.predicationMode=i,this.weightsPass=new vs(new vY);let a=new VM;a.onLoad=()=>{let n=new li(r);n.name="SMAA.Search",n.magFilter=St,n.minFilter=St,n.generateMipmaps=!1,n.needsUpdate=!0,n.flipY=!0,this.weightsMaterial.searchTexture=n;let o=new li(s);o.name="SMAA.Area",o.magFilter=xt,o.minFilter=xt,o.generateMipmaps=!1,o.needsUpdate=!0,o.flipY=!1,this.weightsMaterial.areaTexture=o,this.dispatchEvent({type:"load"})},a.itemStart("search"),a.itemStart("area"),r!==void 0&&s!==void 0?(a.itemEnd("search"),a.itemEnd("area")):typeof Image<"u"&&(r=new Image,s=new Image,r.addEventListener("load",()=>a.itemEnd("search")),s.addEventListener("load",()=>a.itemEnd("area")),r.src=UA,s.src=NA),this.applyPreset(e)}get edgesTexture(){return this.renderTargetEdges.texture}getEdgesTexture(){return this.edgesTexture}get weightsTexture(){return this.renderTargetWeights.texture}getWeightsTexture(){return this.weightsTexture}get edgeDetectionMaterial(){return this.edgeDetectionPass.fullscreenMaterial}get colorEdgesMaterial(){return this.edgeDetectionMaterial}getEdgeDetectionMaterial(){return this.edgeDetectionMaterial}get weightsMaterial(){return this.weightsPass.fullscreenMaterial}getWeightsMaterial(){return this.weightsMaterial}setEdgeDetectionThreshold(e){this.edgeDetectionMaterial.edgeDetectionThreshold=e}setOrthogonalSearchSteps(e){this.weightsMaterial.orthogonalSearchSteps=e}applyPreset(e){let t=this.edgeDetectionMaterial,i=this.weightsMaterial;switch(e){case Bo.LOW:t.edgeDetectionThreshold=.15,i.orthogonalSearchSteps=4,i.diagonalDetection=!1,i.cornerDetection=!1;break;case Bo.MEDIUM:t.edgeDetectionThreshold=.1,i.orthogonalSearchSteps=8,i.diagonalDetection=!1,i.cornerDetection=!1;break;case Bo.HIGH:t.edgeDetectionThreshold=.1,i.orthogonalSearchSteps=16,i.diagonalSearchSteps=8,i.cornerRounding=25,i.diagonalDetection=!0,i.cornerDetection=!0;break;case Bo.ULTRA:t.edgeDetectionThreshold=.05,i.orthogonalSearchSteps=32,i.diagonalSearchSteps=16,i.cornerRounding=25,i.diagonalDetection=!0,i.cornerDetection=!0;break}}setDepthTexture(e,t=xn){this.edgeDetectionMaterial.depthBuffer=e,this.edgeDetectionMaterial.depthPacking=t}update(e,t,i){this.clearPass.render(e,this.renderTargetEdges),this.edgeDetectionPass.render(e,t,this.renderTargetEdges),this.weightsPass.render(e,this.renderTargetEdges,this.renderTargetWeights)}setSize(e,t){this.edgeDetectionMaterial.setSize(e,t),this.weightsMaterial.setSize(e,t),this.renderTargetEdges.setSize(e,t),this.renderTargetWeights.setSize(e,t)}dispose(){let{searchTexture:e,areaTexture:t}=this.weightsMaterial;e!==null&&t!==null&&(e.dispose(),t.dispose()),super.dispose()}static get searchImageDataURL(){return UA}static get areaImageDataURL(){return NA}},pQ=`uniform float offset;uniform float darkness;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){const vec2 center=vec2(0.5);vec3 color=inputColor.rgb; 5696#if VIGNETTE_TECHNIQUE == 0 5697float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offset)); 5698#else 5699vec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord)); 5700#endif 5701outputColor=vec4(color,inputColor.a);}`,dp={DEFAULT:0,ESKIL:1},fQ=class extends Ta{constructor({blendFunction:e=It.NORMAL,technique:t=dp.DEFAULT,eskil:i=!1,offset:r=.5,darkness:s=.5}={}){super("VignetteEffect",pQ,{blendFunction:e,defines:new Map([["VIGNETTE_TECHNIQUE",t.toFixed(0)]]),uniforms:new Map([["offset",new ge(r)],["darkness",new ge(s)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(e){this.technique!==e&&(this.defines.set("VIGNETTE_TECHNIQUE",e.toFixed(0)),this.setChanged())}get eskil(){return this.technique===dp.ESKIL}set eskil(e){this.technique=e?dp.ESKIL:dp.DEFAULT}getTechnique(){return this.technique}setTechnique(e){this.technique=e}get offset(){return this.uniforms.get("offset").value}set offset(e){this.uniforms.get("offset").value=e}getOffset(){return this.offset}setOffset(e){this.offset=e}get darkness(){return this.uniforms.get("darkness").value}set darkness(e){this.uniforms.get("darkness").value=e}getDarkness(){return this.darkness}setDarkness(e){this.darkness=e}},bn=class{constructor(e,t){this.enabled=!1,this.effect=new e(t),Object.defineProperty(this,"opacity",{enumerable:!0,set(i){this.effect.blendMode.opacity.value=i},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(i){this.effect.blendMode.setBlendFunction(Number(i))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=It.NORMAL}dispose(){this.effect.dispose()}},mQ=class extends bn{constructor(){super(QY),this.blendFunction=It.SCREEN}set intensity(e){this.effect.intensity=e}get intensity(){return this.effect.intensity}set luminanceThreshold(e){this.effect.luminanceMaterial.threshold=e}get luminanceThreshold(){return this.effect.luminanceMaterial.threshold}set luminanceSmoothing(e){this.effect.luminanceMaterial.smoothing=e}get luminanceSmoothing(){return this.effect.luminanceMaterial.smoothing}set blurScale(e){this.effect.blurPass.scale=e}get blurScale(){return this.effect.blurPass.scale}set kernelSize(e){this.effect.blurPass.kernelSize=e}get kernelSize(){return this.effect.blurPass.kernelSize}},gQ=class extends bn{constructor(){super(ZY)}set contrast(e){this.effect.uniforms.get("contrast").value=e}get contrast(){return this.effect.uniforms.get("contrast").value}set brightness(e){this.effect.uniforms.get("brightness").value=e}get brightness(){return this.effect.uniforms.get("brightness").value}},vQ=class extends bn{constructor(){super(iQ),this.effect.offset=new H(.01,.01)}set offset(e){this.effect.offset.set(e[0]/1e3,e[1]/1e3)}get offset(){return[this.effect.offset.x*1e3,this.effect.offset.y*1e3]}},yQ=class extends bn{constructor(){super($Y)}},xQ=class extends bn{constructor(){super(nQ),this._hue=0}set hue(e){this._hue=e,this.effect.setHue(e)}get hue(){return this._hue}set saturation(e){this.effect.uniforms.get("saturation").value=e}get saturation(){return this.effect.uniforms.get("saturation").value}},bQ=class extends bn{constructor(){super(lQ),this.blendFunction=It.OVERLAY}},wQ=class extends bn{constructor(){super(fQ)}get eskil(){return this.effect.eskil}set eskil(e){this.effect.eskil=e}get darkness(){return this.effect.uniforms.get("darkness").value}set darkness(e){this.effect.uniforms.get("darkness").value=e}get offset(){return this.effect.uniforms.get("offset").value}set offset(e){this.effect.uniforms.get("offset").value=e}},SQ=class extends bn{constructor(e){super(sQ)}set focalLength(e){this.effect.circleOfConfusionMaterial.uniforms.focalLength.value=e/2e3}get focalLength(){return this.effect.circleOfConfusionMaterial.uniforms.focalLength.value}set focusDistance(e){this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value=this.isPerspectiveCamera?e/2e3:(e+992)/2e3}get focusDistance(){return this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value}get bokehScale(){return this.effect.bokehScale}set bokehScale(e){this.effect.bokehScale=e}setCamera(e){let t=!1;(e.isPerspectiveCamera&&this.isPerspectiveCamera===!1||!e.isPerspectiveCamera&&this.isPerspectiveCamera===!0)&&(t=!0),e.isPerspectiveCamera?(this.effect.circleOfConfusionMaterial.adoptCameraSettings(e.perspCamera),this.isPerspectiveCamera=!0):(this.effect.circleOfConfusionMaterial.adoptCameraSettings(e),this.isPerspectiveCamera=!1),t&&this.effect.setChanged()}},_Q=class extends bn{constructor(){super(cQ)}get granularity(){return this.effect.getGranularity()}set granularity(e){this.effect.setGranularity(e)}},AQ=`#define GLSLIFY 1 5702varying vec2 vUv;varying vec2 vTexCoords[9];uniform vec2 resolution;void main(){vUv=position.xy*0.5+0.5;vec2 texelSize=vec2(1.0)/resolution;vTexCoords[0]=vUv+vec2(-texelSize.x,-texelSize.y);vTexCoords[1]=vUv+vec2(0.0,-texelSize.y);vTexCoords[2]=vUv+vec2(texelSize.x,-texelSize.y);vTexCoords[3]=vUv+vec2(-texelSize.x,0.0);vTexCoords[4]=vUv+vec2(0.0,0.0);vTexCoords[5]=vUv+vec2(texelSize.x,0.0);vTexCoords[6]=vUv+vec2(-texelSize.x,texelSize.y);vTexCoords[7]=vUv+vec2(0.0,texelSize.y);vTexCoords[8]=vUv+vec2(texelSize.x,texelSize.y);gl_Position=vec4(position.xy,1.0,1.0);}`,MQ=`#define GLSLIFY 1 5703#include <common> 5704varying vec2 vUv;varying vec2 vTexCoords[9];uniform sampler2D inputBuffer;uniform sampler2D historyBuffer;uniform sampler2D velocityBuffer;uniform sampler2D depthBuffer;uniform vec2 resolution; 5705#define USE_YCOCG 5706#define USE_CATMULL_ROM 5707const float feedback_min=0.5;const float feedback_max=0.95;vec3 RGB_YCoCg(vec3 c){return vec3(c.x/4.0+c.y/2.0+c.z/4.0,c.x/2.0-c.z/2.0,-c.x/4.0+c.y/2.0-c.z/4.0);}vec3 YCoCg_RGB(vec3 c){return clamp(vec3(c.x+c.y-c.z,c.x+c.z,c.x-c.y-c.z),vec3(0.0),vec3(1.0));}vec4 sample_color(sampler2D tex,vec2 uv){ 5708#ifdef USE_YCOCG 5709vec4 c=texture(tex,uv);return vec4(RGB_YCoCg(c.rgb),c.a); 5710#else 5711return texture(tex,uv); 5712#endif 5713}vec4 sample_catmull_rom(sampler2D tex,vec2 uv,vec2 texSize){vec2 samplePos=uv*texSize;vec2 texPos1=floor(samplePos-0.5)+0.5;vec2 f=samplePos-texPos1;vec2 w0=f*(-0.5+f*(1.0-0.5*f));vec2 w1=1.0+f*f*(-2.5+1.5*f);vec2 w2=f*(0.5+f*(2.0-1.5*f));vec2 w3=f*f*(-0.5+0.5*f);vec2 w12=w1+w2;vec2 offset12=w2/(w1+w2);vec2 texPos0=texPos1-1.0;vec2 texPos3=texPos1+2.0;vec2 texPos12=texPos1+offset12;texPos0/=texSize;texPos3/=texSize;texPos12/=texSize;vec4 result=vec4(0.0);result+=texture2D(tex,vec2(texPos12.x,texPos0.y))*w12.x*w0.y;result+=texture2D(tex,vec2(texPos0.x,texPos12.y))*w0.x*w12.y;result+=texture2D(tex,vec2(texPos12.x,texPos12.y))*w12.x*w12.y;result+=texture2D(tex,vec2(texPos3.x,texPos12.y))*w3.x*w12.y;result+=texture2D(tex,vec2(texPos12.x,texPos3.y))*w12.x*w3.y;return result;}vec3 choose_motion_vector(){ 5714#ifdef CHOOSE_LONGEST_MOTION_VECTOR 5715float longest=-1.0;vec3 v_choose=vec3(-1.0);for(int i=0;i<9;i++){vec3 v=texture2D(velocityBuffer,vTexCoords[i]).rgb;float l=length(v.xy);if(l>longest){longest=l;v_choose=v;}}return v_choose; 5716#else 5717float closest_depth=1000.0;vec2 closest_uv_offset=vec2(0.0);for(int i=0;i<9;i++){float neighbor_depth=texture2D(depthBuffer,vTexCoords[i]).r;if(neighbor_depth<closest_depth){closest_uv_offset=vTexCoords[i];closest_depth=neighbor_depth;}}return texture2D(velocityBuffer,closest_uv_offset).rgb; 5718#endif 5719}vec4 clipAabb(vec3 aabb_min,vec3 aabb_max,vec4 avg,vec4 input_texel){const float FLT_EPS=0.00000001;vec3 p_clip=0.5*(aabb_max+aabb_min);vec3 e_clip=0.5*(aabb_max-aabb_min)+FLT_EPS;vec4 v_clip=input_texel-vec4(p_clip,avg.w);vec3 v_unit=v_clip.xyz/e_clip;vec3 a_unit=abs(v_unit);float ma_unit=max(a_unit.x,max(a_unit.y,a_unit.z));if(ma_unit>1.0){return vec4(p_clip,avg.w)+v_clip/ma_unit;}else{return input_texel;}}vec3 clip_aabb_variance(in vec3 cOld,in vec3 cNew,in vec3 centre,in vec3 halfSize){if(all(lessThanEqual(abs(cOld-centre),halfSize))){return cOld;}vec3 dir=(cNew-cOld);vec3 near=centre-sign(dir)*halfSize;vec3 tAll=(near-cOld)/dir;float t=0.0001;for(int i=0;i<3;i++){if(tAll[i]>=0.0&&tAll[i]<t){t=tAll[i];}}if(t>=0.0001){return cOld;}return cOld+dir*t;}void main(){vec3 v=choose_motion_vector();vec2 velocity=v.rg;vec2 previousPixelPos=vUv-velocity;vec4 currentColor=sample_color(inputBuffer,vUv); 5720#ifdef USE_CATMULL_ROM 5721vec4 previousColor=sample_catmull_rom(historyBuffer,previousPixelPos,resolution); 5722#else 5723vec4 previousColor=sample_color(historyBuffer,previousPixelPos); 5724#endif 5725#ifdef USE_YCOCG 5726previousColor=vec4(RGB_YCoCg(previousColor.rgb),previousColor.a); 5727#endif 5728vec4 ctl=sample_color(inputBuffer,vTexCoords[0]);vec4 ctc=sample_color(inputBuffer,vTexCoords[1]);vec4 ctr=sample_color(inputBuffer,vTexCoords[2]);vec4 cml=sample_color(inputBuffer,vTexCoords[3]);vec4 cmc=sample_color(inputBuffer,vTexCoords[4]);vec4 cmr=sample_color(inputBuffer,vTexCoords[5]);vec4 cbl=sample_color(inputBuffer,vTexCoords[6]);vec4 cbc=sample_color(inputBuffer,vTexCoords[7]);vec4 cbr=sample_color(inputBuffer,vTexCoords[8]);vec4 cmin=min(ctl,min(ctc,min(ctr,min(cml,min(cmc,min(cmr,min(cbl,min(cbc,cbr))))))));vec4 cmax=max(ctl,max(ctc,max(ctr,max(cml,max(cmc,max(cmr,max(cbl,max(cbc,cbr))))))));
5728vec4 cavg=(ctl+ctc+ctr+cml+cmc+cmr+cbl+cbc+cbr)/9.0;vec4 cmin5=min(ctc,min(cml,min(cmc,min(cmr,cbc))));vec4 cmax5=max(ctc,max(cml,max(cmc,max(cmr,cbc))));vec4 cavg5=(ctc+cml+cmc+cmr+cbc)/5.0;cmin=0.5*(cmin+cmin5);cmax=0.5*(cmax+cmax5);cavg=0.5*(cavg+cavg5); 5729#ifdef USE_YCOCG 5730vec2 chroma_extent=vec2(0.25*0.5*(cmax.r-cmin.r));vec2 chroma_center=currentColor.gb;cmin.yz=chroma_center-chroma_extent;cmax.yz=chroma_center+chroma_extent;cavg.yz=chroma_center; 5731#endif 5732vec4 previousColorClipped=clamp(previousColor,cmin,cmax); 5733#ifdef LUMINANCE_DIFFERENCES 5734#ifdef USE_YCOCG 5735float lum0=currentColor.r;float lum1=previousColorClipped.r; 5736#else 5737float lum0=luminance(currentColor.rgb);float lum1=luminance(previousColorClipped.rgb); 5738#endif 5739float unbiased_diff=abs(lum0-lum1)/max(lum0,max(lum1,0.2));float unbiased_weight=1.0-unbiased_diff;float unbiased_weight_sqr=unbiased_weight*unbiased_weight;float k_feedback=mix(feedback_min,feedback_max,unbiased_weight_sqr);vec4 result=mix(currentColor,previousColorClipped,vec4(k_feedback)); 5740#else 5741const float alpha=0.1;vec4 result=mix(currentColor,previousColorClipped,1.0-alpha); 5742#endif 5743#ifdef USE_YCOCG 5744gl_FragColor=vec4(YCoCg_RGB(result.rgb).rgb,result.a); 5745#else 5746gl_FragColor=result; 5747#endif 5748}`,EQ=`#define GLSLIFY 1 5749varying vec2 vUv;void main(){gl_Position=vec4(position.xy,1.0,1.0);vUv=position.xy*0.5+0.5;}`,CQ=`#define GLSLIFY 1 5750layout(location=1)out vec4 gVelocity;varying vec2 vUv;uniform sampler2D inputBuffer;void main(){gl_FragColor=texture2D(inputBuffer,vUv);gVelocity=vec4(0.0);}`,Py=class extends Dt{constructor(){super({name:"PassthroughMaterial",uniforms:{inputBuffer:new ge(null)},blending:Ri,depthWrite:!1,depthTest:!1,vertexShader:EQ,fragmentShader:CQ})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}},TQ=class extends kr{constructor(){super("TAAResolvePass"),this.MRTCompatible=!0,this.needsSwap=!1,this.passThroughMaterial=new Py,this.resolutionVector=new H,this.resolveMaterial=new Dt({name:"TAAResolveMaterial",uniforms:{inputBuffer:new ge(null),historyBuffer:new ge(null),velocityBuffer:new ge(null),depthBuffer:new ge(null),resolution:new ge(new H)},blending:Ri,depthWrite:!1,depthTest:!1,vertexShader:AQ,fragmentShader:MQ}),this.historyRenderTarget=new Pt(1024,1024,{minFilter:xt,stencilBuffer:!1,depthBuffer:!1}),this.historyRenderTarget.texture.name="TAA.History",this.resultRenderTarget=new Pt(1024,1024,{minFilter:xt,stencilBuffer:!1,depthBuffer:!1}),this.resultRenderTarget.texture.name="TAA.Output"}setSize(e,t){this.historyRenderTarget.setSize(e,t),this.resultRenderTarget.setSize(e,t)}render(e,t){this.fullscreenMaterial=this.resolveMaterial,this.resolveMaterial.uniforms.inputBuffer.value=t.texture[0],this.resolveMaterial.uniforms.velocityBuffer.value=t.texture[1],this.resolveMaterial.uniforms.depthBuffer.value=t.depthTexture,this.resolveMaterial.uniforms.historyBuffer.value=this.historyRenderTarget.texture,this.resolveMaterial.uniforms.resolution.value.set(t.width,t.height),e.setRenderTarget(this.resultRenderTarget),e.render(this.scene,this.camera),this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=this.resultRenderTarget.texture,e.setRenderTarget(this.historyRenderTarget),e.render(this.scene,this.camera);let i=this.renderToScreen?null:t;this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=this.resultRenderTarget.texture,e.setRenderTarget(i),e.render(this.scene,this.camera)}dispose(){super.dispose(),this.resultRenderTarget.dispose(),this.historyRenderTarget.dispose(),this.resolveMaterial.dispose(),this.passThroughMaterial.dispose()}},PQ=class extends kr{constructor(e,t,i){super("TransmissionPass",void 0,t),this.MRTCompatible=!0,this.depthPass=new FA(e,t,{renderTarget:i.transmissionDepthTarget}),this.passThroughMaterial=new Py,this.splineScene=e,this.needsSwap=!1}updatePasses(e){this.passThroughMaterial.dispose(),this.passThroughMaterial=new Py,this.depthPass.dispose(),this.depthPass=new FA(this.splineScene,this.camera,{renderTarget:e.transmissionDepthTarget})}setCamera(e){this.camera=e}setScene(e){this.splineScene=e}render(e,t,i){let r=this.camera.layers.mask,s=e;s.setRenderTarget(s.transmissionRenderTarget),this.fullscreenMaterial=this.passThroughMaterial,this.passThroughMaterial.inputBuffer=t.texture[0],s.clear(),s.render(this.scene,this.camera),this.camera.layers.disable(3),this.depthPass.render(e,t,i),s.shadowMap.needsUpdate=!1,s.shadowMap.autoUpdate=!1;let a=this.renderToScreen?null:t;this.camera.layers.set(3),e.setRenderTarget(a),e.render(this.splineScene,this.camera),this.camera.layers.mask=r}dispose(){super.dispose(),this.depthPass?.renderPass.dispose(),this.depthPass.dispose(),this.passThroughMaterial.dispose(),this.depthPass=void 0,this.passThroughMaterial=void 0,this.splineScene=void 0,this.scene=void 0,this.camera=void 0}},VA=new Qr,DQ=new Dt({transparent:!0,vertexShader:` 5751 void main() { 5752 gl_Position = vec4(0.0); 5753 } 5754 `,fragmentShader:` 5755 layout(location = 1) out vec4 gVelocity; 5756 5757 void main() { 5758 gl_FragColor = vec4(0.0); 5759 gVelocity = vec4(0.0); 5760 } 5761 `}),Dy=class extends kr{constructor(e,t,i){super("OpaquePass",t??VA,i),this.MRTCompatible=!0,this.originalMaterials=[],this.hasTransmissionPass=!1,this.clear=!0,this.clearColorOnly=!1,this.clearDepth=!1,this.needsSwap=!1,this.MRTCompatible=e}setCamera(e){this.camera=e}setScene(e){this.scene=e??VA}getScene(){return this.scene}render(e,t){this.camera.layers.enable(3),this.hasTransmissionPass&&(this.originalMaterials.length=0,this.scene.traverse(r=>{r.layers.isEnabled(3)&&r instanceof xr&&(this.originalMaterials.push([r,r.material]),r.material=DQ)}),e.shadowMap.needsUpdate=!0,e.shadowMap.autoUpdate=!0),this.camera.layers.enable(8);let i=this.renderToScreen?null:t;e.setRenderTarget(i),this.clearColorOnly&&e.clear(!0,!1,!0),this.clear&&e.clear(),e.render(this.scene,this.camera),this.clearDepth&&e.clear(!1,!0,!1),this.hasTransmissionPass&&this.originalMaterials.forEac
vendor: 13,002 bytes, lines 5761-5809
5761h(r=>{r[0].material=r[1]})}dispose(){super.dispose(),this.originalMaterials.length=0,this.scene=void 0,this.camera=void 0}},OQ=class{constructor(e,{depthBuffer:t=!0,stencilBuffer:i=!1,multisampling:r=0,frameBufferType:s=0}={}){this.renderer=e,this.helperStartIndex=0,this.copyPass=new Ty,this.depthTexture=null,this.timer=new XY,this._width=1,this._height=1,this.passes=[],this.helperPasses=[],this.autoRenderToScreen=!0,this.inputBuffer=this.createBuffer(t,i,s,r,!0,"input buffer mrt"),this.inputBufferSingle=this.createBuffer(t,i,s,r,!1," input buffer single"),this.inputBufferSingle.texture.dispose(),this.inputBufferSingle.depthTexture.dispose(),this.inputBufferSingle.texture=this.inputBuffer.texture[0],this.inputBufferSingle.depthTexture=this.inputBuffer.depthTexture,this.outputBuffer=this.inputBuffer.clone(),this.outputBuffer.name="output buffer mrt",this.outputBufferSingle=this.createBuffer(t,i,s,r,!1,"output buffer single"),this.outputBufferSingle.texture.dispose(),this.outputBufferSingle.depthTexture.dispose(),this.outputBufferSingle.texture=this.outputBuffer.texture[0],this.outputBufferSingle.depthTexture=this.outputBuffer.depthTexture,this.setRenderer(e)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(e){let t=this.inputBuffer,i=this.multisampling;i>0&&e>0?(this.inputBuffer.samples=e,this.outputBuffer.samples=e,this.inputBuffer.dispose(),this.outputBuffer.dispose()):i!==e&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),console.log("creating new input buffer"),this.inputBuffer=this.createBuffer(t.depthBuffer,t.stencilBuffer,t.texture.type,e,!0,"new input buffer"),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(e){if(this.renderer=e,e!==null){let t=e.getSize(new H),i=e.getContext().getContextAttributes()?.alpha??!1,r=this.inputBuffer.texture[0].type;r===Mr&&e.outputEncoding===gt&&(this.inputBuffer.texture[0].encoding=gt,this.outputBuffer.texture[0].encoding=gt,this.inputBuffer.dispose(),this.outputBuffer.dispose(),console.log("doing some kinda dispose??")),e.autoClear=!1,this.setSize(t.width,t.height,!1);for(let s of this.passes)s.initialize(e,i,r)}}replaceRenderer(e,t=!0){let i=this.renderer,r=i.domElement.parentNode;return this.setRenderer(e),t&&r!==null&&(r.removeChild(i.domElement),r.appendChild(e.domElement)),i}createDepthTexture(){let e=this.depthTexture=new Ah(this._width,this._height);return this.inputBuffer.depthTexture=e,this.inputBuffer.stencilBuffer?(e.format=el,e.type=qo):e.type=sn,e}deleteDepthTexture(){if(this.depthTexture!==null){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(let e of this.passes)e.setDepthTexture(null)}}createBuffer(e,t,i,r,s,a){let n=this.renderer,o=n===null?new H:n.getDrawingBufferSize(new H),l={minFilter:xt,magFilter:xt,wrapS:si,wrapT:si,stencilBuffer:t,depthBuffer:e},h;return r>0?(h=new Pt(o.width,o.height,l),h.samples=r):(s?(h=new fM(o.width,o.height,2,l),h.texture[1].type=dn):h=new Pt(o.width,o.height,l),h.depthTexture=new Ah(2048,2048),h.depthTexture.type=Ht),i===Mr&&n!==null&&n.outputEncoding===gt&&(Array.isArray(h.texture)?h.texture.forEach(c=>c.encoding=gt):h.texture.encoding=gt),Array.isArray(h.texture)?h.texture.forEach((c,u)=>{c.name=`EffectComposer.Buffer ${s} ${u}`,c.generateMipmaps=!1}):(h.texture.name=`EffectComposer.Buffer ${s}`,h.texture.generateMipmaps=!1),h.name=a,h}addPass(e,t){let i=this.passes,r=this.renderer,s=r.getDrawingBufferSize(new H),a=r.getContext().getContextAttributes()?.alpha??!1,n;if(e.MRTCompatible&&(n=this.inputBuffer.texture[0].type),e.MRTCompatible||(n=this.inputBuffer.texture.type),e.setRenderer(r),e.setSize(s.width,s.height),e.initialize(r,a,n),this.autoRenderToScreen&&(i.length>0&&(i[i.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),t!==void 0?i.splice(t,0,e):i.push(e),this.autoRenderToScreen&&(i[i.length-1].renderToScreen=!0),e.needsDepthTexture||this.depthTexture!==null)if(this.depthTexture===null){let o=this.createDepthTexture();for(e of i)e.setDepthTexture(o)}else e.setDepthTexture(this.depthTexture)}setHelperStartIndex(e){this.helperStartIndex=e}removePass(e){let t=this.passes,i=t.indexOf(e);if(i!==-1&&t.splice(i,1).length>0){if(this.depthTexture!==null){let r=(s,a)=>s||a.needsDepthTexture;t.reduce(r,!1)||e.getDepthTexture()===this.depthTexture&&e.setDepthTexture(null)}this.autoRenderToScreen&&i===t.length&&(e.renderToScreen=!1,t.length>0&&(t[t.length-1].renderToScreen=!0))}}removeAllPasses(){let e=this.passes;e.length>0&&(this.autoRenderToScreen&&(e[e.length-1].renderToScreen=!1),this.passes=[])}render(e){let t=this.renderer,i=this.copyPass,r=this.inputBuffer,s=this.outputBuffer,a=this.inputBufferSingle,n=this.outputBufferSingle,o=!1,l,h,c,u;e===void 0&&(e=this.timer.update().getDelta());for(let d of this.passes)d.enabled&&(d.MRTCompatible?d.render(t,r,s,e,o):d.render(t,a,n,e,o),d.needsSwap&&(o&&(i.renderToScreen=d.renderToScreen,l=t.getContext(),h=t.state.buffers.stencil,h.setFunc(l.NOTEQUAL,1,4294967295),i.render(t,r,s,e,o),h.setFunc(l.EQUAL,1,4294967295)),c=r,u=a,r=s,a=n,s=c,n=u),d instanceof WY?o=!0:d instanceof bY&&(o=!1))}setSize(e,t,i){let r=this.renderer;if(this._width=e,this._height=t,e===void 0||t===void 0){let a=r.getSize(new H);e=a.width,t=a.height}r.setSize(e,t,i);let s=r.getDrawingBufferSize(new H);this.inputBuffer.setSize(s.width,s.height),this.outputBuffer.setSize(s.width,s.height),this.inputBufferSingle.setSize(s.width,s.height),this.outputBufferSingle.setSize(s.width,s.height);for(let a of this.passes)a.setSize(s.width,s.height)}reset(){let e=this.timer.isAutoResetEnabled();this.dispose(),this.autoRenderToScreen=!0,this.timer.setAutoResetEnabled(e)}dispose(){for(let e of this.passes)e.dispose();this.passes=[],this.inputBuffer!==null&&this.inputBuffer.dispose(),this.outputBuffer!==null&&this.outputBuffer.dispose(),this.inputBufferSingle!==null&&this.inputBufferSingle.dispose(),this.outputBufferSingle!==null&&this.outputBufferSingle.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose()}},IQ=new Dt({name:"CombineMaterial",uniforms:{inputBufferA:new ge(null),inputBufferB:new ge(null)},blending:Ri,depthWrite:!1,depthTest:!1,vertexShader:` 5762varying vec2 vUv; 5763void main() { 5764 gl_Position = vec4(position.xy, 1.0, 1.0); 5765 vUv = position.xy * 0.5 + 0.5; 5766} 5767`,fragmentShader:` 5768 varying vec2 vUv; 5769 uniform sampler2D inputBufferA; 5770 uniform sampler2D inputBufferB; 5771 5772 // TODO: Why do we need these when postpro of framemode is enabled??? 5773 layout(location = 1) out vec4 gVelocity; 5774 5775 void main() { 5776 vec4 resA = texture2D(inputBufferA, vUv); 5777 vec4 resB = texture2D(inputBufferB, vUv); 5778 float a = resA.a + resB.a * ( 1.0 - resA.a ); 5779 5780 vec4 res; 5781 res.rgb = resA.rgb + (resB.rgb * (1.0 - resA.a)); 5782 res.a = resA.a + resB.a * (1.0 - resA.a); 5783 gl_FragColor = res; 5784 gVelocity = vec4(0.0); 5785 } 5786`}),RQ=class extends kr{constructor(e){super("HelperPass",void 0,e),this.MRTCompatible=!1,this.fullscreenMaterial=IQ,this.helperPass=new Dy(!1,void 0,this.camera),this.helperPass.hasTransmissionPass=!1,this.helperPass.clear=!1,this.helperPass.renderToScreen=!1,this.helperPassOnTop=new Dy(!1,void 0,this.camera),this.helperPassOnTop.hasTransmissionPass=!1,this.helperPassOnTop.clear=!1,this.helperPassOnTop.renderToScreen=!1;let t=new sP({preset:Bo.LOW,edgeDetectionMode:Sm.COLOR});this.effectPass=new Gf(this.camera,t),this.rt=new Pt(10,10,{minFilter:xt,magFilter:xt,wrapS:si,wrapT:si,depthBuffer:!0})}setSize(e,t){this.rt.setSize(e,t),this.effectPass.setSize(e,t)}set sceneHelpers(e){this.helperPass.setScene(e)}get sceneHelpers(){return this.helperPass.getScene()}set sceneHelpersOnTop(e){this.helperPassOnTop.setScene(e)}get sceneHelpersOnTop(){return this.helperPassOnTop.getScene()}setCamera(e){this.helperPass.setCamera(e),this.helperPassOnTop.setCamera(e)}initialize(e,t,i){super.initialize(e,t,i),this.effectPass.initialize(e,t,i)}dispose(){super.dispose(),this.rt.dispose(),this.effectPass.dispose(),this.helperPass.dispose(),this.helperPassOnTop.dispose()}render(e,t,i){this.rt.depthTexture=t.depthTexture;let r=e.getClearAlpha();e.setClearAlpha(0),this.helperPass.clearDepth=!0,this.helperPass.clearColorOnly=!0,this.helperPass.render(e,this.rt),this.helperPassOnTop.render(e,this.rt),this.effectPass.renderToScreen=!1,this.effectPass.render(e,this.rt,i),this.fullscreenMaterial.uniforms.inputBufferA.value=i.texture,this.fullscreenMaterial.uniforms.inputBufferB.value=t.texture,e.setClearAlpha(r),e.setRenderTarget(null),e.clear(),e.render(this.scene,this.camera)}},LQ=`#define GLSLIFY 1 5787#include <skinning_pars_vertex> 5788#include <morphtarget_pars_vertex> 5789out vec3 n;void main(){ 5790#include <beginnormal_vertex> 5791#include <morphnormal_vertex> 5792#include <skinbase_vertex> 5793#include <skinnormal_vertex> 5794#include <defaultnormal_vertex> 5795#include <begin_vertex> 5796#include <morphtarget_vertex> 5797#include <skinning_vertex> 5798vec4 view_space=viewMatrix*modelMatrix*vec4(transformed,1.0);gl_Position=projectionMatrix*view_space;n=normalize(transformedNormal);}`,zQ=`#define GLSLIFY 1 5799in vec3 n;void main(){gl_FragColor=vec4(n,1.0);}`,BQ=`#define GLSLIFY 1 5800out vec2 v_uv;void main(){v_uv=uv;gl_Position=vec4(position.xy,1.0,1.0);}`,FQ=`#define GLSLIFY 1 5801in vec2 v_uv;const float pi=3.14159265;const float num_steps=4.0;const float num_directions=4.0;uniform float near;uniform float far;uniform float fov;uniform vec4 proj_info;uniform bool is_ortho;uniform vec2 resolution;uniform float radius_of_influence;uniform float radius_in_screen_space;uniform float exponent;uniform vec3 ao_color;uniform float bias;uniform sampler2D texture_depth;uniform sampler2D texture_normals;uniform sampler2D texture_blue_noise;uniform sampler2D texture_blue_noise_in_disk;uniform sampler2D texture_color_pass;uniform int frame_index;uniform bool fog_enabled;uniform float fog_near;uniform float fog_far;vec3 uv_to_view_space(vec2 uv,float eye_z){return vec3((uv*proj_info.xy+proj_info.zw)*(is_ortho ? 1.0 : eye_z),eye_z);}float linearize_depth(float depth_sampled){float z=is_ortho ? depth_sampled : depth_sampled*2.0-1.0;return mix((2.0*near*far)/(far+near-z*(far-near)),near+z*(far-near),float(is_ortho));}vec3 get_view_position(vec2 uv_coords){float linear_depth=linearize_depth(texture(texture_depth,uv_coords).x);return uv_to_view_space(uv_coords,linear_depth);}vec3 min_difference(vec3 p,vec3 right,vec3 left){vec3 v1=right-p;vec3 v2=p-left;return(dot(v1,v1)<dot(v2,v2))? v1 : v2;}vec3 rebuild_normal(in vec2 uv,in vec3 p){vec2 one_over_resolution=1.0/resolution;vec3 r=get_view_position(uv+vec2(one_over_resolution.x,0));vec3 l=get_view_position(uv+vec2(-one_over_resolution.x,0));vec3 t=get_view_position(uv+vec2(0,one_over_resolution.y));vec3 b=get_view_position(uv+vec2(0,-one_over_resolution.y));return normalize(cross(min_difference(p,r,l),min_difference(p,t,b)));}float falloff(float distance_squared){float neg_inv_r2=-1.0/(radius_of_influence*radius_of_influence);return distance_squared*neg_inv_r2+1.0;}float ao_contribution(vec3 P,vec3 N,vec3 S){vec3 to_sample=S-P;float norm_squared=dot(to_sample,to_sample);float norm=sqrt(norm_squared);float cos_theta=dot(N,to_sample)/norm;return clamp(cos_theta-bias,0.0,1.0)*clamp(falloff(norm_squared),0.0,1.0);}float compute_ambient_occlusion(vec2 uv,float radius_in_screen_space,vec3 pc,vec3 view_space_n){vec2 one_over_resolution=1.0/resolution;ivec2 noise_uv=ivec2(int(mod(gl_FragCoord.x,128.0)),int(mod(gl_FragCoord.y,128.0)));float noise=texelFetch(texture_blue_noise,noise_uv,0).r;noise=fract(noise+0.61803398875*float(frame_index));float theta=noise*2.0*3.1415;float ct=cos(theta);float st=sin(theta);float step_size=radius_in_screen_space/(num_steps+1.0);const float angle_step=2.0*pi/num_directions;float contribution=0.0;for(int i=0;i<int(num_directions);++i){float current_pixel=step_size+1.0;for(int j=0;j<int(num_steps);++j){int index=i*int(num_steps)+j;vec2 blue_noise_sample=texelFetch(texture_blue_noise_in_disk,ivec2(index,0),0).rg;vec2 disk_point;disk_point.x=blue_noise_sample.x*ct-blue_noise_sample.y*st;disk_point.y=blue_noise_sample.x*st+blue_noise_sample.y*ct;vec2 sample_direction=disk_point;vec2 snapped_uv=round(current_pixel*sample_direction)*one_over_resolution+uv;vec3 ps=get_view_position(snapped_uv);current_pixel+=step_size;contribution+=ao_contribution(pc,view_space_n,ps);}}float mult=1.0/(1.0-bias);contribution*=mult/(num_directions*num_steps);return clamp(1.0-contribution*2.0,0.0,1.0);} 5802#define USE_GBUFFER_NORMALS 5803void main(){vec3 view_space_p=get_view_position(v_uv); 5804#ifdef USE_GBUFFER_NORMALS 5805vec3 view_space_n=texture(texture_normals,v_uv).rgb;view_space_n.z*=-1.0; 5806#else 5807vec3 view_space_n=-rebuild_normal(v_uv,view_space_p); 5808#endif 5809float radius_ss=radius_in_screen_space/(is_ortho ? 1.0 : view_space_p.z);float ao=compute_ambient_occlusion(v_uv,radius_ss,view_space_p,view_space_n);float final=pow(ao,exponent);if(view_space_p.z>
5809=far){final=1.0;}vec3 color=mix(ao_color,vec3(1.0),final);if(fog_enabled){float fog_factor=smoothstep(fog_near,fog_far,view_space_p.z);color=mix(color,vec3(1.0),fog_factor);}gl_FragColor=vec4(color,1.0);}`,kQ=`#define GLSLIFY 1 5810out vec2 v_uv;void main(){gl_Position=vec4(position.xy,1.0,1.0);v_uv=uv;}`,UQ=`#define GLSLIFY 1 5811in vec2 v_uv;uniform sampler2D texture_ao_lrez;uniform sampler2D texture_depth_lrez;uniform sampler2D texture_depth_hrez;uniform float near;uniform float far;float linearize_depth(float depth_sampled){float z=depth_sampled*2.0-1.0;return(2.0*near*far)/(far+near-z*(far-near));}vec2 nearest_depth_filter(in vec2 uv){vec2 resolution=vec2(textureSize(texture_depth_lrez,0));vec2 texel_size=1.0/resolution;vec2 offset=uv-0.5*texel_size;float d_hrez=texture(texture_depth_hrez,uv).r;float a=abs(d_hrez-texture(texture_depth_lrez,offset).r);float b=abs(d_hrez-texture(texture_depth_lrez,offset+vec2(texel_size.x,0.0)).r);float c=abs(d_hrez-texture(texture_depth_lrez,offset+vec2(0.0,texel_size.y)).r);float d=abs(d_hrez-texture(texture_depth_lrez,offset+vec2(texel_size.x,texel_size.y)).r);float min_diff=min(a,min(b,min(c,d)));if(min_diff==a)return offset;if(min_diff==b)return offset+vec2(texel_size.x,0.0);if(min_diff==c)return offset+vec2(0.0,texel_size.y);if(min_diff==d)return offset+vec2(texel_size.x,texel_size.y);}void main(){ 5812#ifdef DEBUG 5813float d_lrez=texture(texture_depth_lrez,v_uv).r;float d_hrez=texture(texture_depth_hrez,v_uv).r;float output_d=mix(linearize_depth(d_lrez)/far,linearize_depth(d_hrez)/far,step(0.5,v_uv.x));gl_FragColor=vec4(vec3(output_d),1.0); 5814#else 5815vec2 filtered_uv=nearest_depth_filter(v_uv);vec4 ao=texture(texture_ao_lrez,filtered_uv);gl_FragColor=vec4(ao.rgb,1.0);gl_FragColor=ao; 5816#endif 5817}`,Ec=[[.478712,.875764],[-.337956,-.793959],[-.955259,-.028164],[.864527,.325689],[.209342,-.395657],[-.106779,.672585],[.156213,.235113],[-.413644,-.082856],[-.415667,.323909],[.141896,-.93998],[.954932,-.182516],[-.766184,.410799],[-.434912,-.458845],[.415242,-.078724],[.728335,-.491777],[-.058086,-.066401],[.20299,.686837],[-.808362,-.556402],[.507386,-.640839],[-.723494,-.22924],[.48974,.317826],[-.622663,.765301],[-.01064,.929347],[.663146,.647618],[-.096674,-.413835],[.525945,-.321063],[-.122533,.366019],[.195235,-.687983],[-.563203,.098748],[.418563,.561335],[-.378595,.800367],[.826922,.001024],[-.085372,-.766651],[-.92192,.183673],[-.590008,-.721799],[.167751,-.164393],[.032961,-.56253],[.6329,-.107059],[-.46408,.569669],[-.173676,-.958758],[-.242648,-.234303],[-.275362,.157163],[.382295,-.795131],[.562955,.115562],[.190586,.470121],[.770764,-.297576],[.237281,.93105],[-.666642,-.455871],[-.905649,-.298379],[.33952,.157829],[.701438,-.7041],[-.062758,.160346],[-.220674,.957141],[.642692,.432706],[-.77339,-.015272],[-.671467,.24688],[.158051,.062859],[.806009,.527232],[-.05762,-.247071],[.333436,-.51671],[-.550658,-.315773],[-.652078,.589846],[.008818,.530556],[-.210004,.519896]],NQ=new Dt({vertexShader:LQ,fragmentShader:zQ}),Ul=new Dt({vertexShader:kQ,fragmentShader:UQ,uniforms:{texture_ao_lrez:new ge(null),texture_depth_lrez:new ge(null),texture_depth_hrez:new ge(null),near:new ge(null),far:new ge(null)}}),VQ=class extends kr{constructor(e,t){super("AmbientOcclusionPass",void 0,t),this.fogEnabled=!1,this.fogNear=1,this.fogFar=1e3,this.frameIndex=0,this.sanitizeViewport=!1,this._runHalfRes=!0,this._width=1,this._height=1;let i=1024,r=1024;this.gBuffer=new Pt(i,r,{type:Kh?dn:Ht,depthTexture:new Ah(i,r),minFilter:xt,magFilter:xt}),this.depthBufferHighRes=new Pt(i,r,{depthTexture:new Ah(i,r)}),this.aoBuffer=new Pt(i,r,{minFilter:xt,magFilter:xt}),this.splineScene=e,this.splineCamera=t;let s=new Float32Array(Ec.length*2);for(let n=0;n<Ec.length;n++){let o=n*2;s[o+0]=Ec[n][0],s[o+1]=Ec[n][1]}this.blueNoiseInDiskTexture=new zr(s,Ec.length,1,Hp,Ht),this.blueNoiseInDiskTexture.wrapS=rn,this.blueNoiseInDiskTexture.wrapT=rn,this.blueNoiseInDiskTexture.needsUpdate=!0,this.hbaoMaterial=new Dt({vertexShader:BQ,fragmentShader:FQ,uniforms:{near:new ge(null),far:new ge(null),fov:new ge(null),proj_info:new ge(new ot),is_ortho:new ge(!1),resolution:new ge(new H),radius_of_influence:new ge(8),radius_in_screen_space:new ge(1),exponent:new ge(1),ao_color:new ge(new M),bias:new ge(.5),texture_depth:new ge(null),texture_normals:new ge(null),texture_blue_noise:new ge(null),texture_blue_noise_in_disk:new ge(this.blueNoiseInDiskTexture),frame_index:new ge(0),fog_enabled:new ge(!1),fog_near:new ge(1),fog_far:new ge(1e3)}}),this.radius=128,this.aoColor={r:0,g:0,b:0},this.bias=.5,this.hbaoMaterial.uniforms.texture_depth.value=this.gBuffer.depthTexture,this.hbaoMaterial.uniforms.texture_normals.value=this.gBuffer.texture,this.needsSwap=!0,this.aaBuffer=new Pt(i,r,{minFilter:xt,magFilter:xt,wrapS:si,wrapT:si,depthBuffer:!1,type:Ht});let a=new sP({preset:Bo.ULTRA,edgeDetectionMode:Sm.COLOR});this.effectPass=new Gf(this.camera,a)}initialize(e,t,i){super.initialize(e,t,i),this.effectPass.initialize(e,t,i)}setBlueNoiseTexture(e){this.hbaoMaterial.uniforms.texture_blue_noise.value=e}setSize(e,t){this._width=e,this._height=t,this.depthBufferHighRes.setSize(e,t);let i=this._runHalfRes?.5:1,r=e*i,s=t*i;this.gBuffer.setSize(r,s),this.aoBuffer.setSize(r,s),this.hbaoMaterial.uniforms.resolution.value.set(r,s),this.aaBuffer.setSize(r,s),this.effectPass.setSize(r,s)}get runHalfRes(){return this._runHalfRes}set runHalfRes(e){this._runHalfRes=e,this.setSize(this._width,this._height)}setCamera(e){this.splineCamera=e}setScene(e){this.splineScene=e}setDepthTexture(e){this.depthBufferHighRes.depthTexture=e,Ul.uniforms.texture_depth_hrez.value=e,Ul.needsUpdate=!0}render(e,t,i){let r=null,s=null,a=null,n=null,o=c=>{e.setViewport(0,0,c.width,c.height)};this.sanitizeViewport&&(r=new ot,s=new ot,e.getViewport(r),e.getScissor(s),a=e.getScissorTest(),n=e.getRenderTarget(),e.setScissorTest(!1)),this.splineScene.overrideMaterial=NQ;let l=this.splineCamera.layers.mask;if(this.splineCamera.layers.set(5),e.setRenderTarget(this.gBuffer),this.sanitizeViewport&&o(this.gBuffer),e.clear(),e.render(this.splineScene,this.splineCamera),e.setRenderTarget(this.depthBufferHighRes),this.sanitizeViewport&&o(this.depthBufferHighRes),e.clear(),e.render(this.splineScene,this.splineCamera),this.splineScene.overrideMaterial=null,this.splineCamera.layers.mask=l,this.hbaoMaterial.uniforms.radius_of_influence.value=this.radius,this.hbaoMaterial.uniforms.ao_color.value.set(this.aoColor.r,this.aoColor.g,this.aoColor.b),this.hbaoMaterial.uniforms.bi
vendor: 18,057 bytes, lines 5817-5990
5817as.value=this.bias,this.hbaoMaterial.uniforms.fog_enabled.value=this.fogEnabled,this.hbaoMaterial.uniforms.fog_near.value=this.fogNear,this.hbaoMaterial.uniforms.fog_far.value=this.fogFar,this.hbaoMaterial.uniforms.frame_index.value=this.frameIndex,this.frameIndex++,this.splineCamera.isPerspectiveCamera){this.hbaoMaterial.uniforms.near.value=this.splineCamera.perspCamera.near,this.hbaoMaterial.uniforms.far.value=this.splineCamera.perspCamera.far;let c=this.splineCamera.perspCamera.projectionMatrix.elements,u=2/c[0],d=2/c[5],p=-(1-c[8])/c[0],f=-(1+c[9])/c[5];this.hbaoMaterial.uniforms.proj_info.value.set(u,d,p,f);let m=this.splineCamera.perspCamera.fov*(Math.PI/180),g=this.hbaoMaterial.uniforms.resolution.value.y/(Math.tan(m*.5)*2),v=this.hbaoMaterial.uniforms.radius_of_influence.value*.5*g;this.hbaoMaterial.uniforms.radius_in_screen_space.value=v,this.hbaoMaterial.uniforms.is_ortho.value=!1}else{this.hbaoMaterial.uniforms.near.value=this.splineCamera.orthoCamera.near,this.hbaoMaterial.uniforms.far.value=this.splineCamera.orthoCamera.far;let c=this.splineCamera.orthoCamera.projectionMatrix.elements,u=2/c[0],d=2/c[5],p=-(1+c[12])/c[0],f=-(1-c[13])/c[5];this.hbaoMaterial.uniforms.proj_info.value.set(u,d,p,f);let m=.5*(this.hbaoMaterial.uniforms.resolution.value.y/d),g=this.hbaoMaterial.uniforms.radius_of_influence.value*m;this.hbaoMaterial.uniforms.radius_in_screen_space.value=g,this.hbaoMaterial.uniforms.is_ortho.value=!0}let h=e.aoRenderTarget;this.runHalfRes?(this.fullscreenMaterial=this.hbaoMaterial,e.setRenderTarget(this.aoBuffer),this.sanitizeViewport&&o(this.aoBuffer),e.clear(),e.render(this.scene,this.camera),this.fullscreenMaterial=Ul,Ul.uniforms.texture_ao_lrez.value=this.aoBuffer.texture,Ul.uniforms.texture_depth_lrez.value=this.gBuffer.depthTexture,Ul.uniforms.texture_depth_hrez.value=this.depthBufferHighRes.depthTexture,e.setRenderTarget(h),this.sanitizeViewport&&o(h),e.clear(),e.render(this.scene,this.camera)):(this.fullscreenMaterial=this.hbaoMaterial,e.setRenderTarget(this.aaBuffer),this.sanitizeViewport&&o(this.aaBuffer),e.clear(),e.render(this.scene,this.camera),this.effectPass.renderToScreen=!1,this.effectPass.render(e,this.aaBuffer,h)),this.sanitizeViewport&&r&&s&&a!==null&&(e.setRenderTarget(n),e.setViewport(r.x,r.y,r.z,r.w),e.setScissor(s.x,s.y,s.z,s.w),e.setScissorTest(a))}dispose(){super.dispose(),this.gBuffer.dispose(),this.depthBufferHighRes.dispose(),this.aoBuffer.dispose(),this.aaBuffer.dispose(),this.effectPass.dispose(),this.hbaoMaterial.dispose(),this.blueNoiseInDiskTexture.dispose(),this.splineScene=null,this.splineCamera=null}},jQ=` 5818varying vec2 vUv; 5819void main() { 5820 vUv = uv; 5821 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 5822}`,HQ=` 5823uniform sampler2D tInput; 5824uniform sampler2D tMap; 5825uniform vec2 resolution; 5826varying vec2 vUv; 5827 5828uniform vec2 uResolution; 5829uniform vec2 uCoords; 5830 5831// Draws a rectangle at center <st> with size <size> 5832float rectangle(vec2 st, vec2 size) { 5833 size = vec2(0.5) - size * 0.5; 5834 vec2 uv = vec2(step(size.x, st.x), step(size.y, st.y)); 5835 uv *= vec2(step(size.x, 1.0 - st.x), step(size.y, 1.0 - st.y)); 5836 5837 return uv.x * uv.y; 5838} 5839 5840uniform vec2 uSize; 5841uniform float uScale; 5842uniform float uDPR; 5843uniform float uCurrent; 5844uniform vec3 uSceneColor; 5845 5846void main() { 5847 vec2 screenUv = gl_FragCoord.xy / uResolution.xy; 5848 screenUv *= 1.0 / uDPR; 5849 5850 vec2 center = vec2(0.5, -0.5); 5851 vec2 outsideUv = screenUv; 5852 outsideUv += center; 5853 outsideUv -= uCoords.xy / uResolution.xy; 5854 outsideUv = (outsideUv - 0.5) + 0.5; 5855 outsideUv -= center; 5856 vec2 s = (uSize / uResolution) * uScale; 5857 float isOutside = 1.0 - rectangle(outsideUv, s); 5858 5859 vec2 mid = vec2(0.5); 5860 vec2 insideUv = (screenUv - mid + s * mid) / s; 5861 vec4 background = texture2D(tInput, screenUv); 5862 vec4 image = texture2D(tMap, insideUv); 5863 gl_FragColor = mix(image, background, isOutside); 5864} 5865`,GQ=class extends vs{constructor(){super(new Dt({vertexShader:jQ,fragmentShader:HQ,uniforms:{tInput:new ge(null),tMap:new ge(null),uResolution:new ge(new H),uSize:new ge(new H),uCoords:new ge(new H),uScale:new ge(1),uSceneColor:new ge(new Je(16711680)),uDPR:new ge(1),uCurrent:new ge(0)}}),"tInput"),this.needsSwap=!0}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.tMap.value}set texture(e){this.uniforms.tMap.value=e}},WQ=` 5866void main() { 5867 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 5868}`,qQ=` 5869uniform sampler2D toScene; 5870uniform sampler2D fromScene; 5871uniform vec2 resolution; 5872 5873uniform vec2 uResolution; 5874uniform float uDPR; 5875 5876uniform float mixRatio; 5877uniform sampler2D tMixTexture; 5878uniform int useTexture; 5879uniform float threshold; 5880 5881void main() { 5882 vec2 screenUv = gl_FragCoord.xy / uResolution.xy; 5883 screenUv *= 1.0 / uDPR; 5884 5885 vec4 texel1 = texture2D( fromScene, screenUv ); 5886 vec4 texel2 = texture2D( toScene, screenUv ); 5887 5888 if (useTexture==1) { 5889 5890 vec4 transitionTexel = texture2D( tMixTexture, screenUv ); 5891 float r = mixRatio * (1.0 + threshold * 2.0) - threshold; 5892 float mixf=clamp((transitionTexel.r - r)*(1.0/threshold), 0.0, 1.0); 5893 5894 gl_FragColor = mix( texel1, texel2, mixf ); 5895 } else { 5896 5897 gl_FragColor = mix( texel1, texel2, mixRatio ); 5898 5899 } 5900} 5901`,XQ=[],YQ=class extends vs{constructor(){super(new Dt({vertexShader:WQ,fragmentShader:qQ,uniforms:{toScene:new ge(null),fromScene:new ge(null),uResolution:new ge(new H),uDPR:new ge(1),mixRatio:new ge(0),threshold:new ge(.1),useTexture:new ge(0),tMixTexture:{value:XQ[0]}}}),"toScene"),this.needsSwap=!0}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.fromScene.value}set texture(e){this.uniforms.fromScene.value=e}},QQ=` 5902void main() { 5903 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 5904}`,KQ=` 5905uniform sampler2D inputBuffer; 5906uniform sampler2D blurredInputBuffer; 5907uniform sampler2D overlay; 5908uniform float blurIntensity; 5909 5910uniform vec2 uResolution; 5911uniform float uDPR; 5912 5913void main() { 5914 vec2 screenUv = gl_FragCoord.xy / uResolution.xy; 5915 screenUv *= 1.0 / uDPR; 5916 5917 vec4 texel1 = texture2D( overlay, screenUv ); 5918 vec4 texel2 = texture2D( inputBuffer, screenUv ); 5919 vec4 texel3 = texture2D( blurredInputBuffer, screenUv ); 5920 5921 float blurMask2 = max(sign(texel1.a), 0.0) * blurIntensity; 5922 gl_FragColor = mix( mix(texel2, texel3, blurMask2), texel1, texel1.a ); 5923} 5924`,ZQ=class extends vs{constructor(){super(new Dt({vertexShader:QQ,fragmentShader:KQ,uniforms:{inputBuffer:new ge(null),blurredInputBuffer:new ge(null),overlay:new ge(null),uResolution:new ge(new H),uDPR:new ge(1),blurIntensity:new ge(0)}})),this._blurEnabled=!1,this.blurTarget=new Pt(1,1,{minFilter:xt,magFilter:xt,wrapS:si,wrapT:si}),this.blurPass=new Ex({width:window.innerWidth,height:window.innerHeight,kernelSize:_m.HUGE,resolutionScale:.25}),this.blurPass.renderToScreen=!1,this.uniforms.blurredInputBuffer.value=this.blurTarget.texture}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.overlay.value}set texture(e){this.uniforms.overlay.value=e}setResolution(e,t,i=1){this.uniforms.uResolution.value.set(e,t),this.uniforms.uDPR.value=i,this.blurPass.setSize(e,t),this.blurTarget.setSize(e,t),this.blurPass.setSize(e,t)}get uiCanvas(){return this._uiCanvas}set uiCanvas(e){this._uiCanvas=e,e.texture&&(this.uniforms.overlay.value=e.texture);let t=e.frame;if(t){let i=t.data.backgroundBlur,r=i.radius;this._blurEnabled=i.enabled,this.uniforms.blurIntensity.value=this._blurEnabled?1:0,this.blurPass.scale=r/3}}render(e,t,i,r,s){this._blurEnabled&&(this.blurPass.setDepthTexture(this.getDepthTexture()),this.blurPass.render(e,t,this.blurTarget,r,s)),super.render(e,t,i,r,s)}dispose(){super.dispose(),this.blurTarget.dispose(),this.blurPass.dispose(),this.fullscreenMaterial.dispose(),this._uiCanvas=void 0}},JQ=` 5925varying vec2 vUv; 5926void main() { 5927 vUv = uv; 5928 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 5929}`,$Q=` 5930uniform sampler2D tInput; 5931uniform sampler2D tOverlayImage; 5932varying vec2 vUv; 5933uniform vec2 uResolution; 5934uniform vec2 uRightBottom; 5935uniform vec2 uImageSize; 5936uniform float uScale; 5937uniform float uDPR; 5938 5939vec3 blendNormal(vec3 base, vec3 blend) { 5940 return blend; 5941} 5942 5943vec3 blendNormal(vec3 base, vec3 blend, float opacity) { 5944 return (blendNormal(base, blend) * opacity + base * (1.0 - opacity)); 5945} 5946 5947vec4 drawFixedSizeImage(sampler2D image, vec2 screenUV, vec2 imageSize, vec2 imageCoords, vec2 screenSize, float dpr) { 5948 vec2 uv = (screenUV * screenSize * dpr - imageCoords) / (imageSize * dpr); 5949 if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) { 5950 return vec4(0.0); 5951 } 5952 return texture2D(image, uv); 5953} 5954 5955void main() { 5956 vec2 screenUV = gl_FragCoord.xy / (uResolution.xy * uDPR); 5957 vec2 imageCoords = vec2(uResolution.x * uDPR - uImageSize.x * uScale * uDPR - uRightBottom.x * uDPR, uRightBottom.y * uDPR); 5958 vec4 background = texture2D(tInput, screenUV); 5959 vec4 image = drawFixedSizeImage(tOverlayImage, screenUV, uImageSize * uScale, imageCoords, uResolution, uDPR); 5960 gl_FragColor = vec4(blendNormal(background.rgb, image.rgb, image.a), max(background.a, image.a)); 5961} 5962`,eK=class extends vs{constructor(){super(new Dt({vertexShader:JQ,fragmentShader:$Q,uniforms:{tInput:new ge(null),tOverlayImage:new ge(null),uResolution:new ge(new H),uImageSize:new ge(new H),uRightBottom:new ge(new H(20,20)),uScale:new ge(.25),uDPR:new ge(1)}}),"tInput")}get uniforms(){return this.fullscreenMaterial.uniforms}get texture(){return this.uniforms.tOverlayImage.value}set texture(e){this.uniforms.tOverlayImage.value=e,this.uniforms.uImageSize.value.set(e.image.width,e.image.height)}};function jA(e,t){return t&&t.enabled&&e.push(t.effect),e}var tK=e=>Object.values(It).includes(e)?e:It.NORMAL,iK=class extends or{constructor(e,t){super(),this._needsDOFResize=t,this.postprocessingState=Mf.defaultData,this._scene=new Qr,this._camera=new qi,this.effects=new Map,this.blueNoiseTexture=new zr,this._renderToScreen=!0,this._isUIOverlayEnabled=!1,this.clock=new OB,this.renderer=e,this.debug=!1,this.effects.set("bloom",new mQ),this.effects.set("chromaticAberration",new vQ),this.effects.set("vignette",new wQ),this.effects.set("noise",new bQ),this.effects.set("colorAverage",new yQ),this.effects.set("hueSaturation",new xQ),this.effects.set("brightnessContrast",new gQ),this.effects.set("depthOfField",new SQ),this.effects.set("pixelation",new _Q),this.effectComposer=new OQ(this.renderer),this.effectComposer.autoRenderToScreen=!1,this.opaquePass=new Dy(!0,this.scene,this.camera),this.opaquePass.clear=!0,this.transmissionPass=new PQ(this.scene,this.camera,this.renderer),this.aoPass=new VQ(this.scene,this.camera),this.taaPass=new TQ,this.taaPass.renderToScreen=!1,this.helperPass=new RQ(this.camera),this.helperPass.renderToScreen=!1,this.stylesOverlayPass=new GQ,this.stylesOverlayPass.enabled=!1,this.uiOverlayPass=new ZQ,this.uiOverlayPass.enabled=!1,this.logoOverlayPass=new eK,this.logoOverlayPass.enabled=!1,this.sceneTransitionPass=new YQ,this.sceneTransitionPass.enabled=!1,this._initCopyPass(),this._initPasses()}set overlayTexture(e){e!==void 0?(this.stylesOverlayPass.texture=e,this.stylesOverlayPass.enabled=!0):this.stylesOverlayPass.enabled=!1}get overlayTexture(){return this.stylesOverlayPass.texture}set sceneHelpers(e){this.helperPass.sceneHelpers=e}get sceneHelpers(){return this.helperPass.sceneHelpers}set sceneHelpersOnTop(e){this.helperPass.sceneHelpersOnTop=e}get sceneHelpersOnTop(){return this.helperPass.sceneHelpersOnTop}get scene(){return this._scene}set scene(e){this._scene=e,this.opaquePass.setScene(e),this.transmissionPass.setScene(e),this.aoPass.setScene(e)}get camera(){return this._camera}set camera(e){let t=this._camera!==e;this._camera=e,this.opaquePass.setCamera(e),this.transmissionPass.setCamera(e),t&&this.transmissionPass.updatePasses(this.renderer),this.aoPass.setCamera(e),this.helperPass.setCamera(e),this.effects.get("depthOfField").setCamera(e)}updateRenderToScreen(){let e=!1;for(let t=this.effectComposer.passes.length-1;t>=0;t--){let i=this.effectComposer.passes[t];if(i.enabled===!0&&!e&&this._renderToScreen){i.renderToScreen=!0,e=!0;continue}i.renderToScreen=!1}}get isUIOverlayEnabled(){return this._isUIOverlayEnabled}disableUIOverlay(){this._isUIOverlayEnabled=!1}enableUIOverlay(){this._isUIOverlayEnabled=!0}disableHelpers(){this.helperPass.enabled=!1,this.updateRenderToScreen()}enableHelpers(){this.helperPass.enabled=!0,this.updateRenderToScreen()}updateBlueNoiseTexture(e){this.blueNoiseTexture=new zr(e,128,128),this.blueNoiseTexture.wrapS=rn,this.blueNoiseTexture.wrapT=rn,this.blueNoiseTexture.minFilter=St,this.blueNoiseTexture.magFilter=St,this.blueNoiseTexture.needsUpdate=!0}setAmbientOcclusionParams(e,t,i,r,s,a,n,o){this.aoPass.enabled=e,this.aoPass.radius=t,this.aoPass.bias=i,this.aoPass.aoColor=r,this.aoPass.fogEnabled=s,this.aoPass.fogNear=a,this.aoPass.fogFar=n,this.aoPass.runHalfRes!==!o&&(this.aoPass.runHalfRes=!o)}setTransmissionPassEnabled(e){this.transmissionPass.enabled=e,this.opaquePass.hasTransmissionPass=e}_initPasses(){if(this.uvEffectPass?.dispose(),this.effectPass?.dispose(),this.effectComposer.removeAllPasses(),this.transmissionPass.updatePasses(this.renderer),this.effectComposer.addPass(this.aoPass),this.effectComposer.addPass(this.opaquePass),this.effectComposer.addPass(this.transmissionPass),this.effectComposer.addPass(this.taaPass),this.postprocessingState.enabled){let e=[this.effects.get("pixelation")].reduce(jA,[]);e.length>0&&(this.uvEffectPass=new Gf(this.camera,...e),this.uvEffectPass.renderToScreen=!1,this.effectComposer.addPass(this.uvEffectPass));let t=[this.effects.get("chromaticAberration"),this.effects.get("bloom"),this.effects.get("depthOfField"),this.effects.get("colorAverage"),this.effects.get("hueSaturation"),this.effects.get("brightnessContrast"),this.effects.get("vignette"),this.effects.get("noise")].reduce(jA,[]);if(t.length>0&&(this.effectPass=new Gf(this.camera,...t),this.effectPass.renderToScreen=!1,this.effectComposer.addPass(this.effectPass),this._needsDOFResize&&this.effects.get("depthOfField")?.enabled&&window!==void 0)){let i=this.renderer.viewportWidth,r=this.renderer.viewportHeight;this.renderer.setSize(i-1,r-1),this.renderer.setSize(i,r)}}this.effectComposer.addPass(this.stylesOverlayPass),this.effectComposer.addPass(this.uiOverlayPass),this.effectComposer.addPass(this.sceneTransitionPass),this.effectComposer.addPass(this.helperPass),this.effectComposer.addPass(this.logoOverlayPass)}_initCopyPass(){if(this._savePass)return;let e=new H;this.renderer.getDrawingBufferSize(e),this._rt=new Pt(e.x,e.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:rn,wrapT:rn}),this._rt.samples=0,this._savePass=new Ty(this._rt,!1),this._savePass.renderToScreen=!1}setCopyPass(e){this._rt=e,this._savePass=new Ty(this._rt,!1),this.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(e){if(this._renderToScreen===e)return;let t=this.effectComposer;!t||(e===!0?t.removePass(this._savePass):t.addPass(this._savePass),this._renderToScreen=e,this.updateRenderToScreen())}set sceneTransitionFromTexture(e){e!==this.sceneTransitionPass.texture&&(e!==null?this.sceneTransitionPass.enabled=!0:(this.sceneTransitionPass.enabled=!1,this.updateRenderToScreen()),this.sceneTransitionPass.texture=e)}setWatermark(e){this.logoOverlayPass.enabled=e!==null,e&&(this.logoOverlayPass.texture=e)}get texture(){return this._rt&&this._rt.texture}get renderTarget(){return this._rt}updatePostprocessing(e){let{enabled:t,...i}=e,r=!1;t!==this.postprocessingState.enabled&&(r=!0);for(let s of Object.entries(i)){let a=s[1],n=this.effects.get(s[0]);if(n){n.enabled!==a.enabled&&(r=!0),n.enabled=a.enabled;for(let[o,l]of Object.entries(a))o==="blendFunction"?n.blendFunction=tK(l):n[o]=l}}this.postprocessingState=e,r&&this._initPasses()}render(){this.effectComposer.render(this.clock.getDelta())}setScissor(e,t,i,r){e instanceof ot?(this.effectComposer.inputBuffer.scissor.set(e.x,e.y,e.z,e.w),this.effectComposer.outputBuffer.scissor.set(e.x,e.y,e.z,e.w)):(this.effectComposer.inputBuffer.scissor.set(e,t,i,r),this.effectComposer.outputBuffer.scissor.set(e,t,i,r));let s=this.renderer.getPixelRatio();this.effectComposer.inputBuffer.scissor.multiplyScalar(s),this.effectComposer.outputBuffer.scissor.multiplyScalar(s),this.renderer.setScissor(e,t,i,r)}setScissorTest(e){this.effectComposer.inputBuffer.scissorTest=e,this.effectComposer.outputBuffer.scissorTest=e,this.renderer.setScissorTest(e)}setViewport(e,t,i,r){e instanceof ot?(this.effectComposer.inputBuffer.viewport.copy(e),this.effectComposer.outputBuffer.viewport.copy(e)):(this.effectComposer.inputBuffer.viewport.set(e,t,i,r),this.effectComposer.outputBuffer.viewport.set(e,t,i,r))}resize(e,t,i){if(this.effectComposer.setSize(e,t,i),this._rt){let r=this.renderer.getPixelRatio();this._rt.setSize(e*r,t*r)}}dispose(){this.uvEffectPass?.dispose(),this.effectPass?.dispose(),this.effectComposer.dispose(),this.blueNoiseTexture.dispose(),this._rt?.dispose(),this.effects.forEach(e=>e.dispose()),this.effects.clear(),this._scene=void 0,this._camera=void 0,this.renderer=void 0}},rK=e=>` 5963 5964// PCSS implementation based on: 5965// https://www.gamedev.net/articles/programming/graphics/contact-hardening-soft-shadows-made-fast-r4906/ 5966// NOTE: This number affects how big the shadow blur can 5967// possibly get. Bigger number == bigger blur, but less precise results 5968 5969const float gPenumbraFilterSize = 80.0; 5970const int gPenumbraSamples = ${e}; 5971const int gShadowSamples = ${e}; 5972const float gShadowSamplesRpc = 1.0f / float(gShadowSamples); 5973 5974#ifdef USE_SHADOWMAP 5975 #if NUM_DIR_LIGHT_SHADOWS > 0 5976 5977 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; 5978 varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; 5979 5980 struct DirectionalLightShadow { 5981 float shadowBias; 5982 float shadowNormalBias; 5983 float shadowRadius; 5984 vec2 shadowMapSize; 5985 }; 5986 5987 uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; 5988 5989 #endif 5990
5991 #if NUM_SPOT_LIGHT_SHADOWS > 0 5992 5993 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; 5994 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_SHADOWS ]; 5995 5996 struct SpotLightShadow { 5997 float shadowBias; 5998 float shadowNormalBias; 5999 float shadowRadius; 6000 vec2 shadowMapSize; 6001 }; 6002 6003 uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; 6004 6005 #endif 6006 6007 #if NUM_POINT_LIGHT_SHADOWS > 0 6008 6009 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; 6010 varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; 6011 6012 struct PointLightShadow { 6013 float shadowBias; 6014 float shadowNormalBias; 6015 float shadowRadius; 6016 vec2 shadowMapSize; 6017 float shadowCameraNear; 6018 float shadowCameraFar; 6019 }; 6020 6021 uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; 6022 6023 #endif 6024 6025 /* 6026 #if NUM_RECT_AREA_LIGHTS > 0 6027 6028 // TODO (abelnation): create uniforms for area light shadows 6029 6030 #endif 6031 */ 6032 6033float computePenumbra(int index, sampler2D shadowMap, float temporalAngle, float texelSize, vec2 uv, float compare, float texelScalar, float shadowRadius) 6034{ 6035 float penumbra = 1.0; 6036 float blockerDepthAvg = 0.0; 6037 float blockerCount = 0.0; 6038 6039 #pragma unroll_loop_start 6040 for(int i = 0; i < gPenumbraSamples; i ++) 6041 { 6042 vec2 offset = (vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize) * texelScalar; 6043 float depth = unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) ); 6044 6045 if(depth < compare + 0.0001) 6046 { 6047 blockerDepthAvg += depth; 6048 blockerCount++; 6049 } 6050 } 6051 #pragma unroll_loop_end 6052 6053 if (blockerCount > 0.0) 6054 { 6055 blockerDepthAvg /= blockerCount; 6056 6057 // Compute penumbra 6058 penumbra = (compare - blockerDepthAvg) / (blockerDepthAvg); 6059 penumbra *= penumbra; 6060 penumbra *= 200.0 * penumbraSize[min(index, 5 - 1)]; // Magic number that affects how quickly the penumbra grows 6061 6062 return clamp(penumbra, 0.00, 1.0); 6063 } 6064 return 0.0; 6065} 6066 6067float vogelShadow(int index, sampler2D shadowMap, vec2 uv, float texelSize, float compare, float shadowRadius) 6068{ 6069 float shadow = 0.0f; 6070 6071 // NOTE: When using TAA, we should use screen space interleaved gradient noise 6072 vec2 halton = haltonSequence[frameIndex]; 6073 float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton); 6074 float temporalAngle = temporalOffset * PI2; 6075 6076 float texelScalar = (gPenumbraFilterSize) / (texelSize * 1024.); 6077 float penumbra = computePenumbra(index, shadowMap, temporalAngle, texelSize, uv, compare, texelScalar, shadowRadius); 6078 if (penumbra == -1.0) { 6079 return 1.0; 6080 } 6081 6082 #pragma unroll_loop_start 6083 for (int i = 0; i < gShadowSamples; i++) 6084 { 6085 vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize; 6086 // Overall blurring offset 6087 vec2 offset = vogelSample * (shadowRadius * 2.); 6088 6089 // Penumbra offset 6090 offset += vogelSample * (penumbra * texelScalar); 6091 6092 shadow += step( compare, unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) ) ); 6093 } 6094 #pragma unroll_loop_end 6095 6096 return shadow * gShadowSamplesRpc; 6097} 6098 6099 6100 float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { 6101 6102 return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); 6103 6104 } 6105 6106 vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { 6107 6108 return unpackRGBATo2Half( texture2D( shadow, uv ) ); 6109 6110 } 6111 6112 float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ 6113 6114 float occlusion = 1.0; 6115 6116 vec2 distribution = texture2DDistribution( shadow, uv ); 6117 6118 float hard_shadow = step( compare , distribution.x ); // Hard Shadow 6119 6120 if (hard_shadow != 1.0 ) { 6121 6122 float distance = compare - distribution.x ; 6123 float variance = max( 0.00000, distribution.y * distribution.y ); 6124 float softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality 6125 softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed 6126 occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); 6127 6128 } 6129 return occlusion; 6130 6131 } 6132 6133 float getShadow( int i, sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { 6134 6135 float shadow = 1.0; 6136 6137 shadowCoord.xyz /= shadowCoord.w; 6138 shadowCoord.z += shadowBias; 6139 6140 // if ( something && something ) breaks ATI OpenGL shader compiler 6141 // if ( all( something, something ) ) using this instead 6142 6143 bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 ); 6144 bool inFrustum = all( inFrustumVec ); 6145 6146 bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 ); 6147 6148 bool frustumTest = all( frustumTestVec ); 6149 6150 if ( frustumTest ) { 6151 6152 #if defined( SHADOWMAP_TYPE_PCF ) 6153 6154 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 6155 return vogelShadow(i, shadowMap, shadowCoord.xy, texelSize.x, shadowCoord.z, shadowRadius ); 6156 6157 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 6158 6159 vec2 texelSize = vec2( 1.0 ) / shadowMapSize; 6160 float dx = texelSize.x; 6161 float dy = texelSize.y; 6162 6163 vec2 uv = shadowCoord.xy;
6164 vec2 f = fract( uv * shadowMapSize + 0.5 ); 6165 uv -= f * texelSize; 6166 6167 shadow = ( 6168 texture2DCompare( shadowMap, uv, shadowCoord.z ) + 6169 texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + 6170 texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + 6171 texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + 6172 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 6173 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), 6174 f.x ) + 6175 mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 6176 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), 6177 f.x ) + 6178 mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 6179 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), 6180 f.y ) + 6181 mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 6182 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), 6183 f.y ) + 6184 mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 6185 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), 6186 f.x ), 6187 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 6188 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), 6189 f.x ), 6190 f.y ) 6191 ) * ( 1.0 / 9.0 ); 6192 6193 #elif defined( SHADOWMAP_TYPE_VSM ) 6194 6195 shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); 6196 6197 #else // no percentage-closer filtering: 6198 6199 shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); 6200 6201 #endif 6202 6203 } 6204 6205 return shadow; 6206 6207 } 6208 6209 // cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D 6210 // vector suitable for 2D texture mapping. This code uses the following layout for the 6211 // 2D texture: 6212 // 6213 // xzXZ 6214 // y Y 6215 // 6216 // Y - Positive y direction 6217 // y - Negative y direction 6218 // X - Positive x direction 6219 // x - Negative x direction 6220 // Z - Positive z direction 6221 // z - Negative z direction 6222 // 6223 // Source and test bed: 6224 // https://gist.github.com/tschw/da10c43c467ce8afd0c4 6225 6226 vec2 cubeToUV( vec3 v, float texelSizeY ) { 6227 6228 // Number of texels to avoid at the edge of each square 6229 6230 vec3 absV = abs( v ); 6231 6232 // Intersect unit cube 6233 6234 float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); 6235 absV *= scaleToCube; 6236 6237 // Apply scale to avoid seams 6238 6239 // two texels less per square (one texel will do for NEAREST) 6240 v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); 6241 6242 // Unwrap 6243 6244 // space: -1 ... 1 range for each square 6245 // 6246 // #X## dim := ( 4 , 2 ) 6247 // # # center := ( 1 , 1 ) 6248 6249 vec2 planar = v.xy; 6250 6251 float almostATexel = 1.5 * texelSizeY; 6252 float almostOne = 1.0 - almostATexel; 6253 6254 if ( absV.z >= almostOne ) { 6255 6256 if ( v.z > 0.0 ) 6257 planar.x = 4.0 - v.x; 6258 6259 } else if ( absV.x >= almostOne ) { 6260 6261 float signX = sign( v.x ); 6262 planar.x = v.z * signX + 2.0 * signX; 6263 6264 } else if ( absV.y >= almostOne ) { 6265 6266 float signY = sign( v.y ); 6267 planar.x = v.x + 2.0 * signY + 2.0; 6268 planar.y = v.z * signY - 2.0; 6269 6270 } 6271 6272 // Transform to UV space 6273 6274 // scale := 0.5 / dim 6275 // translate := ( center + 0.5 ) / dim 6276 return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); 6277 6278 } 6279 6280 float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { 6281 6282 float shadow = 1.0; 6283 vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); 6284 6285 // for point lights, the uniform @vShadowCoord is re-purposed to hold 6286 // the vector from the light to the world-space position of the fragment. 6287 vec3 lightToPosition = shadowCoord.xyz; 6288 6289 // dp = normalized distance from light to fragment position 6290 float compare = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp? 6291 compare += shadowBias; 6292 6293 // bd3D = base direction 3D 6294 vec3 bd3D = normalize( lightToPosition ); 6295 6296 vec2 halton = haltonSequence[frameIndex]; 6297 float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton); 6298 float temporalAngle = temporalOffset * PI2; 6299 6300 #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_VSM ) 6301 for (int i = 0; i < gShadowSamples; i++) { 6302 vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize; 6303 6304 // Overall blurring offset 6305 vec3 offset = vec3(vogelSample.x, vogelSample.y, -vogelSample.x) * (shadowRadius + 5.); 6306 6307 // NOTE: Removed for now 6308 // Penumbra offset 6309 //offset += vec3(vogelSample.x, vogelSample.y, vogelSample.y) * (penumbra * gPenumbraFilterSize); 6310 6311 shadow += texture2DCompare( shadowMap, cubeToUV( bd3D + offset, texelSize.y ), compare ); 6312 6313 } 6314 return shadow * gShadowSamplesRpc; 6315 6316 #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) 6317 for (int i = 0; i < 16; i++) { 6318 vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize; 6319 6320 // Overall blurring offset 6321 vec3 offset = vec3(vogelSample.x, vogelSample.y, -vogelSample.x) * (shadowRadius + 5.); 6322 6323 shadow += texture2DCompare( shadowMap, cubeToUV( bd3D + offset, texelSize.y ), compare ); 6324 6325 } 6326 return shadow * (1.0 / 16.0); 6327 #else // no percentage-closer filtering 6328 6329 return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), compare ); 6330 6331 #endif 6332 6333 } 6334 6335#endif 6336`,sK=yt.lights_fragment_begin,aK=yt.shadowmask_pars_fragment,HA=null,nK=e=>{switch(e){case"low":return 8;case"medium":return 16;case"high":return 32;default:return 16}},oK=(e="medium")=>{if(HA===e)return!1;HA=e;let t=nK(e);yt.shadowmap_pars_fragment=rK(t);let i=sK.slice();i=i.replace("getShadow( spotShadowMap[ i ]","getShadow( UNROLLED_LOOP_INDEX + 3, spotShadowMap[ i ]"),i=i.replace("getShadow( directionalShadowMap[ i ]","getShadow( UNROLLED_LOOP_INDEX, directionalShadowMap[ i ]"),yt.lights_fragment_begin=i;let r=aK.slice();return r=r.replaceAll("getShadow(","getShadow( UNROLLED_LOOP_INDEX, "),yt.shadowmask_pars_fragment=r,!0},lK=` 6337attribute vec3 randomColor; 6338varying vec3 vNormal; 6339flat out vec3 vColor; 6340#include <skinning_pars_vertex> 6341#include <morphtarget_pars_vertex> 6342 6343void main() 6344{ 6345#include <beginnormal_vertex> 6346#include <morphnormal_vertex> 6347#include <skinbase_vertex> 6348#include <skinnormal_vertex> 6349vec3 transformed = vec3(position); 6350#include <morphtarget_vertex> 6351#include <skinning_vertex> 6352 6353vNormal = normal; 6354vColor = randomColor; 6355gl_Position = projectionMatrix * (modelViewMatrix * vec4(transformed, 1.0)); 6356} 6357`,hK=` 6358uniform float depthContrast; 6359varying vec3 vNormal; 6360flat in vec3 vColor; 6361void main() 6362{ 6363vec3 normal = (normalize(vNormal)).rgb; 6364 6365float contrastDepth = (gl_FragCoord.z - 0.5) * depthContrast + 0.5; 6366 6367vec3 resultColor = mix(mix(vColor, normal, 0.2), vec3(contrastDepth), 0.4); 6368gl_FragColor = vec4(resultColor, vColor.r); 6369gl_FragColor = vec4(resultColor, vColor.r); 6370} 6371`,cv=new Dt({vertexShader:lK,fragmentShader:hK,uniforms:{depthContrast:{value:1}}}
vendor: 15,642 bytes, lines 6371-6372
6371),Mo=new li,GA=new H,cK=class extends _M{constructor(e){super(e),this._pixelRatio=this.getPixelRatio(),this.viewportWidth=1,this.viewportHeight=1,this.resolution=new H,this.dummyCamera=new qi,this.sceneTransitionDuration=0,this.sceneTransitionTimeRemaining=-1,this.isXRCopyPassSet=!1,this.clear=(s=!0,a=!0,n=!0)=>{let o=this.getContext(),l=0;s&&(l|=o.COLOR_BUFFER_BIT),a&&(l|=o.DEPTH_BUFFER_BIT),n&&(l|=o.STENCIL_BUFFER_BIT),o.clear(l),o.clearBufferfv(o.COLOR,1,[0,0,0,1])},this.pipeline=new iK(this,e?.needsDOFResize??!1),this.autoClear=!1;let t=this.setPixelRatio.bind(this),i=this.setSize.bind(this);this.shadowMap.enabled=!0,this.shadowMap.type=Yy,this.dummyCamera.matrixAutoUpdate=!1,this.domElement.removeAttribute("data-engine");let r=this.getContext();if(r&&"drawingBufferColorSpace"in r)try{r.drawingBufferColorSpace="display-p3"}catch(s){console.warn(s)}this.setPixelRatio=s=>{this._pixelRatio!==s&&(this._pixelRatio=s,t(s))},this.setSize=(s,a,n=!0)=>{(this.viewportWidth!==s||this.viewportHeight!==a)&&(this.viewportWidth=s,this.viewportHeight=a,i(s,a,n),this.normalRenderTarget?.setSize(s*this._pixelRatio,a*this._pixelRatio),this._resizeTransmission(s,a),this.transmissionDepthTarget?.setSize(s*this._pixelRatio/2,a*this._pixelRatio/2),this.pipeline.resize(s,a,n))},this._superDispose=this.dispose,this.dispose=this._currentDispose}createAORenderTarget(){this.aoRenderTarget===void 0&&(this.aoRenderTarget=new Pt(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:xt,magFilter:xt,wrapS:si,wrapT:si,depthBuffer:!1}))}_resizeTransmission(e,t){this.transmissionRenderTarget?.setSize(e*this._pixelRatio/(this.hdTransmission?1:2),t*this._pixelRatio/(this.hdTransmission?1:2)),this.aoRenderTarget?.setSize(e*this._pixelRatio/1,t*this._pixelRatio/1)}get hdTransmission(){return Ye.transmissionLod.value===1}set hdTransmission(e){Ye.transmissionLod.value=e===!0?1:2,this._resizeTransmission(this.viewportWidth,this.viewportHeight)}createTransmissionRenderTarget(){this.transmissionRenderTarget===void 0&&(this.transmissionRenderTarget=new Pt(this.viewportWidth*this._pixelRatio/(this.hdTransmission?1:2),this.viewportHeight*this._pixelRatio/(this.hdTransmission?1:2),{generateMipmaps:!0,minFilter:Sh,magFilter:xt,wrapS:si,wrapT:si,depthBuffer:!1}),this.transmissionDepthTarget=new Pt(this.viewportWidth*this._pixelRatio/2,this.viewportHeight*this._pixelRatio/2,{minFilter:St,magFilter:St,depthBuffer:!1}))}createNormalRenderTarget(){this.normalRenderTarget===void 0&&(this.normalRenderTarget=new Pt(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:St,magFilter:St,type:Ht,depthTexture:new Ah(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio)}))}renderNormal(e,t,i){this.normalRenderTarget&&(this.setClearColor(0),i.layers.enable(8),i.layers.disable(0),i.layers.disable(3),t.traverseEntity(r=>{r.layers.isEnabled(8)&&(r.copyPreviousMatrix=!1)}),this.setRenderTarget(this.normalRenderTarget),this.clear(),i instanceof qi?cv.uniforms.depthContrast.value=(i.far-i.near)/1e4:cv.uniforms.depthContrast.value=1,t.overrideMaterial=cv,this.render(t,i),this.setClearColor(t.bgColor,t.bgColor.a),this.setRenderTarget(null),t.overrideMaterial=e.wireframeState?Fy:null,i.layers.enable(0),i.layers.enable(3),t.traverseEntity(r=>{r.layers.isEnabled(8)&&(r.copyPreviousMatrix=!0)}))}renderSplineSceneWithDummyCamera(e,t,i=1){this.dummyCamera.updateCameraState(t.dataPatched),this.dummyCamera.matrix.copy(t.matrixWorld);let r=t.height,s=t.width,a=this.viewportWidth/this.viewportHeight;s<r?s=r*a:r=s/a,this.dummyCamera.setViewplaneSize(s,r);for(let n=0;n<i;n++)this.renderSplineScene(e,this.dummyCamera)}renderSplineScene(e,t,{sceneHelpers:i=this.sceneHelpers,sceneHelpersOnTop:r=this.sceneHelpersOnTop,overrideTransmission:s=void 0,overrideNormal:a=void 0}={}){let n=e instanceof Lx?e.activePage:e,o=n.visible;n.visible=!0;let l=n.scene;this.xr.enabled&&(this.isXRCopyPassSet===!1&&this.getRenderTarget()!==null&&(this.pipeline.setCopyPass(this.getRenderTarget()),this.isXRCopyPassSet=!0),this.xr.updateCamera(t)),this.setClearColor(n.bgColor,n.bgColor.a),n.penumbraSizeArray.forEach((d,p)=>{Ye.penumbraSize.value[p]=d}),Ye.pixelRatioNode.value=this.getPixelRatio(),this.resolution.x!==0&&this.resolution.y!==0?Ye.resolution.value.set(this.resolution.x,this.resolution.y):Ye.resolution.value.set(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio),a!==void 0?(Ye.normalRenderTarget.value=a,Ye.normalRenderTargetDepth.value=Mo):l.needsNormal()&&(this.createNormalRenderTarget(),Ye.normalRenderTarget.value=this.normalRenderTarget.texture,Ye.normalRenderTargetDepth.value=this.normalRenderTarget.depthTexture,this.renderNormal(l,n,t));let h=n.data.ao,c=h.occlusion;if(c&&(this.createAORenderTarget(),Ye.aoRenderTarget.value=this.aoRenderTarget.texture),Ye.aoEnabled.value=c,this.pipeline.setAmbientOcclusionParams(h.occlusion,h.radius,h.bias,n.aoColor,n.fog!==null,n.backupFog.near,n.backupFog.far,h.aoFullRes&&!Kh),this.pipeline.aoPass.setBlueNoiseTexture(this.pipeline.blueNoiseTexture),this.pipeline.isUIOverlayEnabled&&n.uiCanvas?.enabled&&n.uiCanvas.texture&&n.uiCanvas.texture.image.width>0){let d=this.getSize(GA),p=this.getPixelRatio();(n.uiCanvas.width!==this.viewportWidth||n.uiCanvas.height!==this.viewportHeight||n.uiCanvas.dpr!==p)&&n.uiCanvas.applySize({width:this.viewportWidth,height:this.viewportHeight},p),n.uiCanvas.render(this),this.pipeline.uiOverlayPass.uiCanvas=n.uiCanvas,this.pipeline.uiOverlayPass.enabled=!0,this.pipeline.uiOverlayPass.setResolution(d.x,d.y,p),this.pipeline.updateRenderToScreen()}else this.pipeline.uiOverlayPass.enabled=!1,this.pipeline.updateRenderToScreen();if(this.pipeline.logoOverlayPass.enabled){let d=this.getSize(GA),p=this.getPixelRatio();this.pipeline.logoOverlayPass.uniforms.uResolution.value.set(d.x,d.y),this.pipeline.logoOverlayPass.uniforms.uDPR.value=p}let u=!1;if(s!==void 0)Ye.transmissionRenderTarget.value=s,Ye.transmissionRenderTargetDepth.value=Mo,this.pipeline.setTransmissionPassEnabled(!1);else{let d=l.needsTransmission();d&&(this.transmissionRenderTarget===void 0&&(u=!0),this.createTransmissionRenderTarget(),Ye.transmissionRenderTarget.value=this.transmissionRenderTarget.texture,Ye.aspectRatio.value=eq(this.viewportWidth,this.viewportHeight),Ye.transmissionRenderTargetDepth.value=this.transmissionDepthTarget.texture),this.pipeline.setTransmissionPassEnabled(d)}t.layers.enable(3),t.layers.enable(8),this.pipeline.sceneHelpers=i,this.pipeline.sceneHelpersOnTop=r,this.pipeline.taaPass.enabled=Ye.taaEnabled.value,this.pipeline.scene=n,this.pipeline.camera=t,u&&this.pipeline.transmissionPass.updatePasses(this),this.pipeline.postprocessingState!==n.postprocessing&&(this.pipeline.updatePostprocessing(n.postprocessing),!i&&!r&&this.pipeline.disableHelpers()),this.clearAlphaOverride!==void 0&&this.setClearAlpha(this.clearAlphaOverride),l.shapeBlendIntances.forEach(d=>{d.onBeforeShadowPass(this)}),n.overrideMaterial=l.wireframeState?Fy:null,this.pipeline.render(),Ye.taaEnabled.value&&(Ye.frameIndex.value=(Ye.frameIndex.value+1)%16),t instanceof qi&&t.copyHistory(),n.visible=o}renderFromSceneForSceneTransitionPass(e,t,i){this.pipeline.renderToScreen=!1,this.pipeline.renderTarget,this.renderSplineScene(e,t),this.pipeline.sceneTransitionFromTexture=this.pipeline.renderTarget.texture,this.sceneTransitionDuration=i,this.sceneTransitionTimeRemaining=i,this.pipeline.renderToScreen=!0;let r=this.pipeline.sceneTransitionPass.uniforms;r.uDPR.value=window.devicePixelRatio,r.uResolution.value.set(this.domElement.width,this.domElement.height).divideScalar(window.devicePixelRatio)}_currentDispose(){this._superDispose(),this.pipeline.dispose(),this.aoRenderTarget?.dispose(),this.aoRenderTarget=void 0,this.transmissionRenderTarget?.dispose(),this.transmissionRenderTarget=void 0,this.transmissionDepthTarget?.dispose(),this.transmissionDepthTarget=void 0,this.normalRenderTarget?.depthTexture?.dispose(),this.normalRenderTarget?.dispose(),this.normalRenderTarget=void 0,this.dummyCamera.dispose(),this.dummyCamera=void 0,Ye.normalRenderTarget.value=Mo,Ye.normalRenderTargetDepth.value=Mo,Ye.transmissionRenderTarget.value=Mo,Ye.transmissionRenderTargetDepth.value=Mo,Ye.aoRenderTarget.value=Mo}},aP=class extends Gu(XB){constructor(e,t=15,i=10066329){super(e,t,i),this.object=e,this.added=!1,this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){Wu(this.object,aP.geometryHelper,e,t)}},nP=class extends Gu(qB){constructor(e,t=15,i=6710886){super(e,t,i),this.object=e,this.name=`PointLightHelper: ${e.uuid}`}raycast(e,t){Wu(this.object,nP.geometryHelper,e,t)}},Oy=class extends Gu(WB){constructor(e,t=6710886){super(e,t),this.object=e,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){Wu(this.object,Oy.geometryHelper,e,t)}update(){if(this.object!==void 0){let e=Oy._vector,t=this.object.distance?this.object.distance:1e3,i=t*Math.tan(this.object.angle);this.cone.scale.set(i,i,t),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let r=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let s=0,a=this.cone.material.length;s<a;s++)this.cone.material[s].color.set(r);else this.cone.material.color.set(r)}}},oP=Oy;oP._vector=new M;var lP=class extends nn{constructor(){super(),this.caretIndex=0,this._caretVisibleAlpha=1,this._selectionVisibleAlpha=.3,this.current={start:0,end:void 0},this.matrixAutoUpdate=!1,this.caretMesh=new Zt(new Sa(1,1),new pn({transparent:!0,opacity:0,side:Ar})),this.add(this.caretMesh),this.selectionMesh=new Zt(new Sa(1,1),new pn({color:2857471,transparent:!0,depthTest:!1,depthWrite:!1,opacity:0,side:Ar})),this.add(this.selectionMesh),this.hide()}get caretHeight(){return this.object?.AD??0}show(e){this.visible=!0,this.object=e,this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.y=-this.caretHeight*.5,this.setCaretPosition(this.caretIndex),this.update()}hide(){this.visible=!1}update(){if(this.object===void 0)return;this.updateHelperMatrix();let{depth:e}=this.object.geometry.userData.parameters;this.caretMesh.position.z=e,this.selectionMesh.position.z=e}updateHelperMatrix(){if(this.object===void 0)return;let e=this.object,t=e.parent;t!==null&&t.updateWorldMatrix(!0,!1),e.matrixAutoUpdate&&e.updateMatrix(),t!==null?(this.matrixWorld.multiplyMatrices(t.matrixWorld,e.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,e.matrix)):this.matrixWorld.multiplyMatrices(e.hiddenMatrix,e.matrix),this.matrix.copy(this.matrixWorld);for(let i of this.children)i.matrixWorld.copy(this.matrixWorld);e.updateWorldMatrix(!0,!0)}setCaretColor(e){let t=this.caretMesh.material;t.color.setRGB(e.r,e.g,e.b);let i=this._caretVisibleAlpha===t.opacity;this._caretVisibleAlpha=e.a,i&&(t.opacity=this._caretVisibleAlpha)}setSelectionColor(e){this.selectionMesh.material.color.setRGB(e.r,e.g,e.b)}setCaretPosition(e,t={}){if(this.object===void 0)return;this.caretIndex=e;let i=this.object.wrappedText,[r,s]=Wf(i,e),[a,n]=e>0?Wf(i,e-1):[null,null];(e>0&&i.length?i[a].charAt(n):null)===` 6372`&&(r++,s=0),this.current.start=e,this.current.end=void 0;let[o,l]=uv(this.object,r,s),{AD:h,descender:c}=this.object,u=c+h*.5,{width:d,height:p,depth:f}=this.object.geometry.userData.parameters,m=typeof d=="string"?0:d,g=typeof p=="string"?0:p;this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.set(o-m*.5,l+u+g*.5,f),this.hideSelectionMesh(),this.showCaretMesh()}setSelection(e,t){if(this.object===void 0)return;let i=this.object.wrappedText;this.current.start=e,this.current.end=t;let r=[],s=[],a=uK(i,e,t),{lineHeight:n,AD:o,descender:l}=this.object,h=l+o*.5-n*.5;for(let[g,v,y]of a)if(v!==y){let[x,w]=uv(this.object,g,v),[S,b]=uv(this.object,g,y);w+=h,b+=h,b+=n;let E=r.length/3;r.push(x,w,0),r.push(S,w,0),r.push(S,b,0),r.push(x,b,0),s.push(E+0,E+1,E+2),s.push(E+2,E+3,E+0)}let c=new He;c.setIndex(s),c.setAttribute("position",new De(r,3));let{width:u,height:d,depth:p}=this.object.geometry.userData.parameters,f=typeof u=="string"?0:u,m=typeof d=="string"?0:d;this.selectionMesh.geometry.dispose(),this.selectionMesh.geometry=c,this.selectionMesh.position.x=-f*.5,this.selectionMesh.position.y=m*.5,this.selectionMesh.position.z=p,this.showSelectionMesh(),this.hideCaretMesh()}getSelectionFromPosition(e,t,i="previous"){if(this.object===void 0||this.object.font===void 0)return;let r=this.object.wrappedText,s=r.length,a=this.object.lineHeight,n=s*a,{height:o,verticalAlign:l}=this.object.geometry.userData.parameters,h=typeof o=="string"?0:o,c=0;l===3?c=h-n:l===2&&(c=h*.5-n*.5);let u=Math.min(Math.floor(Math.max(Math.min(-t-c,n),0)/a),s-1),d=this.object.charCoords[u],p=this.object.charWidths[u],f=0,m=!1;if(i==="previous"){for(let g=0;g<d.length;g++)if(d[g][0]+p[g]*.5-e>0){f=g,m=!0;break}}else if(i==="closest"){let g=1/0;for(let v=0;v<d.length;v++){let y=d[v][0]+p[v]*.5,x=Math.abs(y-e);x<g&&(g=x,f=v,m=!0)}}else for(let g=0;g<d.length;g++){let v=d[g][0],y=d[g][0]+p[g];if(e>=v&&e<y){f=g,m=!0;break}}return m||(f=d.length),{index:this.getGlobalIndexFromLineAndCharIndexes(r,u,f),lineIndex:u,characterIndex:f}}getGlobalIndexFromLineAndCharIndexes(e,t,i){return e.slice(0,t).reduce((r,s)=>r+=s.length,0)+i}showSelectionMesh(){this.selectionMesh.material.opacity=this._selectionVisibleAlpha}hideSelectionMesh(){this.selectionMesh.material.opacity=0}showCaretMesh(){this.caretMesh.material.opacity=this._caretVisibleAlpha}hideCaretMesh(){this.caretMesh.material.opacity=0}};function uv(e,t,i){let{charCoords:r,charWidths:s,initialOffsetY:a,lineHeight:n}=e;if(r[t]&&r[t].length===0||r.length===0){let c=0,{horizontalAlign:u}=e.data.geometry,d=e.wrappedText,{width:p}=e.geometry.userData.parameters;return d.length===1&&d[0].length===0&&(u===3?c=p*.5:u===2&&(c=p)),[c,a-n*t]}let o=r[t];if(o===void 0||o.length===0)return[0,0];let[l,h]=o[Math.min(i,o.length-1)];return i>=o.length&&(l+=s[t][i-1]),[l,h]}function Wf(e,t){let i=0;for(let r=0;r<e.length;r++){let s=e[r],a=t-i;if(a<=s.length)return[r,a];i+=s.length}return[Math.max(0,e.length-1),e[e.length-1]?.length??0]}function uK(e,t,i){let[r,s]=Wf(e,t),[a,n]=Wf(e,i),o=[];s>=e[r].length&&(r++,s=0);for(let l=r;l<=a;l++){let h=e[l],c=l===r?s:0,u=l===a?n:h.length;o.push([l,c,u])}return o}function dK(e,t){let i=Ti.fromHex(3223857),r=.8;for(let s of e.layers){if(s.data.type==="light"||s.data.type==="displace"||s.data.type==="fresnel"||s.data.type==="matcap"||s.data.type==="texture"||s.data.type==="toon"||s.data.type==="outline"||s.data.type==="transmission"||s.data.type==="noise")continue;let a=typeof s.data.alpha=="string"?Number(t.getVariable(s.data.alpha)):s.data.alpha;if(s.data.type==="color"&&a>.3){i=pK(s.data.color,t),r=a;break}else if((s.data.type==="depth"||s.data.type==="gradient")&&a>.3){let n=fK(s.data);i={r:n[0],g:n[1],b:n[2]},r=typeof s.data.alpha=="string"?1:s.data.alpha;break}}return{...i,a:r}}function pK(e,t){return typeof e=="string"?t.data.colors[e]:e}function fK(e){return e.colors[0]}function mK(e,t){e.shadow.camera.right=t/2,e.shadow.camera.left=-t/2,e.shadow.camera.top=t/2,e.shadow.camera.bottom=-t/2,e.shadow.needsUpdate=!0}var Am=class extends Ax(DB,aP){constructor(e,t,i){super(),this.super_Entity(e,t),this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.top=1250,r.bottom=-1250,r.right=1250,r.left=-1250,r.near=-1e4,r.far=2500;let s=new tf(this.shadow.camera);s.visible=!1,this.gizmos.shadowmap=s}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this.gizmos){let t=this.gizmos[e];
6372t instanceof tf&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}updateState(e,t){this.updateState_Light(e,t);let i=e.depth!==void 0&&e.depth!==this.shadow.camera.far||e.size!==void 0&&e.size/2!==this.shadow.camera.right;e.size!==void 0&&mK(this,e.size),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),e.penumbraSize!==void 0&&t.scene.markPenumbraSizeDirty(),i&&this.update()}},WA=new M,qA=new M,XA=new nt,Mm=class extends Ax(EB,oP){constructor(e,t,i){super(),this.super_Entity(e,t),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.fov=Te.RAD2DEG*2*this.angle,r.aspect=1,r.near=100,r.far=2500;let s=new tf(this.shadow.camera);s.visible=!1,this.gizmos.shadowmap=s,this.update()}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this.gizmos){let t=this.gizmos[e];t instanceof tf&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),qA.setFromMatrixPosition(this.matrixWorld),XA.setFromRotationMatrix(this.matrixWorld),WA.copy(this.up).applyQuaternion(XA).negate().multiplyScalar(this.distance),this.target.position.copy(qA).add(WA),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}updateState(e,t){this.updateState_Light(e,t),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.angle!==void 0&&(this.angle=e.angle),e.penumbra!==void 0&&(this.penumbra=e.penumbra),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.penumbraSize!==void 0&&t.scene.markPenumbraSizeDirty(),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}};function gK(e){let t=(e[0][0]+e[1][1])/2,i=(e[0][0]-e[1][1])/2,r=(e[1][0]+e[0][1])/2,s=(e[1][0]-e[0][1])/2,a=Math.sqrt(t*t+s*s),n=Math.sqrt(i*i+r*r),o=a+n,l=a-n,h=Math.atan2(r,i),c=Math.atan2(s,t),u=(c-h)/2,d=(c+h)/2,p=[[Math.cos(d),Math.sin(d)],[-Math.sin(d),Math.cos(d)]],f=[[o,0],[0,l]],m=[[Math.cos(u),Math.sin(u)],[-Math.sin(u),Math.cos(u)]];return p[0][0]*=-1,p[0][1]*=-1,m[0][0]*=-1,m[1][0]*=-1,[p,f,m]}function Bp(e,t){return[[e[0][0]*t[0][0]+e[0][1]*t[1][0],e[0][0]*t[0][1]+e[0][1]*t[1][1]],[e[1][0]*t[0][0]+e[1][1]*t[1][0],e[1][0]*t[0][1]+e[1][1]*t[1][1]]]}function YA(e){return[[e[0][0],e[1][0]],[e[0][1],e[1][1]]]}function vK(e){let[t,i,r]=gK(e),s=Bp(t,YA(r)),a=Bp(Bp(r,i),YA(r)),n=Math.atan2(s[1][0],s[0][0]),o=[a[0][0],a[1][1]],l=[a[0][1]/a[1][1],a[1][0]/a[0][0]];return{rotation:n,scale:o,shear:l}}function yK({rotation:e,scale:t,shear:i}){let r=Math.cos(e),s=Math.sin(e),a=[[r,-s],[s,r]],n=[[t[0],i[0]*t[1]],[i[1]*t[0],t[1]]],o=Bp(a,n);return[o[0][0],o[1][0],o[0][1],o[1][1]]}var Lt;(e=>{function t(){return[1,0,0,0,1,0,0,0,1]}e.identity=t;function i(b,E=e.identity()){for(let _=0,A=b.length;_<A;_++)E[_]=b[_];return E}e.copy=i;function r(b,E,_,A,C,T){return e.setAbcdef(e.identity(),b,E,_,A,C,T)}e.create=r;function s(b,E,_,A,C,T,I){return b[0]=E,b[1]=A,b[2]=T,b[3]=_,b[4]=C,b[5]=I,b}e.setAbcdef=s;function a(b,E){let[_,A,C,T,I,P]=o(b),[O,k,G,B,U,Q]=o(E),q=O*_+k*C,j=O*A+k*T,X=G*_+B*C,te=G*A+B*T,K=U*_+Q*C+I,Z=U*A+Q*T+P;return e.create(q,j,X,te,K,Z)}e.append=a;function n(b,E){let[_,A,C,T,I,P]=o(b),[O,k,G,B,U,Q]=o(E),q=_,j=A,X=C,te=T;(O!==1||k!==0||G!==0||B!==1)&&(q=_*O+A*G,j=_*k+A*B,X=C*O+T*G,te=C*k+T*B);let K=I*O+P*G+U,Z=I*k+P*B+Q;return e.create(q,j,X,te,K,Z)}e.prepend=n;function o(b){return[b[0],b[3],b[1],b[4],b[2],b[5]]}e.getAbcdef=o;function l(b){let[E,_,A,C,T,I]=e.getAbcdef(b),P=E*C-_*A,O=C/P,k=-_/P,G=-A/P,B=E/P,U=(A*I-C*T)/P,Q=-(E*I-_*T)/P;return e.create(O,k,G,B,U,Q)}e.invert=l;function h([b,E],_){let[A,C,T,I,P,O]=e.getAbcdef(_);return[A*b+T*E+P,C*b+I*E+O]}e.apply=h;function c(b,E){let[_,A,C,T,I,P]=e.getAbcdef(E),O=1/(_*T+C*-A),[k,G]=b;return[T*O*k+-C*O*G+(P*C-I*T)*O,_*O*G+-A*O*k+(-P*_+I*A)*O]}e.applyInverse=c;function u(b,E,_=E){let[A,C,T,I,P,O]=e.getAbcdef(b);return e.setAbcdef(b,A*E,C*_,T*E,I*_,P*E,O*_),b}e.scale=u;function d(b,E){let _=Math.cos(E),A=Math.sin(E),[C,T,I,P,O,k]=e.getAbcdef(b);return e.setAbcdef(b,C*_-T*A,C*A+T*_,I*_-P*A,I*A+P*_,O*_-k*A,O*A+k*_),b}e.rotate=d;function p(b,E,_){let[A,C]=_,T=e.translate(b,-A,-C);return T=e.rotate(T,E),T=e.translate(T,A,C),T}
vendor: 11,706 bytes, line 6372
6372e.rotateAround=p;function f(b,E,_){let[A,C,T,I,P,O]=e.getAbcdef(b);return e.setAbcdef(b,A,C,T,I,P+E,O+_),b}e.translate=f;function m(b,E,_){let[A,C,T,I]=e.getAbcdef(b);return e.setAbcdef(b,A,C,T,I,E,_),b}e.setTranslate=m;function g(b,E,_){let[A,C,T,I]=e.getAbcdef(b);return e.setAbcdef(b,A,C,T,I,E,_),b}e.setPosition=g;function v(b){let[E,_,A,C]=e.getAbcdef(b),T=Math.sqrt(E*E+_*_),I=Math.sqrt(A*A+C*C);return[T,I]}e.getScale=v;function y(b){let[,,,,E,_]=e.getAbcdef(b);return[E,_]}e.getPosition=y;function x(b,E){return e.decompose(b,E).rotation}e.getRotation=x;function w(b,E){let[_,A,C,T,I,P]=e.getAbcdef(b),{rotation:O,scale:k,shear:G}=vK([[_,C],[A,T]]);return{position:[I+(E[0]*_+E[1]*C)-E[0],P+(E[0]*A+E[1]*T)-E[1]],scale:k,rotation:O,shear:G,pivot:E}}e.decompose=w;function S(b,E,_,A,C=[0,0]){let[T,I]=b,[P,O]=A,[k,G,B,U]=yK({rotation:_,scale:E,shear:C}),Q=T-(P*k+O*B)+P,q=I-(P*G+O*U)+O;return e.create(k,G,B,U,Q,q)}e.compose=S})(Lt||(Lt={}));var xK=Math.PI/180;function bK(e,t,i,r,s,a){let n=e-i,o=t-r;return n*n/(s*s)+o*o/(a*a)<=1}function wK(e){return e*xK}var nr=class{constructor(e,t,i){this.uuid=e,this.data=t,this.localMatrix=Lt.identity(),this.worldMatrix=Lt.identity(),this.ignoreCameraZoom=!1,this.visible=!0,this._singleBBox=new Iy,this._recursiveBBox=new Iy,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.stateSelection=null,this.prevState=null,this.currentState=null,this.reversibleToState=null,this.currentTransitionEvent=null,this.previousAction=null,this.name="",this.position=[0,0],this.scale=[1,1],this.rotation=0,this.shear=[0,0],this.emitter=bm(),this.dpr=i.dpr??1,this.dataPatched=t}project(e,t){let i=this.worldMatrix;return t&&(i=Lt.append(t.worldMatrix,i)),Lt.applyInverse(e,i)}intersects(e,t,i,r=!1){return this.visible&&!this.data.raycastLock&&this.intersectsInLocalSpace(...this.project([e,t],i),r)}intersectsInLocalSpace(e,t,i=!1){let{min:r,max:s}=i?this.recursiveBBox:this.singleBBox;return e>=r[0]&&e<=s[0]&&t>=r[1]&&t<=s[1]}applyTransforms(e){e.setTransform(this.worldMatrix,this.ignoreCameraZoom)}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges()),this._recursiveBBox}updateLocalMatrix(){this.localMatrix=Lt.compose(this.position,this.scale,wK(this.rotation),Ko.getPivot(this.dataPatched),this.shear)}updateWorldMatrix(e,t,i){let r=this.parent;t&&r!==null&&r!==void 0&&r.updateWorldMatrix(e,!0,!1),e&&this.updateLocalMatrix(),this.parent?this.worldMatrix=Lt.append(this.parent.worldMatrix,this.localMatrix):this.worldMatrix=Lt.copy(this.localMatrix),this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}get pivot(){return Ko.getPivot(this.data)}getCenter(){return[0,0]}getHalfSize(){return[0,0]}get id(){return this.uuid}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(e=>{e.resetBBoxNeedsUpdateSelf()})}updateTransformState(e){let t=!1;e.position!==void 0&&(t=!0,this.position=e.position),e.rotation!==void 0&&(t=!0,this.rotation=e.rotation),e.scale!==void 0&&(t=!0,this.scale=e.scale),e.shear!==void 0&&(t=!0,this.shear=e.shear),t&&(this.updateWorldMatrix(!0,!1,!0),this.resetBBoxNeedsUpdate())}updateByOp(e,t,i){e.type===0&&e.props.visible!==void 0&&(this.visible=e.props.visible),this.data=t,this.data=t;let r=e,s=Qt(e.path,["states","*"]);if(s!==null){if(e.type===0){let[a]=s;if(this?.stateSelection===a){let n={...e.props};if(delete n.name,Object.values(e.props).some(o=>o===void 0)){let o=this.data;if(o!==void 0){let l=Hi.zoom(o,e.path.slice(2));if(l)for(let h in e.props)e.props[h]===void 0&&h in l&&(n[h]=l[h])}}r={...e,props:n,path:e.path.slice(2)}}}}else if(e.type===0){let a=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(a!==void 0){if(e.props.name!==void 0&&a.name){let{name:o,...l}=a;a=l}let n=Hi.removeOverridden(e.path,e.props,a);r={...e,props:n}}}this.updateByPatchedOpBase(r,Vo.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),i)}changeSelectedState(e,t,i=!1){if(!(this.data.states.length===0&&!i)){for(let r of this.data.states)Vo.toOps(this.data,r.data).forEach(s=>{let a=pf.replaceProps(s,this.data);this.dataPatched=this.data,this.updateByPatchedOp(a,this.data,t)});if(e!==null){let r=this.data.states.data(e);r&&(this.dataPatched=Vo.patch(this.data,r),Vo.toOps(this.data,r).forEach(s=>{this.updateByPatchedOp(s,this.dataPatched,t)}))}i&&this.updateTransformState(this.dataPatched),this.stateSelection=e}}updateState(e,t){e.name!==void 0&&(this.name=e.name),e.visible!==void 0&&(this.visible=e.visible),this.updateTransformState(e)}updateByPatchedOpBase(e,t,i){this.dataPatched=t,this.updateByPatchedOp(e,t,i)}updateByPatchedOp(e,t,i){e.path.length===0&&e.type===0&&this.updateState(e.props,i),this.requestRender()}traverseFrameAncestors(e){this.traverseAncestors(t=>{t.data.type==="frame2d"&&e(t)})}traverseAncestors(e){let t=this.parent;for(;t;)e(t),t=t.parent}requestRender(){this.traverseFrameAncestors(e=>{e.requestRender()})}clone(e){let t=new nr(this.uuid,this.data,e);return t.parent=void 0,t}addEventListener(e,t){this.emitter.on(e,t)}removeEventListener(e,t){this.emitter.off(e,t)}dispatchEvent(e){this.emitter.emit(e.type,{...e,target:e.target??this})}traverseSortNextHelper(){let e=this.parent;if(e){let t=e.children;if(t){let i=t.indexOf(this)+1;return t[i]?t[i]:e.traverseSortNextHelper()}}}sortNext(){let e=this.children;return e&&e.length>0&&e[0]?e[0]:this.traverseSortNextHelper()}isDescendantOf(e){e instanceof nr&&(e=e.uuid);let t=this;for(;t.parent;){if(t.parent.uuid===e)return!0;t=t.parent}return!1}},Bs=class extends nr{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this.context=i,this.children=[]}add(e){e.parent&&e.parent instanceof Bs&&e.parent.remove(e),this.children.push(e),e.parent=this}remove(e){let t=this.children.indexOf(e);t>=0&&(this.children.splice(t,1),e.parent=void 0)}traverse(e){let t=e(this);if(t!==!0)for(let i of this.children)i instanceof Bs?i.traverse(e):t=e(i)}intersectsChildrenHelper(e,t,i,r,s){for(let a of this.children)if(a.intersects(e,t,i,!1)&&(s.push(a),r)||a instanceof Bs&&a.intersectsChildrenHelper(e,t,i,r,s))return!0;return!1}intersectsChildren(e,t,i,r=!1,s=[],a=!1){return this.intersectsChildrenHelper(e,t,i,r,s),s}intersectsChildrenHelperReverse(e,t,i,r,s){for(let a of this.children)if(a instanceof Bs&&a.intersectsChildrenHelperReverse(e,t,i,r,s)||a.intersects(e,t,i,!1)&&(s.push(a),r))return!0;return!1}intersectsChildrenReverse(e,t,i,r=!1,s=[],a=!1){return this.intersectsChildrenHelperReverse(e,t,i,r,s),s}updateWorldMatrix(e,t,i){if(super.updateWorldMatrix(e,t,i),i&&this.children)for(let r of this.children)r.updateWorldMatrix(e,!1,!0)}find(e){let t;return this.traverse(i=>{i.uuid===e&&(t=i)}),t}innerDrawChildren(e){for(let t=this.children.length-1;t>=0;t--)this.children[t].draw(e)}resetBBoxNeedsUpdate(){super.resetBBoxNeedsUpdate(),this.traverse(e=>{e.resetBBoxNeedsUpdateSelf()})}clone(e){let t=new Bs(this.uuid,this.data,e);t.parent=void 0;for(let i of this.children)t.add(i.clone(e));return t}},po=class extends Bs{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this.updateState(t,i)}draw(e){!this.visible||(e.save(),this.applyTransforms(e),this.innerDrawChildren(e),e.restore())}clone(e){let t=new po(this.uuid,this.data,e);t.parent=void 0;for(let i of this.children)t.add(i.clone(e));return t}};function SK(e,t){let[[i,r],[s,a]]=e,[[n,o],[l,h]]=t,c=(i-s)*(o-h)-(r-a)*(n-l);if(c===0)return!1;let u=((i-n)*(o-h)-(r-o)*(n-l))/c,d=-((i-s)*(r-o)-(r-a)*(i-n))/c;return u>=0&&u<=1&&d>=0&&d<=1}var hP=[[-1,1],[-1,-1],[1,-1],[1,1]],QA=(e,t,i)=>{let r=e.getCenter(),s=e.getHalfSize(),a=Lt.append(t,e.worldMatrix);s[0]===0&&s[1]===0?i.push(Lt.apply(r,a)):hP.forEach(n=>{let o=[n[0]*s[0]+r[0],n[1]*s[1]+r[1]];i.push(Lt.apply(o,a))})},Iy=class{constructor(){this.matrix=Lt.identity(),this.min=[1/0,1/0],this.max=[-1/0,-1/0],this.vertices=[],this.edges=[]}setFromObjectSize(e,t=!1){e.updateWorldMatrix(),this.makeEmpty(),Lt.copy(e.worldMatrix,this.matrix);let i=Lt.invert(e.worldMatrix);this.expandByObjectSize(e,i,t)}expandByObjectSize(e,t,i=!1){let r=[];i===!0&&e instanceof Bs?e.traverse(s=>{s.visible&&QA(s,t,r)}):QA(e,t,r),this.setFromPoints(r)}setFromSize(e,t,i){this.makeEmpty(),Lt.copy(i,this.matrix),this.expandBySize(e,t,i)}expandBySize(e,t,i){[Lt.apply([0,0],i),Lt.apply([0,t],i),Lt.apply([e,t],i),Lt.apply([e,0],i)].forEach(r=>this.expandByPoint(r))}getCenter(){let[e,t]=this.min,[i,r]=this.getHalfSize();return Lt.apply([e+i,t+r],this.matrix)}getSize(){return[this.max[0]-this.min[0],this.max[1]-this.min[1]]}getHalfSize(){return[(this.max[0]-this.min[0])*.5,(this.max[1]-this.min[1])*.5]}makeEmpty(){this.min=[1/0,1/0],this.max=[-1/0,-1/0]}setFromPoints(e){this.makeEmpty();for(let t of e)this.expandByPoint(t)}expandByPoint(e){this.min=[Math.min(this.min[0],e[0]),Math.min(this.min[1],e[1])],this.max=[Math.max(this.max[0],e[0]),Math.max(this.max[1],e[1])]}computeVertices(){let[e,t]=this.getHalfSize(),i=this.getCenter(),[r,s,a,n]=Lt.getAbcdef(this.matrix),o=Lt.create(r,s,a,n,i[0],i[1]);this.vertices=hP.map(([l,h])=>Lt.apply([l*e,h*t],o))}computeEdges(){this.edges=[];for(let e=0,t=this.vertices.length;e<t;++e)this.edges.push([this.vertices[e],this.vertices[(e+1)%t]])}project(e,t){let i=this.matrix;return t&&(i=Lt.append(t.worldMatrix,i)),Lt.applyInverse(e,i)}intersects(e,t,i){return this.intersectsInLocalSpace(...this.project([e,t],i))}intersectsInLocalSpace(e,t){let{min:i,max:r}=this;return e>=i[0]&&e<=r[0]&&t>=i[1]&&t<=r[1]}containsPoint(e){let[t,i]=e,[r,s]=this.min,[a,n]=this.max;return t>=r&&t<=a&&i>=s&&i<=n}intersectsBBox2D(e){for(let t=0,i=this.edges.length;t<i;t++){let r=this.edges[t];for(let s=0,a=e.edges.length;s<a;s++){let n=e.edges[s];if(SK(r,n))return!0}}for(let t=0,i=e.vertices.length;t<i;t++){let r=e.vertices[t];if(this.containsPoint(r))return!0}return!1}ensureMinMax(){let e=this.min,t=this.max;this.min=[Math.min(e[0],t[0]),Math.min(e[1],t[1])],this.max=[Math.max(e[0],t[0]),Math.max(e[1],t[1])]}copy(e){this.min=[...e.min],this.max=[...e.max],Lt.copy(e.matrix,this.matrix),this.computeVertices(),this.computeEdges()}clone(){let e=new Iy;return e.copy(this),e}},cP,_K=new Promise(e=>{cP=e}),KA=!1,pp;function AK(){if(KA)return;if(pp)return pp;async function e(){let t=await fo(()=>import("./ui-CVBmWQBQ.js"),[]);cP(t.default??t),KA=!0}return pp=e(),pp}function ZA(e){let t=!1;return e.scene.objects.traverse((i,r)=>{(r.type==="Mesh"&&r.geometry.type==="UIGeometry"||r.type==="Page"&&r.uiFrame!==void 0)&&(t=!0)}),t}var dt,dv;async function MK(e){let t=await _K;dt||(dv||(dv=t({locateFile:()=>e})),dt=await dv)}var JA=Lt.identity(),uP=class{constructor(e,t=1){this.canvas=e,this._dpr=t,this._width=0,this._height=0,this._strokeMode="inside",this._layerBlur=0,this._backgroundBlur=0,this._dropShadowBlur=0,this._dropShadowOffsetX=0,this._dropShadowOffsetY=0,this._dropShadowColor=Ut.transparent,this._innerShadowBlur=0,this._innerShadowOffsetX=0,this._innerShadowOffsetY=0,this._innerShadowSpread=0,this._innerShadowColor=Ut.transparent,this._fonts=new Map,this._isSizeDirty=!1;try{let i=e.getBoundingClientRect();e.width=i.width*t,e.height=i.height*t}catch{console.log(e.width,t)}this._currentM3Transform=JA,this._currentTransform=new Float32Array(JA)}get dpr(){return this._dpr}set dpr(e){this._dpr=e,this._isSizeDirty=!0}
6372async init(){if(!this.wasmURL)throw Error("Your must set the wasm binary url with renderer.wasmURL = ... before you can call renderer.init");await MK(this.wasmURL),this._surface=dt.MakeWebGLCanvasSurface(this.canvas),this.ctx=this._surface?.getCanvas(),this._paint=new dt.Paint,this._paint.setAntiAlias(!0),this._paintFill=this._paint.copy(),this._paintFill.setStyle(dt.PaintStyle.Fill),this._paintStroke=this._paint.copy(),this._paintStroke.setStyle(dt.PaintStyle.Stroke),this.ctx?.scale(this.dpr,this.dpr)}get currentTransform(){return this._currentM3Transform}get currentTransformBuffer(){return this._currentTransform}set currentTransform(e){this._currentM3Transform=e,this._currentTransform.set(e)}async loadFont(e,t){let i=await(await fetch(e)).arrayBuffer();this.registerFont(i,t)}registerFont(e,t){if(this._fonts.has(t))return;let i=dt.FontMgr.FromData(e);if(i)this._fonts.set(t,i);else throw new Error("Invalid font data for "+t)}get width(){return this._width}get height(){return this._height}set strokeColor(e){this._paintStroke&&this._paintStroke.setColor(fp(e),dt.ColorSpace.DISPLAY_P3)}set fillColor(e){this._paintFill&&this._paintFill.setColor(fp(e),dt.ColorSpace.DISPLAY_P3)}set lineWidth(e){this._paintStroke&&this._paintStroke.setStrokeWidth(this._strokeMode==="center"?e:e*2)}set strokeMode(e){this._strokeMode=e}set dropShadowBlur(e){this._dropShadowBlur=e}set dropShadowColor(e){this._dropShadowColor=e}set dropShadowOffsetX(e){this._dropShadowOffsetX=e}set dropShadowOffsetY(e){this._dropShadowOffsetY=e}set innerShadowBlur(e){this._innerShadowBlur=e}set innerShadowColor(e){this._innerShadowColor=e}set innerShadowOffsetX(e){this._innerShadowOffsetX=e}set innerShadowOffsetY(e){this._innerShadowOffsetY=e}set innerShadowSpread(e){this._innerShadowSpread=e}set layerBlur(e){this._layerBlur=e}set backgroundBlur(e){this._backgroundBlur=e}clear(){this.ctx?.clear(dt.TRANSPARENT)}save(){this.ctx?.save()}restore(){this.ctx?.restore()}beginPath(){this._currentPath?.delete(),this._currentPath=new dt.Path}closePath(){let e=this._currentPath;if(e){if(e.isEmpty())return;let t=e.getBounds();(t[3]-t[1]||t[2]-t[0])&&e.close()}}fill(){this._paintInner(this._paintFill,!0)}stroke(){this._paintInner(this._paintStroke,!1)}clipRect(e,t,i,r,s=0,a=0,n=0,o=0){let l=dt.XYWHRect(e,t,i,r);if(s===0&&a===0&&o===0&&n===0)this.ctx?.clipRect(l,dt.ClipOp.Intersect,!0);else{let h=dt.RRectXY(l,s,s);h[4]=h[5]=s,h[6]=h[7]=a,h[8]=h[9]=n,h[10]=h[11]=o,this.ctx?.clipRRect(h,dt.ClipOp.Intersect,!0)}}_applyShadowOffsetMatrix(){if(this.ctx){let e=Lt.invert(this.currentTransform);this.ctx.concat(e);let t=Lt.translate(Lt.identity(),this._dropShadowOffsetX,this._dropShadowOffsetY);this.ctx.concat(t),this.ctx.concat(this._currentTransform)}}_applyEffectsToPaint(e,t,i=!0){if(this.ctx&&this._currentPath){let r,s=!1;if(i&&this._hasDropShadow()){let a=e.copy();a.setColor(fp(this._dropShadowColor));let n;this._dropShadowBlur>0&&(n=dt.MaskFilter.MakeBlur(dt.BlurStyle.Normal,this._dropShadowBlur*this.dpr*(this.camera?.scale??1),!1),a.setMaskFilter(n)),this.ctx.save(),this.ctx.clipPath(this._currentPath,dt.ClipOp.Difference,!0),this._applyShadowOffsetMatrix(),t(a),this.ctx.restore(),a.delete(),n?.delete()}if(this._backgroundBlur>0&&i){this.ctx.save(),this.ctx.clipPath(this._currentPath,dt.ClipOp.Intersect,!0);let a=dt.ImageFilter.MakeBlur(this._backgroundBlur,this._backgroundBlur,dt.TileMode.Clamp,null),n=e.copy();n.setImageFilter(a),n.setAlphaf(1);let o=this._currentPath.computeTightBounds();this.ctx.saveLayer(n,o,null,dt.SaveLayerInitWithPrevious),this.ctx.drawColor(e.getColor()),this.ctx.restore(),this.ctx.restore(),n.delete(),a.delete(),s=!0}if(this._layerBlur>0){let a=e.copy();r=dt.MaskFilter.MakeBlur(dt.BlurStyle.Normal,this._layerBlur*this.dpr*(this.camera?.scale??1),!1),a.setMaskFilter(r),t(a),a.delete(),r.delete(),s=!0}if(s||t(e),i&&this._hasInnerShadow()){let a=new dt.Paint;a.setAntiAlias(!0),a.setStyle(dt.PaintStyle.Fill),a.setColor(fp(this._innerShadowColor));let n;this._innerShadowBlur>0&&(n=dt.MaskFilter.MakeBlur(dt.BlurStyle.Normal,this._innerShadowBlur*this.dpr*(this.camera?.scale??1),!1),a.setMaskFilter(n));let o=this._currentPath.computeTightBounds(),[l,h,c,u]=o,d=c-l,p=u-h;this.ctx.save(),this.ctx.clipPath(this._currentPath,dt.ClipOp.Intersect,!0),this.ctx.saveLayer(a,o,null,dt.SaveLayerInitWithPrevious),this.ctx?.translate(this._innerShadowOffsetX,this._innerShadowOffsetY),this.ctx.drawRect(dt.XYWHRect(-1e3-this._innerShadowOffsetX,-1e3-this._innerShadowOffsetY,2e3+d+Math.abs(this._innerShadowOffsetX*2),2e3+p+Math.abs(this._innerShadowOffsetY*2)),a),a.setBlendMode(dt.BlendMode.Clear),this.ctx.drawPath(this._currentPath,a),this.ctx.restore(
6372),this.ctx.restore(),a.delete(),n?.delete()}}}_paintInner(e,t=!0){if(this.ctx&&this._currentPath&&e){let i=this.ctx,r=this._currentPath;this._applyEffectsToPaint(e,s=>{let a=!1;!t&&this._strokeMode!=="center"&&(i.save(),i.clipPath(r,this._strokeMode==="outside"?dt.ClipOp.Difference:dt.ClipOp.Intersect,!0),a=!0),i.drawPath(r,s),a&&i.restore()},t)}}_hasDropShadow(){return this._dropShadowColor?.a>0}_hasInnerShadow(){return this._innerShadowColor?.a>0}path(e){this._currentPath?.addPath(dt.Path.MakeFromSVGString(e))}ellipse(e,t,i,r,s,a,n,o){if(!$A([e,t,i,r])||!this._currentPath)return;if(i<0||r<0)throw Error("radii cannot be negative");let l=dt.XYWHRect(e-i,t-r,i*2,r*2);this._currentPath?.addOval(l)}rect(e,t,i,r,s=0,a=0,n=0,o=0){let l=dt.XYWHRect(e,t,i,r);if($A(l))if(s===0&&a===0&&o===0&&n===0)this._currentPath?.addRect(l);else{let h=dt.RRectXY(l,s,s);h[4]=h[5]=s,h[6]=h[7]=a,h[8]=h[9]=n,h[10]=h[11]=o,this._currentPath?.addRRect(h)}}getHorizontalAlign(e){switch(e){case 2:return dt.TextAlign.Right;case 3:return dt.TextAlign.Center;case 4:return dt.TextAlign.Justify;default:return dt.TextAlign.Left}}drawTextInner(e,t,i,[r,s,a,n],o,l,h=!0){let c=0,{ctx:u}=this;if(!u)return c;let d=l.copy(),p=l.copy();return p.setAlphaf(0),this._applyEffectsToPaint(d,f=>{t.pushPaintStyle(i,f,p),t.addText(e);let m=t.build();m.layout(a);let g=s;o===2?g+=(n-m.getHeight())/2:o===3&&(g+=n-m.getHeight()),u.drawParagraph(m,r,g),c=m.getHeight(),t.reset(),m.delete()},h),d.delete(),p.delete(),c}drawText(e,t){let i=0,r=this._fonts.get(t.font),{ctx:s,_paintFill:a,_paintStroke:n}=this;if(r&&s){let o=new dt.TextStyle({fontFamilies:[t.font],fontSize:t.fontSize,heightMultiplier:t.lineHeight,letterSpacing:t.letterSpacing}),l=new dt.ParagraphStyle({textStyle:o,textAlign:this.getHorizontalAlign(t.horizontalAlign)}),h=dt.XYWHRect(t.x,t.y,t.width,t.height),c=dt.ParagraphBuilder.Make(l,r);a&&(i=this.drawTextInner(e,c,o,h,t.verticalAlign,a,!0)),n&&(i=this.drawTextInner(e,c,o,h,t.verticalAlign,n,!1)),c.delete()}return{height:i}}render(){this._surface?.flush()}moveTo(e,t){this._currentPath?.moveTo(e,t)}lineTo(e,t){this._currentPath?.lineTo(e,t)}bezierCurveTo(e,t,i,r,s,a){this._currentPath?.cubicTo(e,t,i,r,s,a)}quadraticCurveTo(e,t,i,r){this._currentPath?.quadTo(e,t,i,r)}setTransform(e,t=!1){if(!this.ctx)return;let i=this.ctx.getTotalMatrix(),r=Lt.invert(i);if(r&&this.ctx.concat(r),this.ctx?.scale(this.dpr,this.dpr),this.camera?.enabled&&(this.ctx?.concat(this.camera.worldMatrix),t)){let s=Lt.getScale(this.camera.worldMatrix);this.ctx?.scale(1/s[0],1/s[1])}this.ctx?.concat(e),this.currentTransform=e}transform(e){this.ctx?.concat(e)}setSize(e,t){!this._isSizeDirty&&e===this._width&&t===this._height||(this._isSizeDirty=!1,this._width=e,this._height=t,this.canvas.style.width=e+"px",this.canvas.style.height=t+"px",this.canvas.width=e*this.dpr,this.canvas.height=t*this.dpr,this._surface&&(this._surface=dt.MakeWebGLCanvasSurface(this.canvas),this.ctx=this._surface?.getCanvas()))}};function $A(e){for(let t=0;t<e.length;t++)if(e[t]!==void 0&&!Number.isFinite(e[t]))return!1;return!0}function fp({r:e,g:t,b:i,a:r}){return dt.Color4f(e,t,i,r)}var e2=class{constructor(e,t,i){this.uuid=e,this.data=t,this.enabled=!1,this.color=Ut.transparent,this.blurRadius=0,this.offset=[0,0],this.spread=0,this.update(t)}update(e){e.color!==void 0&&(this.color=e.color),e.enabled!==void 0&&(this.enabled=e.enabled),e.blurRadius!==void 0&&(this.blurRadius=e.blurRadius),e.offset!==void 0&&(this.offset=e.offset),e.spread!==void 0&&(this.spread=e.spread)}},t2=class{constructor(e,t,i){this.uuid=e,this.data=t,this.enabled=!1,this.radius=0,this.update(t)}update(e){e.enabled!==void 0&&(this.enabled=e.enabled),e.radius!==void 0&&(this.radius=e.radius)}},EK=class{constructor(e,t,i){this.uuid=e,this.data=t,this.enabled=!1,this.color=Ut.transparent,this.update(t)}update(e){e.enabled!==void 0&&(this.enabled=e.enabled),e.color!==void 0&&(this.color=e.color)}},CK=class{constructor(e,t,i){this.uuid=e,this.data=t,this.enabled=!1,this.color=Ut.transparent,this.thickness=0,this.mode="inside",this.update(t)}update(e){e.enabled!==void 0&&(this.enabled=e.enabled),e.color!==void 0&&(this.color=e.color),e.thickness!==void 0&&(this.thickness=e.thickness),e.mode!==void 0&&(this.mode=e.mode)}},tr=class extends nr{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this.autoClose=!0,this.fill=new EK(e+"-fill",t.fill,i),this.stroke=new CK(e+"-stroke",t.stroke,i),this.dropShadow=new e2(e+"-dropShadow",t.dropShadow,i),this.innerShadow=new e2(e+"-innerShadow",t.innerShadow,i),this.backgroundBlur=new t2(e+"-backgroundBlur",t.backgroundBlur,i),this.layerBlur=new t2(e+"-layerBlur",t.layerBlur,i)}applyFillStroke(e){e.fillColor=this.fill.enabled?this.fill.color:Ut.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:Ut.transparent,e.strokeMode=this.stroke.mode,e.lineWidth=this.stroke.thickness}applyFilters(e){this.layerBlur.enabled?e.layerBlur=this.layerBlur.radius*5:e.layerBlur=0,this.backgroundBlur.enabled?e.backgroundBlur=this.backgroundBlur.radius*5:e.backgroundBlur=0,this.dropShadow.enabled?(e.dropShadowBlur=this.dropShadow.blurRadius*5,e.dropShadowColor=this.dropShadow.color,e.dropShadowOffsetX=this.dropShadow.offset[0],e.dropShadowOffsetY=this.dropShadow.offset[1]):e.dropShadowColor=Ut.transparent,this.innerShadow.enabled?(e.innerShadowSpread=this.innerShadow.spread,e.innerShadowBlur=this.innerShadow.blurRadius*5,e.innerShadowColor=this.innerShadow.color,e.innerShadowOffsetX=this.innerShadow.offset[0],e.innerShadowOffsetY=this.innerShadow.offset[1]):e.innerShadowColor=Ut.transparent}innerDraw(e){}draw(e){!this.visible||(e.save(),this.applyTransforms(e),this.applyFilters(e),this.applyFillStroke(e),e.beginPath(),this.innerDraw(e),this.autoClose&&e.closePath(),this.fill.enabled&&e.fill(),this.stroke.enabled&&e.stroke(),e.restore(
vendor: 44,515 bytes, lines 6372-6431
6372))}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),e.type===0&&(Qt(e.path,["fill"])?this.fill.update(e.props):Qt(e.path,["stroke"])?this.stroke.update(e.props):Qt(e.path,["dropShadow"])?this.dropShadow.update(e.props):Qt(e.path,["innerShadow"])?this.innerShadow.update(e.props):Qt(e.path,["layerBlur"])?this.layerBlur.update(e.props):Qt(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}updateState(e,t){super.updateState(e,t),e.fill!==void 0&&this.fill.update(e.fill),e.stroke!==void 0&&this.stroke.update(e.stroke),e.dropShadow!==void 0&&this.dropShadow.update(e.dropShadow),e.innerShadow!==void 0&&this.innerShadow.update(e.innerShadow),e.layerBlur!==void 0&&this.layerBlur.update(e.layerBlur),e.backgroundBlur!==void 0&&this.backgroundBlur.update(e.backgroundBlur)}clone(e){let t=new tr(this.uuid,this.data,e);return t.parent=void 0,t}},Cx=class extends tr{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this.width=0,this.height=0,this.updateState(t,i)}innerDraw(e){e.ellipse(this.width*.5,this.height*.5,this.width*.5,this.height*.5,0,0,Math.PI*2)}intersectsInLocalSpace(e,t){return bK(e,t,this.width*.5,this.height*.5,this.width*.5,this.height*.5)}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateSizeState(e){let t=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,t=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,t=!0),t&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,t){super.updateState(e,t),this.updateSizeState(e)}clone(e){let t=new Cx(this.uuid,this.data,e);return t.parent=void 0,t}},Yu=class extends tr{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this.width=0,this.height=0,this.cornerRadius=[0,0,0,0],this.updateState(t,i)}innerDraw(e){e.rect(0,0,this.width,this.height,...this.cornerRadius)}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateCornerState(e){e.cornerRadius!==void 0&&(this.cornerRadius=e.cornerRadius)}updateSizeState(e){let t=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,t=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,t=!0),t&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,t){super.updateState(e,t),this.updateSizeState(e),this.updateCornerState(e)}clone(e){let t=new Yu(this.uuid,this.data,e);return t.parent=void 0,t}},Tx=class extends tr{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this._textHeight=0,this._textHeightDirty=!0,this.width=0,this.height=0,this.updateState(t,i)}get textHeight(){return this._textHeight}applyFillStroke(e){e.fillColor=this.fill.enabled?this.fill.color:Ut.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:Ut.transparent,e.strokeMode="center",e.lineWidth=this.stroke.thickness}innerDraw(e){this._fontHolder?.arrayBuffer&&this._fontHolder.arrayBuffer.byteLength>1&&this.data.font&&e.registerFont(this._fontHolder.arrayBuffer,this.data.font);let t=this.data.textTransform,i=this.data.text.textValue.toString(),r=t===2?i.toUpperCase():t===3?i.toLowerCase():i,{height:s}=e.drawText(r,{x:0,y:0,width:this.width,height:this.height,fontSize:this.data.fontSize,lineHeight:this.data.lineHeight??1,letterSpacing:this.data.letterSpacing??0,horizontalAlign:this.data.horizontalAlign,verticalAlign:this.data.verticalAlign,font:this.data.font});this._textHeight=s}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateSizeState(e){let t=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,t=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,t=!0),t&&this.updateWorldMatrix(!0,!1,!0)}updateFontState(e,{shared:t}){e.font!==void 0&&(this._fontHolder=t.getFont(e.font),this._fontHolder&&!this._fontHolder.isLoaded&&this._fontHolder.loadingPromise.then(()=>{this.requestRender()}))}updateState(e,t){super.updateState(e,t),this.updateSizeState(e),this.updateFontState(e,t)}clone(e){let t=new Tx(this.uuid,this.data,e);return t.parent=void 0,t}},dP=class extends tr{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this.curves=[],this.extremasBBox={min:[0,0],max:[0,0]},this.updateState(t,i)}computeExtremas(){this.curves.length===0&&this.computeCurves();let e=this.curves.map(r=>qf.extremas(r)),t=[1/0,1/0],i=[-1/0,-1/0];for(let r=0,s=e.length;r<s;r++){let a=e[r];a[0][0]<t[0]&&(t[0]=a[0][0]),a[0][1]<t[1]&&(t[1]=a[0][1]),a[1][0]>i[0]&&(i[0]=a[1][0]),a[1][1]>i[1]&&(i[1]=a[1][1])}return this.extremasBBox.min=[t[0],t[1]],this.extremasBBox.max=[i[0],i[1]],this.extremasBBox}computeCurves(){this.curves=[];for(let i=1,r=this.data.points.length;i<r;i++){let s=this.data.points[i].data,a=this.data.points[i-1].data,n={start:a.position,cp1:a.controlNext.position,cp2:s.controlPrevious.position,end:s.position};this.curves.push(n)}let e=this.data.points[0].data,t=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let i={start:t.position,cp1:t.controlNext.position,cp2:e.controlPrevious.position,end:e.position};this.curves.push(i)}}getCenter(){let[e,t]=this.extremasBBox.min,[i,r]=this.getHalfSize();return[e+i,t+r]}getHalfSize(){let{min:e,max:t}=this.extremasBBox;return[(t[0]-e[0])*.5,(t[1]-e[1])*.5]}innerDraw(e){for(let r=0,s=this.data.points.length;r<s;r++){let a=this.data.points[r].data;if(r===0){let[n,o]=a.position;e.moveTo(n,o)}else{let n=this.data.points[r-1].data,[o,l]=n.controlNext.position,[h,c]=a.controlPrevious.position,[u,d]=a.position,p={start:n.position,cp1:n.controlNext.position,cp2:a.controlPrevious.position,end:a.position};qf.derive(p),e.bezierCurveTo(o,l,h,c,u,d)}}let t=this.data.points[0].data,i=this.data.points[this.data.points.length-1].data;if(this.data.isClosed){let[r,s]=i.controlNext.position,[a,n]=t.controlPrevious.position,[o,l]=t.position;e.bezierCurveTo(r,s,a,n,o,l)}}updateState(e,t){super.updateState(e,t),this.computeExtremas()}clone(e){let t=new dP(this.uuid,this.data,e);return t.parent=void 0,t}},qf;(e=>{function t(n){let o=n.start,l=n.cp1,h=n.cp2,c=n.end,u=[3*(l[0]-o[0]),3*(l[1]-o[1])],d=[3*(h[0]-l[0]),3*(h[1]-l[1])],p=[3*(c[0]-h[0]),3*(c[1]-h[1])],f={start:u,cp:d,end:p};return n.derivative=f,f.derivative=Ry.derive(f),f}e.derive=t;function i(n,o,l,h=!1){let c=n-2*o+l;if(c!==0){let u=-Math.sqrt(Math.abs(o*o-n*l)),d=-n+o,p=-(u+d)/c,f=-(-u+d)/c;return[p,f]}else if(o!==l&&c===0)return[(2*o-l)/(2*(o-l))];return[]}function r(n){let o=n.derivative??e.derive(n),l=o.start,h=o.cp,c=o.end;return[i(l[0],h[0],c[0]),i(l[1],h[1],c[1])]}e.droot=r;function s(n){let[o,l]=e.droot(n),h=[n.start[0],n.end[0]],c=[n.start[1],n.end[1]];for(let u of o)h.push(e.compute(n,Math.min(1,Math.max(0,u)))[0]);for(let u of l)c.push(e.compute(n,Math.min(1,Math.max(0,u)))[1]);return h.sort((u,d)=>u-d),c.sort((u,d)=>u-d),[[h[0],c[0]],[h[h.length-1],c[c.length-1]]]}e.extremas=s;function a(n,o){if(o===0)return[...n.start];if(o===1)return[...n.end];let l=1-o,h=l*l,c=o*o,u=h*l,d=h*o*3,p=l*c*3,f=o*c;return[u*n.start[0]+d*n.cp1[0]+p*n.cp2[0]+f*n.end[0],u*n.start[1]+d*n.cp1[1]+p*n.cp2[1]+f*n.end[1]]}e.compute=a})(qf||(qf={}));var Ry;(e=>{function t(s){let a=s.start,n=s.cp,o=s.end,l=[2*(n[0]-a[0]),2*(n[1]-a[1])],h=[2*(o[0]-n[0]),2*(o[1]-n[1])],c={start:l,end:h};return c.derivative=Ly.derive(c),s.derivative=c,c}e.derive=t;function i(s){let a=s.derivative??e.derive(s),n=a.start,o=a.end;return[n[0]!==o[0]?n[0]/(n[0]-o[0]):0,n[1]!==o[1]?n[1]/(n[1]-o[1]):0]}e.droot=i;function r(s,a){if(a===0)return[...s.start];if(a===1)return[...s.end];let n=1-a,o=n*n,l=a*a,h=o,c=n*a*2,u=l;return[h*s.start[0]+c*s.cp[0]+u*s.end[0],h*s.start[1]+c*s.cp[1]+u*s.end[1]]}e.compute=r})(Ry||(Ry={}));var Ly;(e=>{function t(r){let s=r.start,a=r.end,n=[a[0]-s[0],a[1]-s[1]];return r.derivative=n,r.derivative}e.derive=t;function i(r,s){if(s===0)return[...r.start];if(s===1)return[...r.end];let a=r.start,n=r.end;return[a[0]+(n[0]-a[0])*s,a[1]+(n[1]-a[1])*s]}e.compute=i})(Ly||(Ly={}));var wa=class extends Bs{constructor(e,t,i){super(e,t,i),this.uuid=e,this.width=0,this.height=0,this.clipped=!0,this.background=new Yu(e+"-background",Tu.defaultData,i),this.background.parent=this,this.updateState(t,i)}get fill(){return this.background.fill}get stroke(){return this.background.stroke}get backgroundBlur(){return this.background.backgroundBlur}get layerBlur(){return this.background.layerBlur}get dropShadow(){return this.background.dropShadow}get innerShadow(){return this.background.innerShadow}get cornerRadius(){return this.background.cornerRadius}set cornerRadius(e){this.background.cornerRadius=e}updateLocalMatrix(){super.updateLocalMatrix(),this.background?.updateLocalMatrix()}updateWorldMatrix(e,t,i){super.updateWorldMatrix(e,t,i),this.background?.updateWorldMatrix(e,t,i)}draw(e){if(!this.visible)return;e.save();let t=this.width,i=this.height;this.applyTransforms(e),this.background.width=t,this.background.height=i,this.background.draw(e),this.clipped&&e.clipRect(0,0,t,i,...this.cornerRadius),this.innerDrawChildren(e),e.restore()}getCenter(){return[this.width*.5,this.height*.5]}getHalfSize(){return[this.width*.5,this.height*.5]}updateCornerState(e){e.cornerRadius!==void 0&&(this.cornerRadius=e.cornerRadius)}updateSizeState(e){let t=!1;e.width!==void 0&&(this.width=typeof e.width=="number"?e.width:this.width,t=!0),e.height!==void 0&&(this.height=typeof e.height=="number"?e.height:this.height,t=!0),t&&this.updateWorldMatrix(!0,!1,!0)}updateState(e,t){super.updateState(e,t),this.updateSizeState(e),this.updateCornerState(e),e.fill!==void 0&&this.fill.update(e.fill),e.stroke!==void 0&&this.stroke.update(e.stroke),e.dropShadow!==void 0&&this.dropShadow.update(e.dropShadow),e.innerShadow!==void 0&&this.innerShadow.update(e.innerShadow),e.layerBlur!==void 0&&this.layerBlur.update(e.layerBlur),e.backgroundBlur!==void 0&&this.backgroundBlur.update(e.backgroundBlur),e.clipped!==void 0&&(this.clipped=e.clipped)}requestRender(){super.requestRender(),this.dispatchEvent({type:"render"})}dispose(){this.removeEventListener("render")}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),e.type===0&&(Qt(e.path,["fill"])?this.fill.update(e.props):Qt(e.path,["stroke"])?this.stroke.update(e.props):Qt(e.path,["dropShadow"])?this.dropShadow.update(e.props):Qt(e.path,["innerShadow"])?this.innerShadow.update(e.props):Qt(e.path,["layerBlur"])?this.layerBlur.update(e.props):Qt(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}clone(e){let t=new wa(this.uuid,this.data,e);t.parent=void 0;for(let i of this.children)t.add(i.clone(e));return t}},TK=mo(J2(),1),Em=class extends tr{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this._pathBBox=new DOMRect,this.path="",this.updateState(t,i),this.autoClose=!1,this.computeSVGBBox()}computeSVGBBox(){let e=this.path;pP(this.path)&&(console.warn("Invalid SVG path",this.uuid),e="");let t=document.createElementNS("http://www.w3.org/2000/svg","svg"),i=document.createElementNS("http://www.w3.org/2000/svg","path");document.body.appendChild(t),i.setAttribute("d",e),t.appendChild(i),this._pathBBox=i.getBBox(),t.remove()}innerDraw(e){e.path(this.path)}intersectsInLocalSpace(e,t){return e>=this._pathBBox.x&&e<=this._pathBBox.x+this._pathBBox.width&&t>=this._pathBBox.y&&t<=this._pathBBox.y+this._pathBBox.height}getCenter(){return[(this._pathBBox.x+this._pathBBox.width)/2,(this._pathBBox.y+this._pathBBox.height)/2]}getHalfSize(){return[(this._pathBBox.x+this._pathBBox.width)/2,(this._pathBBox.y+this._pathBBox.height)/2]}updateState(e,t){super.updateState(e,t),e.path!==void 0&&(this.path=e.path,this.computeSVGBBox())}clone(e){let t=new Em(this.uuid,this.data,e);return t.parent=void 0,t}};function pP(e){return/NaN/.test(e)}function PK(e,t=1,i=1){if(t<=0||i<=0)return e;if(pP(e))return console.warn("Cannot scale invalid path",e),pv([]);try{let r=(0,TK.parseSVG)(e).map(s=>{let a={...s};return"x"in a&&(a.x=a.x*t),"y"in a&&(a.y=a.y*i),"x1"in a&&(a.x1=a.x1*t),"x2"in a&&(a.x2=a.x2*t),"y1"in a&&(a.y1=a.y1*i),"y2"in a&&(a.y2=a.y2*i),"rx"in a&&(a.rx=a.rx*t),"ry"in a&&(a.ry=a.ry*i),a});return pv(r)}catch(r){return console.warn("Error parsing SVG path",r),pv([])}}function pv(e){let t=["rx","ry","xAxisRotation","largeArc","sweep","x1","y1","x2","y2","x","y"],i;return e.map(r=>{let s=[];t.forEach(n=>{if(n in r){let o=r[n]*1;s.length&&o>=0&&s.push(","),s.push(o)}});let a=(i===r.code?s[0]<0?"":",":r.code)+s.join("");return i=r.code,a}).join("")}function DK(e,t,i){switch(t.type){case"ellipse2d":return new Cx(e,t,i);case"rectangle2d":return new Yu(e,t,i);case"text2d":return new Tx(e,t,i);case"vector2d":return new dP(e,t,i);case"path2d":return new Em(e,t,i);case"frame2d":return new wa(e,t,i);default:return new po(e,t,i)}}var fP=class{constructor(e,t,i){this.uuid=e,this.data=t,this.group=new po(fP.GROUP_ID,{...Rf.defaultData},i),this.createChildrenObjects(t.objects,this.group,i)}createObject(e,t,i,r,s,a){let n=DK(e,t,a);n&&(r.add(n),r.children.splice(s,0,r.children.pop()),n.updateWorldMatrix(),i.length>0&&(n instanceof po||n instanceof wa)&&this.createChildrenObjects(i,n,a))}createChildrenObjects(e,t,i){let r=0;for(let s of e)this.createObject(s.id,s.data,s.children,t,r,i),r+=1}draw(e){this.group.draw(e)}updateEntityByOp(e,t,i,r){let s=this.find(e);if(s)try{s.updateByOp(t,i,{shared:r})}catch(a){console.error(a)}}updateTreeByOp(e,t){if(e.path.length===0&&e.type===7){let i=e.parent===null?this.group:this.find(e.parent);i!==void 0&&i instanceof Bs&&(this.createObject(e.id,e.data,e.children,i,e.localIndex,t),i.requestRender())}else if(e.path.length===0&&e.type===8){let i=this.find(e.id);if(i!==void 0&&i.parent!==void 0&&i.parent instanceof Bs){let r=i.parent;i.resetBBoxNeedsUpdate(),r?.remove(i),r?.requestRender()}}else if(e.path.length===0&&e.type===9){let i=this.find(e.id);if(i!==void 0){let r=i.parent,s=e.parent===null?this:this.find(e.parent);if(s instanceof Bs||s===this){s.add(i);let a=e.localIndex;s.children.splice(a,0,s.children.pop()),i.updateWorldMatrix(!0,!1,!0),r?.requestRender(),i.requestRender()}i.resetBBoxNeedsUpdate()}}}add(e){this.group.add(e)}remove(e){this.group.remove(e)}traverse(e){this.group.traverse(t=>{t!==this.group&&e(t)})}intersectsChildren(e,t,i,r=!1,s=[]){return this.group.intersectsChildren(e,t,i,r,s,!0)}intersectsChildrenReverse(e,t,i,r=!1,s=[]){return this.group.intersectsChildrenReverse(e,t,i,r,s,!0)}find(e){return this.group.find(e)}get children(){return this.group.children}project(e,t){return this.group.project(e,t)}getWithSortKey(e){let t=this.find(e);if(t===void 0)return;let i=[],r=t;for(;r!==this.group;){let s=r;r=r.parent;let a=r.children.indexOf(s);i.splice(0,0,a)}return{entity:t,sortKey:i}}getAllSorted(e){let t=[];for(let i of e){let r=this.getWithSortKey(i.id);r!==void 0&&t.push(r)}return t.sort((i,r)=>NE(i.sortKey,r.sortKey)),t.map(i=>i.entity)}},Px=fP;Px.GROUP_ID="scene2d";function mP({constraints:e,newParentWidth:t,newParentHeight:i,initialParentWidth:r,initialParentHeight:s,objectInitialWidth:a,objectInitialHeight:n,objectInitialPosition:o}){let{horizontalConstraint:l,verticalConstraint:h}=e,c=t-r,u=i-s,d=a,p=n,f=o[0],m=o[1];if(l!==0){if(l===1)f+=c;else if(l===3)f+=c/2;else if(l===2)d=Math.max(1,d+c);else if(l===4){let g=t/r;d*=g,f*=g}}if(h!==0){if(h===1)m+=u;else if(h===3)m+=u/2;else if(h===2)p=Math.max(1,p+u);else if(h===4){let g=i/s;p*=g,m*=g}}return{width:d,height:p,position:[f,m]}}mo(J2(),1);var OK=` 6373 varying vec2 vUv; 6374 void main() { 6375 vUv = uv; 6376 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 6377 }`,IK=` 6378 uniform sampler2D tDiffuse; 6379 varying vec2 vUv; 6380 void main() { 6381 vec4 texel = texture2D( tDiffuse, vUv ); 6382 gl_FragColor = texel; 6383 }`,RK=new $f(-1,1,1,-1,0,1),LK=class extends He{constructor(){super(),this.setAttribute("position",new De([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new De([0,2,0,0,2,0],2))}},zK=new LK,BK=class{constructor(e){this._mesh=new Zt(zK,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,RK)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}},gP=new Dt({defines:{},uniforms:{tDiffuse:new ge(null)},vertexShader:OK,fragmentShader:IK}),FK=new BK(gP),fv=null,mv=null,kK=()=>(fv===null&&(fv=document.createElement("canvas")),fv),UK=e=>(mv===null&&(mv=new uP(e)),mv),NK=Lt.identity(),vP=class{constructor(e,t,i,r){this.uuid=e,this.width=t,this.height=i,this.context=r,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.context.shared.requestRender()},this._innerApplySize=()=>{let s=this.width,a=this.height,n=this.dpr;this.renderer.dpr=this.isScreenSpace?n:Math.floor(2048/Math.max(s,a)),this.renderer.setSize(s,a)},this.onFrameOverrideObjectEvent=s=>{if(s.target?.uuid!==void 0){let a=this.frameRoot?.find(s.target.uuid);a&&a.dispatchEvent({...s,target:a})}},this.scene2d=new Px(Te.generateUUID(),$0.defaultData,{dpr:window.devicePixelRatio,shared:r.shared}),this.canvas=kK(),this.renderer=UK(this.canvas),this.promise=this.init(),this.renderTarget=new Pt(1,1,{type:dn,stencilBuffer:!1,depthBuffer:!1}),r.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=r.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new kz(this.canvas)),this._canvasTexture}async init(){this.renderer instanceof uP&&(this.renderer.wasmURL=jT.skiaWasmUrl),await this.renderer.init()}render(e){if(this.isFrameDirty){this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),gP.uniforms.tDiffuse.value=this.canvasTexture,this.canvasTexture.needsUpdate=!0;let t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.clear(),FK.render(e),e.setRenderTarget(t),this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(e,t,i,r){this.scene2d.updateEntityByOp(e,t,i,r),this.applySize()}updateTreeByOp(e,t){this.scene2d.updateTreeByOp(e,t),this.applySize()}applyOverrides(e){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let t=e?.width??this.width,i=e?.height??this.height;this.frameOverride.width=t,this.frameOverride.height=i,this.frameOverride.localMatrix=NK,this.isScreenSpace&&(this.frameOverride.fill.color=Ut.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:t,height:i},yP({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(e,t=window.devicePixelRatio){let i=Math.max(1,e?.width??this.width),r=Math.max(1,e?.height??this.height);this.dpr=t,this.width=i,this.height=r,this._innerApplySize();let s=1,a=512,n=512;(i*t<a||r*t<n)&&(s=Math.max(a/(i*t),n/(r*t))),this.renderTarget.setSize(i*t*s,r*t*s),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(e),this.frameOverride?.requestRender()}applyFrame(e){let t=this.context.scene.find2D(e);if(!(!t||!(t instanceof wa)))return this.disposeFrameOverride(),this.frameRoot=t,this.frameOverride=t.clone({dpr:this.renderer.dpr,shared:this.context.shared}),this.scene2d.add(this.frameOverride),this.applySize(),this.frame?.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(i=>{i.addEventListener("beginState",this.onFrameOverrideObjectEvent)}),this.frameOverride.traverse(i=>{i.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),t}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(e){return this.scene2d.find(e)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(e=>{e.removeEventListener("beginStateChange",this.onFrameOverrideObjectEvent)}),this.frameOverride?.traverse(e=>{e.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function yP({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:a}){if(e instanceof wa&&t instanceof wa||e instanceof po&&t instanceof po)for(let n=0,o=e.children.length;n<o;n++){let l=e.children[n],h=t.children[n];l&&h&&l.uuid===h.uuid&&jK({objectOverride:l,objectRoot:h,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:a})}}function VK(e){if(zy(e))return[e.width,e.height];if(e instanceof Em){let[t,i]=e.getHalfSize();return[t*2,i*2]}else if(e instanceof po){let[t,i]=e.recursiveBBox.getHalfSize();return[t*2,i*2]}return[0,0]}function jK({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:a}){let[n,o]=VK(t),{width:l,height:h,position:c}=mP({constraints:e.data,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:a,objectInitialWidth:n,objectInitialHeight:o,objectInitialPosition:t.position});if(e.position=c,e.data={...e.data,position:c},e.states)for(let u in e.states)HK({stateId:u,objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:a});if(zy(e)||e instanceof po)zy(e)&&(e.width=l,e.height=h,e.data={...e.data,width:l,height:h}),yP({objectOverride:e,objectRoot:t,newParentWidth:l,newParentHeight:h,initialParentWidth:n,initialParentHeight:o});else if(e instanceof Em){let u=t,d=n!==0?l/n:1,p=o!==0?h/o:1;e.path=PK(u.path,d,p),e.data={...e.data,path:e.path}}}function HK({stateId:e,objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:s,initialParentWidth:a,initialParentHeight:n}){let o=t.states?.[e],l=i.states?.[e];if(o&&l){let{width:h,height:c,position:u}=mP({constraints:t.data,newParentWidth:r,newParentHeight:s,initialParentWidth:a,initialParentHeight:n,objectInitialWidth:Ko.isResizeable(l)?l.width:0,objectInitialHeight:Ko.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(t.states[e],{position:u}),Ko.isResizeable(o)&&Object.assign(t.states[e],{width:h,height:c})}}function zy(e){return e instanceof Yu||e instanceof wa||e instanceof Cx||e instanceof Tx}var er=class extends sx(Qr){constructor(e,t,i){super(),this.data=t,this.bgColor=new Wi(1,1,1,1),this.fog=null,this.backupFog=new AM(16777215,.1,2e3),this.fogUseBGColor=!1,this.isActive=!1,this.aoColor=new Je,this.penumbraSizeArrayCache=null,this.super_Entity(e,t),this.personalCamera=new qi(Jh,{...Mu.defaultData,...t.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new AB(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.ambientLight.removeFromParent(),this.add(this.ambientLight),t.uiScene?this.uiScene=new Px((Array.isArray(e)?e[0]:e)+"-ui",t.uiScene,{dpr:window.devicePixelRatio,shared:i.shared}):t.uiFrame&&this.createUICanvas(t.uiFrame,i)}get scene(){return this.parent}get postprocessing(){return this.data.postprocessing}get frameId(){return this.data.uiFrame}get frame(){return this.uiCanvas?.frame}createUICanvas(e,t){this.uiCanvas=new vP(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,t),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{this.uiCanvas?.applyFrame(e),this.uiCanvas?.applySize()})}updateVisible(){}setBackgroundColor(e){this.bgColor=e,this.fogUseBGColor===!0&&(this.backupFog.color=e)}entityChildrenCount(){return this.uiScene?this.uiScene.children.length:super.entityChildrenCount()}updateAmbientLight(e,t){e.color!==void 0&&(this.ambientLight.color=Br(e.color,t)),e.intensity!==void 0&&(this.ambientLight.intensity=e.intensity),e.enabled!==void 0&&(e.enabled?this.add(this.ambientLight):this.remove(this.ambientLight))}onDeactive(){this.isActive=!1}onActive(e){this.isActive=!0,e.fog=this.fog,this.traverseEntity(t=>{t instanceof al&&t.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof uo)if(Array.isArray(e.material))for(let t of e.material)t.needsUpdate=!0;else e.material.needsUpdate=!0,e.material.dispose()})}updateShadow(e){e.softShadowQuality!==void 0&&this.isActive&&oK(e.softShadowQuality)&&this.forceMaterialsUpdate()}updateFog(e,t){if(e.enabled?this.fog=this.backupFog:this.fog=null,this.isActive){let i=this.scene;i.fog=this.fog}this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=Br(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far}updateAo(e,t){e.aoColor!==void 0&&(this.aoColor=Br(e.aoColor,t))}updateByOp(e,t,i,r){let s=this.data.uiFrame;super.updateByOp(e,t,i,r);let a=t;Qt(e.path,["fog"])?this.updateFog(a.fog,i.shared):Qt(e.path,["ao"])?this.updateAo(a.ao,i.shared):Qt(e.path,["ambient"])?this.updateAmbientLight(a.ambient,i.shared):Qt(e.path,["shadow"])?this.updateShadow(a.shadow):e.type===0&&e.path.length===0&&(e.props.uiFrame!==void 0||s!==a.uiFrame)&&this.updateUIFrame(e.props.uiFrame,i)}updateUIFrame(e,t){e?(this.uiCanvas||this.createUICanvas(e,t),this.uiCanvas.enabled=!0,this.uiCanvas.applyFrame(e)):this.uiCanvas&&(this.uiCanvas.enabled=!1)}updateState(e,t){this.updateState_Entity(e,t),e.backgroundColor!==void 0&&this.setBackgroundColor(Br(e.backgroundColor,t.shared)),e.fog!==void 0&&this.updateFog(e.fog,t.shared),e.ambient!==void 0&&this.updateAmbientLight(e.ambient,t.shared),e.ao!==void 0&&this.updateAo(e.ao,t.shared),e.shadow!==void 0&&this.updateShadow(e.shadow)}createFrame(e,t){}raycast(e,t){super.raycast(e,t)}switchActiveCamera(e){e&&e.isDescendantOf(this)&&(this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=e,e.objectHelper.visible=!1)}get playCamera(){return this.scene?.find(this.data.publish.playCamera)??this.personalCamera}switchToPlayCamera(){this.switchActiveCamera(this.playCamera)}get penumbraSizeArray(){return this.penumbraSizeArrayCache===null&&this.updatePenumbraSizeArray(),this.penumbraSizeArrayCache}updatePenumbraSizeArray(){this.penumbraSizeArrayCache=new Array(5).fill(.5);let e=0,t=0;this.traverseEntity(i=>{if(!i.visible)return!0;i instanceof Am&&i.visible&&e<3&&(this.penumbraSizeArrayCache[e]=i.data.penumbraSize??.5,e+=1),i instanceof Mm&&i.visible&&e<2&&(this.penumbraSizeArrayCache[3+t]=i.data.penumbraSize??.5,t+=1)})}raycastWithClones(e){let t=[],i=r=>{for(let s of r.children){let a=s.cloner;Tt.is(s)&&(s.visible||a?.object.data.visible)&&((fa(s)||My(s)&&this.scene.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,t),By(s,e,t,!0)),i(s))}};return i(this),t}updateEntity2DByOp(e,t,i,r){this.uiCanvas?.updateEntity2DByOp(e,t,i,r)}},Dx=class extends Ax(TB,nP){constructor(e,t,i){super(),this.super_Entity(e,t),this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let r=this.shadow.camera;r.fov=90,r.aspect=1,r.near=100,r.far=2500;let s=new M(-r.far+this.position.x,-r.far+this.position.y,-r.far+this.position.z),a=new M(r.far+this.position.x,r.far+this.position.y,r.far+this.position.z),n=new yi(s,a),o=new rf(n,new Je(16755200));o.visible=!1,this.gizmos.shadowmap=o,this.update()}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this.gizmos))for(let e in this.gizmos){let t=this.gizmos[e];if(t instanceof rf){let i=this.shadow.camera,r=new M(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),s=new M(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z);t.box.set(r,s),t.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.objectHelper&&this.objectHelper.update()}updateState(e,t){this.updateState_Light(e,t),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null))}},GK=class extends ai{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");i!==void 0?dx(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}},Cm=class extends ai{constructor(e,t,i){super(e,t,i),this._shapeId=null,this._context=i}updateState(e,t){super.updateState(e,t),this.updateShape(),this.refreshAttachedCloners(t)}updateShape(){let e={...this.data.geometry.extrusion.shape};for(let r in e)typeof e[r]=="string"&&(e[r]=this._context.shared.getVariable(e[r],[this.uuid,"geometry","extrusion","shape",r]));let t;if(e.type==="Custom"){let r=e.shapeId;if(r!==this._shapeId&&this.detachShape(),r){this._shapeId=r;let s=this._context.scene.find(r);s?.data&&(s.attachedPaths.add(this),t=s.geometry.userData?.shape),t||this._context.scene.addPendingCommand(()=>this.updateShape())}}else{let r;switch(e.type){case"Rectangle":r=ux;break;case"Ellipse":r=cx;break;case"Polygon":r=sT;break;case"Star":r=aT;break;default:throw new Error(`Unknown shape type: ${e.type}`)}t=r.create({parameters:e}).userData.shape}let i=this.geometry;t&&i.inputs&&(i.inputs.shapeData=t,i.build())}detachShape(){this._shapeId!==null&&this._context.scene.find(this._shapeId)?.attachedPaths.delete(this)}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.updateShape(),this.refreshAttachedPaths(e)}updateTransformState(e,t){return super.updateTransformState(e,t)}updateGeometryInteractions(e,t){super.updateGeometryInteractions(e,t),this.updateShape()}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");i!==void 0?dx(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}},Ox=class extends _x{constructor(e,t,i){super(e,t,i),this.data=t}},bh=class extends tc(nn,qu){constructor(e,t,i){super(),t.type==="Instance"&&typeof e=="string"&&(t=this.transformAssignData(t,i)),this.super_Entity(e,t),this.objectHelper.update()}get isComponentRoot(){return this.data.type==="Component"&&typeof this.identity=="string"}get isInstanceRoot(){return this.data.type==="Instance"&&typeof this.identity=="string"}transformAssignData(e,t){let i=Qo.getComponentData({scene:t.scene.data,shared:t.shared.data},e.component);if(i){let r,s;for(let a of Kn.rootOverrideProps)e[a]===void 0?(r===void 0&&(r={...e}),r[a]=i.data[a]):(s===void 0&&(s={}),s[a]=e[a],r===void 0&&(r={...e}),r[a]=ro.apply(i.data[a],e[a]));return this.overrideData=s,r}else return{...Gi.defaultData,...e,...xa(Gi.defaultData,Kn.rootOverrideProps)}}updateByOp(e,t,i,r){let s;if(this.isInstanceRoot&&!r){if(t=this.transformAssignData(t,i),e.type===0&&e.path.length===0&&this.component)for(let a of Kn.rootOverrideProps)a in e.props&&e.props[a]===void 0&&(s===void 0&&(s={...e,props:{...e.props}}),s.props[a]=this.component.data[a]);else if(e.type===0&&e.path.length>0&&Kn.rootOverrideProps.includes(e.path[0])){let a=e.path[0];s===void 0&&(s={...e,path:[],props:{[a]:t[a]}})}}super.updateByOp(s??e,t,i,r)}updateState(e,t){this.updateState_Entity(e,t)}expandInstanceChildren(e){let t=this.data;if(this.component===void 0){let i=e.scene.find(t.component)??null,r=!1;if(i!==this.oldComponent){if(this.oldComponent){let s=0;for(let a of this.children)if(Tt.is(a))e.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(a),Ix(a),s+=1;else break;this.children.splice(0,s)}r=!0}if(i){let s={};xP(e,[this.uuid],t.overrides,this,i,i,0,r,s);for(let a of this.children)if(Tt.is(a)){let n=a.data;n.type==="Empty"&&n.animations&&a.traverseEntity(o=>{let l=o.dataPatched;if(o instanceof ai&&l.bones&&l.boneInverses){let h=o.dataPatched;if(h.bones&&h.boneInverses){let c=h.bones.map(p=>e.scene.find(s[p])),u=h.boneInverses.map(p=>new xe().fromArray(p)),d=new i1(c,u);o.bind(d,o.bindMatrix)}}else o.matrixAutoUpdate=!0})}}this.oldComponent=this.component}}};function Ix(e){if(e.component){let t=e.component.instances.indexOf(e);t>=0&&e.component.instances.splice(t,1);for(let i of e.children)Tt.is(i)&&Ix(i)}}function i2(e,t,i,r){return e.component===t&&T1(e.identity,r)?e.overrideData===i?2:1:0}function xP(e,t,i,r,s,a,n,o,l){if(n>50)return!1;if(r.component!==s){if(r.component){let c=r.component.instances.indexOf(r);c>=0&&r.component.instances.splice(c,1)}s.instances.find(c=>c===r)||s.instances.push(r),r.component=s}s instanceof bh&&s.isInstanceRoot&&s.expandInstanceChildren(e);let h=0;for(let c of s.children)if(Tt.is(c)){let u=[...t,...typeof c.identity=="string"?[c.identity]:c.identity],d=Ef.resolve(i,u,1);d!=null&&!(d instanceof vi)&&(Object.setPrototypeOf(d,vi.prototype),console.error("wrong prototype"));let p=null,f;if(!o){let m=r.children[h];if(p=Tt.is(m)?m:null,p!==null){let g=i2(p,c,d,u);f=g>=1?p.stateSelection:void 0,g!==2&&(p=null)}if(p===null&&(p=e.scene.findInstance(u)??null,p!==null)){let g=i2(p,c,d,u);if(f=g>=1?p.stateSelection:void 0,g!==2)p=null;else{let v=p.parent.children.indexOf(p);p.parent.children.splice(v,1),r.children.splice(h,0,p),p.parent===r?v<=h&&console.error("not possible"):(p.parent=r,p.matrixWorldNeedsUpdate=!0,p.resetBBoxNeedsUpdate(),p.updateVisible(),e.pendingDeletes.delete(p))}}}if(p===null){let m=d?ro.apply(c.data,d):c.data;il.is(m.type)&&(m={...m,type:"Empty"}),p=Jn.createEntity(u,m,e),p.overrideData=d,r.add(p),r.children.splice(r.children.length-1,1),r.children.splice(h,0,p),p.updateState(p.data,e),f&&p.changeSelectedState(f,e),e.scene.registerInstanceAndSetUuid(p)}if(p.isBone){let m=p.identity[p.identity.length-1];l[m]=p.uuid}h+=1,xP(e,t,i,p,c,a,n+1,o,l)}if(!o){let c=h;for(;;){let u=r.children[h];if(Tt.is(u))e.pendingDeletes.add(u);else break;h+=1}r.children.splice(c,h-c)}return!0}var WK=class extends tc(MM,qu){constructor(e,t){super(),this.super_Entity(e,t),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(e,t){this.updateState_Entity(e,t)}},_r=class extends ai{constructor(e,t,i){super(e,t,i),this.onBeforeRender=r=>{this.uiCanvas.render(r)},this.uiCanvas=new vP(e+"-canvas",t.geometry.width,t.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(e,t,i){super.updateByPatchedOpGeometry(e,t,i),e.type===0&&(e.props.frame!==void 0&&this.applyFrame(e.props.frame,i.shared),(e.props.width!==void 0||e.props.height!==void 0)&&this.applySize(e.props,i.shared))}applySize(e,t){let i=e?.width??this.dataPatched.geometry.width,r=e?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:r}),this.applyGeometryParametersFromFrame(t)}applyFrame(e,t){this.uiCanvas.applyFrame(e),this.applyGeometryParametersFromFrame(t),this.applyMaterialParametersFromFrame({shared:t})}applyGeometryParametersFromFrame(e){let t=this.frame;t&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=Fh(this.dataPatched.geometry,e,this.data.flatShading,this))}applyMaterialParametersFromFrame(e){let t=this.frame;if(t){let i=t.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),Object.assign(this.dataPatched.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.dataPatched.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),this.material.reset?.(this.dataPatched.material,e,!0)}}updateEntity2DByOp(e,t,i,r){this.uiCanvas.updateEntity2DByOp(e,t,i,r),e===this.frameId&&t.type===0&&(t.props.cornerRadius!==void 0?this.applyGeometryParametersFromFrame(r):Qt(t.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:r}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(e){super.removeInteractionGeometry(e),this.applySize({},e)}updateGeometryInteractions(e,t){super.updateGeometryInteractions(e,t),this.applySize({width:e.width,height:e.height},t);let i={...this.data.geometry,...e};this.localGeometry?.dispose(),this.localGeometry=Fh(i,t,this.data.flatShading,this)}},qK=class{constructor(e,t,i){this.variables=[],this.currentTextureIndex=0;let r=Ht,s=new Qr,a=new go;a.position.z=1;let n={passThruTexture:{value:null}},o=c(d(),n),l=new Zt(new Sa(2,2),o);s.add(l),this.setDataType=function(p){return r=p,this},this.addVariable=function(p,f,m){let g=this.createShaderMaterial(f),v={name:p,initialValueTexture:m,material:g,dependencies:null,renderTargets:[],wrapS:null,wrapT:null,minFilter:St,magFilter:St};return this.variables.push(v),v},this.setVariableDependencies=function(p,f){p.dependencies=f},this.init=function(){if(i.capabilities.isWebGL2===!1&&i.extensions.has("OES_texture_float")===!1)return"No OES_texture_float support for float textures.";if(i.capabilities.maxVertexTextures===0)return"No support for vertex shader textures.";for(let p=0;p<this.variables.length;p++){let f=this.variables[p];f.renderTargets[0]=this.createRenderTarget(e,t,f.wrapS,f.wrapT,f.minFilter,f.magFilter),f.renderTargets[1]=this.createRenderTarget(e,t,f.wrapS,f.wrapT,f.minFilter,f.magFilter),this.renderTexture(f.initialValueTexture,f.renderTargets[0]),this.renderTexture(f.initialValueTexture,f.renderTargets[1]);let m=f.material,g=m.uniforms;if(f.dependencies!==null)for(let v=0;v<f.dependencies.length;v++){let y=f.dependencies[v];if(y.name!==f.name){let x=!1;for(let w=0;w<this.variables.length;w++)if(y.name===this.variables[w].name){x=!0;break}if(!x)return"Variable dependency not found. Variable="+f.name+", dependency="+y.name}g[y.name]={value:null},m.fragmentShader=` 6384uniform sampler2D `+y.name+`; 6385`+m.fragmentShader}}return this.currentTextureIndex=0,null},this.compute=function(){let p=this.currentTextureIndex,f=this.currentTextureIndex===0?1:0;for(let m=0,g=this.variables.length;m<g;m++){let v=this.variables[m];if(v.dependencies!==null){let y=v.material.uniforms;for(let x=0,w=v.dependencies.length;x<w;x++){let S=v.dependencies[x];y[S.name].value=S.renderTargets[p].texture}}this.doRenderTarget(v.material,v.renderTargets[f])}this.currentTextureIndex=f},this.getCurrentRenderTarget=function(p){return p.renderTargets[this.currentTextureIndex]},this.getAlternateRenderTarget=function(p){return p.renderTargets[this.currentTextureIndex===0?1:0]},this.dispose=function(){l.geometry.dispose(),l.material.dispose();let p=this.variables;for(let f=0;f<p.length;f++){let m=p[f];m.initialValueTexture&&m.initialValueTexture.dispose();let g=m.renderTargets;for(let v=0;v<g.length;v++)g[v].dispose()}};function h(p){p.defines.resolution="vec2( "+e.toFixed(1)+", "+t.toFixed(1)+" )"}this.addResolutionDefine=h;function c(p,f){f=f||{};let m=new Dt({uniforms:f,vertexShader:u(),fragmentShader:p});return h(m),m}this.createShaderMaterial=c,this.createRenderTarget=function(p,f,m,g,v,y){return p=p||e,f=f||t,m=m||si,g=g||si,v=v||St,y=y||St,new Pt(p,f,{wrapS:m,wrapT:g,minFilter:v,magFilter:y,format:oi,type:r,depthBuffer:!1})},this.createTexture=function(){let p=new Float32Array(e*t*4),f=new zr(p,e,t,oi,Ht);return f.needsUpdate=!0,f},this.renderTexture=function(p,f){n.passThruTexture.value=p,this.doRenderTarget(o,f),n.passThruTexture.value=null},this.doRenderTarget=function(p,f){let m=i.getRenderTarget(),g=i.xr.enabled,v=i.shadowMap.autoUpdate,y=i.outputEncoding,x=i.toneMapping;i.xr.enabled=!1,i.shadowMap.autoUpdate=!1,i.outputEncoding=js,i.toneMapping=ya,l.material=p,i.setRenderTarget(f),i.render(s,a),l.material=o,i.xr.enabled=g,i.shadowMap.autoUpdate=v,i.outputEncoding=y,i.toneMapping=x,i.setRenderTarget(m)};function u(){return`void main() { 6386 6387 gl_Position = vec4( position, 1.0 ); 6388 6389} 6390`}function d(){return`uniform sampler2D passThruTexture; 6391 6392void main() { 6393 6394 vec2 uv = gl_FragCoord.xy / resolution.xy; 6395 6396 gl_FragColor = texture2D( passThruTexture, uv ); 6397 6398} 6399`}}},hr=new fr,mp=new M,XK=class{constructor(e){let t=e.geometry;if(!t.isBufferGeometry||t.attributes.position.itemSize!==3)throw new Error("THREE.MeshSurfaceSampler: Requires BufferGeometry triangle mesh.");t.index&&(console.warn("THREE.MeshSurfaceSampler: Converting geometry to non-indexed BufferGeometry."),t=t.toNonIndexed()),this.geometry=t,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.colorAttribute=this.geometry.getAttribute("color"),this.weightAttribute=null,this.distribution=null}setWeightAttribute(e){return this.weightAttribute=e?this.geometry.getAttribute(e):null,this}build(){let e=this.positionAttribute,t=this.weightAttribute,i=new Float32Array(e.count/3);for(let s=0;s<e.count;s+=3){let a=1;t&&(a=t.getX(s)+t.getX(s+1)+t.getX(s+2)),hr.a.fromBufferAttribute(e,s),hr.b.fromBufferAttribute(e,s+1),hr.c.fromBufferAttribute(e,s+2),a*=hr.getArea(),i[s/3]=a}this.distribution=new Float32Array(e.count/3);let r=0;for(let s=0;s<i.length;s++)r+=i[s],this.distribution[s]=r;return this}setRandomGenerator(e){return this.randomFunction=e,this}sample(e,t,i){let r=this.distribution[this.distribution.length-1],s=this.binarySearch(this.randomFunction()*r);return this.sampleFace(s,e,t,i)}binarySearch(e){let t=this.distribution,i=0,r=t.length-1,s=-1;for(;i<=r;){let a=Math.ceil((i+r)/2);if(a===0||t[a-1]<=e&&t[a]>e){s=a;break}else e<t[a]?r=a-1:i=a+1}return s}sampleFace(e,t,i,r){let s=this.randomFunction(),a=this.randomFunction();return s+a>1&&(s=1-s,a=1-a),hr.a.fromBufferAttribute(this.positionAttribute,e*3),hr.b.fromBufferAttribute(this.positionAttribute,e*3+1),hr.c.fromBufferAttribute(this.positionAttribute,e*3+2),t.set(0,0,0).addScaledVector(hr.a,s).addScaledVector(hr.b,a).addScaledVector(hr.c,1-(s+a)),i!==void 0&&hr.getNormal(i),r!==void 0&&this.colorAttribute!==void 0&&(hr.a.fromBufferAttribute(this.colorAttribute,e*3),hr.b.fromBufferAttribute(this.colorAttribute,e*3+1),hr.c.fromBufferAttribute(this.colorAttribute,e*3+2),mp.set(0,0,0).addScaledVector(hr.a,s).addScaledVector(hr.b,a).addScaledVector(hr.c,1-(s+a)),r.r=mp.x,r.g=mp.y,r.b=mp.z),this}};function YK(e){let t=new Float32Array(e*e*2);for(let i=0;i<e;i++)for(let r=0;r<e;r++){let s=i*e+r;t[s*2+0]=i/(e-1),t[s*2+1]=r/(e-1)}return t}function QK(e){let t=Math.ceil(Math.sqrt(e));return Math.max(t,1)}function KK(e,t){let i=new Zt(e.geometry,e.material),r=[],s=[],a=new M,n=new M;i.geometry.index!==null&&(i.geometry=i.geometry.toNonIndexed());let o=new XK(i).build();for(let c=0;c<t;c++)o.sample(a,n),r.push(a.x,a.y,a.z),s.push(n.x,n.y,n.z);let l=new Float32Array(r),h=new Float32Array(s);return{positions:l,normals:h}}function r2(e,t){let i=e,r=new Float32Array(4*t*t);for(let a=0;a<t*t;a++)r[4*a]=i[3*a],r[4*a+1]=i[3*a+1],r[4*a+2]=i[3*a+2],r[4*a+3]=0;let s=new zr(r,t,t,oi,Ht);return s.needsUpdate=!0,s}function ZK({size:e}){let t=new Float32Array(4*e*e);for(let r=0;r<e*e;r++)t[4*r]=r,t[4*r+1]=0,t[4*r+2]=0,t[4*r+3]=0;let i=new zr(t,e,e,oi,Ht);return i.needsUpdate=!0,i}function JK(e){let t=new Float32Array(4*e*e);for(let r=0;r<e*e;r++)t[4*r]=0,t[4*r+1]=0,t[4*r+2]=0,t[4*r+3]=0;let i=new zr(t,e,e,oi,Ht);return i.needsUpdate=!0,i}var $K=` 6400// uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU 6401// uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU 6402// uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU 6403uniform sampler2D uOriginalPosition; 6404uniform float uTime; 6405uniform float uSpeed; // update speed of the particles 6406uniform vec3 uWorldOffset; 6407uniform vec4 uWorldQuaternion; 6408uniform float uMaxLifeTime; 6409uniform vec3 uEmitterSize; 6410uniform float uFPSRatio; // 1 for 60 FPS 6411 6412float random (vec2 st) { 6413 return fract(sin(dot(st.xy, 6414 vec2(12.9898,78.233)))* 6415 43758.5453123); 6416} 6417vec3 applyQuaternionToVector( vec4 q, vec3 v ){ 6418 return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v ); 6419} 6420 6421vec3 applyForce(vec3 force, float mass) { 6422 vec3 acceleration = force / mass; 6423 6424 return acceleration; 6425 } 6426 6427 6428void main() { 6429 vec2 vUv = gl_FragCoord.xy / resolution.xy; 6430 vec3 position = texture2D( uCurrentPosition, vUv ).xyz; 6431 float currentLife = texture2D( uCurrentPosition, vUv ).w; // from 1 to 0
6432 float isSpawning = texture2D( uCurrentEmissionRate, vUv ).r; // 1. = spawning, 0. = not spawning 6433 float isActive = texture2D( uCurrentEmissionRate, vUv ).g; // 1. = active, 0. = not active 6434 float timeStart = texture2D( uCurrentEmissionRate, vUv ).b; // timeStart in seconds when the particle was emitted 6435 vec3 originalPosition = ((texture2D( uOriginalPosition, vUv ).xyz) * uEmitterSize); 6436 vec3 velocity = texture2D( uCurrentVelocity, vUv ).xyz; 6437 float collisionFlag = texture2D( uCurrentVelocity, vUv ).w; // 1. = collided, 0. = not collided 6438 float lifeTime = uMaxLifeTime; 6439 6440 // Calculate the position adjustment based on collision 6441 // if (collisionFlag > .5) { 6442 float isColliding = step(0.5, collisionFlag); // 1.0 if collisionFlag > 0.5, otherwise 0.0 6443 float bounceOffset = 3.0 * isColliding; // Becomes 3.0 if colliding, 0.0 otherwise 6444 vec3 collisionAdjustedVelocity = velocity * (1.0 + bounceOffset); 6445 6446 // Update position based on collision or normal movement 6447 vec3 fpsVelocity = velocity * min(uFPSRatio, 5.0); 6448 position += mix(fpsVelocity, collisionAdjustedVelocity, isColliding); 6449 6450 // EMISSION RATE - BIRTH 6451 // if (isSpawning == 1.0) { 6452 // Better Approach to avoid If statement 6453 vec3 newPosition = applyQuaternionToVector(uWorldQuaternion, originalPosition) + uWorldOffset; 6454 originalPosition = mix(originalPosition, newPosition, isSpawning); 6455 position = mix(position, originalPosition, isSpawning);; 6456 timeStart = mix(timeStart, uTime, isSpawning); 6457 6458 // Calculate timeLeft for life normalization
6459 float timeLeft = max(lifeTime - (uTime - timeStart), 0.0); 6460 float life_Normalize = timeLeft / lifeTime; 6461 6462 // Use isActive to blend between the calculated color and black 6463 vec4 activeColor = vec4(position, life_Normalize); 6464 // if (isActive == 1.0) { 6465 gl_FragColor = mix(vec4(0.0), activeColor, isActive); 6466 6467} 6468`,eZ=` 6469 6470 vec3 mod289(vec3 x) { 6471 return x - floor(x * (1.0 / 289.0)) * 289.0; 6472 } 6473 6474 vec4 mod289(vec4 x) { 6475 return x - floor(x * (1.0 / 289.0)) * 289.0; 6476 } 6477 6478 vec4 permute(vec4 x) { 6479 return mod289(((x*34.0)+1.0)*x); 6480 } 6481 6482 vec4 taylorInvSqrt(vec4 r) 6483 { 6484 return 1.79284291400159 - 0.85373472095314 * r; 6485 } 6486 6487 vec3 fade(vec3 t) { 6488 return t*t*t*(t*(t*6.0-15.0)+10.0); 6489} 6490 6491 float snoise(vec3 v) 6492 { 6493 const vec2 C = vec2(1.0/6.0, 1.0/3.0) ; 6494 const vec4 D = vec4(0.0, 0.5, 1.0, 2.0); 6495 vec3 i = floor(v + dot(v, C.yyy) ); 6496 vec3 x0 = v - i + dot(i, C.xxx) ; 6497 vec3 g = step(x0.yzx, x0.xyz); 6498 vec3 l = 1.0 - g; 6499 vec3 i1 = min( g.xyz, l.zxy ); 6500 vec3 i2 = max( g.xyz, l.zxy ); 6501 vec3 x1 = x0 - i1 + C.xxx; 6502 vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y 6503 vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y 6504 6505 // Permutations 6506 i = mod289(i); 6507 vec4 p = permute( permute( permute( 6508 i.z + vec4(0.0, i1.z, i2.z, 1.0 )) 6509 + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) 6510 + i.x + vec4(0.0, i1.x, i2.x, 1.0 )); 6511 6512 // Gradients: 7x7 points over a square, mapped onto an octahedron. 6513 // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294) 6514 float n_ = 0.142857142857; // 1.0/7.0 6515 vec3 ns = n_ * D.wyz - D.xzx; 6516 6517 vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7) 6518 6519 vec4 x_ = floor(j * ns.z); 6520 vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N) 6521 6522 vec4 x = x_ *ns.x + ns.yyyy; 6523 vec4 y = y_ *ns.x + ns.yyyy; 6524 vec4 h = 1.0 - abs(x) - abs(y); 6525 6526 vec4 b0 = vec4( x.xy, y.xy ); 6527 vec4 b1 = vec4( x.zw, y.zw ); 6528 6529 vec4 s0 = floor(b0)*2.0 + 1.0; 6530 vec4 s1 = floor(b1)*2.0 + 1.0; 6531 vec4 sh = -step(h, vec4(0.0)); 6532 6533 vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ; 6534 vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ; 6535 6536 vec3 p0 = vec3(a0.xy,h.x); 6537 vec3 p1 = vec3(a0.zw,h.y); 6538 vec3 p2 = vec3(a1.xy,h.z); 6539 vec3 p3 = vec3(a1.zw,h.w); 6540 6541 //Normalise gradients 6542 vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3))); 6543 p0 *= norm.x; 6544 p1 *= norm.y; 6545 p2 *= norm.z; 6546 p3 *= norm.w; 6547 6548 // Mix final noise value 6549 vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0); 6550 m = m * m; 6551 return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), 6552 dot(p2,x2), dot(p3,x3) ) ); 6553 } 6554 6555 vec3 snoiseVec3( vec3 x ){ 6556 6557 float s = snoise(vec3( x )); 6558 float s1 = snoise(vec3( x.y - 19.1 , x.z + 33.4 , x.x + 47.2 )); 6559 float s2 = snoise(vec3( x.z + 74.2 , x.x - 124.5 , x.y + 99.4 )); 6560 vec3 c = vec3( s , s1 , s2 ); 6561 return c; 6562 6563 } 6564 6565 6566 vec3 curlNoise( vec3 p, float seed){ 6567 p += seed; 6568 const float e = .1; 6569 vec3 dx = vec3( e , 0.0 , 0.0 ); 6570 vec3 dy = vec3( 0.0 , e , 0.0 ); 6571 vec3 dz = vec3( 0.0 , 0.0 , e ); 6572 6573 vec3 p_x0 = snoiseVec3( p - dx ); 6574 vec3 p_x1 = snoiseVec3( p + dx ); 6575 vec3 p_y0 = snoiseVec3( p - dy ); 6576 vec3 p_y1 = snoiseVec3( p + dy ); 6577 vec3 p_z0 = snoiseVec3( p - dz ); 6578 vec3 p_z1 = snoiseVec3( p + dz ); 6579 6580 float x = p_y1.z - p_y0.z - p_z1.y + p_z0.y; 6581 float y = p_z1.x - p_z0.x - p_x1.z + p_x0.z; 6582 float z = p_x1.y - p_x0.y - p_y1.x + p_y0.x; 6583 6584 const float divisor = 1.0 / ( 2.0 * e ); 6585 return normalize( vec3( x , y , z ) * divisor ); 6586 6587 } 6588 6589 6590// Classic Perlin noise 6591float cnoise(vec3 P) 6592{ 6593 vec3 Pi0 = floor(P); // Integer part for indexing 6594 vec3 Pi1 = Pi0 + vec3(1.0); // Integer part + 1 6595 Pi0 = mod289(Pi0); 6596 Pi1 = mod289(Pi1); 6597 vec3 Pf0 = fract(P); // Fractional part for interpolation 6598 vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0 6599 vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x); 6600 vec4 iy = vec4(Pi0.yy, Pi1.yy); 6601 vec4 iz0 = Pi0.zzzz; 6602 vec4 iz1 = Pi1.zzzz; 6603 6604 vec4 ixy = permute(permute(ix) + iy); 6605 vec4 ixy0 = permute(ixy + iz0); 6606 vec4 ixy1 = permute(ixy + iz1); 6607 6608 vec4 gx0 = ixy0 * (1.0 / 7.0); 6609 vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5; 6610 gx0 = fract(gx0); 6611 vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0); 6612 vec4 sz0 = step(gz0, vec4(0.0)); 6613 gx0 -= sz0 * (step(0.0, gx0) - 0.5); 6614 gy0 -= sz0 * (step(0.0, gy0) - 0.5); 6615 6616 vec4 gx1 = ixy1 * (1.0 / 7.0); 6617 vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5; 6618 gx1 = fract(gx1); 6619 vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1); 6620 vec4 sz1 = step(gz1, vec4(0.0)); 6621 gx1 -= sz1 * (step(0.0, gx1) - 0.5); 6622 gy1 -= sz1 * (step(0.0, gy1) - 0.5); 6623 6624 vec3 g000 = vec3(gx0.x,gy0.x,gz0.x); 6625 vec3 g100 = vec3(gx0.y,gy0.y,gz0.y); 6626 vec3 g010 = vec3(gx0.z,gy0.z,gz0.z); 6627 vec3 g110 = vec3(gx0.w,gy0.w,gz0.w); 6628 vec3 g001 = vec3(gx1.x,gy1.x,gz1.x); 6629 vec3 g101 = vec3(gx1.y,gy1.y,gz1.y); 6630 vec3 g011 = vec3(gx1.z,gy1.z,gz1.z); 6631 vec3 g111 = vec3(gx1.w,gy1.w,gz1.w); 6632 6633 vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); 6634 g000 *= norm0.x; 6635 g010 *= norm0.y; 6636 g100 *= norm0.z; 6637 g110 *= norm0.w; 6638 vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); 6639 g001 *= norm1.x; 6640 g011 *= norm1.y; 6641 g101 *= norm1.z; 6642 g111 *= norm1.w; 6643 6644 float n000 = dot(g000, Pf0); 6645 float n100 = dot(g100, vec3(Pf1.x, Pf0.yz)); 6646 float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z)); 6647 float n110 = dot(g110, vec3(Pf1.xy, Pf0.z)); 6648 float n001 = dot(g001, vec3(Pf0.xy, Pf1.z)); 6649 float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z)); 6650 float n011 = dot(g011, vec3(Pf0.x, Pf1.yz)); 6651 float n111 = dot(g111, Pf1); 6652 6653 vec3 fade_xyz = fade(Pf0); 6654 vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z); 6655 vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y); 6656 float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); 6657 return 2.2 * n_xyz; 6658} 6659 6660 6661vec3 fbm_vec3(vec3 p, float frequency, float offset) 6662{ 6663 return vec3( 6664 cnoise((p+vec3(offset))*frequency), 6665 cnoise((p+vec3(offset+20.0))*frequency), 6666 cnoise((p+vec3(offset-30.0))*frequency) 6667 ); 6668} 6669 6670`,tZ=` 6671 #ifdef USE_COLLIDER 6672 float restitution = max(uBounce * 2., .01); // Energy Loss 6673 // SPHERE COLLIDER 6674 // ************************************************************** 6675 #ifdef USE_SPHERE_COLLIDER 6676 // Convert collider size to radii (assuming uColliderSize is the diameter in each axis) 6677 vec3 radii = uColliderSize; 6678 // Adjust position relative to collider 6679 vec3 relPos = position - uColliderPos; 6680 // Apply rotation of the collider to the relative position 6681 relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos); 6682 // Scale relative position by radii (for ellipsoid collision detection) 6683 vec3 scaledPos = relPos / radii; 6684 // Calculate ellipsoidal distance 6685 float dist = length(scaledPos); // Distance in terms of ellipsoid 6686
6687 // Check for collision 6688 if (dist <= 1. + particleSize / length(radii) && collisionFlag == 0.0) { 6689 // Compute the normal at the collision point, accounting for particle size 6690 vec3 adjustedPos = scaledPos * (1.0 + particleSize / length(radii)); 6691 // Compute the normal at the collision point 6692 vec3 normal = ellipsoidNormal(adjustedPos, radii); 6693 // Rotate the normal back to world space 6694 normal = applyQuaternionToVector(uColliderQuaternion, normal); 6695 // Reflect the velocity vector off the normal 6696 velocity = reflect(velocity, normal) * restitution; 6697 6698 collisionFlag = 1.0; 6699 } else { 6700 collisionFlag = 0.0; 6701 } 6702 #endif 6703 6704 // BOX COLLIDER or PLANE COLLIDER 6705 // ************************************************************** 6706 #ifdef USE_BOX_COLLIDER 6707 // Box dimensions and repulsion variables 6708 vec3 boxHalfSize = uColliderSize / 2.0; 6709 // Convert world position to box's local space 6710 vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos); 6711 // Collision detection 6712 vec3 localDistance = abs(localPos) - boxHalfSize; 6713 float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z)); 6714 6715 // Collision Detected 6716 if (distToSurface <= particleSize * 0.5 && collisionFlag == 0.0) { 6717 // Find the nearest face normal for bounce direction 6718 vec3 normal; 6719 if (localDistance.x > localDistance.y && localDistance.x > localDistance.z) { 6720 normal = vec3(sign(localPos.x), 0.0, 0.0); 6721 } else if (localDistance.y > localDistance.z) { 6722 normal = vec3(0.0, sign(localPos.y), 0.0); 6723 } else { 6724 normal = vec3(0.0, 0.0, sign(localPos.z)); 6725 } 6726 // Rotate normal back to world space 6727 normal = applyQuaternionToVector(uColliderQuaternion, normal); 6728 // Reflect velocity and apply repulsion force 6729 velocity = reflect(velocity, normal) * restitution; 6730 6731 collisionFlag = 1.0; 6732 } else { 6733 collisionFlag = 0.0; 6734 } 6735 #endif 6736 #endif 6737 // END COLLIDER 6738`,iZ=` 6739 #ifdef USE_ATTRACTOR 6740 6741 #ifdef USE_SPHERE_COLLIDER 6742 // Convert collider size to radii (assuming uColliderSize is the diameter in each axis) 6743 vec3 radii = uColliderSize; 6744 // Adjust position relative to collider 6745 vec3 relPos = position - uColliderPos; 6746 // Apply rotation of the collider to the relative position 6747 relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos); 6748 // Scale relative position by radii (for ellipsoid collision detection) 6749 vec3 scaledPos = relPos / radii; 6750 // Calculate ellipsoidal distance 6751 float distToSurface = length(scaledPos); // Distance in terms of ellipsoid 6752 float insideCheck = 1.0; 6753 6754 #endif 6755 6756 6757 #ifdef USE_BOX_COLLIDER 6758 // Box dimensions 6759 vec3 boxHalfSize = uColliderSize / 2.0; 6760 // Convert world position to box's local space 6761 vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos); 6762 vec3 localDistance = abs(localPos) - boxHalfSize; 6763 float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z)); 6764 float insideCheck = particleSize; 6765 #endif 6766 6767 // Apply vortex force inside the Helper 6768 #ifdef USE_FORCE_LOCAL_SPACE 6769 if (distToSurface <= insideCheck ) { 6770 // Define parameters for the attractor field 6771 #ifdef USE_SPHERE_COLLIDER 6772 float attractorStrength = (1.0 - distToSurface ) * uForceIntensity; // Adjust as needed 6773 #endif 6774 6775 #ifdef USE_BOX_COLLIDER 6776 float attractorStrength = max((1.0 - insideCheck / distToSurface), 0.) * uForceIntensity; // Adjust as needed 6777 #endif 6778 6779 float attractorDamping = uForceDamping; // Adjust as needed (higher values will attenuate velocity more) 6780 6781 // Use the same radii calculation code as for the collider 6782 vec3 attractorRadii = uColliderSize; 6783 // Adjust position relative to attractor center 6784 vec3 relPos = position - uColliderPos; 6785 // Apply rotation of the collider to the relative position 6786 relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos); 6787 // Scale relative position by radii (for ellipsoid attraction) 6788 vec3 scaledPos = relPos / attractorRadii; 6789 6790 // Calculate ellipsoidal distance as attractor radius 6791 float attractorRadius = length(scaledPos); 6792 // Calculate the distance from the attractor center 6793 vec3 relativePosition = position - uColliderPos; 6794 // Calculate the force vector towards the attractor center 6795 vec3 attractorForce = normalize(relativePosition) * attractorStrength; 6796 // Apply the attractor force to the particle 6797 velocity -= attractorForce; 6798 // Attenuate the particle's velocity 6799 velocity *= attractorDamping; 6800 } 6801 #else 6802 // Calculate the distance from the attractor center 6803 vec3 relativePosition = position - uColliderPos; 6804 // Calculate the force vector towards the attractor center 6805 vec3 attractorForce = normalize(relativePosition) * uForceIntensity; 6806 // Apply the attractor force to the particle 6807 velocity -= attractorForce; 6808 // Attenuate the particle's velocity 6809 velocity *= uForceDamping; 6810 #endif 6811 #endif 6812`,rZ=` 6813 #ifdef USE_VORTEX 6814 // Box dimensions 6815 vec3 boxHalfSize = uColliderSize / 2.0; 6816 // Convert world position to box's local space 6817 vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos); 6818 vec3 localDistance = abs(localPos) - boxHalfSize; 6819 float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z)); 6820 6821 // Apply vortex force inside the box 6822 if (distToSurface <= particleSize) { 6823 float vortexStrength = uForceIntensity; 6824 vec3 localTopCenter = vec3(0.0, 0., 0.0); 6825 6826 // Transform the local top center to the world space 6827 vec3 vortexCenter = uColliderPos + applyQuaternionToVector(uColliderQuaternion, localTopCenter); 6828 // Calculate the vector from particle to vortex center 6829 vec3 vortexVector = vortexCenter - position; 6830 6831 // Calculate the rotation axis from the inverse of the collider's quaternion and the fixed up vector 6832 // Note: important to add a tiny z component to the up vector to avoid instability 6833 vec3 upVector = vec3(0.0, 1.0, 0.01); 6834 vec3 rotationAxis = cross(upVector, applyQuaternionToVector(uColliderQuaternion, vortexVector)); 6835 rotationAxis = normalize(rotationAxis); 6836 6837 // Add rotational component to velocity 6838 float rotationSpeed = length(vortexVector * vortexStrength * 3.0) ; 6839 6840 vec3 rotationVelocity = rotationAxis * rotationSpeed; 6841 // velocity += rotationVelocity * 0.005 ; 6842 velocity = rotationVelocity * 0.005 ; 6843 6844 // Calculate vortex force 6845 // vec3 vortexForce = normalize(vortexVector) * uSpeed * .1 ; 6846 // Apply the vortex force to the particle 6847 vec3 originDirection = applyQuaternionToVector(uWorldQuaternion, directions); 6848 velocity += applyForce( originDirection * uSpeed * (1. - uForceDamping) , mass * .5); 6849 } 6850 #endif 6851`,sZ=` 6852// uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU 6853// uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU 6854// uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU 6855uniform sampler2D uOriginalPosition; 6856uniform sampler2D uDirections; 6857uniform vec3 uDirectionsAxis; 6858uniform vec4 uWorldQuaternion; 6859uniform vec3 uGravity; 6860uniform float uNoiseStrength; // Variation of the noise 6861uniform float uNoiseScale; // Scale of the noise 6862uniform float uNoiseSeed; // Seed of the noise 6863uniform float particleSize; 6864uniform float uSpeed; // update speed of the particles
6865uniform float uRandomMassFactor; 6866 6867// COLLIDER 6868uniform vec3 uColliderPos; // Collider Position 6869uniform vec3 uColliderSize; // Collider Dimension 6870uniform vec4 uColliderQuaternion; // Collider Rotation 6871uniform vec4 uColliderQuaternionInvert; // Collider Rotation 6872uniform float uBounce; // Bounce factor 6873uniform float uForceDamping; 6874uniform float uForceIntensity; 6875 6876 6877`+eZ+` 6878float rand(vec2 co){ 6879 return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453); 6880} 6881vec3 applyQuaternionToVector( vec4 q, vec3 v ){ 6882 return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v ); 6883 } 6884vec3 applyForce(vec3 force, float mass) { 6885 vec3 acceleration = force / mass; 6886 6887 return acceleration; 6888} 6889 6890vec4 conjugate(vec4 q) { 6891 return vec4(q.w, -q.x, -q.y, -q.z); 6892} 6893 6894// Function to compute the normal of the ellipsoid at a given point 6895vec3 ellipsoidNormal(vec3 p, vec3 radii) { 6896 return normalize(p / (radii * radii)); 6897} 6898 6899float friction = .3; 6900 6901void main() { 6902 vec2 vUv = gl_FragCoord.xy / resolution.xy; 6903 vec3 position = texture2D( uCurrentPosition, vUv ).xyz; 6904 vec3 originalPosition = texture2D( uOriginalPosition, vUv ).xyz; 6905 float timeLeft = texture2D( uCurrentPosition, vUv ).w; 6906 vec3 directions = texture2D( uDirections, vUv ).xyz; 6907 vec3 velocity = texture2D( uCurrentVelocity, vUv ).xyz; 6908 float mass = rand(originalPosition.xy) * 0.5 + 0.5; 6909 float isSpawning = texture2D( uCurrentEmissionRate, vUv ).x; // 1. = spawning, 0. = not spawning 6910 float isActive = texture2D( uCurrentEmissionRate, vUv ).y; // 1. = active, 0. = not active 6911 float collisionFlag =texture2D( uCurrentVelocity, vUv ).w; // Indicate collision 6912 6913 // Randomness Mass 6914 mass = (1.0 - (uRandomMassFactor * mass)); 6915 6916 if (isActive == 1.0) { 6917 // ************************************************************** 6918 // FORCES NOISES 6919 // ************************************************************** 6920 #ifdef USE_CURL_NOISE 6921 if (uNoiseScale > 0.0 ) { 6922 velocity = curlNoise(position * uNoiseScale * .002, uNoiseSeed) * ( uNoiseStrength + 1.0) * .05 * uSpeed; 6923 } 6924 // Variation of the noise Over Time 6925 if (uNoiseStrength > 0.0 && uNoiseScale == 0.0 ) { 6926 velocity += curlNoise( position, uNoiseSeed) * uNoiseStrength * 0.05 * uSpeed; 6927 } 6928 #endif 6929 // ************************************************************** 6930 #ifdef USE_SIMPLEX_NOISE 6931 if (uNoiseScale > 0.0 ) { 6932 velocity = vec3(snoise(position * uNoiseScale * .001) * ( uNoiseStrength + 1.0) * .1); 6933 velocity *= uSpeed; 6934 } 6935 // Variation of the noise Over Time 6936 if (uNoiseStrength > 0.0 && uNoiseScale == 0.0) { 6937 velocity += vec3(snoise(position * uNoiseStrength * .001) * .05 * uSpeed); 6938 } 6939 #endif 6940 // ************************************************************** 6941 #ifdef USE_FBM_NOISE 6942 if (uNoiseScale > 0.0 ) { 6943 velocity = fbm_vec3(position * uNoiseScale * .001, ( uNoiseStrength + 1.0), uNoiseSeed); 6944 velocity *= uSpeed; 6945 } 6946 // Variation of the noise Over Time 6947 if (uNoiseStrength > 0.0 && uNoiseScale == 0.0 ) { 6948 velocity += fbm_vec3(position * uNoiseStrength * .001, ( uNoiseStrength + 1.0), uNoiseSeed) * .1 * uSpeed; 6949 } 6950 #endif 6951 6952 // COLLIDER 6953 ${tZ} 6954 // ATTRACTION 6955 ${iZ} 6956 // VORTEX 6957 ${rZ} 6958 } 6959 // End isActive 6960 6961 // SPAWN BIRTH 6962 // ************************************************************** 6963 // if (isSpawning == 1.) 6964 #ifdef USE_NORMALS 6965 velocity = mix(velocity, applyQuaternionToVector(uWorldQuaternion, directions) * uSpeed, isSpawning); 6966 #else 6967 velocity = mix(velocity, applyQuaternionToVector(uWorldQuaternion, uDirectionsAxis) * uSpeed, isSpawning); 6968 #endif 6969 6970 // if (collisionFlag == 0.0) 6971 velocity += applyForce(uGravity, mass * .5) * (1.0 - collisionFlag); 6972 6973 gl_FragColor = vec4(velocity, collisionFlag); 6974} 6975`,bP=` 6976 6977 // Linear Fade In 6978 float linearFadeIn(float t) { 6979 return t; 6980 } 6981 6982 6983 // linear fade out 6984 float linearFadeOut(float t) { 6985 return 1.0 - t; 6986 } 6987 6988 float linearInOut(float t) { 6989 return t < 0.5 ? t : (1.0 - t); 6990 } 6991 6992 // lerp 6993 float lerp(float a, float b, float t) { 6994 return a + (b - a) * t; 6995 } 6996 6997 // Ease In Out Quart 6998 float exponentialInOut(float t) { 6999 return t < 0.4 ? lerp(0.0, 1.0, t / 0.4) : 7000 t > 0.6 ? lerp(1.0, 0.0, (t - 0.6) / 0.4) : 7001 1.0; 7002 } 7003 7004 // constant 7005 float constant(float t) { 7006 return 1.0; 7007 } 7008`,aZ=` 7009 7010float rand(vec3 co){ 7011 return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); 7012} 7013 7014vec3 applyQuaternionToVector( vec4 q, vec3 v ){ 7015 return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v ); 7016} 7017 7018vec3 applyForce(vec3 force, float mass) { 7019 vec3 acceleration = force / mass; 7020 7021 return acceleration; 7022} 7023`,nZ=` 7024vec3 rgb2xyz (in vec3 rgb) { 7025 float r = rgb.r; 7026 float g = rgb.g; 7027 float b = rgb.b; 7028 7029 r = r > 0.04045 ? pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); 7030 g = g > 0.04045 ? pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); 7031 b = b > 0.04045 ? pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); 7032 7033 float x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); 7034 float y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); 7035 float z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); 7036 7037 vec3 xyz = vec3( 7038 (r * 0.4124) + (g * 0.3576) + (b * 0.1805) * 100.0, 7039 (r * 0.2126) + (g * 0.7152) + (b * 0.0722) * 100.0, 7040 (r * 0.0193) + (g * 0.1192) + (b * 0.9505) * 100.0 7041 ); 7042 return(xyz); 7043} 7044 7045vec3 xyz2lab (in vec3 xyz) { 7046 float x = xyz.x / 95.047; 7047 float y = xyz.y / 100.0; 7048 float z = xyz.z / 108.883; 7049 7050 x = x > 0.008856 ? pow(x, 1.0 / 3.0) : (7.787 * x) + (16.0 / 116.0);
7051 y = y > 0.008856 ? pow(y, 1.0 / 3.0) : (7.787 * y) + (16.0 / 116.0); 7052 z = z > 0.008856 ? pow(z, 1.0 / 3.0) : (7.787 * z) + (16.0 / 116.0); 7053 7054 vec3 lab = vec3((116.0 * y) - 16.0, 500.0 * (x - y), 200.0 * (y - z)); 7055 return(lab); 7056} 7057 7058vec3 rgb2lab(in vec3 rgb) { 7059 vec3 xyz = rgb2xyz(rgb); 7060 vec3 lab = xyz2lab(xyz); 7061 return(lab); 7062} 7063 7064vec3 xyz2rgb (in vec3 xyz) { 7065 float x = xyz.x / 100.0; 7066 float y = xyz.y / 100.0; 7067 float z = xyz.z / 100.0; 7068 7069 7070 float r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); 7071 float g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); 7072 float b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); 7073 7074 r = r > 0.0031308 ? ((1.055 * pow(r, 1.0 / 2.4)) - 0.055) : r * 12.92; 7075 g = g > 0.0031308 ? ((1.055 * pow(g, 1.0 / 2.4)) - 0.055) : g * 12.92; 7076 b = b > 0.0031308 ? ((1.055 * pow(b, 1.0 / 2.4)) - 0.055) : b * 12.92; 7077 7078 r = min(max(0.0, r), 1.0); 7079 g = min(max(0.0, g), 1.0); 7080 b = min(max(0.0, b), 1.0); 7081 7082 return(vec3(r, g, b)); 7083} 7084 7085vec3 lab2xyz (in vec3 lab) { 7086 float l = lab.x; 7087 float a = lab.y; 7088 float b = lab.z; 7089 7090 float y = (l + 16.0) / 116.0; 7091 float x = a / 500.0 + y; 7092 float z = y - b / 200.0; 7093 7094 float y2 = pow(y, 3.0); 7095 float x2 = pow(x, 3.0); 7096 float z2 = pow(z, 3.0); 7097 7098 y = y2 > 0.008856 ? y2 : (y - 16.0 / 116.0) / 7.787; 7099 x = x2 > 0.008856 ? x2 : (x - 16.0 / 116.0) / 7.787; 7100 z = z2 > 0.008856 ? z2 : (z - 16.0 / 116.0) / 7.787; 7101 7102 x *= 95.047; 7103 y *= 100.0; 7104 z *= 108.883; 7105 7106 return(vec3(x, y, z)); 7107} 7108vec3 lab2rgb (in vec3 lab) { 7109 vec3 xyz = lab2xyz(lab); 7110 vec3 rgb = xyz2rgb(xyz); 7111 return(rgb); 7112} 7113 7114`,oZ=` 7115 uniform sampler2D uPosition; 7116 uniform float uSize; 7117 uniform float uSizeEnd; 7118 uniform vec3 uWorldOffset; 7119 uniform vec4 uWorldQuaternion; 7120 // Billboard Behavior - Currently at Zero, but we can change that 7121 uniform float uRotation; 7122 uniform float uRotationEnd; 7123 uniform vec2 center; 7124 7125 // Randomness 7126 uniform float uRandScaleFactor; 7127 uniform float uRandRotationFactor; 7128 7129 attribute vec2 ref; 7130 7131 varying float v_LifeLeft; // normalized lifetime 1 to 0 7132 varying vec2 vUv; 7133 varying vec2 vRef; 7134 7135 ${aZ} 7136 ${bP} 7137`,lZ=({easeSize:e="linearFadeOut"})=>` 7138 vUv = uv; 7139 vRef = ref; 7140 // Normalized LifeTime 1 to 0 7141 float lifeLeft = texture2D(uPosition, ref).w; 7142 v_LifeLeft = lifeLeft; 7143 // Position From DataTexture Simulation 7144 vec3 pos = texture2D(uPosition, ref).rgb - uWorldOffset; 7145 // Apply World Quaternion 7146 pos = applyQuaternionToVector(uWorldQuaternion, pos); 7147 7148 #ifdef USE_SIZE_END 7149 // Scaled Over Time 7150 float t = 1. - lifeLeft; 7151 float currentSize = mix(uSize, uSizeEnd, t); // Linearly interpolate between uSize and uSizeEnd 7152 vec3 scaledPosition = position * vec3(currentSize); 7153 #else 7154 // Change Size Behavior over LifeTime 7155 float easeSize = ${e}(1. - lifeLeft); 7156 // Scaled Over Time 7157 vec3 scaledPosition = position * vec3(uSize * easeSize); 7158 #endif 7159 7160 // Billboard Behavior 7161 vec2 scale; 7162 scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); 7163 scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); 7164 // Randomness 7165 float randRef = rand(ref); 7166 scale *= (1.0 - (uRandScaleFactor * randRef)); 7167 // Rotation 7168 float randRotation = 2.0 * PI * ( uRandRotationFactor * randRef); 7169 float originalRotation = (1.0 - uRotation) * 2.0 * PI; 7170 float originalRotationEnd = (1.0 - uRotationEnd) * 2.0 * PI; 7171 // OverTime 7172 float finalRotation = mix(originalRotation + randRotation, originalRotationEnd + randRotation, lifeLeft); 7173 7174 vec2 alignedPosition = ( scaledPosition.xy - ( center - vec2( 0.5 ) ) ) * scale; 7175 vec2 rotatedPosition; 7176 rotatedPosition.x = cos( finalRotation ) * alignedPosition.x - sin( finalRotation ) * alignedPosition.y; 7177 rotatedPosition.y = sin( finalRotation ) * alignedPosition.x + cos( finalRotation ) * alignedPosition.y; 7178 7179 mat4 instanceMatrix = mat4( 7180 vec4(1.0, 0.0, 0.0, 0.0), 7181 vec4(0.0, 1.0, 0.0, 0.0), 7182 vec4(0.0, 0.0, 1.0, 0.0), 7183 vec4(pos.x, pos.y, pos.z, 1.0) 7184 ); 7185 7186 mvPosition = modelViewMatrix * instanceMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); 7187 mvPosition.xy += rotatedPosition; 7188 gl_Position = projectionMatrix * mvPosition; 7189`,hZ=` 7190 uniform vec4 uColor; // start color 7191 uniform vec4 uColor2; // end color 7192 uniform sampler2D uTexture; // texture 7193 varying float v_LifeLeft; // normalized lifetime 1 to 0 7194 varying vec2 vUv; 7195 varying vec2 vRef; 7196 7197 float random(vec2 co) { 7198 return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); 7199 } 7200 `+bP+` 7201 ${nZ} 7202 7203`,cZ=({easeOpacity:e="linearFadeOut"})=>` 7204 // if Particle is dead, hide it 7205 if (v_LifeLeft <= 0.005 ) { 7206 discard; 7207 } 7208 7209 #ifdef USE_RANDOM_COLORING 7210 float randVal = random(vRef); // Generate a random value based on the reference 7211 vec4 color = mix(uColor, uColor2, randVal); // Interpolate between the two colors 7212 #else 7213 vec4 color = mix(uColor, uColor2, 1. - v_LifeLeft); 7214 #endif 7215 7216 // Opacity over Life Time 7217 float finalAlpha = ${e}(1. - v_LifeLeft); 7218 vec4 textureColor = texture2D(uTexture, vUv).rgba; 7219 finalColor = textureColor.rgb * color.rgb; 7220 finalAlpha = color.a * textureColor.a * finalAlpha; 7221 7222 gl_FragColor = vec4(finalColor, finalAlpha); 7223 7224`,uZ=class extends Dt{constructor(e,t){super(),this.needsJitter=!0,this.type="ParticleMaterial",this.easeOpacity="linearFadeIn",this.easeSize="linearFadeIn",this.useSizeEnd=!1,this.isColoringRandom=!1,this.init(e,t),this.context=t}reset(){}init(e,t){this.transparent=!0,this.depthTest=!0,this.depthWrite=!1,this.easeOpacity=e.ease,this.easeSize=e.easeSize,this.layers=[],ji.startContext(ji.globalContext),this.lightLayer=new la(0,"",{..._i.defaultData("light","phong"),visible:!1},new gx,{},t.shared),ji.endContext(ji.globalContext),this.build()}updateState(e){e.coloring!==void 0&&(this.isColoringRandom=e.coloring==="random"),e.color!==void 0&&(e.color instanceof Array?this.uniforms.uColor.value=e.color:this.uniforms.uColor.value=this.context.shared.color(e.color)),e.color2!==void 0&&(e.color2 instanceof Array?this.uniforms.uColor2.value=e.color2:this.uniforms.uColor2.value=this.context.shared.color(e.color2)),e.size!==void 0&&(this.uniforms.uSize.value=e.size[0],this.uniforms.uSizeEnd.value=e.size[1],e.size[0]!==e.size[1]?this.useSizeEnd=!0:this.useSizeEnd=!1),e.ease!==void 0&&(this.easeOpacity=e.ease,this.build()),e.easeSize!==void 0&&(this.easeSize=e.easeSize,this.build()),this.needsUpdate=!0}onBeforeCompile(e){this.build(),e.defines=this.defines,e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader}build(){let e=new bT;return e.needsJitter=this.needsJitter,e.addFragmentParsCode(W7),e.buildShader("vertex",this.fragment),e.buildShader("fragment",this.fragment),e.addFragmentFinalCode(q7),this.isColoringRandom&&e.define("USE_RANDOM_COLORING"),this.useSizeEnd&&e.define("USE_SIZE_END"),e.addVertexParsCode(oZ),e.addFragmentParsCode(hZ),e.addVertexFinalCode(lZ({easeSize:this.easeSize})),e.addFragmentFinalCode(cZ({easeOpacity:this.easeOpacity})),this.vertexShader=e.getCode("vertex"),this.fragmentShader=e.getCode("fragment"),this.defines=e.defines,this.uniforms={...e.uniforms,...this.uniforms},this.extensions=e.extensions,this}get nodeMaterial(){return this}get fragment(){return this.lightLayer.node}getDefines(){return this.defines}
vendor: 22,717 bytes, lines 7224-7272
7224nodeMaterialDispose(){this.layers.forEach(e=>e.dispose()),super.dispose()}},gv=class{constructor(e,t,i,r){this.type="SphereEmitterShape",this.targetMesh=void 0,this.size=e,this.type=i,this.textureSize=QK(t);let s=1;this.targetMesh=r?.geometry.type==="BufferGeometry"||r?.type==="Mesh"&&r&&r.geometry.hasAttribute("position")&&r.geometry.hasAttribute("normal")?r:this.getMesh(i,s);let{positions:a,dataTexture:n,dataTextureNormals:o}=this.createPositions(this.textureSize,this.targetMesh??this.getMesh(i,s));this.positionsTexture=n,this.positionsAttribute=a,this.directionsTexture=o}createPositions(e,t){let{positions:i,normals:r}=KK(t,e*e),s=r2(i,e),a=r2(r,e);return{dataTexture:s,positions:i,dataTextureNormals:a}}getMesh(e,t){let i=null;switch(e){case"SphereEmitterShape":{i=new hh(t*.5,32,32);break}case"TorusEmitterShape":{i=new zM(t*.5,.3,15,40);break}case"ConeEmitterShape":{i=new n1(t,t,15);break}case"BoxEmitterShape":{i=new Hs(t,t,t);break}case"PlaneEmitterShape":{i=new Sa(t,t),i.rotateX(-Math.PI/2);break}case"MeshEmitterShape":{i=new hh(t,32,32);break}default:{i=new hh(t,32,32);break}}return new Zt(i,new pn({color:16711680}))}applyToShader(e,t){this.size=new M().fromArray(t.size.map(i=>typeof i=="number"?i:1)),e.uEmitterSize.value=this.size}dispose(){this.positionsTexture.dispose(),this.directionsTexture.dispose(),this.positionsAttribute=new Float32Array}};function eh(e){let t={...e},i=bf.defaultData;t.forceFieldObjectId&&(t.colliderEntityId=t.forceFieldObjectId);let r={...i.shape,...t.shape},s={...i.renderMaterial,...t.renderMaterial};return{...i,...t,shape:r,renderMaterial:s}}var dZ=` 7225// uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU 7226// uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU 7227// uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU 7228 7229uniform sampler2D uIndex; // Texture with corresponding index 7230uniform float uLastIndexEmitted; // Last emitted index 7231uniform float uParticlesToEmit; // Number of particles to emit on that frame 7232uniform float uTime; 7233 7234void main() { 7235 vec2 vUv = gl_FragCoord.xy / resolution.xy; 7236 float particleIndex = texture(uIndex, vUv).x; 7237 float timeLeft = texture2D( uCurrentPosition, vUv ).w; 7238 float isActive = texture2D( uCurrentEmissionRate, vUv ).g; // 1. = active, 0. = not active 7239 float timeStart = texture2D( uCurrentEmissionRate, vUv ).b; 7240 7241 7242 // ********** Detect Colision to Create a flag and use it in position ********** 7243 // We are doing this here, so 7244 7245 // ********** Emit Particles ********** 7246 // X = isSpawning 0.0 or 1.0 7247 // Y = isActive 0.0 or 1.0 7248 // Check if the vertex index is between the first value and the last value 7249 // if (particleIndex >= uLastIndexEmitted && particleIndex < uLastIndexEmitted + uParticlesToEmit) { 7250 // // Emit a particle by writing 1 to the red channel of the color output 7251 // // r: 1. == emit the particle 7252 // // g: 1. == particle is now active 7253 // timeStart = uTime; 7254 // gl_FragColor = vec4(1.0, 1.0, timeStart, 1.0); 7255 // } else { 7256 // // The Particle is either already emitted or not in the range of the particles to emit 7257 // // Do not emit a particle by writing 0 to the red channel of the color output 7258 // gl_FragColor = vec4(0.0, isActive, timeStart, 1.0); 7259 // } 7260 // Determine if the particle is within the emission range 7261 float emitLowerBound = step(uLastIndexEmitted, particleIndex); 7262 float emitUpperBound = step(particleIndex, uLastIndexEmitted + uParticlesToEmit - 1.0); 7263 float emitParticle = emitLowerBound * emitUpperBound; // 1.0 if in range, 0.0 otherwise 7264 7265 // Set timeStart and color 7266 timeStart = mix(timeStart, uTime, emitParticle); 7267 gl_FragColor = vec4(emitParticle, mix(isActive, 1.0, emitParticle), timeStart, 1.0); 7268 7269 7270} 7271`,vv=10,pZ=class extends Vt{constructor(e,t){super(),this.type="ParticleEmitter",this.debugMode=!1,this.worldSpace=!0,this.rootObject=null,this.gpuCompute=null,this.positionSimRT=null,this.velocitySimRT=null,this.emissionRateSimRT=null,this.emitterShape=void 0,this.isEmitting=!1,this.hasBeenReset=!1,this.emittedParticlesAmount=0,this.lastEmitTime=0,this.globalTime=0,this.targetFPS=60,this.previousRatio=1,this.lerpFactor=.4,this.particlesAmount=0,this.noiseStrength=0,this.noiseScale=0,this.isBillboardBased=!0,this.simFeaturesDefinition={USE_COLLIDER:!1,USE_ATTRACTOR:!1,USE_VORTEX:!1,USE_SPHERE_COLLIDER:!1,USE_BOX_COLLIDER:!1,USE_FORCE_LOCAL_SPACE:!1,USE_NORMALS:!1,USE_CURL_NOISE:!0,USE_SIMPLEX_NOISE:!1,USE_FBM_NOISE:!1},this.textureLoader=new _B,this.currentWorldPosition=new M,this.systemQuaternion=new nt,this.worldGravity=new M(0,0,0),this.directionAxis=new M(0,0,0),this.colliderV3=new M(0,0,0),this.colliderQuaternion=new nt(0,0,0,1),this.matrixAutoUpdate=!0,this.renderer=e,this.system=t,this.shared=t.context.shared;let i=t.data;this.material=new uZ(i.renderMaterial,t.context),this.material.uniforms={uSize:{value:0},uSizeEnd:{value:0},uColor:{value:i.renderMaterial.color},uColor2:{value:i.renderMaterial.color2},uPosition:{value:new M(0,0,0)},uEmissionData:{value:new M(0,0,0)},uTexture:{value:this.defaultTexture},uWorldOffset:{value:new M(0,0,0)},uWorldQuaternion:{value:new ot(0,0,0,1)},uRandScaleFactor:{value:i.randomScale??0},uRandRotationFactor:{value:i.randomRotation??0},uRotation:{value:i.renderMaterial.spriteRotation[0]??0},uRotationEnd:{value:i.renderMaterial.spriteRotation[1]??0}},this.setTexture(this.material.uniforms,i.renderMaterial.texture),this.init(i)}setTexture(e,t){let i=t.data;if(typeof t=="string"){let r=this.shared.image(t),s=new li(r.img);s.needsUpdate=!0,e.uTexture.value=s;return}if(typeof i!="string"){let r=new Image;r.onload=()=>{let n=new li(r);n.needsUpdate=!0,e.uTexture.value=n};let s=new Blob([i],{type:"image/*"}),a=URL.createObjectURL(s);r.src=a}}updateGeometryAttributes(e,t){let i=YK(t);!this.emitterShape?.positionsAttribute||e.geometry.setAttribute("ref",new pu(i,2))}applyWorldSpace(){if(!this.system.started||!this.worldSpace||!this.positionSimRT||!this.velocitySimRT)return;let e=this.system;e.getWorldQuaternion(this.systemQuaternion),this.systemQuaternion.invert(),e.getWorldPosition(this.currentWorldPosition),this.material.uniforms.uWorldOffset.value=this.currentWorldPosition,this.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize()),this.positionSimRT.material.uniforms.uWorldOffset.value=this.currentWorldPosition,this.systemQuaternion.invert(),this.positionSimRT.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize()),this.velocitySimRT.material.uniforms.uWorldQuaternion.value.copy(this.systemQuaternion.normalize())}update(e,t){if(!this.gpuCompute||!this.positionSimRT||!this.velocitySimRT||!this.emissionRateSimRT||this.hasBeenReset)return;if(this.checkIfAllParticlesAreDead()&&!this.hasBeenReset){this.reset();return}this.applyWorldSpace(),this.globalTime=e,this.positionSimRT.material.uniforms.uTime.value=e,this.emissionRateSimRT.material.uniforms.uTime.value=e;let i=1e3/t,r=this.targetFPS/i,s=this.previousRatio+(r-this.previousRatio)*this.lerpFactor;this.positionSimRT.material.uniforms.uFPSRatio.value=s,this.previousRatio=s;let a=this.isEmitting?this.GoEmitSomeParticles(e,this.system.data.birthRatePerSec):0;this.emissionRateSimRT.material.uniforms.uLastIndexEmitted.value=this.emittedParticlesAmount,this.emissionRateSimRT.material.uniforms.uParticlesToEmit.value=a,this.material.uniforms.uPosition.value=this.gpuCompute.getCurrentRenderTarget(this.positionSimRT)?.texture,this.system.colliderEntities.length>0&&this.renderColliders(),this.gpuCompute.compute()}renderColliders(){if(!this.velocitySimRT)return;let e=this.system.colliderEntities[0],t=this.simFeaturesDefinition.USE_COLLIDER||this.simFeaturesDefinition.USE_ATTRACTOR||this.simFeaturesDefinition.USE_VORTEX;if(e.destroyedInAction&&t&&this.init(eh({...this.system.data,colliderEntityId:null})),!e||e.destroyedInAction)return;e.getWorldPosition(this.colliderV3),this.colliderV3.y===0&&(this.colliderV3.y=1e-4),this.velocitySimRT.material.uniforms.uColliderPos.value.copy(this.colliderV3);let i=e.data.size;this.colliderV3.fromArray(i),this.velocitySimRT.material.uniforms.uColliderSize.value.copy(this.simFeaturesDefinition.USE_SPHERE_COLLIDER?this.colliderV3.multiplyScalar(.5):this.colliderV3),e.getWorldQuaternion(this.colliderQuaternion),this.velocitySimRT.material.uniforms.uColliderQuaternion.value.copy(this.colliderQuaternion.normalize()),this.velocitySimRT.material.uniforms.uColliderQuaternionInvert.value.copy(this.colliderQuaternion.normalize().invert())}updateState(e){!this.velocitySimRT||!this.positionSimRT||(e.renderMaterial&&this.updateMaterialState(e.renderMaterial),this.updateParticleState(e))}updateVariableState(e,t){if(!this.velocitySimRT||!this.positionSimRT)return;t[2]==="size"&&this.material.updateState({size:[e,this.material.uniforms.uSizeEnd.value]}),t[2]==="sizeEnd"&&this.material.updateState({size:[this.material.uniforms.uSize.value,e]});let i=(r,s)=>{let a=[...this.system.data.shape.size];a[r]=s,this.updateParticleState({shape:{...this.system.data.shape,size:a}})};t[2]==="shape_size_0"&&i(0,e),t[2]==="shape_size_1"&&i(1,e),t[2]==="shape_size_2"&&i(2,e),t[2]==="speed"&&(this.velocitySimRT.material.uniforms.uSpeed.value=e/vv),t[2]==="gravity"&&this.worldGravity.set(0,e/100,0),t[2]==="noiseStrength"&&(this.noiseStrength=e,this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),t[2]==="noiseScale"&&(this.noiseScale=e,this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),t[2]==="direction_x"&&(this.directionAxis=this.getDirectionAxis([Number(e),this.system.data.direction[1],this.system.data.direction[2]])),t[2]==="direction_y"&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],Number(e),this.system.data.direction[2]])),t[2]==="direction_z"&&(this.directionAxis=this.getDirectionAxis([this.system.data.direction[0],this.system.data.direction[1],Number(e)]))}updateMaterialState(e){this.material.updateState({...e,size:e.size?[Number(this.shared.getVariable(e.size[0],[this.uuid,"particles","size"])),Number(this.shared.getVariable(e.size[1],[this.uuid,"particles","sizeEnd"]))]:[0,0]}),e.texture&&(this.setTexture(this.material.uniforms,e.texture),this.material.needsUpdate=!0)}updateParticleState(e){if(!(!this.positionSimRT||!this.velocitySimRT)){if(this.shouldReInitGPUCompute(e)&&this.init(eh(this.system.data)),e.life!==void 0&&(this.positionSimRT.material.uniforms.uMaxLifeTime.value=e.life),e.speed!==void 0&&(this.velocitySimRT.material.uniforms.uSpeed.value=Number(this.shared.getVariable(e.speed,[this.uuid,"particles","speed"]))/vv),e.collisionBounce!==void 0&&(this.velocitySimRT.material.uniforms.uBounce.value=e.collisionBounce),e.noiseStrength!==void 0&&(this.noiseStrength=Number(this.shared.getVariable(e.noiseStrength,[this.uuid,"particles","noiseStrength"])),this.velocitySimRT.material.uniforms.uNoiseStrength.value=this.noiseStrength),e.noiseScale!==void 0&&(this.noiseScale=Number(this.shared.getVariable(e.noiseScale,[this.uuid,"particles","noiseScale"])),this.velocitySimRT.material.uniforms.uNoiseScale.value=this.noiseScale),e.noiseSeed!==void 0&&(this.velocitySimRT.material.uniforms.uNoiseSeed.value=e.noiseSeed),e.randomMass!==void 0&&(this.velocitySimRT.material.uniforms.uRandomMassFactor.value=e.randomMass),e.renderMaterial?.size!==void 0){let t=this.shared.getVariable(e.renderMaterial.size[0],[this.uuid,"particles","size"]);this.velocitySimRT.material.uniforms.particleSize.value=Number(t)}if(e.renderMaterial?.spriteRotation!==void 0&&(this.material.uniforms.uRotation.value=e.renderMaterial.spriteRotation[0],this.material.uniforms.uRotationEnd.value=e.renderMaterial.spriteRotation[1]),e.shape!==void 0){let t=e.shape.size??this.system.data.shape.size,i=[Number(this.shared.getVariable(t[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(t[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(t[2],[this.uuid,"particles","shape_size_2"]))],r={...eh(this.system.data).shape,size:i};this.emitterShape?.applyToShader(this.positionSimRT.material.uniforms,r)}if(e.gravity!==void 0&&(this.worldGravity.set(0,Number(this.shared.getVariable(this.system.data.gravity,[this.uuid,"particles","gravity"]))/100,0),this.velocitySimRT.material.uniforms.uGravity={value:this.worldGravity}),e.direction!==void 0){let t=this.getDirectionFromVariable(e.direction);this.directionAxis=this.getDirectionAxis(t),this.velocitySimRT.material.uniforms.uDirectionsAxis.value=this.directionAxis}e.randomRotation!==void 0&&(this.material.uniforms.uRandRotationFactor.value=e.randomRotation),e.randomScale!==void 0&&(this.material.uniforms.uRandScaleFactor.value=e.randomScale)}}updateForceFieldParameters(e){!this.velocitySimRT||(e.forceIntensity!==void 0&&(this.velocitySimRT.material.uniforms.uForceIntensity.value=e.forceIntensity),e.forceDambing!==void 0&&(this.velocitySimRT.material.uniforms.uForceDamping.value=e.forceDambing))}getDirectionAxis(e){let t=[Number(e[0])*Te.DEG2RAD,Number(e[1])*Te.DEG2RAD,Number(e[2])*Te.DEG2RAD],i=new Di(t[0],t[1],t[2],"XYZ");return this.directionAxis.set(0,1,0).applyEuler(i).normalize(),this.velocitySimRT&&(this.velocitySimRT.material.uniforms.uDirectionsAxis.value=this.directionAxis),this.directionAxis}shouldReInitGPUCompute(e){let{birthRatePerSec:t,rootObjectType:i,colliderEntityId:r,shape:s,emitTimeDuration:a,emitTimeCycle:n,life:o,directionMode:l,noiseType:h}=e;return t!==void 0||i!==void 0||r||r===null||n!==void 0||s!==void 0||o!==void 0||a!==void 0||l!==void 0||h!==void 0}init(e){this.dispose(),this.particlesAmount=this.getMaxParticlesAmount({birthRatePerSecond:e.birthRatePerSec,particleMaxLifeTime:e.life,loopDuration:e.emitTimeCycle==="infinity"?0:e.emitTimeDuration}),this.particlesAmount>1e5&&(console.warn("The maximum number of particles is limited to 100000."),this.particlesAmount=1e5),this.emitterShape=this.createShape(e.shape,this.particlesAmount);let t=setInterval(()=>{if(this.emitterShape)if(isNaN(this.emitterShape.positionsTexture.source.data.data[0])){this.init(e);return}else clearInterval(t)},100);if(!this.emitterShape)return;let i=new qK(this.emitterShape.textureSize,this.emitterShape.textureSize,this.renderer),r=this.updateSimulationDefinition(e),s=i.addVariable("uCurrentPosition",r+$K,this.emitterShape.positionsTexture),a=i.addVariable("uCurrentVelocity",r+sZ,this.emitterShape.directionsTexture),n=i.addVariable("uCurrentEmissionRate",dZ,JK(this.emitterShape.textureSize));i.setVariableDependencies(s,[s,a,n]),i.setVariableDependencies(a,[s,a,n]),i.setVariableDependencies(n,[s,a,n]);let o=ZK({size:this.emitterShape.textureSize}),l={uOriginalPosition:{value:this.emitterShape.positionsTexture},uWorldOffset:{value:new M(0,0,0)},uWorldQuaternion:{value:new ot(0,0,0,1)},uTime:{value:0},uFPSRatio:{value:1},uMaxLifeTime:{value:e.life},uEmitterSize:{value:new M(Number(this.shared.getVariable(e.shape.size[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(e.shape.size[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(e.shape.size[2],[this.uuid,"particles","shape_size_2"])))},particleSize:{value:0}};s.material.uniforms=l;let h=this.getDirectionFromVariable(e.direction);this.directionAxis=this.getDirectionAxis(h),this.worldGravity.set(0,Number(this.shared.getVariable(this.system.data.gravity,[this.uuid,"particles","gravity"]))/100,0),this.noiseStrength=Number(this.shared.getVariable(e.noiseStrength,[this.uuid,"particles","noiseStrength"])),this.noiseScale=Number(this.shared.getVariable(e.noiseScale,[this.uuid,"particles","noiseScale"]));let c=e.colliderEntityId&&this.system.getColliderData(e.colliderEntityId),u={uOriginalPosition:{value:this.emitterShape.positionsTexture},uDirections:{value:this.emitterShape.directionsTexture},uDirectionsAxis:{value:this.directionAxis},uWorldQuaternion:{value:new ot(0,0,0,1)},uColliderPos:{value:new M(0,0,0)},uColliderSize:{value:new M(0,0,0)},uForceIntensity:{value:c?c.forceIntensity:0},uForceDamping:{value:c?c.forceDambing:0},uColliderQuaternion:{value:new ot(0,0,0,1)},uColliderQuaternionInvert:{value:new ot(0,0,0,1)},particleSize:{value:0},uGravity:{value:this.worldGravity},uNoiseStrength:{value:this.noiseStrength},uNoiseScale:{value:this.noiseScale},uNoiseSeed:{value:e.noiseSeed},uRandomMassFactor:{value:e.randomMass},uBounce:{value:e.collisionBounce},uSpeed:{value:Number(this.shared.getVariable(e.speed,[this.uuid,"particles","speed"]))/vv}};a.material.uniforms=u;let d={uIndex:{value:o},uTime:{value:0},uLastIndexEmitted:{value:0},uParticlesToEmit:{value:0}};n.material.uniforms=d;let p=[Number(this.shared.getVariable(e.shape.size[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(e.shape.size[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(e.shape.size[2],[this.uuid,"particles","shape_size_2"]))],f={...eh(this.system.data).shape,size:p};this.emitterShape.applyToShader(s.material.uniforms,f),i.init(),this.gpuCompute=i,this.positionSimRT=s,this.velocitySimRT=a,this.emissionRateSimRT=n,this.rootObject=this.createPrimaryEmitter(this.emitterShape.textureSize),this.add(this.rootObject),this.material.needsUpdate=!0}getDirectionFromVariable(e){let t=Number(this.shared.getVariable(e[0],[this.uuid,"particles","direction_x"])),i=Number(this.shared.getVariable(e[1],[this.uuid,"particles","direction_y"])),r=Number(this.shared.getVariable(e[2],[this.uuid,"particles","direction_z"]));return[t,i,r]}updateSimulationDefinition(e){if(this.simFeaturesDefinition.USE_COLLIDER=!1,this.simFeaturesDefinition.USE_ATTRACTOR=!1,this.simFeaturesDefinition.USE_VORTEX=!1,this.simFeaturesDefinition.USE_SPHERE_COLLIDER=!1,this.simFeaturesDefinition.USE_BOX_COLLIDER=!1,this.simFeaturesDefinition.USE_FORCE_LOCAL_SPACE=!1,this.simFeaturesDefinition.USE_NORMALS=!1,this.simFeaturesDefinition.USE_CURL_NOISE=!1,this.simFeaturesDefinition.USE_SIMPLEX_NOISE=!1,this.simFeaturesDefinition.USE_FBM_NOISE=!1,e.colliderEntityId&&this.system.colliderEntities.length>0){let i=this.system.getColliderData(e.colliderEntityId);switch(i?.forceType){case"attractor":this.simFeaturesDefinition.USE_ATTRACTOR=!0;break;case"collider":this.simFeaturesDefinition.USE_COLLIDER=!0;break;case"vortex":this.simFeaturesDefinition.USE_VORTEX=!0;break}let r=i?.colliderType;r==="sphere"&&(this.simFeaturesDefinition.USE_SPHERE_COLLIDER=!0),r==="box"&&(this.simFeaturesDefinition.USE_BOX_COLLIDER=!0),i?.forceRange==="helper"&&(this.simFeaturesDefinition.USE_FORCE_LOCAL_SPACE=!0)}e.directionMode==="normals"&&(this.simFeaturesDefinition.USE_NORMALS=!0),e.noiseType==="curl"&&(this.simFeaturesDefinition.USE_CURL_NOISE=!0),e.noiseType==="simplex"&&(this.simFeaturesDefinition.USE_SIMPLEX_NOISE=!0),e.noiseType==="fbm"&&(this.simFeaturesDefinition.USE_FBM_NOISE=!0);let t="";for(let[i,r]of Object.entries(this.simFeaturesDefinition))r&&(t+=`#define ${i} 7272`);return t}createShape(e,t){this.emitterShape&&this.emitterShape.dispose();let i=new M(Number(this.shared.getVariable(e.size[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(e.size[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(e.size[2],[this.uuid,"particles","shape_size_2"])));if(e.type==="MeshEmitterShape"){let r=null;return this.system.context.scene.traverseEntity(s=>{s.uuid===e.fromMeshId&&(r=s)}),r?new gv(i,t,e.type,r):new gv(i,t,"SphereEmitterShape")}else return new gv(i,t,e.type)}createPrimaryEmitter(e){let t,i=e*e;return t=new Bz(new Sa(1,1,1),this.material,i),this.updateGeometryAttributes(t,e),this.material.needsUpdate=!0,t.onBeforeRender=()=>{this.applyWorldSpace()},t}getMaxParticlesAmount({birthRatePerSecond:e,particleMaxLifeTime:t,loopDuration:i=0}){return Math.ceil(e*(t+i))}dispose(){!this.gpuCompute||(this.rootObject?.parent?.remove(this.rootObject),this.gpuCompute.dispose(),this.material.nodeMaterialDispose(),this.emitterShape?.dispose())}GoEmitSomeParticles(e,t){let i=e-this.lastEmitTime,r=1/t;if(i>=r){let s=Math.max(1,Math.floor(i/r));return this.lastEmitTime=e,this.emittedParticlesAmount+s>this.particlesAmount&&(this.emittedParticlesAmount=0),this.emittedParticlesAmount+=s,s}return 0}checkIfAllParticlesAreDead(){return this.lastEmitTime+this.system.data.life+1<this.globalTime}reset(){this.hasBeenReset=!0,this.lastEmitTime=0,this.emittedParticlesAmount=0,this.gpuCompute&&this.init(eh(this.system.data))}startEmitting(e){this.isEmitting=!0,this.hasBeenReset=!1,this.lastEmitTime=e}stopEmitting(){this.isEmitting=!1}},nu=class extends xr{constructor(e,t,i){super(e,t),this.type="ParticleSystem",this.geometry=new He,this.actualTime=0,this.currentLoopTime=0,this.started=!1,this.stopped=!1,this.timeoutId=void 0,this.isFrozen=!1,this.isIdle=!0,this.emitter=null,this.colliderEntities=[],this.renderer=null,this.isPreWarm=!1,this._hasOnAfterRenderBeenCalled=!1,this.onAfterRender=r=>{this._hasOnAfterRenderBeenCalled||(this._hasOnAfterRenderBeenCalled=!0,this.init(r))},this.context=i,this.data={...t,...eh(t)},this.geometry.setAttribute("position",new De([],3)),this.material=new pn({colorWrite:!1}),this.frustumCulled=!1}init(e){this.renderer=e,this.emitter=new pZ(e,this),this.add(this.emitter),this.updateParticleState(this.data)}update(e){if(!this.isReady||!this.started||this.isFrozen||this.isIdle)return;this.actualTime+=e,this.stopped||(this.currentLoopTime+=e);let t=this.data.emitTimeCycle==="one_time";if((this.data.emitTimeCycle==="loop"||t)&&this.currentLoopTime>this.data.emitTimeDuration*1e3&&(this.stopped||(this.stop(),t||this.start(this.data.emitTimeDelay*1e3))),this.emitter&&this.started){let i=this.actualTime/1e3;this.emitter.update(i,e)}this.scale.set(1,1,1),this.updateMatrix()}isReady(){return!!this.emitter}hasCollider(e){return this.colliderEntities.some(t=>t.identity===e)}getColliderData(e){let t=this.colliderEntities.find(i=>i.identity===e);return t?t.data:null}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),Qt(e.path,["renderMaterial"])&&this.updateParticleState({renderMaterial:{...this.data.renderMaterial,...ir.drop(e,1).props}}),Qt(e.path,["shape"])&&this.updateParticleState({shape:{...this.data.shape,...ir.drop(e,1).props}})}updateState(e,t){super.updateState(e,t),this.updateParticleState(e)}updateParticleState(e){if(this.emitter){if(e.colliderEntityId!==void 0&&e.colliderEntityId!==null){let t=this.context.scene.find(e.colliderEntityId);this.colliderEntities=t?[t]:[]}e.colliderEntityId===null&&(this.colliderEntities=[]),this.emitter.updateState(e),e.emitTimeCycle&&this.started&&this.start()}}updateFromColliderEntity(e){!this.emitter||(this.emitter.updateForceFieldParameters(e),this.stop(),this.start())}
7272start(e=0){if(this.currentLoopTime=0,e){this.timeoutId=window.setTimeout(()=>{this.start(0)},e);return}this.started=!0,this.stopped=!1,this.isFrozen=!1,this.emitter?.startEmitting(this.actualTime/1e3)}froze(){this.isFrozen=!0}unFroze(){this.isFrozen=!1}stop(){this.stopped=!0,this.currentLoopTime=0,this.emitter?.stopEmitting(),clearTimeout(this.timeoutId)}reset(){this.started=!1,this.stopped=!1,this.emitter?.reset()}wakeUp(){this.isIdle=!1}sleep(){this.isIdle=!0,this.reset()}};function fZ(){try{let e=window.location.href;if(e.includes("reducesubdiv=")){let t=e.indexOf("reducesubdiv=")+13;return parseInt(e.slice(t,t+1))}}catch{}}var yv=fZ();function mZ(e,t,i){yv!==void 0&&t?.geometry&&"subdivisions"in t.geometry&&(t.geometry.subdivisions??0)>yv&&Object.assign(t.geometry,{subdivisions:yv});let r;return t.geometry.type==="TextGeometry"?new _x(e,t,i):t.geometry.type==="InputGeometry"?new Ox(e,t,i):(t.geometry.type==="SubdivGeometry"?r=new Iu(e,t,i):t.geometry.type==="PathGeometry"?r=new Cm(e,t,i):t.geometry.type==="VectorGeometry"?r=new GK(e,t,i):t.geometry.type==="BooleanGeometry"?r=new al(e,t,i):t.geometry.type==="ShapeBlendGeometry"?r=new nl(e,t,i):t.geometry.type==="UIGeometry"?r=new _r(e,t,i):r=new ai(e,t,i),r)}function Rx(e,t,i){return console.assert(t.type!==void 0),t.type==="Mesh"?mZ(e,t,i):t.type==="Empty"?new xh(e,t):t.type==="Particle"?new nu(e,t,i):t.type==="ParticleCollider"?new au(e,t,i):t.type==="Splat"?new xh(e,t):t.type==="Bone"?new WK(e,t):t.type==="Page"?new er(e,t,i):t.type==="PointLight"?new Dx(e,t,i):t.type==="SpotLight"?new Mm(e,t,i):t.type==="DirectionalLight"?new Am(e,t,i):t.type==="Component"||t.type==="Instance"?new bh(e,t,i):il.is(t.type)?new qi(e,t):(console.error(t),new xh(e,t))}Jn.createEntity=Rx;function gZ(e,t,i){let r=Rx(e.identity,t,i),s=e.children,a=e.attachedPaths,n=e.parent,o=e.component,l=e.instances,h=e.overrideData,c=e.uuid,u=e.stateSelection;e.dispose();for(let d of Object.keys(e))delete e[d];Object.setPrototypeOf(e,Object.getPrototypeOf(r));for(let d of Object.keys(r))e[d]=r[d];e.children=[...e.children,...s],e.attachedPaths=a,e.parent=n,e.component=o,e.instances=l,e.uuid=c,e.overrideData=h,e.updateState(e.data,i),u&&e.changeSelectedState(u,i),e.resetBBoxNeedsUpdate()}Jn.changeEntityProptotype=gZ;Jn.Cloner=ys;function vZ(e,t,i,r){e.updateByOp(t,i,r,!1)}var Fo=5,ou=new He;ou.setAttribute("position",new tt(new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),3));var Fp=class extends pB{constructor(e){super({...e,depthTest:!1,depthWrite:!1,glslVersion:qv,vertexShader:` 7273 precision highp float; 7274 in vec3 position; 7275 void main() { 7276 gl_Position = vec4(position, 1); 7277 } 7278 `})}customProgramCacheKey(){return""}};function yZ(){return{shapeInput:()=>` 7279 const float posRowCoord = ${.5/Fo}; // vec4: px py pz opType 7280 const float quatRowCoord = ${1.5/Fo}; // vec4: qx qy qz qw 7281 const float param1RowCoord = ${2.5/Fo};// vec4: type param1 param2 param3 7282 const float param2RowCoord = ${3.5/Fo};// vec4: blendRange roundness scale param4 7283 const float colorRowCoord = ${4.5/Fo}; // vec4: r g b a 7284 uniform sampler2D shapesDataTexture; 7285 vec4 shapePos(float iin) { 7286 vec4 r = texture(shapesDataTexture, vec2(iin, posRowCoord)); 7287 return r; 7288 } 7289 vec4 shapeQuat(float iin) { 7290 vec4 r = texture(shapesDataTexture, vec2(iin, quatRowCoord)); 7291 return r; 7292 } 7293 vec4 shapeParams1(float iin) { 7294 vec4 r = texture(shapesDataTexture, vec2(iin, param1RowCoord)); 7295 return r; 7296 } 7297 vec4 shapeParams2(float iin) { 7298 vec4 r = texture(shapesDataTexture, vec2(iin, param2RowCoord)); 7299 return r; 7300 } 7301 vec4 shapeColor(float iin) { 7302 vec4 r = texture(shapesDataTexture, vec2(iin, colorRowCoord)); 7303 return r; 7304 } 7305 `,getxyzi:` 7306 // this code must complement lookup 7307 float xi = mod(gl_FragCoord.x - 0.5, VOXEL_RESOLUTION); 7308 float yi = mod(gl_FragCoord.y - 0.5, VOXEL_RESOLUTION); 7309 float zi = floor((gl_FragCoord.x - 0.5) * INV_VOXEL_RESOLUTION) + floor((gl_FragCoord.y - 0.5) * INV_VOXEL_RESOLUTION) * Z_LAYERS_PER_ROW; 7310 `,lookup:` 7311 uniform sampler2D potentialPassTexture; 7312 uniform sampler2D voxelPassTexture; // includes normal (in xyz) and key (in w) 7313 7314 // box or marching cube lookup value in value texture, integer box coord inputs 7315 // this code must complement codebits.getxyzi 7316 vec4 look(float xi, float yi, float zi, sampler2D rt) {// range 0 .. numv etc 7317 vec2 uv = vec2( 7318 mod(zi, Z_LAYERS_PER_ROW) + (xi + 0.5) / VOXEL_RESOLUTION, 7319 floor(zi / Z_LAYERS_PER_ROW) + (yi + 0.5) / VOXEL_RESOLUTION 7320 ); 7321 uv /= Z_LAYERS_PER_ROW; 7322 return texture(rt, uv); 7323 } 7324 `,getpart:` 7325 float getpart(inout float a, float b) { 7326 float t = floor(a/b); 7327 float r = a - t*b; 7328 a = t; 7329 return r; 7330 } 7331 `
vendor: 10,806 bytes, line 7331
7331,triTable:new Float32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,1,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,1,1,8,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,2,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,0,10,2,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,2,9,9,2,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,2,8,10,2,8,9,10,-1,-1,-1,-1,-1,-1,-1,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,11,0,0,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,11,3,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,11,1,11,9,1,11,8,9,-1,-1,-1,-1,-1,-1,-1,1,10,3,3,10,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,10,0,10,8,0,10,11,8,-1,-1,-1,-1,-1,-1,-1,0,9,3,9,11,3,9,10,11,-1,-1,-1,-1,-1,-1,-1,10,8,9,11,8,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,4,4,3,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,1,0,7,4,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,1,4,1,7,4,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,2,1,7,4,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,4,3,4,0,3,10,2,1,-1,-1,-1,-1,-1,-1,-1,10,2,9,2,0,9,7,4,8,-1,-1,-1,-1,-1,-1,-1,9,10,2,7,9,2,3,7,2,4,9,7,-1,-1,-1,-1,7,4,8,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,4,11,4,2,11,4,0,2,-1,-1,-1,-1,-1,-1,-1,1,0,9,7,4,8,11,3,2,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,9,2,11,9,1,2,9,-1,-1,-1,-1,1,10,3,10,11,3,4,8,7,-1,-1,-1,-1,-1,-1,-1,10,11,1,11,4,1,4,0,1,4,11,7,-1,-1,-1,-1,8,7,4,11,0,9,10,11,9,3,0,11,-1,-1,-1,-1,11,7,4,9,11,4,10,11,9,-1,-1,-1,-1,-1,-1,-1,4,5,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,5,9,3,8,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,5,0,0,5,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,5,8,5,3,8,5,1,3,-1,-1,-1,-1,-1,-1,-1,10,2,1,4,5,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,0,3,10,2,1,5,9,4,-1,-1,-1,-1,-1,-1,-1,10,2,5,2,4,5,2,0,4,-1,-1,-1,-1,-1,-1,-1,5,10,2,5,2,3,4,5,3,8,4,3,-1,-1,-1,-1,4,5,9,11,3,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,11,0,11,8,0,5,9,4,-1,-1,-1,-1,-1,-1,-1,4,5,0,5,1,0,11,3,2,-1,-1,-1,-1,-1,-1,-1,5,1,2,8,5,2,11,8,2,5,8,4,-1,-1,-1,-1,11,3,10,3,1,10,4,5,9,-1,-1,-1,-1,-1,-1,-1,5,9,4,1,8,0,1,10,8,10,11,8,-1,-1,-1,-1,0,4,5,11,0,5,10,11,5,3,0,11,-1,-1,-1,-1,8,4,5,10,8,5,11,8,10,-1,-1,-1,-1,-1,-1,-1,8,7,9,9,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,9,3,5,9,3,7,5,-1,-1,-1,-1,-1,-1,-1,8,7,0,7,1,0,7,5,1,-1,-1,-1,-1,-1,-1,-1,3,5,1,7,5,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,7,9,7,5,9,2,1,10,-1,-1,-1,-1,-1,-1,-1,2,1,10,0,5,9,0,3,5,3,7,5,-1,-1,-1,-1,2,0,8,5,2,8,7,5,8,2,5,10,-1,-1,-1,-1,5,10,2,3,5,2,7,5,3,-1,-1,-1,-1,-1,-1,-1,5,9,7,9,8,7,2,11,3,-1,-1,-1,-1,-1,-1,-1,7,5,9,2,7,9,0,2,9,11,7,2,-1,-1,-1,-1,11,3,2,8,1,0,8,7,1,7,5,1,-1,-1,-1,-1,1,2,11,7,1,11,5,1,7,-1,-1,-1,-1,-1,-1,-1,8,5,9,7,5,8,3,1,10,11,3,10,-1,-1,-1,-1,0,7,5,9,0,5,0,11,7,10,0,1,0,10,11,-1,0,10,11,3,0,11,0,5,10,7,0,8,0,7,5,-1,5,10,11,5,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,0,6,10,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,0,9,6,10,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,1,8,9,1,6,10,5,-1,-1,-1,-1,-1,-1,-1,5,6,1,1,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,6,1,6,2,1,8,0,3,-1,-1,-1,-1,-1,-1,-1,5,6,9,6,0,9,6,2,0,-1,-1,-1,-1,-1,-1,-1,8,9,5,2,8,5,6,2,5,8,2,3,-1,-1,-1,-1,11,3,2,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,0,11,0,2,11,5,6,10,-1,-1,-1,-1,-1,-1,-1,9,1,0,11,3,2,6,10,5,-1,-1,-1,-1,-1,-1,-1,6,10,5,2,9,1,2,11,9,11,8,9,-1,-1,-1,-1,11,3,6,3,5,6,3,1,5,-1,-1,-1,-1,-1,-1,-1,11,8,0,5,11,0,1,5,0,6,11,5,-1,-1,-1,-1,6,11,3,6,3,0,5,6,0,9,5,0,-1,-1,-1,-1,9,5,6,11,9,6,8,9,11,-1,-1,-1,-1,-1,-1,-1,6,10,5,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,4,3,7,4,10,5,6,-1,-1,-1,-1,-1,-1,-1,0,9,1,6,10,5,7,4,8,-1,-1,-1,-1,-1,-1,-1,5,6,10,7,9,1,3,7,1,4,9,7,-1,-1,-1,-1,2,1,6,1,5,6,8,7,4,-1,-1,-1,-1,-1,-1,-1,5,2,1,6,2,5,4,0,3,7,4,3,-1,-1,-1,-1,7,4,8,5,0,9,5,6,0,6,2,0,-1,-1,-1,-1,9,3,7,4,9,7,9,2,3,6,9,5,9,6,2,-1,2,11,3,4,8,7,5,6,10,-1,-1,-1,-1,-1,-1,-1,6,10,5,2,7,4,0,2,4,11,7,2,-1,-1,-1,-1,9,1,0,8,7,4,11,3,2,6,10,5,-1,-1,-1,-1,1,2,9,2,11,9,11,4,9,4,11,7,6,10,5,-1,7,4,8,5,11,3,1,5,3,6,11,5,-1,-1,-1,-1,11,1,5,6,11,5,11,0,1,4,11,7,11,4,0,-1,9,5,0,5,6,0,6,3,0,3,6,11,7,4,8,-1,9,5,6,11,9,6,9,7,4,9,11,7,-1,-1,-1,-1,9,4,10,10,4,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6,10,4,10,9,4,3,8,0,-1,-1,-1,-1,-1,-1,-1,1,0,10,0,6,10,0,4,6,-1,-1,-1,-1,-1,-1,-1,1,3,8,6,1,8,4,6,8,10,1,6,-1,-1,-1,-1,9,4,1,4,2,1,4,6,2,-1,-1,-1,-1,-1,-1,-1,8,0,3,9,2,1,9,4,2,4,6,2,-1,-1,-1,-1,4,2,0,6,2,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,4,2,8,6,2,4,-1,-1,-1,-1,-1,-1,-1,9,4,10,4,6,10,3,2,11,-1,-1,-1,-1,-1,-1,-1,2,8,0,11,8,2,10,9,4,6,10,4,-1,-1,-1,-1,2,11,3,6,1,0,4,6,0,10,1,6,-1,-1,-1,-1,1,4,6,10,1,6,1,8,4,11,1,2,1,11,8,-1,4,6,9,6,3,9,3,1,9,3,6,11,-1,-1,-1,-1,1,11,8,0,1,8,1,6,11,4,1,9,1,4,6,-1,6,11,3,0,6,3,4,6,0,-1,-1,-1,-1,-1,-1,-1,8,4,6,8,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6,10,7,10,8,7,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,7,0,7,10,0,10,9,0,10,7,6,-1,-1,-1,-1,7,6,10,7,10,1,8,7,1,0,8,1,-1,-1,-1,-1,7,6,10,1,7,10,3,7,1,-1,-1,-1,-1,-1,-1,-1,6,2,1,8,6,1,9,8,1,7,6,8,-1,-1,-1,-1,9,6,2,1,9,2,9,7,6,3,9,0,9,3,7,-1,0,8,7,6,0,7,2,0,6,-1,-1,-1,-1,-1,-1,-1,2,3,7,2,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,3,2,8,6,10,9,8,10,7,6,8,-1,-1,-1,-1,7,0,2,11,7,2,7,9,0,10,7,6,7,10,9,-1,0,8,1,8,7,1,7,10,1,10,7,6,11,3,2,-1,1,2,11,7,1,11,1,6,10,1,7,6,-1,-1,-1,-1,6,9,8,7,6,8,6,1,9,3,6,11,6,3,1,-1,1,9,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,6,0,7,0,11,3,0,6,11,-1,-1,-1,-1,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,0,3,6,7,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,1,0,6,7,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,1,8,1,3,8,6,7,11,-1,-1,-1,-1,-1,-1,-1,2,1,10,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,2,1,8,0,3,7,11,6,-1,-1,-1,-1,-1,-1,-1,0,9,2,9,10,2,7,11,6,-1,-1,-1,-1,-1,-1,-1,7,11,6,3,10,2,3,8,10,8,9,10,-1,-1,-1,-1,3,2,7,7,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,0,7,0,6,7,0,2,6,-1,-1,-1,-1,-1,-1,-1,6,7,2,7,3,2,9,1,0,-1,-1,-1,-1,-1,-1,-1,2,6,1,6,8,1,8,9,1,6,7,8,-1,-1,-1,-1,6,7,10,7,1,10,7,3,1,-1,-1,-1,-1,-1,-1,-1,6,7,10,10,7,1,7,8,1,8,0,1,-1,-1,-1,-1,7,3,0,10,7,0,9,10,0,7,10,6,-1,-1,-1,-1,10,6,7,8,10,7,9,10,8,-1,-1,-1,-1,-1,-1,-1,4,8,6,6,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,6,3,6,0,3,6,4,0,-1,-1,-1,-1,-1,-1,-1,11,6,8,6,4,8,1,0,9,-1,-1,-1,-1,-1,-1,-1,6,4,9,3,6,9,1,3,9,6,3,11,-1,-1,-1,-1,4,8,6,8,11,6,1,10,2,-1,-1,-1,-1,-1,-1,-1,10,2,1,11,0,3,11,6,0,6,4,0,-1,-1,-1,-1,8,11,4,11,6,4,9,2,0,9,10,2,-1,-1,-1,-1,3,9,10,2,3,10,3,4,9,6,3,11,3,6,4,-1,3,2,8,2,4,8,2,6,4,-1,-1,-1,-1,-1,-1,-1,2,4,0,2,6,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,4,3,2,6,4,2,8,3,4,-1,-1,-1,-1,4,9,1,2,4,1,6,4,2,-1,-1,-1,-1,-1,-1,-1,3,1,8,1,6,8,6,4,8,1,10,6,-1,-1,-1,-1,0,1,10,6,0,10,4,0,6,-1,-1,-1,-1,-1,-1,-1,3,6,4,8,3,4,3,10,6,9,3,0,3,9,10,-1,4,9,10,4,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,9,4,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,0,5,9,4,6,7,11,-1,-1,-1,-1,-1,-1,-1,1,0,5,0,4,5,11,6,7,-1,-1,-1,-1,-1,-1,-1,6,7,11,4,3,8,4,5,3,5,1,3,-1,-1,-1,-1,4,5,9,2,1,10,11,6,7,-1,-1,-1,-1,-1,-1,-1,7,11,6,10,2,1,3,8,0,5,9,4,-1,-1,-1,-1,11,6,7,10,4,5,10,2,4,2,0,4,-1,-1,-1,-1,8,4,3,4,5,3,5,2,3,2,5,10,6,7,11,-1,3,2,7,2,6,7,9,4,5,-1,-1,-1,-1,-1,-1,-1,4,5,9,6,8,0,2,6,0,7,8,6,-1,-1,-1,-1,2,6,3,6,7,3,0,5,1,0,4,5,-1,-1,-1,-1,8,2,6,7,8,6,8,1,2,5,8,4,8,5,1,-1,4,5,9,6,1,10,6,7,1,7,3,1,-1,-1,-1,-1,10,6,1,6,7,1,7,0,1,0,7,8,4,5,9,-1,10,0,4,5,10,4,10,3,0,7,10,6,10,7,3,-1,10,6,7,8,10,7,10,4,5,10,8,4,-1,-1,-1,-1,5,9,6,9,11,6,9,8,11,-1,-1,-1,-1,-1,-1,-1,11,6,3,3,6,0,6,5,0,5,9,0,-1,-1,-1,-1,8,11,0,11,5,0,5,1,0,11,6,5,-1,-1,-1,-1,3,11,6,5,3,6,1,3,5,-1,-1,-1,-1,-1,-1,-1,10,2,1,11,5,9,8,11,9,6,5,11,-1,-1,-1,-1,3,11,0,11,6,0,6,9,0,9,6,5,10,2,1,-1,5,8,11,6,5,11,5,0,8,2,5,10,5,2,0,-1,3,11,6,5,3,6,3,10,2,3,5,10,-1,-1,-1,-1,9,8,5,8,2,5,2,6,5,2,8,3,-1,-1,-1,-1,6,5,9,0,6,9,2,6,0,-1,-1,-1,-1,-1,-1,-1,8,5,1,0,8,1,8,6,5,2,8,3,8,2,6,-1,6,5,1,6,1,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6,3,1,10,6,1,6,8,3,9,6,5,6,9,8,-1,0,1,10,6,0,10,0,5,9,0,6,5,-1,-1,-1,-1,8,3,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6,5,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,11,11,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,11,5,7,11,0,3,8,-1,-1,-1,-1,-1,-1,-1,7,11,5,11,10,5,0,9,1,-1,-1,-1,-1,-1,-1,-1,5,7,10,7,11,10,1,8,9,1,3,8,-1,-1,-1,-1,2,1,11,1,7,11,1,5,7,-1,-1,-1,-1,-1,-1,-1,3,8,0,7,2,1,5,7,1,11,2,7,-1,-1,-1,-1,5,7,9,7,2,9,2,0,9,7,11,2,-1,-1,-1,-1,2,5,7,11,2,7,2,9,5,8,2,3,2,8,9,-1,10,5,2,5,3,2,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,2,8,2,5,8,5,7,8,5,2,10,-1,-1,-1,-1,1,0,9,3,10,5,7,3,5,2,10,3,-1,-1,-1,-1,2,8,9,1,2,9,2,7,8,5,2,10,2,5,7,-1,5,3,1,5,7,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,1,7,0,5,7,1,-1,-1,-1,-1,-1,-1,-1,3,0,9,5,3,9,7,3,5,-1,-1,-1,-1,-1,-1,-1,7,8,9,7,9,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,5,8,10,5,8,11,10,-1,-1,-1,-1,-1,-1,-1,4,0,5,0,11,5,11,10,5,0,3,11,-1,-1,-1,-1,9,1,0,10,4,8,11,10,8,5,4,10,-1,-1,-1,-1,4,11,10,5,4,10,4,3,11,1,4,9,4,1,3,-1,1,5,2,5,8,2,8,11,2,8,5,4,-1,-1,-1,-1,11,4,0,3,11,0,11,5,4,1,11,2,11,1,5,-1,5,2,0,9,5,0,5,11,2,8,5,4,5,8,11,-1,5,4,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,2,2,5,3,5,4,3,4,8,3,-1,-1,-1,-1,2,10,5,4,2,5,0,2,4,-1,-1,-1,-1,-1,-1,-1,2,10,3,10,5,3,5,8,3,8,5,4,9,1,0,-1,2,10,5,4,2,5,2,9,1,2,4,9,-1,-1,-1,-1,5,4,8,3,5,8,1,5,3,-1,-1,-1,-1,-1,-1,-1,5,4,0,5,0,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,4,8,3,5,8,5,0,9,5,3,0,-1,-1,-1,-1,5,4,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,11,4,11,9,4,11,10,9,-1,-1,-1,-1,-1,-1,-1,3,8,0,7,9,4,7,11,9,11,10,9,-1,-1,-1,-1,11,10,1,4,11,1,0,4,1,11,4,7,-1,-1,-1,-1,4,1,3,8,4,3,4,10,1,11,4,7,4,11,10,-1,7,11,4,4,11,9,11,2,9,2,1,9,-1,-1,-1,-1,4,7,9,7,11,9,11,1,9,1,11,2,3,8,0,-1,4,7,11,2,4,11,0,4,2,-1,-1,-1,-1,-1,-1,-1,4,7,11,2,4,11,4,3,8,4,2,3,-1,-1,-1,-1,10,9,2,9,7,2,7,3,2,9,4,7,-1,-1,-1,-1,7,10,9,4,7,9,7,2,10,0,7,8,7,0,2,-1,10,7,3,2,10,3,10,4,7,0,10,1,10,0,4,-1,2,10,1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,4,7,1,4,3,1,7,-1,-1,-1,-1,-1,-1,-1,1,9,4,7,1,4,1,8,0,1,7,8,-1,-1,-1,-1,3,0,4,3,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,10,9,8,11,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,3,11,9,3,10,9,11,-1,-1,-1,-1,-1,-1,-1,10,1,0,8,10,0,11,10,8,-1,-1,-1,-1,-1,-1,-1,10,1,3,10,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,2,1,9,11,1,8,11,9,-1,-1,-1,-1,-1,-1,-1,9,0,3,11,9,3,9,2,1,9,11,2,-1,-1,-1,-1,11,2,0,11,0,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,2,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,10,8,2,9,8,10,-1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,10,8,2,8,1,0,8,10,1,-1,-1,-1,-1,2,10,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]),numTrisTable:new Float32Array([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,2,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,2,3,3,2,3,4,4,3,3,4,4,3,4,5,5,2,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,4,2,3,3,4,3,4,2,3,3,4,4,5,4,5,3,2,3,4,4,3,4,5,3,2,4,5,5,4,5,2,4,1,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,2,3,3,4,3,4,4,5,3,2,4,3,4,3,5,2,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,4,3,4,4,3,4,5,5,4,4,3,5,2,5,4,2,1,2,3,3,4,3,4,4,5,3,4,4,5,2,3,3,2,3,4,4,5,4,5,5,2,4,3,5,4,3,2,4,1,3,4,4,5,4,5,3,4,4,5,5,2,3,4,2,1,2,3,3,2,3,4,2,1,3,2,4,1,2,1,1,0])}}var
7331kp=new go,xZ=class{constructor(){this.pyramidPassScene=new Qr,this.pyramidPassMaterial=new Fp({name:"PyramidPass"}),this.pyramidPassUniforms={inputTexture:{value:void 0}
vendor: 16,283 bytes, lines 7331-7487
7331,inputWidth:{value:0},inputHeight:{value:0},inputShiftX:{value:0},outputShiftX:{value:0}},this.pyramidTopLevelReadPixelBuffer=new Float32Array(4);let e=` 7332 precision highp float; 7333 precision highp sampler2D; 7334 layout(location = 0) out vec4 pc_FragColor; 7335 uniform sampler2D inputTexture; 7336 uniform float inputWidth; 7337 uniform float inputHeight; 7338 uniform float inputShiftX; 7339 uniform float outputShiftX; 7340 const vec2 half_unit_coord = vec2(0.5); 7341 const vec4 one = vec4(1.0); 7342 void main() { 7343 vec2 inputSize = vec2(inputWidth, inputHeight); 7344 vec2 input_pixel_uv = 1. / inputSize; 7345 vec2 coord = gl_FragCoord.xy - half_unit_coord; 7346 coord.x -= outputShiftX; 7347 coord = coord * 2. + half_unit_coord; 7348 coord.x += inputShiftX; 7349 7350 // sample bottom left corner 7351 vec2 input_uv = coord / inputSize; 7352 float bl = texture(inputTexture, input_uv).r; 7353 7354 // sample bottom right corner 7355 input_uv.x += input_pixel_uv.x; 7356 float br = texture(inputTexture, input_uv).r; 7357 7358 // sample top right corner 7359 input_uv.y += input_pixel_uv.y; 7360 float tr = texture(inputTexture, input_uv).r; 7361 7362 // sample top left corner 7363 input_uv.x -= input_pixel_uv.x; 7364 float tl = texture(inputTexture, input_uv).r; 7365 7366 pc_FragColor.a = bl; 7367 pc_FragColor.b = pc_FragColor.a + br; 7368 pc_FragColor.g = pc_FragColor.b + tr; 7369 pc_FragColor.r = pc_FragColor.g + tl; 7370 } 7371 `;this.pyramidPassMaterial.fragmentShader=e,this.pyramidPassMaterial.uniforms=this.pyramidPassUniforms,this.pyramidPassMaterial.depthTest=!1,this.pyramidPassMaterial.depthWrite=!1;let t=new Zt(ou,this.pyramidPassMaterial);t.frustumCulled=!1,this.pyramidPassScene.add(t)}renderPyramid(e,t,i,r,s){new u1().min.setScalar(0);let a=t.length-1,n=new ot;i.getViewport(n),this.pyramidPassUniforms.inputShiftX.value=0,this.pyramidPassUniforms.outputShiftX.value=0;let o=a-1;for(let h=o;h>=0;h--){let c=h%2===o%2?s[0]:s[1],u=h===o?r:h%2===o%2?s[1]:s[0];this.pyramidPassUniforms.inputTexture.value=Array.isArray(u.texture)?u.texture[1]:u.texture,this.pyramidPassUniforms.inputWidth.value="width"in u?u.width:1,this.pyramidPassUniforms.inputHeight.value="height"in u?u.height:1,i.setRenderTarget(c);let d=t[h],p=i.getPixelRatio();i.setViewport(this.pyramidPassUniforms.outputShiftX.value/p,0,d/p,d/p),h===2&&e%2!==0&&i.setViewport(this.pyramidPassUniforms.outputShiftX.value/p,0,3/p,3/p),i.render(this.pyramidPassScene,kp);let f=this.pyramidPassUniforms.inputShiftX.value;this.pyramidPassUniforms.inputShiftX.value=this.pyramidPassUniforms.outputShiftX.value,this.pyramidPassUniforms.outputShiftX.value=f,h<o&&(this.pyramidPassUniforms.outputShiftX.value+=t[h+1])}i.setViewport(n);let l=t.length%2===0?0:1;return i.readRenderTargetPixelsAsync(s[l],s[l].width-1,0,1,1,this.pyramidTopLevelReadPixelBuffer).then(()=>this.pyramidTopLevelReadPixelBuffer[0])}},Ds=24,ur=96,ta=yZ(),Ua=2,wP=class extends ai{constructor(e,t,i){super(e,t,i),this.data=t,this.needsRebuild=!0,this.customDepthMaterialNeedsUpdate=!1,this._npart=-1,this.spatialn=1,this.drawRangeNeedsForceUpdate=!0,this._resolutionLevel=-1,this.resolution=64,this.spatialDivisions=25,this.zLayersPerRow=8,this.basePyramidSize=512,this.pyramidTexture1Width=341,this.pyramidTexture1Height=256,this.pyramidTexture2Width=170,this.pyramidTexture2Height=128,this.numLevels=9,this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512],this.bboxSize=0,this.bboxOffset=0,this.shapesDataTexture={value:void 0},this.spatialscene=new Qr,this.potentialPassScene=new Qr,this.voxelPassScene=new Qr,this._spatialPassRenderTargets=[],this._potentialPassRenderTargets=[],this._voxelPassRenderTargets=[],this._pyramidRenderTargets=[],this.geometry=new He,this.geometry.drawRange.count=0,this.spatialPassUniforms={span:{value:-1},shapesDataTexture:this.shapesDataTexture,npart:{value:this.npart},spatialn:{value:this.spatialn}},this.spatialMesh=new Zt(ou,this.spatialPassMaterial()),this.spatialMesh.frustumCulled=!1,this.spatialscene.add(this.spatialMesh);let r=new zr(ta.triTable,16,256,Mp,Ht);r.needsUpdate=!0;let s=new zr(ta.numTrisTable,256,1,Mp,Ht);s.needsUpdate=!0,this.voxelPassUniforms={potentialPassTexture:{value:void 0},numTrisTable:{value:s}},this.voxelMesh=new Zt(ou,this.voxelPassMaterial()),this.voxelMesh.frustumCulled=!1,this.voxelPassScene.add(this.voxelMesh),this.potentialPassUniforms={shapesDataTexture:this.shapesDataTexture,spatialPassTexture:{value:void 0},npart:{value:this.npart},spatialn:{value:this.spatialn}},this.potentialMesh=new Zt(ou,this.potentialPassMaterial()),this.potentialMesh.frustumCulled=!1,this.potentialPassScene.add(this.potentialMesh),this.marchPassUniforms={triTable:{value:r},potentialPassTexture:{value:void 0},voxelPassTexture:{value:void 0},pyramidTexture1:{value:void 0},pyramidTexture1Size:{value:void 0},pyramidTexture2:{value:void 0},pyramidTexture2Size:{value:void 0}},this.frustumCulled=!1,this.onBeforeShadowPass=a=>{if(AZ.call(this),this.npart===0){this.geometry.drawRange.count=0;return}let n=this.material.root;if(!n.shadersPatchedForShapeBlend)this.patchVertexShaderForShapeBlend(n),n.shadersPatchedForShapeBlend=!0,this.customDepthMaterialNeedsUpdate=!0;else if(this.customDepthMaterialNeedsUpdate){this.customDepthMaterialNeedsUpdate=!1,this.customDepthMaterial=new Dt({vertexShader:n.vertexShader,fragmentShader:` 7372 #include <packing> 7373 void main() 7374 { 7375 gl_FragColor = packDepthToRGBA(gl_FragCoord.z); 7376 } 7377 `,uniforms:n.uniforms,defines:this.material.defines}),this.isMeshDepthMaterial=!0,this.customDistanceMaterial=new Dt({vertexShader:n.vertexShader,fragmentShader:` 7378 #include <common> 7379 #include <packing> 7380 uniform vec3 referencePosition; 7381 uniform float nearDistance; 7382 uniform float farDistance; 7383 // World-space position 7384 varying vec3 vWPosition; 7385 void main() 7386 { 7387 float dist = length(vWPosition - referencePosition); 7388 dist = (dist - nearDistance) / (farDistance - nearDistance); 7389 dist = saturate(dist); 7390 // Required by Three.js for this to work 7391 gl_FragColor = packDepthToRGBA( dist ); 7392 }`,uniforms:{nearDistance:{value:0},farDistance:{value:0},referencePosition:{value:new M},opacity:{value:0},...n.uniforms},defines:this.material.defines});let h=this.customDistanceMaterial;h.referencePosition=new M,h.nearDistance=0,h.farDistance=0,h.opacity=1,h.isMeshDistanceMaterial=!0}if(this.spatialPassUniforms.npart.value=this.npart,this.spatialPassUniforms.spatialn.value=this.spatialn,this.potentialPassUniforms.npart.value=this.npart,this.potentialPassUniforms.spatialn.value=this.spatialn,this.needsRebuild){this.needsRebuild=!1,this.spatialMesh.material.defines.RES=this.resolutionLevel,this.spatialMesh.material.needsUpdate=!0,this.potentialMesh.material.defines.RES=this.resolutionLevel,this.potentialPassUniforms.spatialPassTexture.value=this.spatialPassRenderTarget.texture,this.potentialMesh.material.needsUpdate=!0,this.voxelMesh.material.defines.RES=this.resolutionLevel,this.voxelMesh.material.needsUpdate=!0,this.voxelPassUniforms.potentialPassTexture.value=this.potentialPassRenderTarget.texture,this.marchPassUniforms.potentialPassTexture.value=this.potentialPassRenderTarget.texture,this.marchPassUniforms.voxelPassTexture.value=this.voxelPassRenderTarget.texture[0],this.material.defines.RES=this.resolutionLevel,this.material.defines.LEVELS=this.pyramidLevelSizes.length,this.material.defines.LOOP=this.pyramidLevelSizes.length%2===0?this.pyramidLevelSizes.length-3:this.pyramidLevelSizes.length-2,this.material.defines.HALF=this.pyramidLevelSizes.length%2===0?1:0,this.material.needsUpdate=!0;let h=this.pyramidLevelSizes.length%2===0?0:1,c=this.pyramidLevelSizes.length%2===0?1:0;this.marchPassUniforms.pyramidTexture2.value=this.pyramidRenderTarget[h].texture,this.marchPassUniforms.pyramidTexture2Size.value=new H(this.pyramidRenderTarget[h].width,this.pyramidRenderTarget[h].height),this.marchPassUniforms.pyramidTexture1.value=this.pyramidRenderTarget[c].texture,this.marchPassUniforms.pyramidTexture1Size.value=new H(this.pyramidRenderTarget[c].width,this.pyramidRenderTarget[c].height),Object.assign(this.material.uniforms,this.marchPassUniforms)}let o=a.shadowMap.enabled;a.shadowMap.enabled=!1;let l=a.getRenderTarget();a.setRenderTarget(this.spatialPassRenderTarget),a.render(this.spatialscene,kp),a.setRenderTarget(this.potentialPassRenderTarget),a.render(this.potentialPassScene,kp),a.setRenderTarget(this.voxelPassRenderTarget),a.render(this.voxelPassScene,kp),wP.streamCompaction.renderPyramid(this.resolutionLevel,this.pyramidLevelSizes,a,this.voxelPassRenderTarget,this.pyramidRenderTarget).then(h=>{this.material.wireframe&&(h*3>this.geometry.attributes.position.count||this.drawRangeNeedsForceUpdate)&&(this.geometry.dispose(),this.geometry=new He,this.geometry.userData.parameters={width:this.bboxSize,height:this.bboxSize,depth:this.bboxSize,centerOffset:[this.bboxOffset,this.bboxOffset,this.bboxOffset]},this.geometry.attributes.position=new tt(new Float32Array(h*3*2),3)),(h*3>this.geometry.drawRange.count||this.drawRangeNeedsForceUpdate)&&(this.geometry.drawRange.count=Math.floor(h*1.2)*3),this.drawRangeNeedsForceUpdate=!1}),a.shadowMap.enabled=o,a.setRenderTarget(l)}}set npart(e){e!==this._npart&&(this.drawRangeNeedsForceUpdate=!0,this._npart=e,this.spatialn=Math.ceil(e/(4*Ds)))}get npart(){return this._npart}set resolutionLevel(e){let t=Math.min(8,Math.max(5,e));if(t!==this._resolutionLevel){switch(this._resolutionLevel=t,this.resolution=Math.pow(2,t),this.resolutionLevel){case 5:this.pyramidLevelSizes=[1,2,4,6,12,24,48,96,192],this.bboxSize=248*Ua,this.bboxOffset=8*Ua*-1/2;break;case 6:this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512],this.bboxSize=252*Ua,this.bboxOffset=4*Ua*-1/2;break;case 7:this.pyramidLevelSizes=[1,2,4,6,12,24,48,96,192,384,768,1536],this.bboxSize=254*Ua,this.bboxOffset=2*Ua*-1/2;break;case 8:this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096],this.bboxSize=255*Ua,this.bboxOffset=Ua*-1/2;break}this.pyramidTexture1Width=0,this.pyramidTexture2Width=0,this.pyramidTexture1Height=this.pyramidLevelSizes[this.pyramidLevelSizes.length-2],this.pyramidTexture2Height=this.pyramidLevelSizes[this.pyramidLevelSizes.length-3];for(let i=this.pyramidLevelSizes.length-2;i>=0;i--)(this.pyramidLevelSizes.length-2)%2===i%2?this.pyramidTexture1Width+=this.pyramidLevelSizes[i]:this.pyramidTexture2Width+=this.pyramidLevelSizes[i];this.basePyramidSize=this.pyramidLevelSizes[this.pyramidLevelSizes.length-1],this.zLayersPerRow=this.basePyramidSize/this.resolution,this.numLevels=this.pyramidLevelSizes.length-1,this.geometry.userData.parameters={width:this.bboxSize,height:this.bboxSize,depth:this.bboxSize,centerOffset:[this.bboxOffset,this.bboxOffset,this.bboxOffset]},this.needsRebuild=!0,this.customDepthMaterialNeedsUpdate=!0}}get resolutionLevel(){return this._resolutionLevel}get spatialPassRenderTarget(){let e=this._spatialPassRenderTargets[this.resolutionLevel];return e||(e=new Pt(this.spatialDivisions*this.spatialn,this.spatialDivisions**2,{format:oi,type:Ht,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:St,magFilter:St}),this._spatialPassRenderTargets[this.resolutionLevel]=e),e}get potentialPassRenderTarget(){let e=this._potentialPassRenderTargets[this.resolutionLevel];return e||(e=new Pt(this.basePyramidSize,this.basePyramidSize,{format:oi,type:Ht,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:St,magFilter:St}),this._potentialPassRenderTargets[this.resolutionLevel]=e),e}get voxelPassRenderTarget(){let e=this._voxelPassRenderTargets[this.resolutionLevel];return e||(e=new fM(this.basePyramidSize,this.basePyramidSize,2,{stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:St,magFilter:St}),e.texture[0].format=oi,e.texture[0].type=Ht,e.texture[1].format=Mp,e.texture[1].type=Ht,this._voxelPassRenderTargets[this.resolutionLevel]=e),e}get pyramidRenderTarget(){let e=this._pyramidRenderTargets[this.resolutionLevel];if(!e){let t=new Pt(this.pyramidTexture1Width,this.pyramidTexture1Height,{format:oi,type:Ht,stencilBuffer:!1,depthBuffer:!1,magFilter:St,minFilter:St}),i=new Pt(this.pyramidTexture2Width,this.pyramidTexture2Height,{format:oi,type:Ht,stencilBuffer:!1,depthBuffer:!1,magFilter:St,minFilter:St});e=[t,i],this._pyramidRenderTargets[this.resolutionLevel]=e}return e}updateState(e,t){let i=this.material;super.updateState(e,t),i!==this.material&&(this.needsRebuild=!0),e.geometry&&(this.resolutionLevel=e.geometry.resolutionLevel,this.geometry.userData.parameters={width:this.bboxSize,height:this.bboxSize,depth:this.bboxSize,centerOffset:[this.bboxOffset,this.bboxOffset,this.bboxOffset]}),e.wireframe&&!this.geometry.getAttribute("position")?this.geometry.setAttribute("position",new tt(new Float32Array(this.geometry.drawRange.count*3),3)):!e.wireframe&&this.geometry.getAttribute("position")&&this.geometry.deleteAttribute("position")}spatialPassMaterial(){let e=` 7393 precision highp float; 7394 out vec4 pc_FragColor; 7395 const float spatialDivisions = ${this.spatialDivisions}.; 7396 uniform float span; 7397 uniform float npart; 7398 uniform float spatialn; 7399 ${ta.shapeInput()} 7400 7401 vec3 low, high; // range of current div; subset of -1 .. 1 with span border 7402 7403 // lookup one element/channel's worth of spheres for current division 7404 // stating with low sphere number lowi 7405 // gives a key to which spheres from lowi..lowi+23 are active within given div (low..high) 7406 float spatialKey(float lowi) { 7407 float t = 0.; 7408 for (float ii = ${Ds-1}.; ii >= 0.; ii--) { 7409 float i = ii + lowi; 7410 float iin = (i + 0.5) / ${ur}.; 7411 vec4 shape = shapePos(iin); 7412 vec3 d = shape.xyz; 7413 float op = shape.w; 7414 7415 t *= 2.; 7416 t += ( 7417 low.x < d.x && d.x < high.x && 7418 low.y < d.y && d.y < high.y && 7419 low.z < d.z && d.z < high.z && 7420 i < npart || op == -2. // always include if op is -2, which is the intersection operation 7421 ) ? 1. : 0.; 7422 } 7423 return t; 7424 } 7425 7426 ${ta.getpart} 7427 7428 void main() { // spatialial fragment shader 7429 // find active div 7430 vec3 div; // which div is current 7431 // out holds x=> x, lowi faster moving and y=> z, y faster moving 7432 float yz = float(gl_FragCoord.y - 0.5); // contains z, y faster moving 7433 div.y = getpart(yz, spatialDivisions); 7434 div.z = yz; // getpart(yz, spatialDivisions.z); // what's left, should be the same as getpart 7435 7436 float lx = float(gl_FragCoord.x - 0.5); // contains x, lowi faster moving 7437 float lowi = getpart(lx, spatialn) * ${4*Ds}.; 7438 div.x = lx; 7439 7440 low = div / spatialDivisions * 2. - 1. - span; 7441 high = (div+1.) / spatialDivisions * 2. - 1. + span; 7442 7443 // find active range of spheres 7444 pc_FragColor.x = spatialKey(lowi); 7445 pc_FragColor.y = spatialKey(lowi+${Ds}.); 7446 pc_FragColor.z = spatialKey(lowi+${2*Ds}.); 7447 pc_FragColor.w = spatialKey(lowi+${3*Ds}.); 7448 } 7449 `;return new Fp({name:"Spatial Pass",fragmentShader:e,uniforms:this.spatialPassUniforms})}potentialPassMaterial(){let e=` 7450 precision highp float; 7451 out vec4 pc_FragColor; 7452 7453 ${ta.shapeInput()} 7454 uniform sampler2D spatialPassTexture; 7455 7456 const float res = float(RES); 7457 const float VOXEL_RESOLUTION = pow(2., res); 7458 const float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.)); 7459 const float VOXEL_RESOLUTION_SUB1 = VOXEL_RESOLUTION - 1.; 7460 const float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION; 7461 7462 uniform float npart; 7463 uniform float spatialn; 7464 const float spatialDivisions = ${this.spatialDivisions}.; 7465 const float spatialDivisions2 = spatialDivisions * spatialDivisions; 7466 const float spatialDivisionsSub1 = spatialDivisions - 1.; 7467 7468 ${ta.getpart} 7469 7470 vec3 packRGBAToVec3(vec4 color) { 7471 uint r = uint(color.r * 255.); 7472 uint g = uint(color.g * 255.); 7473 uint combined = (r << 8) | g; 7474 return vec3(float(combined) * 0.00001525902, color.b, color.a); // 1/65535 7475 } 7476 7477 void applyQuaternionToVector(in vec4 q, inout vec3 v) { 7478 v += 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v); 7479 } 7480 7481 /** 7482 * SDF functions (reference: https://iquilezles.org/articles/distfunctions/) 7483 */ 7484 7485 // branchless version of "Smooth Union, Subtraction and Intersection - bound, bound, bound" in above reference 7486 float smoothOperation(float op, float sdf, float d, float k) { 7487 // union: op = 1 =>
7487 signSubtract = 1, signIntersection = 1 7488 // subtract: op = -1 => signSubtract = -1, signIntersection = 1 7489 // intersection: op = -2 => signSubtract = -1, signIntersection = -1 7490 7491 float signSubtract = clamp(op, -1., 1.); 7492 float signIntersection = 2. * (op - signSubtract) + 1.; 7493 float h = clamp( 7494 0.5 + signSubtract * 0.5 * (sdf - signSubtract * signIntersection * d) / k, 7495 0.0, 7496 1.0 7497 ); 7498 return mix(sdf, signSubtract * signIntersection * d, h) - 7499 signSubtract * k * h * (1.0 - h); 7500 } 7501 7502 float sdSphere( vec3 p, float s ) 7503 { 7504 return length(p)-s; 7505 } 7506 7507 float sdEllipsoid( vec3 p, vec3 r ) 7508 { 7509 float k0 = length(p/r); 7510 float k1 = length(p/(r*r)); 7511 return k0*(k0-1.0)/k1; 7512 } 7513 7514 float sdBox( vec3 p, vec3 b ) 7515 { 7516 vec3 q = abs(p) - b; 7517 return length(max(q,0.0)) + min(max(q.x,max(q.y,q.z)),0.0); 7518 } 7519 7520 float sdTorus( vec3 p, vec2 t ) 7521 { 7522 vec2 q = vec2(length(p.xy)-t.x,p.z); 7523 return length(q)-t.y; 7524 } 7525 7526 float sdCappedTorus( vec3 p, vec2 sc, float ra, float rb) 7527 { 7528 p.x = abs(p.x); 7529 float k = (sc.y*p.x>sc.x*p.y) ? dot(p.xy,sc) : length(p.xy); 7530 return sqrt( dot(p,p) + ra*ra - 2.0*ra*k ) - rb; 7531 } 7532 7533 float dot2( in vec2 v ) { return dot(v,v); } 7534 float sdCappedCone( vec3 p, float h, float r1, float r2 ) 7535 { 7536 vec2 q = vec2( length(p.xz), p.y ); 7537 vec2 k1 = vec2(r2,h); 7538 vec2 k2 = vec2(r2-r1,2.0*h); 7539 vec2 ca = vec2(q.x-min(q.x,(q.y<0.0)?r1:r2), abs(q.y)-h); 7540 vec2 cb = q - k1 + k2*clamp( dot(k1-q,k2)/dot2(k2), 0.0, 1.0 ); 7541 float s = (cb.x<0.0 && ca.y<0.0) ? -1.0 : 1.0; 7542 return s*sqrt( min(dot2(ca),dot2(cb)) ); 7543 } 7544 7545 float sdCappedCylinder( vec3 p, float h, float r ) 7546 { 7547 vec2 d = abs(vec2(length(p.xz),p.y)) - vec2(r,h); 7548 return min(max(d.x,d.y),0.0) + length(max(d,0.0)); 7549 } 7550 7551 float maxBlend = 0.0; 7552 // compute potential from A (=24) spheres, using the bit flags in 'activeKey' 7553 // to avoid lookup/compute for inactive spheres 7554 // return field potential, side effect updates track, 7555 // compute and return +ve and -ve values separately 7556 void fillSpatialInner( 7557 float ii, 7558 float activeKey, 7559 vec3 corner, 7560 inout float sdf, 7561 inout float colorDivisor, 7562 inout vec4 trackColor 7563 ) { 7564 for (float i = 0.; i < ${Ds}.; i++) { 7565 if (activeKey < 1.) break; // activeKey exhausted, no more active spheres 7566 activeKey *= 0.5; 7567 if (fract(activeKey) < 0.5) continue; 7568 7569 float iin = (i + ii + 0.5) * ${1/ur}; 7570 vec4 shape = shapePos(iin); 7571 vec4 quat = shapeQuat(iin); 7572 vec4 params1 = shapeParams1(iin); 7573 vec4 params2 = shapeParams2(iin); 7574 7575 vec3 p = corner - shape.xyz; 7576 applyQuaternionToVector(quat, p); 7577 p /= params2.z; // scale 7578 float d; // d in -1..1 coordinates 7579 switch (int(params1.x)) { 7580 case 0: d = sdSphere(p, params1.y); break; 7581 case 1: d = sdEllipsoid(p, params1.yzw); break; 7582 case 2: d = sdBox(p, params1.yzw); break; 7583 case 3: d = sdCappedCylinder(p, params1.y, params1.z); break; 7584 case 4: d = sdCappedCone(p, params1.y, params1.z, params1.w); break; 7585 case 5: d = sdTorus(p, params1.yz); break; 7586 case 6: d = sdCappedTorus(p, params1.yz, params1.w, params2.w); break; 7587 } 7588 d -= params2.y; // rounded edge 7589 d *= params2.z; // scale 7590 7591 float k = params2.x; 7592 float op = shape.w; 7593 7594 sdf = smoothOperation(shape.w, sdf, d, k); 7595 7596 float isNegativeOne = step(-1.5, op) * step(op, -0.5); // 1 when op == -1, 0 otherwise 7597 float colorCull = smoothstep(maxBlend, 0., -d); 7598 float cullFactor = mix(1.0, colorCull, isNegativeOne); 7599 trackColor *= cullFactor; 7600 colorDivisor *= cullFactor; 7601 7602 maxBlend = max(maxBlend, k); 7603 7604 k += 2. * INV_VOXEL_RESOLUTION; // avoid division by zero, and other color artifacts with very small k 7605 float nearness = smoothstep(k, 0., d); 7606 7607 vec4 color = shapeColor(iin); 7608 nearness *= float(color.a >= 0.); 7609 7610 colorDivisor += nearness; 7611 trackColor += color * nearness; 7612 } 7613 } 7614 7615 vec3 div; 7616 // compute potential from all spheres; collect +ve and =ve values separately 7617 // work in blocks of A*4 (=96) spheres, using the bit flags in 4 float channel 'activeKey' values 7618 // TODO check if extra vec3 output useful, not really used at present 7619 float fillSpatial(vec3 corner, inout vec4 trackColor) { 7620 float sdf = 1e3; // hack: initialize to large value 7621 float colorDivisor = 0.; 7622 // spatialPassTexture holds x=> lowi, x faster moving and y=> z, y faster moving 7623 float divyz = (div.y + div.z * spatialDivisions + 0.5) / (spatialDivisions2); 7624 for (float ii = 0.; ii < spatialn; ii++) { 7625 float i = ii * ${4*Ds}.; 7626 7627 vec4 activeKey = texture(spatialPassTexture, vec2((div.x * spatialn + ii + 0.5)/(spatialn * spatialDivisions), divyz)); 7628 fillSpatialInner(i, activeKey.x, corner, sdf, colorDivisor, trackColor); 7629 fillSpatialInner(i+${Ds}., activeKey.y, corner, sdf, colorDivisor, trackColor); 7630 fillSpatialInner(i+${2*Ds}., activeKey.z, corner, sdf, colorDivisor, trackColor); 7631 fillSpatialInner(i+${3*Ds}., activeKey.w, corner, sdf, colorDivisor, trackColor); 7632 } 7633 7634 trackColor /= colorDivisor; 7635 return mix(sdf, 0.0, step(1e20 - 0.1, sdf)); 7636 } 7637 7638 void main() { 7639 ${ta.getxyzi} // get xi yi zi from 2d position 7640 7641 vec3 xyzi = vec3(xi,yi,zi); 7642 vec3 corner = xyzi / VOXEL_RESOLUTION_SUB1 * 2. - 1.; // -1..1 coords 7643 7644 div = floor(xyzi / VOXEL_RESOLUTION_SUB1 * spatialDivisionsSub1); 7645 7646 vec4 c = vec4(0.); 7647 float t = fillSpatial(corner, c); 7648 7649 pc_FragColor = vec4(t, packRGBAToVec3(c)); // RGB texture 7650 } 7651 `;return new Fp({name:"PotentialPass",fragmentShader:e,uniforms:this.potentialPassUniforms})}voxelPassMaterial(){let e=` 7652 precision highp float; 7653 layout(location = 0) out vec4 pc_FragColor; 7654 layout(location = 1) out vec4 numTris; 7655 7656 const float res = float(RES); 7657 const float VOXEL_RESOLUTION = pow(2., res); 7658 const float VOXEL_RESOLUTION_SUB1 = VOXEL_RESOLUTION - 1.; 7659 const float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.)); 7660 const float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION; 7661 uniform sampler2D numTrisTable; // 256 x 1 7662 7663 float keyi(float f000, float f100, float f010, float f110, float f001, float f101, float f011, float f111) { 7664 return (float(f000 < 0.) * 1.) + 7665 (float(f100 < 0.) * 2.) + 7666 (float(f010 < 0.) * 8.) + 7667 (float(f110 < 0.) * 4.) + 7668 (float(f001 < 0.) * 16.) + 7669 (float(f101 < 0.) * 32.) + 7670 (float(f011 < 0.) * 128.) + 7671 (float(f111 < 0.) * 64.); 7672 } 7673 7674 ${ta.lookup} 7675 7676 vec3 compNormi(float xi, float yi, float zi) { 7677 float dx = look(xi + 1., yi, zi, potentialPassTexture).r - look(xi - 1., yi, zi, potentialPassTexture).r; 7678 float dy = look(xi, yi + 1., zi, potentialPassTexture).r - look(xi, yi - 1., zi, potentialPassTexture).r; 7679 float dz = look(xi, yi, zi + 1., potentialPassTexture).r - look(xi, yi, zi - 1., potentialPassTexture).r; 7680 // if we allow (common) 0,0,0 case through then NaN can spread 7681 // eg r = vec4(compNorm i(???), 1.) will pollute r.w 7682 if (dx == 0.0 && dy == 0.0 && dz == 0.0) { 7683 return vec3(0.199, 0.299, 0.399); 7684 } 7685 return normalize(vec3(dx, dy, dz)); 7686 } 7687 7688 void main() { 7689 ${ta.getxyzi} // get xi yi zi from 2d 7690 7691 vec3 normal = compNormi(xi, yi, zi); // even if our key is -1 this may be needed by a neighbouring voxel 7692 7693 if (xi >= VOXEL_RESOLUTION_SUB1 || yi >= VOXEL_RESOLUTION_SUB1 || zi >= VOXEL_RESOLUTION_SUB1) { 7694 pc_FragColor = vec4(normal, 0.); 7695 numTris = vec4(0.); 7696 return; 7697 } 7698 7699 float 7700 f000 = look(xi, yi, zi, potentialPassTexture).r, 7701 f100 = look(xi+1., yi, zi, potentialPassTexture).r, 7702 f010 = look(xi, yi+1., zi, potentialPassTexture).r, 7703 f110 = look(xi+1., yi+1., zi, potentialPassTexture).r, 7704 f001 = look(xi, yi, zi+1., potentialPassTexture).r, 7705 f101 = look(xi+1., yi, zi+1., potentialPassTexture).r, 7706 f011 = look(xi, yi+1., zi+1., potentialPassTexture).r, 7707 f111 = look(xi+1., yi+1., zi+1., potentialPassTexture).r; 7708 float key = keyi(f000, f100, f010, f110, f001, f101, f011, f111); 7709 7710 pc_FragColor = vec4(normal, key); 7711 7712 numTris = texture(numTrisTable, vec2((key + 0.5) / 256., 0.5)); 7713 } 7714 `;return new Fp({name:"VoxelPass",fragmentShader:e,uniforms:this.voxelPassUniforms})}
vendor: 13,195 bytes, lines 7714-7950
7714patchVertexShaderForShapeBlend(e){let t=` 7715 #ifdef SHAPEBLEND 7716 precision highp sampler2D; 7717 7718 uniform float isol; 7719 7720 uniform sampler2D triTable; // 256 x 16 7721 uniform sampler2D pyramidTexture1; 7722 uniform vec2 pyramidTexture1Size; 7723 uniform sampler2D pyramidTexture2; 7724 uniform vec2 pyramidTexture2Size; 7725 7726 const vec2 halfPixelOffset = vec2(0.5, 0.5); 7727 7728 const vec2 rShift = vec2(0., 1.); 7729 const vec2 gShift = vec2(1., 1.); 7730 const vec2 bShift = vec2(1., 0.); 7731 7732 const float res = float(RES); 7733 const float VOXEL_RESOLUTION = pow(2., res); 7734 const float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.)); 7735 const float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION; 7736 7737 const float scale_factor = ${Ua}.; 7738 7739 #if SHAPEBLEND == 5 7740 const float levelShiftX[7] = float[7](4., 6., 12., 24., 48., 96., 192.); 7741 const float scale = 8. * scale_factor; 7742 const vec3 originOffset = vec3(16.); 7743 #elif SHAPEBLEND == 7 7744 const float levelShiftX[10] = float[10](4., 6., 12., 24., 48., 96., 192., 384., 768., 1536.); 7745 const float scale = 2. * scale_factor; 7746 const vec3 originOffset = vec3(64.); 7747 #elif SHAPEBLEND == 8 7748 const float levelShiftX[11] = float[11](4., 8., 16., 32., 64., 128., 256., 512., 1024., 2048., 4096.); 7749 const float scale = scale_factor; 7750 const vec3 originOffset = vec3(128.); 7751 #else 7752 const float levelShiftX[8] = float[8](4., 8., 16., 32., 64., 128., 256., 512.); 7753 const float scale = 4. * scale_factor; 7754 const vec3 originOffset = vec3(32.); 7755 #endif 7756 7757 ${ta.lookup} 7758 7759 const vec3 offsets[24] = vec3[]( 7760 vec3(0., 0., 0.), vec3(1., 0., 0.), 7761 vec3(1., 0., 0.), vec3(1., 1., 0.), 7762 vec3(0., 1., 0.), vec3(1., 1., 0.), 7763 vec3(0., 0., 0.), vec3(0., 1., 0.), 7764 vec3(0., 0., 1.), vec3(1., 0., 1.), 7765 vec3(1., 0., 1.), vec3(1., 1., 1.), 7766 vec3(0., 1., 1.), vec3(1., 1., 1.), 7767 vec3(0., 0., 1.), vec3(0., 1., 1.), 7768 vec3(0., 0., 0.), vec3(0., 0., 1.), 7769 vec3(1., 0., 0.), vec3(1., 0., 1.), 7770 vec3(1., 1., 0.), vec3(1., 1., 1.), 7771 vec3(0., 1., 0.), vec3(0., 1., 1.) 7772 ); 7773 7774 vec2 computeShiftedPosition1(vec2 xy, float levelOriginX) { 7775 vec2 xyShifted = xy; 7776 xyShifted.x += levelOriginX; 7777 return (xyShifted + halfPixelOffset) / pyramidTexture1Size; 7778 } 7779 7780 vec2 computeShiftedPosition2(vec2 xy, float levelOriginX) { 7781 vec2 xyShifted = xy; 7782 xyShifted.x += levelOriginX; 7783 return (xyShifted + halfPixelOffset) / pyramidTexture2Size; 7784 } 7785 7786 vec4 unpackVec3ToRGBA(vec3 vec) { 7787 uint combined = uint(vec.x * 65535.0 + 0.5); // Add 0.5 for rounding 7788 float g = float(combined & uint(0xFF)) * 0.00392156862; // 1/255 7789 float r = float((combined >> 8) & uint(0xFF)) * 0.00392156862; 7790 7791 return vec4(r, g, vec.y, vec.z); 7792 } 7793 7794 out vec4 marchColor; 7795 // end of marchvertPre 7796 #endif 7797 `,i=` 7798 #ifdef SHAPEBLEND 7799 float triIndex = floor(float(gl_VertexID/3)); 7800 float vertexIndex = float(gl_VertexID); 7801 7802 // Initial pyramid lookup 7803 float levelOriginX1 = pyramidTexture1Size.x - 2.; 7804 float levelOriginX2 = pyramidTexture2Size.x - 1.; 7805 vec2 xy = vec2(0.); 7806 vec4 lookUp = texture(pyramidTexture2, computeShiftedPosition2(xy, levelOriginX2)); 7807 7808 // Early exit check 7809 if (triIndex >= lookUp.r) return; 7810 7811 // Optimize loop variables 7812 float start = 0.; 7813 vec4 triIndexVec = vec4(triIndex); 7814 7815 // Main position computation loop 7816 for (int i = 0; i < LOOP;) { 7817 // Compute boundaries 7818 vec4 ends = lookUp + vec4(start); 7819 vec4 starts = vec4(ends.gba, start); 7820 vec4 check = vec4(greaterThanEqual(triIndexVec, starts)) * 7821 vec4(lessThan(triIndexVec, ends)); 7822 7823 // Update position 7824 xy *= 2.; 7825 xy += check.r * rShift + check.g * gShift + check.b * bShift; 7826 7827 // Update loop variables 7828 start = dot(check, starts); 7829 levelOriginX2 -= levelShiftX[i]; 7830 7831 // Update lookup 7832 lookUp = texture(pyramidTexture1, computeShiftedPosition1(xy, levelOriginX1)); 7833 i++; 7834 7835 ends = lookUp + vec4(start); 7836 starts = vec4(ends.gba, start); 7837 check = vec4(greaterThanEqual(triIndexVec, starts)) * 7838 vec4(lessThan(triIndexVec, ends)); 7839 7840 // Update position 7841 xy *= 2.; 7842 xy += check.r * rShift + check.g * gShift + check.b * bShift; 7843 7844 // Update loop variables 7845 start = dot(check, starts); 7846 levelOriginX1 -= levelShiftX[i]; 7847 7848 // Update lookup 7849 lookUp = texture(pyramidTexture2, computeShiftedPosition2(xy, levelOriginX2)); 7850 7851 i++; 7852 } 7853 7854 #if HALF == 1 7855 vec4 ends = lookUp + vec4(start); 7856 vec4 starts = vec4(ends.gba, start); 7857 vec4 check = vec4(greaterThanEqual(triIndexVec, starts)) * vec4(lessThan(triIndexVec, ends)); 7858 7859 // Update position 7860 xy *= 2.; 7861 xy += check.r * rShift + check.g * gShift + check.b * bShift; 7862 7863 // Update loop variables 7864 start = dot(check, starts); 7865 #endif 7866 7867 // Compute final coordinates 7868 vec3 gridPos; 7869 gridPos.x = mod(xy.x, VOXEL_RESOLUTION); 7870 gridPos.y = mod(xy.y, VOXEL_RESOLUTION); 7871 gridPos.z = floor(xy.x * INV_VOXEL_RESOLUTION) + 7872 floor(xy.y * INV_VOXEL_RESOLUTION) * Z_LAYERS_PER_ROW; 7873 7874 // Vertex key computation 7875 vertexIndex -= start * 3.; 7876 float vk = vertexIndex * 0.0625 + 0.03125; // Optimized division by 16 and addition of 1/32 7877 7878 // Voxel lookup and edge computation 7879 vec4 voxel = look(gridPos.x, gridPos.y, gridPos.z, voxelPassTexture); 7880 float key = (voxel.w + 0.5) * 0.00390625; // Optimized division by 256 7881 7882 // Edge lookup and offset computation 7883 float edgeNum = texture(triTable, vec2(vk, key)).x; 7884 int edgeIndex = int(edgeNum) * 2; 7885 7886 // Compute edge positions 7887 vec3 p1 = gridPos + offsets[edgeIndex]; 7888 vec3 p2 = gridPos + offsets[edgeIndex + 1]; 7889 7890 // Compute potentials and normals 7891 vec4 potential1 = look(p1.x, p1.y, p1.z, potentialPassTexture); 7892 vec4 potential2 = look(p2.x, p2.y, p2.z, potentialPassTexture); 7893 7894 // Final position and normal computation 7895 float mu = potential1.r / (potential1.r - potential2.r); 7896 7897 marchColor = mix( 7898 unpackVec3ToRGBA(potential1.gba), 7899 unpackVec3ToRGBA(potential2.gba), 7900 mu 7901 ); 7902 7903 transformed = p1 + (p2 - p1) * mu; 7904 transformed -= originOffset; 7905 transformed *= scale; 7906 vec4 data1 = look(p1.x, p1.y, p1.z, voxelPassTexture); 7907 vec4 data2 = look(p2.x, p2.y, p2.z, voxelPassTexture); 7908 objectNormal = normalize(mix(data1.xyz, data2.xyz, mu)); 7909 transformedNormal = normalMatrix * objectNormal; 7910 #ifndef FLAT_SHADED 7911 vNormal = transformedNormal; 7912 #endif 7913 #endif 7914 `;e.vertexShader=t+e.vertexShader.replace("#include <project_vertex>",i+` 7915#include <project_vertex>`);let r=e.fragmentShader.match(/vec3 diffuseColor[^\n]*\n/);if(!r)return;let s=` 7916 #ifdef SHAPEBLEND_C 7917 #if SHAPEBLEND_C == 1 7918 ${r[0].replace(/nodeU0,/g,"marchColor.rgb,").replace(/nodeU\d+(?=,g_uid\d+_calpha\))/g,"marchColor.a")} 7919 #else 7920 ${r[0]} 7921 #endif 7922 #else 7923 ${r[0]} 7924 #endif 7925 `;e.fragmentShader=`in vec4 marchColor; 7926`+e.fragmentShader.replace(r[0],s),Object.assign(e.uniforms,this.marchPassUniforms)}initDebugPass(e){console.log("fboToDebug.width",e.width,e.height),this.geometry=new Sa(e.width,e.height),this.geometry.userData={parameters:{width:4,height:4}};let t={inputTexture:{value:Array.isArray(e.texture)?e.texture[1]:e.texture},pyramidTextureSize:{value:void 0}},i=r=>{r.vertexShader=` 7927 precision highp float; 7928 7929 varying vec2 vUv; 7930 7931 void main() { 7932 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 7933 vUv = uv; 7934 } 7935 `,r.fragmentShader=` 7936 layout(location = 1) out vec4 gVelocity; 7937 7938 precision highp float; 7939 7940 uniform sampler2D inputTexture; 7941 varying vec2 vUv; 7942 7943 uniform vec2 pyramidTextureSize; 7944 7945 void main() { 7946 // Sample the input texture using UV coordinates 7947 gl_FragColor = texture(inputTexture, vUv); 7948 gVelocity = vec4(0.0); 7949 } 7950 `,t.pyramidTextureSize.value=new H(this.pyramidRenderTarget[0].width,this.pyramidRenderTarget[0].height),Object.assign(r.uniforms,t)};this.material.shapeBlendhack=i,this.material.root.shapeBlendhack=i}},nl=wP;nl.streamCompaction=new xZ;var bZ=new xe,wZ=new xe,Nl=new nt,Rn=new M,gp=new M,SZ=new nt;function _Z(e,t=0){let i=this.children.length;for(;i--;){let r=this.children[i];rl.is(r)&&SP.call(r,e,t+1)}}function SP(e,t=0){if(e(this,t)!==!0){let i=this.children.length;for(;i--;){let r=this.children[i];rl.is(r)&&SP.call(r,e,t+1)}}}function AZ(){if(this.shapesDataTexture.value===void 0){let n=new zr(new Float32Array(4*ur*Fo),ur,Fo,oi,Ht);this.shapesDataTexture.value=n}let e=this.shapesDataTexture.value,t=e.image.data;e.needsUpdate=!0;let i=0,r=this.data.geometry.blendRange,s=bZ.copy(this.matrixWorld).invert(),a=0;_Z.call(this,n=>{if(n.visible===!1)return!0;let o;if(n instanceof ys||n instanceof au||n instanceof nu)return;n instanceof vr?o=n.object:o=n;let l=n.data?.cloner;if(Tt.is(n)&&l&&!l.hideBase&&l.type!=="radial"&&l.disabled!==!0||!(o instanceof ai))return;let h=o.geometry.userData.parameters,c=h.shapeBlendNode;if(c===void 0)return;if(wZ.multiplyMatrices(s,n.matrixWorld).decompose(gp,Nl,Rn),h.type==="TorusGeometry"&&h.arc!==360){let v=h.arc*Math.PI/180;v=v/4,Nl.multiply(SZ.set(0,0,Math.sin(v),Math.cos(v)))}let u=c.overrideGlobalBlend?c.blendRange:r;u=u/this.bboxSize*2,t[a*4]=(gp.x-this.bboxOffset)/this.bboxSize*2,t[a*4+1]=(gp.y-this.bboxOffset)/this.bboxSize*2,t[a*4+2]=(gp.z-this.bboxOffset)/this.bboxSize*2,t[a*4+3]=c.operation===0?1:c.operation===2?-1:-2,t[ur*4+a*4]=-Nl.x,t[ur*4+a*4+1]=-Nl.y,t[ur*4+a*4+2]=-Nl.z,t[ur*4+a*4+3]=Nl.w;let d=new Float32Array(4),p=0;if(h.type==="SphereGeometry")h.width===h.height&&h.width===h.depth?d[0]=0:d[0]=1,d[1]=h.width/this.bboxSize,d[2]=h.height/this.bboxSize,d[3]=h.depth/this.bboxSize,i=Math.max(i,d[1]*Rn.x+u,d[2]*Rn.x+u,d[3]*Rn.x+u);else if(h.type==="CubeGeometry"){p=h.cornerRadius;let v=h.width,y=h.height,x=h.depth;d[0]=2,d[1]=(v-2*p)/this.bboxSize,d[2]=(y-2*p)/this.bboxSize,d[3]=(x-2*p)/this.bboxSize,i=Math.max(i,Math.sqrt(v**2+y**2+x**2)/this.bboxSize*Rn.x+u)}else if(h.type==="CylinderGeometry"){p=h.cornerRadius;let v=h.height,y=h.radiusBottom,x=h.radiusTop;if(x>=y){let w=Math.atan2(x-y,v),S=(Math.PI/2-w)/2;x-=p/Math.tan(S),y-=p*Math.tan(S)}else if(y>x){let w=Math.atan2(y-x,v),S=(Math.PI/2-w)/2;x-=p*Math.tan(S),y-=p/Math.tan(S)}d[1]=(h.height-2*p)/this.bboxSize,y===x?(d[0]=3,d[2]=y/this.bboxSize*2):(d[0]=4,d[2]=y/this.bboxSize*2,d[3]=x/this.bboxSize*2),i=Math.max(i,d[1]*4*Rn.x+u)}else if(h.type==="TorusGeometry"){if(d[0]=5,d[1]=(h.width-h.depth)/this.bboxSize,d[2]=h.depth/this.bboxSize,h.arc!==360){d[0]=6,d[3]=d[1],t[ur*12+a*4+3]=d[2];let v=2*Math.atan2(d[2]/2,d[1]),y=h.arc*Math.PI/180/2-v;d[1]=Math.sin(y),d[2]=Math.cos(y)}i=Math.max(i,h.width*Rn.x/this.bboxSize+u)}t.set(d,ur*8+a*4),t[ur*12+a*4]=u,t[ur*12+a*4+1]=p/this.bboxSize*2,t[ur*12+a*4+2]=Rn.x;let f=o.material,m=f.uniforms.nodeU0.node.value,g=f.uniforms.nodeU1.value;c.operation!==0&&!c.useColor&&(g=-1),t[ur*16+a*4]=m.r,t[ur*16+a*4+1]=m.g,t[ur*16+a*4+2]=m.b,t[ur*16+a*4+3]=g,g<1&&this.material.defines.SHAPEBLEND_C===1&&(this.material.transparent=!0),a++}),this.npart=a,this.spatialPassUniforms.span.value=i*1.4}var _P=512;function s2(e,t){let i=!1,r=e.layers.mask&_P,s=t.getLayersOfType("transmission"),a=t.getLayersOfType("outline");return a.length>0&&(e.layers.set(8),s.length>0&&e.layers.enable(3),i=!0,Sx(e),wx(e)),s.length===0&&a.length===0&&e.layers.set(0),r&&e.layers.set(9),e instanceof uo&&e.needsAO&&e.layers.enable(5),i}function a2(e,t){if(!t.layers)return!1;let i=e.layers.mask&_P,r=!1,s=t.getLayersOfType("transmission").filter(n=>n.data.visible),a=t.getLayersOfType("outline").filter(n=>n.data.visible);return s.length>0&&(e.layers.set(3),a.length>0&&e.layers.enable(8),r=!0),s.length===0&&a.length===0&&e.layers.set(0),i&&e.layers.set(9),e.needsAO&&e.layers.enable(5),r}function MZ(e){let t=!1;return e.traverseEntity(i=>{if(i instanceof uo)if(Array.isArray(i.material))for(let r=0;r<i.material.length;r++)s2(i,i.material[r])&&(t=!0);else s2(i,i.material)&&(t=!0)}),t}function EZ(e){let t=!1;return e.traverseEntity(i=>{if(i instanceof uo)if(Array.isArray(i.material))for(let r=0;r<i.material.length;r++)a2(i,i.material[r])&&(t=!0);else a2(i,i.material)&&(t=!0)}),t}var CZ=new GM,TZ=new xe,PZ=new Nh;function By(e,t,i,r=!1){let s=e.cloner;if(s)for(let a of s.children){let n=TZ.copy(a.matrixWorld).invert(),o=PZ.copy(t.ray).applyMatrix4(n),l=e.matrixWorld;o.applyMatrix4(l);let h=CZ;h.set(o.origin,o.direction),h.near=t.near,h.far=t.far;let c=h.intersectObject(e,!1);c.length>0&&i.push({...c[0],object:r?a:e})}}var DZ=class{constructor(){this._constraints=new Map}setConstraint(e,t){t===null?this._constraints.delete(e):this._constraints.set(e,t)}removeDependencies(e){this._constraints.delete(e)}applyConstraints(e){let t=new Set;this._constraints.forEach((i,r)=>{let s=[r,i],a=i;for(;this._constraints.has(a);){if(a=this._constraints.get(a),s.includes(a)){console.warn(`circular dependency detected: ${s.join(" -> ")}`);break}t.has(a)||s.push(a)}for(let n=s.length-2;n>=0;n--)if(!t.has(s[n])){let o=e.find(s[n]);o?o.applyPathSnapping(e):console.warn(`missing entity ${s[n]}`),t.add(s[n])}})}findDependency(e,t){let i=e;for(;this._constraints.has(i);)if(i=this._constraints.get(i),i===t)return!0;return!1}}
7950,OZ="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL",eo=class{};Bc(eo,"DepthMapRange",65536),Bc(eo,"MemoryPageSize",65536),Bc(eo,"BytesPerFloat",4),Bc(eo,"BytesPerInt",4);function IZ(e){let t,i,r,s,a,n,o,l,h,c,u,d,p,f,m,g;function v(T){let I=new Float64Array(c,n,16);for(let O=0;O<16;O++)I[O]=T[O];let P;if(r>1){t.exports.sortIndexes(s,a,h,n,o,l,d.DepthMapRange,r);let O=new Uint32Array(r);P=O.buffer,O.set(new Uint32Array(c,l,r))}else if(r===1){let O=new Uint32Array(r);O[0]=new Uint32Array(c,s,i)[0],P=O.buffer}else P=new ArrayBuffer(0);e.postMessage({sortDone:!0,indexesBuffer:P},[P])}function y(T,I,P){let O=new Float32Array(c,a,i*3);r=0;let k=new Uint32Array(c,s,i);for(let G=0;G<P.length-1;G++){let B=I[G],U=T[G].elements,Q=B.filter(j=>j.enabled&&j.mode==="Include").map(j=>j.type==="Box"?b(j):A(j)),q=B.filter(j=>j.enabled&&j.mode==="Exclude").map(j=>j.type==="Box"?b(j):A(j));for(let j=P[G];j<P[G+1];j++){let X=p[j*3],te=p[j*3+1],K=p[j*3+2];if((Q.length===0||w(X,te,K,Q))&&(q.length===0||!w(X,te,K,q))){let Z=1/(U[3]*X+U[7]*te+U[11]*K+U[15]);O[r*3]=(U[0]*X+U[4]*te+U[8]*K+U[12])*Z,O[r*3+1]=(U[1]*X+U[5]*te+U[9]*K+U[13])*Z,O[r*3+2]=(U[2]*X+U[6]*te+U[10]*K+U[14])*Z,k[r]=j,r++}}}}function x(T,I){let P=[],O=I.filter(B=>B.enabled&&B.mode==="Include").map(B=>B.type==="Box"?b(B):A(B)),k=I.filter(B=>B.enabled&&B.mode==="Exclude").map(B=>B.type==="Box"?b(B):A(B)),G=T.length;for(let B=0;B<G;B+=3){let U=T[B],Q=T[B+1],q=T[B+2];(O.length===0||w(U,Q,q,O))&&(k.length===0||!w(U,Q,q,k))||P.push(B/3)}return P}function w(T,I,P,O,k){return O[k==="Intersect"?"every":"some"](G=>{let B=S(T,I,P,G.invRotationMatrix,G.cropCenter);return Array.isArray(G)?_(B.x,B.y,B.z,G):C(B.x,B.y,B.z,G)})}function S(T,I,P,O,k){let G=T-k[0],B=I-k[1],U=P-k[2],Q=1/(O[3]*G+O[7]*B+O[11]*U+O[15]);return{x:(O[0]*G+O[4]*B+O[8]*U+O[12])*Q+k[0],y:(O[1]*G+O[5]*B+O[9]*U+O[13])*Q+k[1],z:(O[2]*G+O[6]*B+O[10]*U+O[14])*Q+k[2]}}function b(T){let I=T.cropSize[0]/2,P=T.cropSize[1]/2,O=T.cropSize[2]/2,k=[T.cropCenter[0]-I,T.cropCenter[1]-P,T.cropCenter[2]-O,T.cropCenter[0]+I,T.cropCenter[1]+P,T.cropCenter[2]+O],G=E(T.cropRotation);return Object.assign(k,{invRotationMatrix:G,cropCenter:T.cropCenter})}function E(T){let I=[],P=T[0]*Math.PI/180,O=T[1]*Math.PI/180,k=T[2]*Math.PI/180,G=Math.cos(P),B=Math.sin(P),U=Math.cos(O),Q=Math.sin(O),q=Math.cos(k),j=Math.sin(k),X=G*q,te=G*j,K=B*q,Z=B*j;return I[0]=U*q,I[1]=-U*j,I[2]=Q,I[4]=te+K*Q,I[5]=X-Z*Q,I[6]=-B*U,I[8]=Z-X*Q,I[9]=K+te*Q,I[10]=G*U,I[12]=0,I[13]=0,I[14]=0,I[3]=0,I[7]=0,I[11]=0,I[15]=1,I}function _(T,I,P,O){return T>=O[0]&&T<=O[3]&&I>=O[1]&&I<=O[4]&&P>=O[2]&&P<=O[5]}function A(T){let I=2/T.cropSize[0],P=2/T.cropSize[1],O=2/T.cropSize[2],k=E(T.cropRotation);return{invRadiusX:I,invRadiusY:P,invRadiusZ:O,cropCenter:T.cropCenter,invRotationMatrix:k}}function C(T,I,P,O){let k=(T-O.cropCenter[0])*O.invRadiusX,G=(I-O.cropCenter[1])*O.invRadiusY,B=(P-O.cropCenter[2])*O.invRadiusZ;return k*k+G*G+B*B<=1}e.onmessage=T=>{if(T.data.getCroppedIndexes){let I=new Uint32Array(x(new Float32Array(T.data.positions),T.data.crops)).buffer;e.postMessage({outOfBoundsIndexes:I},[I])}else if(T.data.positions)u=T.data.positions,p=new Float32Array(u),m=T.data.meshMatrixWorlds,g=T.data.cropsArray,f=T.data.meshIndexIntervals,y(m,g,f),e.postMessage({sortSetupComplete:!0});else if(T.data.sort||T.data.newMatrixWorlds||T.data.newCropsArray)(T.data.newMatrixWorlds||T.data.newCropsArray)&&(g=T.data.newCropsArray||g,m=T.data.newMatrixWorlds||m,y(m,g,f)),v(T.data.sort.view,T.data.sort.cameraPosition);else if(T.data.init){d=T.data.init.Constants,i=T.data.init.splatCount;let I=d.BytesPerInt,P=d.BytesPerFloat*3,O=new Uint8Array(T.data.init.sorterWasmBytes),k=I+P,G=i*k,B=i*d.BytesPerInt*2+d.DepthMapRange*d.BytesPerInt*2,U=d.MemoryPageSize*32,Q=G+B+U,q=Math.floor(Q/d.MemoryPageSize)+1,j={module:{},env:{memory:new WebAssembly.Memory({initial:q*2,maximum:q*3,shared:!0})}};WebAssembly.compile(O).then(X=>WebAssembly.instantiate(X,j)).then(X=>{t=X,s=0,a=i*I,n=a+i*P,h=n+16*d.BytesPerFloat*2,o=h+i*d.BytesPerInt,l=o+d.DepthMapRange*d.BytesPerInt,c=j.env.memory.buffer,e.postMessage({sortSetupPhase1Complete:!0})})}}}function RZ(e){let t=new Worker(URL.createObjectURL(new Blob(["(",IZ.toString(),")(self)"],{type:"application/javascript"}
7950))),i=atob(OZ),r=new Uint8Array(i.length);for(let s=0;s<i.length;s++)r[s]=i.charCodeAt(s);return t.postMessage({init:{sorterWasmBytes:r.buffer,splatCount:e,Constants:{BytesPerFloat:eo.BytesPerFloat,BytesPerInt:eo.BytesPerInt,DepthMapRange:eo.DepthMapRange,MemoryPageSize:eo.MemoryPageSize}}}),t}var xv=(function(){let e=new Float32Array(1),t=new Int32Array(e.buffer);return function(i){return e[0]=i,t[0]}})(),LZ=function(e,t,i,r){return e+(t<<8)+(i<<16)+(r<<24)},vp=new H;function n2(e){let t=!1;return e.scene.objects.traverse((i,r)=>{if(r.visible===!1)return!0;r.type==="Splat"&&(t=!0)}),t}var Up=class extends Zt{constructor(e,t,i,r,s=!1,a=1,n,o){super(i,r),this.splatCount=t,this.meshIndexIntervals=n,this.meshMatrixWorlds=o,this.splatBuffers=e,this.geometry=i,this.material=r,this.splatDataTextures=null,this.halfPrecisionCovariancesOnGPU=s,this.devicePixelRatio=a,this.resetLocalSplatDataAndTexturesFromSplatBuffer()}static buildMesh(e,t,i=!1,r=1,s,a){let n=Up.buildGeomtery(t),o=Up.buildMaterial(s);return new Up(e,t,n,o,i,r,s,a)}static buildMaterial(e){let t=` 7951 precision highp float; 7952 #include <common> 7953 7954 attribute uint splatIndex; 7955 7956 uniform highp sampler2D covariancesTexture; 7957 uniform highp usampler2D centersColorsTexture; 7958 uniform vec2 focal; 7959 uniform vec2 viewport; 7960 uniform vec2 basisViewport; 7961 uniform vec2 covariancesTextureSize; 7962 uniform vec2 centersColorsTextureSize; 7963 uniform highp sampler2D meshMatrixWorldsTexture; 7964 uniform uint meshIndexIntervals[257]; 7965 uniform float orthoZoom; 7966 7967 varying vec4 vColor; 7968 varying vec2 vUv; 7969 7970 varying vec2 vPosition; 7971 7972 const vec4 encodeNorm4 = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0); 7973 const uvec4 mask4 = uvec4(uint(0x000000FF), uint(0x0000FF00), uint(0x00FF0000), uint(0xFF000000)); 7974 const uvec4 shift4 = uvec4(0, 8, 16, 24); 7975 vec4 uintToRGBAVec (uint u) { 7976 uvec4 urgba = mask4 & u; 7977 urgba = urgba >> shift4; 7978 vec4 rgba = vec4(urgba) * encodeNorm4; 7979 return rgba; 7980 } 7981 7982 vec2 getDataUV(in int stride, in int offset, in vec2 dimensions) { 7983 vec2 samplerUV = vec2(0.0, 0.0); 7984 float d = float(splatIndex * uint(stride) + uint(offset)) / dimensions.x; 7985 samplerUV.y = float(floor(d)) / dimensions.y; 7986 samplerUV.x = fract(d); 7987 return samplerUV; 7988 } 7989 7990 void main () { 7991 uvec4 sampledCenterColor = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize)); 7992 vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenterColor.gba)); 7993 vColor = uintToRGBAVec(sampledCenterColor.r); 7994 7995 vPosition = position.xy * 2.0; 7996 7997 uint meshIndex; 7998 for (int i = 1; i < 257; i++) { 7999 if (splatIndex < meshIndexIntervals[i]) { 8000 meshIndex = uint(i - 1); 8001 break; 8002 } 8003 } 8004 8005 float strideMulmeshIndex = float(4u*meshIndex); 8006 float meshMatrixWorldsTextureLength = float(256*4); 8007 8008 mat4 modelMat = mat4( 8009 texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+0.0)/meshMatrixWorldsTextureLength, 0)), 8010 texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+1.0)/meshMatrixWorldsTextureLength, 0)), 8011 texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+2.0)/meshMatrixWorldsTextureLength, 0)), 8012 texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+3.0)/meshMatrixWorldsTextureLength, 0)) 8013 ); 8014 mat4 modelViewMat = viewMatrix * modelMat; 8015 vec4 viewCenter = modelViewMat * vec4(splatCenter, 1.0); 8016 vec4 clipCenter = projectionMatrix * viewCenter; 8017 8018 vec2 sampledCovarianceA = texture(covariancesTexture, getDataUV(3, 0, covariancesTextureSize)).rg; 8019 vec2 sampledCovarianceB = texture(covariancesTexture, getDataUV(3, 1, covariancesTextureSize)).rg; 8020 vec2 sampledCovarianceC = texture(covariancesTexture, getDataUV(3, 2, covariancesTextureSize)).rg; 8021 8022 vec3 cov3D_M11_M12_M13 = vec3(sampledCovarianceA.rg, sampledCovarianceB.r); 8023 vec3 cov3D_M22_M23_M33 = vec3(sampledCovarianceB.g, sampledCovarianceC.rg); 8024 8025 // Compute the 2D covariance matrix from the upper-right portion of the 3D covariance matrix 8026 mat3 Vrk = mat3( 8027 cov3D_M11_M12_M13.x, cov3D_M11_M12_M13.y, cov3D_M11_M12_M13.z, 8028 cov3D_M11_M12_M13.y, cov3D_M22_M23_M33.x, cov3D_M22_M23_M33.y, 8029 cov3D_M11_M12_M13.z, cov3D_M22_M23_M33.y, cov3D_M22_M23_M33.z 8030 ); 8031 float s = 1.0 / (viewCenter.z * viewCenter.z); 8032 8033 mat3 W = transpose(mat3(modelViewMat)); 8034 mat3 T = orthoZoom > 0.0 ? W : W * mat3( 8035 focal.x / viewCenter.z, 0., -(focal.x * viewCenter.x) * s, 8036 0., focal.y / viewCenter.z, -(focal.y * viewCenter.y) * s, 8037 0., 0., 0. 8038 ); 8039 mat3 cov2Dm = transpose(T) * Vrk * T; 8040 cov2Dm[0][0] += 0.3; 8041 cov2Dm[1][1] += 0.3; 8042 8043 // We are interested in the upper-left 2x2 portion of the projected 3D covariance matrix because 8044 // we only care about the X and Y values. We want the X-diagonal, cov2Dm[0][0], 8045 // the Y-diagonal, cov2Dm[1][1], and the correlation between the two cov2Dm[0][1]. We don't 8046 // need cov2Dm[1][0] because it is a symetric matrix. 8047 vec3 cov2Dv = vec3(cov2Dm[0][0], cov2Dm[0][1], cov2Dm[1][1]); 8048 8049 vec3 ndcCenter = clipCenter.xyz / clipCenter.w; 8050 8051 // We now need to solve for the eigen-values and eigen vectors of the 2D covariance matrix 8052 // so that we can determine the 2D basis for the splat. This is done using the method described 8053 // here: https://people.math.harvard.edu/~knill/teaching/math21b2004/exhibits/2dmatrices/index.html 8054 // 8055 // This is a different approach than in the original work at INRIA. In that work they compute the 8056 // max extents of the 2D covariance matrix in screen space to form an axis aligned boun
8056ding rectangle 8057 // which forms the geometry that is actually rasterized. They then use the inverse 2D covariance 8058 // matrix (called 'conic') to determine fragment opacity. 8059 float a = cov2Dv.x; 8060 float d = cov2Dv.z; 8061 float b = cov2Dv.y; 8062 float D = a * d - b * b; 8063 float trace = a + d; 8064 float traceOver2 = 0.5 * trace; 8065 float term2 = sqrt(trace * trace / 4.0 - D); 8066 float eigenValue1 = traceOver2 + term2; 8067 float eigenValue2 = max(traceOver2 - term2, 0.00); // prevent negative eigen value 8068 8069 const float maxSplatSize = 1024.0; 8070 vec2 eigenVector1 = normalize(vec2(b, eigenValue1 - a)); 8071 // since the eigen vectors are orthogonal, we derive the second one from the first 8072 vec2 eigenVector2 = vec2(eigenVector1.y, -eigenVector1.x); 8073 vec2 basisVector1 = eigenVector1 * min(sqrt(2.0 * eigenValue1), maxSplatSize); 8074 vec2 basisVector2 = eigenVector2 * min(sqrt(2.0 * eigenValue2), maxSplatSize); 8075 8076 vec2 ndcOffset = vec2(vPosition.x * basisVector1 + vPosition.y * basisVector2) * basisViewport; 8077 8078 if (orthoZoom > 0.0) { 8079 ndcOffset *= orthoZoom; 8080 } 8081 8082 gl_Position = vec4(ndcCenter.xy + ndcOffset, ndcCenter.z, 1.0); 8083 }`,i=` 8084 precision highp float; 8085 #include <common> 8086 8087 uniform vec3 debugColor; 8088 8089 varying vec4 vColor; 8090 varying vec2 vUv; 8091 8092 varying vec2 vPosition; 8093 layout(location = 1) out vec4 gVelocity; 8094 8095 void main () { 8096 // compute the negative squared distance from the center of the splat to the 8097 // current fragment in the splat's local space. 8098 float A = -dot(vPosition, vPosition); 8099 if (A < -4.0) discard; 8100 vec3 color = vColor.rgb; 8101 A = exp(A) * vColor.a; 8102 gl_FragColor = vec4(color.rgb, A); 8103 gVelocity = vec4(0.0); // so it is ignored by TAA 8104 }`,r={covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},meshIndexIntervals:{value:e},meshMatrixWorldsTexture:{type:"t",value:null},focal:{type:"v2",value:new H},viewport:{type:"v2",value:new H},basisViewport:{type:"v2",value:new H},debugColor:{type:"v3",value:new Je},covariancesTextureSize:{type:"v2",value:new H(1024,1024)},centersColorsTextureSize:{type:"v2",value:new H(1024,1024)},orthoZoom:{type:"f",value:-1}};return new Dt({uniforms:r,vertexShader:t,fragmentShader:i,transparent:!0,alphaTest:1,blending:Wo,depthTest:!0,depthWrite:!1,side:Ar})}static buildGeomtery(e){let t=new He;t.setIndex([0,1,2,0,2,3]);let i=new Float32Array(12),r=new tt(i,3);t.setAttribute("position",r),r.setXYZ(0,-1,-1,0),r.setXYZ(1,-1,1,0),r.setXYZ(2,1,1,0),r.setXYZ(3,1,-1,0),r.needsUpdate=!0;let s=new jM().copy(t),a=new Uint32Array(e),n=new pu(a,1,!1);return n.setUsage(w3),s.setAttribute("splatIndex",n),s.instanceCount=e,s}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach(r=>r.buildPreComputedBuffers()),this.covariances=new Float32Array(this.splatCount*6),this.colors=new Uint8Array(this.splatCount*4),this.centers=new Float32Array(this.splatCount*3);let e=0,t=0,i=0;for(let r of this.splatBuffers){let s=r.nsplats;this.colors.subarray(e,e+s*4).set(r.colorsA),e+=s*4,this.centers.subarray(t,t+s*3).set(r.decoded.xyz.denormDequant().data),t+=s*3,this.covariances.subarray(i,i+s*6).set(new Float32Array(r.precomputedCovarianceBufferData)),i+=s*6}}allocateAndStoreLocalSplatDataInTextures(){let e=this.splatCount,t=new H(4096,1024);for(;t.x*t.y*2<e*6;)t.y*=2;let i=new H(4096,1024);for(;i.x*i.y*4<e*4;)i.y*=2;let r,s;if(this.halfPrecisionCovariancesOnGPU){s=new Uint16Array(t.x*t.y*2);for(let c=0;c<this.covariances.length;c++)s[c]=JB.toHalfFloat(this.covariances[c]);r=new zr(s,t.x,t.y,Hp,dn)}else s=new Float32Array(t.x*t.y*2),s.set(this.covariances),r=new zr(s,t.x,t.y,Hp,Ht);r.needsUpdate=!0,this.material.uniforms.covariancesTexture.value=r,this.material.uniforms.covariancesTextureSize.value.copy(t);let a=new Uint32Array(i.x*i.y*4);for(let c=0;c<e;c++){let u=c*4,d=c*3,p=c*4;a[p]=LZ(this.colors[u],this.colors[u+1],this.colors[u+2],this.colors[u+3]),a[p+1]=xv(this.centers[d]),a[p+2]=xv(this.centers[d+1]),a[p+3]=xv(this.centers[d+2])}let n=new zr(a,i.x,i.y,sM,sn);n.internalFormat="RGBA32UI",n.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=n,this.material.uniforms.centersColorsTextureSize.value.copy(i);let o=256*4,l=new Float32Array(256*16);for(let c=0;c<this.meshMatrixWorlds.length;c++)l.set(this.meshMatrixWorlds[c].elements,c*16);let h=new zr(l,o,1,oi,Ht);h.needsUpdate=!0,this.material.uniforms.meshMatrixWorldsTexture.value=h,this.material.uniformsNeedUpdate=!0,this.splatDataTextures={covariances:{data:s,texture:r,size:t},centerColors:{data:a,texture:n,size:i},meshMatrixWorlds:{data:l,texture:h}}}updateIndexes(e){let t=this.geometry;t.attributes.splatIndex.set(e),t.attributes.splatIndex.needsUpdate=!0,t.instanceCount=e.length}updateUniforms(e,t,i,r){this.splatCount>0&&(vp.set(e.x*this.devicePixelRatio,e.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(vp),this.material.uniforms.basisViewport.value.set(2/vp.x,2/vp.y),this.material.uniforms.focal.value.set(t,i),this.material.uniforms.orthoZoom.value=r,this.material.uniformsNeedUpdate=!0)}getSplatDataTextures(){return this.splatDataTextures}getSplatCount(){return this.splatCount}getCenters(){return this.centers}getColors(){return this.colors}getCovariances(){return this.covariances}dispose(){this.geometry.dispose(),this.material.dispose(),this.splatDataTextures&&(this.splatDataTextures.covariances.texture.dispose(),this.splatDataTextures.centerColors.texture.dispose(),this.splatDataTextures.meshMatrixWorlds.texture.dispose()),this.removeFromParent()}},AP,zZ=new Promise(e=>{AP=e}),o2=!1,yp;function BZ(){if(o2)return;if(yp)return yp;async function e(){let t=await fo(()=>import("./gaussian-splat-compression-CH16aANn.js"),[]);AP(t),o2=!0}return yp=e(),yp}var MP;zZ.then(e=>MP=e);var FZ=class{constructor(e={}){Bc(this,"updateView",(function(){let t=new xe,i=[],r=new M(0,0,-1),s=new M(0,0,-1),a=new M,n=new M;return function(o=!1,l){let h=this.updateMatrixWorldsInWorkerIfNeeded(),c=this.cropsChanged();if(!o){s.set(0,0,-1).applyQuaternion(l.quaternion);let d=!1,p=!1;if(s.dot(r)<=.95&&(d=!0),n.copy(l.position).sub(a).length()>=1&&(p=!0),!d&&!p&&!h&&!c&&!this.needsInitialRender)return}this.needsInitialRender=!1,a.copy(l.position),r.copy(s),t.copy(l.matrixWorld).invert(),t.premultiply(this.dummyPerspectiveMatrix),i[0]=l.position.x,i[1]=l.position.y,i[2]=l.position.z;let u={sort:{view:t.elements,cameraPosition:i,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...h?{newMatrixWorlds:this.meshMatrixWorlds}:{},...c?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=u:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(u))}})()),this.scene=e.scene,this.currentPage=null,this.devicePixelRatio=window.devicePixelRatio,this.sortWorker=null,this.splatRenderCount=0,this.splatSortCount=0,this.splatMesh=null,this.sortRunning=!1,this.meshMatrixWorlds=null,this.meshMatrixWorldsOld=null,this.cropsArray=null,this.splatEntries=null,this.queuedMessage=null,this.needsInitialRender=!0,this.dummyPerspectiveMatrix=new xe().makePerspective(-1,1,-1,1,.1,1e3)}updateSplatMeshUniforms(e,t){let i=new H;this.splatMesh!==null&&this.splatMesh.getSplatCount()>0&&(e.getSize(i),this.cameraFocalLengthX=t.projectionMatrix.elements[0]*this.devicePixelRatio*i.x*.45,this.cameraFocalLengthY=t.projectionMatrix.elements[5]*this.devicePixelRatio*i.y*.45,this.splatMesh.updateUniforms(i,this.cameraFocalLengthX,this.cameraFocalLengthY,t.isPerspectiveCamera?-1:t.zoom*this.devicePixelRatio))}loadSplat(e={}){this.activePage=this.scene.activePage,e.position&&(e.position=new M().fromArray(e.position)),e.orientation&&(e.orientation=new nt().fromArray(e.orientation)),e.halfPrecisionCovariances=!!e.halfPrecisionCovariances;let t=[];if(this.splatEntries=t,this.activePage.traverseVisibleEntity(a=>{a.data.type==="Splat"&&t.push(a)}),this.splatMesh&&this.splatMesh.dispose(),t.length===0)return this.splatMesh=null,!1;this.meshMatrixWorlds=t.map(a=>a.matrixWorld),this.meshMatrixWorldsOld=t.map(a=>a.matrixWorld.clone()),this.cropsArray=t.map(a=>a.data.crops.map(n=>n.data));let i=t.map(a=>new MP.GSplineBuffer(new Uint8Array(a.data.buffer).buffer)),r=0,s=[0];for(let a of i)r+=a.getSplatCount(),s.push(r);return this.setupSplatMesh(i,r,e.position,e.orientation,e.halfPrecisionCovariances,this.devicePixelRatio,s,this.meshMatrixWorlds),this.setupSortWorker(r),!0}updateMatrixWorldsInWorkerIfNeeded(){let e=this.splatDataTextures.meshMatrixWorlds.data;for(let t=0;t<this.meshMatrixWorlds.length;t++)e.set(this.meshMatrixWorlds[t].elements,t*16);return this.splatDataTextures.meshMatrixWorlds.texture.needsUpdate=!0,this.meshMatrixWorlds.every((t,i)=>t.equals(this.meshMatrixWorldsOld[i]))?!1:(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map(t=>t.clone()),!0)}cropsChanged(){let e=!1;
vendor: 4,660 bytes, line 8104
8104return this.splatEntries.forEach((t,i)=>{t.data.crops.forEach((r,s)=>{this.cropsArray[i][s]===void 0?(e=!0,this.cropsArray[i][s]=r.data):Object.entries(r.data).forEach(([a,n])=>{Array.isArray(n)&&n.some((o,l)=>o!==this.cropsArray[i][s][a][l])?(e=!0,this.cropsArray[i][s][a]=n):n!==this.cropsArray[i][s]?.[a]&&(e=!0,this.cropsArray[i][s][a]=n)})}),t.data.crops.length!==this.cropsArray[i]?.length&&(this.cropsArray[i].length=t.data.crops.length,e=!0)}),e}setupSplatMesh(e,t,i=new M,r=new nt,s=!1,a=1,n,o){this.splatMesh=Up.buildMesh(e,t,s,a,n,o),this.splatMesh.position.copy(i),this.splatMesh.quaternion.copy(r),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=99999,this.splatRenderCount=t,this.splatMesh.onBeforeRender=(l,h,c)=>this.update(l,c)}setupSortWorker(e){this.sortWorker=RZ(e),this.sortWorker.onmessage=t=>{t.data.sortDone?(this.sortRunning=!1,this.splatMesh?.updateIndexes(new Uint32Array(t.data.indexesBuffer)),this.lastSortTime=t.data.sortTime,this.queuedMessage&&(this.sortWorker.postMessage(this.queuedMessage),this.queuedMessage=null)):t.data.sortCanceled?this.sortRunning=!1:t.data.sortSetupPhase1Complete?this.sortWorker.postMessage({positions:this.splatMesh.getCenters().buffer,meshMatrixWorlds:this.splatMesh.meshMatrixWorlds,meshIndexIntervals:this.splatMesh.meshIndexIntervals,cropsArray:this.cropsArray}):t.data.sortSetupComplete&&(this.splatDataTextures=this.splatMesh.getSplatDataTextures(),this.scene.activePage.add(this.splatMesh),this.needsInitialRender=!0)}}update(e,t){this.splatMesh!==null&&(this.updateSplatMeshUniforms(e,t),this.updateView(!1,t))}getSplatMesh(){return this.splatMesh}},Fy=new pn;Fy.wireframe=!0;var l2=new M,Lx=class extends Qr{constructor(e,t){super(),this.data=e,this.sharedAssets=t,this.enableHelpers=!1,this.wireframeState=!1,this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this._needsTransmission=!1,this._needsNormal=!1,this.geometryCacheChanged=!1,this.splatViewer=null,this.shapeBlendIntances=[],this.entityByUuid={},this.entityIdentityToEntity={},this.toExpandCloner=new Set,this.toUpdateCloner=new Set,this.pendingCommands=[],this.pathConstraints=new DZ,this.invisibleObjects=new xh("jflkdsafjasdifjaslk",{...U0.defaultData,visible:!1,name:"buildin invisible"}),this.needsRecomputeInstances=!1,this.init(e,t),this.matrixAutoUpdate=!1,this.errorPage=new er("fdasfa",{...Rh.defaultData,name:""},{shared:t,scene:this})}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=EZ(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._needsNormal=MZ(this),this.needsNormalDirty=!1),this._needsNormal}registerInstanceAndSetUuid(e){let t=e.identity.join("-"),i=this.entityIdentityToEntity[t];i&&(e.uuid=i.uuid),this.entityIdentityToEntity[t]=e,this.entityByUuid[e.uuid]=e}markPenumbraSizeDirty(){for(let e of this.children)e instanceof er&&(e.penumbraSizeArrayCache=null)}findInstance(e){return this.entityIdentityToEntity[e.join("-")]}get bgColor(){return this.activePage.bgColor}get postprocessing(){return this.activePage.data.postprocessing}getWithSortKey(e){let t=this.find(e);if(t===void 0)return;let i=[],r=t;for(;r!==this;){let s=r;r=r.parent;let a=r.children.indexOf(s);i.splice(0,0,a)}return{entity:t,sortKey:i}}getAllSorted(e){let t=[];for(let i of e){let r=this.getWithSortKey(i.id);r!==void 0&&t.push(r)}return t.sort((i,r)=>NE(i.sortKey,r.sortKey)),t.map(i=>i.entity)}nonExistOrDescendantOf(e,t){let i=this.find(e);if(i===void 0)return!0;for(;i;){if(i.uuid===t)return!0;i=i.parent}return!1}find(e){if(this.activePage&&this.activePage.personalCamera.parent){if(e==="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera")return this.activePage.personalCamera;if(e===Jh)return this.activePage.personalCamera}if(e===""||e===void 0)return;let t=this.entityByUuid[e];return t===void 0?this.getObjectByProperty("uuid",e):t}find2D(e){for(let t of this.children)if(t instanceof er&&t.uiScene){let i=t.uiScene.find(e);if(i)return i}}findScene2DfromObject2D(e){for(let t of this.children)if(t instanceof er&&t.uiScene&&t.uiScene.find(e))return t.uiScene}find2DInUIObjects(e){let t;return this.traverseEntity(i=>{t===void 0&&i instanceof _r&&(t=i.uiCanvas.find(e))}),t}traverse2D(e){for(let t of this.children)t instanceof er&&t.uiScene&&t.uiScene.traverse(e)}debugEnsureEntity(e){let t=this.find(e);if(t){if(Array.isArray(t.identity)&&this.findInstance(t.identity)===void 0){console.error("not found instance");debugger}}else{console.error("not found");debugger}}
vendor: 49,240 bytes, line 8104
8104addPendingExpandCloner(e){this.toExpandCloner.add(e)}addPendingUpdateCloner(e){this.toUpdateCloner.add(e)}markToExpandCloner(e){this.toExpandCloner.add(e),e.traverseEntityAncestors(t=>{this.toExpandCloner.add(t)})}doPendingExpandCloner(e){this.toExpandCloner.forEach(t=>{t.expandCloner(e)}),this.toExpandCloner.clear()}doPendingUpdateCloner(e){this.toUpdateCloner.forEach(t=>{t.cloner?.update(e)}),this.toUpdateCloner.clear()}doPendingUpdates(e){this.doPendingExpandCloner(e),this.doPendingUpdateCloner(e),this.applyPendingCommands()}addPendingCommand(e){this.pendingCommands.push(e)}applyPendingCommands(){this.pendingCommands.forEach(e=>e()),this.pendingCommands.length=0}updateByLibOp(e,t){e.path.length===1&&e.path[0]==="components"&&e.type===1&&this.createChildrenObjects([{...e.data.asset,id:e.id}],this.invisibleObjects,t)}updateTreeByOp(e,t){if(e.path.length===0&&e.type===7){let i=e.parent===null?this:this.find(e.parent);if(i===void 0)throw new Error("unexpected");let r=this.createObject(e.id,e.data,e.children,i,e.localIndex,t);r.updateVisible(this),r.resetBBoxNeedsUpdate(),fa(r)&&ln(r.parent)&&(r.invalidateUpstreamBooleanData(),r.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(i),this.markNeedsRecomputeInstancesForChildren(r),this.markToExpandCloner(r),this.markPenumbraSizeDirty(),r.updatePathSnapping()}else if(e.path.length===0&&e.type===8){let i=this.find(e.id);if(i===void 0)throw new Error("unexpected");i.traverseEntity(s=>{s instanceof nl&&(this.shapeBlendIntances=this.shapeBlendIntances.filter(a=>a!==s))}),this.markToExpandCloner(i),i.resetBBoxNeedsUpdate(),this.unregisterObject(i);let r=i.parent;this.markNeedsRecomputeInstancesForAncessors(r),this.markNeedsRecomputeInstancesForChildren(i),this.markPenumbraSizeDirty(),i.parent.remove(i),ln(i.parent)&&(i.parent.invalidateUpstreamBooleanData(),i.parent.invalidateDownstreamBooleanData().recomputeBoolean()),fa(i)&&(i.freeBooleanPointer(),r instanceof al&&r.invalidateDownstreamBooleanData().recomputeBoolean()),i instanceof Cm&&i.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(i),this.pathConstraints.removeDependencies(i.uuid),i.updatePathSnapping()}else if(e.path.length===0&&e.type===9){let i=this.find(e.id);if(i===void 0)throw new Error("unexpected");this.markNeedsRecomputeInstancesForChildren(i);let r=i.parent;this.markNeedsRecomputeInstancesForAncessors(r),i.cloner?.resetOnMove(),this.markToExpandCloner(i);let s=e.parent===null?this:this.find(e.parent);if(s===void 0)throw new Error("unexpected");s.add(i),this.markNeedsRecomputeInstancesForAncessors(s),this.markToExpandCloner(i),i.invalidateClonerTransform(i),i.updateVisible(this),i.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let a=e.localIndex;s.children.splice(a,0,s.children.pop()),fa(i)&&(i.invalidateUpstreamBooleanData(),ln(i.parent)?i.parent.invalidateDownstreamBooleanData().recomputeBoolean():r instanceof al&&r.invalidateDownstreamBooleanData().recomputeBoolean()),i.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(e){this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage;for(let t of this.children)t instanceof er&&(t.visible=t.uuid===e,t.visible&&(this.activePage=t,this.activePage.onActive(this)));this.activePage!==this.splatViewer?.activePage&&this.reloadSplats()}updateEntityByOp(e,t,i,r){if(t.type===0){if(("overrides"in t.props||"component"in t.props)&&this.markNeedsRecomputeInstances(),"visible"in t.props&&this.markPenumbraSizeDirty(),t.path.includes("overrides")&&"states"in t.props){let{rest:a}=t.props;t={...t,props:a},this.markNeedsRecomputeInstances()}t.path[0]==="pathSnapping"&&t.props.pathId!==void 0&&this.pathConstraints.setConstraint(e,t.props.pathId)}let s=this.find(e);if(s)try{vZ(s,t,i,{scene:this,shared:r}),s instanceof ai&&s.updateGeometryGroupsIfNeeded()}catch(a){console.error(a)}}updateEntity2DByOp(e,t,i,r,s,a=[]){e.updateEntityByOp(t,i,r,s),this.traverseEntity(n=>{(n instanceof _r||n instanceof er)&&(a.includes(n.frameId??"")||n.frameId===t)&&n.updateEntity2DByOp(t,i,r,s)})}get activeCamera(){return this.activePage.activeCamera}switchActiveCamera(e){this.activePage.switchActiveCamera(e)}isInvisibleObjects(e){return e===this.invisibleObjects||e.hasAnccestor(this.invisibleObjects)}init(e,t){let i=Object.entries(t.data.lib.components).map((r,s)=>({data:r[1].asset.data,children:r[1].asset.children,id:r[0],fi:s}));this.invisibleObjects.updateState(this.invisibleObjects.data,{scene:this,shared:t}),this.add(this.invisibleObjects),this.createChildrenObjects(i,this.invisibleObjects,t),this.createChildrenObjects(e.objects,this,t),this.updatePage(e.publish.playPage),this.activePage.switchToPlayCamera(),this.expandInstances(t,!0),this.traverseEntity(r=>{r instanceof qi&&r.updateUp()}),this.doPendingExpandCloner({scene:this,shared:t}),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(e){e.traverseEntity(t=>{(t.data.type==="Component"||t.data.type==="Instance")&&this.markNeedsRecomputeInstances()})}markNeedsRecomputeInstancesForAncessors(e){Tt.is(e)&&(e.data.type==="Component"&&this.markNeedsRecomputeInstances(),e.traverseAncestors(t=>{Tt.is(t)&&t.data.type==="Component"&&this.markNeedsRecomputeInstances()}))}relativeizeInner(e,t,i,r,s,a,n){if(e){let o=r.find(e);o&&o!==r&&s.forInstancesRec(l=>{l.data=_u(l.data,h=>{let c=h.events.data(n.id),u=l.goUp(a);if(u){let d=[...UE(u.identity),e].join("-"),p=this.entityIdentityToEntity[d];if(p){let f=p.uuid,m=Hi.zoom(c,t);m[i]=f}else console.warn("cannot find instance")}}).data})}}rewriteActions(e,t,i,r,s,a){e.forEach(n=>{n.data.type==="Transition"?this.relativeizeInner(n.data.object,[...t,n.id],"object",i,r,s,a):n.data.type==="Animation"?this.relativeizeInner(n.data.object,[...t,n.id],"object",i,r,s,a):n.data.type==="Conditional"&&(this.rewriteActions(n.data.ifActions,[...t,n.id,"ifActions"],i,r,s,a),this.rewriteActions(n.data.elseActions,[...t,n.id,"elseActions"],i,r,s,a))})}rewriteEventsBeforeGoToPlayMode(){this.traverseEntity(e=>{if(e instanceof bh&&typeof e.identity=="string"&&e.data.type==="Component")return e.traverseEntity((t,i)=>{t.data.events.forEach(r=>{if(r.data.type==="GameControl"){let s=!1;if(t.forInstancesRec(a=>{a.data=_u(a.data,n=>{a.isInstanceRoot||(n.events.delete(r.id),s=!0)}).data}),s===!1)for(let a of Tf.list)this.rewriteActions(r.data.gameActions[a],["gameActions",a],e,t,i,r)}else r.data.type==="Conditional"?(r.data.condition.type==="Distance"?(this.relativeizeInner(r.data.condition.fromObject,["condition"],"fromObject",e,t,i,r),this.relativeizeInner(r.data.condition.toObject,["condition"],"toObject",e,t,i,r)):r.data.condition.type==="State"?this.relativeizeInner(r.data.condition.object,["condition"],"object",e,t,i,r):r.data.condition.type==="Comparison"&&(r.data.condition.lOperand.type==="Property"&&this.relativeizeInner(r.data.condition.lOperand.value[0],["condition","lOperand","value"],0,e,t,i,r),r.data.condition.rOperand.type==="Property"&&this.relativeizeInner(r.data.condition.rOperand.value[0],["condition","rOperand","value"],0,e,t,i,r)),this.rewriteActions(r.data.inActions,["inActions"],e,t,i,r),this.rewriteActions(r.data.outActions,["outActions"],e,t,i,r)):"actions"in r.data&&this.rewriteActions(r.data.actions,["actions"],e,t,i,r)})}),!0})}expandInstances(e,t,i){let r=new Set;this.traverseEntity(s=>{if(s instanceof bh&&s.isInstanceRoot)return s.expandInstanceChildren({scene:this,shared:e,pendingDeletes:r}),t||s.resetBBoxNeedsUpdate(),i&&s.traverseEntity(a=>{i.addClip(a)}),!0});for(let s of r)this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(s),Ix(s)}recomputeInstances(e,t){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity(i=>{i instanceof bh&&i.isInstanceRoot&&(i.component=void 0)}),this.expandInstances(e,!1,t))}disposeAndUnregisterEntityRecursivelyIfNotReregistered(e){e.traverseEntity(t=>{let i=typeof t.identity=="string"?t.identity:t.identity.join("-");this.entityIdentityToEntity[i]===t&&(delete this.entityByUuid[t.uuid],delete this.entityIdentityToEntity[i]),t.dispose()})}clearScene(){for(let e of this.children)Tt.is(e)&&e.disposeRecursively();this.children.length=0}resetAfterClear(e,t){this.init(e,t)}raycast(e){return this.raycast1(e,!1)}raycast1(e,t){let i=[],r=s=>{for(let a of s.children){let n=a.cloner;if(Tt.is(a)&&!a.raycastLock&&(a.visible||n?.object.data.visible))if(t===!0&&a.isInstanceRoot){let o=[];if(e.intersectObject(a,!0,o),o.length){let l=o[0];l.object=a,l.point.applyMatrix4(l.object.matrixWorld);let h=a.matrixWorld.clone().invert();l.point.applyMatrix4(h),i.push(l)}}else(fa(a)||My(a)&&this.enableHelpers&&a.objectHelper.visible)&&(e.intersectObject(a,!1,i),By(a,e,i)),r(a)}};return r(this.activePage),i}raycastWithClones(e){let t=[],i=r=>{for(let s of r.children){let a=s.cloner;Tt.is(s)&&(s.visible||a?.object.data.visible)&&((fa(s)||My(s)&&this.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,t),By(s,e,t,!0)),i(s))}};return i(this),t}forEachEntity(e){for(let t of this.children)Tt.is(t)&&e(t)}traverseConcreteEntity(e){for(let t of this.children)Tt.is(t)&&t.isConcreteEntity&&t.traverseEntity(e)}traverseEntity(e){for(let t of this.children)Tt.is(t)&&t.traverseEntity(e)}updateFont(e,t){this.traverseEntity(i=>{if(i instanceof ai&&i.data.type==="Mesh"&&(i.data.geometry.type==="TextGeometry"||i.data.geometry.type==="InputGeometry")&&i.data.geometry.font===e){let r=i.geometry,s=i.data.geometry;r.updateFont(e,t).then(()=>{r.update(s,t);let a=i.invalidateDownstreamBooleanData();ln(a)&&a.recomputeBoolean()})}})}traverseObject(e){for(let t of this.children)rl.is(t)&&t.traverseObject(e)}traverseVisibleEntity(e){for(let t of this.children)Tt.is(t)&&t.visible&&t.traverseVisibleEntity(e)}dispose(){this.clearScene()}createChildrenObjects(e,t,i){let r=0;for(let s of e)this.createObject(s.id,s.data,s.children,t,r,i),r+=1}registerObjectCreatedInLegacy(e){this.entityByUuid[e.uuid]=e}unregisterObject(e){delete this.entityByUuid[e.uuid];for(let t of e.children)this.unregisterObject(t)}createObject(e,t,i,r,s,a){let n={scene:this,shared:a},o=Rx(e,t,n);return o instanceof nl&&this.shapeBlendIntances.push(o),o&&(this.entityByUuid[e]=o,r.add(o),r.children.splice(s,0,r.children.pop()),i.length>0&&(o.isInstanceRoot?console.error("instance should not have children!"):this.createChildrenObjects(i,o,a)),o.updateState(t,n),o instanceof ai&&o.updateGeometryGroupsIfNeeded(),o.updateVisible(this),o.cloner&&this.toExpandCloner.add(o),t.pathSnapping?.pathId&&this.pathConstraints.setConstraint(e,t.pathSnapping.pathId)),t.type==="Empty"&&t.animations&&o.traverseEntity(l=>{let h=l.dataPatched;if(l instanceof ai&&h.bones&&h.boneInverses){let c=h.bones.map(p=>this.find(p)),u=h.boneInverses.map(p=>new xe().fromArray(p)),d=new i1(c,u);l.bind(d,l.bindMatrix)}else l.matrixAutoUpdate=!0}),o}getCenter(e){let t=[];for(let r=0,s=e.length;r<s;++r){let{id:a,recursive:n}=e[r],o=this.find(a),l=n?o.recursiveBBox:o.singleBBox;t.push(...l.vertices)}let i=new yi;return i.setFromPoints(t),i.getCenter(l2),l2}copyMatrixWorld(e,t){if(e===null){t.identity();return}let i=this.find(e);i?t.copy(i.matrixWorld):t.identity()}copyParentMatrixWorld(e,t){if(e===null){t.identity();return}let i=this.find(e)?.parent;i?t.copy(i.matrixWorld):t.identity()}traverseMaterial(e){this.traverseEntity(t=>{if(t instanceof xr)if(Array.isArray(t.material))for(let i=0;i<t.material.length;i++)t.material[i]instanceof yn&&e(t.material[i]);else t.material instanceof yn&&e(t.material)})}updateViewPlaneSize(e,t,i=!1){this.traverseConcreteEntity(r=>{r instanceof qi&&r.setViewplaneSize(e,t,i)})}initializeSplatViewer(){this.splatViewer=new FZ({scene:this}),this.reloadSplats()}reloadSplats(){this.splatViewer?.loadSplat()}},Np=(e,t)=>{let i=t.x-e.x,r=t.y-e.y;return Math.sqrt(i*i+r*r)},kZ=(e,t)=>{let i=t.x-e.x,r=t.y-e.y;return NZ(Math.atan2(r,i))},UZ=(e,t,i)=>{let r={x:0,y:0};return i=ky(i),r.x=e.x-t*Math.cos(i),r.y=e.y-t*Math.sin(i),r},ky=e=>e*(Math.PI/180),NZ=e=>e*(180/Math.PI),VZ=e=>isNaN(e.buttons)?e.pressure!==0:e.buttons!==0,xp=new Map,jZ=e=>{xp.has(e)&&clearTimeout(xp.get(e)),xp.set(e,setTimeout(function(){xp.delete(e),e()},100))},Xf=(e,t,i)=>{let r=t.split(/[ ,]+/g),s;for(let a=0;a<r.length;a+=1)s=r[a],e.addEventListener?e.addEventListener(s,i,!1):e.attachEvent&&e.attachEvent(s,i)},Yf=(e,t,i)=>{let r=t.split(/[ ,]+/g),s;for(let a=0;a<r.length;a+=1)s=r[a],e.removeEventListener?e.removeEventListener(s,i):e.detachEvent&&e.detachEvent(s,i)},EP=e=>(e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e),h2=()=>{if(typeof window>"u")return;let e=window.pageXOffset!==void 0?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft,t=window.pageYOffset!==void 0?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop;return{x:e,y:t}},Uy=(e,t)=>{t.top||t.right||t.bottom||t.left?(e.style.top=t.top,e.style.right=t.right,e.style.bottom=t.bottom,e.style.left=t.left):(e.style.left=t.x+"px",e.style.top=t.y+"px")},zx=(e,t,i)=>{let r=CP(e);for(let s in r)if(r.hasOwnProperty(s))if(typeof t=="string")r[s]=t+" "+i;else{let a="";for(let n=0,o=t.length;n<o;n+=1)a+=t[n]+" "+i+", ";r[s]=a.slice(0,-2)}return r},HZ=(e,t)=>{let i=CP(e);for(let r in i)i.hasOwnProperty(r)&&(i[r]=t);return i},CP=e=>{let t={};return t[e]="",["webkit","Moz","o"].forEach(function(i){t[i+e.charAt(0).toUpperCase()+e.slice(1)]=""}),t},bv=(e,t)=>{for(let i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},GZ=(e,t)=>{let i={};for(let r in e)e.hasOwnProperty(r)&&t.hasOwnProperty(r)?i[r]=t[r]:e.hasOwnProperty(r)&&(i[r]=e[r]);return i},Ny=(e,t)=>{if(e.length)for(let i=0,r=e.length;i<r;i+=1)t(e[i]);else t(e)},WZ=(e,t,i)=>({x:Math.min(Math.max(e.x,t.x-i),t.x+i),y:Math.min(Math.max(e.y,t.y-i),t.y+i)});typeof window<"u"&&(TP="ontouchstart"in window,PP=!!window.PointerEvent,DP=!!window.MSPointerEvent);var TP,PP,DP,Cc={touch:{start:"touchstart",move:"touchmove",end:"touchend, touchcancel"},mouse:{start:"mousedown",move:"mousemove",end:"mouseup"},pointer:{start:"pointerdown",move:"pointermove",end:"pointerup, pointercancel"},MSPointer:{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}},oh,Ru={};PP?oh=Cc.pointer:DP?oh=Cc.MSPointer:TP?(oh=Cc.touch,Ru=Cc.mouse):oh=Cc.mouse;function dl(){}dl.prototype.on=function(e,t){var i=this,r=e.split(/[ ,]+/g),s;i._handlers_=i._handlers_||{};for(var a=0;a<r.length;a+=1)s=r[a],i._handlers_[s]=i._handlers_[s]||[],i._handlers_[s].push(t);return i};dl.prototype.off=function(e,t){var i=this;return i._handlers_=i._handlers_||{},e===void 0?i._handlers_={}:t===void 0?i._handlers_[e]=null:i._handlers_[e]&&i._handlers_[e].indexOf(t)>=0&&i._handlers_[e].splice(i._handlers_[e].indexOf(t),1),i};dl.prototype.trigger=function(e,t){var i=this,r=e.split(/[ ,]+/g),s;i._handlers_=i._handlers_||{};for(var a=0;a<r.length;a+=1)s=r[a],i._handlers_[s]&&i._handlers_[s].length&&i._handlers_[s].forEach(function(n){n.call(i,{type:s,target:i},t)})};dl.prototype.config=function(e){var t=this;t.options=t.defaults||{},e&&(t.options=GZ(t.options,e))};dl.prototype.bindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{},i._domHandlers_[t]=function(){typeof i["on"+t]=="function"?i["on"+t].apply(i,arguments):console.warn('[WARNING] : Missing "on'+t+'" handler.')},Xf(e,oh[t],i._domHandlers_[t]),Ru[t]&&Xf(e,Ru[t],i._domHandlers_[t]),i};dl.prototype.unbindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{},Yf(e,oh[t],i._domHandlers_[t]),Ru[t]&&Yf(e,Ru[t],i._domHandlers_[t]),delete i._domHandlers_[t],this};var Bx=dl;function Qi(e,t){return this.identifier=t.identifier,this.position=t.position,this.frontPosition=t.frontPosition,this.collection=e,this.defaults={size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,mode:"dynamic",zone:document.body,lockX:!1,lockY:!1,shape:"circle"},this.config(t),this.options.mode==="dynamic"&&(this.options.restOpacity=0),this.id=Qi.id,Qi.id+=1,this.buildEl().stylize(),this.instance={el:this.ui.el,on:this.on.bind(this),off:this.off.bind(this),show:this.show.bind(this),hide:this.hide.bind(this),add:this.addToDom.bind(this),remove:this.removeFromDom.bind(this),destroy:this.destroy.bind(this),setPosition:this.setPosition.bind(this),resetDirection:this.resetDirection.bind(this),computeDirection:this.computeDirection.bind(this),trigger:this.trigger.bind(this),position:this.position,frontPosition:this.frontPosition,ui:this.ui,identifier:this.identifier,id:this.id,options:this.options},this.instance}Qi.prototype=new Bx;Qi.constructor=Qi;Qi.id=0;Qi.prototype.buildEl=function(e){return this.ui={},this.options.dataOnly?this:(this.ui.el=document.createElement("div"),this.ui.back=document.createElement("div"),this.ui.front=document.createElement("div"),this.ui.el.className="nipple collection_"+this.collection.id,this.ui.back.className="back",this.ui.front.className="front",this.ui.el.setAttribute("id","nipple_"+this.collection.id+"_"+this.id),this.ui.el.appendChild(this.ui.back),this.ui.el.appendChild(this.ui.front),this)};Qi.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=HZ("borderRadius","50%"),i=zx("transition","opacity",e),r={};return r.el={position:"absolute",opacity:this.options.restOpacity,display:"block",zIndex:999},r.back={position:"absolute",display:"block",width:this.options.size+"px",height:this.options.size+"px",marginLeft:-this.options.size/2+"px",marginTop:-this.options.size/2+"px",background:"rgba(255, 255, 255, .4)",border:"solid 2px rgba(0, 0, 0, .1)"},r.front={width:this.options.size/2+"px",height:this.options.size/2+"px",position:"absolute",display:"block",marginLeft:-this.options.size/4+"px",marginTop:-this.options.size/4+"px",background:"rgba(255, 255, 255, .8)",border:"solid 2px rgba(0, 0, 0, .1)"},bv(r.el,i),this.options.shape==="circle"&&bv(r.back,t),bv(r.front,t),this.applyStyles(r),this};Qi.prototype.applyStyles=function(e){for(var t in this.ui)if(this.ui.hasOwnProperty(t))for(var i in e[t])this.ui[t].style[i]=e[t][i];return this};Qi.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)?this:(this.options.zone.appendChild(this.ui.el),this)};Qi.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)?this:(this.options.zone.removeChild(this.ui.el),this)};Qi.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off(),this.ui=null,this.instance=null,this.collection=null,this.options=null};Qi.prototype.show=function(e){var t=this;return t.options.dataOnly||(clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.addToDom(),t.restCallback(),setTimeout(function(){t.ui.el.style.opacity=1},0),t.showTimeout=setTimeout(function(){t.trigger("shown",t.instance),typeof e=="function"&&e.call(this)},t.options.fadeTime)),t};Qi.prototype.hide=function(e){var t=this;if(t.options.dataOnly)return t;if(t.ui.el.style.opacity=t.options.restOpacity,clearTimeout(t.removeTimeout),clearTimeout(t.showTimeout),clearTimeout(t.restTimeout),t.removeTimeout=setTimeout(function(){var i=t.options.mode==="dynamic"?"none":"block";t.ui.el.style.display=i,typeof e=="function"&&e.call(t),t.trigger("hidden",t.instance)},t.options.fadeTime),t.options.restJoystick){let i=t.options.restJoystick,r={};r.x=i===!0||i.x!==!1?0:t.instance.frontPosition.x,r.y=i===!0||i.y!==!1?0:t.instance.frontPosition.y,t.setPosition(e,r)}return t};Qi.prototype.setPosition=function(e,t){var i=this;i.frontPosition={x:t.x,y:t.y};var r=i.options.fadeTime+"ms",s={};s.front=zx("transition",["top","left"],r);var a={front:{}};a.front={left:i.frontPosition.x+"px",top:i.frontPosition.y+"px"},i.applyStyles(s),i.applyStyles(a),i.restTimeout=setTimeout(function(){typeof e=="function"&&e.call(i),i.restCallback()},i.options.fadeTime)};Qi.prototype.restCallback=function(){var e=this,t={};t.front=zx("transition","none",""),e.applyStyles(t),e.trigger("rested",e.instance)};Qi.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}};Qi.prototype.computeDirection=function(e){var t=e.angle.radian,i=Math.PI/4,r=Math.PI/2,s,a,n;if(t>i&&t<i*3&&!e.lockX?s="up":t>-i&&t<=i&&!e.lockY?s="left":t>-i*3&&t<=-i&&!e.lockX?s="down":e.lockY||(s="right"),e.lockY||(t>-r&&t<r?a="left":a="right"),e.lockX||(t>0?n="up":n="down"),e.force>this.options.threshold){var o={},l;for(l in this.direction)this.direction.hasOwnProperty(l)&&(o[l]=this.direction[l]);var h={};this.direction={x:a,y:n,angle:s},e.direction=this.direction;for(l in o)o[l]===this.direction[l]&&(h[l]=!0);if(h.x&&h.y&&h.angle)return e;(!h.x||!h.y)&&this.trigger("plain",e),h.x||this.trigger("plain:"+a,e),h.y||this.trigger("plain:"+n,e),h.angle||this.trigger("dir dir:"+s,e)}else this.resetDirection();return e};var qZ=Qi;function Mi(e,t){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=e,i.id=Mi.id,Mi.id+=1,i.defaults={zone:document.body,multitouch:!1,maxNumberOfNipples:10,mode:"dynamic",position:{top:0,left:0},catchDistance:200,size:100,threshold:.1,color:"white",fadeTime:250,dataOnly:!1,restJoystick:!0,restOpacity:1,lockX:!1,lockY:!1,shape:"circle",dynamicPage:!1,follow:!1},i.config(t),(i.options.mode==="static"||i.options.mode==="semi")&&(i.options.multitouch=!1),i.options.multitouch||(i.options.maxNumberOfNipples=1);let r=getComputedStyle(i.options.zone.parentElement);return r&&r.display==="flex"&&(i.parentIsFlex=!0),i.updateBox(),i.prepareNipples(),i.bindings(),i.begin(),i.nipples}Mi.prototype=new Bx;Mi.constructor=Mi;Mi.id=0;Mi.prototype.prepareNipples=function(){var e=this,t=e.nipples;t.on=e.on.bind(e),t.off=e.off.bind(e),t.options=e.options,t.destroy=e.destroy.bind(e),t.ids=e.ids,t.id=e.id,t.processOnMove=e.processOnMove.bind(e),t.processOnEnd=e.processOnEnd.bind(e),t.get=function(i){if(i===void 0)return t[0];for(var r=0,s=t.length;r<s;r+=1)if(t[r].identifier===i)return t[r];return!1}};Mi.prototype.bindings=function(){var e=this;e.bindEvt(e.options.zone,"start"),e.options.zone.style.touchAction="none",e.options.zone.style.msTouchAction="none"};Mi.prototype.begin=function(){var e=this,t=e.options;if(t.mode==="static"){var i=e.createNipple(t.position,e.manager.getIdentifier());i.add(),e.idles.push(i)}};Mi.prototype.createNipple=function(e,t){var i=this,r=i.manager.scroll,s={},a=i.options,n={x:i.parentIsFlex?r.x:r.x+i.box.left,y:i.parentIsFlex?r.y:r.y+i.box.top};if(e.x&&e.y)s={x:e.x-n.x,y:e.y-n.y};else if(e.top||e.right||e.bottom||e.left){var o=document.createElement("DIV");o.style.display="hidden",o.style.top=e.top,o.style.right=e.right,o.style.bottom=e.bottom,o.style.left=e.left,o.style.position="absolute",a.zone.appendChild(o);var l=o.getBoundingClientRect();a.zone.removeChild(o),s=e,e={x:l.left+r.x,y:l.top+r.y}}var h=new qZ(i,{color:a.color,size:a.size,threshold:a.threshold,fadeTime:a.fadeTime,dataOnly:a.dataOnly,restJoystick:a.restJoystick,restOpacity:a.restOpacity,mode:a.mode,identifier:t,position:e,zone:a.zone,frontPosition:{x:0,y:0},shape:a.shape});return a.dataOnly||(Uy(h.ui.el,s),Uy(h.ui.front,h.frontPosition)),i.nipples.push(h),i.trigger("added "+h.identifier+":added",h),i.manager.trigger("added "+h.identifier+":added",h),i.bindNipple(h),h};Mi.prototype.updateBox=function(){var e=this;e.box=e.options.zone.getBoundingClientRect()};Mi.prototype.bindNipple=function(e){var t=this,i,r=function(s,a){i=s.type+" "+a.id+":"+s.type,t.trigger(i,a)};e.on("destroyed",t.onDestroyed.bind(t)),e.on("shown hidden rested dir plain",r),e.on("dir:up dir:right dir:down dir:left",r),e.on("plain:up plain:right plain:down plain:left",r)};Mi.prototype.pressureFn=function(e,t,i){var r=this,s=0;clearInterval(r.pressureIntervals[i]),r.pressureIntervals[i]=setInterval((function(){var a=e.force||e.pressure||e.webkitForce||0;a!==s&&(t.trigger("pressure",a),r.trigger("pressure "+t.identifier+":pressure",a),s=a)}).bind(r),100)};Mi.prototype.onstart=function(e){var t=this,i=t.options,r=e;e=EP(e),t.updateBox();var s=function(a){t.actives.length<i.maxNumberOfNipples?t.processOnStart(a):r.type.match(/^touch/)&&(Object.keys(t.manager.ids).forEach(function(n){if(Object.values(r.touches).findIndex(function(l){return l.identifier===n})<0){var o=[e[0]];o.identifier=n,t.processOnEnd(o)}}),t.actives.length<i.maxNumberOfNipples&&t.processOnStart(a))};return Ny(e,s),t.manager.bindDocument(),!1};Mi.prototype.processOnStart=function(e){var t=this,i=t.options,r,s=t.manager.getIdentifier(e),a=e.force||e.pressure||e.webkitForce||0,n={x:e.pageX,y:e.pageY},o=t.getOrCreate(s,n);o.identifier!==s&&t.manager.removeIdentifier(o.identifier),o.identifier=s;var l=function(c){c.trigger("start",c),t.trigger("start "+c.id+":start",c),c.show(),a>0&&t.pressureFn(e,c,c.identifier),t.processOnMove(e)};if((r=t.idles.indexOf(o))>=0&&t.idles.splice(r,1),t.actives.push(o),t.ids.push(o.identifier),i.mode!=="semi")l(o);else{var h=Np(n,o.position);if(h<=i.catchDistance)l(o);else{o.destroy(),t.processOnStart(e);return}}return o};Mi.prototype.getOrCreate=function(e,t){var i=this,r=i.options,s;return/(semi|static)/.test(r.mode)?(s=i.idles[0],s?(i.idles.splice(0,1),s):r.mode==="semi"?i.createNipple(t,e):(console.warn("Coudln't find the needed nipple."),!1)):(s=i.createNipple(t,e),s)};Mi.prototype.processOnMove=function(e){var t=this,i=t.options,r=t.manager.getIdentifier(e),s=t.nipples.get(r),a=t.manager.scroll;if(!VZ(e)){this.processOnEnd(e);return}if(!s){console.error("Found zombie joystick with ID "+r),t.manager.removeIdentifier(r);return}if(i.dynamicPage){var n=s.el.getBoundingClientRect();s.position={x:a.x+n.left,y:a.y+n.top}}s.identifier=r;var o=s.options.size/2,l={x:e.pageX,y:e.pageY};i.lockX&&(l.y=s.position.y),i.lockY&&(l.x=s.position.x);var h=Np(l,s.position),c=kZ(l,s.position),u=ky(c),d=h/o,p={distance:h,position:l},f,m;if(s.options.shape==="circle"?(f=Math.min(h,o),m=UZ(s.position,f,c)):(m=WZ(l,s.position,o),f=Np(m,s.position)),i.follow){if(h>o){let x=l.x-m.x,w=l.y-m.y;s.position.x+=x,s.position.y+=w,s.el.style.top=s.position.y-(t.box.top+a.y)+"px",s.el.style.left=s.position.x-(t.box.left+a.x)+"px",h=Np(l,s.position)}}else l=m,h=f;var g=l.x-s.position.x,v=l.y-s.position.y;s.frontPosition={x:g,y:v},i.dataOnly||Uy(s.ui.front,s.frontPosition);var y={identifier:s.identifier,position:l,force:d,pressure:e.force||e.pressure||e.webkitForce||0,distance:h,angle:{radian:u,degree:c},vector:{x:g/o,y:-v/o},raw:p,instance:s,lockX:i.lockX,lockY:i.lockY};y=s.computeDirection(y),y.angle={radian:ky(180-c),degree:180-c},s.trigger("move",y),t.trigger("move "+s.id+":move",y)};Mi.prototype.processOnEnd=function(e){var t=this,i=t.options,r=t.manager.getIdentifier(e),s=t.nipples.get(r),a=t.manager.removeIdentifier(s.identifier);!s||(i.dataOnly||s.hide(function(){i.mode==="dynamic"&&(s.trigger("removed",s),t.trigger("removed "+s.id+":removed",s),t.manager.trigger("removed "+s.id+":removed",s),s.destroy())}),clearInterval(t.pressureIntervals[s.identifier]),s.resetDirection(),s.trigger("end",s),t.trigger("end "+s.id+":end",s),t.ids.indexOf(s.identifier)>=0&&t.ids.splice(t.ids.indexOf(s.identifier),1),t.actives.indexOf(s)>=0&&t.actives.splice(t.actives.indexOf(s),1),/(semi|static)/.test(i.mode)?t.idles.push(s):t.nipples.indexOf(s)>=0&&t.nipples.splice(t.nipples.indexOf(s),1),t.manager.unbindDocument(),/(semi|static)/.test(i.mode)&&(t.manager.ids[a.id]=a.identifier))};Mi.prototype.onDestroyed=function(e,t){var i=this;i.nipples.indexOf(t)>=0&&i.nipples.splice(i.nipples.indexOf(t),1),i.actives.indexOf(t)>=0&&i.actives.splice(i.actives.indexOf(t),1),i.idles.indexOf(t)>=0&&i.idles.splice(i.idles.indexOf(t),1),i.ids.indexOf(t.identifier)>=0&&i.ids.splice(i.ids.indexOf(t.identifier),1),i.manager.removeIdentifier(t.identifier),i.manager.unbindDocument()};Mi.prototype.destroy=function(){var e=this;e.unbindEvt(e.options.zone,"start"),e.nipples.forEach(function(i){i.destroy()});for(var t in e.pressureIntervals)e.pressureIntervals.hasOwnProperty(t)&&clearInterval(e.pressureIntervals[t]);e.trigger("destroyed",e.nipples),e.manager.unbindDocument(),e.off(),e.pressureIntervals={},e.nipples=[],e.idles=[],e.actives=[],e.ids=[],e.manager=null};var XZ=Mi;function zi(e){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=h2(),t._windowBound=!1,t.config(e),t.prepareCollections();var i=function(){var r;t.collections.forEach(function(s){s.forEach(function(a){r=a.el.getBoundingClientRect(),a.position={x:t.scroll.x+r.left,y:t.scroll.y+r.top}})})};return t._onResize=function(){jZ(i)},t._onScroll=function(){t.scroll=h2()},t.collections}zi.prototype=new Bx;zi.constructor=zi;zi.prototype.prepareCollections=function(){var e=this;e.collections.create=e.create.bind(e),e.collections.on=e.on.bind(e),e.collections.off=e.off.bind(e),e.collections.destroy=e.destroy.bind(e),e.collections.get=function(t){var i;return e.collections.every(function(r){return i=r.get(t),!i}),i}};zi.prototype.create=function(e){return this.createCollection(e)};zi.prototype.bindWindowEvents=function(){var e=this;e._windowBound||typeof window>"u"||(e._windowBound=!0,Xf(window,"resize",e._onResize),Xf(window,"scroll",e._onScroll))};zi.prototype.unbindWindowEvents=function(){var e=this;!e._windowBound||typeof window>"u"||(e._windowBound=!1,Yf(window,"resize",e._onResize),Yf(window,"scroll",e._onScroll))};zi.prototype.createCollection=function(e){var t=this,i=new XZ(t,e);return t.bindCollection(i),t.collections.push(i),t.bindWindowEvents(),i};zi.prototype.bindCollection=function(e){var t=this,i,r=function(s,a){i=s.type+" "+a.id+":"+s.type,t.trigger(i,a)};e.on("destroyed",t.onDestroyed.bind(t)),e.on("shown hidden rested dir plain",r),e.on("dir:up dir:right dir:down dir:left",r),e.on("plain:up plain:right plain:down plain:left",r)};zi.prototype.bindDocument=function(){var e=this;e.binded||(e.bindEvt(document,"move").bindEvt(document,"end"),e.binded=!0)};zi.prototype.unbindDocument=function(e){var t=this;(!Object.keys(t.ids).length||e===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)};zi.prototype.getIdentifier=function(e){var t;return e?(t=e.identifier===void 0?e.pointerId:e.identifier,t===void 0&&(t=this.latest||0)):t=this.index,this.ids[t]===void 0&&(this.ids[t]=this.index,this.index+=1),this.latest=t,this.ids[t]};zi.prototype.removeIdentifier=function(e){var t={};for(var i in this.ids)if(this.ids[i]===e){t.id=i,t.identifier=this.ids[i],delete this.ids[i];break}return t};zi.prototype.onmove=function(e){var t=this;return t.onAny("move",e),!1};zi.prototype.onend=function(e){var t=this;return t.onAny("end",e),!1};zi.prototype.oncancel=function(e){var t=this;return t.onAny("end",e),!1};zi.prototype.onAny=function(e,t){var i=this,r,s="processOn"+e.charAt(0).toUpperCase()+e.slice(1);t=EP(t);var a=function(o,l,h){h.ids.indexOf(l)>=0&&(h[s](o),o._found_=!0)},n=function(o){r=i.getIdentifier(o),Ny(i.collections,a.bind(null,o,r)),o._found_||i.removeIdentifier(r)};return Ny(t,n),!1};zi.prototype.destroy=function(){var e=this;e.unbindDocument(!0),e.unbindWindowEvents(),e.ids={},e.index=0,e.collections.forEach(function(t){t.destroy()}),e.collections=[],e.off()};zi.prototype.onDestroyed=function(e,t){var i=this;if(i.collections.indexOf(t)<0)return!1;i.collections.splice(i.collections.indexOf(t),1),i.collections.length===0&&i.unbindWindowEvents()};var YZ=zi,wh=null;function c2(){return wh||(wh=new YZ),wh}var QZ={create:function(e){return c2().create(e)},destroy:function(){wh&&(wh.destroy(),wh=null)},get factory(){return c2()}},KZ=QZ,OP=new Map,lu=new Map,Ho=class{constructor(e,t,i,r){this.data=t;let{audio:s,volume:a,delay:n,loop:o}=t;if(!s)throw new Error("Missing property");try{let l=typeof s=="string"?r.getAudio(s).src:s.data;this.audioPlayer=new qc({src:l,volume:a,delay:n,loop:o})}catch{console.warn(`Could not create an audio player for this object: "${i.name}" and this audio: "${s}"`)}lu.has(i.uuid)?lu.get(i.uuid).push(this):lu.set(i.uuid,[this]),OP.set(e,this)}playByToggle(){this.data.toggle==="stop"?this.audioPlayer?.status==="playing"?this.audioPlayer.stop():(this.audioPlayer?.stop(),this.audioPlayer?.play()):this.data.toggle==="pause"?this.audioPlayer?.status==="playing"?this.audioPlayer?.pause():this.audioPlayer?.play():(this.audioPlayer?.stop(),this.audioPlayer?.play())}dispose(){this.audioPlayer?.stop()}},Vy=class{constructor(e){this.data=e}dispatch(){this.data.playAudio?this.pauseAudio(this.data.playAudio):this.data.object?this.pauseAllAudiosFromObject(this.data.object):this.pauseAllAudios()}pauseAudio(e){let t=OP.get(e);!t||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.audioPlayer?.[this.data.interaction](),this.disposeDelay()},this.data.delay)):t.audioPlayer?.[this.data.interaction]())}pauseAllAudiosFromObject(e){let t=lu.get(e);!t?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(i=>i.audioPlayer?.[this.data.interaction]()),this.disposeDelay()},this.data.delay)):t.forEach(i=>i.audioPlayer?.[this.data.interaction]()))}pauseAllAudios(){let e=[...lu.values()];!e.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(t=>{t.forEach(i=>{i.audioPlayer?.[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):e.forEach(t=>{t.forEach(i=>{i.audioPlayer?.[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},IP=class{constructor(e,t,i,r,s){if(this.data=t,this.shared=r,this.condition=s,t.interaction==="play")this.interaction=new Ho(e,t,i,r);else if(t.interaction==="pause"||t.interaction==="stop")this.interaction=new Vy(t);else throw new Error("Missing property")}dispatchBasic(){if(ii(this.shared,this.condition)===!1)return!1;this.interaction instanceof Ho?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(ii(this.shared,this.condition)===!1)return!1;this.interaction instanceof Ho?this.interaction.audioPlayer?.play():this.interaction.dispatch()}dispatchGameControl(e){if(ii(this.shared,this.condition)===!1)return!1;this.interaction instanceof Ho&&(e==="start"?this.interaction.audioPlayer?.play():this.interaction.audioPlayer?.stop())}dispose(){this.interaction.dispose()}},RP=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r,this.delay=0,this.emission=e.emission,e.delay!==void 0&&(this.delay=e.delay),this.particleSystem=this.page.scene.find(this.data.emitterObjectId)}toggleEmitting(){this.particleSystem.started&&!this.particleSystem.stopped?this.stop(this.delay):this.start(this.delay)}toggleFroze(){this.particleSystem.started&&!this.particleSystem.isFrozen?this.freeze(this.delay):this.unFreeze(this.delay)}start(e=0){if(e){this.delayTimerId=window.setTimeout(()=>{this.start(0),this.clearDelay()},e);return}this.particleSystem.start()}stop(e=0){if(e){this.delayTimerId=window.setTimeout(()=>{this.stop(0),this.clearDelay()},e);return}this.particleSystem.stop()}freeze(e=0){if(e){this.delayTimerId=window.setTimeout(()=>{this.freeze(0),this.clearDelay()},e);return}this.particleSystem.froze()}unFreeze(e=0){if(e){this.delayTimerId=window.setTimeout(()=>{this.unFreeze(0),this.clearDelay()},e);return}this.particleSystem.unFroze()}reset(e=0){if(e){this.delayTimerId=window.setTimeout(()=>{this.reset(0),this.clearDelay()},e);return}this.particleSystem.reset()}reverseFromCurrent(){switch(this.emission){case"emitToggle":this.toggleEmitting();break;case"pauseToggle":this.toggleFroze();break}}dispatchBasic(){if(ii(this.shared,this.condition)===!1||!this.particleSystem)return!1;switch(this.emission){case"start":this.start(this.delay);break;case"emitToggle":this.toggleEmitting();break;case"pause":this.freeze(this.delay);break;case"pauseToggle":this.toggleFroze();break;case"stop":this.stop(this.delay);break;case"reset":this.reset(this.delay);break}}dispatchConditional(){if(ii(this.shared,this.condition)===!1||!this.particleSystem)return!1;switch(this.emission){case"start":this.start(this.delay);break;case"stop":this.stop(this.delay);break;case"reset":this.reset(this.delay);break}}dispatchGameControl(e){if(ii(this.shared,this.condition)===!1||!this.particleSystem)return!1;e==="start"?this.start(this.delay):this.stop(this.delay)}dispose(){!this.particleSystem||(this.particleSystem.reset(),this.clearDelay())}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}},ZZ="text/plain",JZ="us-ascii",u2=(e,t)=>t.some(i=>i instanceof RegExp?i.test(e):i===e),$Z=(e,{stripHash:t})=>{let i=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(e);if(!i)throw new Error(`Invalid URL: ${e}`);let{type:r,data:s,hash:a}=i.groups,n=r.split(";");a=t?"":a;let o=!1;n[n.length-1]==="base64"&&(n.pop(),o=!0);let l=(n.shift()||"").toLowerCase(),h=[...n.map(c=>{let[u,d=""]=c.split("=").map(p=>p.trim());return u==="charset"&&(d=d.toLowerCase(),d===JZ)?"":`${u}${d?`=${d}`:""}`}).filter(Boolean)];return o&&h.push("base64"),(h.length>0||l&&l!==ZZ)&&h.unshift(l),`data:${h.join(";")},${o?s.trim():s}${a?`#${a}`:""}`};function eJ(e,t){if(t={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...t},e=e.trim(),/^data:/i.test(e))return $Z(e,t);if(/^view-source:/i.test(e))throw new Error("`view-source:` is not supported as it is a non-standard protocol");let i=e.startsWith("//");!i&&/^\.*\//.test(e)||(e=e.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,t.defaultProtocol));let r=new URL(e);if(t.forceHttp&&t.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(t.forceHttp&&r.protocol==="https:"&&(r.protocol="http:"),t.forceHttps&&r.protocol==="http:"&&(r.protocol="https:"),t.stripAuthentication&&(r.username="",r.password=""),t.stripHash?r.hash="":t.stripTextFragment&&(r.hash=r.hash.replace(/#?:~:text.*?$/i,"")),r.pathname){let a=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,n=0,o="";for(;;){let h=a.exec(r.pathname);if(!h)break;let c=h[0],u=h.index,d=r.pathname.slice(n,u);o+=d.replace(/\/{2,}/g,"/"),o+=c,n=u+c.length}let l=r.pathname.slice(n,r.pathname.length);o+=l.replace(/\/{2,}/g,"/"),r.pathname=o}if(r.pathname)try{r.pathname=decodeURI(r.pathname)}catch{}if(t.removeDirectoryIndex===!0&&(t.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(t.removeDirectoryIndex)&&t.removeDirectoryIndex.length>0){let a=r.pathname.split("/"),n=a[a.length-1];u2(n,t.removeDirectoryIndex)&&(a=a.slice(0,-1),r.pathname=a.slice(1).join("/")+"/")}if(r.hostname&&(r.hostname=r.hostname.replace(/\.$/,""),t.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(r.hostname)&&(r.hostname=r.hostname.replace(/^www\./,""))),Array.isArray(t.removeQueryParameters))for(let a of[...r.searchParams.keys()])u2(a,t.removeQueryParameters)&&r.searchParams.delete(a);if(t.removeQueryParameters===!0&&(r.search=""),t.sortQueryParameters){r.searchParams.sort();try{r.search=decodeURIComponent(r.search)}catch{}}t.removeTrailingSlash&&(r.pathname=r.pathname.replace(/\/$/,""));let s=e;return e=r.toString(),!t.removeSingleSlash&&r.pathname==="/"&&!s.endsWith("/")&&r.hash===""&&(e=e.replace(/\/$/,"")),(t.removeTrailingSlash||r.pathname==="/")&&r.hash===""&&t.removeSingleSlash&&(e=e.replace(/\/$/,"")),i&&!t.normalizeProtocol&&(e=e.replace(/^http:\/\//,"//")),t.stripProtocol&&(e=e.replace(/^(?:https?:)?\/\//,"")),e}var tJ=class{constructor({url:e,context:t},i,r,s){if(this.controlsManager=i,this.shared=r,this.condition=s,!e)throw new Error("Missing property");this.url=e.startsWith("mailto:")?e:eJ(e,{removeTrailingSlash:!1,removeSingleSlash:!1,stripWWW:!1}),this.context=t??"tab"}dispatch(){if(ii(this.shared,this.condition)===!1)return!1;Kh?window.location.assign(this.url):(this.context==="tab"||kE&&this.context==="none"?window.open(this.url,"_blank"):this.context==="window"?window.open(this.url,"_blank",`width=${window.innerWidth}, height=${window.innerHeight}`):window.open(this.url,"_parent"),this.controlsManager.orbitControls?.onPointerUp(at[0]),hH())}},LP=class{constructor(e,t,i,r,s){this.data=e,this.page=t,this.controlsManager=i,this.shared=r,this.condition=s,this.timeoutIdQueue=[],this.dispatchInner=()=>{this.objects.forEach(this.destroyCallback)},this.destroyCallback=a=>{this.timeoutIdQueue.shift();let n=this.page.scene.find(a);if(n===void 0)return;let o=this.controlsManager.sharedGameControlGlobals.rapierWorld,l=o?n.dataPatched.physics?.fusedBody:!0;if(n.cloner){for(let h of n.cloner.children)l?(h.playModeVisible=!1,h.rigidBody&&n.dataPatched.physics?.rigidBody==="positioned"&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(h.rigidBody.collider(0).handle),o.removeRigidBody(h.rigidBody),h.rigidBody=void 0),h.bvhGeometry&&(h.bvhGeometry=void 0)):this.clone===void 0||this.clone===h?(h.playModeVisible=!1,h.rigidBody&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(h.rigidBody.collider(0).handle),o.removeRigidBody(h.rigidBody),h.rigidBody=void 0)):h.playModeVisible===void 0&&(h.playModeVisible=!0);(l||this.clone===void 0||this.clone===!1)&&(n.visible=!1,n.rigidBody&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(n.rigidBody.collider(0).handle),o.removeRigidBody(n.rigidBody),n.rigidBody=void 0),n.bvhGeometry&&(n.bvhGeometry=void 0))}else n.rigidBody&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(n.rigidBody.collider(0).handle),o.removeRigidBody(n.rigidBody),n.rigidBody=void 0),n.bvhGeometry&&(n.bvhGeometry=void 0),n.visible=!1;o===void 0?this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(h=>h.bvhGeometry!==void 0):this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(h=>h.rigidBody!==void 0),n.destroyedInAction=!0,this.controlsManager.requestRender()},this.objects=[...e.objects]}dispatch(e){if(ii(this.shared,this.condition)===!1)return!1;this.clone=e,this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,this.data.delay*1e3)):this.dispatchInner()}dispatchFromStart(){if(ii(this.shared,this.condition)===!1)return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,this.data.delay*1e3))}dispose(){this.timeoutIdQueue.forEach(e=>window.clearTimeout(e))}},zP=class{constructor(e,t,i,r,s){this.data=e,this.page=t,this.shared=i,this.eventManager=r,this.condition=s,this.shared=i}dispatch(){if(ii(this.shared,this.condition)===!1)return!1;clearTimeout(this.timeoutId),delete this.timeoutId,this.timeoutId=window.setTimeout(()=>{this.shared.reset(this.shared.data,!0),Fx(this.page,this.shared,!0),this.eventManager.reset(),this.eventManager.controlsManager.gameControl?.reset(!0),this.page.switchToPlayCamera(),this.eventManager.controlsManager.requestRender(),delete this.timeoutId},(this.data.delay??0)*1e3)}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}};function iJ(e,t,i,r){let s=[],a=e.cameraType==="OrthographicCamera"?t.orthographic?.zoom:t.perspective?.zoom,n=e.cameraType==="OrthographicCamera"?i.orthographic?.zoom:i.perspective?.zoom;if(n!==void 0){let o=a??e.zoom,l=n;o!==l&&s.push({update:h=>{e.zoom=Te.lerp(o,l,h),e.updateProjectionMatrix()},start:()=>{e.zoom=o,e.updateProjectionMatrix()},end:()=>{e.zoom=l,e.updateProjectionMatrix()}})}if(i.targetOffset!==void 0){let o=pr("targetOffset",e,t,i,r);o&&s.push(o)}return s}function rJ(e,t,i,r){if(i.scaleBaked===void 0)return;let s=(t.scaleBaked??e.data.geometry.scaleBaked).map(o=>typeof o=="string"?Number(r.shared.getVariable(o)??0):o),a=i.scaleBaked.map(o=>typeof o=="string"?Number(r.shared.getVariable(o)??0):o);if(ao.isEqual(s,a))return;let n=[];return n.push({update:o=>{e.updateGeometryInteractions({scaleBaked:[Te.lerp(s[0],a[0],o),Te.lerp(s[1],a[1],o),Te.lerp(s[2],a[2],o)]},r.shared),e.invalidateDownstreamBooleanData(),e.refreshAttachedClonersInteractions(r)},start:()=>{e.updateGeometryInteractions({scaleBaked:s},r.shared),e.invalidateDownstreamBooleanData(),e.refreshAttachedClonersInteractions(r)},end:()=>{e.updateGeometryInteractions({scaleBaked:a},r.shared),e.invalidateDownstreamBooleanData(),e.refreshAttachedClonersInteractions(r)}}),n}function sJ(e,t,i,r){if(!i.extrusion)return;let s=e.extrusion,a=t.extrusion??{},n=i.extrusion,o=[];return G1.forEach(l=>{let h=yo(l,s,a,n,r);h&&o.push(h)}),o}function aJ(e,t,i,r){let s=[];if(!("geometry"in i))return s;let a=e.geometry.userData.parameters,n="geometry"in t?t.geometry:{},o=i.geometry;if(e instanceof Iu){let l=rJ(e,n,o,r);l&&s.push(...l)}else{let l={};if(Object.assign(l,xa(a,Eg),xa(n,Eg)),Eg.forEach(h=>{let c=yo(h,l,n,o,r.shared);c&&s.push(c)}),e instanceof Cm){Object.assign(l,{extrusion:{...a.extrusion}});let h=sJ(l,n,o,r.shared);h&&s.push(...h)}s.length&&s.push({update:h=>{e.updateGeometryInteractions(l,r.shared),e.updateGeometryGroupsIfNeeded(),e.refreshAttachedClonersInteractions(r)},start:h=>{e.updateGeometryInteractions(l,r.shared),e.updateGeometryGroupsIfNeeded(),e.refreshAttachedClonersInteractions(r)},end:h=>{e.updateGeometryInteractions(l,r.shared),e.updateGeometryGroupsIfNeeded(),e.refreshAttachedClonersInteractions(r)}})}return s}function nJ(e,t,i,r){let s=e.geometry.userData.parameters.extrusion;if(s)return G1.forEach(a=>{Gn(a,s,t,i,r)}),s}function oJ(e,t,i,r){let s=e.updatedPathSnapping;if(s)return eG.forEach(a=>{Gn(a,s,t,i,r)}),s}function lJ(e,t,i,r){let s=[];if(i.intensity!==void 0){let a=pr("intensity",e,t,i,r);a&&s.push(a)}if(i.color!==void 0){let a=EW("color",e,t,i,r);a&&s.push(a)}return s}function hJ(e,t,i,r){let s=[];if(Array.isArray(e.material)){if(!("materials"in i&&i.materials))return s;let a="materials"in t&&t.materials?t.materials:[],n=i.materials;e.material.forEach((o,l)=>{if(!n[l])return;let h=a[l]??{},c=n[l];typeof h=="string"||typeof c=="string"||s.push(...d2(o,h,c,r))})}else{if(!("material"in i&&i.material))return s;let a="material"in t&&t.material?t.material:{},n=i.material;if(typeof a=="string"||typeof n=="string")return s;s.push(...d2(e.material,a,n,r))}return s}function d2(e,t,i,r){let s=[],a=nh(i,r)||!!t.layers&&nh(t,r);s.push(cJ(e,a));for(let n of e.layers){let o=t.layers?.data(n.uuid),l=i.layers.data(n.uuid);if(!l||n.type!=="light"&&(!(n.visible??!0)||!(l.visible??!0)))continue;let h=n.getNames().filter(c=>!pC.some(u=>c.includes(u)));for(let c of h)try{let u=n.getValue(c),d;if(c==="colors")d=jP(n,o,l,c);else if(Array.isArray(u))c==="steps"&&(d=VP(n,o,l,c));else if(typeof u=="number")d=BP(n,o,l,c,r);else{if(typeof u=="boolean")continue;u instanceof H?d=FP(n,o,l,c):u instanceof M?d=kP(n,o,l,c,r):u instanceof Wi?d=NP(n,o,l,c,r):u instanceof Je?d=UP(n,o,l,c,r):"isTexture"in u&&(d=HP(n,o,l,c))}d&&(Array.isArray(d)?s.push(...d):s.push(d))}catch(u){console.error(`lerpMaterial: unexpected material layer for ${c}`,u)}}return s}function BP(e,t,i,r,s){if(!e.hasValue(r)||!(r in i))return;let a=t?t[r]:e.getValue(r),n=i[r],o=typeof a=="string"?Number(s.getVariable(a)??0):a,l=typeof n=="string"?Number(s.getVariable(n)??0):n;if(o!==l)return{update:h=>{e.setValue(r,Te.lerp(o,l,h))},start:()=>{e.setValue(r,o)},end:()=>{e.setValue(r,l)}}}function FP(e,t,i,r){if(!e.hasValue(r)||!(r in i))return;let s=e.getValue(r),a=t?new H().fromArray(t[r]):s.clone(),n=new H().fromArray(i[r]);if(!a.equals(n))return{update:o=>{s.lerpVectors(a,n,o)},start:()=>{s.copy(a)},end:()=>{s.copy(n)}}}function kP(e,t,i,r,s){if(!e.hasValue(r)||!(r in i))return;let a=e.getValue(r),n=t?t[r]:void 0,o=i[r],l=n?Lf(new M,n,s):a.clone(),h=Lf(new M,o,s);if(!l.equals(h))return{update:c=>{a.lerpVectors(l,h,c)},start:()=>{a.copy(l)},end:()=>{a.copy(h)}}}function UP(e,t,i,r,s){if(!e.hasValue(r)||!(r in i))return;let a=t?t[r]:void 0,n=i[r],o=e.getValue(r),l=a?typeof a=="string"?s.getColor(a).clone():new Je().setRGB(a.r,a.g,a.b):o.clone(),h=typeof n=="string"?s.getColor(n).clone():new Je().setRGB(n.r,n.g,n.b);if(l.equals(h))return;let c=o.clone();return{update:u=>{e.getValue(r)!==c&&e.setValue(r,c),c.lerpColors(l,h,u)},start:()=>{c.copy(l)},end:()=>{c.copy(h)}}}function NP(e,t,i,r,s){if(!e.hasValue(r)||!(r in i))return;let a=t?t[r]:void 0,n=i[r],o=e.getValue(r),l=a?typeof a=="string"?s.color(a).clone():new Je().setRGB(a.r,a.g,a.b):o.clone(),h=typeof n=="string"?s.getColor(n).clone():new Wi(n.r,n.g,n.b,n.a);if(l.equals(h))return;let c=o.clone();return{update:u=>{e.getValue(r)!==c&&e.setValue(r,c),c.lerpColors(l,h,u)},start:()=>{c.copy(l)},end:()=>{c.copy(h)}}}function VP(e,t,i,r="steps"){if(!e.hasValue(r)||!(r in i))return;let s=[],a=e.getValue(r),n=t?t[r]:a,o=i[r];return T1(n,o)||s.push({update:l=>{let h=[...a];for(let c=0;c<a.length;++c){let u=n[c],d=o[c];h[c]=Te.lerp(u,d,l)}e.setValue(r,h)},start:()=>{e.setValue(r,n)},end:()=>{e.setValue(r,o)}}),s.length?s:void 0}function jP(e,t,i,r="colors"){if(!e.hasValue(r)||!(r in i))return;
8104let s=[],a=e.getValue(r),n=t?t[r]:a.map(l=>l.toArray()),o=i[r];for(let l=0;l<a.length;++l){let h=[...n[l]],c=[...o[l]];Au.isEqual(h,c)||s.push({update:u=>{a[l].fromArray(Au.lerp(h,c,u))},start:()=>{a[l].fromArray(h)},end:()=>{a[l].fromArray(c)}})}return s.length?s:void 0}function HP(e,t,i,r="texture"){if(!e.hasValue(r)||!(r in i))return;let s=e.getNode("rotation"),a=t?.[r]?.rotation??0,n=i[r]?.rotation??0;if(s&&a!==n)return{update:g=>{s.value=Te.lerp(a,n,g)*Te.DEG2RAD},start:()=>{s.value=a*Te.DEG2RAD},end:()=>{s.value=n*Te.DEG2RAD}};let o=e.getNode("mat");if(!o)return;let l=t?t[r]:o,h=i[r],c=[...l.repeat],u=[...l.offset],d=[...h.repeat],p=[...h.offset],f=l.rotation??0,m=h.rotation??0;if(!ma.isEqual(c,d)||!ma.isEqual(u,p)||f!==m)return{update:g=>{o.repeat=ma.lerp(c,d,g),o.offset=ma.lerp(u,p,g),o.rotation=Te.lerp(f,m,g),o.updateMatrix()},start:()=>{o.repeat=[...c],o.offset=[...u],o.rotation=f,o.updateMatrix()},end:()=>{o.repeat=[...d],o.offset=[...p],o.rotation=m,o.updateMatrix()}}}function p2(e,t,i,r,s,a,n){if(e==="colors")jP(t,i,r,e)?.forEach(o=>o.update(s));else if(Array.isArray(a))e==="steps"&&VP(t,i,r,e)?.forEach(o=>o.update(s));else if(typeof a=="number")BP(t,i,r,e,n)?.update(s);else{if(typeof a=="boolean")return;a instanceof H?FP(t,i,r,e)?.update(s):a instanceof M?kP(t,i,r,e,n)?.update(s):a instanceof Wi&&n?NP(t,i,r,e,n)?.update(s):a instanceof Je&&n?UP(t,i,r,e,n)?.update(s):"isTexture"in a&&HP(t,i,r,e)?.update(s)}}function cJ(e,t){return{update:()=>{e.transparent=t}}}var wv=new M,f2=new Di;function uJ(e,t,i,r,s){let a=[],n,o,l,h,c,u,d,p;if(e instanceof nr?(n=zf("position",e,t,i,s),n&&a.push(n),l=pr("rotation",e,t,i,s),l&&a.push(l),h=zf("shear",e,t,i,s),h&&a.push(h)):(p={slide:t.pathSnapping?.slide??e.updatedPathSnapping?.slide??e.dataPatched.pathSnapping?.slide??0,offset:t.pathSnapping?.offset??e.updatedPathSnapping?.offset??e.dataPatched.pathSnapping?.offset??0},u=pr("slide",p,t.pathSnapping??e.updatedPathSnapping??e.dataPatched.pathSnapping,i.pathSnapping??e.dataPatched.pathSnapping,s),u&&a.push(u),d=pr("offset",p,t.pathSnapping??e.updatedPathSnapping??e.dataPatched.pathSnapping,i.pathSnapping??e.dataPatched.pathSnapping,s),d&&a.push(d),!u&&!d&&(n=h_("position",e,t,i,s),n&&a.push(n),o=h_("scale",e,t,i,s),o&&a.push(o),l=dJ(e,t,i,r,s),l&&a.push(l),c=MW("hiddenMatrix",e,t,i),c&&a.push(c))),n||o||l||c||u||d){let f=e instanceof nr?()=>{e.updateWorldMatrix(!0,!1,!0),e.resetBBoxNeedsUpdate()}:()=>{e.updateMatrix(),e.hasNonUniformScale&&(e.updateMatrixWorld(),e.updateMatrixWorldSVD()),e.parent?.matrixWorldFusedFalse&&(e.matrixWorld.multiplyMatrices(e.parent.matrixWorldFusedFalse,e.matrix),e.matrixWorldNeedsUpdate=!1),fa(e)&&ln(e.parent)&&e.invali
vendor: 1,809 bytes, line 8104
8104dateDownstreamBooleanData(!0),e.updatePathSnapping(Object.assign({},t.pathSnapping,p))};a.push({update:f,start:f,end:f})}return a}function dJ(e,t,i,r,s){let a=t?.rotation?t.rotation.map(c=>(typeof c=="string"?Number(s.getVariable(c)??0):c)*Te.DEG2RAD):void 0,n=i.rotation?.map(c=>(typeof c=="string"?Number(s.getVariable(c)??0):c)*Te.DEG2RAD);if(!n)return;let o=a?new M().fromArray(a):new M().setFromEuler(e.rotation),l=new M().fromArray(n);if(o.equals(l))return;let h=wv.subVectors(l,o);if(r&&h.toArray().every(c=>Math.abs(c)<2*Math.PI)){let c=new nt().setFromEuler(f2.setFromVector3(o)),u=new nt().setFromEuler(f2.setFromVector3(l));return{update:d=>{AW(c,u,e.quaternion,d)},start:()=>{e.rotation.setFromVector3(o)},end:()=>{e.rotation.setFromVector3(l)}}}else return{update:c=>{wv.lerpVectors(o,l,c),e.rotation.setFromVector3(wv)},start:()=>{e.rotation.setFromVector3(o)},end:()=>{e.rotation.setFromVector3(l)}}}function pJ(e,t){return{update:()=>{e instanceof tr&&(e.fill.enabled=t)}}}function fJ(e,t){return{update:()=>{e instanceof tr&&(e.stroke.enabled=t)}}}function mJ(e,t){return{update:()=>{e instanceof tr&&(e.dropShadow.enabled=t)}}}function gJ(e,t){return{update:()=>{e instanceof tr&&(e.innerShadow.enabled=t)}}}function vJ(e,t){return{update:()=>{e instanceof tr&&(e.backgroundBlur.enabled=t)}}}function yJ(e,t){return{update:()=>{e instanceof tr&&(e.layerBlur.enabled=t)}}}function xJ(e,t,i,r,s){let a=[],n,o,l,h,c,u,d,p,f,m,g,v,y,x,w;if("width"in e&&(n=pr("width",e,t,i,s),n&&a.push(n)),"height"in e&&(o=pr("height",e,t,i,s),o&&a.push(o)),e instanceof tr||e instanceof wa){let S={...t.fill},b={...i.fill};S.enabled!==void 0&&S.enabled!==b.enabled&&(a.push(pJ(e,!0)),S.enabled||Object.assign(S,{enabled:!0,color:{...S.color,a:0}}),b.enabled||Object.assign(b,{enabled:!0,color:{...b.color,a:0}}
8104)),l=zd("color",e.fill,S,b,s),l&&a.push(l)}if(e instanceof tr){let S={...t.stroke},b={...i.stroke};(S.enabled||b.enabled)&&(a.push(fJ(e,!0)),S.enabled||Object.assign(S,{enabled:!0,color:{...S.color,a:0}}),b.enabled||Object.assign(b,{enabled:!0,color:{...b.color,a:0}})),h=zd("color",e.stroke,S,b,s),h&&a.push(h),c=pr("thickness",e.stroke,S,b,s),c&&a.push(c)}if(e instanceof tr){let S={...t.dropShadow},b={...i.dropShadow};(S.enabled||b.enabled)&&(a.push(mJ(e,!0)),S.enabled||Object.assign(S,{enabled:!0,color:{...S.color,a:0}}),b.enabled||Object.assign(b,{enabled:!0,color:{...b.color,a:0}})),u=zd("color",e.dropShadow,S,b,s),u&&a.push(u),d=pr("blurRadius",e.dropShadow,S,b,s),d&&a.push(d),f=pr("spread",e.dropShadow,S,b,s),f&&a.push(f),p=zf("offset",e.dropShadow,S,b,s),p&&a.push(p)}if(e instanceof tr){let S={...t.innerShadow},b={...i.innerShadow};(S.enabled||b.enabled)&&(a.push(gJ(e,!0)),S.enabled||Object.assign(S,{enabled:!0,color:{...S.color,a:0}}),b.enabled||Object.assign(b,{enabled:!0,color:{...b.color,a:0}})),m=zd("color",e.innerShadow,S,b,s),m&&a.push(m),g=pr("blurRadius",e.innerShadow,S,b,s),g&&a.push(g),y=pr("spread",e.innerShadow,S,b,s),y&&a.push(y),v=zf("offset",e.innerShadow,S,b,s),v&&a.push(v)}if(e instanceof tr||e instanceof wa){let S={...t.backgroundBlur},b={...i.backgroundBlur};(S.enabled||b.enabled)&&(a.push(vJ(e,!0)),S.enabled||Object.assign(S,{enabled:!0,radius:0}),b.enabled||Object.assign(b,{enabled:!0,radius:0})),x=pr("radius",e.backgroundBlur,S,b,s),x&&a.push(x)}if(e instanceof tr){let S={...t.layerBlur},b={...i.layerBlur};(S.enabled||b.enabled)&&(a.push(yJ(e,!0)),S.enabled||Object.assign(S,{enabled:!0,radius:0}),b.enabled||Object.assign(b,{enabled:!0,radius:0})),w=pr("radius",e.layerBlur,S,b,s),w&&a.push(w)}if(e instanceof wa||e instanceof Yu){let S=ex("cornerRadius",e,t,i,s);S&&a.push(S)}return a}function m2(e,t,i,r,s){let a=[];return e.data.visible&&a.push(...uJ(e,t,i,s,r.shared)),e instanceof nr?a.push(...xJ(e,t,i,s,r.shared)):(e.data.visible&&a.push(...CW(e,t,i,r)),e instanceof xr?(e instanceof ai&&e.data.visible&&a.push(...aJ(e,t,i,r)),e.data.visible&&a.push(...hJ(e,t,i,r.shared))):Hf.is(e)?e.data.visible&&a.push(...lJ(e,t,i,r.shared)):e instanceof qi&&a.push(...iJ(e,t,i,r.shared))),a.length?{update:n=>{a.forEach(o=>o.update(n))},start:n=>{a.forEach(o=>o.start?.(n))},end:n=>{a.forEach(o=>o.end?.(n))}}:void 0}function bJ(e,t){return{position(i){Object.assign(e.position,i),(i.x!==void 0||i.y!==void 0||i.z!==void 0)&&(e.updateMatrix(),e.resetBBoxNeedsUpdate(),e instanceof ai&&e.invalidateDownstreamBooleanData(),e.dispatchEvent({type:"requestRender"}))},rotation(i){let r=Object.keys(i)[0];e.rotation[r]=i[r]*Te.DEG2RAD,(i.x!==void 0||i.y!==void 0||i.z!==void 0)&&(e.updateMatrix(),e.resetBBoxNeedsUpdate(),e instanceof ai&&e.invalidateDownstreamBooleanData(),e.dispatchEvent({type:"requestRender"}))},scale(i){Object.assign(e.scale,i),(i.x!==void 0||i.y!==void 0||i.z!==void 0)&&(e.updateMatrix(),e.resetBBoxNeedsUpdate(),e instanceof ai&&e.invalidateDownstreamBooleanData(),e.dispatchEvent({type:"requestRender"}))},shapeSize(i){e instanceof ai&&(e.userData.value={...e.userData.value,...i},(i.x!==void 0||i.y!==void 0||i.z!==void 0)&&(e.updateGeometryInteractions({width:e.userData.value.x,height:e.userData.value.y,depth:e.userData.value.z},t.shared),e.resetBBoxNeedsUpdate(),e.invalidateDownstreamBooleanData(),e.dispatchEvent({type:"requestRender"})))},material(i,r,s){s&&(Object.entries(s).forEach(([a,{start:n,end:o,t:l}])=>{let h=r.getValue(a);h!==void 0&&p2(a,r,n,o,l,h,t.shared)}),e.dispatchEvent({type:"requestRender"}))},opacity(i){if(e instanceof xr&&!Array.isArray(e.material)){let r=e.material.getLayersOfType("light")[0];e.material.transparent=!0,p2("alphaOverride",r,{alphaOverride:i},{alphaOverride:i+1},0,i,t.shared),e.dispatchEvent({type:"requestRender"})}},light(i,r){(e instanceof Am||e instanceof Dx||e instanceof Mm)&&(e[i]=r,e.dispatchEvent({type:"requestRender"}))},cloner(i){i.cloner?.update(t),i instanceof ai&&i.invalidateDownstreamBooleanData(),i.dispatchEvent({type:"requestRender"})},pathExtrusion(i,r){i.geometry.userData.parameters.extrusion={...i.geometry.userData.parameters.extrusion,...r},i.updateGeometryInteractions({extrusion:{...i.geometry.userData.parameters.extrusion}},t.shared),i.resetBBoxNeedsUpdate(),i.invalidateDownstreamBooleanData(),i.dispatchEvent({type:"requestRender"})},pathSnapping(i){e.userData.pathSnapping={...e.userData.pathSnapping,...i},e.updatePathSnapping(e.userData.pathSnapping),e.dispatchEvent({type:"requestRender"})}}}var g2=new M;function Fx(e,t,i=!1){let r=[],s=a=>{let n=a.data;delete a.states,a.currentState=null,a.reversibleToState=null,a.currentTransitionEvent=null;for(let o of n.states){let l={...o.data};a.states||(a.states={}),a.states[o.id]=Vo.patch(n,l)}y2(e.scene,a,null,t,n.events.find(o=>o.data.type==="Follow"||o.data.type==="LookAt")!==void 0),v2(e)};
8104e.scene.traverse2D(s),e.traverseChildren(a=>{if(i&&(a.rigidBody?.setTranslation(a.position0,!0),a.rigidBody?.setRotation(a.rotation0,!0),a.rigidBody?.setLinvel(g2,!0),a.rigidBody?.setAngvel(g2,!0)),!Tt.is(a))return;let n=a.uuid,o=a.data;if(delete a.states,a.uuid===Jh)return;let l=!1;r.some(h=>e.scene.find(n)?.isDescendantOf(h))?l=!0:o.physics?.fusedBody===!0&&o.physics.rigidBody==="dynamic"&&r.push(n),a.data=o,a.currentState=null,a.reversibleToState=null,a.currentTransitionEvent=null;for(let h of o.states){let c={...h.data};e.data.globalPhysics.usePhysics===!0&&o.physics&&(o.physics.rigidBody==="dynamic"||l)&&(h.data.position!==void 0&&delete c.position,h.data.rotation!==void 0&&delete c.rotation,h.data.hiddenMatrix!==void 0&&delete c.hiddenMatrix),a.states||(a.states={}),a.states[h.id]=Zn.patch(o,c)}y2(e.scene,a,null,t,o.events.find(h=>h.data.type==="Follow"||h.data.type==="LookAt")!==void 0),a instanceof _r&&a.frame&&(a.frame.traverse(h=>s(h)),a.uiCanvas?.applySize())}),v2(e),e.frame&&(e.frame.traverse(a=>s(a)),e.uiCanvas?.applySize())}function v2(e){e.traverseEntity(t=>{for(let i of t.data.events){let r=[];switch(i.data.type){case"Follow":case"MouseHover":case"Scroll":case"MouseDown":case"MouseUp":case"MousePress":case"KeyUp":case"KeyDown":case"KeyPress":case"Collision":r.push(...i.data.actions);break;case"GameControl":for(let s of Object.values(i.data.gameActions))r.push(...s);break;case"DragDrop":r.push(...i.data.dragDropActions.drag,...i.data.dragDropActions.drop);break;case"Conditional":r.push(...i.data.inActions,...i.data.outActions);break}for(let s of r)if(s.data.type==="Create"&&s.data.hideBase==="Yes"){let a=e.scene.find(s.data.object);a&&(a.visible=!1)}}})}function y2(e,t,i,r,s=!1){if(t instanceof ai&&!(t instanceof nl)&&t.removeInteractionGeometry(r),t instanceof nr?t.changeSelectedState(i,{shared:r},s):t.changeSelectedState(i,{scene:e,shared:r},s),t instanceof ai&&t.updateGeometryGroupsIfNeeded(),t instanceof qi&&t.updateCameraState(t.dataPatched,{scene:e,shared:r}),!(t instanceof nr)){if(t.cloner)for(let a of t.cloner.children)a.playModeVisible=void 0;t.updateVisible()}}function GP(e){let t;if(e.easing===5){let{control1:i,control2:r}=e;t=`cubicBezier( 8105 ${i[0]}, ${i[1]}, ${r[0]}, ${r[1]} 8106 )`}else if(e.easing===6){let{mass:i,stiffness:r,damping:s,velocity:a}=e;t=`spring( ${i}, ${r}, ${s}, ${a} )`}else{let i;switch(e.easing){case 0:i=kn.linear;break;case 1:i=kn.ease;break;case 2:i=kn.easeIn;break;case 3:i=kn.easeOut;break;case 4:i=kn.easeInOut;break;default:i=kn.linear}let[r,s,a,n]=i;t=`cubicBezier( ${r}, ${s}, ${a}, ${n} )`}return{duration:Math.max(e.duration,1e-4),easing:t}}function Qf(e){let t={delay:0,loop:e.repeat===-1?!0:e.repeat+1};if(e.repeat===0)t.direction="normal",t.rewind=!1;else switch(e.direction){case"pingpong":t.direction="alternate",t.rewind=!1;break;case"pingpong-rewind":t.direction="alternate",t.rewind=!0;break;default:t.direction="normal",t.rewind=!1;break}switch(t.delay=0,t.endDelay=0,t.startOnceDelay=0,t.pingPongDelayCorrection=0,t.pingPongEndDelayCorrection=0,e.delayDirection){case"start-once":t.startOnceDelay=e.delay;break;case"start":t.delay=e.delay;break;case"end":t.endDelay=e.delay;break;case"start-end":case void 0:t.delay=e.delay,t.endDelay=e.delay;break}return t.direction==="alternate"&&(t.delay/=2,t.endDelay/=2,e.delayDirection==="start"?(t.pingPongDelayCorrection=t.delay,typeof t.loop=="number"&&t.loop%2===0&&(t.pingPongEndDelayCorrection=t.delay)):e.delayDirection==="end"?typeof t.loop=="number"&&t.loop%2!==0&&(t.pingPongEndDelayCorrection=t.endDelay):e.delayDirection==="start-end"&&(t.pingPongDelayCorrection=t.delay,t.pingPongEndDelayCorrection=t.endDelay)),t}var WP={type:"beginState"},qP={type:"completeState",isfromEntity:!1},jy=class{constructor(e,t,i,r,s,a,n){if(this.object=e,this.data=r,this.sharedAssets=s,this.allowSlerp=a,this.page=n,this.targets={t:0},this.firstLoop=!0,this._changeBegan=!1,this._changeCompleted=!0,this.onChange=()=>{this.callback&&(this.callback.update(this.targets.t),this.object.requestRender()),this.targets.t===0||this.targets.t===1?this._changeCompleted||(this._changeCompleted=!0,this._changeBegan=!1,this.onChangeComplete()):(this._changeCompleted&&(this._changeCompleted=!1),this._changeBegan||(this._changeBegan=!0,this.onChangeBegin()))},this.onChangeBegin=()=>{this.object.reversibleToState=this.to.id;let o=this.targets.t>.5?this.from.id:this.to.id;this.object.prevState!==this.object.currentState&&(this.object.prevState=this.object.currentState),this.object.currentState=o,this.object.dispatchEvent({type:"beginState",state:o}),this.object instanceof nr||this.object.traverseEntity(l=>{l!==this.object&&l instanceof qi&&l.dispatchEvent(WP)})},this.onChangeComplete=()=>{this.firstLoop&&(this.onFirstLoop(),this.firstLoop=!1),this.object.reversibleToState=this.to.id;let o=this.targets.t<.5?this.from.id:this.to.id;this.object.prevState!==this.object.currentState&&(this.object.prevState=this.object.currentState),this.object.currentState=o,this.object.dispatchEvent({type:"completeState",state:o}),this.object instanceof nr||this.object.traverseEntity(l=>{l!==this.object&&l instanceof qi&&l.dispatchEvent(qP)})},this.onFirstLoop=()=>{this.useCurrentState&&(this.callback=m2(this.object,this.from.data,this.to.data,{scene:this.page.scene,shared:this.sharedAssets},this.allowSlerp))},t===void 0){let o=Vp(this.object,this.object.currentState===i?this.object.prevState:this.object.currentState);if(!o)throw new Error("Missing property");this.from=o}else{let o=Vp(this.object,t);if(!o)throw new Error("Missing property");this.from=o}if(i===void 0)throw new Error("Missing property");{let o=Vp(this.object,i);if(!o)throw new Error("Missing property");this.to=o}this.useCurrentState=t===void 0||i===void 0,this.params={targets:this.targets,t:1,autoplay:!1,...Qf(r),...GP(r),change:this.onChange},this.callback=m2(this.object,t===void 0?{}:this.from.data,i===void 0?{}:this.to.data,{scene:this.page.scene,shared:this.sharedAssets},this.allowSlerp)}get changeBegan(){return this._changeBegan}get changeCompleted(){return this._changeCompleted}},Hy=class extends or{constructor(e,t,i,r,s){if(super(),this.eventType=e,this.data=t,this.page=i,this.shared=r,this.condition=s,this.toggleIsForward=!1,this.timelineNeedsRebuild=!1,this.hasPlayedOnce=!1,this.pauseOnNextLoopEnd=!1,this.onTimelineChangeComplete=()=>{if(this.pauseOnNextLoopEnd){this.pauseOnNextLoopEnd=!1,this.timeline?.pause();return}this.data.tweens[0].data.direction!=="normal"&&(this.toggleIsForward=!this.toggleIsForward),this.timelineNeedsRebuild!==!1&&(this.timeline?.pause(),this.buildTimeline({isForward:this.toggleIsForward,needsRebuild:!1,isRebuild:!0}),this.timeline.play())},!t.object)throw new Error("Missing property");let a=this.page.scene.find(t.object)??this.page.uiCanvas?.find(t.object)??this.page.scene.find2DInUIObjects(t.object);if(!a)throw new Error("Missing property");if(!a.states)throw new Error("Missing property");if(this.object=a,t.tweens.length<2)throw new Error("Missing property");this.tweens=Array(this.data.tweens.length-1),this.startOnceDelay=t.tweens[0].data.delayDirection==="start-once"?t.tweens[0].data.delay:0,this.init()}get playing(){return this.timeline?.paused===!1}
8106get changeBegan(){return this.tweens.some(e=>e.changeBegan)??!1}init(){this.initialCurrentState=Vp(this.object,this.object.currentState).id,this.toggleIsForward=!1}get currentState(){return this.data.runMode==="Toggle"&&v0(this.eventType)?this.initialCurrentState:this.object.currentState}buildTimeline({isForward:e=!0,needsRebuild:t=!1,isRebuild:i=!1}={}){try{let r=Qf(this.data.tweens[0].data);i&&typeof r.loop=="number"&&r.loop--,this.timeline?.pause(),this.timeline=un.timeline({autoplay:!1,...r,...r.loop===!0||r.loop>1?{timelineChangeComplete:this.onTimelineChangeComplete}:{}});let s=this.tweens.findIndex(a=>a?.changeBegan);if(t===!0&&(this.timelineNeedsRebuild=!0),e){let a=s===-1?0:s;for(let n=a;n<this.data.tweens.length-1;n++){let o=this.data.tweens[n],l=this.data.tweens[n+1],h;n===a&&(this.object.wasMovedByUser===!0||this.object.previousAction?.changeBegan===!0)?(h=void 0,this.object instanceof qi&&(this.object.wasMovedByUser=!1)):h=o.data.state===void 0?this.currentState:o.data.state;let c=new jy(this.object,h,l.data.state===void 0?this.currentState:l.data.state,l.data,this.shared,this.data.allowSlerp??!1,this.page);s!==-1&&n===a&&Object.assign(c.params,{startOnceDelay:0}),this.tweens[n]=c,this.timeline.add(c.params,this.timeline.duration+(n===a?r.delay:0))}this.timeline.duration+=r.endDelay}else{let a=s===-1?this.data.tweens.length-1:s+1;for(let n=a;n>0;n--){let o=this.data.tweens[n],l=this.data.tweens[n-1],h;n===a&&(this.object.wasMovedByUser===!0||this.object.previousAction?.changeBegan===!0)?(h=void 0,this.object instanceof qi&&(this.object.wasMovedByUser=!1)):h=o.data.state===void 0?this.currentState:o.data.state;let c=new jy(this.object,h,l.data.state===void 0?this.currentState:l.data.state,o.data,this.shared,this.data.allowSlerp??!1,this.page);s!==-1&&n===a&&Object.assign(c.params,{startOnceDelay:0}),this.tweens[n-1]=c,this.timeline.add(c.params,this.timeline.duration+(n===a?r.endDelay:0))}this.timeline.duration+=r.delay}}catch(r){r instanceof Error&&console.error(r.message)}this.object.previousAction?.playing===!0&&this.object.previousAction.pause(),this.object.previousAction=this}play(){if(ii(this.shared,this.condition)===!1||v0(this.eventType)&&this.data.runMode==="Once"&&this.hasPlayedOnce||(this.hasPlayedOnce=!0,this.playing))return!1;this.startTimeout?.pause();let e=Qf(this.data.tweens[0].data).pingPongDelayCorrection;this.startTimeout=un({targets:{},duration:this.startOnceDelay+e,easing:"linear",complete:()=>{this.startTimeout=void 0;try{this.buildTimeline(),this.timeline.play()}catch(t){t instanceof Error&&console.error(t.message)}}})}pause(){this.timeline?.pause(),this.startTimeout?.pause(),this.tweens=Array(this.data.tweens.length-1),delete this.startTimeout}stop(){this.pause();let e=this.data.tweens[0].data.state===void 0?this.initialCurrentState:this.data.tweens[0].data.state;this.object instanceof nr?this.object.changeSelectedState(e,{shared:this.shared}):this.object.changeSelectedState(e,{scene:this.page.scene,shared:this.shared}),this.object.currentState=e}seek(e){if(ii(this.shared,this.condition)===!1)return!1;this.timeline===void 0&&this.buildTimeline(),this.timeline?.seek(e*this.timeline.duration,!0)}toggle(e){if(ii(this.shared,this.condition)===!1)return!1;this.startTimeout?.pause(),this.toggleIsForward=e??!this.toggleIsForward,this.playing?(this.timeline?.pause(),this.buildTimeline({isForward:this.toggleIsForward,needsRebuild:!0}),this.pauseOnNextLoopEnd=!0,this.timeline.play()):this.startTimeout=un({targets:{},duration:this.startOnceDelay,easing:"linear",complete:()=>{this.startTimeout=void 0,this.timeline?.pause(),this.buildTimeline({isForward:this.toggleIsForward}),this.timeline.play()}})}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause()}};function Vp(e,t){let i,r;if(typeof t=="string"?(i=t,r=e.states?.[i]):t===null&&(i=null,r=e.data),!(i===void 0||r===void 0))return{id:i,data:r}}var wJ={type:"beginState"},x2={type:"completeState",isfromEntity:!1},b2={type:"requestRender"},XP=class extends or{constructor(e,t,i,r){super(),this.data=e,this.page=t,this.shared=i,this.condition=r,this.toggleIsForward=!1,this.posStart=new M,this.posEnd=new M,this.qStart=new nt,this.qEnd=new nt,this.zoomStart=1,this.zoomEnd=1}init(){}get playing(){return this.animation&&this.animation.began&&!this.animation.completed}buildAnimation(e=!1){if(!this.data.animate)return;let t=this.page.scene.find(this.data.targetCamera);if(!t||!t.visible)throw new ReferenceError("Target camera not founded or not visible");let i={t:0};this.posStart.copy(this.page.activeCamera.position),this.qStart.copy(this.page.activeCamera.quaternion),this.zoomStart=this.page.activeCamera.zoom,this.animation=un({targets:i,t:1,...GP(this.data),update:()=>{i.t===0&&(this.data.runMode==="Toggle"&&!this.toggleIsForward?this.fromCamera&&(this.posEnd.copy(this.fromCamera.position),this.qEnd.copy(this.fromCamera.quaternion),this.zoomEnd=this.fromCamera.zoom,this.switchCamera(this.fromCamera.uuid)):(this.posEnd.copy(t.position),this.qEnd.copy(t.quaternion),this.zoomEnd=t.zoom,this.fromCamera=this.page.activeCamera,this.switchCamera(t.uuid)),this.page.activeCamera.dispatchEvent(wJ));let r=this.page.activeCamera;r.position.lerpVectors(this.posStart,this.posEnd,i.t),r.quaternion.slerp
8106Quaternions(this.qStart,this.qEnd,i.t),r.zoom=this.zoomStart+(this.zoomEnd-this.zoomStart)*i.t,r.wasMovedBySwitchCameraAction=!0,r.updateMatrix(),r.updateMatrixWorld(),r.updateProjectionMatrix(),r.dispatchEvent(b2),i.t===1&&r.dispatchEvent(x2)}})}switchCamera(e){let t=this.page.activeCamera,i=this.page.scene.find(e);if(!i||!i.visible)throw new ReferenceError("Target camera not founded or not visible");this.page.switchActiveCamera(i),t.dispatchEvent({type:"cameraChange",camera:i})}play(){if(ii(this.shared,this.condition)===!1)return!1;if(!this.playing&&this.page.activeCamera.uuid!==this.data.targetCamera)try{clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{delete this.timeoutId,this.data.animate?(this.buildAnimation(),this.animation?.play()):this.switchCamera(this.data.targetCamera)},this.data.delay*1e3)}catch{}}pause(){this.animation?.pause(),clearTimeout(this.timeoutId),delete this.timeoutId}toggle(e){if(ii(this.shared,this.condition)===!1)return!1;if(window.clearTimeout(this.timeoutId),delete this.timeoutId,e!==this.toggleIsForward)try{this.playing?(this.animation?.pause(),this.toggleIsForward=e??!this.toggleIsForward,this.buildAnimation(!0),this.animation?.play()):this.timeoutId=window.setTimeout(()=>{this.toggleIsForward=e??!this.toggleIsForward,this.data.animate?(this.animation?.pause(),this.buildAnimation(),this.animation?.play()):(this.toggleIsForward?(this.fromCamera=this.page.activeCamera,this.switchCamera(this.data.targetCamera)):this.fromCamera&&this.switchCamera(this.fromCamera.uuid),this.page.activeCamera.dispatchEvent(x2),this.page.activeCamera.dispatchEvent(b2))},this.data.delay*1e3)}catch{}}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause(),this.toggleIsForward=!1}},YP=class extends or{constructor(e,t,i,r,s){super(),this.id=e,this.data=t,this.scene=i,this.sharedAssets=r,this.eventType=s,this.toggleIsForward=!1,this._finished=!1,this.hasPlayedOnce=!1,this._shouldForwardLoop=!1,this._shouldPauseOnNextLoopComplete=!1,this._onLoopComplete=()=>{this._shouldPauseOnNextLoopComplete&&(this.timeline.pause(),this._shouldPauseOnNextLoopComplete=!1)};try{let a=Qf(this.data);typeof a.loop=="number"&&a.loop--,this.timeline=un.timeline({...a,autoplay:!1}),this._shouldForwardLoop=a.loop===!0||typeof a.loop=="number"&&a.loop>1;let n=this.sharedAssets.data.timelineAnimations[this.data.timeline].mapping;Object.entries(n).forEach(([o,l])=>{let h=this.scene.find(o);if(!h)return;let c=h.data.timelineAnimations[l];if(!c)return;let u=sy.addKeyframesToTimeline(h,{...c},bJ(h,{scene:i,shared:r}),this.sharedAssets),d=(this.data.delayDirection==="start"?this.data.delay:0)+(this.data.delayDirection==="start-end"?this.data.delay:0)+(this.data.delayDirection==="start-once"?this.data.delay:0);u.forEach(p=>{this.timeline.add(p,d)}),this.timeline.duration=c.to*1e3+d}),this.timeline.delay=0,this.timeline.duration+=(this.data.delayDirection==="start"?this.data.delay:0)+(this.data.delayDirection==="end"?this.data.delay:0)+(this.data.delayDirection==="start-end"?this.data.delay*2:0)+(this.data.delayDirection==="start-once"?this.data.delay*2:0),this.timeline.finished.then(()=>{Object.keys(n).forEach(o=>{let l=this.scene.find(o);l instanceof qi&&l.dispatchEvent(qP)}),this._finished=!0}),this.timeline.loopComplete=this._onLoopComplete}catch{throw new Error("Missing property")}}get playing(){return this.timeline.paused===!1}get finished(){return this._finished}get paused(){return this.timeline.paused}play(){if(this.eventType!==void 0&&v0(this.eventType)&&this.data.runMode==="Once"&&this.hasPlayedOnce||this.eventType===void 0&&this._finished)return!1;this.hasPlayedOnce=!0;let e=this.sharedAssets.data.timelineAnimations[this.data.timeline].mapping;Object.keys(e).forEach(t=>{let i=this.scene.find(t);i instanceof qi&&i.dispatchEvent(WP)}),this.timeline.restart()}pause(){this.timeline.pause()}stop(){this.pause(),this.seek(0),this.timeline.reset(),this._finished=!1}seek(e){this.timeline.seek(e*this.timeline.duration,!0)}toggle(e){if(this.toggleIsForward=e??!this.toggleIsForward,this.playing){if(!this.toggleIsForward&&this.timeline.reversed&&this._shouldForwardLoop&&this.timeline.remaining%2===1){this._shouldPauseOnNextLoopComplete=!0;return}this.timeline.reverse(this.timeline.duration-this.timeline.currentTime),this._shouldForwardLoop&&this.timeline.loop&&this.timeline.reversed&&(this._shouldPauseOnNextLoopComplete=!0)}else(!this.toggleIsForward!==this.timeline.reversed||!this.toggleIsForward&&this.timeline.reversed&&this.timeline.direction==="alternate")&&this.timeline.reverse(),typeof this.timeline.loop=="number"&&typeof this.timeline.remaining=="number"&&this.timeline.remaining<this.timeline.loop&&this.toggleIsForward&&(this.timeline.remaining=this.timeline.loop),this.timeline.play()}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause()}};function QP(e){let t=e?.tracks.filter(i=>i.ValueTypeName==="vector"||i.ValueTypeName==="quaternion").map(i=>i.times.length);if(t?.length){let i=P6(t);return i&&i>2?i:2}return 2}var KP=class extends or{constructor(e,t,i,r,s){super(),this.data=e,this.page=t,this.animationControls=i,this.shared=r,this.condition=s,this.startOnceDelay=0,this.toggleIsForward=!1;let a=e.object,n=t.scene.find(e.object);n&&Array.isArray(n.identity)&&(a=n.identity[0]),this.data={...e,object:a};let o=this.animationControls.clipIdToAction[e.clipId+"/"+a];if(this.duration=o?.getClip()?.duration??1,this.data.crop2){let l=QP(o?.getClip());this.leftFrameTime=this.data.crop2[0]/(l-1)*this.duration,this.rightFrameTime=this.data.crop2[1]/(l-1)*this.duration}else{let l=o?.getClip()?.tracks[0]?.times.length;l&&l>1?(this.leftFrameTime=this.data.crop[0]/l*this.duration,this.rightFrameTime=this.data.crop[1]/l*this.duration):(this.leftFrameTime=0,this.rightFrameTime=this.duration)}this.startOnceDelay=e.delay}get playing(){return this.threeAnimAction?.isRunning()??!1}play(e=!1){if(ii(this.shared,this.condition)===!1)return!1;window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),!this.threeAnimAction)return;this.threeAnimAction.reset(),this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime;let t=this.data.object;
vendor: 5,987 bytes, line 8106
8106Object.entries(this.animationControls.clipIdToAction).forEach(([i,r])=>{let s=i.split("/")[1];this.threeAnimAction!==r&&s===t&&(e?r.fadeOut(.2):r.stop())}),e&&this.threeAnimAction?.fadeIn(.2)},this.startOnceDelay)}pause(){this.threeAnimAction&&(this.threeAnimAction.paused=!0),window.clearTimeout(this.timeoutId),delete this.timeoutId}stop(){this.threeAnimAction?.fadeOut(.2)}seek(e){this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction&&(this.threeAnimAction.paused=!0,this.threeAnimAction.time=Te.clamp(this.threeAnimAction.time+1/60*e,this.leftFrameTime,this.rightFrameTime-16e-5),this.animationControls.needsUpdate=!0,this.animationControls.requestRender())}toggle(e,t=!1){if(ii(this.shared,this.condition)===!1)return!1;this.toggleIsForward=e??!this.toggleIsForward,this.threeAnimAction&&(this.threeAnimAction._loopCount=0),this.playing?this.threeAnimAction&&(this.threeAnimAction.timeScale=this.toggleIsForward?1:-1,this.toggleIsForward?(this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime)):this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction){this.toggleIsForward?(this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction.time=this.rightFrameTime,this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime),this.threeAnimAction.paused=!1,this.threeAnimAction.timeScale=this.toggleIsForward?1:-1;let i=this.data.clipId.split("/")[1];Object.entries(this.animationControls.clipIdToAction).forEach(([r,s])=>{let a=r.split("/")[1];this.threeAnimAction!==s&&a===i&&s.isRunning()&&(t?s.fadeOut(.2):s.stop())}),t&&this.threeAnimAction?.fadeIn(.2)}},this.startOnceDelay)}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){let e=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object]?.getClip();e&&(e.duration=this.duration),this.pause()}},ZP=class{constructor(e,t,i,r,s){this.data=e,this.page=t,this.eventManager=i,this.shared=r,this.condition=s,this.timeOutId=-1,this.scene=t.scene}dispatch(){if(ii(this.shared,this.condition)===!1)return!1;this.data.target!==this.page.uuid&&(window.clearTimeout(this.timeOutId),this.timeOutId=window.setTimeout(()=>{this.play()},this.data.delay*1e3))}dispose(){window.clearTimeout(this.timeOutId)}play(){if(this.scene.children.every(t=>t.uuid!==this.data.target||t.data.uiScene))return;this.data.transition==="fade"&&this.data.duration>0&&this.eventManager.eventContext.renderer.renderFromSceneForSceneTransitionPass(this.scene,this.scene.activeCamera,this.data.duration*1e3),this.eventManager.deactivate(),this.eventManager.controlsManager.deactivate();let e=this.scene.activeCamera;this.scene.updatePage(this.data.target),this.scene.traverseVisibleEntity(t=>{t.type==="ParticleSystem"&&(t.sleep(),t.wakeUp(),t.data.autoPlay?t.start():t.stop())}),this.scene.activePage.switchToPlayCamera(),this.scene.activeCamera.copyViewPlaneSize(e),Fx(this.scene.activePage,this.shared),this.eventManager.activate(),this.eventManager.controlsManager.activate(this.eventManager)}},JP=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r,this.evaluatedCondition=!1}checkConditions(){this.evaluatedCondition=ii(this.shared,this.condition)}dispatch(){if(this.evaluatedCondition===!1)return!1;let e=this.shared.getVariable(this.data.variableId),t=lT(this.data.expression,this.shared,gr.typeOfVariable(e));t!==void 0&&this.shared.updateVariable(this.data.variableId,typeof t=="string"?{textValue:t}:t)}dispose(){}},$P=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r,this.timeoutId=null}dispatchInner(){if(ii(this.shared,this.condition)===!1)return!1;let e=this.shared.getDynamicVariablePlayState(this.data.variableId);if(this.data.mode==="PlayPause")this.shared.getDynamicVariableToggleIsForward(this.data.variableId)===void 0&&this.shared.setDynamicVariableToggleIsForward(this.data.variableId,!0),this.shared.setDynamicVariablePlayState(this.data.variableId,e==="Playing"?"Paused":"Playing");else if(this.data.mode==="Play"&&e!=="Playing")this.shared.getDynamicVariableToggleIsForward(this.data.variableId)===void 0&&this.shared.setDynamicVariableToggleIsForward(this.data.variableId,!0),this.shared.setDynamicVariablePlayState(this.data.variableId,"Playing");else if(this.data.mode==="Stop"&&e!=="Stopped")this.shared.setDynamicVariablePlayState(this.data.variableId,"Stopped");else if(this.data.mode==="Pause"&&e!=="Paused")this.shared.setDynamicVariablePlayState(this.data.variableId,"Paused");else if(this.data.mode==="Restart")this.shared.setDynamicVariablePlayState(this.data.variableId,"Restarted");else if(this.data.mode==="Toggle"){let t=this.shared.getDynamicVariableToggleIsForward(this.data.variableId);e==="Playing"?this.shared.setDynamicVariableToggleIsForward(this.data.variableId,t===void 0?!1:!t):(this.shared.setDynamicVariableToggleIsForward(this.data.variableId,!t),this.shared.setDynamicVariablePlayState(this.data.variableId,"Playing"))}}dispatch(){let e=this.data.delay,t=this.shared.getDynamicVariablePlayState(this.data.variableId);this.data.mode==="PlayPause"&&t==="Playing"&&(e=this.data.pauseDelay),e!==0?(this.timeoutId&&window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{this.timeoutId=null,this.dispatchInner()},e)):this.dispatchInner()}dispose(){this.timeoutId&&window.clearTimeout(this.timeoutId)}},SJ=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r}dispatch(){if(ii(this.shared,this.condition)===!1)return!1;(this.data.target==="single"?this.data.variableId?[this.data.variableId]:[]:Object.keys(this.shared.getVariables())).forEac
8106h(e=>{this.shared.getVariable(e);let t=this.shared.data.variables.data(e)?.value;t!==void 0&&this.shared.updateVariable(e,t),this.shared.enableLocalStorageForPersistentVariables&&localStorage.removeItem(_y(e))})}dispose(){}},_J=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r}dispatch(){if(ii(this.shared,this.condition)===!1)return!1;if(this.data.userAPIId){let e=this.shared.getUserAPI(this.data.userAPIId);e&&"callUserAPI"in e&&e.callUserAPI(this.shared)}}dispose(){}};function ii(e,t){if(t===void 0)return!0;if(t.expression.length===0)return!1;let i=lT(t.expression,e,"boolean");return t.negate?!i:!!i}function Bi(e,t,i,r,s,a){let n={Audio:[],Video:[],Particles:[],Link:[],Destroy:[],Create:[],Reset:[],Transition:[],TimelineAnimation:[],SwitchCamera:[],Animation:[],SceneTransition:[],SetVariable:[],DynamicVariablePlay:[],ClearLocalStorage:[],UserAPI:[]},o=l=>({id:h,data:c})=>{try{c.type==="Audio"?lr[e.type].includes("Audio")&&n.Audio.push(new IP(h,c,a,r,l)):c.type==="Video"&&!(a instanceof nr)?lr[e.type].includes("Video")&&n.Video.push(new tD(h,c,a,r,l)):c.type==="Particles"?lr[e.type].includes("Particles")&&n.Particles.push(new RP(c,i,r,l)):c.type==="Link"?lr[e.type].includes("Link")&&n.Link.push(new tJ(c,s.controlsManager,r,l)):c.type==="Create"?lr[e.type].includes("Create")&&n.Create.push(new iD(c,i,s.controlsManager,r,l)):c.type==="Destroy"?lr[e.type].includes("Destroy")&&n.Destroy.push(new LP(c,i,s.controlsManager,r,l)):c.type==="Reset"?lr[e.type].includes("Reset")&&n.Reset.push(new zP(c,i,r,s,l)):c.type==="Transition"?lr[e.type].includes("Transition")&&n.Transition.push(new Hy(e.type,c,i,r,l)):c.type==="SwitchCamera"?lr[e.type].includes("SwitchCamera")&&n.SwitchCamera.push(new XP(c,i,r,l)):c.type==="SceneTransition"?lr[e.type].includes("SceneTransition")&&n.SceneTransition.push(new ZP(c,i,s,r,l)):c.type==="Animation"?lr[e.type].includes("Animation")&&n.Animation.push(new KP(c,i,s.animationControls,r,l)):c.type==="SetVariable"?lr[e.type].includes("SetVariable")&&n.SetVariable.push(new JP(c,i,r,l)):c.type==="DynamicVariablePlay"?lr[e.type].includes("DynamicVariablePlay")&&n.DynamicVariablePlay.push(new $P(c,i,r,l)):c.type==="Conditional"?lr[e.type].includes("Conditional")&&(c.ifActions.forEach(o({expression:c.condition,negate:!1})),c.elseActions.forEach(o({expression:c.condition,negate:!0}))):c.type==="ClearLocalStorage"?lr[e.type].includes("ClearLocalStorage")&&n.ClearLocalStorage.push(new SJ(c,i,r,l)):c.type==="UserAPI"?lr[e.type].includes("UserAPI")&&n.UserAPI.push(new _J(c,i,r,l)):c.type==="TimelineAnimation"&&lr[e.type].includes("TimelineAnimation")&&n.TimelineAnimation.push(new YP(h,c,i.scene,r,e.type))}catch{}};return t.forEach(o()),n}function ar(e){Object.values(e).forEach(t=>{t.forEach(i=>{(i instanceof IP||i instanceof tD||i instanceof Hy||i instanceof YP||i instanceof RP||i instanceof KP||i instanceof Hy||i instanceof iD||i instanceof LP||i instanceof XP||i instanceof ZP||i instanceof zP||i instanceof JP||i instanceof $P)&&i.dispose()})})}function AJ(e,t){let i;if("material"in e){let r=e.material;Array.isArray(r)?i=e.material[0].layers.find(s=>s.uuid===t):i=e.material.layers.find(s=>s.uuid===t)}if(i)return i.color.texture.image.img instanceof HTMLVideoElement?i.color.texture.image.img:void 0}var eD=new Map,hu=new Map,to=class{constructor(e,t,i){this.data=t,this.delay=0,this.status="stopped";let{layerId:r,loop:s,volume:a,delay:n}=t;if(this.object=i,r===void 0)throw new Error("Missing property");let o=AJ(i,r);o&&(this.videoElement=o,this.videoElement.loop=s===1/0,Kh&&(this.videoElement.autoplay=!0),a!==void 0&&(this.videoElement.volume=a)),n!==void 0&&(this.delay=n),hu.has(i.uuid)?hu.get(i.uuid).push(this):hu.set(i.uuid,[this]),eD.set(e,this),this.pause()}mute(){!this.videoElement||(this.videoElement.muted=!0)}unMute(){!this.videoElement||(this.videoElement.muted=!1)}play(e){if(!this.videoElement)return;let t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);e?(this.mute(),this.delay+=150):t?(this.mute(),window.setTimeout(()=>{this.unMute()},100)):this.unMute(),this.delayTimerId=window.setTimeout(()=>{if(!this.videoElement)return;let i=this.videoElement.play();i!==void 0&&i.then(r=>{}).catch(r=>{this.play()}),this.clearDelay()},this.delay),this.status="playing"}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}pause(){!this.videoElement||(this.videoElement.pause(),this.status="paused")}stop(){!this.videoElement||(this.videoElement.pause(),this.videoElement.currentTime=0,this.status="stopped",this.clearDelay())}seek(e){return new Promise(t=>{if(!this.videoElement)return t();let i=this.videoElement.duration;if(i>0){let r=e%i;this.videoElement.currentTime=r}this.videoElement.addEventListener("seeked",()=>t(),{once:!0})})}
vendor: 38,424 bytes, line 8106
8106playByToggle(){this.data.toggle==="stop"?this.status==="playing"?this.stop():(this.stop(),this.play()):this.data.toggle==="pause"?this.status==="playing"?this.pause():this.play():(this.stop(),this.play())}dispose(){!this.videoElement||(this.stop(),this.videoElement.muted=!0)}},Gy=class{constructor(e){this.data=e}dispatch(){this.data.playVideo?this.pauseVideo(this.data.playVideo):this.data.object?this.pauseAllVideosFromObject(this.data.object):this.pauseAllVideos()}pauseVideo(e){let t=eD.get(e);!t||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t[this.data.interaction](),this.disposeDelay()},this.data.delay)):t[this.data.interaction]())}pauseAllVideosFromObject(e){let t=hu.get(e);!t?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(i=>i[this.data.interaction]()),this.disposeDelay()},this.data.delay)):t.forEach(i=>i[this.data.interaction]()))}pauseAllVideos(){let e=[...hu.values()];!e.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(t=>{t.forEach(i=>{i[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):e.forEach(t=>{t.forEach(i=>{i[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},tD=class{constructor(e,t,i,r,s){if(this.data=t,this.shared=r,this.condition=s,t.interaction==="play")this.interaction=new to(e,t,i);else if(t.interaction==="pause"||t.interaction==="stop")this.interaction=new Gy(t);else throw new Error("Missing property")}dispatchBasic(){if(ii(this.shared,this.condition)===!1)return!1;this.interaction instanceof to?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(ii(this.shared,this.condition)===!1)return!1;this.interaction instanceof to?this.interaction.play():this.interaction.dispatch()}dispose(){this.interaction.dispose()}},Sv=(()=>{let e,t,i,r,s=!1;function a(h){!e&&!w2()&&(t?.sharedGameControlGlobals.createdObjects.length??0)>0&&(e=requestAnimationFrame(n)),h&&(t=h,r=h.requestRender,!s&&typeof document<"u"&&(document.addEventListener("visibilitychange",o),s=!0))}function n(h){if(!t||!r){e=void 0,i=void 0;return}let c=i?h-i:0,u=t.sharedGameControlGlobals.createdObjects,d=t.sharedGameControlGlobals.nCreatedPerAction,p=u.length,f=0;for(;f<p;){let m=u[f];m.userData.createdTime===void 0&&(m.userData.createdTime=h),m.userData.lifetime===void 0&&m.userData.quantity===void 0||m.userData.lifetime&&h-m.userData.createdTime<m.userData.lifetime||m.userData.quantity&&d[m.userData.actionId]<=m.userData.quantity?(m.userData.velocity&&(m.position.addScaledVector(m.userData.velocity,c/1e3),m.updateMatrix(),r()),f++):(d[m.userData.actionId]>m.userData.quantity&&d[m.userData.actionId]--,u.splice(f,1),m.removeFromParent(),t.sharedGameControlGlobals.rapierWorld&&m.rigidBody?(t.sharedGameControlGlobals.colliderToEntity.delete(m.rigidBody.collider(0).handle),t.sharedGameControlGlobals.rapierWorld.removeRigidBody(m.rigidBody)):(m.bvhGeometry=void 0,t.sharedGameControlGlobals.entitiesWithTransformAnim=t.sharedGameControlGlobals.entitiesWithTransformAnim.filter(g=>g.bvhGeometry!==void 0)),p--,r())}e=f>0?requestAnimationFrame(n):void 0,i=f>0?h:void 0}function o(){w2()?e&&(cancelAnimationFrame(e),e=void 0,i=void 0):a()}function l(){e&&(cancelAnimationFrame(e),e=void 0),s&&typeof document<"u"&&(document.removeEventListener("visibilitychange",o),s=!1),t=void 0,r=void 0,i=void 0}return{play:a,dispose:l}})();function w2(){return!!document&&document.hidden}var S2=new nt,MJ=new M,EJ=new M,iD=class{constructor(e,t,i,r,s){this.data=e,this.page=t,this.controlsManager=i,this.shared=r,this.condition=s,this.intervalId=null,this.timeoutIdQueue=[],this.uniqueId=Te.generateUUID(),this.dispatch=()=>{if(ii(this.shared,this.condition)===!1)return!1;this.data.delay?this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,this.data.delay*1e3)):this.dispatchInner()},this.dispatchFromStart=()=>{if(ii(this.shared,this.condition)===!1)return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,this.data.delay*1e3))},this.dispatchThrottled=X6(this.dispatch,1e3/this.data.creationSpeed),this.dispatchStart=()=>{this.intervalId===null&&(this.intervalId=window.setInterval(this.dispatch,1e3/this.data.creationSpeed))},this.dispatchStop=()=>{this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null)},this.dispatchInner=()=>{this.timeoutIdQueue.shift();let n=new vr(this.object);if(n.playModeVisible=!0,n.expand(),this.data.coordinateSystem!=="world"){let l=this.data.coordinateSystem,h=this.page.scene.find(l);h&&(h.updateMatrixWorldSVD(),n.hiddenMatrix.copy(h.matrixWorldRigid))}n.scale.copy(this.object.scale),n.position.fromArray(this.data.position.map(l=>typeof l=="number"?l:0)),n.rotation.fromArray(this.data.rotation.map(l=>typeof l=="number"?l:0)),n.updateMatrix(),this.page.add(n);let o=this.controlsManager.sharedGameControlGlobals;o.createdObjects.push(n),o.nCreatedPerAction[this.uniqueId]===void 0?o.nCreatedPerAction[this.uniqueId]=1:o.nCreatedPerAction[this.uniqueId]++,n.updateWorldMatrix(!0,!0),n.traverseObject(this.traverseObjectCB),Sv.play(),this.controlsManager.requestRender()},this.traverseObjectCB=n=>{n.hasNonUniformScale&&n.updateMatrixWorldSVD();let o;if(this.controlsManager.sharedGameControlGlobals.rapierWorld){if(n instanceof ys)if(n.objectForSample){if(n.objectForSample.dataPatched.physics.fusedBody)return;o=n.object}else return n.object.dataPatched.physics.fusedBody===!0&&n.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(n instanceof vr)o=n.object;else if(o=n,o.dataPatched.cloner?.hideBase)return!0}else{if(n instanceof ys)return;n instanceof vr?o=n.object:o=n}this.data.destroy==="Time"?n.userData.lifetime=this.data.lifetime*1e3:this.data.destroy==="Quantity"&&(n.userData.quantity=this.data.destroyAfterQuantity,n.userData.actionId=this.uniqueId);let l=new M().fromArray(this.data.velocity.map(c=>typeof c=="number"?c:0)),h=o.dataPatched;if(!(h.physics.enabled==="visibility"?!h.visible:!h.physics.enabled)&&(this.controlsManager.sharedGameControlGlobals.rapierWorld?(this.controlsManager.addRigidBody(n,o,{fromCreate:!0,dynamic:this.data.dynamic}),this.data.destroy==="Collision"&&(n.rigidBody?.collider(0).setActiveEvents(1),n.userData.hasCollisionDestroy=!0),n.matrixWorld.decompose(MJ,S2,EJ),l.applyQuaternion(S2),this.data.velocity.some(c=>c!==0)&&this.data.dynamic&&n.rigidBody?.setLinvel(l.divideScalar(this.controlsManager.pixelsPerMeter),!0)):("geometry"in n.object&&this.controlsManager.addBoundsTree(n),this.data.velocity.some(c=>c!==0)&&this.data.dynamic&&(n.userData.velocity=l)),o.dataPatched.physics?.fusedBody===!0))return!0};let a=this.page.scene.find(this.data.object);if(!a)throw new Error("Missing Property");if(this.object=a,this.data.coordinateSystem!=="world"&&!this.page.scene.find(this.data.coordinateSystem))throw new Error("Missing Property");Sv.play(i)}dispose(){this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null),this.timeoutIdQueue.forEach(e=>window.clearTimeout(e)),this.timeoutIdQueue=[],this.dispatchThrottled.cancel(),this.page.remove(...this.controlsManager.sharedGameControlGlobals.createdObjects),this.controlsManager.sharedGameControlGlobals.createdObjects=[],Sv.dispose()}},rD=200,_v=.02,Av=.3,CJ=65,_2=new M,A2=new M,TJ=new M,Dr=new M,Vr=new M,Ln=new M,Mv=new xe,M2=new xe,PJ=new xe,Os=new nt,Na=new nt,ia=new Di(0,0,0,"YXZ"),DJ=new M(1,0,0),Is=new M(0,1,0),OJ=new M(0,0,1),E2=new M(1,1,1),IJ=1,RJ=.025,LJ=16e-6,C2=12,zJ=20,Ji=new bs,cs=new yi,BJ={type:"requestRender"},FJ={type:"updateMatrix"},T2=Math.PI/6,Wy=class extends or{constructor(e,t,i,r,s,a,n,o,l){super(),this.object=e,this.domElement=t,this.data=i,this.gloabalPhysics=r,this.controlsManager=s,this.cameraFollow=a,this.camera=n,this.page=o,this.sharedAssets=l,this.enableDamping=!0,this.hiddenMatrix0=new xe,this.target0=new M,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=rD,this.euler0=new Di(0,0,0,"YXZ"),this.position0Cam=new M,this.quat0Cam=new nt,this.scale0Cam=new M,this.hiddenMatrix0Cam=new xe,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new bs(new M(0,-40,0),new M(0,40,0)),matrix:new xe,position:new M,rotation:new nt},this.euler=new Di(0,0,0,"YXZ"),this.eulerDelta=new M,this.lastPosition=new M,this.lastCameraQuaternion=new nt,this.lastCameraPosition=new M,this.PI_2=Math.PI/2,this.prevMouse=new H,this.velocityTarget=new M,this.velocity=new M,this.directionXZ=new M,this.rotVelocityStick=new M,this.rotVelocityTarget=new M,this.rotVelocity=new M,this.rotDirection=new M,this.nonColliderRotOffset=new xe,this.nonColliderPosOffset=new xe,this.firstPointerId=-1,this.rot=new M,this.path=[],this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.vrEulerYOffset=0,this.onObject=!1,this.actionState={},this.keyAssignments=[["moveNegZ","W"],["moveNegX","A"],["movePosZ","S"],["movePosX","D"],["rotPosX","ArrowUp"],["rotPosY","ArrowLeft"],["rotNegX","ArrowDown"],["rotNegY","ArrowRight"],["jump"," "]],this.collisionEnabled=!0,this.offsetMatrix=new xe,this.objectToTarget=new M,this.objectToTarget0=new M,this.objectToCamXZ=new M,this.objectToCamXZ0=new M,this.targetToCamera=new M,this.targetToCamera0=new M,this.cameraPolarAxis0=new M,this.targetPos=new M,this.targetQuat=new nt,this.lerpFactorPos=new M().setScalar(.3),this.lerpFactorPosStart=.3,this.lerpFactorPosEnd=.3,this.lerpFactorRotStart=.3,this.lerpFactorRotEnd=.3,this.lerpFactorPosCamera=.3,this.lerpFactorRotCamera=.3,this.objXZQuat=new nt,this.objXZQuatInv=new nt,this.objXZRotMat=new xe,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new M,this.pushedVelocity=new M,this.groundYRotation=0,this.objectRealQuat=new nt,this.colliderWorldQuat=new nt,this.groundNormal=new M,this.groundTilt=new nt,this.groundTiltInv=new nt,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new M,this.quaternion=new nt,this.scale=new M,this.initialAction=!0,this.onPointerDown=f=>{!(f.target===this.domElement||f.target instanceof HTMLElement&&f.target.tagName==="SPLINE-VIEWER"&&f.target.shadowRoot?.contains(this.domElement))||this.firstPointerId!==-1||(this.firstPointerId=f.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!ts&&!tS&&this.domElement.requestPointerLock(),this.prevMouse.set(f.clientX,f.clientY))},this.onPointerUp=f=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),f.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=f=>{if(f.pointerId!==this.firstPointerId)return;let m=f.clientX-this.prevMouse.x,g=f.clientY-this.prevMouse.y;this.prevMouse.set(f.clientX,f.clientY),f.pointerType==="mouse"&&this.rotBy!=="keys"&&(tS&&oH<15.5&&!ts?(this.eulerDelta.y=-m*this.mouseOrbitSensitivity,this.eulerDelta.x=-g*this.mouseOrbitSensitivity):(this.eulerDelta.y=-f.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-f.movementY*this.mouseOrbitSensitivity)),f.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-m*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-g*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=f=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?Wy.isLocked=!0:Wy.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document?.hidden)for(let f in this.movementState)this.movementState[f]=0},this.onKeyDown=f=>{!(f.target instanceof HTMLInputElement)&&(f.code==="ArrowLeft"||f.code==="ArrowUp"||f.code==="ArrowRight"||f.code==="ArrowDown"||f.code==="Space")&&f.preventDefault();for(let m of this.keyAssignments)if(f.key.toUpperCase()===m[1]||f.key===m[1]){this.movementState[m[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=f=>{for(let m of this.keyAssignments)if(f.key.toUpperCase()===m[1]||f.key===m[1]||f.code.slice(3,f.code.length).toUpperCase()===m[1]){this.movementState[m[0]]=0;break}},this.copyVRGamePadValues=(f,m)=>{for(let g=2;g<4;g++){let v=f.axes[g];m===0?g===2?this.movementState.movePosX=v:this.movementState.movePosZ=v:(f.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,g===2?(Math.abs(this.movementState.rotPosY)<.3&&Math.abs(v)>=.3&&(this.vrEulerYOffset+=v<0?1:-1),this.movementState.rotPosY=v):this.moveMode==="fly"&&(this.movementState.moveNegY=v))}},this.sharedGameControlGlobals=s.sharedGameControlGlobals,e===n&&(this.isFirstPerson=!0),this.hiddenMatrix0.copy(this.object.hiddenMatrix),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.euler0.setFromQuaternion(this.quaternion,"YXZ");let h=this.euler0.clone(),c=h.y;if(this.objectRealQuat.copy(this.quaternion),h.y=0,this.quaternion.setFromEuler(h),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),h.set(0,c,0),this.quaternion.setFromEuler(h),this.rot.setFromEuler(h),this.object.matrixAutoUpdate=!1,(this.isFirstPerson||this.cameraFollow===!0)&&(this.target0.copy(this.camera.getTarget()),this.zoom0=this.camera.zoom),this.cameraFollow===!0){this.position0Cam.copy(this.camera.position),this.quat0Cam.copy(this.camera.quaternion),this.scale0Cam.copy(this.camera.scale),this.hiddenMatrix0Cam.copy(this.camera.hiddenMatrix),this.camera.parent?(this.camera.hiddenMatrix.copy(this.camera?.parent.matrixWorld),this.camera.matrix.copy(this.camera.matrixWorld)):this.camera.hiddenMatrix.identity(),this.camera.matrix.copy(this.camera.matrixWorld),this.camera.matrix.decompose(this.camera.position,this.camera.quaternion,this.camera.scale),this.camera.matrixAutoUpdate=!1,this.offsetMatrix.copy(this.object.matrix).invert().multiply(this.camera.matrix);let f=new M(0,0,-1).applyQuaternion(this.camera.quaternion),m=new M().subVectors(this.position,this.camera.position);this.objectToCamXZ.copy(m),this.objectToCamXZ.y=0,this.objectToCamXZ0.copy(this.objectToCamXZ);let g,v;Math.abs(f.y)<1e-6?(m.y=0,f.y=0,v=m.projectOnVector(f)):m.y/f.y>0?v=f.multiplyScalar(m.y/f.y):v=f.multiplyScalar(m.length()),this.targetToCamera0.copy(v).negate(),g=this.camera.position.clone().add(v),this.objectToTarget0.subVectors(g,this.position);let y=new Di().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-y.x,y.x=0,y.z=0,y.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(y)}if(this.object instanceof qi&&(this.object.matrixAutoUpdate=!1),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.rotByTouch=i.rotByTouch??"joystick",this.rotBy=i.rotBy??"keys",this.rotationMode=i.rotationMode??"normal",this.moveMode=i.moveMode??"walk",this.collisionEnabled=i.collisionEnabled,this.speedTranslate=(i.speedTranslate??250)*IJ,this.speedOrbit=(i.speedRotate??100)*RJ,this.mouseOrbitSensitivity=(i.speedRotate??100)*LJ,this.keyAssignments=i.keyAssignments.map(f=>{let m=[f[0],f[1]];return m[1]==="▲"?m[1]="ArrowUp":m[1]==="◀"?m[1]="ArrowLeft":m[1]==="▼"?m[1]="ArrowDown":m[1]==="▶"?m[1]="ArrowRight":m[1]==="⇧"?m[1]="Shift":m[1]==="↵"?m[1]="Enter":m[1]==="Space"?m[1]=" ":m[1]==="⌘"?m[1]="Meta":m[1]==="Ctrl"?m[1]="Control":m[1]==="Esc"&&(m[1]="Escape"),m}),i.rotBy==="mouse"){let f;f=this.keyAssignments.findIndex(m=>m[0]==="rotNegX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(m=>m[0]==="rotPosX"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(m=>m[0]==="rotPosY"),f!==-1&&(this.keyAssignments[f][1]=""),f=this.keyAssignments.findIndex(m=>m[0]==="rotNegY"),f!==-1&&(this.keyAssignments[f][1]="")}this.lerpFactorPosStart=1-.02**(1/((i.delayPos[0]??.3)*60)),this.lerpFactorPosEnd=1-.02**(1/((i.delayPos[1]??.3)*60)),this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.lerpFactorRotStart=1-.02**(1/((i.delayRot[0]??.3)*60)),this.lerpFactorRotEnd=1-.02**(1/((i.delayRot[1]??.3)*60)),this.lerpFactorPosCamera=1-.02**(1/((i.delayPosCamera??.3)*60)),this.lerpFactorRotCamera=1-.02**(1/((i.delayRotCamera??.3)*60)),this.gravity=(this.gloabalPhysics.gravity??Oh.defaultData.gravity)*C2,this.usePhysics=this.gloabalPhysics.usePhysics??Oh.defaultData.usePhysics,this.jumpPower=i.jumpPower*zJ,this.resetYPosition=this.position.y+Math.abs(i.resetYPosition)*(this.gravity>0?1:-1),this.alignToGround=i.alignToGround??!1,this.orientMode=i.autoOrientMove?i.orientMode:"none",this.orientWith=i.orientWith??Pf.defaultDataThirdPerson.orientWith,this.slopeThresh=CJ*Math.PI/180,i.collider.type==="capsule"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=i.collider.height/2-i.collider.radius,this.collider.segment.end.y=-this.collider.segment.start.y,this.offset=i.collider.height*_v/this.pixelsPerMeter,this.stepThresh=i.collider.height*Av/this.pixelsPerMeter,this.colliderHeight=i.collider.height):i.collider.type==="sphere"?(this.collider.radius=i.collider.radius,this.collider.segment.start.y=0,this.collider.segment.end.y=0,this.offset=2*i.collider.radius*_v/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*Av/this.pixelsPerMeter,this.colliderHeight=i.collider.radius*2):(this.offset=i.collider.height*_v/this.pixelsPerMeter,this.stepThresh=i.collider.height*Av/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let u=new M().fromArray(i.collider.position.map(f=>typeof f=="number"?f:0)),d=new nt().setFromEuler(new Di().fromArray([...i.collider.rotation.map(f=>typeof f=="number"?f:0),"XYZ"]));this.collider.position.copy(u).multiply(this.scale),this.collider.rotation.copy(d),this.collider.matrix.compose(u,d,E2),i.cameraXAxis!==void 0&&(this.cameraXAxis=i.cameraXAxis,this.cameraYAxis=i.cameraYAxis,this.minPolarAngle=i.cameraRotXLimits[0],this.maxPolarAngle=i.cameraRotXLimits[1],this.minAzimuthAngleRel=i.cameraRotYLimits[0],this.maxAzimuthAngleRel=i.cameraRotYLimits[1]),this.forwardDir=i.forwardDirection??"-z",this.isFirstPerson&&(this.forwardDir="-z"),this.runMultiplier=i.runMultiplier??2;let p=i.navmesh.destinationHelperRadius*2;if(p>0){let f=new Ue;f.push({fi:0,data:{..._i.defaultData("light","phong"),alpha:0},id:"layer1"}),f.push({fi:0,data:{..._i.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let m=new yx({layers:f},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Zt(NC.create({parameters:{width:p,height:p/10,hollow:.7}}),m),this.navMeshPathDest.material.userData.opacity0=i.navmesh.destinationHelperColor.a}this.activate()}reset(e=!1){if(this.object.hiddenMatrix.copy(this.hiddenMatrix0),e){this.object.updateMatrix(),this.object.updateMatrixWorld(),this.object.matrix.copy(this.object.matrixWorld),this.object.matrix.decompose(this.position,this.quaternion,this.scale),this.object.parent?this.object.hiddenMatrix.copy(this.object.parent.matrixWorld).invert():this.object.hiddenMatrix.identity();let t=new Di().setFromQuaternion(this.quaternion,"YXZ"),i=t.y;this.objectRealQuat.copy(this.quaternion),t.y=0,this.quaternion.setFromEuler(t),this.objXZQuat.copy(this.quaternion),this.objXZQuatInv.copy(this.objXZQuat).invert(),this.objXZRotMat.makeRotationFromQuaternion(this.quaternion),t.set(0,i,0),this.quaternion.setFromEuler(t),this.rot.setFromEuler(t),this.euler.setFromQuaternion(this.quaternion,"YXZ"),this.velocityTarget.set(0,0,0),this.velocity.set(0,0,0)}else this.object instanceof qi?this.object.matrixAutoUpdate=!0:this.object.updateMatrix();this.cameraFollow===!0&&(this.camera.quaternion.copy(this.quat0Cam),this.camera.position.copy(this.position0Cam),this.camera.scale.copy(this.scale0Cam),this.camera.hiddenMatrix.copy(this.hiddenMatrix0Cam),this.camera.matrixAutoUpdate=!0),this.controlsManager.requestRender()}activate(){this.instantiateActions(),this.domElement.ownerDocument.addEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.addEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.addEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.addEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.addEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.addEventListener("visibilitychange",this.handleVisibilityChange)}deactivate(){this.disposeActions(),this.domElement.ownerDocument.removeEventListener("pointerdown",this.onPointerDown),this.domElement.ownerDocument.removeEventListener("keydown",this.onKeyDown),this.domElement.ownerDocument.removeEventListener("keyup",this.onKeyUp),this.domElement.ownerDocument.removeEventListener("pointerlockchange",this.onPointerlockChange),this.domElement.ownerDocument.removeEventListener("pointerlockerror",this.onPointerlockError),this.domElement.ownerDocument.removeEventListener("visibilitychange",this.handleVisibilityChange)}dispose(){this.deactivate(),this.navMeshPathDest?.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let e=this.data,t=this.sharedAssets;e.gameActions!==void 0&&(this.actions={},Tf.list.forEach(i=>{this.actions[i]=Bi({...e,disabled:!1,type:"GameControl"},e.gameActions[i],this.page,t,this.controlsManager.eventManager,this.object)})),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"),this.initialAction&&(this.initialAction=!1)}disposeActions(){this.initialAction=!1,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),ar(this.actions.idle),ar(this.actions.move),ar(this.actions.run),ar(this.actions.jump)}dispatchStartEvent(e){this.actions[e]!==void 0&&(this.actionState[e]||(this.actionState[e]=!0,this.actions[e].Transition.forEach(t=>{t.play()}),this.actions[e].Animation.forEach(t=>{t.play(this.initialAction===!1)}),this.actions[e].TimelineAnimation.forEach(t=>{t.play()}),this.actions[e].Create.forEach(t=>{t.dispatchStart()}),this.actions[e].Audio.forEach(t=>{t.dispatchGameControl("start")}),this.actions[e].Particles.forEach(t=>{t.dispatchGameControl("start")})))}dispatchStopEvent(e){this.actions[e]!==void 0&&(!this.actionState[e]||(this.actionState[e]=!1,this.actions[e].Transition.forEach(t=>{t.stop(),t.object.currentState!==null&&t.object.changeSelectedState(null,{scene:this.page.scene,shared:this.sharedAssets})}),this.actions[e].TimelineAnimation.forEach(t=>{t.stop()}),this.actions[e].Create.forEach(t=>{t.dispatchStop()}),this.actions[e].Audio.forEach(t=>{t.dispatchGameControl("stop")}),this.actions[e].Particles.forEach(t=>{t.dispatchGameControl("stop")})))}get colliderWorldPosition(){return Dr.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e,t,i){if(this.gravity<0?this.position.y<this.resetYPosition:this.position.y>this.resetYPosition)return this.reset(!0),!0;this.sharedGameControlGlobals.gamePads.forEach(this.copyVRGamePadValues);let r=(this.isFirstFrame?16.6:e)/1e3;this.isFirstFrame&&(this.isFirstFrame=!1);let s=r*60,a=!1;if(this.usePhysics&&this.collisionEnabled&&this.object.rigidBody?.collider(0).shape){let o=Vr.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/(10*C2),1)*(this.gravity>0?1:-1):this.velocity.y)*r,0).divideScalar(this.pixelsPerMeter),l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,o,this.object.rigidBody?.collider(0).shape,1,!1,16,void 0,void 0,this.object.rigidBody);if(l){this.onObject=!0,this.groundNormal.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(a=!0),l.collider.parent()?.bodyType()===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let h=l.collider.parent();this.groundYRotation=0,this.groundVelocity.set(0,0,0);for(let c of this.sharedGameControlGlobals.entitiesWithTransformAnim)if(c.rigidBody===h&&c.userData.isFollowingObj!==this.object.uuid){(c.hasNonUniformScale?c.matrixWorldRigid:c.matrixWorld).decompose(Dr,Na,Vr),this.groundVelocity.subVectors(Dr,c.prevT),this.object.getWorldPosition(Vr).add(this.collider.position).sub(Dr),this.groundYRotation=ia.setFromQuaternion(Na).y-c.prevR.y,Ln.copy(Vr).applyAxisAngle(Is,this.groundYRotation),this.groundVelocity.add(Ln.sub(Vr)).divideScalar(r);break}}else this.onObject=!1}if(this.moveMode==="walk"&&this.collisionEnabled&&(this.movementState.jump===1&&this.onObject&&(this.velocityTarget.y=this.jumpPower,this.movementState.jump=0,this.dispatchStopEvent("idle"),this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.dispatchStopEvent("jump"),this.dispatchStartEvent("jump"),this.onObject=!1),this.onObject?this.velocityTarget.y/=2:this.velocityTarget.y+=this.gravity*s),this.moveMode==="fly"&&(this.velocityTarget.y=(this.movementState.movePosY-this.movementState.moveNegY)*this.speedTranslate),this.directionXZ.z=this.movementState.movePosZ-this.movementState.moveNegZ,this.directionXZ.x=this.movementState.movePosX-this.movementState.moveNegX,this.forwardDir==="+z"&&this.directionXZ.multiplyScalar(-1),this.directionXZ.manhattanLength()>0&&(this.path=[]),this.navMeshPathDest){let o=this.navMeshPathDest.material;if(this.moveMode==="walk"&&this.path.length>1){this.navMeshPathDest.position.copy(this.path[this.path.length-1]),this.navMeshPathDest.parent||this.page.add(this.navMeshPathDest);let l=Dr.subVectors(this.path[1],this.position),h=Vr.subVectors(this.path[1],this.path[0]);l.dot(h)<0?this.path.shift():(this.directionXZ.x=h.x,this.directionXZ.z=h.z),o.opacity=o.userData.opacity0}else o.opacity-=.05*o.userData.opacity0,this.navMeshPathDest.material.opacity<=0&&this.navMeshPathDest.parent&&this.page.remove(this.navMeshPathDest)}this.directionXZ.normalize(),this.movementState.run?this.moveForce=this.runMultiplier:this.moveForce=1,this.velocityTarget.z=this.directionXZ.z*this.speedTranslate*this.moveForce,this.velocityTarget.x=this.directionXZ.x*this.speedTranslate*this.moveForce,(this.moveMode==="walk"?this.velocityTarget.x+this.velocityTarget.z===0:this.velocityTarget.manhattanLength()===0)?this.lerpFactorPos.setScalar(this.lerpFactorPosEnd):this.lerpFactorPos.setScalar(this.lerpFactorPosStart),this.moveMode==="walk"&&(this.lerpFactorPos.y=1),this.didHit===!1&&this.pushedVelocity.manhattanLength()===0||this.usePhysics===!1?(this.velocity.x+=(this.velocityTarget.x-this.velocity.x)*(1-(1-this.lerpFactorPos.x)**s),this.velocity.y+=(this.velocityTarget.y-this.velocity.y)*(1-(1-this.lerpFactorPos.y)**s),this.velocity.z+=(this.velocityTarget.z-this.velocity.z)*(1-(1-this.lerpFactorPos.z)**s)):this.velocity.copy(this.velocityTarget),(this.moveMode==="walk"?this.velocity.x**2+this.velocity.z**2<this.speedTranslate:this.velocity.lengthSq()<this.speedTranslate)?(this.dispatchStopEvent("move"),this.dispatchStopEvent("run"),this.onObject&&(this.dispatchStopEvent("jump"),this.dispatchStartEvent("idle"))):(this.dispatchStopEvent("idle"),(this.onObject||this.moveMode==="fly")&&(this.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let n=TJ.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let o=Vr.copy(n);o.y=0,n.set(0,n.y,o.length()*(this.forwardDir==="+z"?1:-1))}if(this.directionXZ.manhattanLength()>0&&this.orientMode!=="none"&&this.isFirstPerson===!1)if(this.orientWith==="camera"&&this.path.length<=1){let o=Dr;this.camera.getWorldDirection(o);let l=Ln.copy(Is).multiplyScalar(o.dot(Is));o.sub(l);let h=Vr.copy(this.directionXZ);h.x*=-1,this.rot.y=o.angleTo(h)*(o.cross(h).y>0?-1:1)+this.rotationAccumWhenOrientWithCamera}else this.rot.y=(this.path.length>1?0:this.euler.y)+Math.atan2(-this.directionXZ.z,this.directionXZ.x)+Math.PI/2*(this.forwardDir==="+z"?1:-1);if(ia.setFromVector3(this.rot),this.moveMode==="walk"&&(ia.x=0),n.applyEuler(ia),a&&(Na.setFromUnitVectors(Is,this.groundNormal),n.applyQuaternion(Na)),i){let o=ia.set(0,this.vrEulerYOffset*T2,0);i.applyEuler(o),n.x+=i.x,n.z+=i.z,this.nonColliderPosOffset.elements[13]+=i.y*r}if(this.usePhysics===!0&&this.object.rigidBody){let o=Vr;this.pushedVelocity.set(0,0,0);for(let l of this.sharedGameControlGlobals.entitiesWithTransformAnim){let h=Ln.setFromMatrixPosition(l.matrixWorld).sub(l.prevT).divideScalar(r).divideScalar(this.pixelsPerMeter),c=l.rigidBody.collider(0).castCollider(h,this.object.rigidBody.collider(0),Dr.copy(n).divideScalar(this.pixelsPerMeter),r,!1);h.multiplyScalar(this.pixelsPerMeter);let u=Tt.is(l)?l:l.object;if(c!==null&&this.lastHitObj!==u){let d;l instanceof vr&&(d=l);let p=this.sharedGameControlGlobals.entityToCollisionEvents[u.uuid];if(p)for(let f of p)f.data.target==="character"&&(f.dispatch(d),u.dispatchEvent(Xy));this.lastHitObj=u}if(c!==null){this.pushedVelocity.copy(h),o.copy(c.normal1).applyQuaternion(l.quaternion);break}}if(this.pushedVelocity.manhattanLength()!==0){let l=o.dot(n);l<0&&n.addScaledVector(o,-l),n.add(this.pushedVelocity)}else n.add(this.groundVelocity)}if(this.rotDirection.y=Number(this.movementState.rotPosY)-Number(this.movementState.rotNegY),this.rotDirection.x=Number(this.movementState.rotPosX)-Number(this.movementState.rotNegX),this.rotDirection.normalize(),this.rotationMode==="normal"&&(this.movementState.rotPosX||this.movementState.rotNegX)||this.rotationMode==="steer"&&(this.movementState.rotPosX||this.movementState.rotNegX)&&(this.movementState.movePosZ||this.movementState.moveNegZ||this.moveMode==="walk")?this.rotVelocityStick.x=-this.rotDirection.x*this.speedOrbit*this.rotForce:this.rotVelocityStick.x=0,this.rotationMode==="normal"&&(this.movementState.rotPosY||this.movementState.rotNegY)||this.rotationMode==="steer"&&(this.movementState.rotPosY||this.movementState.rotNegY)&&(this.movementState.movePosZ||this.movementState.moveNegZ)?this.rotVelocityStick.y=-this.rotDirection.y*this.speedOrbit*this.rotForce:this.rotVelocityStick.y=0,this.rotVelocityTarget.subVectors(this.eulerDelta.divideScalar(r),this.rotVelocityStick),this.rotVelocityTarget.manhattanLength()===0?this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotEnd)**s):this.rotVelocity.lerp(this.rotVelocityTarget,1-(1-this.lerpFactorRotStart)**s),this.euler.x+=this.rotVelocity.x*r,this.euler.y+=this.rotVelocity.y*r+this.groundYRotation,this.rotVelocityTarget.y===0&&this.directionXZ.manhattanLength()===0?this.rotationAccumWhenOrientWithCamera=0:(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.rotationAccumWhenOrientWithCamera+=this.rotVelocity.y*r),this.isFirstPerson===!1&&this.orientMode!=="none"&&this.directionXZ.manhattanLength()>0){if(this.orientMode==="radial"){this.objectToCamXZ.copy(this.objectToCamXZ0).applyAxisAngle(Is,this.euler.y-this.euler0.y);let o=Vr.copy(this.objectToCamXZ).normalize(),l=Ln.copy(n).multiplyScalar(r);l.y=0;let h=l.sub(Dr.copy(o).multiplyScalar(l.dot(o))).cross(o).y;this.euler.y-=Math.atan2(h,this.objectToCamXZ.length())}}else this.rot.y+=this.rotVelocity.y*r+this.groundYRotation,this.rotVelocityTarget.y!==0&&(this.cameraFollow===!1||this.cameraYAxis==="Locked")&&(this.euler.y=this.rot.y);if(this.cameraFollow===!0&&(this.moveMode==="walk"?this.cameraXAxis==="Limit"?this.euler.x=Te.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=Te.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=Te.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(t?(ia.copy(t),ia.y=0):(ia.copy(this.euler),ia.y=0),this.nonColliderRotOffset.makeRotationFromEuler(ia)),t&&(this.moveMode==="walk"?(this.rot.y=t.y,this.rot.x=0,this.rot.z=0):this.rot.setFromEuler(t),this.rot.y+=this.vrEulerYOffset*T2),Os.setFromAxisAngle(DJ,this.rot.x),Na.setFromAxisAngle(Is,this.rot.y),Na.multiply(Os),Os.setFromAxisAngle(OJ,this.rot.z),Na.multiply(Os),this.quaternion.copy(Na),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics&&this.object.rigidBody?.collider(0).shape){let o=Vr.copy(n).multiplyScalar(r/this.pixelsPerMeter),l=null;this.didHit=!1;let h=new M;for(let c=0;c<5;c++){let u=o.length(),d=Ln.copy(o).normalize();if(l=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(h),this.colliderWorldQuat,d,this.object.rigidBody.collider(0).shape,u,!1,24,void 0,void 0,this.object.rigidBody),l!==null){this.didHit=!0;let p=this.sharedGameControlGlobals.colliderToEntity.get(l.collider.handle);if(p!==this.lastHitObj&&c===0){this.lastHitObj=p;let v=this.sharedGameControlGlobals.entityToCollisionEvents[p?.uuid];if(v){for(let y of v)if(y.data.target==="character"){let x=(this.sharedGameControlGlobals.rapierWorld?.getCollider(l.collider.handle))._parent,w;if(p.cloner){for(let S of p.cloner.children)if(S.rigidBody===x){w=S;break}}y.dispatch(w),p.dispatchEvent(Xy)}}}let f=_2.set(l.normal2.x,l.normal2.y,l.normal2.z).applyQuaternion(this.colliderWorldQuat),m=A2.copy(d).multiplyScalar(l.toi).dot(f),g=l.toi;if(g===0&&(this.position.y+=this.offset*this.pixelsPerMeter),m>this.offset&&(g=l.toi*(m-this.offset)/m,h.addScaledVector(d,g)),o.copy(d).multiplyScalar(u-g),Math.acos(-f.y)>this.slopeThresh){let v=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(h),y=Ln.copy(l.witness2).applyQuaternion(this.colliderWorldQuat);y.y=0;let x=v.add(y);x.y+=this.stepThresh;let w=this.sharedGameControlGlobals.rapierWorld.castShape(x,this.colliderWorldQuat,o,this.object.rigidBody?.collider(0).shape,1,!1,24,void 0,void 0,this.object.rigidBody);w!==null&&w.toi===0&&(f.y=0,f.normalize())}o.addScaledVector(f,-o.dot(f))}else{c===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),h.add(o);break}}this.position.addScaledVector(h,this.pixelsPerMeter),this.object.rigidBody?.setTranslation(Dr.copy(this.position).divideScalar(this.pixelsPerMeter),!0),this.object.rigidBody?.setRotation(Os.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat),!0)}else{let o=this.onObject?1:5,l=n.multiplyScalar(r/o);for(let h=0;h<o;h++)this.position.add(l),this.collisionAdjustment(r/o)}else this.position.addScaledVector(n,r);if(this.moveMode==="walk"&&this.onObject&&(this.velocityTarget.y=0,this.velocity.y=0),this.quaternion.premultiply(this.groundTilt).multiply(this.objXZQuat),this.object.matrix.compose(this.position,this.quaternion,this.scale),this.object.matrixWorldNeedsUpdate=!0,this.object.matrix.multiply(this.nonColliderPosOffset).multiply(this.nonColliderRotOffset),this.quaternion.premultiply(this.groundTiltInv).multiply(this.objXZQuatInv),this.cameraFollow===!0){this.updateFollowArms();let o=this.objectToTarget.add(this.position),l=this.targetToCamera.add(o);Mv.lookAt(l,o,Is).setPosition(l),Mv.decompose(this.targetPos,this.targetQuat,Dr),this.camera.quaternion.slerp(this.targetQuat,1-(1-this.lerpFactorRotCamera)**s),this.camera.position.lerp(this.targetPos,1-(1-this.lerpFactorPosCamera)**s),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraYAxis==="Limit"&&this.orientMode==="cartesian"&&(this.euler.y=Te.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=Te.clamp(this.euler.x,-this.PI_2+(this.cameraPolarOffset<0?this.cameraPolarOffset:0),this.PI_2+(this.cameraPolarOffset>0?this.cameraPolarOffset:0))}return this.eulerDelta.set(0,0,0),this.object.dispatchEvent(FJ),this.path.length<2&&this.lastPosition.distanceToSquared(this.position)<this.threshEndTranslate&&Math.abs(this.rotVelocity.x)<this.threshEndRotVel&&Math.abs(this.rotVelocity.y)<this.threshEndRotVel&&(this.camera===void 0||this.isFirstPerson||this.lastCameraPosition.distanceToSquared(this.camera.position)<this.threshEndTranslate&&8*(1-this.lastCameraQuaternion.dot(this.camera.quaternion))<this.threshEndRotate)&&(this.moveMode==="fly"||this.onObject===!0||this.collisionEnabled===!1)&&(this.navMeshPathDest===null||this.navMeshPathDest.material.opacity<-.04*this.navMeshPathDest?.material?.userData.opacity0)?!1:(this.camera&&(this.lastCameraPosition.copy(this.camera.position),this.lastCameraQuaternion.copy(this.camera.quaternion)),this.lastPosition.copy(this.position),this.object.dispatchEvent(BJ),!0)}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e=Os.setFromAxisAngle(Is,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?Te.clamp(this.euler.y-this.euler0.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel):this.euler.y-this.euler0.y);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&this.objectToTarget.applyQuaternion(e);let t;this.cameraXAxis==="Limit"?t=Te.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):t=Te.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=Dr.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(e);let r=Na.setFromAxisAngle(i,t);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(r)}groundTiltAdjustment(e){Is.angleTo(e)*180/Math.PI<15||Is.angleTo(e)*180/Math.PI>85?Os.identity():Os.setFromUnitVectors(Is,e),this.groundTilt.slerp(Os,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){let t=A2.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);
8106let i=Mv.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Dr,Os,Vr).compose(Dr,Os,E2);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(s=>{if(s===this.object||s.isDescendantOf(this.object)||!s.bvhGeometry||!s.bvhGeometry.boundsTree)return;cs.makeEmpty(),s.updateMatrixWorldSVD();let a=s.matrixWorldRigid,n=M2.copy(a).invert(),o=PJ.copy(M2).multiply(i);Ji.copy(this.collider.segment),Ji.start.applyMatrix4(o),Ji.end.applyMatrix4(o);let l=_2.copy(this.position).applyMatrix4(n);cs.expandByPoint(Ji.start),cs.expandByPoint(Ji.end),cs.min.addScalar(-this.collider.radius),cs.max.addScalar(this.collider.radius),s.bvhGeometry.boundsTree.shapecast({traverseBoundsOrder(h){return h.distanceToPoint(Ji.end)},intersectsBounds:h=>h.intersectsBox(cs),intersectsTriangle:h=>{let c=Dr,u=Vr,d=h.closestPointToSegment(Ji,c,u);if(d<this.collider.radius){let p=this.collider.radius-d,f=u.sub(c).normalize(),m=Ln.copy(l);m.addScaledVector(f,p);let g=m.applyMatrix4(a).sub(this.position);t.add(g),Ji.start.addScaledVector(f,p),Ji.end.addScaledVector(f,p)}}})}),cs.makeEmpty(),Ji.copy(this.collider.segment),Ji.start.applyMatrix4(i),Ji.end.applyMatrix4(i),cs.expandByPoint(Ji.start),cs.expandByPoint(Ji.end),cs.min.addScalar(-this.collider.radius),cs.max.addScalar(this.collider.radius),this.sharedGameControlGlobals.staticMeshBVH?.shapecast({traverseBoundsOrder(s){return s.distanceToPoint(Ji.end)},intersectsBounds:s=>s.intersectsBox(cs),intersectsTriangle:s=>{let a=Dr,n=Vr,o=s.closestPointToSegment(Ji,a,n);if(o<this.collider.radius){let l=this.collider.radius-o,h=n.sub(a).normalize();this.alignToGround&&this.groundTiltAdjustment(h),t.addScaledVector(h,l),Ji.start.addScaledVector(h,l),Ji.end.addScaledVector(h,l)}}}),this.onObject=Math.abs(t.y)>Math.abs(e*this.velocity.y*.25),this.onObject&&this.dispatchStopEvent("jump");let r=Math.max(0,t.length()-1e-5);t.normalize().multiplyScalar(r),this.position.add(t)}pause(){this.firstPointerId=-1,this.movementState={moveNegZ:0,movePosZ:0,moveNegX:0,movePosX:0,moveNegY:0,movePosY:0,rotPosX:0,rotNegX:0,rotPosY:0,rotNegY:0,jump:0,run:0},this.deactivate()}resume(){this.activate()}},sD=Wy;sD.isLocked=!1;var kJ=mo(Z2());function aD(e){let t=e.elements,i=t[0]**2+t[1]**2+t[2]**2,r=t[4]**2+t[5]**2+t[6]**2,s=t[8]**2+t[9]**2+t[10]**2,a=t[0]**2+t[4]**2+t[8]**2,n=t[1]**2+t[5]**2+t[9]**2,o=t[2]**2+t[6]**2+t[10]**2,l=1e-8;return i<l||r<l||s<l||a<l||n<l||o<l}function Za(e,t){let i=new He;if(t&&aD(t))return i.setAttribute("position",new De([],3)),i.setIndex([]),i;if(!e.getAttribute("position"))return i.setAttribute("position",new De([],3)),i.setIndex([]),i;let{positions:r,triIndices:s}=wm(e.getAttribute("position"),e.getIndex());return i.setAttribute("position",new De(r,3)),i.setIndex(s),t&&i.applyMatrix4(t),i}var UJ=new xe,NJ=new xe,ra=[[0,0,0],[0,0,0],[0,0,0]];function nD(e){let t=e.elements;ra[0][0]=t[0],ra[0][1]=t[4],ra[0][2]=t[8],ra[1][0]=t[1],ra[1][1]=t[5],ra[1][2]=t[9],ra[2][0]=t[2],ra[2][1]=t[6],ra[2][2]=t[10];let{u:i,v:r}=(0,kJ.SVD)(ra),s=UJ.set(i[0][0],i[0][1],i[0][2],0,i[1][0],i[1][1],i[1][2],0,i[2][0],i[2][1],i[2][2],0,0,0,0,1),a=NJ.set(r[0][0],r[0][1],r[0][2],0,r[1][0],r[1][1],r[1][2],0,r[2][0],r[2][1],r[2][2],0,0,0,0,1);return s.multiply(a.transpose())}var VJ=class extends GM{constructor(){super(),this.layers.enable(3),this.layers.enable(8),this.layers.enable(9)}setFromCamera(e,t){t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):t.isPerspectiveCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):console.error("Raycaster: Unsupported camera type.")}intersectVisibleObjects(e,t=!0,i=[]){return e.forEach(r=>{r.visible&&this.intersectObject(r,t,i)}),i}createRaycastLineHelper(){let e=new vo({color:65280,linewidth:10}),t=new M(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),i=new M(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),r=this.camera.far-this.camera.near,s=new M().addVectors(t,i.multiplyScalar(r)),a=new He;return a.setFromPoints([t,s]),new Qp(a,e)}},oD=e=>e instanceof xh||e instanceof bh;function jJ(e,t){return e.distance-t.distance}function lD(e,t,i){if(!(!Ka(t)||!t.visible)){fa(t)&&t.raycast(e,i);for(let r of t.children)lD(e,r,i)}}function jp(e,t,i,r=!1){if(!r&&!i.some(a=>Kf(e,a)!==void 0))return[];let s=[];
vendor: 18,821 bytes, line 8106
8106return t.children.forEach(a=>lD(e,a,s)),s.sort(jJ),s}function qy(e){let t=[];if(e.length){let i=e[0].object;Ka(i)&&t.push(i);let r=i.parent;for(;r;)oD(r)&&t.push(r),r=r.parent}return t}function Ja(e,t,i,r){let s=e.frame;if(s){let a=t[0]*s.width,n=(1-t[1])*s.height;for(let o of i){let l=o===s.uuid?s:s.find(o);if(l?.intersects(a,n))return r(l),!0}}return!1}function Kf(e,t){if(fa(t)){if(t.visible){let i=[];return t.raycast(e,i),i.length?i[0]:void 0}}else if(oD(t))return hD(e,t)}function hD(e,t){if(!(!Ka(t)||!t.visible)){if(fa(t)){let i=[];if(t.raycast(e,i),i.length)return i[0]}for(let i of t.children){let r=hD(e,i);if(r)return r}}}function HJ(e,t,i){return{x:(e-(i.left+window.scrollX))/i.width*2-1,y:-((t-(i.top+window.scrollY))/i.height)*2+1}}function GJ(e,t,i){return{x:(e-(i.left+window.scrollX))/i.width,y:1-(t-(i.top+window.scrollY))/i.height}}var WJ=class{constructor(e,t,i,r,s,a,n,o){this.renderer=e,this.publish=t,this.scene=i,this.getCamera=r,this.sharedAssets=s,this.requestRender=a,this.isExport=n,this.frame=o,this.raycaster=new VJ,this._useWindowEvents=!1,this.pointerWorld={x:0,y:0},this.pointerScreen={x:0,y:0},this._useWindowEvents=t.mouseEventTarget==="window",this.domElement=e.domElement,this.eventElement=this._useWindowEvents?window:e.domElement,this._domRect=this.domElement.getBoundingClientRect()}get stopRaycast(){return this.publish.stopRaycast}get page(){return this.scene.activePage}set useWindowEvents(e){this._useWindowEvents=e,this.eventElement=e?window:this.renderer.domElement}get useWindowEvents(){return this._useWindowEvents}set domRect(e){this._domRect=e}get domRect(){return this._domRect}updateRaycaster(e){let{pageX:t,pageY:i}=e.touches?.length>0?e.touches[0]:e;this.pointerWorld=HJ(t,i,this._domRect),this.pointerScreen=GJ(t,i,this._domRect),this.raycaster.setFromCamera(this.pointerWorld,this.getCamera())}dispose(){this.scene=void 0,this.sharedAssets=void 0,this.publish=void 0,this.getCamera=void 0,this.requestRender=void 0,this.frame=void 0,this.isExport=void 0}},Er=class{constructor(e){this.eventContext=e,this.domEventsNeeded=new Set,this.hasVideoAction=!1}connect(){}disconnect(){}dispose(){this.disconnect(),this.eventContext=void 0}},kx=[["start","Start"],["keyDown","KeyDown"],["keyUp","KeyUp"],["mouseDown","MouseDown"],["mouseUp","MouseUp"],["mouseHover","MouseHover"],["collision","Collision"],["lookAt","LookAt"],["follow","Follow"],["scroll","Scroll"]],cD=e=>kx.find(([t,i])=>i===e)?.[0],Qu=e=>kx.find(([t])=>t===e)?.[1],qJ=(e,t)=>{let i=cD(e);if(i){let r=new CustomEvent(i,{bubbles:!0});return Object.defineProperty(r,"target",{writable:!1,value:t}),r}},XJ=class extends Er{constructor(){super(...arguments),this.objectsPerEvents=new Map,this.splineEvents={},this.onBeginEvent=e=>{if(!e.eventName||!e.target||e.eventName==="Scroll")return;let t=this.splineEvents[cD(e.eventName)]?.[e.target.uuid];if(!t)return;e.eventName==="Scroll"&&e.deltaY!==void 0&&Object.assign(t,{deltaY:e.deltaY});let{domElement:i}=this.eventContext;i.dispatchEvent(t)}}connect(){let{page:e}=this.eventContext;e.traverseEntity(t=>{if(t.data?.events.length){for(let[i,r]of kx)if(t.data.events.some(s=>s.data.type===r&&!s.data.disabled)){this.objectsPerEvents.has(i)?this.objectsPerEvents.get(i)?.push(t):this.objectsPerEvents.set(i,[t]);let s={id:t.uuid,name:t.name},a=qJ(r,s),n=this.splineEvents[i];n?n[t.uuid]=a:this.splineEvents[i]={[t.uuid]:a}}}}),this.objectsPerEvents.forEach(t=>{t.forEach(i=>{i.addEventListener("beginEvent",this.onBeginEvent)})})}disconnect(){this.objectsPerEvents.forEach(e=>{e.forEach(t=>{t.removeEventListener("beginEvent",this.onBeginEvent)})})}},YJ=class{constructor(e,t,i,r,s,a){if(this.id=e,this.data=t,this.object=i,this.entered=!1,(t.type==="KeyDown"||t.type==="KeyUp"||t.type==="KeyPress")&&!t.key)throw new Error("Missing property");this.actions=Bi(t,t.actions,r,s,a,i)}disconnect(){ar(this.actions)}dispatchHeld(e){this.actions.Create.forEach(t=>{e&&t.dispatchThrottled.cancel(),t.dispatchThrottled()})}dispatch(e=!1){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.data.type==="MousePress"||this.data.type==="KeyPress"?this.entered||(this.entered=!0,this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.playFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.playFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent()),this.actions.Create.forEach(t=>t.dispatchStart())):(this.actions.Transition.some(t=>t.playing&&t.data.runMode!=="Toggle")||this.actions.Transition.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.SwitchCamera.some(t=>t.playing&&t.data.runMode!=="Toggle")||this.actions.SwitchCamera.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Animation.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()})),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),e===!1&&this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}dispatchRelease(){this.entered&&(this.entered=!1,this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Particles.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStop()))}dispatchUserEvent(e){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),e?(this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.reverseFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.playFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.playFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent())),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}},QJ=class extends Er{constructor(e,t,i){super(e),this.eventManager=t,this.useForRaycastProperty=i,this.objectsPerTypes={MouseDown:[],MouseUp:[],MousePress:[],KeyDown:[],KeyUp:[],KeyPress:[]},this.canvasMouseEvents=[],this.eventsPerObjects={MouseDown:{},MouseUp:{},MousePress:{},KeyDown:{},KeyUp:{},KeyPress:{}},this.heldKeys={},this.heldKeysPress={},this._prevObjects=[],this.sceneInterects=null,this.onCanvasRaycast=r=>{if(this.useForRaycastProperty===!0&&this.sceneInterects===null){this.eventContext.updateRaycaster(r);let{raycaster:s,page:a}=this.eventContext,n=jp(s,a,[],!0);this.sceneInterects=n,n.length&&(this.eventContext.sharedAssets.raycastProperty={x:n[0].point.x,y:n[0].point.y,z:n[0].point.z,objX:n[0].object.matrixWorld.elements[12],objY:n[0].object.matrixWorld.elements[13],objZ:n[0].object.matrixWorld.elements[14]})}},this.onCanvasMouseDown=r=>{(r.target===this.eventContext.domElement||r.target.tagName==="SPLINE-VIEWER")&&this.canvasMouseEvents.forEach(s=>{(s.data.type==="MouseDown"||s.data.type==="MousePress")&&(this.onCanvasRaycast(r),s.dispatch())})},this.onCanvasMouseUp=r=>{(r.target===this.eventContext.domElement||r.target.tagName==="SPLINE-VIEWER")&&this.canvasMouseEvents.forEach(s=>{s.data.type==="MouseUp"?(this.onCanvasRaycast(r),s.dispatch()):s.data.type==="MousePress"&&s.dispatchRelease()})},this.onMouseDown=r=>{at.length>1||(this.eventContext.updateRaycaster(r),this.handleMouseEvent("MouseDown"))},this.onMouseUp=r=>{at.length>1||(this.eventContext.updateRaycaster(r),this.handleMouseEvent("MouseUp"))},this.onMousePressDown=r=>{at.length>1||(this.eventContext.updateRaycaster(r),this.handleMousePressEvent())},this.onMousePressRelease=r=>{at.length>1||(this.eventContext.updateRaycaster(r),this.handleMousePressEvent(!0))},this.onKeyDown=r=>{this.heldKeys[r.key]||(this.handleKeyEvent(r,"KeyDown"),this.handleKeyEventHeld(r,"KeyDown",!0)),this.heldKeys[r.key]=!0},this.onKeyUp=r=>{this.handleKeyEvent(r,"KeyUp"),this.handleKeyEventHeld(r,"KeyUp",!0)},this.onKeyPressDown=r=>{this.heldKeysPress[r.key]?this.handleKeyEventHeld(r,"KeyPress"):(this.handleKeyEvent(r,"KeyPress"),this.handleKeyEventHeld(r,"KeyPress",!0)),this.heldKeysPress[r.key]=!0},this.onKeyPressUp=r=>{this.handleKeyEvent(r,"KeyPress",!0)},this.releaseHeldKey=r=>{delete this.heldKeys[r.key]},this.releaseHeldKeyPress=r=>{delete this.heldKeysPress[r.key]},this._onUserEvent=({eventName:r,target:s,reverse:a})=>{if(!r||!s)return;let n=Qu(r);n&&(n==="MouseDown"||n==="MouseUp"||n==="MousePress"?(s.dispatchEvent({type:"beginEvent",eventName:n}),this.eventsPerObjects[n]?.[s.uuid]?.forEach(o=>{o.dispatchUserEvent(a)}),this.canvasMouseEvents.forEach(o=>{o.dispatchUserEvent(a)})):(n==="KeyDown"||n==="KeyUp"||n==="KeyPress")&&(s.dispatchEvent({type:"beginEvent",eventName:n}),this.eventsPerObjects[n]?.[s.uuid]?.forEach(o=>{o.dispatchUserEvent()})))}}connect(){let{page:e,sharedAssets:t,domElement:i}=this.eventContext,r=(s,a)=>{if(!s.data?.events.length)return;let n=["MouseDown","MouseUp","MousePress","KeyDown","KeyUp","KeyPress"];for(let o of n){let l=this.eventsPerObjects[o];if(s.data.events.filter(({data:h})=>h.type===o&&h.disabled!==!0).forEach(({id:h,data:c})=>{try{let u=new YJ(h,c,s,e,t,this.eventManager);u.actions.Video.length&&(this.hasVideoAction=!0),(c.type==="MouseDown"||c.type==="MouseUp"||c.type==="MousePress")&&(c.mode==="Canvas"||c.mode==="Window")?this.canvasMouseEvents.push(u):(l[s.uuid]?l[s.uuid].some(d=>d.id===u.id)||l[s.uuid].push(u):l[s.uuid]=[u],s instanceof nl&&s.traverseChildren(d=>{if(!d.visible)return!0;d instanceof ai&&"shapeBlendNode"in d.data.geometry&&d.data.geometry.shapeBlendNode?.operation!==2&&(l[d.uuid]?l[d.uuid].push(u):l[d.uuid]=[u])}))}catch{}}),l[s.uuid]?.length&&(this.objectsPerTypes[o].push(s instanceof nr&&(o==="MouseDown"||o==="MouseUp"||o==="MousePress")?a:s),s instanceof nl)){let h=this.objectsPerTypes[o];s.traverseChildren(c=>{if(!c.visible)return!0;c instanceof ai&&h.indexOf(c)===-1&&h.push(c)})}}};e.traverseEntity(s=>{(s instanceof _r||s instanceof er)&&s.frame?.traverse(a=>{r(a,s)}),r(s)}),this.heldKeys={},this.heldKeysPress={},this.domEventsNeeded.clear(),i.addEventListener("pointerdown",this.onCanvasMouseDown),i.addEventListener("pointerup",this.onCanvasMouseUp),(this.objectsPerTypes.MouseDown?.length||this.useForRaycastProperty)&&(this.domEventsNeeded.add("pointerdown"),i.addEventListener("pointerdown",this.onMouseDown)),this.objectsPerTypes.MouseUp?.length&&(this.domEventsNeeded.add("pointerup"),i.addEventListener("pointerup",this.onMouseUp)),this.objectsPerTypes.MousePress?.length&&(this.domEventsNeeded.add("pointerdown"),i.addEventListener("pointerdown",this.onMousePressDown),this.domEventsNeeded.add("pointerup"),i.addEventListener("pointerup",this.onMousePressRelease)),this.objectsPerTypes.KeyDown?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.releaseHeldKey)),this.objectsPerTypes.KeyUp?.length&&(this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyUp)),this.objectsPerTypes.KeyPress?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyPressDown),document.addEventListener("keyup",this.releaseHeldKeyPress),this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyPressUp)),Object.entries(this.objectsPerTypes).forEach(([s,a])=>{a.forEach(n=>{n.addEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(s=>{s.object.addEventListener("userEvent",this._onUserEvent)})}disconnect(){let{domElement:e}=this.eventContext;this.domEventsNeeded.clear(),this.heldKeys={},this.heldKeysPress={},e.removeEventListener("pointerdown",this.onCanvasMouseDown),e.removeEventListener("pointerup",this.onCanvasMouseUp),e.removeEventListener("pointerdown",this.onMouseDown),e.removeEventListener("pointerdown",this.onMousePressDown),e.removeEventListener("pointerup",this.onMouseUp),e.removeEventListener("pointerup",this.onMousePressRelease),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp),document.removeEventListener("keydown",this.onKeyPressDown),document.removeEventListener("keyup",this.onKeyPressUp),document.removeEventListener("keyup",this.releaseHeldKey),Object.values(this.eventsPerObjects).forEach(t=>{Object.values(t).forEach(i=>{i.forEach(r=>{r.disconnect()})})}),this.canvasMouseEvents.forEach(t=>{t.disconnect()}),Object.entries(this.objectsPerTypes).forEach(([t,i])=>{i.forEach(r=>{r.removeEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(t=>{t.object.removeEventListener("userEvent",this._onUserEvent)})}handleMouseEvent(e){let{stopRaycast:t,raycaster:i,page:r,pointerScreen:s}=this.eventContext,a=this.objectsPerTypes[e],n=a.filter(o=>!(o instanceof nr));if(!(!a.length&&!this.useForRaycastProperty)&&!(r.uiCanvas&&Ja(r,[s.x,s.y],Object.keys(this.eventsPerObjects[e]),o=>{this.handleObjectMouseEventDispatch(o,e)}))){if(t||this.useForRaycastProperty){let o;if(this.sceneInterects===null?o=jp(i,r,n,this.useForRaycastProperty):(o=this.sceneInterects,this.sceneInterects=null),this.useForRaycastProperty&&o.length&&(this.eventContext.sharedAssets.raycastProperty={x:o[0].point.x,y:o[0].point.y,z:o[0].point.z,objX:o[0].object.matrixWorld.elements[12],objY:o[0].object.matrixWorld.elements[13],objZ:o[0].object.matrixWorld.elements[14]}),t){let l=[o[0]?.uv?.x??0,o[0]?.uv?.y??0];qy(o).forEach(h=>{h instanceof _r&&Ja(h,l,Object.keys(this.eventsPerObjects[e]),c=>{this.handleObjectMouseEventDispatch(c,e)}),this.eventsPerObjects[e][h.uuid]&&this.handleObjectMouseEventDispatch(h,e)})}}t||n.forEach(o=>{let l=Kf(i,o);l&&(this.handleObjectMouseEventDispatch(o,e),o instanceof _r&&Ja(o,[l?.uv?.x??0,l?.uv?.y??0],Object.keys(this.eventsPerObjects[e]),h=>{this.handleObjectMouseEventDispatch(h,e)}))})}}handleMousePressEvent(e=!1){let t="MousePress",i=this.objectsPerTypes[t],r=i.filter(a=>!(a instanceof nr)),s=[];if(i.length){if(!e){let{stopRaycast:a,raycaster:n,page:o,pointerScreen:l}=this.eventContext,h=!1;if(o.uiCanvas&&(h=Ja(o,[l.x,l.y],Object.keys(this.eventsPerObjects[t]),c=>{s.push(c)})),a&&!h){let c=jp(n,o,r);s=qy(c),c.forEach(u=>{u.object instanceof _r&&Ja(u.object,[u?.uv?.x??0,u?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),d=>{s.push(d)})})}else r.forEach(c=>{let u=Kf(n,c);u&&(s.push(c),c instanceof _r&&Ja(c,[u?.uv?.x??0,u?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),d=>{s.push(d)}))})}this._prevObjects.length&&this._prevObjects.forEach(a=>{s.includes(a)||this.handleObjectMouseEventDispatchRelease(a,t)}),s.length&&s.forEach(a=>{this.handleObjectMouseEventDispatch(a,t)}),this._prevObjects=s}}handleObjectMouseEventDispatch(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(i=>{i.dispatch()})}handleObjectMouseEventDispatchRelease(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(i=>{i.dispatchRelease()})}handleKeyEvent(e,t,i=!1){this.objectsPerTypes[t].forEach(r=>{let s=this.eventsPerObjects[t][r.uuid];s.some(({data:a})=>"key"in a&&a.key===e.key)&&r.dispatchEvent({type:"beginEvent",eventName:t}),s.forEach(a=>{"key"in a.data&&a.data.key===e.key&&(i?a.dispatchRelease():a.dispatch(!0))})})}handleKeyEventHeld(e,t,i=!1){this.objectsPerTypes[t].forEach(r=>{this.eventsPerObjects[t][r.uuid].forEach(s=>{"key"in s.data&&s.data.key===e.key&&s.dispatchHeld(i)})})}},KJ=new M,ZJ=new M,uD=class{constructor(e,t,i,r,s){this.actionsIn=Bi(e,e.inActions,i,r,s,t),this.actionsOut=Bi(e,e.outActions,i,r,s,t)}disconnect(){ar(this.actionsIn),ar(this.actionsOut)}},JJ=class extends uD{constructor(e,t,i,r,s,a){super(t,i,r,s,a),this.id=e,this.data=t,this.object=i,this.stage="out",this.objects=[],this.onUpdateMatrixWorld=()=>{for(let d of this.objects)if(!d.visible)return;let h=KJ.setFromMatrixPosition(this.objects[0].matrixWorld),c=ZJ.setFromMatrixPosition(this.objects[1].matrixWorld),u=h.distanceTo(c)<=this.distance?"in":"out";if(this.stage!==u){this.stage=u;let d=u==="in"?this.actionsIn:this.actionsOut;d.Audio.forEach(p=>p.dispatchConditional()),d.Particles.forEach(p=>p.dispatchConditional()),d.Video.forEach(p=>p.dispatchConditional()),d.Link.forEach(p=>p.dispatch()),d.Create.forEach(p=>p.dispatch()),d.Destroy.forEach(p=>p.dispatch()),d.Reset.forEach(p=>p.dispatch()),d.Transition.forEach(p=>{p.object.currentTransitionEvent!==this&&(p.object.currentTransitionEvent=this),p.init()}),d.Transition.forEach(p=>p.play()),d.Animation.forEach(p=>p.play()),d.TimelineAnimation.forEach(p=>p.play()),d.SwitchCamera.forEach(p=>p.play()),d.SceneTransition.forEach(p=>p.dispatch()),d.SetVariable.forEach(p=>p.checkConditions()),d.SetVariable.forEach(p=>p.dispatch()),d.DynamicVariablePlay.forEach(p=>p.dispatch()),d.ClearLocalStorage.forEach(p=>p.dispatch()),d.UserAPI.forEach(p=>p.dispatch())}};let{distance:n,fromObject:o,toObject:l}=t.condition;this.distance=n;for(let h of[o,l]){if(!h)throw new Error("Missing property");let c=r.find(h);if(!c)throw new Error("Missing property");this.objects.push(c)}}connect(){window.setTimeout(()=>{this.objects.forEach(e=>{e.addEventListener("updateMatrixWorld",this.onUpdateMatrixWorld)}),this.onUpdateMatrixWorld()},0)}disconnect(){super.disconnect(),this.stage="out",this.objects.forEach(e=>{e.removeEventListener("updateMatrixWorld",this.onUpdateMatrixWorld)})}},$J=class extends uD{constructor(e,t,i,r,s,a){super(t,i,r,s,a),this.id=e,this.data=t,this.object=i,this.onBegin=({target:l,state:h})=>
8106{this.toState!==h&&(this.actionsOut.Audio.forEach(c=>c.dispatchConditional()),this.actionsOut.Particles.forEach(c=>c.dispatchConditional()),this.actionsOut.Video.forEach(c=>c.dispatchConditional()),this.actionsOut.Link.forEach(c=>c.dispatch()),this.actionsOut.Create.forEach(c=>c.dispatch()),this.actionsOut.Destroy.forEach(c=>c.dispatch()),this.actionsOut.Reset.forEach(c=>c.dispatch()),this.actionsIn.Transition.forEach(c=>c.pause()),this.object.currentTransitionEvent=this,this.actionsOut.Transition.forEach(c=>c.play()),this.actionsOut.Animation.forEach(c=>c.play()),this.actionsOut.TimelineAnimation.forEach(c=>c.play()),this.actionsIn.SwitchCamera.forEach(c=>c.pause()),this.actionsOut.SwitchCamera.forEach(c=>c.play()),this.actionsOut.SceneTransition.forEach(c=>c.dispatch()),this.actionsOut.SetVariable.forEach(c=>c.checkConditions()),this.actionsOut.SetVariable.forEach(c=>c.dispatch()),this.actionsOut.DynamicVariablePlay.forEach(c=>c.dispatch()),this.actionsOut.ClearLocalStorage.forEach(c=>c.dispatch()),this.actionsOut.UserAPI.forEach(c=>c.dispatch()))},this.onComplete=({target:l,state:h})=>
8106{this.toState===h&&(this.actionsIn.Audio.forEach(c=>c.dispatchConditional()),this.actionsIn.Particles.forEach(c=>c.dispatchConditional()),this.actionsIn.Video.forEach(c=>c.dispatchConditional()),this.actionsIn.Link.forEach(c=>c.dispatch()),this.actionsIn.Create.forEach(c=>c.dispatch()),this.actionsIn.Destroy.forEach(c=>c.dispatch()),this.actionsIn.Reset.forEach(c=>c.dispatch()),this.actionsOut.Transition.forEach(c=>c.pause()),this.actionsOut.Transition.forEach(c=>c.pause()),this.object.currentTransitionEvent=this,this.actionsIn.Transition.forEach(c=>c.play()),this.actionsIn.Animation.forEach(c=>c.play()),this.actionsIn.TimelineAnimation.forEach(c=>c.play()),this.actionsOut.SwitchCamera.forEach(c=>c.pause()),this.actionsIn.SwitchCamera.forEach(c=>c.play()),this.actionsIn.SceneTransition.forEach(c=>c.dispatch()),this.actionsIn.SetVariable.forEach(c=>c.checkConditions()),this.actionsIn.SetVariable.forEach(c=>c.dispatch()),this.actionsIn.DynamicVariablePlay.forEach(c=>c.dispatch()),this.actionsOut.ClearLocalStorage.forEach(c=>c.dispatch()),this.actionsOut.UserAPI.forEach(c=>c.dispatch()))};let{condition:n}=t;if(!n.object)throw new Error("Missing property");let o=r.find(n.object)??r.scene.find2D(n.object);if(!o)throw new Error("Missing property");if(this.toObject=o,n.state&&!this.toObject.states?.[n.state])throw new Error("Missing property");this.toState=n.state}connect(){ko(this.actionsOut).forEach(e=>{this.actionsOut[e]?.length&&this.toObject.addEventListener("beginState",this.onBegin)}),ko(this.actionsIn).forEach(e=>{this.actionsIn[e]?.length&&this.toObject.addEventListener("completeState",this.onComplete)})}disconnect(){super.disconnect(),ko(this.actionsOut).forEach(e=>{this.actionsIn[e]?.length&&this.toObject.removeEventListener("beginState",this.onBegin)}),ko(this.actionsIn).forEach(e=>{this.actionsIn[e]?.length&&this.toObject.removeEventListener("completeState",this.onComplete)})}},e$=class extends Er{constructor(e,t){super(e),this.eventManager=t,this.eventsPerConditions={Comparison:[],Distance:[],State:[]},this.hasVideoAction=!1}connect(){super.connect();let{page:e,sharedAssets:t}=this.eventContext;e.traverseEntity(i=>{if(i.data?.events.length){for(let{id:r,data:s}of i.data.events)if(!s.disabled&&s.type==="Conditional")try{let a;s.condition.type==="Comparison"||(s.condition.type==="Distance"?a=new JJ(r,s,i,e,t,this.eventManager):s.condition.type==="State"&&(a=new $J(r,s,i,e,t,this.eventManager))),a&&(this.eventsPerConditions[s.condition.type].push(a),(a.actionsIn.Video.length||a.actionsOut.Video.length)&&(this.hasVideoAction=!0))}catch{}}}),Object.values(this.eventsPerConditions).forEach(i=>i.forEach(r=>r.connect()))}disconnect(){super.disconnect(),Object.values(this.eventsPerConditions).forEach(e=>e.forEach(t=>t.disconnect()))}},Tc=new M,zn=new M,Eo=new M,P2=new Hr,t$=.01,Ft=new M,Vi=new M,D2=new M,Go=new nt,Ev=new Di,i$=new xe,Cv=new Ii,Vl=new M,sa=new M,jl=.2;function Tv(e,t){!t||(t[0]<t[1]&&(e.x=Math.min(Math.max(e.x,t[0]),t[1])),t[2]<t[3]&&(e.y=Math.min(Math.max(e.y,t[2]),t[3])),t[4]<t[5]&&(e.z=Math.min(Math.max(e.z,t[4]),t[5])))}var r$=(function(){let e=new xe;return(t,i,r)=>{let s=t.obj;e.copy(s.hiddenMatrix),s.parent!==null&&e.premultiply(s.parent.matrixWorld),e.invert(),s.position.copy(i),t.reference==="global"&&Tv(s.position,t.limits),s.position.applyMatrix4(e),t.reference==="parent"?Tv(s.position,t.limits):t.reference==="local"&&(Go.copy(t.quat0).invert(),s.position.sub(t.position0),s.position.applyQuaternion(Go),Tv(s.position,t.limits),Go.invert(),s.position.applyQuaternion(Go),s.position.add(t.position0)),e.multiply(r??s.matrixWorld).decompose(Ft,s.quaternion,Vi),s.updateMatrix(),s.hasNonUniformScale&&(s.updateMatrixWorld(),s.updateMatrixWorldSVD()),s instanceof xr&&ln(s.parent)&&s.invalidateDownstreamBooleanData(!0)}})(),s$=class{constructor(e,t,i,r,s,a,n){this.object=e,this.id=t,this.data=i,this.dropDestIds=[],this.activeIdx=null,this.wasDragEventTriggered=!1,this.resetDampingFactor=this.data.resetSpeed===0?1:8/this.data.resetSpeed+1,this.snapDampingFactor=this.data.snapSpeed===0?1:8/this.data.snapSpeed+1,this.actionsDrag=Bi(i,i.dragDropActions.drag,r,s,a,this.object),this.actionsDrop=Bi(i,i.dragDropActions.drop,r,s,a,this.object);let o=[];
vendor: 23,432 bytes, line 8106
8106this.data.objects.forEach(l=>{let h=r.find(l);!h||h.data.visible!==!1&&(o.push(h),n[h.uuid]&&n[h.uuid].forEach(c=>{let u=r.find(c);!u||u.data.visible!==!1&&o.push(u)}))}),this.data.dropDestinations.forEach(l=>{let h=r.find(l);!h||h.data.visible!==!1&&(this.dropDestIds.push(h.uuid),n[h.uuid]&&n[h.uuid].forEach(c=>{let u=r.find(c);!u||u.data.visible!==!1&&this.dropDestIds.push(u.uuid)}))}),this.dragItems=o.map(l=>(this.data.planeMode==="locked"&&(l.userData.lockedPlane=!0),l.userData.worldPosition0=new M().setFromMatrixPosition(l.matrixWorld),{obj:l,fromPosition:new M().setFromMatrixPosition(l.matrixWorld),pointStart:new M,pointEnd:new M,paused:!0,currentDampingFactor:this.data.dampingFactor,reset:!1,position0:new M().copy(l.position),quat0:new nt().copy(l.quaternion),snapped:!1,orientationMatrix:new xe,limits:this.data.limits,reference:this.data.referenceFrame}))}get activeDragItem(){return this.activeIdx!==null?this.dragItems[this.activeIdx]:null}dispose(){ar(this.actionsDrag),ar(this.actionsDrop),this.dragItems.forEach(e=>{e.fromPosition.copy(e.obj.userData.worldPosition0),e.pointStart.copy(e.fromPosition),e.pointEnd.copy(e.pointStart),e.obj.recursiveBBoxNeedsUpdate=!0,e.obj.userData.lockedPlane=void 0,e.obj.position.copy(e.position0),e.obj.quaternion.copy(e.quat0),e.obj.updateMatrix()})}},a$=class extends Er{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.lastDropDestination=null,this.dragTimeout=null,this.onPointerDown=i=>{if(at.length>1)return;this.eventContext.updateRaycaster(i);let{raycaster:r,page:s}=this.eventContext,a=s.raycastWithClones(r);if(this.lastDropDestination=null,a.length===0){this.activeEvent=null;return}for(let n of this.events){let o=0;for(let{obj:l,pointEnd:h,pointStart:c}of n.dragItems){if(l===a[0].object||l===a[0].object.object||Tt.is(l)&&l.isAncestorOf(a[0].object.uuid)){if(n.activeIdx=o,n.activeDragItem.reset=!1,n.activeDragItem.currentDampingFactor=n.data.dampingFactor,n.activeDragItem.snapped=!1,n.data.cursor==="hand"&&this.setCursor("grabbing"),this.eventManager.controlsManager.usePhysics){n.activeDragItem.obj.rigidBody&&n.activeDragItem.obj.rigidBody.setBodyType(2,!0);let u=n.activeDragItem.obj;l.hasNonUniformScale&&l.updateMatrixWorldSVD(),(u.hasNonUniformScale?u.matrixWorldRigid:u.matrixWorld).decompose(Ft,Go,Vi),Ev.setFromQuaternion(Go),u.prevR===void 0?(u.prevR=Ev.clone(),u.prevT=Ft.clone()):(u.prevR.copy(Ev),u.prevT.copy(Ft)),this.eventManager.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.push(n.activeDragItem.obj)}this.calcPlaneIntersectPos(l,c,n.data.plane,n.data.referenceFrame),h.copy(c),(this.eventManager.controlsManager.usePhysics&&l.data.physics?.rigidBody==="dynamic"||n.data.drop===!1||n.data.resetOnSnapFail===!1)&&n.activeDragItem.fromPosition.setFromMatrixPosition(n.activeDragItem.obj.matrixWorld),this.activeEvent=n,this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1);return}o++}}this.activeEvent=null},this.onPointerMove=i=>{if(at.length>1)return;this.eventContext.updateRaycaster(i);let{raycaster:r,page:s}=this.eventContext,a=s.raycastWithClones(r);if(at.length===0){let n=!1;for(let o of this.events){for(let{obj:l}of o.dragItems)if(l===a[0]?.object||l===a[0]?.object?.object||Tt.is(l)&&l.isAncestorOf(a[0]?.object.uuid)){switch(n=!0,o.data.cursor){case"hand":this.setCursor("grab");break;case"move":this.setCursor("move");break}break}if(n)break}n||this.setCursor("default");return}if(this.activeEvent&&this.activeEvent.activeDragItem){let n=this.activeEvent.activeDragItem;n.snapped=!1;let o;if(this.activeEvent.data.drop&&(o=a.filter(l=>n.obj!==l.object&&!n.obj.isAncestorOf(l.object.uuid)&&!(l.object instanceof xh)&&(this.activeEvent.data.dropOn==="all"||this.activeEvent.dropDestIds.some(h=>h===l.object.uuid||s.scene.find(h).isAncestorOf(l.object.uuid))))[0]),o){let l=D2.copy(o.face.normal).applyMatrix3(Cv.getNormalMatrix(o.object.matrixWorld));if(this.activeEvent.data.snapTo==="center")n.fromPosition.setFromMatrixPosition(o.object.matrixWorld);else if(this.activeEvent.data.snapTo==="surface"){if(n.fromPosition.copy(o.point),this.activeEvent.data.snapSurfaceMode==="bbox"){Ft.copy(l).applyMatrix3(Cv.setFromMatrix4(n.obj.matrixWorld).transpose());let h=n.obj;Ft.x>jl?Vi.x=-h.recursiveBBox.min.x:Ft.x<-jl&&(Vi.x=-h.recursiveBBox.max.x),Ft.y>jl?Vi.y=-h.recursiveBBox.min.y:Ft.y<-jl&&(Vi.y=-h.recursiveBBox.max.y),Ft.z>jl?Vi.z=-h.recursiveBBox.min.z:Ft.z<-jl&&(Vi.z=-h.recursiveBBox.max.z),Vi.applyMatrix3(Cv.invert())}else Vi.copy(l).multiplyScalar(this.activeEvent.data.snapSurfaceOffset);n.fromPosition.add(Vi)}this.activeEvent.data.autoOrient&&(Ft.set(0,1,0).cross(l),Ft.length()<1e-4&&Ft.set(-1,0,0).cross(l),Vi.crossVectors(D2,Ft),n.orientationMatrix.makeBasis(Ft,Vi,l)),n.pointStart.copy(n.fromPosition),n.pointEnd.copy(n.pointStart),n.currentDampingFactor=this.activeEvent.snapDampingFactor,n.snapped=!0,this.lastDropDestination!==o.object&&(this.lastDropDestination=o.object,this.activeEvent.actionsDrop.Transition.forEach(h=>{h.play()}),this.activeEvent.actionsDrop.Animation.forEach(h=>{h.play()}),this.activeEvent.actionsDrop.Audio.forEach(h=>{h.dispatchGameControl("start")}),this.activeEvent.actionsDrop.Particles.forEach(h=>{h.dispatchGameControl("start")}),this.activeEvent.actionsDrop.Create.forEach(h=>{h.dispatchThrottled()}))}else n.orientationMatrix.makeRotationFromQuaternion(n.quat0),this.lastDropDestination=null,n.currentDampingFactor=this.activeEvent.data.dampingFactor,this.calcPlaneIntersectPos(n.obj,n.pointEnd,this.activeEvent.data.plane,this.activeEvent.data.referenceFrame),this.activeEvent.actionsDrop.Transition.forEach(l=>{l.stop(),l.object.currentState!==null&&l.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrop.Animation.forEach(l=>{l.stop()}),this.activeEvent.actionsDrop.Audio.forEach(l=>{l.dispatchGameControl("stop")}),this.activeEvent.actionsDrop.Particles.forEach(l=>{l.dispatchGameControl("stop")});this.activeEvent.actionsDrag.Create.forEach(l=>{l.dispatchThrottled()}),this.activeEvent.actionsDrag.SetVariable.forEach(l=>l.checkConditions()),this.activeEvent.actionsDrag.SetVariable.forEach(l=>l.dispatch()),this.activeEvent.actionsDrag.DynamicVariablePlay.forEach(l=>l.dispatch()),this.activeEvent.actionsDrag.ClearLocalStorage.forEach(l=>l.dispatch()),this.activeEvent.actionsDrag.UserAPI.forEach(l=>l.dispatch()),this.activeEvent.wasDragEventTriggered===!1&&(this.activeEvent.wasDragEventTriggered=!0,this.activeEvent.actionsDrag.Transition.forEach(l=>{l.play()}),this.activeEvent.actionsDrag.Animation.forEach(l=>{l.play()}),this.activeEvent.actionsDrag.Audio.forEach(l=>{l.dispatchGameControl("start")}),this.activeEvent.actionsDrag.Particles.forEach(l=>{l.dispatchGameControl("start")})),this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>{!this.activeEvent||(this.activeEvent.wasDragEventTriggered=!1,this.activeEvent.actionsDrag.Audio.forEach(l=>{l.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Particles.forEach(l=>{l.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Transition.forEach(l=>{l.stop(),l.object.currentState!==null&&l.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrag.Animation.forEach(l=>{l.stop()}))},500),this.updateDragItem(n),n.obj.dispatchEvent({type:"requestRender"})}},this.onPointerUp=i=>{if(this.activeEvent&&this.activeEvent.activeDragItem){this.activeEvent.data.cursor==="hand"&&this.setCursor("grab");let r=this.activeEvent.activeDragItem.obj.data.physics?.rigidBody==="dynamic";this.activeEvent.activeDragItem.snapped===!1&&this.activeEvent.data.drop&&this.activeEvent.data.resetOnSnapFail&&(this.eventManager.controlsManager.usePhysics===!1||!r)&&(this.activeEvent.activeDragItem.reset=this.activeEvent.data.resetOnSnapFail,this.activeEvent.activeDragItem.paused=!1,this.activeEvent.activeDragItem.currentDampingFactor=this.activeEvent.resetDampingFactor),this.eventManager.controlsManager.usePhysics&&r&&(this.eventManager.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.pop(),this.activeEvent.activeDragItem.obj.rigidBody.setBodyType(0,!0),this.activeEvent.activeDragItem.paused=!0),this.activeEvent.wasDragEventTriggered===!0&&(this.activeEvent.wasDragEventTriggered=!1,this.activeEvent.actionsDrag.Transition.forEach(s=>{s.stop(),s.object.currentState!==null&&s.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrag.Animation.forEach(s=>{s.stop()}),this.activeEvent.actionsDrag.Audio.forEach(s=>{s.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Particles.forEach(s=>{s.dispatchGameControl("stop")}),this.activeEvent.actionsDrop.SetVariable.forEach(s=>s.checkConditions()),this.activeEvent.actionsDrop.SetVariable.forEach(s=>s.dispatch()),this.activeEvent.actionsDrop.DynamicVariablePlay.forEach(s=>s.dispatch()),this.activeEvent.actionsDrop.ClearLocalStorage.forEach(s=>s.dispatch()),this.activeEvent.actionsDrop.UserAPI.forEach(s=>s.dispatch())),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0)}}}connect(){let e={};if(this.eventContext.page.traverseEntity(i=>{i.component&&(e[i.component.uuid]?e[i.component.uuid].push(i.uuid):e[i.component.uuid]=[i.uuid])}),this.eventContext.page.traverseEntity(i=>{i.data?.events.filter(r=>r.data.type==="DragDrop"&&!r.data.disabled).forEach(r=>{this.events.push(new s$(i,r.id,r.data,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager,e))})}),!this.events.length)return;this.domEventsNeeded.clear(),this.domEventsNeeded.add("pointerdown");let t=this.eventContext.domElement;t.addEventListener("pointerdown",this.onPointerDown),t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.domEventsNeeded.add("pointermove")}disconnect(){if(!this.events.length)return;this.domEventsNeeded.clear();let e=this.eventContext.domElement;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),this.events.forEach(t=>t.dispose())}setCursor(e){this.eventContext.domElement.style.cursor=e}onAnimationFrameDamping(){for(let e of this.events)for(let t of e.dragItems)t.paused||this.updateDragItem(t,!0)}calcPlaneIntersectPos(e,t,i,r){let{getCamera:s,raycaster:a}=this.eventContext;s().getWorldDirection(zn),zn.negate();let n=Go.identity();switch(r==="parent"?i$.multiplyMatrices(e.parent.matrixWorld,e.hiddenMatrix).decompose(Ft,n,Vi):r==="local"&&e.matrixWorld.decompose(Ft,n,Vi),i){case"x":Ft.set(1,0,0).applyQuaternion(n),Vl.copy(zn).cross(Ft),sa.copy(Ft).cross(Vl);break;case"y":Ft.set(0,1,0).applyQuaternion(n),Vl.copy(zn).cross(Ft),sa.copy(Ft).cross(Vl);break;case"z":Ft.set(0,0,1).applyQuaternion(n),Vl.copy(zn).cross(Ft),sa.copy(Ft).cross(Vl);break;case"xy":sa.set(0,0,1).applyQuaternion(n);break;case"yz":sa.set(1,0,0).applyQuaternion(n);break;case"xz":sa.set(0,1,0).applyQuaternion(n);break;case"adaptive":zn.angleTo(Vi.set(0,1,0))>Math.PI/6?(Ft.crossVectors(Vi.set(0,1,0),zn),sa.crossVectors(Ft,Vi)):sa.set(0,1,0);break;default:sa.copy(zn);break}Eo.setFromMatrixPosition(e.matrixWorld);let o=e.userData.lockedPlane?e.userData.worldPosition0:Eo;if(P2.setFromNormalAndCoplanarPoint(sa,o),!!a.ray.intersectPlane(P2,t)&&(i==="x"||i==="y"||i==="z")){let l=Vi.subVectors(t,o).dot(Ft);t.copy(o).addScaledVector(Ft,l)}}updateDragItem(e,t=!1){Eo.setFromMatrixPosition(e.obj.matrixWorld),e.reset==="current"?Tc.subVectors(e.fromPosition,Eo).divideScalar(e.currentDampingFactor):e.reset==="original"?(Tc.subVectors(e.obj.userData.worldPosition0,Eo).divideScalar(e.currentDampingFactor),e.fromPosition.copy(e.obj.userData.worldPosition0),e.pointStart.copy(e.fromPosition),e.pointEnd.copy(e.pointStart)):Tc.subVectors(e.pointEnd,e.pointStart).add(e.fromPosition).sub(Eo).divideScalar(e.currentDampingFactor),e.paused=e.currentDampingFactor>1?Tc.length()<t$:!0,(this.activeEvent&&this.activeEvent.data.dampingFactor===1||t)&&r$(e,Tc.add(Eo),this.activeEvent?.data.drop&&this.activeEvent?.data.autoOrient?e.orientationMatrix:null),e.obj.dispatchEvent({type:"beginEvent",eventName:"DragDrop"}),this.eventManager.requestRender()}},Hl=new M,Pv=new M,Va=new M,ja=new M,O2=new Hr,n$=.01,o$={type:"requestRender"},l$=(function(){let e=new M,t=new M;return(i,r,s)=>s>0?(e.subVectors(i,r),e.length()<=s?i:t.copy(r).add(e.normalize().multiplyScalar(s))):r})(),I2=(function(){let e=new xe;return(t,i)=>{t.position.copy(i),t.parent!==null&&(e.copy(t.parent.matrixWorld).invert(),t.position.applyMatrix4(e)),e.copy(t.hiddenMatrix).invert(),t.position.applyMatrix4(e),t.updateMatrix(),t.hasNonUniformScale&&(t.updateMatrixWorld(),t.updateMatrixWorldSVD()),t instanceof xr&&ln(t.parent)&&t.invalidateDownstreamBooleanData(!0)}})(),h$=class{constructor(e,t,i,r,s,a){this.data=e,this.id=t,this.object=i,this.paused=!1,this.currentDampingFactor=1,this.snapComplete=!1,this.isReset=!1,this.worldPosition0=new M,this.timeoutId=null,this.delayFinished=!0,this.wasOutside=!1,this.data={...x0.defaultData,...e,...e.resetOnPointerLeave===void 0&&{resetOnPointerLeave:!1}},e.target===void 0||e.target==="cursor"||(this.target=r.find(e.target)),this.data.dampingFactor&&(this.currentDampingFactor=this.data.dampingFactor),this.resetDampingFactor=80/this.data.resetSpeed+1,this.object.getWorldPosition(this.worldPosition0),this.actions=Bi(e,e.actions,r,s,a,i)}},c$=class extends Er{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.pairOfEventListeners=[],this.onMouseMove=i=>{if(!(at.length>1)){this.eventContext.updateRaycaster(i);for(let r of this.events)r.target===void 0&&this.updateSingleEvent(r)}},this.onMouseEnter=i=>{for(let r of this.events)r.target===void 0&&(r.isReset=!1,r.currentDampingFactor=r.data.dampingFactor)},this.onMouseLeave=i=>{for(let r of this.events)r.target===void 0&&(r.data.resetOnPointerLeave&&(r.isReset=!0,r.currentDampingFactor=r.resetDampingFactor),this.updateSingleEvent(r))},this.onTargetChange=i=>()=>{this.updateSingleEvent(i)}}connect(){let{page:e}=this.eventContext;if(e.traverseEntity(r=>{let s=r.data?.events.find(a=>a.data.type==="Follow"&&!a.data.disabled);s&&(!e.data.globalPhysics.usePhysics||r.dataPatched.physics?.rigidBody!=="dynamic")&&this.events.push(new h$(s.data,s.id,r,e,this.eventContext.sharedAssets,this.eventManager))}),!this.events.length)return;let{domElement:t,eventElement:i}=this.eventContext;this.domEventsNeeded.clear(),ts&&(this.domEventsNeeded.add("pointerdown"),t.addEventListener("pointerdown",this.onMouseMove)),this.domEventsNeeded.add("pointermove"),i.addEventListener("pointermove",this.onMouseMove),this.eventContext.useWindowEvents||(t.addEventListener("pointerenter",this.onMouseEnter),t.addEventListener("pointerleave",this.onMouseLeave));for(let r of this.events)if(r.target!==void 0){let s=r.target,a=this.onTargetChange(r);this.pairOfEventListeners.push([s,a]),s.addEventListener("requestRender",a)}}disconnect(){if(!this.events.length)return;let{domElement:e,eventElement:t}=this.eventContext;this.domEventsNeeded.clear(),ts&&e.removeEventListener("pointerdown",this.onMouseMove),t.removeEventListener("pointermove",this.onMouseMove),e.removeEventListener("pointerenter",this.onMouseEnter),e.removeEventListener("pointerleave",this.onMouseLeave);for(let[i,r]of this.pairOfEventListeners)i.removeEventListener("requestRender",r);for(let i of this.events)i.paused=!0,i.isReset=!1,ar(i.actions)}onAnimationFrameDamping(){for(let e of this.events)e.paused||this.updateSingleEvent(e,!0)}updateSingleEvent(e,t=!1){this.events.forEach(n=>{n.actions.Create.forEach(o=>{o.dispatchThrottled()})});let{plane:i,limitDistance:r,limitDistanceEnabled:s}=e.data;if(e.object.getWorldPosition(Va),e.isReset)ja.copy(e.worldPosition0);else if(e.target)e.target.getWorldPosition(ja);else{let{getCamera:n,raycaster:o}=this.eventContext;if(i==="custom"?(n().getWorldDirection(Pv),Pv.negate(),Hl.copy(Pv)):i==="xy"?Hl.set(0,0,1):i==="xz"?Hl.set(0,1,0):i==="yz"&&Hl.set(1,0,0),O2.setFromNormalAndCoplanarPoint(Hl,Va),!o.ray.intersectPlane(O2,ja))return}if(!e.isReset){if(ja.distanceTo(e.worldPosition0)>r&&s&&e.target)if(e.snapComplete=!1,e.data.snapDelay&&(e.delayFinished=!1,typeof window<"u"&&e.timeoutId!==null&&(window.clearTimeout(e.timeoutId),e.timeoutId=null)),e.wasOutside=!0,e.data.resetAfterDistanceLimit)ja.copy(e.worldPosition0),e.currentDampingFactor=e.resetDampingFactor;else return;else if(e.wasOutside&&(e.data.snapDelay&&typeof window<"u"&&(e.timeoutId=window.setTimeout(()=>{e.delayFinished=!0,e.paused=!1,this.updateSingleEvent(e)},e.data.snapDelay*1e3)),e.currentDampingFactor=e.data.dampingFactor,e.wasOutside=!1),e.delayFinished===!1)return}e.data.enabledTranslation[0]===!1&&(ja.x=Va.x),e.data.enabledTranslation[1]===!1&&(ja.y=Va.y),e.data.enabledTranslation[2]===!1&&(ja.z=Va.z);let a=l$(Va,ja,e.wasOutside?0:e.data.maxDelta);if(e.currentDampingFactor>1){let n=Hl.subVectors(a,Va).divideScalar(e.currentDampingFactor);Va.add(n),t&&I2(e.object,Va),e.paused=n.length()<n$}else I2(e.object,a),e.paused=!0;e.object?.dispatchEvent({type:"beginEvent",eventName:"Follow"}),e.object.dispatchEvent(o$)}},Pc=new M,bp=new M,Dc=new xe,Gl=new nt,Bn=new nt,Oc=new M,Ic=new M,Co=new M,Ha=new M,Dv=new Hr,u$=1e-6,d$={type:"requestRender"},p$={type:"changeRotation"},R2=(function(){let e=new xe;return function(t,i){t.parent!==null?e.multiplyMatrices(t.parent.matrixWorld,t.hiddenMatrix):e.copy(t.hiddenMatrix),i.premultiply(nD(e).invert()),t.rotation.setFromRotationMatrix(i),t.updateMatrix(),t instanceof xr&&ln(t.parent)&&t.invalidateDownstreamBooleanData(!0)}})(),f$=class{constructor(e,t,i,r){this.id=t,this.object=i,this.paused=!1,this.currentDampingFactor=1,this.isReset=!1,this.worldQuaternion0=new nt,this.timeoutId=null,this.delayFinished=!0,this.wasOutside=!1,this.data={...b0.defaultData,...e,...e.resetOnPointerLeave===void 0&&{resetOnPointerLeave:!1}},e.target===void 0||e.target==="cursor"||(this.target=r.find(e.target)),this.data.dampingFactor&&(this.currentDampingFactor=this.data.dampingFactor),this.object.getWorldQuaternion(this.worldQuaternion0),isNaN(this.worldQuaternion0.x)&&(this.worldQuaternion0.x=0),isNaN(this.worldQuaternion0.y)&&(this.worldQuaternion0.y=0),isNaN(this.worldQuaternion0.z)&&(this.worldQuaternion0.z=0),isNaN(this.worldQuaternion0.w)&&(this.worldQuaternion0.w=1),this.resetDampingFactor=80/this.data.resetSpeed+1}},m$=class extends Er{constructor(){super(...arguments),this.events=[],this.pairOfEventListeners=[],this.pairOfUserEventListeners=[],this.onMouseMove=e=>{if(!(at.length>1)){this._lastMouseEvent=e,this.eventContext.updateRaycaster(e);for(let t of this.events)t.target===void 0&&this.updateSingleEvent(t)}},this.onMouseEnter=e=>{for(let t of this.events)t.target===void 0&&(t.isReset=!1,t.currentDampingFactor=t.data.dampingFactor)},this.onMouseLeave=e=>{for(let t of this.events)t.target===void 0&&(t.data.resetOnPointerLeave&&(t.isReset=!0,t.currentDampingFactor=t.resetDampingFactor),this.updateSingleEvent(t))},this.onScroll=e=>{if(this._lastMouseEvent){let t=new PointerEvent("pointermove",{clientX:this._lastMouseEvent.clientX,clientY:this._lastMouseEvent.clientY,bubbles:!0,cancelable:!0,view:window});this.eventContext.eventElement.dispatchEvent(t)}},this.onTargetChange=e=>()=>{this.updateSingleEvent(e)},this.createUserEventListener=e=>({eventName:t,target:i})=>{if(!t||!i)return;let r=Qu(t);r&&r==="LookAt"&&this.updateSingleEvent(e)}}connect(){let{page:e}=this.eventContext;if(e.traverseEntity(r=>{let s=r.data?.events.find(a=>a.data.type==="LookAt"&&!a.data.disabled);s&&(!e.data.globalPhysics.usePhysics||r.dataPatched.physics?.rigidBody!=="dynamic")&&this.events.push(new f$(s.data,s.id,r,e))}),!this.events.length)return;let{domElement:t,eventElement:i}=this.eventContext;this.domEventsNeeded.clear(),ts&&(this.domEventsNeeded.add("pointerdown"),t.addEventListener("pointerdown",this.onMouseMove)),this.domEventsNeeded.add("pointermove"),i.addEventListener("pointermove",this.onMouseMove),this.eventContext.useWindowEvents?i.addEventListener("scroll",this.onScroll):(t.addEventListener("pointerenter",this.onMouseEnter),t.addEventListener("pointerleave",this.onMouseLeave));for(let r of this.events){if(r.target!==void 0){let n=this.onTargetChange(r),o=r.target;this.pairOfEventListeners.push([o,n]),o.addEventListener("requestRender",n)}let s=this.createUserEventListener(r),a=r.object;this.pairOfUserEventListeners.push([a,s]),a.addEventListener("userEvent",s)}}disconnect(){if(!this.events.length)return;let{domElement:e,eventElement:t}=this.eventContext;this.domEventsNeeded.clear(),ts&&e.removeEventListener("pointerdown",this.onMouseMove),t.removeEventListener("pointermove",this.onMouseMove),e.removeEventListener("pointerenter",this.onMouseEnter),e.removeEventListener("pointerleave",this.onMouseLeave),t.removeEventListener("scroll",this.onScroll);for(let[i,r]of this.pairOfEventListeners)i.removeEventListener("requestRender",r);for(let[i,r]of this.pairOfUserEventListeners)i.removeEventListener("userEvent",r);for(let i of this.events)i.paused=!0,i.isReset=!1}onAnimationFrameDamping(){for(let e of this.events)e.paused||this.updateSingleEvent(e)}updateSingleEvent(e){let{tilt:t,axis:i,distance:r,plane:s,limitDistance:a,enabledRotation:n,limitDistanceEnabled:o}=e.data,{getCamera:l,raycaster:h}=this.eventContext,{object:c,target:u}=e;if(c.getWorldPosition(Oc),!e.isReset)if(e.target)e.target.getWorldPosition(Ic);else{if(s==="custom"?(l().getWorldDirection(bp),bp.negate(),Dv.setFromNormalAndCoplanarPoint(bp,Oc)):(s==="xy"?Pc.set(0,0,1):s==="xz"?Pc.set(0,1,0):s==="yz"&&Pc.set(1,0,0),Dv.setFromNormalAndCoplanarPoint(Pc,Oc)),!h.ray.intersectPlane(Dv,Ic))return;r>0&&(s==="custom"||s===void 0)&&Ic.addScaledVector(bp,r)}if(e.isReset||(u?t==="target"?Co.copy(u.up).applyMatrix4(Dc.extractRotation(u.matrixWorld)).normalize():n.some(d=>d===!1)?(i==="x"?(Ha.set(0,0,1),n[2]===!1&&Ha.set(0,1,0)):i==="y"?(Ha.set(1,0,0),n[0]===!1&&Ha.set(0,0,1)):(Ha.set(0,1,0),n[1]===!1&&Ha.set(1,0,0)),Co.copy(Ha).applyQuaternion(e.worldQuaternion0).normalize()):Co.set(0,1,0):s==="custom"?Co.set(0,1,0):Co.copy(Pc)),e.isReset)Bn.copy(e.worldQuaternion0);else if(Oc.distanceTo(Ic)>a&&o&&u)if(e.data.snapDelay&&(e.delayFinished=!1,typeof window<"u"&&e.timeoutId!==null&&(window.clearTimeout(e.timeoutId),e.timeoutId=null)),e.wasOutside=!0,e.data.resetAfterDistanceLimit)Bn.copy(e.worldQuaternion0),e.currentDampingFactor=e.resetDampingFactor;else return;else{if(e.wasOutside&&(e.data.snapDelay&&typeof window<"u"&&(e.timeoutId=window.setTimeout(()=>{e.delayFinished=!0,e.paused=!1,this.updateSingleEvent(e)},e.data.snapDelay*1e3)),e.currentDampingFactor=e.data.dampingFactor,e.wasOutside=!1),e.delayFinished===!1)return;g$(Dc,Ic,Oc,Co,i,Ha),Bn.setFromRotationMatrix(Dc),Gl.setFromUnitVectors(Ha.applyQuaternion(Bn),Co),n.some(d=>d===!1)&&t!=="target"&&Bn.premultiply(Gl).normalize()}e.currentDampingFactor>1?(c.updateWorldMatrix(!0,!1),Gl.setFromRotationMatrix(nD(c.matrixWorld)),Gl.slerp(Bn,1/e.currentDampingFactor),R2(c,Dc.makeRotationFromQuaternion(Gl)),e.paused=8*(1-Gl.dot(Bn))<u$):(R2(c,Dc.makeRotationFromQuaternion(Bn)),e.paused=!0),e.object?.dispatchEvent({type:"beginEvent",eventName:"Lo
8106okAt"}),c.dispatchEvent(d$),c.dispatchEvent(p$)}},us=new M,Ni=new M,Si=new M;function g$(e,t,i,r,s,a){let n=e.elements;Si.subVectors(t,i),Si.lengthSq()===0&&(Si.z=1),Si.normalize(),Ni.crossVectors(r,Si),Ni.lengthSq()===0&&(Math.abs(r.z)===1?Si.x+=1e-4:Si.z+=1e-4,Si.normalize(),Ni.crossVectors(r,Si)),Ni.normalize(),us.crossVectors(Si,Ni),s==="x"?a.z===1?[Ni,us,Si]=[Si,Ni,us]:(Ni.negate(),[Ni,Si]=[Si,Ni]):s==="y"?a.x===1?[Ni,us,Si]=[us,Si,Ni]:(Ni.negate(),[us,Si]=[Si,us]):a.x===1&&(Ni.negate(),[Ni,us]=[us,Ni]),n[0]=Ni.x,n[4]=us.x,n[8]=Si.x,n[1]=Ni.y,n[5]=us.y,n[9]=Si.y,n[2]=Ni.z,n[6]=us.z,n[10]=Si.z}var v$=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.entered=!1,this.actions=Bi(t,t.actions,r,s,a,i)}disconnect(){ar(this.actions)}dispatchEnter(){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.entered||(this.entered=!0,this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.play()),this.actions.Create.forEach(e=>e.dispatchStart()),this.actions.Particles.forEach(e=>e.dispatchBasic()),this.actions.Destroy.forEach(e=>e.dispatch()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent()),this.actions.SceneTransition.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}dispatchLeave(){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.entered&&(this.entered=!1,this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStop()),this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Particles.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent()))}dispatchUserEvent(e){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),e?(this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Particles.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.reverseFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.playFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.playFromCurrent()),this.actions.Create.forEach(t=>t.dispatch()),this.actions.Particles.forEach(t=>t.dispatchBasic()),this.actions.Destroy.forEach(t=>t.dispatch()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent())),this.actions.SceneTransition.forEach(t=>t.dispatch()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}},y$=class extends Er{constructor(e,t){super(e),this.eventManager=t,this.eventsPerObjects={},this.objects=[],this.objects2D=[],this._prevObjects=[],this.onMouseDown=i=>{at.length>1||(this.eventContext.updateRaycaster(i),this.handleMouseHoverEvent())},this.onMouseUp=i=>{at.length>1||this.handleMouseHoverEvent(!0)},this.onMouseMove=i=>{at.length>1||(this.eventContext.updateRaycaster(i),this.handleMouseHoverEvent())},this.onUserEvent=({eventName:i,target:r,reverse:s})=>{if(!i||!r)return;let a=Qu(i);a&&a==="MouseHover"&&(r.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),this.eventsPerObjects[r.uuid]?.forEach(n=>n.dispatchUserEvent(s)))}}connect(){let{page:e,sharedAssets:t}=this.eventContext,i=(s,a)=>{if(!(!s.visible||!s.data?.events.length)){for(let{id:n,data:o}of s.data.events)if(!o.disabled&&o.type==="MouseHover")try{let l=new v$(n,o,s,e,t,this.eventManager);this.eventsPerObjects[s.uuid]?this.eventsPerObjects[s.uuid].push(l):this.eventsPerObjects[s.uuid]=[l]}catch{}this.eventsPerObjects[s.uuid]?.length&&this.objects.push(s instanceof nr?a:s)}};if(e.traverseEntity(s=>{(s instanceof _r||s instanceof er)&&s.frame?.traverse(a=>{i(a,s)}),i(s)}),!this.objects.length)return;let{domElement:r}=this.eventContext;this.domEventsNeeded.clear(),ts&&(this.domEventsNeeded.add("pointerdown"),r.addEventListener("pointerdown",this.onMouseDown),this.domEventsNeeded.add("pointerup"),r.addEventListener("pointerup",this.onMouseUp)),this.domEventsNeeded.add("pointermove"),r.addEventListener("pointermove",this.onMouseMove),this.objects.forEac
vendor: 5,782 bytes, line 8106
8106h(s=>{s.addEventListener("userEvent",this.onUserEvent)})}disconnect(){if(!this.objects.length)return;let{domElement:e}=this.eventContext;this.domEventsNeeded.clear(),ts&&(e.removeEventListener("pointerdown",this.onMouseDown),e.removeEventListener("pointerup",this.onMouseUp)),e.removeEventListener("pointermove",this.onMouseMove),Object.values(this.eventsPerObjects).forEach(t=>{t.forEach(i=>{i.disconnect()})}),this.objects.forEach(t=>{t.removeEventListener("userEvent",this.onUserEvent)})}handleMouseHoverEvent(e=!1){let t=[];if(!e){let{stopRaycast:i,raycaster:r,page:s,pointerScreen:a}=this.eventContext,n=!1;if(s.uiCanvas&&(n=Ja(s,[a.x,a.y],Object.keys(this.eventsPerObjects),o=>{t.push(o)})),i&&!n){let o=jp(r,s,this.objects);t=qy(o),o.forEach(l=>{l.object instanceof _r&&Ja(l.object,[l?.uv?.x??0,l?.uv?.y??0],Object.keys(this.eventsPerObjects),h=>{t.push(h)})})}else this.objects.forEach(o=>{let l=Kf(r,o);l&&(t.push(o),o instanceof _r&&Ja(o,[l?.uv?.x??0,l?.uv?.y??0],Object.keys(this.eventsPerObjects),h=>{t.push(h)}))})}this._prevObjects.length&&this._prevObjects.forEach(i=>{t.includes(i)||(i.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),this.eventsPerObjects[i.uuid]?.forEach(r=>r.dispatchLeave()))}),t.length&&t.forEach(i=>{i.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),this.eventsPerObjects[i.uuid]?.forEach(r=>r.dispatchEnter())}),this._prevObjects=t}},x$=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.scrollCounter=0,this.actions=Bi(t,t.actions,r,s,a,i)}connect(){this.scrollCounter=0}disconnect(){ar(this.actions)}dispatch(e){this.actions.Transition.forEach(r=>{r.object.currentTransitionEvent!==this&&(r.object.currentTransitionEvent=this,r.init())});let t=e>0?1:-1;this.scrollCounter+=t,this.scrollCounter=Math.min(Math.max(this.scrollCounter,0),this.data.steps);let i=this.scrollCounter/this.data.steps;this.actions.Transition.forEach(r=>r.seek(i)),this.actions.Animation.forEach(r=>r.seek(t)),this.actions.TimelineAnimation.forEach(r=>r.seek(i)),this.actions.Create.forEach(r=>r.dispatchThrottled()),this.actions.SetVariable.forEach(r=>r.checkConditions()),this.actions.SetVariable.forEach(r=>r.dispatch()),this.actions.DynamicVariablePlay.forEach(r=>r.dispatch()),this.actions.ClearLocalStorage.forEach(r=>r.dispatch()),this.actions.UserAPI.forEach(r=>r.dispatch())}dispatchUserEvent(e){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),e?(this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>{t.playFromCurrent()}),this.actions.Animation.forEach(t=>{t.playFromCurrent()}),this.actions.TimelineAnimation.forEach(t=>{t.playFromCurrent()})),this.actions.Create.forEach(t=>t.dispatchThrottled()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}},b$=class{constructor(e,t,i,r,s,a,n){this.id=e,this.data=t,this.object=i,this.domElement=a,this.eventManager=n,this.scrollStart=0,this.scrollEnd=0,this.actions=Bi(t,t.actions,r,s,n,i)}getStickyParentElement(){let e=this.domElement;for(;e;){if(window.getComputedStyle(e).position==="sticky")return e;e=e.parentElement}return null}computeScrollBounds(){let e=this.getStickyParentElement(),t=e?.parentElement,i=this.domElement.getBoundingClientRect(),r={top:i.top,bottom:i.bottom,left:i.left,right:i.right,width:i.width,height:i.height};if(t){let h=t.getBoundingClientRect(),c=window.getComputedStyle(e),u=parseFloat(c.marginTop)+parseFloat(c.marginBottom),d=parseFloat(c.top),p=parseFloat(c.bottom),f=h.height-u;if(!isNaN(d))i.top===d?(r.top+=h.top-d,r.bottom+=h.top-d):i.top<0&&(r.top-=f-i.height,r.bottom-=f-i.height);else if(!isNaN(p)){let m=document.body.clientHeight??window.innerHeight,g=window.innerWidth-(document.documentElement.clientWidth??window.innerWidth);i.bottom===m-p?(r.top+=h.top-i.height+p+g,r.bottom+=h.top-i.height+p+g):i.bottom<m-p&&(r.top-=f-i.height,r.bottom-=f-i.height)}}let s=document.body,a=document.documentElement,n=window.pageYOffset||a.scrollTop||s.scrollTop,o=a.clientTop||s.clientTop||0,l=Math.round(r.top+n-o);if(this.data.startFrom==="enter"){let h=window.innerHeight,c=r.height,u=this.data.enterAnchor,d=u==="top"?h:u==="bottom"?h-c:h-c*.5;this.scrollStart=l-d}else this.scrollStart=0;this.scrollStart+=this.data.startOffset??0,this.scrollEnd=this.scrollStart+(this.data.endAfter??400),this.box=r,this.computeScroll({x:window.scrollX,y:window.scrollY})}connect(){this.computeScrollBounds()}disconnect(){ar(this.actions)}handleResize(){this.computeScrollBounds()}get isInvalidBox(){return this.box===void 0||this.box.width===0&&this.box.height===0&&this.box.top===0&&this.box.bottom===0}computeScroll({x:e,y:t}){this.actions.Transition.forEach(s=>{s.object.currentTransitionEvent!==this&&(s.object.currentTransitionEvent=this,s.init())});let i=this.scrollEnd-this.scrollStart,r=Math.min(1,Math.max(0,(t-this.scrollStart)/i));this.actions.Transition.forEach(s=>s.seek(r)),this.actions.Animation.forEach(s=>s.seek(r)),this.actions.TimelineAnimation.forEach(s=>s.seek(r)),this.actions.Create.forEach(s=>s.dispatchThrottled()),this.actions.SetVariable.forEach(s=>s.checkConditions()),this.actions.SetVariable.forEach(s=>s.dispatch()),this.actions.DynamicVariablePlay.forEach(s=>s.dispatch()),this.actions.ClearLocalStorage.forEach(s=>s.dispatch()),this.actions.UserAPI.forEach(s=>s.dispatch())}dispatch(e){this.isInvalidBox&&this.computeScrollBounds(),this.computeScroll(e)}
vendor: 4,086 bytes, line 8106
8106dispatchUserEvent(e){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),e?(this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>{t.playFromCurrent()}),this.actions.Animation.forEach(t=>{t.playFromCurrent()}),this.actions.TimelineAnimation.forEach(t=>{t.playFromCurrent()})),this.actions.Create.forEach(t=>t.dispatchThrottled()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch())}},w$=class extends Er{constructor(e,t){super(e),this.managers=t,this.wheelEventsPerObject=new Map,this.scrollEventsPerObject=new Map,this.isInview=!0,this.handleResize=()=>{[...this.scrollEventsPerObject.entries()].forEach(([i,r])=>{r.forEach(s=>s.handleResize())})},this.onScroll=i=>{if(!this.isInview)return;let r={y:window.scrollY,x:window.scrollX};[...this.scrollEventsPerObject.entries()].forEach(([s,a])=>{s.dispatchEvent({type:"beginEvent",eventName:"Scroll",scroll:r}),a.forEach(n=>n.dispatch(r))})},this.onWheel=i=>{!this.isInview||i.ctrlKey||[...this.wheelEventsPerObject.entries()].forEach(([r,s])=>{r.dispatchEvent({type:"beginEvent",eventName:"Scroll",deltaY:i.deltaY}),s.forEach(a=>a.dispatch(i.deltaY))})},this.onUserEvent=({eventName:i,target:r,reverse:s})=>{if(!i||!r)return;let a=Qu(i);a&&a==="Scroll"&&(r.dispatchEvent({type:"beginEvent",eventName:"Scroll"}),this.wheelEventsPerObject.get(r)?.forEach(n=>{n.dispatchUserEvent(s)}))}}connect(){let{page:e,sharedAssets:t,domElement:i,isExport:r}=this.eventContext,s=a=>{if(a.data?.events.length){for(let{id:n,data:o}of a.data.events)if(!o.disabled&&o.type==="Scroll")if(o.trigger==="load"||!r){let l=new x$(n,o,a,e,t,this.managers);this.wheelEventsPerObject.has(a)?this.wheelEventsPerObject.get(a)?.push(l):this.wheelEventsPerObject.set(a,[l])}else{let l=new b$(n,o,a,e,t,i,this.managers);this.scrollEventsPerObject.has(a)?this.scrollEventsPerObject.get(a)?.push(l):this.scrollEventsPerObject.set(a,[l])}}};e.traverseEntity(a=>{(a instanceof _r||a instanceof er)&&a.frame?.traverse(n=>{s(n)}),s(a)}),this.intersectionObserver=new IntersectionObserver(a=>{let n=a[0];n&&(this.isInview=n.isIntersecting)},{root:null}),this.intersectionObserver.observe(this.eventContext.domElement),[...this.wheelEventsPerObject.entries()].forEach(([a,n])=>{n.forEach(o=>o.connect()),a.addEventListener("userEvent",this.onUserEvent)}),[...this.scrollEventsPerObject.entries()].forEach(([a,n])=>{n.forEach(o=>o.connect()),a.addEventListener("userEvent",this.onUserEvent)}),[...this.wheelEventsPerObject.values()].some(a=>a.length)&&(this.domEventsNeeded.add("wheel"),window.addEventListener("wheel",this.onWheel)),[...this.scrollEventsPerObject.values()].some(a=>a.length)&&(this.domEventsNeeded.add("scroll"),window.addEventListener("scroll",this.onScroll),window.addEventListener("resize",this.handleResize))}disconnect(){window.removeEventListener("wheel",this.onWheel),window.removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.handleResize),this.intersectionObserver.unobserve(this.eventContext.domElement),this.domEventsNeeded.clear(),[...this.wheelEventsPerObject.entries()].forEach(([e,t])=>{t.forEach(i=>i.disconnect()),e.removeEventListener("userEvent",this.onUserEvent)}),[...this.scrollEventsPerObject.entries()].forEach(([e,t])=>{t.forEach(i=>i.disconnect()),e.removeEventListener("userEvent",this.onUserEvent)})}},S$=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.actions=Bi(t,t.actions,r,s,a,i)}disconnect(){ar(this.actions)}dispatch(){this.actions.Transition.forEach(e=>{e.play()}),this.actions.Animation.forEach(e=>{e.play()}),this.actions.TimelineAnimation.forEach(e=>{e.play()}),this.actions.SwitchCamera.forEach(e=>{e.play()}
8106),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()),this.actions.Create.forEach(e=>{e.dispatchFromStart()}),this.actions.Destroy.forEach(e=>{e.dispatchFromStart()})}dispatchAfter(e){this.actions.Audio.forEach(t=>{(t.interaction.data.triggerAfter??"any")===e&&(t.interaction instanceof Ho?t.interaction.audioPlayer?.play():t.interaction instanceof Vy&&t.interaction.dispatch())}),this.actions.Video.forEach(t=>{let i=t.interaction.data.triggerAfter??"autoplay";i===e&&(t.interaction instanceof to?t.interaction.play(i==="autoplay"):t.interaction instanceof Gy&&t.interaction.dispatch())}),this.actions.Particles.forEach(t=>{(t.data.triggerAfter??"any")===e&&t.dispatchBasic()})}async seekVideos(e){let t=[];this.actions.Video.forEach(i=>{(i.interaction.data.triggerAfter??"autoplay")==="autoplay"&&i.interaction instanceof to&&t.push(i.interaction.seek(e))}),await Promise.all(t)}pauseVideos(){this.actions.Video.forEach(e=>{e.interaction instanceof to&&e.interaction.pause()})}dispatchUserEvent(e){this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),e?(this.actions.Transition.forEach(t=>t.reverseFromCurrent()),this.actions.Animation.forEach(t=>t.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.reverseFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.forEach(t=>t.playFromCurrent()),this.actions.TimelineAnimation.forEach(t=>t.playFromCurrent()),this.actions.SwitchCamera.forEach(t=>t.playFromCurrent())),this.actions.SceneTransition.forEach(t=>t.dispatch()),this.actions.Reset.forEach(t=>t.dispatch()),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch()}
8106),this.actions.Audio.forEach(t=>{t.interaction instanceof Ho?t.interaction.audioPlayer?.play():t.interaction instanceof Vy&&t.interaction.dispatch()}),this.actions.Video.forEach(t=>{t.interaction instanceof to?t.interaction.play():t.interaction instanceof Gy&&t.interaction.dispatch()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()})}},_$=class extends Er{constructor(e,t){super(e),this.eventManager=t,this.eventsPerObject=new Map,this.eventsAfterPerObject=new Map,this.onMouseDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{i.dispatchEvent({type:"beginEvent",eventName:"Start"}),r.forEach(s=>{s.dispatchAfter("mouseDown")})})},this.onKeyDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{i.dispatchEvent({type:"beginEvent",eventName:"Start"}),r.forEach(s=>{s.dispatchAfter("keyDown")})})},this.onAny=()=>{let{domElement:i,isExport:r}=this.eventContext,s=r?document:i;s.removeEventListener("pointerdown",this.onAny),s.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([a,n])=>{a.dispatchEvent({type:"beginEvent",eventName:"Start"}),n.forEach(o=>{o.dispatchAfter("any")})})},this.onSceneTransitionAudioVideoPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{i.dispatchEvent({type:"beginEvent",eventName:"Start"}),r.forEach(s=>
vendor: 4,353 bytes, line 8106
8106{s.actions.Audio.forEach(a=>{a.interaction instanceof Ho&&a.interaction.audioPlayer?.play()}),s.actions.Video.forEach(a=>{let n=a.interaction.data.triggerAfter??"autoplay";a.interaction instanceof to&&a.interaction.play(n==="autoplay")}),s.actions.Particles.forEach(a=>{a.dispatchBasic()})})})},this.onPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{i.dispatchEvent({type:"beginEvent",eventName:"Start"}),r.forEach(s=>{s.dispatchAfter("autoplay")})})},this.seekVideos=async i=>{let r=[];[...this.eventsAfterPerObject.entries()].forEach(([s,a])=>{!s.data.visible||a.forEach(n=>{r.push(n.seekVideos(i))})}),await Promise.all(r)},this.pauseVideos=()=>{[...this.eventsAfterPerObject.entries()].forEach(([i,r])=>{r.forEach(s=>{s.pauseVideos()})})},this.onUserEvent=({eventName:i,target:r,reverse:s})=>{if(!i||!r)return;let a=Qu(i);a&&a==="Start"&&(r instanceof nr||r.dispatchEvent({type:"beginEvent",eventName:"Start"}),this.eventsPerObject.get(r)?.forEach(n=>{n.dispatchUserEvent(s)}),this.eventsAfterPerObject.get(r)?.forEach(n=>{n.dispatchUserEvent(s)}))}}connect(){let{sharedAssets:e,page:t}=this.eventContext,i=r=>{if(r.data?.events.length)for(let{id:s,data:a}of r.data.events){if(a.disabled||a.type!=="Start")continue;let n=new S$(s,a,r,t,e,this.eventManager);(n.actions.Transition.length||n.actions.TimelineAnimation.length||n.actions.Animation.length||n.actions.SwitchCamera.length||n.actions.Create.length||n.actions.Destroy.length||n.actions.SceneTransition.length||n.actions.Reset.length||n.actions.SetVariable.length||n.actions.DynamicVariablePlay.length||n.actions.ClearLocalStorage.length||n.actions.UserAPI.length)&&(this.eventsPerObject.has(r)?this.eventsPerObject.get(r)?.push(n):this.eventsPerObject.set(r,[n])),n.actions.Audio.length&&(this.eventsAfterPerObject.has(r)?this.eventsAfterPerObject.get(r)?.push(n):this.eventsAfterPerObject.set(r,[n])),n.actions.Video.length&&(this.hasVideoAction=!0,this.eventsAfterPerObject.has(r)?this.eventsAfterPerObject.get(r)?.push(n):this.eventsAfterPerObject.set(r,[n])),n.actions.Particles.length&&(this.eventsAfterPerObject.has(r)?this.eventsAfterPerObject.get(r)?.push(n):this.eventsAfterPerObject.set(r,[n]))}};if(t.traverseEntity(r=>{(r instanceof _r||r instanceof er)&&r.frame?.traverse(s=>{i(s)}),i(r)}),[...this.eventsAfterPerObject.values()].some(r=>r.length)){if(this.eventManager.activateCount===0){let{domElement:r,isExport:s}=this.eventContext,a=s?document:r;a.addEventListener("pointerdown",this.onMouseDown,{once:!0}),a.addEventListener("mousedown",this.onMouseDown,{once:!0}),document.addEventListener("keydown",this.onKeyDown,{once:!0}),a.addEventListener("pointerdown",this.onAny),a.addEventListener("mousedown",this.onAny),document.addEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([n,o])=>{n.addEventListener("userEvent",this.onUserEvent)})}else this.onSceneTransitionAudioVideoPlay();this.onPlay()}[...this.eventsPerObject.entries()].forEach(([r,s])=>{r.dispatchEvent({type:"beginEvent",eventName:"Start"}),s.forEach(a=>a.dispatch()),r.addEventListener("userEvent",this.onUserEvent)})}disconnect(){if([...this.eventsAfterPerObject.values()].some(e=>e.length)){let{domElement:e,isExport:t}=this.eventContext,i=t?document:e;i.removeEventListener("pointerdown",this.onMouseDown),i.removeEventListener("mousedown",this.onMouseDown),document.removeEventListener("keydown",this.onKeyDown),i.removeEventListener("pointerdown",this.onAny),i.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([r,s])=>{r.removeEventListener("userEvent",this.onUserEvent),s.forEach(a=>a.disconnect())})}[...this.eventsPerObject.entries()].forEach(([e,t])=>{e.removeEventListener("userEvent",this.onUserEvent),t.forEach(i=>i.disconnect())}),this.eventsPerObject.clear(),this.eventsAfterPerObject.clear()}},A$=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.initialDisabled=!1,this.actions=Bi(t,t.actions,r,s,a,i),this.target=t.target}disconnect(){ar(this.actions)}dispatch(e){this.initialDisabled||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(t=>
vendor: 31,858 bytes, lines 8106-8167
8106{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Animation.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(e??!1)}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}},M$=class extends Er{constructor(e,t,i,r,s){super(e),this.sharedVariables=t,this.eventManager=i,this.needsMouse=r,this.needsRaycast=s,this.dynamicVars=[],this.variablesToWatch=[],this.prevMouseProperty=null,this.prevRaycastProperty=null,this.pauseTime=0,this.isOutOfFocus=!1,this.events=[],this.onFrame=a=>{let n=this.eventContext.sharedAssets;if(this.rafId=window.requestAnimationFrame(this.onFrame),this.isOutOfFocus)return;let o=new Date,l=[],h=[];for(let d=0;d<this.propertiesToWatch.length;d++){let{objectId:p,property:f,prevValue:m}=this.propertiesToWatch[d],g=this.eventContext.scene.find(p),v=S0.propertyPaths[f];if(v[0]==="width"||v[0]==="height"||v[0]==="depth")g=g.geometry.userData.parameters[v[0]];else for(let y=0;y<v.length;y++)g=g[v[y]];m===null?this.propertiesToWatch[d].prevValue=g instanceof M?g.clone():g:(g instanceof M?!g.equals(m):m!==g)&&(h.push({objId:p,property:f}),g instanceof M?this.propertiesToWatch[d].prevValue.copy(g):this.propertiesToWatch[d].prevValue=g)}for(let d=0;d<this.variablesToWatch.length;d++){let{id:p,prevValue:f}=this.variablesToWatch[d],m=n.getVariable(p);m!==f&&(l.push(p),this.variablesToWatch[d].prevValue=m)}for(let d=0;d<this.dynamicVars.length;d++){let{id:p,expectedTime:f,last:m,data:g,timerSeconds:v,startValue:y}=this.dynamicVars[d],x=1e3;if((g.dynamicVariableType==="timer"||g.dynamicVariableType==="stopwatch")&&g.format==="number3decimal"?x=1:g.dynamicVariableType==="counter"?x=g.updateInterval:g.dynamicVariableType==="random"&&(x=g.isStatic?1/0:g.updateInterval),f===-1){this.dynamicVars[d].last=a,this.dynamicVars[d].expectedTime=a+x;continue}if(!((n.getDynamicVariablePlayState(p)==="Stopped"||n.getDynamicVariablePlayState(p)==="Restarted")&&(this.dynamicVars[d].last=a,this.dynamicVars[d].expectedTime=a+x,g.dynamicVariableType==="counter"&&n.getVariable(p)!==y&&(n.updateVariable(p,y),this.eventManager.requestRender()),(g.dynamicVariableType==="timer"||g.dynamicVariableType==="stopwatch")&&this.dynamicVars[d].timerSeconds!==y&&(this.dynamicVars[d].timerSeconds=y,n.updateVariable(p,ms.getFormattedTimerTime(y,g)),this.eventManager.requestRender()),n.getDynamicVariablePlayState(p)==="Restarted"&&n.setDynamicVariablePlayState(p,"Playing"),n.getDynamicVariablePlayState(p)==="Stopped"))){if(n.getDynamicVariablePlayState(p)==="Paused"){this.dynamicVars[d].deltaToExpectedTime===void 0&&(this.dynamicVars[d].deltaToExpectedTime=Math.max(this.dynamicVars[d].expectedTime-a,0)),this.dynamicVars[d].last=a-(x-this.dynamicVars[d].deltaToExpectedTime),this.dynamicVars[d].expectedTime=a+this.dynamicVars[d].deltaToExpectedTime;continue}else this.dynamicVars[d].deltaToExpectedTime=void 0;if(a>=f)if(this.dynamicVars[d].last=a,this.dynamicVars[d].expectedTime+=x,g.dynamicVariableType==="random"){let w=g.min+Math.random()*(g.max-g.min),S=g.decimals;w=Math.round(w*Math.pow(10,S))/Math.pow(10,S),n.updateVariable(p,w),l.push(p),this.eventManager.requestRender()}else if(g.dynamicVariableType==="counter"){let w=n.getVariable(p),S=n.getDynamicVariableToggleIsForward(p)??!0,b=n.getVariable(p)+g.increment*(S?1:-1);g.hasEnd&&(b=g.increment>0?Te.clamp(b,y,g.endValue):Te.clamp(b,g.endValue,y),b===y&&n.setDynamicVariableToggleIsForward(p,void 0),g.repeat?b===g.endValue&&(b=y):(b===y||b===g.endValue)&&n.setDynamicVariablePlayState(p,"Paused")),b!==w&&(l.push(p),n.updateVariable(p,b),this.eventManager.requestRender())}else if(g.dynamicVariableType==="time"){let w=n.getVariable(p),S=oA(o,g);if(typeof w=="object"&&"textValue"in w&&typeof S=="object"&&"textValue"in S){if(Array.isArray(w.textValue)&&Array.isArray(S.textValue)){if(w.textValue.every((b,E)=>b===S.textValue[E]))continue}else if(w.textValue===S.textValue)continue}else if(w===S)continue;n.updateVariable(p,S),l.push(p),this.eventManager.requestRender()}else{let w=gr.isTextValue(g.endValue)?L2(g.endValue.textValue):g.endValue,S=n.getDynamicVariableToggleIsForward(p)??!0,b=v+(a-m)/1e3*(g.dynamicVariableType==="timer"?-1:1)*(S?1:-1);b=Math.max(b,0),g.hasEnd&&(b=g.dynamicVariableType==="stopwatch"?Te.clamp(b,y,w):Te.clamp(b,w,y),b===y&&n.setDynamicVariableToggleIsForward(p,void 0),g.repeat?Math.abs(b-w)<(g.format==="number3decimal"?1e-4:.1)&&(b=y):(Math.abs(b-y)<(g.format==="number3decimal"?1e-4:.1)||Math.abs(b-w)<(g.format==="number3decimal"?1e-4:.1))&&n.setDynamicVariablePlayState(p,"Paused")),b!==v&&(l.push(p),this.dynamicVars[d].timerSeconds=b,n.updateVariable(p,ms.getFormattedTimerTime(b,g)),this.eventManager.requestRender())}}}let c=!1;n.mouseProperty!==this.prevMouseProperty&&(this.prevMouseProperty=n.mouseProperty,c=!0);let u=!1;n.raycastProperty!==this.prevRaycastProperty&&(this.prevRaycastProperty=n.raycastProperty,u=!0),this.events.forEach(d=>{(l.includes(d.data.variableId)||h.find(p=>p.objId===d.data.objectId&&p.property===d.data.property)||d.data.variableId==="mouseProperty"&&c||d.data.variableId==="raycastProperty"&&u)&&(d.dispatch(),this.eventManager.requestRender())})},this.onBlur=()=>{this.pause()},this.onFocus=()=>{this.resume()}}pause(){this.isOutOfFocus||(this.isOutOfFocus=!0,this.pauseTime=Date.now())}resume(){if(!this.isOutOfFocus)return;this.isOutOfFocus=!1;let e=Date.now()-this.pauseTime;for(let t=0;t<this.dynamicVars.length;t++)this.dynamicVars[t].last+=e,this.dynamicVars[t].expectedTime+=e}connect(){this.eventContext.page.traverseEntity(t=>{t.data?.events.filter(i=>i.data.type==="VariableChange"&&!i.data.disabled).forEach(i=>{this.events.push(new E$(i.id,i.data,t,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.propertiesToWatch=this.events.filter(t=>t.data.variableId==="objectProperty"&&t.data.objectId!==null).map(t=>({objectId:t.data.objectId,property:t.data.property,prevValue:null}));let e=this.eventContext.sharedAssets;this.sharedVariables.forEach(({id:t,data:i})=>{if(!("dynamicVariableType"in i)){this.events.find(s=>s.data.variableId===t)&&this.variablesToWatch.push({id:t,prevValue:e.getVariable(t)});return}let r;if(i.dynamicVariableType==="timer"||i.dynamicVariableType==="stopwatch"){let s;if(gr.isTextValue(i.value)&&Array.isArray(i.value.textValue)){let a=i.value.textValue;a.length===3?s=a[2]+a[1]*60+a[0]*3600:s=a[1]+a[0]*60}else s=i.value;r=s,this.dynamicVars.push({id:t,last:-1,expectedTime:-1,data:i,timerSeconds:s,startValue:r})}else i.dynamicVariableType==="time"&&e.updateVariable(t,oA(new Date,i)),i.dynamicVariableType==="counter"&&(r=gr.isTextValue(i.value)?L2(i.value.textValue):i.value),this.dynamicVars.push({id:t,last:-1,expectedTime:-1,data:i,startValue:r})}),this.rafId=window.requestAnimationFrame(this.onFrame),window.addEventListener("blur",this.onBlur),window.addEventListener("focus",this.onFocus)}disconnect(){window.removeEventListener("blur",this.onBlur),window.removeEventListener("focus",this.onFocus),this.rafId&&(window.cancelAnimationFrame(this.rafId),this.rafId=void 0),this.events.forEach(e=>e.dispose())}},E$=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.actions=Bi(t,t.actions,r,s,a,i)}dispatch(){let e=this.actions;e.Audio.forEach(t=>t.dispatchConditional()),e.Particles.forEach(t=>t.dispatchConditional()),e.Video.forEach(t=>t.dispatchConditional()),e.Create.forEach(t=>t.dispatch()),e.Destroy.forEach(t=>t.dispatch()),e.Reset.forEach(t=>t.dispatch()),e.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this),t.init()}),e.Transition.forEach(t=>t.play()),e.Animation.forEach(t=>t.play()),e.SwitchCamera.forEach(t=>t.play()),e.SceneTransition.forEach(t=>t.dispatch()),e.SetVariable.forEach(t=>t.checkConditions()),e.SetVariable.forEach(t=>t.dispatch()),e.DynamicVariablePlay.forEach(t=>t.dispatch()),e.ClearLocalStorage.forEach(t=>t.dispatch()),e.UserAPI.forEach(t=>t.dispatch())}dispose(){ar(this.actions)}};function L2(e){return e.length===3?e[2]+e[1]*60+e[0]*3600:e[1]+e[0]*60}var C$="https://unpkg.com/@splinetool/[email protected]/build/",T$="https://unpkg.com/@splinetool/[email protected]/build/",P$=` 8107(async function() { 8108 const [wasmImport, wasmBinary] = await Promise.all([ 8109 import('${C$}' + 'navmesh.js'), 8110 fetch('${T$}' + 'navmesh.wasm').then((res) => res.arrayBuffer()), 8111 ]); 8112 const wasmModule = wasmImport.default; 8113 self.module = await wasmModule({ wasmBinary }); 8114 postMessage('ready'); 8115})(); 8116`,D$=` 8117(async function() { 8118 const [wasmImport, wasmBinary] = await Promise.all([ 8119 import(self.location.origin + '/_libraries/navmesh.js'), 8120 fetch(self.location.origin + '/_libraries/navmesh.wasm').then((res) => res.arrayBuffer()), 8121 ]); 8122 const wasmModule = wasmImport.default; 8123 self.module = await wasmModule({ wasmBinary }); 8124 postMessage('ready'); 8125})(); 8126`,O$=` 8127 8128onmessage = function(messageEvent) { 8129 const meshData = messageEvent.data; 8130 const positions = meshData[0]; 8131 const offset = meshData[1]; 8132 const indices = meshData[2]; 8133 const indicesLength = meshData[3]; 8134 const parameters = meshData[4]; 8135 8136 const module = self.module; 8137 const rc = new module.rcConfig(); 8138 rc.cs = parameters.cs; 8139 rc.ch = parameters.ch; 8140 rc.borderSize = parameters.borderSize ? parameters.borderSize : 0; 8141 rc.tileSize = parameters.tileSize ? parameters.tileSize : 0; 8142 rc.walkableSlopeAngle = parameters.walkableSlopeAngle; 8143 rc.walkableHeight = parameters.walkableHeight; 8144 rc.walkableClimb = parameters.walkableClimb; 8145 rc.walkableRadius = parameters.walkableRadius; 8146 rc.maxEdgeLen = parameters.maxEdgeLen; 8147 rc.maxSimplificationError = parameters.maxSimplificationError; 8148 rc.minRegionArea = parameters.minRegionArea; 8149 rc.mergeRegionArea = parameters.mergeRegionArea; 8150 rc.maxVertsPerPoly = parameters.maxVertsPerPoly; 8151 rc.detailSampleDist = parameters.detailSampleDist; 8152 rc.detailSampleMaxError = parameters.detailSampleMaxError; 8153 8154 if (!self.navMesh) { 8155 self.navMesh = new module.NavMesh(); 8156 } 8157 self.navMesh.build(positions, offset, indices, indicesLength, rc); 8158 8159 const navmeshData = navMesh.getNavmeshData(); 8160 const arrView = new Uint8Array(module.HEAPU8.buffer, navmeshData.dataPointer, navmeshData.size); 8161 const ret = new Uint8Array(navmeshData.size); 8162 ret.set(arrView); 8163 navMesh.freeNavmeshData(navmeshData); 8164 8165 postMessage(ret); 8166} 8167`,I$=.001,R$={cs:6,ch:2,walkableSlopeAngle:90,walkableHeight:20,walkableClimb:5,walkableRadius:0,maxEdgeLen:12,maxSimplificationError:1.3,minRegionArea:8,mergeRegionArea:20,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1},dD,Mt,cr;dH.then(e=>{dD=e,Mt=new e.Vec3,cr=new e.Vec3});var L$=new M,z$=class{constructor(e=!1,t=!1){this.usePhysics=e,this.isExport=t,this.onPointerDown=i=>{if(at.length!==1)return;let{raycaster:r,page:s}=this.eventContext;this.eventContext.updateRaycaster(i);let a=s.raycastWithClones(r);if(a.length!==0){if(this.gameControl){let n=L$.copy(this.gameControl.colliderWorldPosition);n.y-=this.gameControl.colliderHeight/2,this.gameControl.path=this.computePath(n,a[0].point)}this.eventContext.requestRender()}},this.traverseWithPhysics=(i,r)=>s=>{let a;if(s instanceof ys)if(s.objectForSample){if(s.objectForSample.dataPatched.physics.fusedBody)return;a=s.object}else return s.object.dataPatched.physics.fusedBody===!0&&s.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(s instanceof vr)a=s.object;else if(a=s,a.dataPatched.cloner?.disabled===!1&&a.dataPatched.cloner?.hideBase&&a.dataPatched.physics?.fusedBody!==!0)return!0;if(r&&!a.userData.navmesh)return;let n=a.dataPatched;if(!n.visible&&n.physics?.enabled!==!0)return!0;s.updateMatrixWorldSVD();let o=Zf(n),l=a.userData.hasDestroy,h=a.userData.hasDrag,c=!1,u=!1;for(let d of n.events)d.data.disabled!==!0&&(d.data.type==="GameControl"?c=!0:d.data.type==="Follow"&&(u=!0));if(c||o||u||l||h)return!0;if(this.usePhysics&&n.physics?.rigidBody==="dynamic"){if(this.usePhysics&&n.physics?.fusedBody)return!0}else if("geometry"in s&&s.geometry&&i.push(Za(s.geometry,s.matrixWorld)),this.usePhysics&&n.physics?.fusedBody)return s.traverseObject((d,p)=>{if(p===0)return;let f;if(d instanceof ys)if(d.objectForSample){if(d.objectForSample.dataPatched.physics.fusedBody)return;f=d.object}else return d.object.dataPatched.physics.fusedBody===!0&&d.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(d instanceof vr)f=d.object;else if(f=d,d.dataPatched.cloner?.hideBase)return!0;let m=f.dataPatched;if(!m.visible&&m.physics?.enabled!==!0)return!0;"geometry"in d&&d.geometry&&i.push(Za(d.geometry,d.matrixWorld))}),!0},this.traverseNoPhysics=(i,r)=>s=>{let a;if(s instanceof ys)return;s instanceof vr?a=s.object:a=s;let n=a.dataPatched;if(n.physics.enabled==="visibility"?!n.visible:!n.physics.enabled)return!0;if(r&&!a.userData.navmesh)return;let o=s.geometry,l=a.userData.hasDestroy===!0,h=a.userData.hasDrag===!0;if(Zf(n)||l||h||a.dataPatched.events.some(c=>c.data.disabled!==!0&&c.data.type==="GameControl"))return!0;o&&i.push(Za(o,s.matrixWorld))},this.navmeshWasm=dD,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(t?P$:D$)+O$])),this._worker=new Worker(this._workerURL)}init(e,t,i){this.gameControl=t,this.eventContext=i,this.setDefaultQueryExtent(new M().setScalar(e.ch*e.walkableRadius*1.2)),this._worker.onmessage=()=>{this.createNavMesh(i.page,e,r=>{this.buildFromNavmeshData(r.data)})},this.eventContext.renderer.domElement.addEventListener("pointerdown",this.onPointerDown)}createNavMesh(e,t,i){t.objects.forEach(l=>{let h=e.scene.find(l);h.traverseEntity(c=>{c.userData.navmesh=!0}),h.cloner?.traverseObject(c=>{c.userData.navmesh=!0})});let r=[],s=(this.usePhysics?this.traverseWithPhysics:this.traverseNoPhysics)(r,t.zones==="custom");if(e.traverseChildren(s),t.objects.forEach(l=>{let h=e.scene.find(l);h.traverseEntity(c=>{c.userData.navmesh=void 0}),h.cloner?.traverseObject(c=>{c.userData.navmesh=void 0})}),r.length===0)return!1;let a=jo(r),{positions:n,triIndices:o}=wm(a.getAttribute("position"),a.getIndex());return this._worker.postMessage([n,n.length/3,o,o.length,{...R$,...t}]),this._worker.onmessage=i,!0}createDebugNavGeometry(){let e,t,i=this.navMesh.getDebugNavMesh(),r=i.getTriangleCount(),s=new Uint32Array(r*3),a=new Float32Array(r*3*3);for(e=0;e<r*3;e++)s[e]=e;for(e=0;e<r;e++)for(t=0;t<3;t++){let o=i.getTriangle(e).getPoint(t);a[e*9+t*3+0]=o.x,a[e*9+t*3+1]=o.y,a[e*9+t*3+2]=o.z}let n=new He;return n.setIndex(new tt(s,1)),n.setAttribute("position",new tt(a,3)),n}getClosestPoint(e){return Mt.x=e.x,Mt.y=e.y,Mt.z=e.z,this.navMesh.getClosestPoint(Mt)}getClosestPointToRef(e,t){Mt.x=e.x,Mt.y=e.y,Mt.z=e.z;let i=this.navMesh.getClosestPoint(Mt);t.set(i.x,i.y,i.z)}getRandomPointAround(e,t){return Mt.x=e.x,Mt.y=e.y,Mt.z=e.z,this.navMesh.getRandomPointAround(Mt,t)}getRandomPointAroundToRef(e,t,i){Mt.x=e.x,Mt.y=e.y,Mt.z=e.z;let r=this.navMesh.getRandomPointAround(Mt,t);i.set(r.x,r.y,r.z)}moveAlong(e,t){return Mt.x=e.x,Mt.y=e.y,Mt.z=e.z,cr.x=t.x,cr.y=t.y,cr.z=t.z,this.navMesh.moveAlong(Mt,cr)}moveAlongToRef(e,t,i){return Mt.x=e.x,Mt.y=e.y,Mt.z=e.z,cr.x=t.x,cr.y=t.y,cr.z=t.z,this.navMesh.moveAlong(Mt,cr)}computePath(e,t){let i=this.getClosestPoint(t);if(cr.x=i.x,cr.y=i.y,cr.z=i.z,Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)+Math.pow(t.z-i.z,2))>this.getDefaultQueryExtent().y)return[];this.getClosestPoint(e);let r=this.navMesh.computePath(Mt,cr),s=r.getPointCount(),a=[];for(let n=0;n<s;n++){let o=r.getPoint(n);a.push(new M(o.x,o.y,o.z))}return a}createCrowd(e,t){return new B$(this,e,t)}setDefaultQueryExtent(e){Mt.x=e.x,Mt.y=e.y,Mt.z=e.z,this.navMesh.setDefaultQueryExtent(Mt)}getDefaultQueryExtent(){return this.navMesh.getDefaultQueryExtent()}buildFromNavmeshData(e){let t=e.length*e.BYTES_PER_ELEMENT,i=this.navmeshWasm._malloc(t),r=new Uint8Array(this.navmeshWasm.HEAPU8.buffer,i,t);r.set(e);let s=new this.navmeshWasm.NavmeshData;s.dataPointer=r.byteOffset,s.size=e.length,this.navMesh.buildFromNavmeshData(s),this.navmeshWasm._free(r.byteOffset)}getNavmeshData(){let e=this.navMesh.getNavmeshData(),t=new Uint8Array(this.navmeshWasm.HEAPU8.buffer,e.dataPointer,e.size),i=new Uint8Array(e.size);return i.set(t),this.navMesh.freeNavmeshData(e),i}getDefaultQueryExtentToRef(e){let t=this.navMesh.getDefaultQueryExtent();e.set(t.x,t.y,t.z)}dispose(){this.navMesh.destroy(),this._worker.terminate(),URL.revokeObjectURL(this._workerURL),this.eventContext?.renderer.domElement.removeEventListener("pointerdown",this.onPointerDown)}addCylinderObstacle(e,t,i){return Mt.x=e.x,Mt.y=e.y,Mt.z=e.z,this.navMesh.addCylinderObstacle(Mt,t,i)}addBoxObstacle(e,t,i){return Mt.x=e.x,Mt.y=e.y,Mt.z=e.z,cr.x=t.x,cr.y=t.y,cr.z=t.z,this.navMesh.addBoxObstacle(Mt,cr,i)}removeObstacle(e){this.navMesh.removeObstacle(e)}isSupported(){return this.navmeshWasm!==void 0}},B$=class{constructor(e,t,i){this.navmeshWasmWrapper=e,this.transforms=[],this.agents=new Array,this.reachRadii=new Array,this._agentDestinationArmed=new Array,this._agentDestination=new Array,this.crowd=new this.navmeshWasmWrapper.navmeshWasm.Crowd(t,i,this.navmeshWasmWrapper.navMesh.getNavMesh())}onReachTarget(e,t){}addAgent(e,t,i){let r=new this.navmeshWasmWrapper.navmeshWasm.dtCrowdAgentParams;r.radius=t.radius,r.height=t.height,r.maxAcceleration=t.maxAcceleration,r.maxSpeed=t.maxSpeed,r.collisionQueryRange=t.collisionQueryRange,r.pathOptimizationRange=t.pathOptimizationRange,r.separationWeight=t.separationWeight,r.updateFlags=7,r.obstacleAvoidanceType=0,r.queryFilterType=0,r.userData=0;let s=this.crowd.addAgent(new this.navmeshWasmWrapper.navmeshWasm.Vec3(e.x,e.y,e.z),r);return this.transforms.push(i),this.agents.push(s),this.reachRadii.push(t.reachRadius?t.reachRadius:t.radius),this._agentDestinationArmed.push(!1),this._agentDestination.push(new M(0,0,0)),s}getAgentPosition(e){return this.crowd.getAgentPosition(e)}getAgentPositionToRef(e,t){let i=this.crowd.getAgentPosition(e);t.set(i.x,i.y,i.z)}getAgentVelocity(e){return this.crowd.getAgentVelocity(e)}getAgentVelocityToRef(e,t){let i=this.crowd.getAgentVelocity(e);t.set(i.x,i.y,i.z)}getAgentNextTargetPath(e){return this.crowd.getAgentNextTargetPath(e)}getAgentNextTargetPathToRef(e,t){let i=this.crowd.getAgentNextTargetPath(e);t.set(i.x,i.y,i.z)}getAgentState(e){return this.crowd.getAgentState(e)}overOffmeshConnection(e){return this.crowd.overOffmeshConnection(e)}agentGoto(e,t){this.crowd.agentGoto(e,new this.navmeshWasmWrapper.navmeshWasm.Vec3(t.x,t.y,t.z));let i=this.agents.indexOf(e);i>-1&&(this._agentDestinationArmed[i]=!0,this._agentDestination[i].set(t.x,t.y,t.z))}agentTeleport(e,t){this.crowd.agentTeleport(e,new this.navmeshWasmWrapper.navmeshWasm.Vec3(t.x,t.y,t.z))}updateAgentParameters(e,t){let i=this.crowd.getAgentParameters(e);t.radius!==void 0&&(i.radius=t.radius),t.height!==void 0&&(i.height=t.height),t.maxAcceleration!==void 0&&(i.maxAcceleration=t.maxAcceleration),t.maxSpeed!==void 0&&(i.maxSpeed=t.maxSpeed),t.collisionQueryRange!==void 0&&(i.collisionQueryRange=t.collisionQueryRange),t.pathOptimizationRange!==void 0&&(i.pathOptimizationRange=t.pathOptimizationRange),t.separationWeight!==void 0&&(i.separationWeight=t.separationWeight),this.crowd.setAgentParameters(e,i)}removeAgent(e){this.crowd.removeAgent(e);let t=this.agents.indexOf(e);t>-1&&(this.agents.splice(t,1),this.transforms.splice(t,1),this.reachRadii.splice(t,1),this._agentDestinationArmed.splice(t,1),this._agentDestination.splice(t,1))}getAgents(){return this.agents}update(e){if(this.navmeshWasmWrapper.navMesh.update(),e<=I$)return;let t=1/60,i=10;{let r=Math.floor(e/t);r>i&&(r=i),r<1&&(r=1);let s=e/r;for(let a=0;a<r;a++)this.crowd.update(s)}for(let r=0;r<this.agents.length;r++){let s=this.agents[r],a=this.getAgentPosition(s);if(this.transforms[r].copy(a),this._agentDestinationArmed[r]){let n=a.x-this._agentDestination[r].x,o=a.z-this._agentDestination[r].z,l=this.reachRadii[r],h=this._agentDestination[r].y-this.reachRadii[r],c=this._agentDestination[r].y+this.reachRadii[r],u=n*n+o*o;a.y>h&&a.y<c&&u<l*l&&(this.onReachTarget(s,this._agentDestination[r]),this._agentDestinationArmed[r]=!1)}}}setDefaultQueryExtent(e){let t=new this.navmeshWasmWrapper.navmeshWasm.Vec3(e.x,e.y,e.z);this.crowd.setDefaultQueryExtent(t)}getDefaultQueryExtent(){return this.crowd.getDefaultQueryExtent()}getDefaultQueryExtentToRef(e){let t=this.crowd.getDefaultQueryExtent();e.set(t.x,t.y,t.z)}getCorners(e){let t,i=this.crowd.getCorners(e),r=i.getPointCount(),s=[];for(t=0;t<r;t++){let a=i.getPoint(t);s.push(new M(a.x,a.y,a.z))}return s}dispose(){this.crowd.destroy()}};function F$(e){let t=!1;return e.scene.objects.forEach(i=>{i.data.type==="Page"&&!t&&i.data.publish.gameControlObject&&Eu.traverseModuleInstances(e,i.id,(r,s,a)=>{for(let n of a)n.data.type==="GameControl"&&n.data.navmesh.enabled&&(t=!0)})}),t}var wp={type:"change"},Rc={type:"start"},Wl={type:"end",nonOrbit:!0},k$={type:"end",nonOrbit:!1},U$={type:"end",isZoom:!0,nonOrbit:!0},N$={type:"end",changed:!1},Ov={type:"cameraAnimatingInTimeline"},Iv=new nt,z2=new H,V$=2*Math.PI,j$=1e-8,H$=.01,Rv=new M,Sp=new H,Lv=new M,_p=new nt,B2=new xe,G$={type:"requestRender"},pD=class extends or{constructor(e,t,i={isPlayMode:!1,isExport:!1},r){super(),this.object=e,this.domElement=t,this.options=i,this.timelineState=r,this.enabled=!0,this.useKeyEvents=!0,this.enableDamping=!1,this.enableZoom=!0,this.enableRotate=!0,this.enablePan=!0,this.autoRotate=!1,this.rotationLimitsMode=0,this.panLimitsMode=0,this.rotationSoftLimit=2,this.panSoftLimit=2,this.hoverRotatePanMode=0,this.zoomLimitsEnabled=!1,this.mouseButtons=[0,5],this.mouseButtonsPlay=[3,4,5],this.touches=[null,ns.DOLLY_ROTATE,ns.PAN],this.offset=new M,this.eye=new M,this.lastPosition=new M,this.lastQuaternion=new nt,this.current=new H,this.overShoot=new H,this.overRatio=new H,this.spherical=new dw,this.sphericalDelta=new dw,this.panOffset=new M,this.panLeftV=new M,this.panUpV=new M,this.panV=new M,this.rotateStart=new H,this.rotateEnd=new H,this.rotateDelta=new H,this.panStart=new H,this.panEnd=new H,this.panDelta=new H,this.dollyStart=new H,this.dollyEnd=new H,this.dollyDelta=new H,this.rotationRangeFactor=new H,this.panRangeFactor=new H,this.state=-1,this.zoomChanged=!1,this.isPointerDown=!1,this.isThetaFlipped=!1,this.prevScale=0,this.scale=1,this.gesture=!1,this.timer=-1,this.timerHover=-1,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPhi=0,this.maxPhi=Math.PI,this.minTheta=-1/0,this.maxTheta=1/0,this.minH=0,this.maxH=Math.PI,this.minV=-1/0,this.maxV=1/0,this.autoRotateClockwise=!0,this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.resetHoverEffectOnPointerLeave=!1,this.hasChange=!1,this.useWindowEvents=!1,this.isTouchZoom=!0,this.autoRotateSpeed=2,this.dampingFactor=.125,this.zoomSpeed=2,this.rotateSpeed=1,this.rotateFactor=1,this.panSpeed=1,this.hoverRotatePanStrength=.1,this.hoverRotateDamping=this.dampingFactor,this.isCurrentlyDamping=!1,this.thetaIsFree=!1,this.phiIsFree=!1,this.needsUpdate=!0,this.onCameraChange=s=>{this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange),this.object=s.camera,this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)},this.update=()=>{this.object.updateWorldMatrix(!0,!1),this.object.matrixWorld.decompose(Lv,_p,Rv),this.offset.copy(Lv).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.autoRotate&&this.state===-1&&this.rotateLeft((this.autoRotateClockwise===!0?1:-1)*this.getAutoRotationAngle()),this.rotationLimitsMode!==0&&this.applyLimits(this.sphericalDelta,this.rotationLimitsMode,this.rotationSoftLimit,this.maxTheta,this.minTheta,this.maxPhi,this.minPhi,this.rotationRangeFactor),this.rotationLimitsMode!==2&&(this.spherical.phi+=this.sphericalDelta.phi),(this.rotationLimitsMode!==1||this.autoRotate===!0)&&(this.spherical.theta+=this.sphericalDelta.theta),this.spherical.radius*=this.scale,this.zoomLimitsEnabled&&this.object.isPerspectiveCamera&&(this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius))),this.panLimitsMode!==0&&(this.target.applyQuaternion(Iv.copy(_p).invert()),this.panOffset.applyQuaternion(Iv),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(_p),this.panOffset.applyQuaternion(_p)),this.panLimitsMode===2&&(this.panOffset.y=0),this.panLimitsMode===1&&(this.panOffset.x=0),this.state===-1&&!this.gesture?(this.panOffset.multiplyScalar(1-this.dampingFactor),this.target.add(this.panOffset)):(this.target.add(this.panOffset),this.panOffset.set(0,0,0)),this.offset.setFromSpherical(this.spherical),Lv.copy(this.target).add(this.offset),this.object.position.copy(this.target).add(this.offset),this.object.parent&&(B2.copy(this.object.parent.matrixWorld).invert(),this.object.position.applyMatrix4(B2));let s=this.spherical.phi%V$;if(this.eye.copy(this.offset).normalize(),this.object.up.copy(Vt.DEFAULT_UP).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),s>0&&s>Math.PI||s<0&&s>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),this.state===-1||this.enableDamping===!0){let a=this.hoverRotatePanMode===1?this.hoverRotateDamping:this.dampingFactor;this.sphericalDelta.theta*=1-a,this.sphericalDelta.phi*=1-a}else this.sphericalDelta.set(0,0,0);if(this.scale=1,this.lastPosition.distanceToSquared(this.object.position)>H$||8*(1-this.lastQuaternion.dot(this.object.quaternion))>j$){this.dispatchEvent(wp),this.object.dispatchEvent(G$),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),this.isCurrentlyDamping=!0;return}this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.object.wasMovedBySwitchCameraAction=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),this.isCurrentlyDamping=!1},this.onPointerDown=s=>{this.enabled!==!1&&(s.pointerType==="touch"||s.pointerType==="pen"&&ts?this.onPointerDownTouch(s):this.onPointerDownMouse(s),this.state!==-1&&(this.isPointerDown=!0,this.dispatchEvent(Rc),this.domElement.addEventListener("pointermove",this.onPointerMove),this.domElement.addEventListener("pointerup",this.onPointerUp),s.stopPropagation(),s.pointerType==="touch"||s.pointerType==="pen"&&ts||this.domElement.setPointerCapture(s.pointerId)))},this.onPointerLeave=s=>{this.resetHoverEffectOnPointerLeave&&!this.useWindowEvents?(this.hoverRotatePanMode===1?(this.sphericalDelta.theta=-this.spherical.theta,this.sphericalDelta.phi=-this.spherical.phi,Rv.subVectors(this.position0,this.target0),this.spherical.setFromVector3(Rv),this.sphericalDelta.theta+=this.spherical.theta,this.sphericalDelta.phi+=this.spherical.phi,this.sphericalDelta.theta/=8,this.sphericalDelta.phi/=8):this.hoverRotatePanMode===2&&this.panOffset.subVectors(this.target0,this.target).divideScalar(8),this.update()):this.pointerLeaveEvent=s},this.onPointerEnter=s=>{this.resetHoverEffectOnPointerLeave||this.pointerLeaveEvent===void 0?Sp.set(s.clientX-this.domElement.clientWidth/2,s.clientY-this.domElement.clientHeight/2):Sp.set(s.clientX-this.pointerLeaveEvent.clientX,s.clientY-this.pointerLeaveEvent.clientY),this.hoverRotatePanMode===1?(this.rotateDelta.copy(Sp).multiplyScalar(this.rotateSpeed*this.hoverRotatePanStrength).rotateAround(z2,-this.object.angleOffsetFromUp),this.rotateLeft(2*Math.PI*this.rotateDelta.x/this.domElement.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/this.domElement.clientHeight),this.rotateStart.set(s.clientX,s.clientY)):this.hoverRotatePanMode===2&&(this.panDelta.copy(Sp).multiplyScalar(this.panSpeed*this.hoverRotatePanStrength),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.set(s.clientX,s.clientY)),this.update()},this.onPointerMove=s=>{if(this.timelineState?.isPlayingCameraAnimation){this.dispatchEvent(Ov);return}this.enabled!==!1&&(this.checkRaycastLock()||(s.pointerType==="touch"||s.pointerType==="pen"&&ts?this.onPointerMoveTouch(s):this.onPointerMoveMouse(s),s.stopPropagation()))},this.onPointerUp=s=>{this.isPointerDown=!1,at.length===0&&(this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)),at.length>1&&s.preventDefault(),this.hasChange?this.dispatchEvent(this.state===0?k$:Wl):this.dispatchEvent(N$),this.state=-1,s&&(s.stopPropagation(),s.pointerType==="touch"||s.pointerType==="pen"&&ts||this.domElement.releasePointerCapture(s.pointerId))},this.onPointerDownMouse=s=>{let a;switch(this.useKeyEvents?a=this.mouseButtons[s.button]:a=this.mouseButtonsPlay[s.button],a){case 0:if(s.altKey===!0&&!s.shiftKey&&!Od(s)){if(this.enableRotate===!1)return;this.handleMouseDownRotate(s),this.state=0}else if(this.key===" "){if(this.enablePan===!1)return;this.handleMouseDownPan(s),this.state=2}break;case 4:if(this.enablePan===!1)return;this.handleMouseDownPan(s),this.state=2;break;case 3:if(Od(s)||s.shiftKey){if(this.enablePan===!1)return;this.handleMouseDownPan(s),this.state=2}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(s),this.state=0}break;case 5:if(Od(s)||s.shiftKey){if(this.enableRotate===!1)return;this.handleMouseDownRotate(s),this.state=0}else{if(this.enablePan===!1)return;this.handleMouseDownPan(s),this.state=2}break;default:this.state=-1}},this.onPointerMoveMouse=s=>{switch(this.state){case 0:if(this.enableRotate===!1)return;this.handleMouseMoveRotate(s);break;case 1:if(this.enableZoom===!1)return;this.handleMouseMoveDolly(s);break;case 2:if(this.enablePan===!1)return;this.handleMouseMovePan(s);break}this.object.wasMovedByUser=!0},this.onPointerDownTouch=s=>{switch(at.length>1&&s.preventDefault(),this.touches[at.length-1]){case ns.ROTATE:if(this.enableRotate===!1){this.state=-1;return}this.handleTouchStartRotate(),this.state=3;break;case ns.PAN:if(this.enablePan===!1){this.state=-1;return}this.handleTouchStartPan(),this.state=4;break;case ns.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchStartDollyPan(),this.state=5;break;case ns.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}},this.onPointerMoveTouch=s=>{switch(at.length>1&&s.preventDefault(),this.state){case 3:if(this.enableRotate===!1)return;this.handleTouchMoveRotate(s),this.update();break;case 4:if(this.enablePan===!1)return;this.handleTouchMovePan(s),this.update();break;case 5:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchMoveDollyPan(s),this.update();break;case 6:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchMoveDollyRotate(s),this.update();break;default:this.state=-1}this.object.wasMovedByUser=!0},this.dispatchEndDebounced=bu(()=>{this.zoomChanged?this.dispatchEvent(U$):this.dispatchEvent(Wl),this.zoomChanged=!1},33),this.onMouseWheel=s=>{if(!(this.enabled===!1||this.enableZoom===!1&&this.enablePan===!1)&&
8167!this.checkRaycastLock()){if(!this.options.isExport&&this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth&&s.preventDefault(),this.dispatchEvent(Rc),this.timelineState?.isPlayingCameraAnimation){this.dispatchEvent(Ov);return}this.handleMouseWheel(s),this.dispatchEndDebounced(),this.object.wasMovedByUser=!0}},this.onGesture=s=>{if(s.preventDefault(),this.enabled!==!1&&!this.checkRaycastLock()&&!Kh){if(this.timelineState?.isPlayingCameraAnimation){this.dispatchEvent(Ov);return}if(s.type==="gesturechange"){if(this.enableZoom===!1||this.isTouchZoom===!1)return;this.dispatchEvent(Rc),s.scale>this.prevScale?this.dollyIn(this.getZoomScale()):s.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=s.scale,this.update(),this.object.wasMovedByUser=!0}else this.dispatchEvent(Wl)}},this.onContextMenu=s=>{s.preventDefault()},this.onTouchEnd=s=>{s.preventDefault()},this.onKeyDown=s=>{this.enabled!==!1&&(this.key=s.key,s.key===" "&&this.dispatchEvent(Rc))},this.onKeyUp=s=>{this.enabled!==!1&&(this.key=void 0,this.state!==-1&&s.key==="Alt"&&this.onPointerUp(at[0]),s.key===" "&&this.dispatchEvent(Wl))},this.onPointerHover=s=>{s.pointerType!=="mouse"||this.enabled===!1||this.state!==-1||this.hoverRotatePanMode===2&&this.isPanOverShoot||this.hoverRotatePanMode===1&&this.isRotateOverSho
vendor: 26,176 bytes, line 8167
8167ot||(this.isPointerDown=!0,this.hoverRotatePanMode===2?this.handleMouseMovePan(s,this.hoverRotatePanStrength):this.hoverRotatePanMode===1&&this.handleMouseMoveRotate(s,this.hoverRotatePanStrength))},this.onBeginState=()=>{this.enabled=!1,this.needsUpdate=!1},this.onCompleteState=s=>{s.isfromEntity&&this.options.isPlayMode||(this.enabled=!0,this.needsUpdate=!0,this.object.updateUp(),this.object.getTarget(this.target))},this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.quat0=this.object.quaternion.clone(),this.isUpVectorFlipped0=this.object.isUpVectorFlipped,this.offset.copy(this.object.position).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.initialSphericalRadius=this.spherical.radius,this.addEventListenersToCamera()}dispatchEvent(e){e.type==="start"?this.hasChange=!1:this.hasChange=!0,super.dispatchEvent(e)}addEventListenersToCamera(){this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)}removeEventListenersFromCamera(){this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange)}updateUseWindowEvents(e){if(window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("pointermove",this.onPointerHover),this.useWindowEvents=e,this.hoverRotatePanMode!==0&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover)),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),this.hoverRotatePanMode!==0&&!this.useWindowEvents){let t=this.useWindowEvents?window:this.domElement;t.addEventListener("pointerleave",this.onPointerLeave),t.addEventListener("pointerenter",this.onPointerEnter)}}fromJSON(e,t){this.rotateFactor=e.rotationSpeed??1,this.setEnableDampingSpeed(e.enableDamping),this.enablePan=e.enablePan,this.enableZoom=e.enableZoom,this.enableRotate=e.enableRotate,this.rotationLimitsMode=e.rotationLimitsMode,this.thetaIsFree=e.rotationHorizontalOffset.min===e.rotationHorizontalOffset.max&&e.rotationHorizontalOffset.min===Math.PI,this.phiIsFree=e.rotationVerticalOffset.min===e.rotationVerticalOffset.max&&e.rotationVerticalOffset.min===Math.PI,this.panLimitsMode=e.panLimitsMode,this.panSoftLimit=e.panSoftLimit,this.rotationSoftLimit=e.rotationSoftLimit,this.hoverRotatePanMode=e.hoverRotatePanMode,this.hoverRotateDamping=e.hoverRotateDamping??this.dampingFactor,this.useWindowEvents=t==="window",this.hoverRotatePanMode!==0&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover));let i=e.hoverRotatePanStrength/100;this.hoverRotatePanStrength=i**2,this.zoomLimitsEnabled=e.zoomLimitsEnabled,this.minZoom=e.zoomLimits.min,this.maxZoom=Math.max(e.zoomLimits.min,e.zoomLimits.max),this.minDistance=1e3/this.maxZoom,this.maxDistance=Math.max(this.minDistance,1e3/e.zoomLimits.min),this.autoRotate=e.autoRotate,this.autoRotateSpeed=e.autoRotateSpeed,this.autoRotateClockwise=e.autoRotateClockwise;let r=this.object.getTarget().applyQuaternion(Iv.copy(this.object.quaternion).invert());this.minV=-e.panVerticalOffset.min+r.y,this.maxV=e.panVerticalOffset.max+r.y,this.minH=-e.panHorizontalOffset.min+r.x,this.maxH=e.panHorizontalOffset.max+r.x,this.panRangeFactor.set(this.maxH-this.minH,this.maxV-this.minV).divideScalar(2),this.rotationRangeFactor.setScalar(Math.PI).divideScalar(4),this.minPhi=aa(this.spherical.phi-e.rotationVerticalOffset.min),this.maxPhi=aa(this.spherical.phi+e.rotationVerticalOffset.max),this.minTheta=aa(aa(this.spherical.theta)-e.rotationHorizontalOffset.min),this.maxTheta=aa(aa(this.spherical.theta)+e.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,e.orbitTouches===1&&(this.touches[0]=ns.ROTATE),e.panTouches===1&&(this.touches[0]=ns.PAN),e.orbitTouches===2&&(this.touches[1]=ns.DOLLY_ROTATE),e.panTouches===2&&(this.touches[1]=ns.DOLLY_PAN),e.orbitTouches===3&&(this.touches[2]=ns.ROTATE),e.panTouches===3&&(this.touches[2]=ns.PAN),this.isTouchZoom=e.isTouchZoom,this.resetHoverEffectOnPointerLeave=e.resetHoverEffectOnPointerLeave??!1}connect(){if(this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("wheel",this.onMouseWheel),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keyup",this.onKeyUp,!1),this.domElement.addEventListener("gesturestart",this.onGesture),this.domElement.addEventListener("gesturechange",this.onGesture),this.domElement.addEventListener("gestureend",this.onGesture),this.domElement.addEventListener("touchend",this.onTouchEnd),this.hoverRotatePanMode!==0&&!this.useWindowEvents){let e=this.useWindowEvents?window:this.domElement;e.addEventListener("pointerleave",this.onPointerLeave),e.addEventListener("pointerenter",this.onPointerEnter)}this.pointerLeaveEvent=void 0}dispose(){this.removeEventListenersFromCamera(),this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("wheel",this.onMouseWheel),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keyup",this.onKeyUp,!1),this.domElement.removeEventListener("pointermove",this.onPointerHover),window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("gesturestart",this.onGesture),this.domElement.removeEventListener("gesturechange",this.onGesture),this.domElement.removeEventListener("gestureend",this.onGesture),this.domElement.removeEventListener("touchend",this.onTouchEnd),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)}applyLimits(e,t,i,r,s,a,n,o){this.overShoot.set(0,0);let l,h,c;e instanceof M?(l=e.x,h=e.y,this.current.set(this.target.x,this.target.y),c=!0):(l=e.theta,h=e.phi,this.current.set(aa(this.spherical.theta),aa(this.spherical.phi)),c=!1),i===0&&(this.current.x+=l,this.current.y+=h),(t===3||t===2)&&(!c&&this.isThetaFlipped?this.current.x>r&&this.current.x<0?this.overShoot.x=r-this.current.x:this.current.x<s&&this.current.x>0&&(this.overShoot.x=s-this.current.x):this.current.x>r?this.overShoot.x=r-this.current.x:this.current.x<s&&(this.overShoot.x=s-this.current.x)),(t===3||t===1)&&(this.current.y>a?this.overShoot.y=a-this.current.y:this.current.y<n&&(this.overShoot.y=n-this.current.y)),c||(this.overShoot.x=aa(this.overShoot.x),this.overShoot.y=aa(this.overShoot.y)),i!==0?(this.overRatio.copy(this.overShoot).divide(o),this.overRatio.x=Math.min(Math.abs(this.overRatio.x),1),this.overRatio.y=Math.min(Math.abs(this.overRatio.y),1),i===1&&(this.overRatio.x=F2(Math.abs(this.overRatio.x)),this.overRatio.y=F2(Math.abs(this.overRatio.y))),this.isPointerDown||i===1?i===2&&(this.overRatio.x>.9&&!this.thetaIsFree||this.overRatio.y>.9&&!this.phiIsFree)?this.isPointerDown=!1:(l*this.overShoot.x<0&&!this.thetaIsFree&&(l*=1-this.overRatio.x),h*this.overShoot.y<0&&!this.phiIsFree&&(h*=1-this.overRatio.y)):i===2&&(!c&&(this.overRatio.x>.002&&!this.thetaIsFree||this.overRatio.y>.002&&!this.phiIsFree)||c&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(this.thetaIsFree||(l=this.overShoot.x*.05),this.phiIsFree||(h=this.overShoot.y*.05),c?this.isPanOverShoot=!0:this.isRotateOverShoot=!0):c?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(l+=this.overShoot.x,h+=this.overShoot.y),e instanceof M?(e.x=l,e.y=h):(this.thetaIsFree||(e.theta=l),this.phiIsFree||(e.phi=h))}setEnableDampingSpeed(e){this.enableDamping=e,this.rotateSpeed=(e===!0?.2:1)*this.rotateFactor}stopDamping(){this.sphericalDelta.theta=0,this.sphericalDelta.phi=0}getAutoRotationAngle(){return 2*Math.PI/60/60*this.autoRotateSpeed}getZoomScale(){return Math.pow(.95,this.zoomSpeed)}rotateLeft(e){this.sphericalDelta.theta-=e}rotateUp(e){this.sphericalDelta.phi-=e}panLeft(e,t){this.panLeftV.setFromMatrixColumn(t,0),this.panLeftV.multiplyScalar(-e),this.panOffset.add(this.panLeftV)}panUp(e,t){this.panUpV.setFromMatrixColumn(t,1),this.panUpV.multiplyScalar(e),this.panOffset.add(this.panUpV)}pan(e,t){let i=this.domElement;if(i&&this.object.isPerspectiveCamera){let r=this.object.position;this.panV.copy(r).sub(this.target);let s=this.panV.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*e*s/i.clientHeight,this.object.matrixWorld),this.panUp(2*t*s/i.clientHeight,this.object.matrixWorld)}else i&&this.object.isOrthographicCamera&&(this.panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrixWorld),this.panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrixWorld));this.dispatchEvent(wp)}dollyOut(e){this.object.isPerspectiveCamera?this.scale/=e:this.object.isOrthographicCamera&&(this.object.zoom*=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(wp)}dollyIn(e){this.object.isPerspectiveCamera?this.scale*=e:this.object.isOrthographicCamera&&(this.object.zoom/=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(wp)}setZoom(e){if(this.dispatchEvent(Rc),this.object.isPerspectiveCamera){let t=this.initialSphericalRadius/e/this.spherical.radius;this.scale=t}else this.object.isOrthographicCamera&&(this.object.zoom=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0);this.dispatchEvent(Wl)}handleMouseDownRotate(e){this.rotateStart.set(e.clientX,e.clientY)}handleMouseDownDolly(e){this.dollyStart.set(e.clientX,e.clientY)}handleMouseDownPan(e){this.panStart.set(e.clientX,e.clientY)}handleMouseMoveRotate(e,t=1){e.movementX!==void 0?this.rotateDelta.set(e.movementX,e.movementY):(this.rotateEnd.set(e.clientX,e.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateStart.copy(this.rotateEnd)),this.rotateDelta.multiplyScalar(this.rotateSpeed*t).rotateAround(z2,-this.object.angleOffsetFromUp);let i=this.domElement,r=this.useWindowEvents?window.innerHeight:i.clientHeight,s=2*Math.PI*this.rotateDelta.x/r,a=2*Math.PI*this.rotateDelta.y/r;this.rotateLeft(s),this.rotateUp(a),this.update()}handleMouseMoveDolly(e){this.dollyEnd.set(e.clientX,e.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyOut(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyIn(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(e,t=1){e.movementX!==void 0?this.panDelta.set(e.movementX,e.movementY):(this.panEnd.set(e.clientX,e.clientY),this.panDelta.subVectors(this.panEnd,this.panStart),this.panStart.copy(this.panEnd)),this.panDelta.multiplyScalar(this.panSpeed*t),this.pan(this.panDelta.x,this.panDelta.y),this.update()}handleMouseWheel(e){if(nH===!1&&Od(e)===!1&&lH(e)===!0){if(this.enablePan===!1)return;this.gesture?(this.panDelta.set(-e.deltaX,-e.deltaY).multiplyScalar(this.panSpeed),this.panDelta.x=Math.min(Math.abs(this.panDelta.x),100)*(this.panDelta.x<0?-1:1),this.panDelta.y=Math.min(Math.abs(this.panDelta.y),100)*(this.panDelta.y<0?-1:1),e.altKey?this.pan(0,this.panDelta.y):e.shiftKey?this.pan(this.panDelta.x,0):this.pan(this.panDelta.x,this.panDelta.y),this.update()):(this.gesture=!0,this.isPointerDown=!0),window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.gesture=!1,this.isPointerDown=!1,this.dispatchEvent(Wl)},30)}else{if(this.enableZoom===!1||this.gesture)return;e.deltaY===0?e.deltaX<0?this.dollyIn(this.getZoomScale()):e.deltaX>0&&this.dollyOut(this.getZoomScale()):e.deltaY<0?this.dollyIn(this.getZoomScale()):e.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update(),this.gesture=!1,this.isPointerDown=!1}}handleTouchStartRotate(){if(at.length===2){let e=.5*(at[0].pageX+at[1].pageX),t=.5*(at[0].pageY+at[1].pageY);this.rotateStart.set(e,t)}else this.rotateStart.set(at[0].pageX,at[0].pageY)}handleTouchStartPan(){if(at.length===2){let e=.5*(at[0].pageX+at[1].pageX),t=.5*(at[0].pageY+at[1].pageY);this.panStart.set(e,t)}else this.panStart.set(at[0].pageX,at[0].pageY)}handleTouchStartDolly(){let e=at[0].pageX-at[1].pageX,t=at[0].pageY-at[1].pageY,i=Math.sqrt(e*e+t*t);this.dollyStart.set(0,i)}handleTouchStartDollyPan(){this.enableZoom&&this.isTouchZoom===!0&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&this.isTouchZoom===!0&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(e){if(at.length===2){let i=wg(e),r=.5*(e.pageX+i.x),s=.5*(e.pageY+i.y);this.rotateEnd.set(r,s)}else{if(e.pointerId!==at[0].pointerId)return;this.rotateEnd.set(e.pageX,e.pageY)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;t&&(this.rotateLeft(2*Math.PI*this.rotateDelta.x/t.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/t.clientHeight)),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(e){if(at.length===2){let t=wg(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this.panEnd.set(i,r)}else{if(e.pointerId!==at[0].pointerId)return;this.panEnd.set(e.pageX,e.pageY)}this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(e){let t=wg(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);this.dollyEnd.set(0,s),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,this.zoomSpeed)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(e){this.enableZoom&&this.isTouchZoom===!0&&this.handleTouchMoveDolly(e),this.enablePan&&this.handleTouchMovePan(e)}handleTouchMoveDollyRotate(e){this.enableZoom&&this.isTouchZoom===!0&&this.handleTouchMoveDolly(e),this.enableRotate&&this.handleTouchMoveRotate(e)}checkRaycastLock(){if(this.object.data.raycastLock){if(this.options.isPlayMode)return!1;{let e=this.options?.showCameraLock;return e&&e(),!0}}else return!1}};function aa(e){let t=Math.PI*2;for(;e<=-Math.PI;)e+=t;for(;e>Math.PI;)e-=t;return e}function F2(e){return 1-Math.pow(1-e,4)}var k2=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.page=r,this.currentIntersectedObjects=[],this.actions=Bi(t,t.actions,r,s,a,i),this.target=t.target,this.triggeringObjects=[];for(let n of t.triggeringObjects){let o=r.scene.find(n);o&&this.triggeringObjects.push(o)}}isValidTriggeringObject(e){return this.target==="all"?!0:this.triggeringObjects.some(t=>t===e||t.isAncestorOf(e.uuid)||e.isAncestorOf(t.uuid))}disconnect(){ar(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.SwitchCamera.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{e.data.runMode==="Toggle"?e.toggle():e.play()}),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(!1)}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()))}},Ot;fH.then(e=>Ot=e);var Ci=new M,Rs=new nt,Fn=new M,zv=new Di(0,0,0,"YXZ"),U2=new Di(0,0,0,"XYZ"),Ls=new M,Bv=new M,Fv=new M(1,1,1),ql=new nt,Ap=new xe,N2=new xe,W$={type:"updateMatrix"},V2=new nt,kv=new is,Xy={type:"beginEvent",eventName:"Collision"},q$={type:"beginEvent",eventName:"Trigger"};function X$(e){if(Eu.physicsEnabled(e.scene.objects))return!0;let t=!1;return e.scene.objects.traverse((i,r)=>{if(r.events){if(Array.isArray(r.events)){for(let s of r.events)if(s.data.disabled!==!0&&s.data.type==="GameControl"&&s.data.collisionEnabled){t=!0;break}}else for(let s of Object.values(r.events))if(s.disabled!==!0&&s.type==="GameControl"&&s.collisionEnabled){t=!0;break}}}),t}var Zf=e=>e.states.some(t=>t.data.position!==void 0||t.data.rotation!==void 0||t.data.hiddenMatrix!==void 0||t.data.cloner!==void 0||t.data.pathSnapping!==void 0),Y$=class{constructor(e){this.eventContext=e,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this.processRigidBody=t=>{if(t.bodyType()!==Ot.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[i,r,s]=this.rigidBodyToMesh.get(t.handle);if(Ci.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),Rs.copy(t.rotation()),i.matrixWorld.compose(Ci,Rs,r),i.hasNonUniformScale&&i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(W$),s){let a=i.cloner;if(a&&a.objectForSample===void 0){a.matrixWorld.copy(i.matrixWorld);for(let n of a.children)n.updateMatrixWorld(!0)}for(let n of i.children)n.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(t,i,r)=>{if(r===!1)return;let s,a;if(this.sensorToTriggerEvent[t]?(s=this.sensorToTriggerEvent[t],a=this.sharedGameControlGlobals.colliderToEntity.get(i)):this.sensorToTriggerEvent[i]&&(s=this.sensorToTriggerEvent[i],a=this.sharedGameControlGlobals.colliderToEntity.get(t)),s&&a&&s.isValidTriggeringObject(a)){s.dispatch();return}for(let n=this.sharedGameControlGlobals.createdObjects.length-1;n>=0;n--){let o=this.sharedGameControlGlobals.createdObjects[n];if(o.userData.hasCollisionDestroy&&(o.rigidBody?.collider(0).handle===t||o.rigidBody?.collider(0).handle===i)){this.sharedGameControlGlobals.createdObjects.splice(n,1),o.removeFromParent(),requestAnimationFrame(()=>this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(o.rigidBody));break}}if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let n=this.sharedGameControlGlobals.colliderToEntity.get(i),o=this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,n,i)}else if(this.gameControl?.object!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let n=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid];if(o===void 0)return;for(let l of o)l.data.target==="character"&&this.dispatchCollisionEvent(l,n,t)}else{let n=this.sharedGameControlGlobals.colliderToEntity.get(t),o=this.sharedGameControlGlobals.entityToCollisionEvents[n.uuid];if(o!==void 0)for(let c of o)c.data.target==="scene"&&this.dispatchCollisionEvent(c,n,t);let l=this.sharedGameControlGlobals.colliderToEntity.get(i),h=this.sharedGameControlGlobals.entityToCollisionEvents[l?.uuid];if(h!==void 0)for(let c of h)c.data.target==="scene"&&this.dispatchCollisionEvent(c,l,i)}},this.isExport=e.isExport,this.sharedAssets=e.sharedAssets,this.renderer=e.renderer,this.requestRender=e.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=rD,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}attachVRControllers(e){e.forEach(t=>{t.addEventListener("connected",i=>{"gamepad"in i.data&&"axes"in i.data.gamepad&&this.sharedGameControlGlobals.gamePads.push(i.data.gamepad)})})}markIsDestroyTarget(){this.page.traverseVisibleEntity(e=>{let t=e.dataPatched;for(let i of t.events){if(i.data.disabled===!0)continue;let r=i.data.actions?.find(s=>s.data.type==="Destroy")?.data;if(r)for(let s of r.objects){let a=this.page.scene.find(s);a&&(a.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(e=>{let t=e.dataPatched;for(let i of t.events)if(!(i.data.disabled===!0||i.data.type!=="DragDrop"))for(let r of i.data.objects){let s=this.page.scene.find(r);s&&(s.userData.hasDrag=!0)}})}initBVH(){let e=[];if(this.page.traverseChildren(t=>{let i,r=t instanceof au,s=t instanceof nu;if(t instanceof ys||r||s)return;t instanceof vr?i=t.object:i=t;let a=i.dataPatched;if(a.physics?.enabled==="visibility"?!a.visible:!a.physics?.enabled)return!0;let n=t.geometry,o=i.userData.hasDestroy===!0,l=i.userData.hasDrag===!0;if(Zf(a)||o||l||i.dataPatched.events.some(h=>h.data.disabled!==!0&&(h.data.type==="GameControl"||h.data.type==="Follow")))return t.updateMatrixWorldSVD(),this.addBoundsTree(t),!0;n&&n.getAttribute("position").count>0&&e.push(Za(n,t.matrixWorld))}),e.length>0){let t=jo(e,!1);this.sharedGameControlGlobals.staticMeshBVH=new tu(t)}}addRigidBody(e,t,i){if(aD(e.matrixWorld))return;let r=[],s="geometry"in e?e.geometry:void 0,a=t.dataPatched;if(s?.getAttribute("position")!==void 0&&r.push(Za(s,e.shearScale)),a.physics.fusedBody){let n=this.gatherChildrenGeom(e,r);e.traverseObject(n),e.children.forEach(l=>l.updateMatrixWorld(!0));let o=e.cloner;o&&o.objectForSample===void 0&&a.physics.rigidBody==="dynamic"&&(o.traverseObject(n),o.children.forEach(l=>l.updateMatrixWorld(!0)))}if(r.length>0){let n,o=!i.fromCreate&&a.physics.rigidBody==="dynamic"||i.fromCreate&&i.dynamic;o?(n=Ot.RigidBodyDesc.dynamic(),n.setLinearDamping(a.physics.damping).setAngularDamping(a.physics.damping).setAdditionalMass(1e-9).setGravityScale(a.physics.gravityScale).enabledRotations(...a.physics.enabledRotation).enabledTranslations(...a.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(n=Ot.RigidBodyDesc.kinematicPositionBased(),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e)):n=Ot.RigidBodyDesc.fixed();let l=jo(r);(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(Ci,Rs,Fn),e.position0=Ci.clone().divideScalar(this.pixelsPerMeter),e.rotation0=Rs.clone(),Ci.divideScalar(this.pixelsPerMeter),n.setTranslation(Ci.x,Ci.y,Ci.z).setRotation(Rs),s?l?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):l?.scale(Fn.x/this.pixelsPerMeter,Fn.y/this.pixelsPerMeter,Fn.z/this.pixelsPerMeter);let h=this.sharedGameControlGlobals.rapierWorld.createRigidBody(n);o&&this.rigidBodyToMesh.set(h.handle,[e,Fn.clone(),a.physics.fusedBody]);let c=!(a.geometry===void 0||a.geometry.type==="SubdivGeometry"||a.geometry.type==="NonParametricGeometry"||a.geometry.type==="BooleanGeometry"||a.geometry.type==="VectorGeometry"||a.geometry.type==="StarGeometry"||a.geometry.type==="RectangleGeometry"||a.geometry.type==="EllipseGeometry"||a.geometry.type==="TriangleGeometry"||a.geometry.type==="TorusGeometry"||a.geometry.type==="HelixGeometry");try{this.addCollider(h,a.physics,l,t,c)}catch{try{this.addCollider(h,a.physics,l,t,!1)}catch(u){console.error(u)}}e.rigidBody=h}}addBoundsTree(e){let t=[];if(e.geometry?.getAttribute("position")!==void 0&&e.geometry?.getAttribute("position").count>0&&t.push(Za(e.geometry,e.shearScale)),e.traverseObject(this.gatherChildrenGeom(e,t)),e.children.forEach(i=>i.updateMatrixWorld(!0)),t.length>0){let i=jo(t,!1);e.bvhGeometry=i,i.getAttribute("position").count>0&&(e.bvhGeometry.boundsTree=new tu(i),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e))}}addCollider(e,t,i,r,s=!0){if(i?.getAttribute("position").count===0||i?.getIndex()?.count===0)return;let a;i&&(t.colliderType==="trimesh"?a=Ot.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):a=Ot.ColliderDesc.convexMesh(i.getAttribute("position").array,s?i.getIndex().array:void 0)),a.setFrictionCombineRule(Ot.CoefficientCombineRule.Average).setRestitutionCombineRule(Ot.CoefficientCombineRule.Average).setDensity(t.density).setFriction(t.friction).setRestitution(t.restitution);let n=this.sharedGameControlGlobals.rapierWorld.createCollider(a,e);this.sharedGameControlGlobals.colliderToEntity.set(n.handle,r),this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid]?.some(o=>o.target==="scene")&&n.setActiveEvents(Ot.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(e,t){return(i,r)=>{if(r===0)return;let s;if(i instanceof ys)if(i.objectForSample){if(i.objectForSample.dataPatched.physics.fusedBody)return;s=i.object}else return i.object.dataPatched.physics.fusedBody===!0&&i.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(i instanceof vr)s=i.object;else if(s=i,s.dataPatched.cloner?.hideBase)return!0;let a=s.dataPatched;
8167if(a.physics.enabled==="visibility"?!a.visible:!a.physics.enabled)return!0;r===1?e.hasNonUniformScale?i.matrixWorld.multiplyMatrices(e.shearScale,i.hiddenMatrix):i.matrixWorld.copy(i.hiddenMatrix):i.matrixWorld.multiplyMatrices(i.parent.matrixWorld,i.hiddenMatrix),i.matrixWorld.multiply(i.matrix);let n=i.geometry;n?.getAttribute("position")!==void 0&&t.push(Za(n,i.matrixWorld))}}activate(e){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=e,this.usePhysics=this.page.data.globalPhysics.usePhysics;let t=this.page.playCamera,i=!1,r=5,s=8,a=9,n="drag",o=this.page.data.publish.gameControlObject,l=o!==null?this.page.find(o):null,h=null;if(l)for(let d of l.data.events){if(d.data.disabled||d.data.type!=="GameControl")continue;let p=l;for(;this.usePhysics&&(p=p.parent)?.parent!==null;)p.data.physics?.fusedBody;d.data.collisionEnabled&&(this.needsCollisionDetection=!0),h===null&&(h=d.data)}if(this.page.traverseEntity(d=>{for(let p of d.dataPatched.events)if(p.data.disabled===!1&&p.data.type==="Trigger")return this.needsCollisionDetection=!0,!0}),l&&h&&(l.data.visible===!0||l.data.physics.enabled===!0)){i=i||h.camera===t.uuid||l.uuid===t.uuid;let d=new sD(l,this.renderer.domElement,h,this.eventContext.page.data.globalPhysics,this,l.uuid!==t.uuid&&h.camera===t.uuid,t,this.page,this.sharedAssets);this.gameControl=d,r=h.joystickPosLoc,s=h.joystickRotLoc,a=h.jumpTouchButtonLoc,n=h.rotByTouch,ts&&h.touchControl&&(this.joystickToGameControls[r]="pos",h.moveMode==="walk"&&(this.joystickToGameControls[a]="jmp"),n==="joystick"&&(this.joystickToGameControls[s]="rot"))}if(this.gameControl&&this.gameControl.data.navmesh.enabled){let d=this.gameControl.data;if(!this.navigationMeshWrapper){this.navigationMeshWrapper=new z$(this.usePhysics,this.isExport);let p;d.collider.type==="sphere"?p=d.collider.radius*2:p=d.collider.height,p=Math.floor(p/d.navmesh.ch-1),this.navigationMeshWrapper.init({...d.navmesh,walkableHeight:p},this.gameControl,this.eventContext)}}if(i===!1){let{enableRotate:d,enablePan:p,enableZoom:f,autoRotate:m,hoverRotatePanMode:g}=this.eventManager.publish.orbitControls;(d||p||f||m||g!==0)&&(this.orbitControls=new pD(t,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let c=this.renderer.domElement.width/this.renderer.getPixelRatio(),u=this.renderer.domElement.height/this.renderer.getPixelRatio();this.joystickToGameControls.forEach((d,p)=>{let f=document.body.appendChild(document.createElement("div")),[m,g,v]=this.eventManager.eventContext.publish.joystickSizeAndXYOffset[p],y=(c-5*m)/4+m,x={},w=d==="jmp",S=w?0:m;p<10?(p<5?x.top=S/2:x.bottom=S/2,x.left=S/2+p%5*y):p===10?(x.left=S/2,x.top=u/2):(x.right=S/2,x.top=u/2),x.top?x.top-=g[1]:x.bottom+=g[1],x.left?x.left+=g[0]:x.right-=g[0];for(let _ in x)x[_]+="px";if(w){let _=f.appendChild(document.createElement("div"));Object.assign(_.style,x,{position:"absolute",width:m+"px",height:m+"px",backgroundColor:`rgba(255,255,255,${v==="show"?.4:0})`,zIndex:"9999",borderRadius:m+"px",border:v==="show"?"solid 2px rgba(0, 0, 0, .1)":"none",display:"flex",alignItems:"center",justifyContent:"center",touchAction:"none"});let A=m/16*16*.4;v==="show"&&(_.innerHTML=` 8168 <svg width="${A}" height="${m*.4}" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> 8169 <path d="M2 10L8 4L14 10" stroke="black" stroke-opacity="40%" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> 8170 </svg> 8171 `),_.addEventListener("pointerdown",()=>{this.gameControl.movementState.jump=1,this.requestRender()}),_.addEventListener("touchend",C=>C.preventDefault()),this.joysticks[p]=[void 0,f];return}let b={zone:f,mode:"static",position:x,size:m};v==="hide"&&(b.restOpacity=0);let E=KZ.create(b);E.on("move",(_,A)=>{let C=this.gameControl;d==="pos"?A.force<.2?C.moveForce=0:(C.movementState.movePosZ=Math.sin(-A.angle.radian),C.movementState.movePosX=Math.cos(-A.angle.radian),A.force>1.2?C.movementState.run=1:C.movementState.run=0,A.force<.3?C.moveForce=(A.force-.2)/.1:C.moveForce=1):d==="rot"&&(A.force<.2?C.rotForce=0:(C.movementState.rotPosX=A.vector.y,C.movementState.rotPosY=-A.vector.x,A.force<.3?C.rotForce=(A.force-.2)/.1:C.rotForce=1)),this.requestRender()}),E.on("end",(_,A)=>{let C=this.gameControl;d==="pos"?(C.movementState.movePosZ=0,C.movementState.movePosX=0,C.moveForce=1):d==="rot"&&(C.movementState.rotPosX=0,C.movementState.rotPosY=0,C.rotForce=1)}),this.joysticks[p]=[E,f]}),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>
vendor: 25,644 bytes, lines 8171-8172
8171{this.collisionEvents.forEach(d=>d.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new Ot.World(new Ot.Vector3(0,this.gravity,0)),this.events=new Ot.EventQueue(!0);let e=[],t=[];if(this.page.traverseChildren(n=>{let o;if(n instanceof ys)if(n.objectForSample){if(n.objectForSample.dataPatched.physics.fusedBody)return;o=n.object}else return n.object.dataPatched.physics.fusedBody===!0&&n.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(n instanceof vr)o=n.object;else{if(n instanceof nu||n instanceof au)return;if(o=n,o.dataPatched.cloner?.disabled===!1&&o.dataPatched.cloner?.hideBase&&o.dataPatched.physics?.fusedBody!==!0)return!0}let l=o.dataPatched,h;for(let g of l.events)g.data.disabled!==!0&&g.data.type==="GameControl"&&(h=g.data);if(!l.physics||(l.physics.enabled==="visibility"?!l.visible:!l.physics.enabled))return!0;n.updateMatrixWorldSVD();let c=Zf(l),u=!1,d=o.userData.hasDestroy,p=o.userData.hasDrag,f=!1;for(let g of l.events)if(g.data.disabled!==!0){if(g.data.type==="Collision"){u=!0;let v=new A$(g.id,g.data,o,this.page,this.sharedAssets,this.eventManager);v.initialDisabled=!0,this.collisionEvents.push(v),this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].every(y=>y.id!==g.id)?this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid].push(v):this.sharedGameControlGlobals.entityToCollisionEvents[o.uuid]=[v]}else if(g.data.type==="Follow"){f=!0;let v=g.data.target;n.traverseVisible(y=>{y.userData.isFollowingObj=v})}}l.physics.rigidBody==="dynamic"&&l.physics.fusedBody===!1&&(n.matrixWorldFusedFalse=n.matrixWorld.clone());let m=n.geometry;if(h!==void 0){let g=Ot.RigidBodyDesc.kinematicPositionBased();(n.hasNonUniformScale?n.matrixWorldRigid:n.matrixWorld).decompose(Ci,Rs,Fn),n.position0=Ci.clone().divideScalar(this.pixelsPerMeter),n.rotation0=Rs.clone(),Ci.divideScalar(this.pixelsPerMeter),g.setTranslation(Ci.x,Ci.y,Ci.z).setRotation(Rs);let v=this.sharedGameControlGlobals.rapierWorld.createRigidBody(g);n.rigidBody=v;let y;h.collider.type==="sphere"?y=Ot.ColliderDesc.ball(h.collider.radius/this.pixelsPerMeter):h.collider.type==="capsule"?y=Ot.ColliderDesc.capsule((h.collider.height/2-h.collider.radius)/this.pixelsPerMeter,h.collider.radius/this.pixelsPerMeter):y=Ot.ColliderDesc.cuboid(h.collider.width/this.pixelsPerMeter/2,h.collider.height/this.pixelsPerMeter/2,h.collider.depth/this.pixelsPerMeter/2),y.setFrictionCombineRule(Ot.CoefficientCombineRule.Average).setRestitutionCombineRule(Ot.CoefficientCombineRule.Average).setDensity(l.physics.density).setFriction(l.physics.friction).setRestitution(l.physics.restitution);let x=this.sharedGameControlGlobals.rapierWorld.createCollider(y,v);this.sharedGameControlGlobals.colliderToEntity.set(x.handle,o),Ci.fromArray(h.collider.position.map(S=>typeof S=="number"?S:0)).multiply(Fn.setFromMatrixScale(o.matrixWorld)).divideScalar(this.pixelsPerMeter),x.setTranslationWrtParent(Ci);let w=new nt().setFromEuler(new Di().setFromVector3(new M().fromArray(h.collider.rotation.map(S=>typeof S=="number"?S:0))));x.setRotationWrtParent(w),x.setActiveEvents(Ot.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(o,!0)}else l.physics.rigidBody==="dynamic"||c||f||d||p||u?(this.addRigidBody(n,o,{hasFollow:f,hasTransformAnim:c,hasDrag:p}),this.generateSensorColliderDescs(o,l.physics.fusedBody)):(m&&e.push(Za(m,n.matrixWorld)),l.physics.fusedBody&&n.traverseObject((g,v)=>{if(v===0)return;let y;if(g instanceof ys)if(g.objectForSample){if(g.objectForSample.dataPatched.physics.fusedBody)return;y=g.object}else return g.object.dataPatched.physics.fusedBody===!0&&g.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else{if(g instanceof nu||g instanceof au)return;if(g instanceof vr)y=g.object;else if(y=g,y.dataPatched.cloner?.hideBase)return!0}let x=y.dataPatched;if(x.physics.enabled==="visibility"?!x.visible:!x.physics.enabled)return!0;let w=g.geometry;w?.getAttribute("position")!==void 0&&e.push(Za(w,g.matrixWorld))}),this.generateSensorColliderDescs(o,l.physics.fusedBody,t));if(l.physics?.fusedBody===!0||h)return!0}),e.length===0)return;let i=jo(e);i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let r=Ot.RigidBodyDesc.fixed(),s=this.sharedGameControlGlobals.rapierWorld.createRigidBody(r),a=Ot.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Ot.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Ot.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,s);for(let[n,o]of t){let l=this.sharedGameControlGlobals.rapierWorld.createCollider(n,s);this.sensorToTriggerEvent[l.handle]=o}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(e=>{for(let t of e.dataPatched.events)if(t.data.type==="Trigger"&&t.data.disabled!==!0){let i=new k2(t.id,t.data,e,this.page,this.sharedAssets,this.eventManager),r=new xe().compose(Ls.fromArray(t.data.position.map(s=>typeof s=="number"?s:0)),ql.setFromEuler(U2.fromArray(t.data.rotation.map(s=>typeof s=="number"?s:0))),Fv);if(t.data.triggerZone==="box"){let s=new yi;s.min.fromArray(t.data.size.map(a=>typeof a=="number"?a:0)).multiplyScalar(-.5),s.max.fromArray(t.data.size.map(a=>typeof a=="number"?a:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([s,r,e,i])}else this.sharedGameControlGlobals.triggers.push([t.data.radius,r,e,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(e=>e.disconnect()),this.sharedGameControlGlobals.triggers.forEach(e=>e[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(e=>{let t=e;t.matrixWorldFusedFalse&&(t.matrixWorldFusedFalse=void 0),t.rigidBody&&(t.rigidBody=void 0),t.position0&&(t.position0=void 0),t.rotation0&&(t.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([e,t])=>{e?.destroy(),t.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let e of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))e.forEach(t=>t.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(e,t,i){if(!this.isEnabled)return!0;let r=!0;if(this.orbitControls!==void 0&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),r=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,r=!1):this.initializationCounter===2&&this.gameControl&&(r=!this.gameControl.update(e,t,i)&&r),this.usePhysics===!1&&this.checkTrigger(),this.usePhysics){let s=.016666666666666666;if(e===0)r=this.stepPhysics()&&r;else{let a=e/1e3;a<s&&a>s*.55&&(a=s),this.accumulator+=a;let n=performance.now(),o=0,l=6;for(;this.accumulator>=s&&o<l&&(r=this.stepPhysics()&&r,this.accumulator-=s,o++,!(performance.now()-n>s*1e3)););this.accumulator=this.accumulator%s}}this.skipRender=r}stepPhysics(){for(let e of this.sharedGameControlGlobals.entitiesWithTransformAnim){(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(Ci,Rs,Fn),zv.setFromQuaternion(Rs);let t=e;t.prevR===void 0?(t.prevR=zv.clone(),t.prevT=Ci.clone()):(t.prevR.copy(zv),t.prevT.copy(Ci)),e.rigidBody&&(e.rigidBody.setNextKinematicTranslation(Ci.divideScalar(this.pixelsPerMeter)),e.rigidBody.setNextKinematicRotation(Rs))}return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(e,t,i){let r=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent,s;if(t.cloner){for(let a of t.cloner.children)if(a.rigidBody===r){s=a;break}}e.dispatch(s),t.dispatchEvent(Xy)}updateUseWindowEvents(e){this.orbitControls?.updateUseWindowEvents(e)}generateSensorColliderDescs(e,t,i){let r=N2.copy(e.matrixWorld).invert();e.traverseEntity((s,a)=>{if(t===!1&&a===1)return!0;for(let n of s.dataPatched.events)if(n.data.type==="Trigger"&&n.data.disabled!==!0){let o=new k2(n.id,n.data,s,this.page,this.sharedAssets,this.eventManager),l;if(n.data.triggerZone==="box"?l=Ot.ColliderDesc.cuboid(...n.data.size.map(h=>(typeof h=="number"?h:1)/(2*this.pixelsPerMeter))):l=Ot.ColliderDesc.ball(n.data.radius/this.pixelsPerMeter),l.setDensity(0).setSensor(!0).setActiveEvents(Ot.ActiveEvents.COLLISION_EVENTS),Ls.fromArray(n.data.position.map(h=>typeof h=="number"?h:0)),ql.setFromEuler(U2.fromArray(n.data.rotation.map(h=>typeof h=="number"?h:0))),Ap.compose(Ls,ql,Fv).premultiply(s.matrixWorld),i?(Ap.decompose(Ls,ql,Bv),l.setActiveCollisionTypes(Ot.ActiveCollisionTypes.KINEMATIC_FIXED|Ot.ActiveCollisionTypes.DYNAMIC_FIXED)):(Ap.premultiply(r).decompose(Ls,ql,Bv),e.rigidBody.bodyType()===Ot.RigidBodyType.Dynamic||(e.rigidBody.bodyType()===Ot.RigidBodyType.Fixed?l.setActiveCollisionTypes(Ot.ActiveCollisionTypes.KINEMATIC_FIXED|Ot.ActiveCollisionTypes.DYNAMIC_FIXED):l.setActiveCollisionTypes(Ot.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Ot.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),Ls.divideScalar(this.pixelsPerMeter),l.setTranslation(Ls.x,Ls.y,Ls.z),l.setRotation(ql),i)i.push([l,o]);else{let h=this.sharedGameControlGlobals.rapierWorld.createCollider(l,e.rigidBody);this.sensorToTriggerEvent[h.handle]=o}}})}checkTrigger(){let e;for(let t=0;t<this.sharedGameControlGlobals.triggers.length;t++){let[i,r,s,a]=this.sharedGameControlGlobals.triggers[t];for(let n=0;n<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;n++){let o=this.sharedGameControlGlobals.entitiesWithTransformAnim[n];if(s===o||a.isValidTriggeringObject(Tt.is(o)?o:o.object)===!1)continue;let l=N2.copy(s.matrixWorld).decompose(Ls,V2,Bv).compose(Ls,V2,Fv).multiply(r),h=Ap.copy(o.matrixWorld).invert().multiply(l);i instanceof yi?e=o.bvhGeometry.boundsTree.intersectsBox(i,h):(kv.radius=i,kv.center.setFromMatrixPosition(h),e=o.bvhGeometry.boundsTree.intersectsSphere(kv)),e?a.currentIntersectedObjects.indexOf(o)===-1&&(a.currentIntersectedObjects.push(o),a.dispatch(),s.dispatchEvent(q$)):a.currentIntersectedObjects=a.currentIntersectedObjects.filter(c=>c!==o)}}}};function Q$(e){let t=this._clip.duration,i=this._clip.start??0,r=this.loop,s=this.time+e,a=this._loopCount,n=r===Qy;if(e===0)return a===-1?s:n&&(a&1)===1?t-(s-i):s;if(r===aM){a===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(s>=t)s=t;else if(s<0)s=0;else{this.time=s;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(a===-1&&(e>=0?(a=0,this._setEndings(!0,this.repetitions===0,n)):this._setEndings(this.repetitions===0,!0,n)),s>=t||s<i){let o=Math.floor((s-i)/(t-i));s-=(t-i)*o,a+=Math.abs(o);let l=this.repetitions-a;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n||(s=e>0?t:i,this.repetitions===1&&(s=t)),this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){let h=e<0;this._setEndings(h,!h,n)}else this._setEndings(!1,!1,n);this._loopCount=a,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=s;if(n&&(a&1)===1)return t-(s-i)}return s}var j2=!1,K$=class{constructor(e,t,i,r){this.scene=e,this.requestRender=t,this.updateDisplayProgress=i,this.animationInspectorState=r,this.clipIdToAction={},this.activeClip=null,this.needsUpdate=!1,this.addClip=s=>{s.data.type==="Empty"&&s.data.animations&&s.data.animations.forEach((a,n)=>{let o=a[0]+"/";if(Array.isArray(s.identity)?o+=s.identity[0]:o+=s.uuid,this.clipIdToAction[o])return;let l=$v.parse(JSON.parse(a[2]));s.animations[n]=l;let h=this.mixer.clipAction(l,s);j2===!1&&(Object.getPrototypeOf(h)._updateTime=Q$,j2=!0),h.clampWhenFinished=!0,this.clipIdToAction[o]=h})},this.mixer=new GB(e),this.scene.traverseEntity(this.addClip)}deleteClip(e,t){let i=this.scene.find(t);if(!i)return;let r=i.animations.find(a=>a.uuid===e);if(!r)return;let s=this.clipIdToAction[e];!s||(s.stop(),this.mixer.uncacheClip(r),delete this.clipIdToAction[e],i.animations=i.animations.filter(a=>a.uuid!==e))}get isPlaying(){return Object.values(this.clipIdToAction).some(e=>e.isRunning())}playFromInspector(e){this.mixer.stopAllAction();let t=this.clipIdToAction[e];!t||(t.play(),this.activeClip=t.getClip(),this.requestRender())}onExitPlayMode(){Object.values(this.clipIdToAction).forEach(e=>{e.repetitions=1/0,e.loop=nM}),this.mixer.stopAllAction(),this.requestRender()}play(e){let t=e.clipId+"/"+e.object,i=this.clipIdToAction[t];if(i)return e&&(e.repeat>=0&&(i.repetitions=e.repeat+1),e.direction==="pingpong"&&e.repeat!==0&&(i.loop=Qy)),i.play(),i.paused=!1,this.requestRender(),i}resumeFromInspector(e){let t=this.clipIdToAction[e];!t||(t.play(),t.paused=!1,this.requestRender())}pauseFromInspector(e){let t=this.clipIdToAction[e];!t||(t.paused=!0)}stop(){this.mixer.stopAllAction(),this.requestRender()}update(e){if(this.needsUpdate)this.needsUpdate=!1;else if(this.isPlaying===!1||this.animationInspectorState?.isScrubbing)return;this.mixer.update(e/1e3),this.activeClip&&this.updateDisplayProgress(Math.round(this.mixer.time/this.activeClip.duration*(this.maxFrames-1)%(this.maxFrames-1))),this.requestRender()}get maxFrames(){return QP(this.activeClip??void 0)}setProgressFromInspector(e,t){if(!this.clipIdToAction[t])return;this.activeClip!==this.clipIdToAction[t].getClip()&&this.playFromInspector(t);let i=this.clipIdToAction[t].paused;this.clipIdToAction[t].paused=!1,this.mixer.setTime(Math.min(e/(this.maxFrames-1),.9999)*this.activeClip.duration),this.requestRender(),i&&(this.clipIdToAction[t].paused=!0)}},Uv=new WeakMap,Z$=class extends ku{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,r){let s=new e0(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,a=>{this.decodeDracoFile(a,t).catch(r)},i,r)}decodeDracoFile(e,t,i,r){let s={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!i};return this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){let i=JSON.stringify(t);if(Uv.has(e)){let o=Uv.get(e);if(o.key===i)return o.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r,s=this.workerNextTaskID++,a=e.byteLength,n=this._getWorker(s,a).then(o=>(r=o,new Promise((l,h)=>{r._callbacks[s]={resolve:l,reject:h},r.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(o=>this._createGeometry(o.geometry));return n.catch(()=>!0).then(()=>{r&&s&&this._releaseTask(r,s)}),Uv.set(e,{key:i,promise:n}),n}_createGeometry(e){let t=new He;e.index&&t.setIndex(new tt(e.index.array,1));for(let i=0;i<e.attributes.length;i++){let r=e.attributes[i],s=r.name,a=r.array,n=r.itemSize;t.setAttribute(s,new tt(a,n))}return t}_loadLibrary(e,t){let i=new e0(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((r,s)=>{i.load(e,r,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{let r=i[0];e||(this.decoderConfig.wasmBinary=i[1]);let s=J$.toString(),a=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(` 8172`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(s){let a=s.data;switch(a.type){case"decode":r._callbacks[a.id].resolve(a);break;case"error":r._callbacks[a.id].reject(a);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+a.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,s){return r._taskLoad>s._taskLoad?-1:1});let i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}};function J$(){let e,t;onmessage=function(n){let o=n.data;switch(o.type){case"init":e=o.decoderConfig,t=new Promise(function(c){e.onModuleLoaded=function(u){c({draco:u})},DracoDecoderModule(e)});break;case"decode":let l=o.buffer,h=o.taskConfig;t.then(c=>{let u=c.draco,d=new u.Decoder,p=new u.DecoderBuffer;p.Init(new Int8Array(l),l.byteLength);try{let f=i(u,d,p,h),m=f.attributes.map(g=>g.array.buffer);f.index&&m.push(f.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:f},m)}catch(f){console.error(f),self.postMessage({type:"error",id:o.id,error:f.message})}finally{u.destroy(p),u.destroy(d)}});break}};function i(n,o,l,h){let c=h.attributeIDs,u=h.attributeTypes,d,p,f=o.GetEncodedGeometryType(l);if(f===n.TRIANGULAR_MESH)d=new n.Mesh,p=o.DecodeBufferToMesh(l,d);else if(f===n.POINT_CLOUD)d=new n.PointCloud,p=o.DecodeBufferToPointCloud(l,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!p.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+p.error_msg());let m={index:null,attributes:[]};for(let g in c){let v=self[u[g]],y,x;if(h.useUniqueIDs)x=c[g],y=o.GetAttributeByUniqueId(d,x);else{if(x=o.GetAttributeId(d,n[c[g]]),x===-1)continue;y=o.GetAttribute(d,x)}m.attributes.push(s(n,o,d,g,v,y))}return f===n.TRIANGULAR_MESH&&(m.index=r(n,o,d)),n.destroy(d),m}function r(n,o,l){let h=l.num_faces()*3,c=h*4,u=n._malloc(c);o.GetTrianglesUInt32Array(l,c,u);let d=new Uint32Array(n.HEAPF32.buffer,u,h).slice();return n._free(u),{array:d,itemSize:1}}function s(n,o,l,h,c,u){let d=u.num_components(),p=l.num_points()*d,f=p*c.BYTES_PER_ELEMENT,m=a(n,c),g=n._malloc(f);o.GetAttributeDataArrayForAllPoints(l,u,m,f,g);let v=new c(n.HEAPF32.buffer,g,p).slice();return n._free(g),{name:h,array:v,itemSize:d}}function a(n,o){switch(o){case Float32Array:return n.DT_FLOAT32;case Int8Array:return n.DT_INT8;case Int16Array:return n.DT_INT16;case Int32Array:return n.DT_INT32;case Uint8Array:return n.DT_UINT8;case Uint16Array:return n.DT_UINT16;case Uint32Array:return n.DT_UINT32}}}var io;function H2(e){return io||(io=new Z$,io.setDecoderPath(e!==void 0?`${e}/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),io.decoderPending}async function $$(e){if(io){let t={attributeIDs:io.defaultAttributeIDs,attributeTypes:io.defaultAttributeTypes,useUniqueIDs:!1},i;try{i=await io.decodeGeometry(new Int8Array(e).buffer,t)}catch(r){console.error(r)}if(i)return{index:i.index?{array:i.index.array}:void 0,attributes:Object.entries(i.attributes).map(([r,s])=>({name:r,itemSize:s.itemSize,array:s.array}))}}return null}async function eee(e,t){let[i,r]=$E(gf.deserialize(new Uint8Array(e)));return vC(i),r.result().data}function tee(e){let t=[];return e.scene.objects.traverse((i,r)=>{r.type==="Mesh"&&r.geometry.type==="NonParametricGeometry"&&r.geometry.data.draco!==void 0&&t.push(r)}),t}async function G2(e){for(let t of e){let i=await $$(t.geometry.data.draco);if(i){let r=t.geometry.data;i.index&&(r.index={array:i.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let s={};i.attributes.forEach(({name:a,array:n,itemSize:o})=>{s[a]={array:n,itemSize:o,type:"Float32Array",normalized:!1}}),r.attributes=s,r.draco=void 0}}}var iee=class{constructor(){this._clickCount=0,this._lastTime=0,this._lastPosition=[0,0],this._delay=500,this._distance=2,this._onMouseDown=e=>{let t=[e.clientX,e.clientY],i=new Date().getTime();if(this._clickCount>0){let r=t[0]-this._lastPosition[0],s=t[1]-this._lastPosition[1];Math.sqrt(r*r+s*s)>this._distance&&(this._clickCount=0)}this._lastPosition=t,this._clickCount=i-this._lastTime>this._delay?1:this._clickCount+1,this._lastTime=i},this._onMouseUp=e=>{}}start(e,t=500,i=2){this._target&&this.stop(),this.reset(),this._delay=t,this._distance=i,this._target=e,this._target.addEventListener("pointerdown",this._onMouseDown,!1),this._target.addEventListener("pointerup",this._onMouseUp,!1)}stop(){this._target&&(this._target.removeEventListener("pointerdown",this._onMouseDown,!1),this._target.removeEventListener("pointerup",this._onMouseUp,!1),this._target=void 0)}get clickCount(){return this._clickCount}reset(){this._clickCount=0,this._lastTime=0,this._lastPosition=[0,0]}},ree=class{constructor(e,t,i,r,s,a,n,o){this.eventId=e,this.id=t,this.data=i,this.dataEvent=r,this.object=s,this.stage=!1,this.actions=Bi(r,i.actions,a,n,o,s)}disconnect(){ar(this.actions)}dispatchIn(){this.actions.Audio.forEach(e=>e.dispatchBasic()),this.actions.Particles.forEach(e=>e.dispatchBasic()),this.actions.Video.forEach(e=>e.dispatchBasic()),this.actions.Create.forEach(e=>e.dispatch()),this.actions.Destroy.forEach(e=>e.dispatch()),this.actions.Reset.forEach(e=>e.dispatch()),this.actions.Link.forEach(e=>e.dispatch()),this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),this.actions.Transition.forEach(e=>e.toggle()),this.actions.Animation.forEach(e=>e.play()),this.actions.SwitchCamera.forEach(e=>e.play()),this.actions.SceneTransition.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}dispatchOut(){this.actions.Transition.forEach(e=>{e.toggle()})}},see=class extends Er{constructor(e,t){super(e),this.eventManager=t,this.breakpoints=[],this.resize=(i,r)=>{this.breakpoints.forEach(s=>{let a=w0.deviceToSize(s.data.size),n=s.dataEvent.orientation==="horizontal"?i:r,o;switch(s.data.operator){case"<":o=n<a[0];break;case">":o=n>a[0];break;case"<>":o=n>a[0]&&n<a[1];break}s.stage!==o&&(s.stage=o,s.stage?s.dispatchIn():s.dispatchOut())})},this.onResizeObserver=new ResizeObserver(i=>{for(let r of i){let{width:s,height:a}=r.contentRect;this.resize(s,a)}})}connect(){let{page:e,sharedAssets:t,domElement:i}=this.eventContext;this.onResizeObserver.observe(i);let r=s=>{if(!(!s.visible||!s.data?.events.length))for(let{data:a,id:n}of s.data.events)a.disabled||a.type==="Resize"&&a.breakpoints.forEach(({data:o,id:l})=>{try{let h=new ree(n,l,o,a,s,e,t,this.eventManager);this.breakpoints.push(h)}catch{}})};e.traverseEntity(s=>{(s instanceof _r||s instanceof er)&&s.frame?.traverse(a=>{r(a)}),r(s)})}disconnect(){this.onResizeObserver.disconnect(),this.breakpoints.forEach(e=>{e.disconnect()}),this.breakpoints=[]}},aee=class extends Er{constructor(e,t){super(e),this.eventManager=t,this.userAPIs={},this.events=[],this.onSuccess=({userAPIId:i})=>{this.events.forEach(r=>{r.data.userAPIId===i&&r.dispatchSuccess()})},this.onError=({userAPIId:i})=>{this.events.forEach(r=>{r.data.userAPIId===i&&r.dispatchError()})},this.userAPIs=e.sharedAssets.getUserAPIs()}connect(){this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(t=>t.data.type==="API"&&!t.data.disabled).forEach(t=>{this.events.push(new nee(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),Object.entries(this.userAPIs).forEach(([e,t])=>{t.on("success",this.onSuccess),t.on("error",this.onError),t.autostart&&t.callUserAPI(this.eventContext.sharedAssets)})}disconnect(){Object.entries(this.userAPIs).forEach(([e,t])=>{t.off("success",this.onSuccess),t.off("error",this.onError)})}},nee=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.successActions=Bi(t,t.successActions,r,s,a,i),this.errorActions=Bi(t,t.errorActions,r,s,a,i)}dispatchSuccess(){this.dispatchActions(this.successActions)}dispatchError(){this.dispatchActions(this.errorActions)}
vendor: 1,589 bytes, line 8172
8172dispatchActions(e){e.Audio.forEach(t=>t.dispatchConditional()),e.Particles.forEach(t=>t.dispatchConditional()),e.Video.forEach(t=>t.dispatchConditional()),e.Create.forEach(t=>t.dispatch()),e.Destroy.forEach(t=>t.dispatch()),e.Reset.forEach(t=>t.dispatch()),e.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this),t.init()}),e.Transition.forEach(t=>t.play()),e.Animation.forEach(t=>t.play()),e.SwitchCamera.forEach(t=>t.play()),e.SceneTransition.forEach(t=>t.dispatch()),e.SetVariable.forEach(t=>t.checkConditions()),e.SetVariable.forEach(t=>t.dispatch()),e.DynamicVariablePlay.forEach(t=>t.dispatch()),e.ClearLocalStorage.forEach(t=>t.dispatch()),e.UserAPI.forEach(t=>t.dispatch())}},oee=class extends Er{constructor(e,t){super(e),this.eventManager=t,this.userWebhooks={},this.events=[],this.onMessage=({userWebhookId:i})=>{this.events.forEach(r=>{r.data.userWebhookId===i&&r.dispatch()})},this.userWebhooks=e.sharedAssets.getUserWebhooks()}connect(){this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(t=>t.data.type==="WEBHOOK"&&!t.data.disabled).forEach(t=>{this.events.push(new lee(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),Object.entries(this.userWebhooks).forEach(([e,t])=>{t.connect(),t.on("message",this.onMessage)})}disconnect(){Object.entries(this.userWebhooks).forEach(([e,t])=>{t.off("message",this.onMessage),t.disconnect()})}},lee=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.actions=Bi(t,t.actions,r,s,a,i)}dispatch(){let e=this.actions;
vendor: 14,934 bytes, lines 8172-8174
8172e.Audio.forEach(t=>t.dispatchConditional()),e.Particles.forEach(t=>t.dispatchConditional()),e.Video.forEach(t=>t.dispatchConditional()),e.Create.forEach(t=>t.dispatch()),e.Destroy.forEach(t=>t.dispatch()),e.Reset.forEach(t=>t.dispatch()),e.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this),t.init()}),e.Transition.forEach(t=>t.play()),e.Animation.forEach(t=>t.play()),e.SwitchCamera.forEach(t=>t.play()),e.SceneTransition.forEach(t=>t.dispatch()),e.SetVariable.forEach(t=>t.checkConditions()),e.SetVariable.forEach(t=>t.dispatch()),e.DynamicVariablePlay.forEach(t=>t.dispatch()),e.ClearLocalStorage.forEach(t=>t.dispatch()),e.UserAPI.forEach(t=>t.dispatch())}};function hee(){let e=document.createElement("textarea");return e.style.position="fixed",e.style.top="200px",e.style.left="400px",e.style.zIndex="-1",e.style.border="1px solid rgba(255,0,0,0.5)",e.style.width="10px",e.style.height="500px",e.style.color="white",e.style.opacity="0.5",e.style.background="transparent",e.style.display="none",e.style.margin="0px",e.style.padding="0px",e.style.boxSizing="content-box",e.style.pointerEvents="none",e}var cee=new M(0,0,1),W2=new M,q2=new M,X2=new Ii,uee=class{constructor(e,t,i,r,s){this.containerScene=e,this.raycaster=t,this.sharedAssets=i,this.requestRender=r,this.onExit=s,this.htmlInput=null,this.virtualInput=null,this.helper=new lP,this.doubleClickHandler=new iee,this.isDragging=!1,this.plane=new Hr,this.caretInterval=0,this.planeIntersection=new M,this.projected=new H,this._lastIndex=0,this._isFirstDragMove=!1,this.selectionOnDragStart=0,this.onTextMaterialChanged=()=>{let a=this.virtualInput?.data;if(this.virtualInput!==void 0&&a){let n=a.material,o=typeof n=="string"?this.sharedAssets.data.materials[n]:n,l=dK(o,this.sharedAssets);this.helper.setCaretColor(l)}},this.stopAnimateTextCursor=()=>{clearInterval(this.caretInterval),this.helper&&(this.helper.caretMesh.visible=!1)},this.startAnimateTextCursor=()=>{this.stopAnimateTextCursor(),this.helper&&(this.helper.caretMesh.visible=!0,this.caretInterval=setInterval(()=>{this.helper&&(this.helper.caretMesh.visible=!this.helper.caretMesh.visible),this.requestRender()},600))},this.handleCaretUpdate=a=>{if(!this.htmlInput||!this.virtualInput)return;let n=this.helper,o=a?.key==="ArrowLeft"||a?.key==="ArrowRight",l=a?.key==="ArrowUp"||a?.key==="ArrowDown";this.htmlInput.selectionStart===this.htmlInput.selectionEnd?(n.setCaretPosition(this.htmlInput.selectionStart,{horizontalKeyMove:o,verticalKeyMove:l}),this.startAnimateTextCursor()):n.setSelection(this.htmlInput.selectionStart,this.htmlInput.selectionEnd),this.requestRender()},this.containerScene.add(this.helper)}createInput(){return this.htmlInput=hee(),this.htmlInput}connect(){}disconnect(){this.stopAnimateTextCursor(),this.helper.hide(),this.htmlInput?.remove(),this.doubleClickHandler.stop()}handleMouseDown(){if(!this.htmlInput||!this.virtualInput)return!0;this.getPointOnPlane();let e=this.doubleClickHandler.clickCount,{index:t,lineIndex:i,characterIndex:r}=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,e>1?"inside":"previous")??{index:0,lineIndex:0,characterIndex:0};this.virtualInput?.wrappedText?.length&&this.virtualInput.wrappedText[i][Math.max(0,r-1)]===` 8173`&&(t--,r--),this._lastIndex=t,this._isFirstDragMove=!0;let s=this.checkClickedObject();if(e===1){if(s===null)return this.onExit(this.virtualInput),!0;this.selectionOnDragStart=t,this.isDragging=!0,this.setInputSelection(t)}else s===this.virtualInput&&(e===2?this.selectClosestWord(i,r):e>2&&(this.setInputSelection(0,this.htmlInput.value.length),this.doubleClickHandler.reset()))}handleMouseUp(){this.applyRangeToTextInput(),this.isDragging=!1,this._isFirstDragMove=!1}handleMouseMove(){!this.virtualInput||(this._isFirstDragMove&&this.doubleClickHandler.clickCount>1&&(this.selectionOnDragStart=this._lastIndex,this.isDragging=!0,this.setInputSelection(this._lastIndex)),this._isFirstDragMove=!1,this.getPointOnPlane(),this.applyRangeToTextInput())}focus(e){if(this.virtualInput=e,this.updateTextInputStyles(),this.htmlInput)if(e){let t=this.data?.geometry.text;this.htmlInput.value=typeof t=="string"?"":t?.textValue.toString()??""}else this.htmlInput.value=""}blur(){}get data(){let{virtualInput:e}=this;if(e)return e.dataPatched}applyRangeToTextInput(){if(!this.isDragging||!this.virtualInput||!this.htmlInput)return;let e=this.selectionOnDragStart,{index:t,lineIndex:i,characterIndex:r}=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,this.doubleClickHandler.clickCount>2?"inside":"previous")??{index:0};i!==void 0&&r!==void 0&&this.virtualInput?.wrappedText[i][r-1]===` 8174`&&t--,this.htmlInput.setSelectionRange(Math.min(e,t),Math.max(e,t))}checkClickedObject(){if(this.virtualInput){let e=this.raycaster.intersectObject(this.virtualInput,!1);if(e.length>0){let t=e[0];if(t.object instanceof Ox)return t.object}}return null}selectClosestWord(e,t){if(!this.virtualInput)return;let i=this.virtualInput.wrappedText,r=i[e],s=t+1,a=t;r[t]!==" "&&(s=this.findNextCharOccurence(r,t,"forward"," "),a=this.findNextCharOccurence(r,t,"backward"," "),a>0&&a++,s>=r.length-1&&e===i.length-1&&s++);let n=this.helper,o=n.getGlobalIndexFromLineAndCharIndexes(i,e,a),l=n.getGlobalIndexFromLineAndCharIndexes(i,e,s);this.setInputSelection(o,l)}findNextCharOccurence(e,t,i,r=" "){let s=Math.max(0,e.length-1),a=i==="forward"?s:0,n=i==="forward"?1:-1,o=Math.max(Math.min(t,s),0);for(;o!==a;)if(o+=n,e.charAt(o)===r)return o;return a}getPointOnPlane(){let e=this.virtualInput?.data;if(!(!this.virtualInput||!e)&&this.raycaster.ray.intersectsPlane(this.plane)){this.planeIntersection===null&&(this.planeIntersection=new M);let t=this.raycaster.ray.intersectPlane(this.plane,this.planeIntersection);if(t){this.planeIntersection.copy(this.virtualInput.worldToLocal(t));let i=typeof e.geometry.width=="number"?e.geometry.width:1,r=typeof e.geometry.height=="number"?e.geometry.height:1;this.projected.set(t.x+i*.5,t.y-r*.5)}}}updatePlane(){let e=this.virtualInput?.data;this.virtualInput&&e&&(X2.getNormalMatrix(this.virtualInput.matrixWorld),W2.copy(cee).applyMatrix3(X2).normalize(),this.virtualInput.localToWorld(q2.set(0,0,e.geometry.depth)),this.plane.setFromNormalAndCoplanarPoint(W2,q2))}setInputSelection(e,t=e){this.htmlInput?.setSelectionRange(e,t),Kh&&this.htmlInput?.focus(),setTimeout(()=>{this.htmlInput?.focus()})}updateTextInputStyles(){let e=this.virtualInput?.data;this.virtualInput&&e&&this.htmlInput&&(this.htmlInput.style.fontSize=e.geometry.fontSize+"px",this.htmlInput.style.letterSpacing=e.geometry.letterSpacing*e.geometry.fontSize+"px",this.htmlInput.style.lineHeight=e.geometry.fontSize*e.geometry.lineHeight+"px",this.htmlInput.style.width=e.geometry.width+"px",this.htmlInput.style.height=e.geometry.height+"px",this.htmlInput.style.textAlign=dee(e.geometry.horizontalAlign))}};function dee(e){return e===4?"justify":e===2?"right":e===3?"center":"left"}var fD=(e,t)=>{if(typeof e=="string"){let i=t.data(e);if(i)return fD(i.value,t)}return gr.getDisplayedValue(e)};function Y2(e,t){let i=e.text,r="";if(typeof i=="string"){let s=t.variables.data(r);s&&(r=fD(s.value,t.variables))}else r=i.textValue.toString();return r}var pee=class extends Er{constructor(e,t){super(e),this.eventManager=t,this._textInputs=[],this.sceneHelpers=new Qr,this.helper=new lP,this._onMouseDownFocusIn=i=>{if(at.length>1)return;this.eventContext.updateRaycaster(i);let r=null;if(this.eventContext.raycaster){for(let s of this._textInputs)if(this.eventContext.raycaster.intersectObject(s,!0).length>0){r=s;break}}this.focusOnTextInput(r),this._onCaretUpdate(),this._onMouseUp(),this.textInputManager.doubleClickHandler.start(this.eventContext.domElement),this.textInputManager.doubleClickHandler._onMouseDown(i),this._onMouseDown(i)},this.onExit=()=>{let{virtualInput:i}=this.textInputManager;if(i===null)return;let r=this.textInputManager.htmlInput;this.helper.hide(),r?.setSelectionRange(r.value.length,r.value.length),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0);let{domElement:s}=this.eventContext;s.removeEventListener("pointerdown",this._onMouseDown,!1),s.removeEventListener("pointerup",this._onMouseUp,!1),s.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.textInputManager.doubleClickHandler.reset(),s.addEventListener("pointerdown",this._onMouseDownFocusIn),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers()},this._onMouseDown=i=>{this.eventContext.updateRaycaster(i),this.textInputManager.handleMouseDown(),this.textInputManager.virtualInput&&this.eventContext.raycaster.intersectObject(this.textInputManager.virtualInput,!0).length>0&&this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1)},this._onMouseUp=()=>{this.textInputManager.handleMouseUp(),this.eventManager.controlsManager.orbitControls&&!this.eventManager.controlsManager.orbitControls.enabled&&(this.eventManager.controlsManager.orbitControls.enabled=!0)},this._onMouseMove=i=>{this.eventContext.updateRaycaster(i),this.textInputManager.handleMouseMove()},this._onTextEdit=i=>{let{htmlInput:r,virtualInput:s,helper:a}=this.textInputManager;if(!r||!s)return;let n=r.value;s.textGeometry.setText(n,this.eventContext.sharedAssets).then(()=>{this.eventContext.requestRender()});let o=s.data;a.update();let l=o.geometry.text;if(typeof l=="string"){let h=l;this.eventContext.sharedAssets.updateVariable(h,{textValue:n})}this.textInputManager.updateTextInputStyles(),this._onCaretUpdate()},this._onCaretUpdate=i=>{this.textInputManager.handleCaretUpdate(i)},this._onKeyPress=i=>{i.key==="Escape"&&this.onExit()},this.textInputManager=new uee(this.sceneHelpers,e.raycaster,e.sharedAssets,e.requestRender,this.onExit)}connect(){let e=[];if(this.eventContext.scene.traverseEntity(r=>{r instanceof Ox&&e.push(r)}),this._textInputs=e,e.length===0)return;let{domElement:t}=this.eventContext;t.addEventListener("pointerdown",this._onMouseDownFocusIn),this.textInputManager.connect();let i=this.textInputManager.createInput();document.body.appendChild(i),i.style.display="none",i.addEventListener("keyup",this._onCaretUpdate),i.addEventListener("keydown",this._onCaretUpdate),i.addEventListener("beforeinput",this._onCaretUpdate),i.addEventListener("paste",this._onCaretUpdate),i.addEventListener("cut",this._onCaretUpdate),i.addEventListener("select",this._onCaretUpdate),i.addEventListener("selectstart",this._onCaretUpdate)}disconnect(){let e=this.textInputManager.htmlInput,{domElement:t,sharedAssets:i}=this.eventContext;t.removeEventListener("pointerdown",this._onMouseDownFocusIn),e?.removeEventListener("keyup",this._onCaretUpdate),e?.removeEventListener("keydown",this._onCaretUpdate),e?.removeEventListener("beforeinput",this._onCaretUpdate),e?.removeEventListener("paste",this._onCaretUpdate),e?.removeEventListener("cut",this._onCaretUpdate),e?.removeEventListener("select",this._onCaretUpdate),e?.removeEventListener("selectstart",this._onCaretUpdate),this._textInputs.forEach(r=>{let s=Y2(r.data.geometry,this.eventContext.sharedAssets.data);r.textGeometry.setText(s,i)}),t.removeEventListener("pointerdown",this._onMouseDown,!1),t.removeEventListener("pointerup",this._onMouseUp,!1),t.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers(),this.textInputManager.disconnect()}focusOnTextInput(e){this.textInputManager.focus(e),this.textInputManager.onTextMaterialChanged();let t=this.textInputManager.htmlInput;if(!t||e===null)return;this.textInputManager.updateTextInputStyles(),this.eventContext.renderer.sceneHelpersOnTop=this.sceneHelpers,this.eventContext.renderer.pipeline.enableHelpers(),this.textInputManager.isDragging=!1;let i=Y2(e.textGeometry.userData.parameters,this.eventContext.sharedAssets.data);t.value=i,t.setSelectionRange(0,0),this.textInputManager.helper.show(e),t.style.display="block",t.addEventListener("input",this._onTextEdit),this.textInputManager.updatePlane();let{domElement:r}=this.eventContext;r.removeEventListener("pointerdown",this._onMouseDownFocusIn),r.addEventListener("pointerdown",this._onMouseDown,!1),r.addEventListener("pointerup",this._onMouseUp,!1),r.addEventListener("pointermove",this._onMouseMove,!1),window.addEventListener("keydown",this._onKeyPress)}},fee=class extends Er{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.onVoice=({value:i,frequencies:r})=>{this.events.forEach(s=>{s.dispatch()})}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(t=>t.data.type==="AIAssistantListener"&&!t.data.disabled).forEach(t=>{this.events.push(new mee(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("voice",this.onVoice))}disconnect(){this.openAIRealtime?.off("voice",this.onVoice)}},mee=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.actions=Bi(t,t.actions,r,s,a,i)}dispatch(){this.dispatchActions(this.actions)}dispatchActions(e){e.Audio.forEach(t=>t.dispatchConditional()),e.Particles.forEach(t=>t.dispatchConditional()),e.Video.forEach(t=>t.dispatchConditional()),e.Create.forEach(t=>t.dispatch()),e.Destroy.forEach(t=>t.dispatch()),e.Reset.forEach(t=>t.dispatch()),e.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this),t.init()}),e.Transition.forEach(t=>t.play()),e.Animation.forEach(t=>t.play()),e.SwitchCamera.forEach(t=>t.play()),e.SceneTransition.forEach(t=>t.dispatch()),e.SetVariable.forEach(t=>t.checkConditions()),e.SetVariable.forEach(t=>t.dispatch()),e.DynamicVariablePlay.forEach(t=>t.dispatch()),e.ClearLocalStorage.forEach(t=>t.dispatch()),e.UserAPI.forEach(t=>t.dispatch())}},gee=class extends Er{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.onTriggerEvent=({description:i,direction:r})=>{let s=this.events.find(a=>a.data.description===i);s&&(r==="backward"?s.dispatchReverse():s.dispatch())}}connect(){this.openAIRealtime=this.eventContext.sharedAssets.openAIRealtime,this.openAIRealtime&&(this.eventContext.page.traverseEntity(e=>{e.data?.events.filter(t=>t.data.type==="AIAssistantTrigger"&&!t.data.disabled).forEach(t=>{this.events.push(new vee(t.id,t.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("trigger_event",this.onTriggerEvent))}disconnect(){this.openAIRealtime?.off("trigger_event",this.onTriggerEvent)}},vee=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.actions=Bi(t,t.actions,r,s,a,i)}dispatch(){let e=this.actions;
8174e.Audio.forEach(t=>t.dispatchConditional()),e.Particles.forEach(t=>t.dispatchConditional()),e.Video.forEach(t=>t.dispatchConditional()),e.Create.forEach(t=>t.dispatch()),e.Destroy.forEach(t=>t.dispatch()),e.Reset.forEach(t=>t.dispatch()),e.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this),t.init()}),e.Transition.forEach(t=>t.play()),e.Animation.forEach(t=>t.play()),e.SwitchCamera.forEach(t=>t.play()),e.SceneTransition.forEach(t=>t.dispatch()),e.SetVariable.forEach(t=>t.checkConditions()),e.SetVariable.forEach(t=>t.dispatch()),e.DynamicVariablePlay.forEach(t=>t.dispatch()),e.ClearLocalStorage.forEach(t=>t.dispatch()),e.UserAPI.forEach(t=>t.dispatch())}dispatchReverse(){let e=this.actions;e.Transition.forEach(t=>t.reverseFromCurrent()),e.Particles.forEach(t=>t.reverseFromCurrent()),e.Animation.forEach(t=>t.reverseFromCurrent()),e.SwitchCamera.forEach(t=>t.reverseFromCurrent()),e.Create.forEach(t=>t.dispatchStop())}},yee=class{constructor(e,t,i,r,s){this.publish=e,this.controlsManager=t,this.animationControls=i,this.eventContext=r,this.sharedVariables=s,this.isEnabled=!1,this.activateCount=0,this.needsMouse=!1,this.needsRaycast=!1,this.onTouchMovePreventScroll=a=>{let n=window.parent!==window,o=document.documentElement.scrollHeight>document.documentElement.clientHeight||document.documentElement.scrollWidth>document.documentElement.clientWidth;(a.touches.length>1||this.preventTouchScroll||n===!1&&o===!1)&&a.preventDefault()},this.onMouseWheelPreventScroll=a=>{this.preventScroll&&a.preventDefault()},this.onMouseMove=a=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(a),pressed:a.buttons>0}},this.onMouseDown=a=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(a),pressed:!0}},this.onMouseUp=a=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(a),pressed:!1}},this.getMousePosition=a=>{let{domRect:n}=this.eventContext,{pageX:o,pageY:l}=a.touches?.length>0?a.touches[0]:a;return{x:o-(n.left+window.scrollX),y:l-(n.top+window.scrollY)}},this.stopRaycast=e.stopRaycast,this.preventScroll=e.preventScroll,this.preventTouchScroll=e.preventTouchScroll,this.hideCursor=e.hideCursor,this.requestRender=r.requestRender}activate(e=!1){if(this.isEnabled)return;this.isEnabled=!0,this.initializeActionsDependentStates(),this.needsMouse&&(this.eventContext.domElement.addEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.addEventListener("pointerdown",this.onMouseDown)),this.handlers={Spline:new XJ(this.eventContext),VariableChange:new M$(this.eventContext,this.sharedVariables,this,this.needsMouse,this.needsRaycast),API:new aee(this.eventContext,this),WEBHOOK:new oee(this.eventContext,this),AIAssistantListener:new fee(this.eventContext,this),AIAssistantTrigger:new gee(this.eventContext,this),Conditional:new e$(this.eventContext,this),Start:new _$(this.eventContext,this),Basic:new QJ(this.eventContext,this,this.needsRaycast),MouseHover:new y$(this.eventContext,this),Scroll:ne
vendor: 12,793 bytes, line 8174
8174w w$(this.eventContext,this),Follow:new c$(this.eventContext,this),DragDrop:new a$(this.eventContext,this),LookAt:new m$(this.eventContext),Resize:new see(this.eventContext,this),Textfields:new pee(this.eventContext,this)};let{page:t,domElement:i}=this.eventContext;this.hideCursor&&(i.style.cursor="none"),t.traverseEntity(r=>{r.addEventListener("requestRender",this.requestRender)}),Object.values(this.handlers).forEach(r=>r.connect()),i.addEventListener("wheel",this.onMouseWheelPreventScroll),i.addEventListener("touchmove",this.onTouchMovePreventScroll),this.activateCount++,e||this.eventContext.sharedAssets.openAIRealtime?.connect()}deactivate(e=!1){if(!this.isEnabled)return;this.isEnabled=!1,this.eventContext.domElement.removeEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.removeEventListener("pointerdown",this.onMouseDown),this.eventContext.domElement.removeEventListener("pointerup",this.onMouseUp),this.eventContext.sharedAssets.mouseProperty=null,this.eventContext.sharedAssets.raycastProperty=null;let{page:t,domElement:i}=this.eventContext;i.style.cursor="",Object.values(this.handlers).forEach(r=>r.disconnect()),this.controlsManager.gameControl?.disposeActions(),this.controlsManager.disconnectEvents(),t.traverseEntity(r=>{r.removeEventListener("requestRender",this.requestRender),r.destroyedInAction=!1}),i.removeEventListener("touchmove",this.onTouchMovePreventScroll),i.removeEventListener("wheel",this.onMouseWheelPreventScroll),this.animationControls.onExitPlayMode(),e||this.eventContext.sharedAssets.openAIRealtime?.disconnect()}dispose(){this.deactivate(),Object.values(this.handlers).forEach(e=>e.dispose())}get isPaused(){return this.isEnabled}pause(){this.deactivate()}resume(){this.activate()}reset(){this.deactivate(!0),this.activate(!0),this.controlsManager.deactivate(),this.controlsManager.activate(this),this.controlsManager.page.updateMatrixWorld(!0),this.controlsManager.rebuildBVH()}updateUseWindowEvents(e){let t=this.isEnabled;t&&this.deactivate(),this.eventContext.useWindowEvents=e,t&&this.activate()}initializeActionsDependentStates(){let e=this.eventContext.sharedAssets;e.resetDynamicVariablePlayState();let t=i=>{if(i.data.type==="Conditional"&&(i.data.ifActions.forEach(t),i.data.elseActions.forEach(t)),i.data.type==="Conditional"||i.data.type==="SetVariable")for(let r of i.data.type==="Conditional"?i.data.condition:i.data.expression)"id"in r&&Array.isArray(r.id)&&(r.id[0]==="mouse"&&(this.needsMouse=!0),r.id[0]==="raycast"&&(this.needsRaycast=!0));i.data.type==="DynamicVariablePlay"&&i.data.variableId!==""&&(i.data.mode==="Play"||i.data.mode==="PlayPause"||i.data.mode==="Toggle")&&e.setDynamicVariablePlayState(i.data.variableId,"Stopped")};this.eventContext.page.traverseEntity(i=>{if(i.data?.events.length)for(let r of i.data.events)if(r.data.type==="VariableChange"&&(r.data.variableId==="mouseProperty"&&(this.needsMouse=!0),r.data.variableId==="raycastProperty"&&(this.needsRaycast=!0)),r.data.type==="Conditional")for(let s of["inActions","outActions"])r.data[s].forEach(t);else if(r.data.type==="DragDrop")for(let s of["drag","drop"])r.data.dragDropActions[s].forEach(t);else if(r.data.type==="GameControl")for(let s of["idle","move","jump","run"])r.data.gameActions[s].forEach(t);else if(r.data.type==="Resize")for(let s of r.data.breakpoints)s.data.actions.forEach(t);else r.data.type==="LookAt"||r.data.type==="API"||r.data.actions.forEach(t)})}},xee=class{constructor(e,t,i,r,s){this._aspect=1,this.enableResponsive=!1,this._renderer=e,this._camera=t,this._frameSize=new H().copy(i),this._editorSize=new H().copy(r),this._aspect=t.aspect,this._fov=s??t.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){!this._renderer||this._renderer.setSize(this._frameSize.x,this._frameSize.y)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,i=this._editorSize.y;this._aspect=e/t,t<=i&&(this._camera.zoom*=i/t),this._renderer.setViewport(0,0,e,t)}updateCamera(e=!0){if(this._camera)if(this._camera.cameraType==="PerspectiveCamera"){let t=this._frameSize.y,i=this._editorSize.y,r=this._fov;if(e&&t>i){let s=bee(t,1080,2160,1,15)/100;r*=t/i,r*=1-s}this._camera.aspect=this._aspect,this._camera.fov=r,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y,this.enableResponsive)}setCamera(e){this._camera=e,this._aspect=e.aspect,this._fov=e.fov}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t,this.enableResponsive),this._camera.updateProjectionMatrix())}};function bee(e,t,i,r,s){return(e-t)/(i-t)*(s-r)+r}var wee=class{get sharedAssets(){return this.shared}constructor(e,t={},i=!0){this.shared=new bx(e.shared,t,!0,i),this.scene=new Lx(e.scene,this.sharedAssets),this.shared.setEntityOpContext({scene:this.scene,shared:this.shared})}reset(e,t){this.scene.clearScene(),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}resetPersonalCameraFromDocumentData(){for(let e of this.scene.children)e instanceof er&&!e.uiScene&&e.personalCamera.updateState(e.data.camera,{scene:this.scene,shared:this.shared})}dispose(){this.scene.dispose(),this.shared.dispose()}gc(){this.shared.geometryCache.startGc(),this.shared.geometryCache2.startGc(),this.scene.traverseEntity(e=>{e instanceof ai&&e.markGeometryAsReachable(this.shared)}),this.shared.geometryCache.endGc(),this.shared.geometryCache2.endGc()}},See=class{constructor({x:e=10,y:t=10}){this._startTime=0;let i=document.getElementById("spe-perfs");i?this.element=i:(this.element=document.createElement("div"),document.body.appendChild(this.element),this.element.style.position="absolute",this.element.style.zIndex="10000",this.element.style.fontFamily="monospace",this.element.style.background="black",this.element.style.color="white",this.element.style.padding="10px",this.element.style.opacity="0.5",this.element.style.fontSize="11px",this.element.setAttribute("id","spe-perfs")),this.element.style.left=`${e}px`,this.element.style.top=`${t}px`}dispose(){this.element.parentElement?.removeChild(this.element)}start(){this._startTime=performance.now()}end(){let e=performance.now()-this._startTime;this.element.innerHTML=e.toFixed(3)+" ms"}};function _ee(e){let t;if(e.index)for(let i=0;i<e.index.array.length;i+=3)t=e.index.array[i],e.index.array[i]=e.index.array[i+2],e.index.array[i+2]=t}function cu(e){return e instanceof Iu?"SubdivObject":e.geometry.type==="NonParametricGeometry"?"NonParametric":"Mesh"}function Aee(e,t){let i={};return e.traverseEntity(r=>{if(!r.visible||!(r instanceof xr)||r.type!=="Mesh"||Array.isArray(r.material)||r.states&&Object.keys(r.states).length)return;let s=r.parent;for(;s;){if(s instanceof xr&&r.states&&Object.keys(r.states).length)return;s=s.parent}let a=r.material.uuid,n=t.shared.materials[a];if(n){if(!rr.isMergable(n))return}else{let l=t.scene.objects.get(r.uuid)?.data;if(l&&"material"in l&&typeof l.material!="string"){if(!rr.isMergable(l.material))return;a=rr.getHash(l.material)}}i[a]||(i[a]={});let o=i[a][cu(r)];if(o){if(o.push(r),r.cloner)for(let l of r.cloner.children)o.push(l)}else if(i[a][cu(r)]=[r],r.cloner)for(let l of r.cloner.children)i[a][cu(r)].push(l)}),i}function Mee(e){let t=0;return Object.values(e).forEach(i=>{Object.values(i).forEach(r=>{let s=r.length;s>t&&(t=s)})}),t}function Eee(e,t){let i=Aee(t,e),r=Mee(i),s=new Array(r),a=0,n=new Array(r),o=0,l=new Array(r),h=0,c=new Array(r),u=0;for(let[d,p]of Object.entries(i))for(let f of Object.values(p)){if(o=0,h=0,f.forEach(g=>{g instanceof xr&&(n[o++]=g.geometry.clone(),l[h++]=g)}),h<2)continue;for(let g=0;g<h;g++)l[g].updateWorldMatrix(!0,!1),n[g].applyMatrix4(l[g].matrixWorld),l[g].matrixWorld.determinant()<0&&_ee(n[g]);let m=jo(n.slice(0,o),!1);if(m){let g;d==="SubdivObject"?(console.warn("Turning subdiv object into mesh"),g=new Zt(m,l[0].material)):g=new Zt(m,l[0].material),g.castShadow=l[0].castShadow,g.receiveShadow=l[0].receiveShadow,t.add(g);let v=y=>{u=0;for(let x of y)x.children&&v(x.children),x instanceof xr&&(Array.isArray(x.material)||i[x.material.uuid]&&i[x.material.uuid][cu(x)]&&i[x.material.uuid][cu(x)].length>1||(c[u++]=x));for(let x=0;x<u;x++)t.attach(c[x])};for(let y=0;y<h;y++){let x=l[y];v(x.children),s[a++]=x}}}for(let d=0;d<a;d++)s[d].removeFromParent()}var Cee=mo(TD(),1);function Tee(e){let t=Array.isArray(e)?e[0]:e,i=t.layers.map(Pee),r=t.layers.find(s=>s.type==="light");return{layers:i,alpha:r.node.alphaOverride?.value??1}}function Pee(e){return e.type==="texture"||e.type==="video"||e.type==="matcap"?{...e.data,updateTexture(t){return e.color.texture.image.updateSrc(t)}}:{...e.data}}function Dee(e,t,i){let r=Array.isArray(i)?i[0]:i;if(e[0]==="layers"){let s=parseInt(e[1]),a=r.layers[s],n=e[2];a&&n&&Oee(e.slice(2),t,a)}else e[0]==="alpha"&&r.layers.forEach(s=>{s.type==="light"&&s.node.alphaOverride!==void 0&&(s.node.alphaOverride.value=t,t<1&&(r.transparent=!0))})}var Lc=new Wi(0,0,0,1);function Oee(e,t,i){let r=e[0];try{if(Lee(r,i.type,e.slice(1)))if(r==="colors"){if(e.length<2)throw new Error("You cannot mutate the colors array, only its items");let s=parseInt(e[1]),a=i.getValue(r)?.[s];if(a)Lc.setStyle(t),a.set(Lc.r,Lc.g,Lc.b,Lc.a);else throw new Error("Color index out of range")}else i.getValue(r)?.setStyle(t);else if(r==="texture"||r==="video"){let s=i.color;Iee(e.slice(1),t,s,i)}else{let s=e[1],a=i.getValue(r);a?.isVector3&&s!==void 0||a?.isVector2&&s!==void 0?a.setComponent(parseInt(s),t):i.setValue(r,t)}}catch(s){console.error("Error setting material value",s)}}function Iee(e,t,i,r){let s=e[0];if(s==="repeat"||s==="offset"){let a=e[1];if(a===void 0)t instanceof Array&&t.length===2&&Object.assign(i.mat,{[s]:t});else{let n=i.mat[s],o=parseInt(a)===0?[parseFloat(t),n[1]]:[n[0],parseFloat(t)];Object.assign(i.mat,{[s]:o})}i.mat.updateMatrix()}else s==="rotation"?(i.mat.rotation=parseFloat(t),i.mat.updateMatrix()):s==="wrapping"||s==="minFilter"||s==="magFilter"?s==="wrapping"?i.texture.wrap=t:i.texture[s]=t:s==="image"&&e[1]==="data"&&i.texture.image.updateSrc(t)}var Ree={color:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],matcap:[],pattern:["colorA","colorB"],light:[],displace:[],rainbow:[],particle:[]};function Lee(e,t,i){return!!Ree[t]?.includes(e)}var zee=new H;function Bee(e){let t="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";e.endsWith(".spline")?console.warn(t+" The .spline files are only meant to be used by the Editor."):e.endsWith(".splinecode")||console.warn(t)}function Q2(e){let t=new Wi(0,0,0,1);try{t.setStyle(e)}catch(i){console.error(i)}finally{return t}}var Fee=class{constructor(e,{renderOnDemand:t,renderMode:i="auto",wasmPath:r}={}){this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=s=>{if(this.time=s,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),!this._renderer){this._perfs?.end();return}if(!this._isPaused&&(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){this._perfs?.end();return}if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start.hasVideoAction||this._eventManager.handlers?.Basic.hasVideoAction||this._eventManager.handlers?.Conditional.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<32?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(a=>{a.type==="ParticleSystem"&&(a.update(this.dt),this._skipRender=!1)}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&((this._eventManager.handlers?.Follow).onAnimationFrameDamping(),(this._eventManager.handlers?.LookAt).onAnimationFrameDamping(),(this._eventManager.handlers?.DragDrop).onAnimationFrameDamping()),this._scene&&this._camera){
8174if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let a=1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration;this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=a,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()},this._resize=s=>{if(this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=zee.set(this._viewportWidth,this._viewportHeight)),s){let a=this._viewportWidth,n=this._viewportHeight;this._renderer.setSize(a-1,n-1,!1),this._renderer.setSize(a,n,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);if(this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera){let a=Object.values(this._data?.frames??{})[0].preset??"fullscreen";this._frameView?.setCamera(this._camera),this._frameView?.updateCamera(a!=="fullscreen"),this._camera.cameraType==="PerspectiveCamera"&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()}this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=bu(this._resize,10),this._onScroll=s=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=e,this.renderMode=t?"auto":i,r!==void 0&&(this._wasmPath=Z6(r,"/")),this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&(this._perfs=new See({x:10,y:10})),cH(e)}async load(e,t,i){Bee(e),this.disposed=!1;let r=await(await fetch(e,i)).arrayBuffer();await this.start(r,{variables:t})}async start(e,{interactive:t=!0,variables:i}={}){if(this.disposed)return;un.init();let r=await eee(e);this._data=r;let s=tee(r);r.version&&(0,Cee.default)(r.version,"1.12.67")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),this._wasmPath!==void 0&&this.setUIWasmUrl(`${this._wasmPath}/ui.wasm`),await Promise.all([s.length&&H2(this._wasmPath),OA(r)&&_7(this._wasmPath),PX(r)&&x7(this._wasmPath),Eu.physicsEnabled(r.scene.objects)&&mH(),CA(r)&&aX(),n2(r)&&BZ(),rX(r)&&iX(),ZA(r)&&AK(),F$(r)&&pH(this._wasmPath)].filter(Boolean)),s.length&&await G2(s),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let a=new wee(r);if(a.resetPersonalCameraFromDocumentData(),this._scene=a.scene,this._sharedAssetsManager=a.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let l=performance.now();Eee(r,a.scene);let h=performance.now();console.log("Merged geometries in ",h-l," ms")}OA(r)&&this._scene.traverse(l=>{ln(l)&&l.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(l=>{l instanceof ys&&l.pendingMediaLoad&&l.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(l=>{l.type==="ParticleSystem"&&(l.wakeUp(),l.data.autoPlay?l.start():l.stop())});let n=Object.keys(r.shared.fonts).map(l=>this._sharedAssetsManager.getFont(l).loadingPromise);if(Promise.all(n).then(()=>{this.disposed||(a.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),CA(r)&&X$(r)&&await Promise.all(n),ZA(r)){let l=[];this._scene.traverseEntity(h=>{(h instanceof _r||h instanceof er)&&h.uiCanvas&&l.push(h.uiCanvas)}),await Promise.all(l.map(h=>h.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),Fx(this._scene.activePage,this._sharedAssetsManager),!this._renderer){this._renderer=new cK({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"}),this._renderer.hdTransmission=r.scene.publish.hdTransmission===!0;let l=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),h=this._getPixelRatio(l()?r.scene.publish.settings.web.pixelRatioMobile:r.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(h),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),r.shared.images.SplineWatermark){let c=this._sharedAssetsManager.getImage("SplineWatermark");await c.loadPromise;let u=c.getTexture(1001);this._renderer.pipeline.setWatermark(u)}}n2(r)&&this._scene.initializeSplatViewer(),r.scene.blueNoiseTextureData!==void 0&&this._renderer.pipeline.updateBlueNoiseTexture(r.scene.blueNoiseTextureData);let o=Object.values(r.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):(o.preset==="fullscreen"?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHe
vendor: 9,865 bytes, line 8174
8174ight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=o.size[0],this._viewportHeight=o.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new xee(this._renderer,this._camera,new H(this._viewportWidth,this._viewportHeight),new H(window.innerWidth,window.innerHeight)),this._frameView.enableResponsive=(o.allowResponsive??!1)&&o.preset==="fullscreen"),t){let l=new WJ(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,o);this._scene.updateMatrixWorld(!0),this._controls=new Y$(l),this._animationControls=new K$(this._scene,this._requestRenderAutoMode),this._eventManager=new yee(r.scene.publish,this._controls,this._animationControls,l,r.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),i!==void 0&&this.setVariables(i),this.dt===0&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll)}setVariables(e){if(this._data!==void 0){let t=Object.entries(e);for(let[i,r]of t)this.setVariable(i,r)}}setVariable(e,t){let i=this._getVariableByName(e);if(i&&!("dynamicVariableType"in i.data)){let r=t;typeof i.data.value=="number"?r=typeof t=="number"?t:typeof t=="boolean"?t===!0?1:0:parseFloat(t):typeof i.data.value=="boolean"?r=typeof t=="number"?!!t:typeof t=="boolean"?t:t.toLocaleLowerCase()==="false"?!1:!!t:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(r=t.toString());let s=typeof r=="string"?{textValue:r}:r;this._sharedAssetsManager?.updateVariable(i.id,s),this.requestRender(),this._requestRenderAutoMode()}else i===void 0?console.warn(`No variable named ${e} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in i.data&&console.warn(`Dynamic variables like ${e} cannot be updated from code.`)}getVariables(){let e={};return this._data&&this._data.shared.variables.forEach(t=>{e[t.data.name]===void 0&&(e[t.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(t.id)))}),e}getVariable(e){let t=this._getVariableByName(e);if(t){let i=this._sharedAssetsManager.getVariable(t.id);return this._getVariableValue(i)}}_getVariableValue(e){return typeof e!="string"&&gr.isTextValue(e)?gr.getDisplayedValue(e):e}_getVariableByName(e){if(this._data){if(this._variablesCache.has(e))return this._variablesCache.get(e);let t=this._data.shared.variables.find(i=>i.data.name===e);return t&&this._variablesCache.set(e,t),t}}_getPixelRatio(e){switch(e){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(e){let t=this._scene?.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){let t=this._scene?.getObjectByName(e);return this._createProxyObject(t)}getAllObjects(){let e=[];return this._scene?.traverseEntity(t=>{if(t.uuid!==Jh&&!this._scene.isInvisibleObjects(t)&&!(t instanceof er)){let i=this._createProxyObject(t);i&&e.push(i)}}),e}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEvent(e)}emitEventReverse(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEventReverse(e)}addEventListener(e,t){this.canvas.addEventListener(e,t)}removeEventListener(e,t){this.canvas.removeEventListener(e,t)}setZoom(e){this._controls?.orbitControls instanceof pD&&this._controls?.orbitControls.setZoom(e)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(e,t){this._viewportWidth=e,this._viewportHeight=t,this._viewportMode=2,this._resize()}setBackgroundColor(e){let t=Q2(e);this._scene?.activePage.setBackgroundColor(t),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,lq(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(e=>{Sw.unsubscribe(e)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,uH(this.canvas),document.removeEventListener("scroll",this._onScroll),un.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(e){this._eventManager?.updateUseWindowEvents(e)}get data(){return this._data}_createProxyObject(e){if(!this._scene)return;let t=this._scene;if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);let i;e.traverseAncestors(h=>{h instanceof er&&(i=h.name)});let r=this._sharedAssetsManager,s={shared:r,scene:this._scene},a=h=>{if(h===null||h==="Base State")return null;if(h&&e.data.states){let c=e.data.states.find(u=>u.data.name===h);return c?c.id:void 0}},n="material"in e?e.material:void 0,o={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,type:e.data.type,page:i,material:n?Tee(n):void 0,parentUuid:e.parent instanceof er||e instanceof Lx?void 0:e.parent?.uuid,emitEvent(h){e.dispatchEvent({type:"userEvent",eventName:h})},emitEventReverse(h){e.dispatchEvent({type:"userEvent",eventName:h,reverse:!0})},hide(){e.visible&&(e.visible=!1,s.shared.requestRender())},show(){e.visible||(e.visible=!0,s.shared.requestRender())},get state(){let h=e.stateSelection;if(h!==null)return e.data.states.find(({id:c})=>c===h)?.data.name},set state(h){let c;if(h!==void 0){let u=typeof h=="string"?e.data.states.find(({id:d})=>d===h):e.data.states[h];if(u)c=u.id;else{let d=typeof h=="string"?a(h):void 0;d&&(c=d)}}e.changeSelectedState(c??null,s),e.currentState=c??null,e.dispatchEvent({type:"completeState",state:c??null}),s.shared.requestRender()},transition(h){let c=this,u,d=un.timeline({autoplay:h.autoPlay??!0}),p={transition({from:f,to:m,duration:g,delay:v,...y}){let x=a(f);x===void 0&&(x=u);let w=a(m);u=w;let S=new jy(e,x,w,{state:w,repeat:0,delay:v??0,delayDirection:"start-once",direction:"normal",duration:g??1e3,...y,...y.easing===6?yf.defaultData:y.easing===5?xf.defaultData:{}},r,!1,t.activePage);return d.add({...S.params,begin:()=>{(f&&x||f==="Base State"&&!x)&&(c.state=x??void 0)},complete:()=>{c.state=w??void 0}},d.duration),this},play(){return d.play(),this},pause(){return d.pause(),this},reset(){return d.reset(),this},seek(f){return d.seek(f),this}};return p.transition(h),p},set color(h){let c=Q2(h);if(Hf.is(e)){e.color=c;return}else if(e.type!=="Mesh"||!("material"in e)||!(e instanceof uo))return;let u={r:c.r,g:c.g,b:c.b,a:c.a},d=Array.isArray(e.material)?e.material[0]:e.material,p=d.data.layers.find(f=>f.data.type==="color")?.id;if(p)d.updateByOp({type:0,path:["layers",p],props:{color:{...u}}},d.data,s);else{let f=d.data,m=f.layers.find(b=>b.data.type==="light");if(!m)return;let g=f.layers.indexOf(m)===0?m:null,v=f.layers.at(g?f.layers.indexOf(g)+1:0),y=g?g.fi+(v?(v.fi-g.fi)/2:1):v?v.fi/2:1,x={type:4,fi:y,id:Te.generateUUID(),data:{..._i.defaultData("color"),color:u},localIndex:0},w=f.layers.insertAfterHelper(g?.id??null,1),S=f.layers.runOp({...x,fi:w[0]}).data;Object.assign(d.data,{layers:S}),d.updateByOp({...x,path:["layers"]},d.data,s)}}},l=Sw(o,(h,c)=>{let u=e[h],d=kee(h);d[0]==="material"&&n&&Dee(d.slice(1),c,n),typeof u!="object"&&Object.getOwnPropertyDescriptor(e,h)?.writable&&(e[h]=c),this._requestRenderAutoMode(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,l),l}setUIWasmUrl(e){jT.skiaWasmUrl=e}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(e,t){let i;if(typeof t=="string")if(t.endsWith(".splinegeometry")){let l=await(await fetch(t)).arrayBuffer();i=new Uint8Array(l)}else throw new Error("Only .splinegeometry format is supported");else i=t;let r=gf.deserialize(i),s="data"in r&&r.data.draco!==void 0;s&&await H2(this._wasmPath);let a=this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e);
8174if(!a){console.warn(`Object ${e} not found`);return}if(a.data.type!=="Mesh"||!(a instanceof uo)){console.warn(`Object ${e} is not a mesh`);return}let n=a,o={...n.data,geometry:r};s&&await G2([o]),n.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let l of n.data.states){let h={...l.data};n.states||(n.states={}),n.states[l.id]=Zn.patch(o,h)}return i}};function kee(e){return e.split(".")}var Nv,K2;function Uee(){if(K2)return Nv;K2=1;var e="Expected a function",t=NaN,i="[object Symbol]",r=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,n=/^0o[0-7]+$/i,o=parseInt,l=typeof Ju=="object"&&Ju&&Ju.Object===Object&&Ju,h=typeof self=="object"&&self&&self.Object===Object&&self,c=l||h||Function("return this")(),u=Object.prototype,d=u.toString,p=Math.max,f=Math.min,m=function(){return c.Date.now()};function g(S,b,E){var _,A,C,T,I,P,O=0,k=!1,G=!1,B=!0;if(typeof S!="function")throw new TypeError(e);b=w(b)||0,v(E)&&(k=!!E.leading,G="maxWait"in E,C=G?p(w(E.maxWait)||0,b):C,B="trailing"in E?!!E.trailing:B);function U(re){var $=_,ne=A;return _=A=void 0,O=re,T=S.apply(ne,$),T}function Q(re){return O=re,I=setTimeout(X,b),k?U(re):T}function q(re){var $=re-P,ne=re-O,ie=b-$;return G?f(ie,C-ne):ie}function j(re){var $=re-P,ne=re-O;return P===void 0||$>=b||$<0||G&&ne>=C}function X(){var re=m();if(j(re))return te(re);I=setTimeout(X,q(re))}function te(re){return I=void 0,B&&_?U(re):(_=A=void 0,T)}function K(){I!==void 0&&clearTimeout(I),O=0,_=P=A=I=void 0}function Z(){return I===void 0?T:te(m())}function W(){var re=m(),$=j(re);if(_=arguments,A=this,P=re,$){if(I===void 0)return Q(P);if(G)return I=setTimeout(X,b),U(P)}return I===void 0&&(I=setTimeout(X,b)),T}return W.cancel=K,W.flush=Z,W}function v(S){var b=typeof S;return!!S&&(b=="object"||b=="function")}function y(S){return!!S&&typeof S=="object"}function x(S){return typeof S=="symbol"||y(S)&&d.call(S)==i}function w(S){if(typeof S=="number")return S;if(x(S))return t;if(v(S)){var b=typeof S.valueOf=="function"?S.valueOf():S;S=v(b)?b+"":b}if(typeof S!="string")return S===0?S:+S;S=S.replace(r,"");var E=a.test(S);return E||n.test(S)?o(S.slice(2),E?2:8):s.test(S)?t:+S}return Nv=g,Nv}var Nee=Uee();const Vee=mD(Nee);function jee(e){return t=>{e.forEach(i=>{typeof i=="function"?i(t):i!=null&&(i.current=t)})}}const Hee=[],Gee={width:"100%",height:"100%"},Wee=zs.forwardRef(function({className:e,children:t,debounceTime:i=300,ignoreDimensions:r=Hee,parentSizeStyles:s,enableDebounceLeadingCall:a=!0,resizeObserverPolyfill:n,...o},l){const h=zs.useRef(null),c=zs.useRef(0),[u,d]=zs.useState({width:0,height:0,top:0,left:0}),p=zs.useMemo(()=>{const f=Array.isArray(r)?r:[r];return Vee(m=>{d(g=>Object.keys(g).filter(v=>g[v]!==m[v]).every(v=>f.includes(v))?g:m)},i,{leading:a})},[i,a,r]);return zs.useEffect(()=>{const f=n||window.ResizeObserver,m=new f(g=>{g.forEach(v=>{const{left:y,top:x,width:w,height:S}=v?.contentRect??{};c.current=window.requestAnimationFrame(()=>{p({width:w,height:S,top:x,left:y})})})});return h.current&&m.observe(h.current),()=>{window.cancelAnimationFrame(c.current),m.disconnect(),p.cancel()}},[p,n]),zc.jsx("div",{style:{...Gee,...s},ref:jee([l,h]),className:e,...o,children:t({...u,ref:h.current,resize:p})})}),qee=zs.forwardRef(({scene:e,style:t,onSplineMouseDown:i,onSplineMouseUp:r,onSplineMouseHover:s,onSplineKeyDown:a,onSplineKeyUp:n,onSplineStart:o,onSplineLookAt:l,onSplineFollow:h,onSplineScroll:c,onLoad:u,renderOnDemand:d=!0,wasmPath:p,children:f,...m},g)=>{const v=zs.useRef(null),[y,x]=zs.useState(!0),[w,S]=zs.useState();if(w)throw w;return zs.useEffect(()=>{x(!0);let b;const E=[{name:"mouseDown",cb:i},{name:"mouseUp",cb:r},{name:"mouseHover",cb:s}
8174,{name:"keyDown",cb:a},{name:"keyUp",cb:n},{name:"start",cb:o},{name:"lookAt",cb:l},{name:"follow",cb:h},{name:"scroll",cb:c}];if(v.current){b=new Fee(v.current,{renderOnDemand:d,wasmPath:p});async function _(){await b.load(e);for(let A of E)A.cb&&b.addEventListener(A.name,A.cb);x(!1),u?.(b)}_().catch(A=>{S(A)})}return()=>{for(let _ of E)_.cb&&b.removeEventListener(_.name,_.cb);b.dispose()}},[e]),zc.jsx(Wee,{ref:g,parentSizeStyles:{overflow:"hidden",...t},debounceTime:50,...m,children:()=>zc.jsxs(zc.Fragment,{children:[y&&f,zc.jsx("canvas",{ref:v,style:{display:y?"none":"block"}})]})})}),Zee=Object.freeze(Object.defineProperty({__proto__:null,default:qee},Symbol.toStringTag,{value:"Module"}));export{Ju as c,mD as g,Zee as r};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.