PageSourceSearch

https://ryman.ai/assets/react-spline-DYWPTwJD.js

js ryman.ai collected 2026-10-05 15:24:31 UTC 2,038,134 bytes, 8,473 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/howler-DhNmR6Ur.js","assets/index-D75GC3JR.js","assets/index-DO7A4rx1.css"])))=>i.map(i=>d[i]);
2import{_ as $n,g as wP,c as Rd,r as Ps,j as yc}from"./index-D75GC3JR.js";var SP=Object.create,Tf=Object.defineProperty,_P=Object.getOwnPropertyDescriptor,AP=Object.getOwnPropertyNames,MP=Object.getPrototypeOf,EP=Object.prototype.hasOwnProperty,CP=(e,t,i)=>t in e?Tf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,Zo=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),TP=(e,t)=>{for(var i in t)Tf(e,i,{get:t[i],enumerable:!0})},PP=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of AP(t))!EP.call(e,s)&&s!==i&&Tf(e,s,{get:()=>t[s],enumerable:!(r=_P(t,s))||r.enumerable});return e},eo=(e,t,i)=>(i=e!=null?SP(MP(e)):{},PP(t||!e||!e.__esModule?Tf(i,"default",{value:e,enumerable:!0}):i,e)),Mo=(e,t,i)=>(CP(e,typeof t!="symbol"?t+"":t,i),i),DP=Zo((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 d=function(){var u=2091639*a+l*23283064365386963e-26;return a=n,n=o,o=u-(l=u|0)};return d.next=d,d.uint32=function(){return d()*4294967296},d.fract53=function(){return d()+(d()*2097152|0)*11102230246251565e-32},d.version="Alea 0.9",d.args=s,d.exportState=function(){return[a,n,o,l]},d.importState=function(u){a=+u[0]||0,n=+u[1]||0,o=+u[2]||0,l=+u[3]||0},d}(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}})}),fM=Zo((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,d,u,p,f,g,m,v,y,x,w=r[0].length,S=r.length;if(S<w)throw new TypeError("Invalid matrix: m < n");for(var b=[],A=[],_=[],E=s==="f"?S:w,C=v=f=0;C<S;C++)A[C]=new Array(E).fill(0);for(C=0;C<w;C++)_[C]=new Array(w).fill(0);var T,P=new Array(w).fill(0);for(C=0;C<S;C++)for(l=0;l<w;l++)A[C][l]=r[C][l];for(C=0;C<w;C++){for(b[C]=f,m=0,c=C+1,l=C;l<S;l++)m+=Math.pow(A[l][C],2);if(m<o)f=0;else for(g=(p=A[C][C])*(f=p<0?Math.sqrt(m):-Math.sqrt(m))-m,A[C][C]=p-f,l=c;l<w;l++){for(m=0,h=C;h<S;h++)m+=A[h][C]*A[h][l];for(p=m/g,h=C;h<S;h++)A[h][l]=A[h][l]+p*A[h][C]}for(P[C]=f,m=0,l=c;l<w;l++)m+=Math.pow(A[C][l],2);if(m<o)f=0;else{for(g=(p=A[C][C+1])*(f=p<0?Math.sqrt(m):-Math.sqrt(m))-m,A[C][C+1]=p-f,l=c;l<w;l++)b[l]=A[C][l]/g;for(l=c;l<S;l++){for(m=0,h=c;h<w;h++)m+=A[l][h]*A[C][h];for(h=c;h<w;h++)A[l][h]=A[l][h]+m*b[h]}}v<(y=Math.abs(P[C])+Math.abs(b[C]))&&(v=y)}if(a)for(C=w-1;0<=C;C--){if(f!==0){for(g=A[C][C+1]*f,l=c;l<w;l++)_[l][C]=A[C][l]/g;for(l=c;l<w;l++){for(m=0,h=c;h<w;h++)m+=A[C][h]*_[h][l];for(h=c;h<w;h++)_[h][l]=_[h][l]+m*_[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++)A[C][l]=0;A[C][C]=1}for(C=w-1;0<=C;C--){for(c=C+1,f=P[C],l=c;l<E;l++)A[C][l]=0;if(f!==0){for(g=A[C][C]*f,l=c;l<E;l++){for(m=0,h=c;h<S;h++)m+=A[h][C]*A[h][l];for(p=m/g,h=C;h<S;h++)A[h][l]=A[h][l]+p*A[h][C]}for(l=C;l<S;l++)A[l][C]=A[l][C]/f}else for(l=C;l<S;l++)A[l][C]=0;A[C][C]=A[C][C]+1}}for(n*=v,h=w-1;0<=h;h--)for(var O=0;O<50;O++){for(T=!1,c=h;0<=c;c--){if(Math.abs(b[c])<=n){T=!0;break}if(Math.abs(P[c-1])<=n)break}if(!T){for(u=0,d=c-(m=1),C=c;C<h+1&&(p=m*b[C],b[C]=u*b[C],!(Math.abs(p)<=n));C++)if(f=P[C],P[C]=Math.sqrt(p*p+f*f),u=f/(g=P[C]),m=-p/g,s)for(l=0;l<S;l++)y=A[l][d],x=A[l][C],A[l][d]=y*u+x*m,A[l][C]=-y*m+x*u}if(x=P[h],c===h){if(x<0&&(P[h]=-x,a))for(l=0;l<w;l++)_[l][h]=-_[l][h];break}for(v=P[c],p=(((y=P[h-1])-x)*(y+x)+((f=b[h-1])-(g=b[h]))*(f+g))/(2*g*y),f=Math.sqrt(p*p+1),p=((v-x)*(v+x)+g*(y/(p<0?p-f:p+f)-g))/v,C=c+(m=u=1);C<h+1;C++){if(f=b[C],y=P[C],g=m*f,f*=u,x=Math.sqrt(p*p+g*g),p=v*(u=p/(b[C-1]=x))+f*(m=g/x),f=-v*m+f*u,g=y*m,y*=u,a)for(l=0;l<w;l++)v=_[l][C-1],x=_[l][C],_[l][C-1]=v*u+x*m,_[l][C]=-v*m+x*u;if(x=Math.sqrt(p*p+g*g),p=(u=p/(P[C-1]=x))*f+(m=g/x)*y,v=-m*f+u*y,s)for(l=0;l<S;l++)y=A[l][C-1],x=A[l][C],A[l][C-1]=y*u+x*m,A[l][C]=-y*m+x*u}b[c]=0,b[h]=p,P[h]=v}for(C=0;C<w;C++)P[C]<n&&(P[C]=0);return{u:A,q:P,v:_}},i.VERSION="1.1.1",Object.defineProperty(i,"__esModule",{value:!0})})}),IP=Zo((e,t)=>
vendor: 16,467 bytes, lines 2-3
2{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}),OP=Zo((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}),RP=Zo((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 g="",m;for(m=0;m<f.parts.length;m++)g+=f.parts[m]instanceof Array?c(f.parts[m][0])+"-"+c(f.parts[m][1]):c(f.parts[m]);return"["+(f.inverted?"^":"")+g+"]"},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(g){return"\\x0"+l(g)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(g){return"\\x"+l(g)})}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(g){return"\\x0"+l(g)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(g){return"\\x"+l(g)})}function d(f){return o[f.type](f)}function u(f){var g=new Array(f.length),m,v;for(m=0;m<f.length;m++)g[m]=d(f[m]);if(g.sort(),g.length>0){for(m=1,v=1;m<g.length;m++)g[m-1]!==g[m]&&(g[v]=g[m],v++);g.length=v}switch(g.length){case 1:return g[0];case 2:return g[0]+" or "+g[1];default:return g.slice(0,-1).join(", ")+", or "+g[g.length-1]}}function p(f){return f?'"'+h(f)+'"':"end of input"}return"Expected "+u(a)+" but "+p(n)+" found."};function s(a,n){n=n!==void 0?n:{};var o={},l={svg_path:si},h=si,c=function(I){if(!I)return[];for(var L=[],X=0;X<I.length;X++)L=L.concat.apply(L,I[X]);var z=L[0];return z&&z.code=="m"&&(delete z.relative,z.code="M"),L},d=function(I,L){return Aa(I,L)},u=/^[Mm]/,p=Le(["M","m"],!1,!1),f=function(I,L,X){var z=Gs(I,[L]);return X&&(z=z.concat(Gs(I=="M"?"L":"l",X[1]))),z},g=/^[Zz]/,m=Le(["Z","z"],!1,!1),v=function(){return Gs("Z")},y=/^[Ll]/,x=Le(["L","l"],!1,!1),w=function(I,L){return Gs(I,L)},S=/^[Hh]/,b=Le(["H","h"],!1,!1),A=function(I,L){return Gs(I,L.map(function(X){return{x:X}}))},_=/^[Vv]/,E=Le(["V","v"],!1,!1),C=function(I,L){return Gs(I,L.map(function(X){return{y:X}}))},T=/^[Cc]/,P=Le(["C","c"],!1,!1),O=function(I,L,X){return{x1:I.x,y1:I.y,x2:L.x,y2:L.y,x:X.x,y:X.y}},D=/^[Ss]/,k=Le(["S","s"],!1,!1),W=function(I,L){return{x2:I.x,y2:I.y,x:L.x,y:L.y}},N=/^[Qq]/,F=Le(["Q","q"],!1,!1),Z=function(I,L){return{x1:I.x,y1:I.y,x:L.x,y:L.y}},q=/^[Tt]/,G=Le(["T","t"],!1,!1),Q=/^[Aa]/,ee=Le(["A","a"],!1,!1),Y=function(I,L,X,z,J,_e){return{rx:I,ry:L,xAxisRotation:X,largeArc:z,sweep:J,x:_e.x,y:_e.y}},$=function(I,L){return{x:I,y:L}},H=function(I){return I*1},le=function(I){return I.join("")*1},re=/^[01]/,te=Le(["0","1"],!1,!1),ae=function(I){return I=="1"},ce=function(){return""},ue=",",xe=Ve(",",!1),Re=function(I){return I.join("")},Ae=".",Ne=Ve(".",!1),Fe=/^[eE]/,Ee=Le(["e","E"],!1,!1),Me=/^[+\-]/,Xe=Le(["+","-"],!1,!1),We=/^[0-9]/,V=Le([["0","9"]],!1,!1),B=function(I){return I.join("")},ne=/^[ \t\n\r]/,Se=Le([" ","	",`
3`,"\r"],!1,!1),R=0,Ce=[{line:1,column:1}],Ue=0,Ie=[],de;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 Ve(I,L){return{type:"literal",text:I,ignoreCase:L}}function Le(I,L,X){return{type:"class",parts:I,inverted:L,ignoreCase:X}}function qe(){return{type:"end"}}function tt(I){var L=Ce[I],X;if(L)return L;for(X=I-1;!Ce[X];)X--;for(L=Ce[X],L={line:L.line,column:L.column};X<I;)a.charCodeAt(X)===10?(L.line++,L.column=1):L.column++,X++;return Ce[I]=L,L}function Ye(I,L){var X=tt(I),z=tt(L);return{start:{offset:I,line:X.line,column:X.column},end:{offset:L,line:z.line,column:z.column}}}function Ze(I){R<Ue||(R>Ue&&(Ue=R,Ie=[]),Ie.push(I))}function Wt(I,L,X){return new r(r.buildMessage(I,L),I,L,X)}function si(){var I,L,X,z,J;for(I=R,L=[],X=St();X!==o;)L.push(X),X=St();if(L!==o)if(X=K(),X===o&&(X=null),X!==o){for(z=[],J=St();J!==o;)z.push(J),J=St();z!==o?(L=c(X),I=L):(R=I,I=o)}else R=I,I=o;else R=I,I=o;return I}function K(){var I,L,X,z,J,_e;if(I=R,L=me(),L!==o){for(X=[],z=R,J=[],_e=St();_e!==o;)J.push(_e),_e=St();for(J!==o?(_e=me(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);z!==o;){for(X.push(z),z=R,J=[],_e=St();_e!==o;)J.push(_e),_e=St();J!==o?(_e=me(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o)}X!==o?(L=d(L,X),I=L):(R=I,I=o)}else R=I,I=o;return I}function me(){var I,L,X,z,J,_e;if(I=R,L=Be(),L!==o){for(X=[],z=R,J=[],_e=St();_e!==o;)J.push(_e),_e=St();for(J!==o?(_e=we(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);z!==o;){for(X.push(z),z=R,J=[],_e=St();_e!==o;)J.push(_e),_e=St();J!==o?(_e=we(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o)}X!==o?(L=d(L,X),I=L):(R=I,I=o)}else R=I,I=o;return I}function we(){var I;return I=at(),I===o&&(I=Mt(),I===o&&(I=ji(),I===o&&(I=Kt(),I===o&&(I=gs(),I===o&&(I=tm(),I===o&&(I=U(),I===o&&(I=se(),I===o&&(I=Ge())))))))),I}function Be(){var I,L,X,z,J,_e,Ma;if(I=R,u.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,Ze(p)),L!==o){for(X=[],z=St();z!==o;)X.push(z),z=St();X!==o?(z=Ke(),z!==o?(J=R,_e=gt(),_e===o&&(_e=null),_e!==o?(Ma=pi(),Ma!==o?(_e=[_e,Ma],J=_e):(R=J,J=o)):(R=J,J=o),J===o&&(J=null),J!==o?(L=f(L,z,J),I=L):(R=I,I=o)):(R=I,I=o)):(R=I,I=o)}else R=I,I=o;return I}function at(){var I,L;return I=R,g.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,Ze(m)),L!==o&&(L=v()),I=L,I}function Mt(){var I,L,X,z;if(I=R,y.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,Ze(x)),L!==o){for(X=[],z=St();z!==o;)X.push(z),z=St();X!==o?(z=pi(),z!==o?(L=w(L,z),I=L):(R=I,I=o)):(R=I,I=o)}else R=I,I=o;return I}function pi(){var I,L,X,z,J,_e;if(I=R,L=Ke(),L!==o){for(X=[],z=R,J=gt(),J===o&&(J=null),J!==o?(_e=Ke(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);z!==o;)X.push(z),z=R,J=gt(),J===o&&(J=null),J!==o?(_e=Ke(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);X!==o?(L=d(L,X),I=L):(R=I,I=o)}else R=I,I=o;return I}function ji(){var I,L,X,z;if(I=R,S.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,Ze(b)),L!==o){for(X=[],z=St();z!==o;)X.push(z),z=St();X!==o?(z=js(),z!==o?(L=A(L,z),I=L):(R=I,I=o)):(R=I,I=o)}else R=I,I=o;return I}function js(){var I,L,X,z,J,_e;if(I=R,L=xt(),L!==o){for(X=[],z=R,J=gt(),J===o&&(J=null),J!==o?(_e=xt(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);z!==o;)X.push(z),z=R,J=gt(),J===o&&(J=null),J!==o?(_e=xt(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);X!==o?(L=d(L,X),I=L):(R=I,I=o)}else R=I,I=o;return I}function Kt(){var I,L,X,z;if(I=R,_.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,Ze(E)),L!==o){for(X=[],z=St();z!==o;)X.push(z),z=St();X!==o?(z=js(),z!==o?(L=C(L,z),I=L):(R=I,I=o)):(R=I,I=o)}else R=I,I=o;return I}function gs(){var I,L,X,z;if(I=R,T.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,Ze(P)),L!==o){for(X=[],z=St();z!==o;)X.push(z),z=St();X!==o?(z=Lr(),z!==o?(L=w(L,z),I=L):(R=I,I=o)):(R=I,I=o)}else R=I,I=o;return I}function Lr(){var I,L,X,z,J,_e;if(I=R,L=il(),L!==o){for(X=[],z=R,J=gt(),J===o&&(J=null),J!==o?(_e=il(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);z!==o;)X.push(z),z=R,J=gt(),J===o&&(J=null),J!==o?(_e=il(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);X!==o?(L=d(L,X),I=L):(R=I,I=o)}else R=I,I=o;return I}function il(){var I,L,X,z,J,_e;return I=R,L=Ke(),L!==o?(X=gt(),X===o&&(X=null),X!==o?(z=Ke(),z!==o?(J=gt(),J===o&&(J=null),J!==o?(_e=Ke(),_e!==o?(L=O(L,z,_e),I=L):(R=I,I=o)):(R=I,I=o)):(R=I,I=o)):(R=I,I=o)):(R=I,I=o),I}function tm(){var I,L,X,z;if(I=R,D.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,Ze(k)),L!==o){for(X=[],z=St();z!==o;)X.push(z),z=St();X!==o?(z=im(),z!==o?(L=w(L,z),I=L):(R=I,I=o)):(R=I,I=o)}else R=I,I=o;return I}function im(){var I,L,X,z,J,_e;if(I=R,L=jh(),L!==o){for(X=[],z=R,J=gt(),J===o&&(J=null),J!==o?(_e=jh(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);z!==o;)X.push(z),z=R,J=gt(),J===o&&(J=null),J!==o?(_e=jh(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);X!==o?(L=d(L,X),I=L):(R=I,I=o)}else R=I,I=o;return I}function jh(){var I,L,X,z;return I=R,L=Ke(),L!==o?(X=gt(),X===o&&(X=null),X!==o?(z=Ke(),z!==o?(L=W(L,z),I=L):(R=I,I=o)):(R=I,I=o)):(R=I,I=o),I}function U(){var I,L,X,z;if(I=R,N.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,Ze(F)),L!==o){for(X=[],z=St();z!==o;)X.push(z),z=St();X!==o?(z=oe(),z!==o?(L=w(L,z),I=L):(R=I,I=o)):(R=I,I=o)}else R=I,I=o;return I}function oe(){var I,L,X,z,J,_e;if(I=R,L=fe(),L!==o){for(X=[],z=R,J=gt(),J===o&&(J=null),J!==o?(_e=fe(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);z!==o;)X.push(z),z=R,J=gt(),J===o&&(J=null),J!==o?(_e=fe(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);X!==o?(L=d(L,X),I=L):(R=I,I=o)}else R=I,I=o;return I}function fe(){var I,L,X,z;return I=R,L=Ke(),L!==o?(X=gt(),X===o&&(X=null),X!==o?(z=Ke(),z!==o?(L=Z(L,z),I=L):(R=I,I=o)):(R=I,I=o)):(R=I,I=o),I}function se(){var I,L,X,z;if(I=R,q.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,Ze(G)),L!==o){for(X=[],z=St();z!==o;)X.push(z),z=St();X!==o?(z=ge(),z!==o?(L=w(L,z),I=L):(R=I,I=o)):(R=I,I=o)}else R=I,I=o;return I}function ge(){var I,L,X,z,J,_e;if(I=R,L=Ke(),L!==o){for(X=[],z=R,J=gt(),J===o&&(J=null),J!==o?(_e=Ke(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);z!==o;)X.push(z),z=R,J=gt(),J===o&&(J=null),J!==o?(_e=Ke(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);X!==o?(L=d(L,X),I=L):(R=I,I=o)}else R=I,I=o;return I}function Ge(){var I,L,X,z;if(I=R,Q.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,Ze(ee)),L!==o){for(X=[],z=St();z!==o;)X.push(z),z=St();X!==o?(z=ct(),z!==o?(L=w(L,z),I=L):(R=I,I=o)):(R=I,I=o)}else R=I,I=o;return I}function ct(){var I,L,X,z,J,_e;if(I=R,L=ut(),L!==o){for(X=[],z=R,J=gt(),J===o&&(J=null),J!==o?(_e=ut(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);z!==o;)X.push(z),z=R,J=gt(),J===o&&(J=null),J!==o?(_e=ut(),_e!==o?(J=[J,_e],z=J):(R=z,z=o)):(R=z,z=o);X!==o?(L=d(L,X),I=L):(R=I,I=o)}else R=I,I=o;return I}function ut(){var I,L,X,z,J,_e,Ma,rm,Id,sm,Od,am;return I=R,L=Lt(),L!==o?(X=gt(),X===o&&(X=null),X!==o?(z=Lt(),z!==o?(J=gt(),J===o&&(J=null),J!==o?(_e=xt(),_e!==o?(Ma=gt(),Ma!==o?(rm=bt(),rm!==o?(Id=gt(),Id===o&&(Id=null),Id!==o?(sm=bt(),sm!==o?(Od=gt(),Od===o&&(Od=null),Od!==o?(am=Ke(),am!==o?(L=Y(L,z,_e,rm,sm,am),I=L):(R=I,I=o)):(R=I,I=o)):(R=I,I=o)):(R=I,I=o)):(R=I,I=o)):(R=I,I=o)):(R=I,I=o)):(R=I,I=o)):(R=I,I=o)):(R=I,I=o)):(R=I,I=o),I}function Ke(){var I,L,X,z;return I=R,L=xt(),L!==o?(X=gt(),X===o&&(X=null),X!==o?(z=xt(),z!==o?(L=$(L,z),I=L):(R=I,I=o)):(R=I,I=o)):(R=I,I=o),I}function Lt(){var I,L;return I=R,L=Kr(),L===o&&(L=vs()),L!==o&&(L=H(L)),I=L,I}function xt(){var I,L,X,z;return I=R,L=R,X=_t(),X===o&&(X=null),X!==o?(z=Kr(),z!==o?(X=[X,z],L=X):(R=L,L=o)):(R=L,L=o),L===o&&(L=R,X=_t(),X===o&&(X=null),X!==o?(z=vs(),z!==o?(X=[X,z],L=X):(R=L,L=o)):(R=L,L=o)),L!==o&&(L=le(L)),I=L,I}function bt(){var I,L;return I=R,re.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,Ze(te)),L!==o&&(L=ae(L)),I=L,I}function gt(){var I,L,X,z,J;if(I=R,L=[],X=St(),X!==o)for(;X!==o;)L.push(X),X=St();else L=o;if(L!==o)if(X=Di(),X===o&&(X=null),X!==o){for(z=[],J=St();J!==o;)z.push(J),J=St();z!==o?(L=[L,X,z],I=L):(R=I,I=o)}else R=I,I=o;else R=I,I=o;if(I===o){if(I=R,L=R,X=Di(),X!==o){for(z=[],J=St();J!==o;)z.push(J),J=St();z!==o?(X=[X,z],L=X):(R=L,L=o)}else R=L,L=o;L!==o&&(L=ce()),I=L}return I}function Di(){var I;return a.charCodeAt(R)===44?(I=ue,R++):(I=o,Ze(xe)),I}function Kr(){var I,L,X,z;return I=R,L=R,X=_a(),X!==o?(z=ai(),z===o&&(z=null),z!==o?(X=[X,z],L=X):(R=L,L=o)):(R=L,L=o),L===o&&(L=R,X=vs(),X!==o?(z=ai(),z!==o?(X=[X,z],L=X):(R=L,L=o)):(R=L,L=o)),L!==o&&(L=Re(L)),I=L,I}function _a(){var I,L,X,z,J;return I=R,L=R,X=vs(),X===o&&(X=null),X!==o?(a.charCodeAt(R)===46?(z=Ae,R++):(z=o,Ze(Ne)),z!==o?(J=vs(),J!==o?(X=[X,z,J],L=X):(R=L,L=o)):(R=L,L=o)):(R=L,L=o),L===o&&(L=R,X=vs(),X!==o?(a.charCodeAt(R)===46?(z=Ae,R++):(z=o,Ze(Ne)),z!==o?(X=[X,z],L=X):(R=L,L=o)):(R=L,L=o)),L!==o&&(L=Re(L)),I=L,I}function ai(){var I,L,X,z,J;return I=R,L=R,Fe.test(a.charAt(R))?(X=a.charAt(R),R++):(X=o,Ze(Ee)),X!==o?(z=_t(),z===o&&(z=null),z!==o?(J=vs(),J!==o?(X=[X,z,J],L=X):(R=L,L=o)):(R=L,L=o)):(R=L,L=o),L!==o&&(L=Re(L)),I=L,I}function _t(){var I;return Me.test(a.charAt(R))?(I=a.charAt(R),R++):(I=o,Ze(Xe)),I}function vs(){var I,L,X;if(I=R,L=[],We.test(a.charAt(R))?(X=a.charAt(R),R++):(X=o,Ze(V)),X!==o)for(;X!==o;)L.push(X),We.test(a.charAt(R))?(X=a.charAt(R),R++):(X=o,Ze(V));else L=o;return L!==o&&(L=B(L)),I=L,I}function St(){var I,L;return I=R,ne.test(a.charAt(R))?(L=a.charAt(R),R++):(L=o,Ze(Se)),L!==o&&(L=ce()),I=L,I}function Aa(I,L){if(!L)return[I];for(var X=[I],z=0,J=L.length;z<J;z++)X[z+1]=L[z][1];return X}var so={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 dn in so)so[dn.toUpperCase()]=so[dn];function Gs(I,L){L||(L=[{}]);for(var X=L.length;X--;){var z={code:I,command:so[I]};I==I.toLowerCase()&&(z.relative=!0);for(var J in L[X])z[J]=L[X][J];L[X]=z}return L}if(de=h(),de!==o&&R===a.length)return de;throw de!==o&&R<a.length&&Ze(qe()),Wt(Ie,Ue<a.length?a.charAt(Ue):null,Ue<a.length?Ye(Ue,Ue+1):Ye(Ue,Ue))}t.exports={SyntaxError:r,parse:s}}),mM=Zo((e,t)=>{var i=RP().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}}),LP=Zo((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}}),Mh="149",Jr={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},BP=0,$1=1,zP=2,my=1,FP=2,xc=3,zs=0,Ki=1,vr=2,Ci=0,Lo=1,ex=2,tx=3,ix=4,kP=5,zl=100,UP=101,NP=102,rx=103,sx=104,VP=200,jP=201,GP=202,HP=203,gM=204,vM=205,WP=206,qP=207,XP=208,YP=209,QP=210,ZP=0,KP=1,JP=2,uv=3,$P=4,eD=5,tD=6,iD=7,yM=0,rD=1,sD=2,ua=0,aD=1,nD=2,oD=3,lD=4,hD=5,xM=300,Vo=301,jo=302,pv=303,fv=304,fd=306,Ya=1e3,ii=1001,mv=1002,wt=1003,ax=1004,nm=1005,yt=1006,cD=1007,ch=1008,xr=1009,dD=1010,uD=1011,bM=1012,pD=1013,Qa=1014,Vt=1015,rn=1016,fD=1017,mD=1018,Bo=1020,gD=1021,ri=1023,vD=1024,yD=1025,zo=1026,Go=1027,sp=1028,xD=1029,Sp=1030,bD=1031,wM=1033,om=33776,lm=33777,hm=33778,cm=33779,nx=35840,ox=35841,lx=35842,hx=35843,wD=36196,cx=37492,dx=37496,ux=37808,px=37809,fx=37810,mx=37811,gx=37812,vx=37813,yx=37814,xx=37815,bx=37816,wx=37817,Sx=37818,_x=37819,Ax=37820,Mx=37821,dm=36492,SD=36283,Ex=36284,Cx=36285,Tx=36286,SM=2200,_M=2201,gy=2202,_p=2300,Ap=2301,um=2302,Gl=2400,Hl=2401,Mp=2402,vy=2500,_D=2501,Fs=3e3,mt=3001,hn=3200,AM=3201,AD=0,MD=1,ra="srgb",Ep="srgb-linear",pm=7680,ED=519,gv=35044,CD=35048,vv="300 es",yv=1035,ur=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}}},pr=["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
35","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"],Px=1234567,Pc=Math.PI/180,Wc=180/Math.PI;function ds(){let e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(pr[e&255]+pr[e>>8&255]+pr[e>>16&255]+pr[e>>24&255]+"-"+pr[t&255]+pr[t>>8&255]+"-"+pr[t>>16&15|64]+pr[t>>24&255]+"-"+pr[i&63|128]+pr[i>>8&255]+"-"+pr[i>>16&255]+pr[i>>24&255]+pr[r&255]+pr[r>>8&255]+pr[r>>16&255]+pr[r>>24&255]).toLowerCase()}function _i(e,t,i){return Math.max(t,Math.min(i,e))}function yy(e,t){return(e%t+t)%t}function TD(e,t,i,r,s){return r+(e-t)*(s-r)/(i-t)}function PD(e,t,i){return e!==t?(i-e)/(t-e):0}function Dc(e,t,i){return(1-i)*e+i*t}function DD(e,t,i,r){return Dc(e,t,1-Math.exp(-i*r))}function ID(e,t=1){return t-Math.abs(yy(e,t*2)-t)}function OD(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t),e*e*(3-2*e))}function RD(e,t,i){return e<=t?0:e>=i?1:(e=(e-t)/(i-t),e*e*e*(e*(e*6-15)+10))}function LD(e,t){return e+Math.floor(Math.random()*(t-e+1))}function BD(e,t){return e+Math.random()*(t-e)}function zD(e){return e*(.5-Math.random())}function FD(e){e!==void 0&&(Px=e);let t=Px+=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 kD(e){return e*Pc}function UD(e){return e*Wc}function xv(e){return(e&e-1)===0&&e!==0}function MM(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Cp(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function ND(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),d=a((t-r)/2),u=n((t-r)/2),p=a((r-t)/2),f=n((r-t)/2);switch(s){case"XYX":e.set(o*c,l*d,l*u,o*h);break;case"YZY":e.set(l*u,o*c,l*d,o*h);break;case"ZXZ":e.set(l*d,l*u,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 Za(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 Qt(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 Oe=Object.freeze({__proto__:null,DEG2RAD:Pc,RAD2DEG:Wc,ceilPowerOfTwo:MM,clamp:_i,damp:DD,degToRad:kD,denormalize:Za,euclideanModulo:yy,floorPowerOfTwo:Cp,generateUUID:ds,inverseLerp:PD,isPowerOfTwo:xv,lerp:Dc,mapLinear:TD,normalize:Qt,pingpong:ID,radToDeg:UD,randFloat:BD,randFloatSpread:zD,randInt:LD,seededRandom:FD,setQuaternionFromProperEuler:ND,smootherstep:RD,smoothstep:OD}),j=class{constructor(e=0,t=0){j.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 3
3sub(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}},Mi=class{constructor(){Mi.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],d=i[2],u=i[5],p=i[8],f=r[0],g=r[3],m=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*g+n*y+o*S,s[6]=a*m+n*x+o*b,s[1]=l*f+h*v+c*w,s[4]=l*g+h*y+c*S,s[7]=l*m+h*x+c*b,s[2]=d*f+u*v+p*w,s[5]=d*g+u*y+p*S,s[8]=d*m+u*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,d=n*o-h*s,u=l*s-a*o,p=t*c+i*d+r*u;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]=d*f,e[4]=(h*t-r*o)*f,e[5]=(r*s-n*t)*f,e[6]=u*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(fm.makeScale(e,t)),this}rotate(e){return this.premultiply(fm.makeRotation(-e)),this}translate(e,t){return this.premultiply(fm.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)}},fm=new Mi;function EM(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}var VD={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Ld(e,t){return new VD[e](t)}function qc(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function jD(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 Fo(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}
vendor: 10,974 bytes, line 3
3function ap(e){return e<.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}var mm={[ra]:{[Ep]:Fo},[Ep]:{[ra]:ap}},wr={legacyMode:!0,get workingColorSpace(){return Ep},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(mm[t]&&mm[t][i]!==void 0){let r=mm[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},Ii={r:0,g:0,b:0},ys={h:0,s:0,l:0},Bd={h:0,s:0,l:0};function gm(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 zd(e,t){return t.r=e.r,t.g=e.g,t.b=e.b,t}var $e=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=ra){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,wr.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=wr.workingColorSpace){return this.r=e,this.g=t,this.b=i,wr.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=wr.workingColorSpace){if(e=yy(e,1),t=_i(t,0,1),i=_i(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=gm(a,s,e+1/3),this.g=gm(a,s,e),this.b=gm(a,s,e-1/3)}return wr.toWorkingColorSpace(this,r),this}setStyle(e,t=ra){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,wr.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,wr.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,wr.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,wr.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=ra){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=Fo(e.r),this.g=Fo(e.g),this.b=Fo(e.b),this}copyLinearToSRGB(e){return this.r=ap(e.r),this.g=ap(e.g),this.b=ap(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ra){return wr.fromWorkingColorSpace(zd(this,Ii),e),_i(Ii.r*255,0,255)<<16^_i(Ii.g*255,0,255)<<8^_i(Ii.b*255,0,255)<<0}getHexString(e=ra){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=wr.workingColorSpace){wr.fromWorkingColorSpace(zd(this,Ii),t);let i=Ii.r,r=Ii.g,s=Ii.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=wr.workingColorSpace){return wr.fromWorkingColorSpace(zd(this,Ii),t),e.r=Ii.r,e.g=Ii.g,e.b=Ii.b,e}getStyle(e=ra){return wr.fromWorkingColorSpace(zd(this,Ii),e),e!==ra?`color(${e} ${Ii.r} ${Ii.g} ${Ii.b})`:`rgb(${Ii.r*255|0},${Ii.g*255|0},${Ii.b*255|0})`}offsetHSL(e,t,i){return this.getHSL(ys),ys.h+=e,ys.s+=t,ys.l+=i,this.setHSL(ys.h,ys.s,ys.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(ys),e.getHSL(Bd);let i=Dc(ys.h,Bd.h,t),r=Dc(ys.s,Bd.s,t),s=Dc(ys.l,Bd.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}};$e.NAMES=CM;var rl,TM=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{rl===void 0&&(rl=qc("canvas")),rl.width=e.width,rl.height=e.height;let i=rl.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=rl}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=qc("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]=Fo(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(Fo(t[i]/255)*255):t[i]=Fo(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}},PM=class{constructor(e=null){this.isSource=!0,this.uuid=ds(),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(vm(r[a].image)):s.push(vm(r[a]))}else s=vm(r);i.url=s}return t||(e.images[this.uuid]=i),i}};function vm(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap?TM.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 GD=0,oi=class extends ur{constructor(e=oi.DEFAULT_IMAGE,t=oi.DEFAULT_MAPPING,i=ii,r=ii,s=yt,a=ch,n=ri,o=xr,l=oi.DEFAULT_ANISOTROPY,h=Fs){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:GD++}),this.uuid=ds(),this.name="",this.source=new PM(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 j(0,0),this.repeat=new j(1,
vendor: 18,947 bytes, line 3
31),this.center=new j(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Mi,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.type,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!==xM)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ya:e.x=e.x-Math.floor(e.x);break;case ii:e.x=e.x<0?0:1;break;case mv: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 Ya:e.y=e.y-Math.floor(e.y);break;case ii:e.y=e.y<0?0:1;break;case mv: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)}};oi.DEFAULT_IMAGE=null;oi.DEFAULT_MAPPING=xM;oi.DEFAULT_ANISOTROPY=1;var ht=class{constructor(e=0,t=0,i=0,r=1){ht.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],d=a[9],u=a[2],p=a[6],f=a[10];if(Math.abs(o-h)<.01&&Math.abs(l-u)<.01&&Math.abs(d-p)<.01){if(Math.abs(o+h)<.1&&Math.abs(l+u)<.1&&Math.abs(d+p)<.1&&Math.abs(n+c+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let m=(n+1)/2,v=(c+1)/2,y=(f+1)/2,x=(o+h)/4,w=(l+u)/4,S=(d+p)/4;return m>v&&m>y?m<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(m),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 g=Math.sqrt((p-d)*(p-d)+(l-u)*(l-u)+(h-o)*(h-o));return Math.abs(g)<.001&&(g=1),this.x=(p-d)/g,this.y=(l-u)/g,this.z=(h-o)/g,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}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,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}},Tt=class extends ur{constructor(e=1,t=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new ht(0,0,e,t),this.scissorTest=!1,this.viewport=new ht(0,0,e,t);let r={width:e,height:t,depth:1};this.texture=new oi(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:yt,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 PM(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"})}},DM=class extends oi{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=wt,this.minFilter=wt,this.wrapR=ii,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},HD=class extends oi{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=wt,this.minFilter=wt,this.wrapR=ii,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},IM=class extends Tt{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}},ot=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],d=s[a+0],u=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]=d,e[t+1]=u,e[t+2]=p,e[t+3]=f;return}if(c!==f||o!==d||l!==u||h!==p){let g=1-n,m=o*d+l*u+h*p+c*f,v=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){let w=Math.sqrt(y),S=Math.atan2(w,m*v);g=Math.sin(g*S)/w,n=Math.sin(n*S)/w}let x=n*v;if(o=o*g+d*x,l=l*g+u*x,h=h*g+p*x,c=c*g+f*x,g===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],d=s[a+1],u=s[a+2],p=s[a+3];return e[t]=n*p+h*c+o*u-l*d,e[t+1]=o*p+h*d+l*c-n*u,e[t+2]=l*p+h*u+n*d-o*c,e[t+3]=h*p-n*c-o*d-l*u,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),d=o(i/2),u=o(r/2),p=o(s/2);switch(a){case"XYZ":this._x=d*h*c+l*u*p,this._y=l*u*c-d*h*p,this._z=l*h*p+d*u*c,this._w=l*h*c-d*u*p;break;case"YXZ":this._x=d*h*c+l*u*p,this._y=l*u*c-d*h*p,this._z=l*h*p-d*u*c,this._w=l*h*c+d*u*p;break;case"ZXY":this._x=d*h*c-l*u*p,this._y=l*u*c+d*h*p,this._z=l*h*p+d*u*c,this._w=l*h*c-d*u*p;break;case"ZYX":this._x=d*h*c-l*u*p,this._y=l*u*c+d*h*p,this._z=l*h*p-d*u*c,this._w=l*h*c+d*u*p;break;case"YZX":this._x=d*h*c+l*u*p,this._y=l*u*c+d*h*p,this._z=l*h*p-d*u*c,this._w=l*h*c-d*u*p;break;case"XZY":this._x=d*h*c-l*u*p,this._y=l*u*c-d*h*p,this._z=l*h*p+d*u*c,this._w=l*h*c+d*u*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],d=i+n+c;if(d>0){let u=.5/Math.sqrt(d+1);this._w=.25/u,this._x=(h-o)*u,this._y=(s-l)*u,this._z=(a-r)*u}else if(i>n&&i>c){let u=2*Math.sqrt(1+i-n-c);this._w=(h-o)/u,this._x=.25*u,this._y=(r+a)/u,this._z=(s+l)/u}else if(n>c){let u=2*Math.sqrt(1+n-i-c);this._w=(s-l)/u,this._x=(r+a)/u,this._y=.25*u,this._z=(o+h)/u}else{let u=2*Math.sqrt(1+c-i-n);this._w=(a-r)/u,this._x=(s+l)/u,this._y=(o+h)/u,this._z=.25*u}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(_i(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 u=1-t;return this._w=u*a+t*this._w,this._x=u*i+t*this._x,this._y=u*r+t*this._y,this._z=u*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,d=Math.sin(t*h)/l;return this._w=a*c+this._w*d,this._x=i*c+this._x*d,this._y=r*c+this._y*d,this._z=s*c+this._z*d,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(Dx.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Dx.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: 10,969 bytes, line 3
3applyQuaternion(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,d=-s*t-a*i-n*r;return this.x=l*o+d*-s+h*-n-c*-a,this.y=h*o+d*-a+c*-s-l*-n,this.z=c*o+d*-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 ym.copy(this).projectOnVector(e),this.sub(ym)}reflect(e){return this.sub(ym.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(_i(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}},ym=new M,Dx=new ot,xi=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],d=e[o+2];h<t&&(t=h),c<i&&(i=c),d<r&&(r=d),h>s&&(s=h),c>a&&(a=c),d>n&&(n=d)}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),d=e.getZ(o);h<t&&(t=h),c<i&&(i=c),d<r&&(r=d),h>s&&(s=h),c>a&&(a=c),d>n&&(n=d)}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=ao.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++)ao.fromBufferAttribute(s,a).applyMatrix4(e.matrixWorld),this.expandByPoint(ao)}else i.boundingBox===null&&i.computeBoundingBox(),xm.copy(i.boundingBox),xm.applyMatrix4(e.matrixWorld),this.union(xm);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,ao),ao.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(Gh),Fd.subVectors(this.max,Gh),sl.subVectors(e.a,Gh),al.subVectors(e.b,Gh),nl.subVectors(e.c,Gh),un.subVectors(al,sl),pn.subVectors(nl,al),no.subVectors(sl,nl);let t=[0,-un.z,un.y,0,-pn.z,pn.y,0,-no.z,no.y,un.z,0,-un.x,pn.z,0,-pn.x,no.z,0,-no.x,-un.y,un.x,0,-pn.y,pn.x,0,-no.y,no.x,0];return!bm(t,sl,al,nl,Fd)||(t=[1,0,0,0,1,0,0,0,1],!bm(t,sl,al,nl,Fd))?!1:(kd.crossVectors(un,pn),t=[kd.x,kd.y,kd.z],bm(t,sl,al,nl,Fd))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return ao.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(ao).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:(Ea[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ea[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ea[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ea[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ea[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ea[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ea[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ea[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ea),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)}},Ea=[new M,new M,new M,new M,new M,new M,new M,new M],ao=new M,xm=new xi,sl=new M,al=new M,nl=new M,un=new M,pn=new M,no=new M,Gh=new M,Fd=new M,kd=new M,oo=new M;function bm(e,t,i,r,s){for(let a=0,n=e.length-3;a<=n;a+=3){oo.fromArray(e,a);let o=s.x*Math.abs(oo.x)+s.y*Math.abs(oo.y)+s.z*Math.abs(oo.z),l=t.dot(oo),h=i.dot(oo),c=r.dot(oo);if(Math.max(-Math.max(l,h,c),Math.min(l,h,c))>o)return!1}return!0}var WD=new xi,Hh=new M,wm=new M,Hr=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):WD.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)}
vendor: 7,185 bytes, line 3
3applyMatrix4(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;Hh.subVectors(e,this.center);let t=Hh.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Hh,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):(wm.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Hh.copy(e.center).add(wm)),this.expandByPoint(Hh.copy(e.center).sub(wm))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},Ca=new M,Sm=new M,Ud=new M,fn=new M,_m=new M,Nd=new M,Am=new M,Eh=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}recast(e){return this.origin.copy(this.at(e,Ca)),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=Ca.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ca.copy(this.direction).multiplyScalar(t).add(this.origin),Ca.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Sm.copy(e).add(t).multiplyScalar(.5),Ud.copy(t).sub(e).normalize(),fn.copy(this.origin).sub(Sm);let s=e.distanceTo(t)*.5,a=-this.direction.dot(Ud),n=fn.dot(this.direction),o=-fn.dot(Ud),l=fn.lengthSq(),h=Math.abs(1-a*a),c,d,u,p;if(h>0)if(c=a*o-n,d=a*n-o,p=s*h,c>=0)if(d>=-p)if(d<=p){let f=1/h;c*=f,d*=f,u=c*(c+a*d+2*n)+d*(a*c+d+2*o)+l}else d=s,c=Math.max(0,-(a*d+n)),u=-c*c+d*(d+2*o)+l;else d=-s,c=Math.max(0,-(a*d+n)),u=-c*c+d*(d+2*o)+l;else d<=-p?(c=Math.max(0,-(-a*s+n)),d=c>0?-s:Math.min(Math.max(-s,-o),s),u=-c*c+d*(d+2*o)+l):d<=p?(c=0,d=Math.min(Math.max(-s,-o),s),u=d*(d+2*o)+l):(c=Math.max(0,-(a*s+n)),d=c>0?s:Math.min(Math.max(-s,-o),s),u=-c*c+d*(d+2*o)+l);else d=a>0?-s:s,c=Math.max(0,-(a*d+n)),u=-c*c+d*(d+2*o)+l;return i&&i.copy(this.direction).multiplyScalar(c).add(this.origin),r&&r.copy(Ud).multiplyScalar(d).add(Sm),u}intersectSphere(e,t){Ca.subVectors(e.center,this.origin);let i=Ca.dot(this.direction),r=Ca.dot(Ca)-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,d=this.origin;return l>=0?(i=(e.min.x-d.x)*l,r=(e.max.x-d.x)*l):(i=(e.max.x-d.x)*l,r=(e.min.x-d.x)*l),h>=0?(s=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(s=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),c>=0?(n=(e.min.z-d.z)*c,o=(e.max.z-d.z)*c):(n=(e.max.z-d.z)*c,o=(e.min.z-d.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,Ca)!==null}intersectTriangle(e,t,i,r,s){_m.subVectors(t,e),Nd.subVectors(i,e),Am.crossVectors(_m,Nd);let a=this.direction.dot(Am),n;if(a>0){if(r)return null;n=1}else if(a<0)n=-1,a=-a;else return null;fn.subVectors(this.origin,e);let o=n*this.direction.dot(Nd.crossVectors(fn,Nd));if(o<0)return null;let l=n*this.direction.dot(_m.cross(fn));if(l<0||o+l>a)return null;let h=-n*fn.dot(Am);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)}},be=class{constructor(){be.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,d,u,p,f,g){let m=this.elements;return m[0]=e,m[4]=t,m[8]=i,m[12]=r,m[1]=s,m[5]=a,m[9]=n,m[13]=o,m[2]=l,m[6]=h,m[10]=c,m[14]=d,m[3]=u,m[7]=p,m[11]=f,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new be().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/ol.setFromMatrixColumn(e,0).length(),s=1/ol.setFromMatrixColumn(e,1).length(),a=1/ol.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 d=a*h,u=a*c,p=n*h,f=n*c;t[0]=o*h,t[4]=-o*c,t[8]=l,t[1]=u+p*l,t[5]=d-f*l,t[9]=-n*o,t[2]=f-d*l,t[6]=p+u*l,t[10]=a*o}else if(e.order==="YXZ"){let d=o*h,u=o*c,p=l*h,f=l*c;t[0]=d+f*n,t[4]=p*n-u,t[8]=a*l,t[1]=a*c,t[5]=a*h,t[9]=-n,t[2]=u*n-p,t[6]=f+d*n,t[10]=a*o}else if(e.order==="ZXY"){let d=o*h,u=o*c,p=l*h,f=l*c;t[0]=d-f*n,t[4]=-a*c,t[8]=p+u*n,t[1]=u+p*n,t[5]=a*h,t[9]=f-d*n,t[2]=-a*l,t[6]=n,t[10]=a*o}else if(e.order==="ZYX"){let d=a*h,u=a*c,p=n*h,f=n*c;t[0]=o*h,t[4]=p*l-u,t[8]=d*l+f,t[1]=o*c,t[5]=f*l+d,t[9]=u*l-p,t[2]=-l,t[6]=n*o,t[10]=a*o}else if(e.order==="YZX"){let d=a*o,u=a*l,p=n*o,f=n*l;t[0]=o*h,t[4]=f-d*c,t[8]=p*c+u,t[1]=c,t[5]=a*h,t[9]=-n*h,t[2]=-l*h,t[6]=u*c+p,t[10]=d-f*c}else if(e.order==="XZY"){let d=a*o,u=a*l,p=n*o,f=n*l;t[0]=o*h,t[4]=-c,t[8]=l*h,t[1]=d*c+f,t[5]=a*h,t[9]=u*c-p,t[2]=p*c-u,t[6]=n*h,t[10]=f*c+d}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(qD,e,XD)}lookAt(e,t,i){let r=this.elements;return qr.subVectors(e,t),qr.lengthSq()===0&&(qr.z=1),qr.normalize(),mn.crossVectors(i,qr),mn.lengthSq()===0&&(Math.abs(i.z)===1?qr.x+=1e-4:qr.z+=1e-4,qr.n
vendor: 10,068 bytes, line 3
3ormalize(),mn.crossVectors(i,qr)),mn.normalize(),Vd.crossVectors(qr,mn),r[0]=mn.x,r[4]=Vd.x,r[8]=qr.x,r[1]=mn.y,r[5]=Vd.y,r[9]=qr.y,r[2]=mn.z,r[6]=Vd.z,r[10]=qr.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],d=i[9],u=i[13],p=i[2],f=i[6],g=i[10],m=i[14],v=i[3],y=i[7],x=i[11],w=i[15],S=r[0],b=r[4],A=r[8],_=r[12],E=r[1],C=r[5],T=r[9],P=r[13],O=r[2],D=r[6],k=r[10],W=r[14],N=r[3],F=r[7],Z=r[11],q=r[15];return s[0]=a*S+n*E+o*O+l*N,s[4]=a*b+n*C+o*D+l*F,s[8]=a*A+n*T+o*k+l*Z,s[12]=a*_+n*P+o*W+l*q,s[1]=h*S+c*E+d*O+u*N,s[5]=h*b+c*C+d*D+u*F,s[9]=h*A+c*T+d*k+u*Z,s[13]=h*_+c*P+d*W+u*q,s[2]=p*S+f*E+g*O+m*N,s[6]=p*b+f*C+g*D+m*F,s[10]=p*A+f*T+g*k+m*Z,s[14]=p*_+f*P+g*W+m*q,s[3]=v*S+y*E+x*O+w*N,s[7]=v*b+y*C+x*D+w*F,s[11]=v*A+y*T+x*k+w*Z,s[15]=v*_+y*P+x*W+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],d=e[10],u=e[14],p=e[3],f=e[7],g=e[11],m=e[15];return p*(+s*o*c-r*l*c-s*n*d+i*l*d+r*n*u-i*o*u)+f*(+t*o*u-t*l*d+s*a*d-r*a*u+r*l*h-s*o*h)+g*(+t*l*c-t*n*u-s*a*c+i*a*u+s*n*h-i*l*h)+m*(-r*n*h-t*o*c+t*n*d+r*a*c-i*a*d+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],d=e[10],u=e[11],p=e[12],f=e[13],g=e[14],m=e[15],v=c*g*l-f*d*l+f*o*u-n*g*u-c*o*m+n*d*m,y=p*d*l-h*g*l-p*o*u+a*g*u+h*o*m-a*d*m,x=h*f*l-p*c*l+p*n*u-a*f*u-h*n*m+a*c*m,w=p*c*o-h*f*o-p*n*d+a*f*d+h*n*g-a*c*g,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*d*s-c*g*s-f*r*u+i*g*u+c*r*m-i*d*m)*b,e[2]=(n*g*s-f*o*s+f*r*l-i*g*l-n*r*m+i*o*m)*b,e[3]=(c*o*s-n*d*s-c*r*l+i*d*l+n*r*u-i*o*u)*b,e[4]=y*b,e[5]=(h*g*s-p*d*s+p*r*u-t*g*u-h*r*m+t*d*m)*b,e[6]=(p*o*s-a*g*s-p*r*l+t*g*l+a*r*m-t*o*m)*b,e[7]=(a*d*s-h*o*s+h*r*l-t*d*l-a*r*u+t*o*u)*b,e[8]=x*b,e[9]=(p*c*s-h*f*s-p*i*u+t*f*u+h*i*m-t*c*m)*b,e[10]=(a*f*s-p*n*s+p*i*l-t*f*l-a*i*m+t*n*m)*b,e[11]=(h*n*s-a*c*s-h*i*l+t*c*l+a*i*u-t*n*u)*b,e[12]=w*b,e[13]=(h*f*r-p*c*r+p*i*d-t*f*d-h*i*g+t*c*g)*b,e[14]=(p*n*r-a*f*r-p*i*o+t*f*o+a*i*g-t*n*g)*b,e[15]=(a*c*r-h*n*r+h*i*o-t*c*o-a*i*d+t*n*d)*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,d=s*l,u=s*h,p=s*c,f=a*h,g=a*c,m=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+m))*w,r[1]=(u+x)*w,r[2]=(p-y)*w,r[3]=0,r[4]=(u-x)*S,r[5]=(1-(d+m))*S,r[6]=(g+v)*S,r[7]=0,r[8]=(p+y)*b,r[9]=(g-v)*b,r[10]=(1-(d+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=ol.set(r[0],r[1],r[2]).length(),a=ol.set(r[4],r[5],r[6]).length(),n=ol.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],xs.copy(this);let o=1/s,l=1/a,h=1/n;return xs.elements[0]*=o,xs.elements[1]*=o,xs.elements[2]*=o,xs.elements[4]*=l,xs.elements[5]*=l,xs.elements[6]*=l,xs.elements[8]*=h,xs.elements[9]*=h,xs.elements[10]*=h,t.setFromRotationMatrix(xs),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),d=-(a+s)/(a-s),u=-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]=d,n[14]=u,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,d=(i+r)*l,u=(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]=-d,n[2]=0,n[6]=0,n[10]=-2*h,n[14]=-u,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}},ol=new M,xs=new be,qD=new M(0,0,0),XD=new M(1,1,1),mn=new M,Vd=new M,qr=new M,Ix=new be,Ox=new ot,zi=class{constructor(e=0,t=0,i=0,r=zi.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],d=r[6],u=r[10];switch(t){case"XYZ":this._y=Math.asin(_i(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(-h,u),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-_i(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(n,u),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,s),this._z=0);break;case"ZXY":this._x=Math.asin(_i(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-c,u),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,s));break;case"ZYX":this._y=Math.asin(-_i(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(o,s)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(_i(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,u));break;case"XZY":this._z=Math.asin(-_i(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(n,s)):(this._x=Math.atan2(-h,u),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 Ix.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ix,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Ox.setFromEuler(this),this.setFromQuaternion(Ox,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}};zi.DEFAULT_ORDER="XYZ";var xy=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}isEnabled(e){return(this.mask&(1<<e|0))!==0}},YD=0,Rx=new M,ll=new ot,Ta=new be,jd=new M,Wh=new M,QD=new M,ZD=new ot,Lx=new M(1,0,0),Bx=new M(0,1,0),zx=new M(0,0,1),KD={type:"added"},Fx={type:"removed"},Ut=class extends ur{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:YD++}),this.uuid=ds(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ut.DEFAULT_UP.clone();let e=new M,t=new zi,i=new ot,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 be},normalMatrix:{value:new Mi}}),this.matrix=new be,this.matrixWorld=new be,this.matrixAutoUpdate=Ut.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=Ut.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new xy,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)}
3setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ll.setFromAxisAngle(e,t),this.quaternion.multiply(ll),this}rotateOnWorldAxis(e,t){return ll.setFromAxisAngle(e,t),this.quaternion.premultiply(ll),this}rotateX(e){return this.rotateOnAxis(Lx,e)}rotateY(e){return this.rotateOnAxis(Bx,e)}rotateZ(e){return this.rotateOnAxis(zx,e)}translateOnAxis(e,t){return Rx.copy(e).applyQuaternion(this.quaternion),this.position.add(Rx.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Lx,e)}translateY(e){return this.translateOnAxis(Bx,e)}translateZ(e){return this.translateOnAxis(zx,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Ta.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?jd.copy(e):jd.set(e,t,i);let r=this.parent;this.updateWorldMatrix(!0,!1),Wh.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ta.lookAt(Wh,jd,this.up):Ta.lookAt(jd,Wh,this.up),this.quaternion.setFromRotationMatrix(Ta),r&&(Ta.extractRotation(r.matrixWorld),ll.setFromRotationMatrix(Ta),this.quaternion.premultiply(ll.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(KD)):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(Fx)),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(Fx)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),Ta.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Ta.multiply(e.parent.matrixWorld)),e.applyMatrix4(Ta),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(Wh,e,QD),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Wh,ZD,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):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
vendor: 8,198 bytes, line 3
3):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),d=a(e.skeletons),u=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),d.length>0&&(i.skeletons=d),u.length>0&&(i.animations=u),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}};Ut.DEFAULT_UP=new M(0,1,0);Ut.DEFAULT_MATRIX_AUTO_UPDATE=!0;Ut.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var bs=new M,Pa=new M,Mm=new M,Da=new M,hl=new M,cl=new M,kx=new M,Em=new M,Cm=new M,Tm=new M,or=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),bs.subVectors(e,t),r.cross(bs);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){bs.subVectors(r,t),Pa.subVectors(i,t),Mm.subVectors(e,t);let a=bs.dot(bs),n=bs.dot(Pa),o=bs.dot(Mm),l=Pa.dot(Pa),h=Pa.dot(Mm),c=a*l-n*n;if(c===0)return s.set(-2,-1,-1);let d=1/c,u=(l*o-n*h)*d,p=(a*h-n*o)*d;return s.set(1-u-p,p,u)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Da),Da.x>=0&&Da.y>=0&&Da.x+Da.y<=1}static getUV(e,t,i,r,s,a,n,o){return this.getBarycoord(e,t,i,r,Da),o.set(0,0),o.addScaledVector(s,Da.x),o.addScaledVector(a,Da.y),o.addScaledVector(n,Da.z),o}static isFrontFacing(e,t,i,r){return bs.subVectors(i,t),Pa.subVectors(e,t),bs.cross(Pa).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 bs.subVectors(this.c,this.b),Pa.subVectors(this.a,this.b),bs.cross(Pa).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return or.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return or.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return or.getUV(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return or.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return or.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;hl.subVectors(r,i),cl.subVectors(s,i),Em.subVectors(e,i);let o=hl.dot(Em),l=cl.dot(Em);if(o<=0&&l<=0)return t.copy(i);Cm.subVectors(e,r);let h=hl.dot(Cm),c=cl.dot(Cm);if(h>=0&&c<=h)return t.copy(r);let d=o*c-h*l;if(d<=0&&o>=0&&h<=0)return a=o/(o-h),t.copy(i).addScaledVector(hl,a);Tm.subVectors(e,s);let u=hl.dot(Tm),p=cl.dot(Tm);if(p>=0&&u<=p)return t.copy(s);let f=u*l-o*p;if(f<=0&&l>=0&&p<=0)return n=l/(l-p),t.copy(i).addScaledVector(cl,n);let g=h*p-u*c;if(g<=0&&c-h>=0&&u-p>=0)return kx.subVectors(s,r),n=(c-h)/(c-h+(u-p)),t.copy(r).addScaledVector(kx,n);let m=1/(g+f+d);return a=f*m,n=d*m,t.copy(i).addScaledVector(hl,a).addScaledVector(cl,n)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},JD=0,md=class extends ur{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:JD++}),this.uuid=ds(),this.name="",this.type="Material",this.blending=Lo,this.side=zs,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=gM,this.blendDst=vM,this.blendEquation=zl,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=uv,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ED,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=pm,this.stencilZFail=pm,this.stencilZPass=pm,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 3
3i.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!==Lo&&(i.blending=this.blending),this.side!==zs&&(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,134 bytes, line 3
3adows,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++}},sn=class extends md{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new $e(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=yM,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}},wi=new M,Gd=new j,et=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=gv,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++)Gd.fromBufferAttribute(this,t),Gd.applyMatrix3(e),this.setXY(t,Gd.x,Gd.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)wi.fromBufferAttribute(this,t),wi.applyMatrix3(e),this.setXYZ(t,wi.x,wi.y,wi.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)wi.fromBufferAttribute(this,t),wi.applyMatrix4(e),this.setXYZ(t,wi.x,wi.y,wi.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)wi.fromBufferAttribute(this,t),wi.applyNormalMatrix(e),this.setXYZ(t,wi.x,wi.y,wi.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)wi.fromBufferAttribute(this,t),wi.transformDirection(e),this.setXYZ(t,wi.x,wi.y,wi.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=Za(t,this.array)),t}setX(e,t){return this.normalized&&(t=Qt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Za(t,this.array)),t}setY(e,t){return this.normalized&&(t=Qt(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=Za(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Qt(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=Za(t,this.array)),t}setW(e,t){return this.normalized&&(t=Qt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Qt(t,this.array),i=Qt(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=Qt(t,this.array),i=Qt(i,this.array),r=Qt
vendor: 3,752 bytes, line 3
3(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=Qt(t,this.array),i=Qt(i,this.array),r=Qt(r,this.array),s=Qt(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==gv&&(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.")}},OM=class extends et{constructor(e,t,i){super(new Uint16Array(e),t,i)}},Zl=class extends et{constructor(e,t,i){super(new Uint32Array(e),t,i)}},De=class extends et{constructor(e,t,i){super(new Float32Array(e),t,i)}},$D=0,$r=new be,Pm=new Ut,dl=new M,Xr=new xi,qh=new xi,Gi=new M,je=class extends ur{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:$D++}),this.uuid=ds(),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(EM(e)?Zl:OM)(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 Mi().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 $r.makeRotationFromQuaternion(e),this.applyMatrix4($r),this}rotateX(e){return $r.makeRotationX(e),this.applyMatrix4($r),this}rotateY(e){return $r.makeRotationY(e),this.applyMatrix4($r),this}rotateZ(e){return $r.makeRotationZ(e),this.applyMatrix4($r),this}translate(e,t,i){return $r.makeTranslation(e,t,i),this.applyMatrix4($r),this}scale(e,t,i){return $r.makeScale(e,t,i),this.applyMatrix4($r),this}lookAt(e){return Pm.lookAt(e),Pm.updateMatrix(),this.applyMatrix4(Pm.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(dl).negate(),this.translate(dl.x,dl.y,dl.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 xi);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
3se".',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];Xr.setFromBufferAttribute(s),this.morphTargetsRelative?(Gi.addVectors(this.boundingBox.min,Xr.min),this.boundingBox.expandByPoint(Gi),Gi.addVectors(this.boundingBox.max,Xr.max),this.boundingBox.expandByPoint(Gi)):(this.boundingBox.expandByPoint(Xr.min),this.boundingBox.expandByPoint(Xr.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 Hr);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
3se".',this),this.boundingSphere.set(new M,1/0);return}if(e){let i=this.boundingSphere.center;if(Xr.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){let n=t[s];qh.setFromBufferAttribute(n),this.morphTargetsRelative?(Gi.addVectors(Xr.min,qh.min),Xr.expandByPoint(Gi),Gi.addVectors(Xr.max,qh.max),Xr.expandByPoint(Gi)):(Xr.expandByPoint(qh.min),Xr.expandByPoint(qh.max))}Xr.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)Gi.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Gi));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++)Gi.fromBufferAttribute(n,l),o&&(dl.fromBufferAttribute(e,l),Gi.add(dl)),r=Math.max(r,i.distanceToSquared(Gi))}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 et(new Float32Array(4*n),4));let o=this.getAttribute("tangent").array,l=[],h=[];for(let E=0;E<n;E++)l[E]=new M,h[E]=new M;let c=new M,d=new M,u=new M,p=new j,f=new j,g=new j,m=new M,v=new M;function y(E,C,T){c.fromArray(r,E*3),d.fromArray(r,C*3),u.fromArray(r,T*3),p.fromArray(a,E*2),f.fromArray(a,C*2),g.fromArray(a,T*2),d.sub(c),u.sub(c),f.sub(p),g.sub(p);let P=1/(f.x*g.y-g.x*f.y);!isFinite(P)||(m.copy(d).multiplyScalar(g.y).addScaledVector(u,-f.y).multiplyScalar(P),v.copy(u).multiplyScalar(f.x).addScaledVector(d,-g.x).multiplyScalar(P),l[E].add(m),l[C].add(m),l[T].add(m),h[E].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 E=0,C=x.length;E<C;++E){let T=x[E],P=T.start,O=T.count;for(let D=P,k=P+O;D<k;D+=3)y(i[D+0],i[D+1],i[D+2])}let w=new M,S=new M,b=new M,A=new M;function _(E){b.fromArray(s,E*3),A.copy(b);let C=l[E];w.copy(C),w.sub(b.multiplyScalar(b.dot(C))).normalize(),S.crossVectors(A,C);let T=S.dot(h[E])<0?-1:1;o[E*4]=w.x,o[E*4+1]=w.y,o[E*4+2]=w.z,o[E*4+3]=T}for(let E=0,C=x.length;E<C;++E){let T=x[E],P=T.start,O=T.count;for(let D=P,k=P+O;D<k;D+=3)_(i[D+0]),_(i[D+1]),_(i[D+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 et(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let d=0,u=i.count;d<u;d++)i.setXYZ(d,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 d=0,u=e.count;d<u;d+=3){let p=e.getX(d+0),f=e.getX(d+1),g=e.getX(d+2);r.fromBufferAttribute(t,p),s.fromBufferAttribute(t,f),a.fromBufferAttribute(t,g),h.subVectors(a,s),c.subVectors(r,s),h.cross(c),n.fromBufferAttribute(i,p),o.fromBufferAttribute(i,f),l.fromBufferAttribute(i,g),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(g,l.x,l.y,l.z)}else for(let d=0,u=t.count;d<u;d+=3)r.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),h.subVectors(a,s),c.subVectors(r,s),h.cross(c),i.setXYZ(d+0,h.x,h.y,h.z),i.setXYZ(d+1,h.x,h.y,h.z),i.setXYZ(d+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++)Gi.fromBufferAttribute(e,t),Gi.normalize(),e.setXYZ(t,Gi.x,Gi.y,Gi.z)}toNonIndexed(){function e(n,o){let l=n.array,h=n.itemSize,c=n.normalized,d=new l.constructor(o.length*h),u=0,p=0;for(let f=0,g=o.length;f<g;f++){n.isInterleavedBufferAttribute?u=o[f]*n.data.stride+n.offset:u=o[f]*h;for(let m=0;m<h;m++)d[p++]=l[u++]}return new et(d,h,c)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new je,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 d=l[h],u=e(d,i);o.push(u)}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,118 bytes, line 3
3if(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,d=l.length;c<d;c++){let u=l[c];h.push(u.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 d=0,u=c.length;d<u;d++)h.push(c[d].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"})}},Ux=new be,ul=new Eh,Dm=new Hr,Xh=new M,Yh=new M,Qh=new M,Im=new M,Hd=new M,Wd=new j,qd=new j,Xd=new j,Om=new M,Yd=new M,Zt=class extends Ut{constructor(e=new je,t=new sn){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&&(Im.fromBufferAttribute(c,e),a?Hd.addScaledVector(Im,h):Hd.addScaledVector(Im.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(),Dm.copy(i.boundingSphere),Dm.applyMatrix4(s),e.ray.intersectsSphere(Dm)===!1)||(Ux.copy(s).invert(),ul.copy(e.ray).applyMatrix4(Ux),i.boundingBox!==null&&ul.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,d=i.drawRange;if(n!==null)if(Array.isArray(r))for(let u=0,p=c.length;u<p;u++){let f=c[u],g=r[f.materialIndex],m=Math.max(f.start,d.start),v=Math.min(n.count,Math.min(f.start+f.count,d.start+d.count));for(let y=m,x=v;y<x;y+=3){let w=n.getX(y),S=n.getX(y+1),b=n.getX(y+2);a=Qd(this,g,e,ul,l,h,w,S,b),a&&(a.faceIndex=Math.floor(y/3),a.face.materialIndex=f.materialIndex,t.push(a))}}else{let u=Math.max(0,d.start),p=Math.min(n.count,d.start+d.count);for(let f=u,g=p;f<g;f+=3){let m=n.getX(f),v=n.getX(f+1),y=n.getX(f+2);a=Qd(this,r,e,ul,l,h,m,v,y),a&&(a.faceIndex=Math.floor(f/3),t.push(a))}}else if(o!==void 0)if(Array.isArray(r))for(let u=0,p=c.length;u<p;u++){let f=c[u],g=r[f.materialIndex],m=Math.max(f.start,d.start),v=Math.min(o.count,Math.min(f.start+f.count,d.start+d.count));for(let y=m,x=v;y<x;y+=3){let w=y,S=y+1,b=y+2;a=Qd(this,g,e,ul,l,h,w,S,b),a&&(a.faceIndex=Math.floor(y/3),a.face.materialIndex=f.materialIndex,t.push(a))}}else{let u=Math.max(0,d.start),p=Math.min(o.count,d.start+d.count);for(let f=u,g=p;f<g;f+=3){let m=f,v=f+1,y=f+2;a=Qd(this,r,e,ul,l,h,m,v,y),a&&(a.faceIndex=Math.floor(f/3),t.push(a))}}}};function e3(e,t,i,r,s,a,n,o){let l;if(t.side===Ki?l=r.intersectTriangle(n,a,s,!0,o):l=r.intersectTriangle(s,a,n,t.side===zs,o),l===null)return null;Yd.copy(o),Yd.applyMatrix4(e.matrixWorld);let h=i.ray.origin.distanceTo(Yd);return h<i.near||h>i.far?null:{distance:h,point:Yd.clone(),object:e}}function Qd(e,t,i,r,s,a,n,o,l){e.getVertexPosition(n,Xh),e.getVertexPosition(o,Yh),e.getVertexPosition(l,Qh);
vendor: 5,563 bytes, lines 3-7
3let h=e3(e,t,i,r,Xh,Yh,Qh,Om);if(h){s&&(Wd.fromBufferAttribute(s,n),qd.fromBufferAttribute(s,o),Xd.fromBufferAttribute(s,l),h.uv=or.getUV(Om,Xh,Yh,Qh,Wd,qd,Xd,new j)),a&&(Wd.fromBufferAttribute(a,n),qd.fromBufferAttribute(a,o),Xd.fromBufferAttribute(a,l),h.uv2=or.getUV(Om,Xh,Yh,Qh,Wd,qd,Xd,new j));let c={a:n,b:o,c:l,normal:new M,materialIndex:0};or.getNormal(Xh,Yh,Qh,c.normal),h.face=c}return h}var ks=class extends je{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=[],d=0,u=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),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,g,m,v,y,x,w,S,b,A,_){let E=x/b,C=w/A,T=x/2,P=w/2,O=S/2,D=b+1,k=A+1,W=0,N=0,F=new M;for(let Z=0;Z<k;Z++){let q=Z*C-P;for(let G=0;G<D;G++){let Q=G*E-T;F[f]=Q*v,F[g]=q*y,F[m]=O,l.push(F.x,F.y,F.z),F[f]=0,F[g]=0,F[m]=S>0?1:-1,h.push(F.x,F.y,F.z),c.push(G/b),c.push(1-Z/A),W+=1}}for(let Z=0;Z<A;Z++)for(let q=0;q<b;q++){let G=d+q+D*Z,Q=d+q+D*(Z+1),ee=d+(q+1)+D*(Z+1),Y=d+(q+1)+D*Z;o.push(G,Q,Y),o.push(Q,ee,Y),N+=6}n.addGroup(u,N,_),u+=N,d+=W}}static fromJSON(e){return new ks(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function dh(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 Mr(e){let t={};for(let i=0;i<e.length;i++){let r=dh(e[i]);for(let s in r)t[s]=r[s]}return t}function t3(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i].clone());return t}function RM(e){return e.getRenderTarget()===null&&e.outputEncoding===mt?ra:Ep}var Ch={clone:dh,merge:Mr},i3=`void main() {
4	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
5}`,r3=`void main() {
6	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
7}`,Pt=class extends md{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=i3,this.fragmentShader=r3,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=dh(e.uniforms),this.uniformsGroups=t3(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}},to=class extends Ut{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new be,this.projectionMatrix=new be,this.projectionMatrixInverse=new be}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)}},mr=class extends to{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=Wc*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Pc*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,947 bytes, lines 7-42
7getEffectiveFOV(){return Wc*2*Math.atan(Math.tan(Pc*.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(Pc*.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}},pl=-90,fl=1,s3=class extends Ut{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i;let r=new mr(pl,fl,e,t);r.layers=this.layers,r.up.set(0,1,0),r.lookAt(1,0,0),this.add(r);let s=new mr(pl,fl,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);let a=new mr(pl,fl,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(0,1,0),this.add(a);let n=new mr(pl,fl,e,t);n.layers=this.layers,n.up.set(0,0,1),n.lookAt(0,-1,0),this.add(n);let o=new mr(pl,fl,e,t);o.layers=this.layers,o.up.set(0,1,0),o.lookAt(0,0,1),this.add(o);let l=new mr(pl,fl,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,d=e.xr.enabled;e.toneMapping=ua,e.xr.enabled=!1;let u=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=u,e.setRenderTarget(i,5),e.render(t,l),e.setRenderTarget(h),e.toneMapping=c,e.xr.enabled=d,i.texture.needsPMREMUpdate=!0}},by=class extends oi{constructor(e,t,i,r,s,a,n,o,l,h){e=e!==void 0?e:[],t=t!==void 0?t:Vo,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}},a3=class extends Tt{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 by(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:yt}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:`
8
9				varying vec3 vWorldDirection;
10
11				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
12
13					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
14
15				}
16
17				void main() {
18
19					vWorldDirection = transformDirection( position, modelMatrix );
20
21					#include <begin_vertex>
22					#include <project_vertex>
23
24				}
25			`,fragmentShader:`
26
27				uniform sampler2D tEquirect;
28
29				varying vec3 vWorldDirection;
30
31				#include <common>
32
33				void main() {
34
35					vec3 direction = normalize( vWorldDirection );
36
37					vec2 sampleUV = equirectUv( direction );
38
39					gl_FragColor = texture2D( tEquirect, sampleUV );
40
41				}
42			`},r=new ks(5,5,5),s=new Pt({name:"CubemapFromEquirect",uniforms:dh(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ki,blending:Ci});s.uniforms.tEquirect.value=t;let a=new Zt(r,s),n=t.minFilter;return t.minFilter===ch&&(t.minFilter=yt),new s3(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)}},Rm=new M,n3=new M,o3=new Mi,Fr=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: 5,768 bytes, lines 42-43
42setFromCoplanarPoints(e,t,i){let r=Rm.subVectors(i,t).cross(n3.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(Rm),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||o3.getNormalMatrix(e),r=this.coplanarPoint(Rm).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)}},ml=new Hr,Zd=new M,wy=class{constructor(e=new Fr,t=new Fr,i=new Fr,r=new Fr,s=new Fr,a=new Fr){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],d=i[8],u=i[9],p=i[10],f=i[11],g=i[12],m=i[13],v=i[14],y=i[15];return t[0].setComponents(n-r,c-o,f-d,y-g).normalize(),t[1].setComponents(n+r,c+o,f+d,y+g).normalize(),t[2].setComponents(n+s,c+l,f+u,y+m).normalize(),t[3].setComponents(n-s,c-l,f-u,y-m).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(),ml.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(ml)}intersectsSprite(e){return ml.center.set(0,0,0),ml.radius=.7071067811865476,ml.applyMatrix4(e.matrixWorld),this.intersectsSphere(ml)}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(Zd.x=r.normal.x>0?e.max.x:e.min.x,Zd.y=r.normal.y>0?e.max.y:e.min.y,Zd.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Zd)<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 LM(){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 l3(e,t){let i=t.isWebGL2,r=new WeakMap;function s(h,c){let d=h.array,u=h.usage,p=e.createBuffer();e.bindBuffer(c,p),e.bufferData(c,d,u),h.onUploadCallback();let f;if(d instanceof Float32Array)f=5126;else if(d 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(d instanceof Int16Array)f=5122;else if(d instanceof Uint32Array)f=5125;else if(d instanceof Int32Array)f=5124;else if(d instanceof Int8Array)f=5120;else if(d instanceof Uint8Array)f=5121;else if(d instanceof Uint8ClampedArray)f=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:p,type:f,bytesPerElement:d.BYTES_PER_ELEMENT,version:h.version}}function a(h,c,d){let u=c.array,p=c.updateRange;e.bindBuffer(d,h),p.count===-1?e.bufferSubData(d,0,u):(i?e.bufferSubData(d,p.offset*u.BYTES_PER_ELEMENT,u,p.offset,p.count):e.bufferSubData(d,p.offset*u.BYTES_PER_ELEMENT,u.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 u=r.get(h);(!u||u.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 d=r.get(h);d===void 0?r.set(h,s(h,c)):d.version<h.version&&(a(d.buffer,h,c),d.version=h.version)}return{get:n,remove:o,update:l}}var ga=class extends je{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,d=t/o,u=[],p=[],f=[],g=[];for(let m=0;m<h;m++){let v=m*d-a;for(let y=0;y<l;y++){let x=y*c-s;p.push(x,-v,0),f.push(0,0,1),g.push(y/n),g.push(1-m/o)}}for(let m=0;m<o;m++)for(let v=0;v<n;v++){let y=v+l*m,x=v+l*(m+1),w=v+1+l*(m+1),S=v+1+l*m;u.push(y,x,S),u.push(x,w,S)}this.setIndex(u),this.setAttribute("position",new De(p,3)),this.setAttribute("normal",new De(f,3)),this.setAttribute("uv",new De(g,2))}static fromJSON(e){return new ga(e.width,e.height,e.widthSegments,e.heightSegments)}},h3=`#ifdef USE_ALPHAMAP
43	diffuseColor.a *= texture2D( alphaMap, vUv ).g;
44#endif`,c3=`#ifdef USE_ALPHAMAP
45	uniform sampler2D alphaMap;
46#endif`,d3=`#ifdef USE_ALPHATEST
47	if ( diffuseColor.a < alphaTest ) discard;
48#endif`,u3=`#ifdef USE_ALPHATEST
49	uniform float alphaTest;
50#endif`,p3=`#ifdef USE_AOMAP
51	float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
52	reflectedLight.indirectDiffuse *= ambientOcclusion;
53	#if defined( USE_ENVMAP ) && defined( STANDARD )
54		float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
55		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
56	#endif
57#endif`,f3=`#ifdef USE_AOMAP
58	uniform sampler2D aoMap;
59	uniform float aoMapIntensity;
60#endif`,m3="vec3 transformed = vec3( position );",g3=`vec3 objectNormal = vec3( normal );
61#ifdef USE_TANGENT
62	vec3 objectTangent = vec3( tangent.xyz );
63#endif`,v3=`vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
64	return RECIPROCAL_PI * diffuseColor;
65}
66vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
67	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
68	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
69}
70float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
71	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
72	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
73}
74vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
75    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
76    float x2 = x * x;
77    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
78    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
79}
80float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
81	float a2 = pow2( alpha );
82	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
83	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
84	return 0.5 / max( gv + gl, EPSILON );
85}
86float D_GGX( const in float alpha, const in float dotNH ) {
87	float a2 = pow2( alpha );
88	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
89	return RECIPROCAL_PI * a2 / pow2( denom );
90}
91vec3 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 ) {
92	float alpha = pow2( roughness );
93	vec3 halfDir = normalize( lightDir + viewDir );
94	float dotNL = saturate( dot( normal, lightDir ) );
95	float dotNV = saturate( dot( normal, viewDir ) );
96	float dotNH = saturate( dot( normal, halfDir ) );
97	float dotVH = saturate( dot( viewDir, halfDir ) );
98	vec3 F = F_Schlick( f0, f90, dotVH );
99	float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
100	float D = D_GGX( alpha, dotNH );
101	return F * ( V * D );
102}
103#ifdef USE_IRIDESCENCE
104	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 ) {
105		float alpha = pow2( roughness );
106		vec3 halfDir = normalize( lightDir + viewDir );
107		float dotNL = saturate( dot( normal, lightDir ) );
108		float dotNV = saturate( dot( normal, viewDir ) );
109		float dotNH = saturate( dot( normal, halfDir ) );
110		float dotVH = saturate( dot( viewDir, halfDir ) );
111		vec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );
112		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
113		float D = D_GGX( alpha, dotNH );
114		return F * ( V * D );
115	}
116#endif
117vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
118	const float LUT_SIZE = 64.0;
119	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
120	const float LUT_BIAS = 0.5 / LUT_SIZE;
121	float dotNV = saturate( dot( N, V ) );
122	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
123	uv = uv * LUT_SCALE + LUT_BIAS;
124	return uv;
125}
126float LTC_ClippedSphereFormFactor( const in vec3 f ) {
127	float l = length( f );
128	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
129}
130vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
131	float x = dot( v1, v2 );
132	float y = abs( x );
133	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
134	float b = 3.4175940 + ( 4.1616724 + y ) * y;
135	float v = a / b;
136	float theta_sintheta = ( x >
136 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
137	return cross( v1, v2 ) * theta_sintheta;
138}
139vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
140	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
141	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
142	vec3 lightNormal = cross( v1, v2 );
143	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
144	vec3 T1, T2;
145	T1 = normalize( V - N * dot( V, N ) );
146	T2 = - cross( N, T1 );
147	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
148	vec3 coords[ 4 ];
149	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
150	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
151	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
152	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
153	coords[ 0 ] = normalize( coords[ 0 ] );
154	coords[ 1 ] = normalize( coords[ 1 ] );
155	coords[ 2 ] = normalize( coords[ 2 ] );
156	coords[ 3 ] = normalize( coords[ 3 ] );
157	vec3 vectorFormFactor = vec3( 0.0 );
158	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
159	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
160	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
161	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
162	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
163	return vec3( result );
164}
165float G_BlinnPhong_Implicit( ) {
166	return 0.25;
167}
168float D_BlinnPhong( const in float shininess, const in float dotNH ) {
169	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
170}
171vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
172	vec3 halfDir = normalize( lightDir + viewDir );
173	float dotNH = saturate( dot( normal, halfDir ) );
174	float dotVH = saturate( dot( viewDir, halfDir ) );
175	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
176	float G = G_BlinnPhong_Implicit( );
177	float D = D_BlinnPhong( shininess, dotNH );
178	return F * ( G * D );
179}
180#if defined( USE_SHEEN )
181float D_Charlie( float roughness, float dotNH ) {
182	float alpha = pow2( roughness );
183	float invAlpha = 1.0 / alpha;
184	float cos2h = dotNH * dotNH;
185	float sin2h = max( 1.0 - cos2h, 0.0078125 );
186	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
187}
188float V_Neubelt( float dotNV, float dotNL ) {
189	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
190}
191vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
192	vec3 halfDir = normalize( lightDir + viewDir );
193	float dotNL = saturate( dot( normal, lightDir ) );
194	float dotNV = saturate( dot( normal, viewDir ) );
195	float dotNH = saturate( dot( normal, halfDir ) );
196	float D = D_Charlie( sheenRoughness, dotNH );
197	float V = V_Neubelt( dotNV, dotNL );
198	return sheenColor * ( D * V );
199}
200#endif`,y3=`#ifdef USE_IRIDESCENCE
201	const mat3 XYZ_TO_REC709 = mat3(
202		 3.2404542, -0.9692660,  0.0556434,
203		-1.5371385,  1.8760108, -0.2040259,
204		-0.4985314,  0.0415560,  1.0572252
205	);
206	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
207		vec3 sqrtF0 = sqrt( fresnel0 );
208		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
209	}
210	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
211		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
212	}
213	float IorToFresnel0( float transmittedIor, float incidentIor ) {
214		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
215	}
216	vec3 evalSensitivity( float OPD, vec3 shift ) {
217		float phase = 2.0 * PI * OPD * 1.0e-9;
218		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
219		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
220		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
221		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
222		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 ) );
223		xyz /= 1.0685e-7;
224		vec3 rgb = XYZ_TO_REC709 * xyz;
225		return rgb;
226	}
227	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
228		vec3 I;
229		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
230		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
231		float cosTheta2Sq = 1.0 - sinTheta2Sq;
232		if ( cosTheta2Sq < 0.0 ) {
233			 return vec3( 1.0 );
234		}
235		float cosTheta2 = sqrt( cosTheta2Sq );
236		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
237		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
238		float R21 = R12;
239		float T121 = 1.0 - R12;
240		float phi12 = 0.0;
241		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
242		float phi21 = PI - phi12;
243		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
244		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
245		vec3 phi23 = vec3( 0.0 );
246		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
247		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
248		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
249		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
250		vec3 phi = vec3( phi21 ) + phi23;
251		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
252		vec3 r123 = sqrt( R123 );
253		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
254		vec3 C0 = R12 + Rs;
255		I = C0;
256		vec3 Cm = Rs - T121;
257		for ( int m = 1; m <= 2; ++ m ) {
258			Cm *= r123;
259			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
260			I += Cm * Sm;
261		}
262		return max( I, vec3( 0.0 ) );
263	}
264#endif`,x3=`#ifdef USE_BUMPMAP
265	uniform sampler2D bumpMap;
266	uniform float bumpScale;
267	vec2 dHdxy_fwd() {
268		vec2 dSTdx = dFdx( vUv );
269		vec2 dSTdy = dFdy( vUv );
270		float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
271		float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
272		float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
273		return vec2( dBx, dBy );
274	}
275	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
276		vec3 vSigmaX = dFdx( surf_pos.xyz );
277		vec3 vSigmaY = dFdy( surf_pos.xyz );
278		vec3 vN = surf_norm;
279		vec3 R1 = cross( vSigmaY, vN );
280		vec3 R2 = cross( vN, vSigmaX );
281		float fDet = dot( vSigmaX, R1 ) * faceDirection;
282		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
283		return normalize( abs( fDet ) * surf_norm - vGrad );
284	}
285#endif`,b3=`#if NUM_CLIPPING_PLANES > 0
286	vec4 plane;
287	#pragma unroll_loop_start
288	for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
289		plane = clippingPlanes[ i ];
290		if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
291	}
292	#pragma unroll_loop_end
293	#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
294		bool clipped = true;
295		#pragma unroll_loop_start
296		for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
297			plane = clippingPlanes[ i ];
298			clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
299		}
300		#pragma unroll_loop_end
301		if ( clipped ) discard;
302	#endif
303#endif`,w3=`#if NUM_CLIPPING_PLANES > 0
304	varying vec3 vClipPosition;
305	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
306#endif`,S3=`#if NUM_CLIPPING_PLANES > 0
307	varying vec3 vClipPosition;
308#endif`,_3=`#if NUM_CLIPPING_PLANES > 0
309	vClipPosition = - mvPosition.xyz;
310#endif`,A3=`#if defined( USE_COLOR_ALPHA )
311	diffuseColor *= vColor;
312#elif defined( USE_COLOR )
313	diffuseColor.rgb *= vColor;
314#endif`,M3=`#if defined( USE_COLOR_ALPHA )
315	varying vec4 vColor;
316#elif defined( USE_COLOR )
317	varying vec3 vColor;
318#endif`,E3=`#if defined( USE_COLOR_ALPHA )
319	varying vec4 vColor;
320#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
321	varying vec3 vColor;
322#endif`,C3=`#if defined( USE_COLOR_ALPHA )
323	vColor = vec4( 1.0 );
324#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
325	vColor = vec3( 1.0 );
326#endif
327#ifdef USE_COLOR
328	vColor *= color;
329#endif
330#ifdef USE_INSTANCING_COLOR
331	vColor.xyz *= instanceColor.xyz;
332#endif`,T3=`#define PI 3.141592653589793
333#define PI2 6.283185307179586
334#define PI_HALF 1.5707963267948966
335#define RECIPROCAL_PI 0.3183098861837907
336#define RECIPROCAL_PI2 0.15915494309189535
337#define EPSILON 1e-6
338#ifndef saturate
339#define saturate( a ) clamp( a, 0.0, 1.0 )
340#endif
341#define whiteComplement( a ) ( 1.0 - saturate( a ) )
342float pow2( const in float x ) { return x*x; }
343vec3 pow2( const in vec3 x ) { return x*x; }
344float pow3( const in float x ) { return x*x*x; }
345float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
346float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
347float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
348highp float rand( const in vec2 uv ) {
349	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
350	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
351	return fract( sin( sn ) * c );
352}
353#ifdef HIGH_PRECISION
354	float precisionSafeLength( vec3 v ) { return length( v ); }
355#else
356	float precisionSafeLength( vec3 v ) {
357		float maxComponent = max3( abs( v ) );
358		return length( v / maxComponent ) * maxComponent;
359	}
360#endif
361struct IncidentLight {
362	vec3 color;
363	vec3 direction;
364	bool visible;
365};
366struct ReflectedLight {
367	vec3 directDiffuse;
368	vec3 directSpecular;
369	vec3 indirectDiffuse;
370	vec3 indirectSpecular;
371};
372struct GeometricContext {
373	vec3 position;
374	vec3 normal;
375	vec3 viewDir;
376#ifdef USE_CLEARCOAT
377	vec3 clearcoatNormal;
378#endif
379};
380vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
381	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
382}
383vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
384	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
385}
386mat3 transposeMat3( const in mat3 m ) {
387	mat3 tmp;
388	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
389	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
390	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
391	return tmp;
392}
393float luminance( const in vec3 rgb ) {
394	const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
395	return dot( weights, rgb );
396}
397bool isPerspectiveMatrix( mat4 m ) {
398	return m[ 2 ][ 3 ] == - 1.0;
399}
400vec2 equirectUv( in vec3 dir ) {
401	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
402	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
403	return vec2( u, v );
404}`,P3=`#ifdef ENVMAP_TYPE_CUBE_UV
405	#define cubeUV_minMipLevel 4.0
406	#define cubeUV_minTileSize 16.0
407	float getFace( vec3 direction ) {
408		vec3 absDirection = abs( direction );
409		float face = - 1.0;
410		if ( absDirection.x > absDirection.z ) {
411			if ( absDirection.x > absDirection.y )
412				face = direction.x > 0.0 ? 0.0 : 3.0;
413			else
414				face = direction.y > 0.0 ? 1.0 : 4.0;
415		} else {
416			if ( absDirection.z > absDirection.y )
417				face = direction.z > 0.0 ? 2.0 : 5.0;
418			else
419				face = direction.y > 0.0 ? 1.0 : 4.0;
420		}
421		return face;
422	}
423	vec2 getUV( vec3 direction, float face ) {
424		vec2 uv;
425		if ( face == 0.0 ) {
426			uv = vec2( direction.z, direction.y ) / abs( direction.x );
427		} else if ( face == 1.0 ) {
428			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
429		} else if ( face == 2.0 ) {
430			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
431		} else if ( face == 3.0 ) {
432			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
433		} else if ( face == 4.0 ) {
434			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
435		} else {
436			uv = vec2( direction.x, direction.y ) / abs( direction.z );
437		}
438		return 0.5 * ( uv + 1.0 );
439	}
440	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
441		float face = getFace( direction );
442		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
443		mipInt = max( mipInt, cubeUV_minMipLevel );
444		float faceSize = exp2( mipInt );
445		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
446		if ( face > 2.0 ) {
447			uv.y += faceSize;
448			face -= 3.0;
449		}
450		uv.x += face * faceSize;
451		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
452		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
453		uv.x *= CUBEUV_TEXEL_WIDTH;
454		uv.y *= CUBEUV_TEXEL_HEIGHT;
455		#ifdef texture2DGradEXT
456			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
457		#else
458			return texture2D( envMap, uv ).rgb;
459		#endif
460	}
461	#define cubeUV_r0 1.0
462	#define cubeUV_v0 0.339
463	#define cubeUV_m0 - 2.0
464	#define cubeUV_r1 0.8
465	#define cubeUV_v1 0.276
466	#define cubeUV_m1 - 1.0
467	#define cubeUV_r4 0.4
468	#define cubeUV_v4 0.046
469	#define cubeUV_m4 2.0
470	#define cubeUV_r5 0.305
471	#define cubeUV_v5 0.016
472	#define cubeUV_m5 3.0
473	#define cubeUV_r6 0.21
474	#define cubeUV_v6 0.0038
475	#define cubeUV_m6 4.0
476	float roughnessToMip( float roughness ) {
477		float mip = 0.0;
478		if ( roughness >= cubeUV_r1 ) {
479			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
480		} else if ( roughness >= cubeUV_r4 ) {
481			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
482		} else if ( roughness >= cubeUV_r5 ) {
483			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
484		} else if ( roughness >= cubeUV_r6 ) {
485			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
486		} else {
487			mip = - 2.0 * log2( 1.16 * roughness );		}
488		return mip;
489	}
490	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
491		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
492		float mipF = fract( mip );
493		float mipInt = floor( mip );
494		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
495		if ( mipF == 0.0 ) {
496			return vec4( color0, 1.0 );
497		} else {
498			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
499			return vec4( mix( color0, color1, mipF ), 1.0 );
500		}
501	}
502#endif`,D3=`vec3 transformedNormal = objectNormal;
503#ifdef USE_INSTANCING
504	mat3 m = mat3( instanceMatrix );
505	transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
506	transformedNormal = m * transformedNormal;
507#endif
508transformedNormal = normalMatrix * transformedNormal;
509#ifdef FLIP_SIDED
510	transformedNormal = - transformedNormal;
511#endif
512#ifdef USE_TANGENT
513	vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
514	#ifdef FLIP_SIDED
515		transformedTangent = - transformedTangent;
516	#endif
517#endif`,I3=`#ifdef USE_DISPLACEMENTMAP
518	uniform sampler2D displacementMap;
519	uniform float displacementScale;
520	uniform float displacementBias;
521#endif`,O3=`#ifdef USE_DISPLACEMENTMAP
522	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
523#endif`,R3=`#ifdef USE_EMISSIVEMAP
524	vec4 emissiveColor = texture2D( emissiveMap, vUv );
525	totalEmissiveRadiance *= emissiveColor.rgb;
526#endif`,L3=`#ifdef USE_EMISSIVEMAP
527	uniform sampler2D emissiveMap;
528#endif`,B3="gl_FragColor = linearToOutputTexel( gl_FragColor );",z3=`vec4 LinearToLinear( in vec4 value ) {
529	return value;
530}
531vec4 LinearTosRGB( in vec4 value ) {
532	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 );
533}`,F3=`#ifdef USE_ENVMAP
534	#ifdef ENV_WORLDPOS
535		vec3 cameraToFrag;
536		if ( isOrthographic ) {
537			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
538		} else {
539			cameraToFrag = normalize( vWorldPosition - cameraPosition );
540		}
541		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
542		#ifdef ENVMAP_MODE_REFLECTION
543			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
544		#else
545			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
546		#endif
547	#else
548		vec3 reflectVec = vReflect;
549	#endif
550	#ifdef ENVMAP_TYPE_CUBE
551		vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
552	#else
553		vec4 envColor = vec4( 0.0 );
554	#endif
555	#ifdef ENVMAP_BLENDING_MULTIPLY
556		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
557	#elif defined( ENVMAP_BLENDING_MIX )
558		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
559	#elif defined( ENVMAP_BLENDING_ADD )
560		outgoingLight += envColor.xyz * specularStrength * reflectivity;
561	#endif
562#endif`,k3=`#ifdef USE_ENVMAP
563	uniform float envMapIntensity;
564	uniform float flipEnvMap;
565	#ifdef ENVMAP_TYPE_CUBE
566		uniform samplerCube envMap;
567	#else
568		uniform sampler2D envMap;
569	#endif
570	
571#endif`,U3=`#ifdef USE_ENVMAP
572	uniform float reflectivity;
573	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
574		#define ENV_WORLDPOS
575	#endif
576	#ifdef ENV_WORLDPOS
577		varying vec3 vWorldPosition;
578		uniform float refractionRatio;
579	#else
580		varying vec3 vReflect;
581	#endif
582#endif`,N3=`#ifdef USE_ENVMAP
583	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
584		#define ENV_WORLDPOS
585	#endif
586	#ifdef ENV_WORLDPOS
587		
588		varying vec3 vWorldPosition;
589	#else
590		varying vec3 vReflect;
591		uniform float refractionRatio;
592	#endif
593#endif`,V3=`#ifdef USE_ENVMAP
594	#ifdef ENV_WORLDPOS
595		vWorldPosition = worldPosition.xyz;
596	#else
597		vec3 cameraToVertex;
598		if ( isOrthographic ) {
599			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
600		} else {
601			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
602		}
603		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
604		#ifdef ENVMAP_MODE_REFLECTION
605			vReflect = reflect( cameraToVertex, worldNormal );
606		#else
607			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
608		#endif
609	#endif
610#endif`,j3=`#ifdef USE_FOG
611	vFogDepth = - mvPosition.z;
612#endif`,G3=`#ifdef USE_FOG
613	varying float vFogDepth;
614#endif`,H3=`#ifdef USE_FOG
615	#ifdef FOG_EXP2
616		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
617	#else
618		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
619	#endif
620	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
621#endif`,W3=`#ifdef USE_FOG
622	uniform vec3 fogColor;
623	varying float vFogDepth;
624	#ifdef FOG_EXP2
625		uniform float fogDensity;
626	#else
627		uniform float fogNear;
628		uniform float fogFar;
629	#endif
630#endif`,q3=`#ifdef USE_GRADIENTMAP
631	uniform sampler2D gradientMap;
632#endif
633vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
634	float dotNL = dot( normal, lightDirection );
635	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
636	#ifdef USE_GRADIENTMAP
637		return vec3( texture2D( gradientMap, coord ).r );
638	#else
639		vec2 fw = fwidth( coord ) * 0.5;
640		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
641	#endif
642}`,X3=`#ifdef USE_LIGHTMAP
643	vec4 lightMapTexel = texture2D( lightMap, vUv2 );
644	vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
645	reflectedLight.indirectDiffuse += lightMapIrradiance;
646#endif`,Y3=`#ifdef USE_LIGHTMAP
647	uniform sampler2D lightMap;
648	uniform float lightMapIntensity;
649#endif`,Q3=`LambertMaterial material;
650material.diffuseColor = diffuseColor.rgb;
651material.specularStrength = specularStrength;`,Z3=`varying vec3 vViewPosition;
652struct LambertMaterial {
653	vec3 diffuseColor;
654	float specularStrength;
655};
656void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
657	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
658	vec3 irradiance = dotNL * directLight.color;
659	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
660}
661void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
662	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
663}
664#define RE_Direct				RE_Direct_Lambert
665#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,K3=`uniform bool receiveShadow;
666uniform vec3 ambientLightColor;
667uniform vec3 lightProbe[ 9 ];
668vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
669	float x = normal.x, y = normal.y, z = normal.z;
670	vec3 result = shCoefficients[ 0 ] * 0.886227;
671	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
672	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
673	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
674	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
675	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
676	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
677	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
678	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
679	return result;
680}
681vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
682	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
683	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
684	return irradiance;
685}
686vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
687	vec3 irradiance = ambientLightColor;
688	return irradiance;
689}
690float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
691	#if defined ( PHYSICALLY_CORRECT_LIGHTS )
692		float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
693		if ( cutoffDistance > 0.0 ) {
694			distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
695		}
696		return distanceFalloff;
697	#else
698		if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
699			return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
700		}
701		return 1.0;
702	#endif
703}
704float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
705	return smoothstep( coneCosine, penumbraCosine, angleCosine );
706}
707#if NUM_DIR_LIGHTS > 0
708	struct DirectionalLight {
709		vec3 direction;
710		vec3 color;
711	};
712	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
713	void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {
714		light.color = directionalLight.color;
715		light.direction = directionalLight.direction;
716		light.visible = true;
717	}
718#endif
719#if NUM_POINT_LIGHTS > 0
720	struct PointLight {
721		vec3 position;
722		vec3 color;
723		float distance;
724		float decay;
725	};
726	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
727	void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {
728		vec3 lVector = pointLight.position - geometry.position;
729		light.direction = normalize( lVector );
730		float lightDistance = length( lVector );
731		light.color = pointLight.color;
732		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
733		light.visible = ( light.color != vec3( 0.0 ) );
734	}
735#endif
736#if NUM_SPOT_LIGHTS > 0
737	struct SpotLight {
738		vec3 position;
739		vec3 direction;
740		vec3 color;
741		float distance;
742		float decay;
743		float coneCos;
744		float penumbraCos;
745	};
746	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
747	void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {
748		vec3 lVector = spotLight.position - geometry.position;
749		light.direction = normalize( lVector );
750		float angleCos = dot( light.direction, spotLight.direction );
751		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
752		if ( spotAttenuation > 0.0 ) {
753			float lightDistance = length( lVector );
754			light.color = spotLight.color * spotAttenuation;
755			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
756			light.visible = ( light.color != vec3( 0.0 ) );
757		} else {
758			light.color = vec3( 0.0 );
759			light.visible = false;
760		}
761	}
762#endif
763#if NUM_RECT_AREA_LIGHTS > 0
764	struct RectAreaLight {
765		vec3 color;
766		vec3 position;
767		vec3 halfWidth;
768		vec3 halfHeight;
769	};
770	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
771	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
772#endif
773#if NUM_HEMI_LIGHTS > 0
774	struct HemisphereLight {
775		vec3 direction;
776		vec3 skyColor;
777		vec3 groundColor;
778	};
779	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
780	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
781		float dotNL = dot( normal, hemiLight.direction );
782		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
783		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
784		return irradiance;
785	}
786#endif`,J3=`#if defined( USE_ENVMAP )
787	vec3 getIBLIrradiance( const in vec3 normal ) {
788		#if defined( ENVMAP_TYPE_CUBE_UV )
789			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
790			vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
791			return PI * envMapColor.rgb * envMapIntensity;
792		#else
793			return vec3( 0.0 );
794		#endif
795	}
796	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
797		#if defined( ENVMAP_TYPE_CUBE_UV )
798			vec3 reflectVec = reflect( - viewDir, normal );
799			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
800			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
801			vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
802			return envMapColor.rgb * envMapIntensity;
803		#else
804			return vec3( 0.0 );
805		#endif
806	}
807#endif`,$3=`ToonMaterial material;
808material.diffuseColor = diffuseColor.rgb;`,eI=`varying vec3 vViewPosition;
809struct ToonMaterial {
810	vec3 diffuseColor;
811};
812void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
813	vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
814	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
815}
816void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
817	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
818}
819#define RE_Direct				RE_Direct_Toon
820#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,tI=`BlinnPhongMaterial material;
821material.diffuseColor = diffuseColor.rgb;
822material.specularColor = specular;
823material.specularShininess = shininess;
824material.specularStrength = specularStrength;`,iI=`varying vec3 vViewPosition;
825struct BlinnPhongMaterial {
826	vec3 diffuseColor;
827	vec3 specularColor;
828	float specularShininess;
829	float specularStrength;
830};
831void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
832	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
833	vec3 irradiance = dotNL * directLight.color;
834	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
835	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
836}
837void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
838	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
839}
840#define RE_Direct				RE_Direct_BlinnPhong
841#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,rI=`PhysicalMaterial material;
842material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
843vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
844float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
845material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
846material.roughness = min( material.roughness, 1.0 );
847#ifdef IOR
848	material.ior = ior;
849	#ifdef SPECULAR
850		float specularIntensityFactor = specularIntensity;
851		vec3 specularColorFactor = specularColor;
852		#ifdef USE_SPECULARINTENSITYMAP
853			specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;
854		#endif
855		#ifdef USE_SPECULARCOLORMAP
856			specularColorFactor *= texture2D( specularColorMap, vUv ).rgb;
857		#endif
858		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
859	#else
860		float specularIntensityFactor = 1.0;
861		vec3 specularColorFactor = vec3( 1.0 );
862		material.specularF90 = 1.0;
863	#endif
864	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
865#else
866	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
867	material.specularF90 = 1.0;
868#endif
869#ifdef USE_CLEARCOAT
870	material.clearcoat = clearcoat;
871	material.clearcoatRoughness = clearcoatRoughness;
872	material.clearcoatF0 = vec3( 0.04 );
873	material.clearcoatF90 = 1.0;
874	#ifdef USE_CLEARCOATMAP
875		material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
876	#endif
877	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
878		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
879	#endif
880	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
881	material.clearcoatRoughness += geometryRoughness;
882	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
883#endif
884#ifdef USE_IRIDESCENCE
885	material.iridescence = iridescence;
886	material.iridescenceIOR = iridescenceIOR;
887	#ifdef USE_IRIDESCENCEMAP
888		material.iridescence *= texture2D( iridescenceMap, vUv ).r;
889	#endif
890	#ifdef USE_IRIDESCENCE_THICKNESSMAP
891		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;
892	#else
893		material.iridescenceThickness = iridescenceThicknessMaximum;
894	#endif
895#endif
896#ifdef USE_SHEEN
897	material.sheenColor = sheenColor;
898	#ifdef USE_SHEENCOLORMAP
899		material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;
900	#endif
901	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
902	#ifdef USE_SHEENROUGHNESSMAP
903		material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;
904	#endif
905#endif`,sI=`struct PhysicalMaterial {
906	vec3 diffuseColor;
907	float roughness;
908	vec3 specularColor;
909	float specularF90;
910	#ifdef USE_CLEARCOAT
911		float clearcoat;
912		float clearcoatRoughness;
913		vec3 clearcoatF0;
914		float clearcoatF90;
915	#endif
916	#ifdef USE_IRIDESCENCE
917		float iridescence;
918		float iridescenceIOR;
919		float iridescenceThickness;
920		vec3 iridescenceFresnel;
921		vec3 iridescenceF0;
922	#endif
923	#ifdef USE_SHEEN
924		vec3 sheenColor;
925		float sheenRoughness;
926	#endif
927	#ifdef IOR
928		float ior;
929	#endif
930	#ifdef USE_TRANSMISSION
931		float transmission;
932		float transmissionAlpha;
933		float thickness;
934		float attenuationDistance;
935		vec3 attenuationColor;
936	#endif
937};
938vec3 clearcoatSpecular = vec3( 0.0 );
939vec3 sheenSpecular = vec3( 0.0 );
940float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
941	float dotNV = saturate( dot( normal, viewDir ) );
942	float r2 = roughness * roughness;
943	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
944	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
945	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
946	return saturate( DG * RECIPROCAL_PI );
947}
948vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
949	float dotNV = saturate( dot( normal, viewDir ) );
950	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
951	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
952	vec4 r = roughness * c0 + c1;
953	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
954	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
955	return fab;
956}
957vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
958	vec2 fab = DFGApprox( normal, viewDir, roughness );
959	return specularColor * fab.x + specularF90 * fab.y;
960}
961#ifdef USE_IRIDESCENCE
962void 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 ) {
963#else
964void 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 ) {
965#endif
966	vec2 fab = DFGApprox( normal, viewDir, roughness );
967	#ifdef USE_IRIDESCENCE
968		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
969	#else
970		vec3 Fr = specularColor;
971	#endif
972	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
973	float Ess = fab.x + fab.y;
974	float Ems = 1.0 - Ess;
975	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
976	singleScatter += FssEss;
977	multiScatter += Fms * Ems;
978}
979#if NUM_RECT_AREA_LIGHTS > 0
980	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
981		vec3 normal = geometry.normal;
982		vec3 viewDir = geometry.viewDir;
983		vec3 position = geometry.position;
984		vec3 lightPos = rectAreaLight.position;
985		vec3 halfWidth = rectAreaLight.halfWidth;
986		vec3 halfHeight = rectAreaLight.halfHeight;
987		vec3 lightColor = rectAreaLight.color;
988		float roughness = material.roughness;
989		vec3 rectCoords[ 4 ];
990		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
991		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
992		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
993		vec2 uv = LTC_Uv( normal, viewDir, roughness );
994		vec4 t1 = texture2D( ltc_1, uv );
995		vec4 t2 = texture2D( ltc_2, uv );
996		mat3 mInv = mat3(
997			vec3( t1.x, 0, t1.y ),
998			vec3(    0, 1,    0 ),
999			vec3( t1.z, 0, t1.w )
1000		);
1001		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1002		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1003		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1004	}
1005#endif
1006void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1007	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
1008	vec3 irradiance = dotNL * directLight.color;
1009	#ifdef USE_CLEARCOAT
1010		float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
1011		vec3 ccIrradiance = dotNLcc * directLight.color;
1012		clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1013	#endif
1014	#ifdef USE_SHEEN
1015		sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
1016	#endif
1017	#ifdef USE_IRIDESCENCE
1018		reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );
1019	#else
1020		reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );
1021	#endif
1022	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1023}
1024void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1025	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1026}
1027void 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) {
1028	#ifdef USE_CLEARCOAT
1029		clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1030	#endif
1031	#ifdef USE_SHEEN
1032		sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
1033	#endif
1034	vec3 singleScattering = vec3( 0.0 );
1035	vec3 multiScattering = vec3( 0.0 );
1036	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1037	#ifdef USE_IRIDESCENCE
1038		computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
1039	#else
1040		computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
1041	#endif
1042	vec3 totalScattering = singleScattering + multiScattering;
1043	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
1044	reflectedLight.indirectSpecular += radiance * singleScattering;
1045	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1046	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1047}
1048#define RE_Direct				RE_Direct_Physical
1049#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1050#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1051#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1052float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1053	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1054}`,aI=`
1055GeometricContext geometry;
1056geometry.position = - vViewPosition;
1057geometry.normal = normal;
1058geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1059#ifdef USE_CLEARCOAT
1060	geometry.clearcoatNormal = clearcoatNormal;
1061#endif
1062#ifdef USE_IRIDESCENCE
1063	float dotNVi = saturate( dot( normal, geometry.viewDir ) );
1064	if ( material.iridescenceThickness == 0.0 ) {
1065		material.iridescence = 0.0;
1066	} else {
1067		material.iridescence = saturate( material.iridescence );
1068	}
1069	if ( material.iridescence > 0.0 ) {
1070		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1071		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1072	}
1073#endif
1074IncidentLight directLight;
1075#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1076	PointLight pointLight;
1077	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1078	PointLightShadow pointLightShadow;
1079	#endif
1080	#pragma unroll_loop_start
1081	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1082		pointLight = pointLights[ i ];
1083		getPointLightInfo( pointLight, geometry, directLight );
1084		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1085		pointLightShadow = pointLightShadows[ i ];
1086		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1087		#endif
1088		RE_Direct( directLight, geometry, material, reflectedLight );
1089	}
1090	#pragma unroll_loop_end
1091#endif
1092#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1093	SpotLight spotLight;
1094	vec4 spotColor;
1095	vec3 spotLightCoord;
1096	bool inSpotLightMap;
1097	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1098	SpotLightShadow spotLightShadow;
1099	#endif
1100	#pragma unroll_loop_start
1101	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1102		spotLight = spotLights[ i ];
1103		getSpotLightInfo( spotLight, geometry, directLight );
1104		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1105		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1106		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1107		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1108		#else
1109		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1110		#endif
1111		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1112			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1113			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1114			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1115			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1116		#endif
1117		#undef SPOT_LIGHT_MAP_INDEX
1118		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1119		spotLightShadow = spotLightShadows[ i ];
1120		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1121		#endif
1122		RE_Direct( directLight, geometry, material, reflectedLight );
1123	}
1124	#pragma unroll_loop_end
1125#endif
1126#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1127	DirectionalLight directionalLight;
1128	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1129	DirectionalLightShadow directionalLightShadow;
1130	#endif
1131	#pragma unroll_loop_start
1132	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1133		directionalLight = directionalLights[ i ];
1134		getDirectionalLightInfo( directionalLight, geometry, directLight );
1135		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1136		directionalLightShadow = directionalLightShadows[ i ];
1137		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1138		#endif
1139		RE_Direct( directLight, geometry, material, reflectedLight );
1140	}
1141	#pragma unroll_loop_end
1142#endif
1143#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1144	RectAreaLight rectAreaLight;
1145	#pragma unroll_loop_start
1146	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1147		rectAreaLight = rectAreaLights[ i ];
1148		RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
1149	}
1150	#pragma unroll_loop_end
1151#endif
1152#if defined( RE_IndirectDiffuse )
1153	vec3 iblIrradiance = vec3( 0.0 );
1154	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1155	irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
1156	#if ( NUM_HEMI_LIGHTS > 0 )
1157		#pragma unroll_loop_start
1158		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1159			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
1160		}
1161		#pragma unroll_loop_end
1162	#endif
1163#endif
1164#if defined( RE_IndirectSpecular )
1165	vec3 radiance = vec3( 0.0 );
1166	vec3 clearcoatRadiance = vec3( 0.0 );
1167#endif`,nI=`#if defined( RE_IndirectDiffuse )
1168	#ifdef USE_LIGHTMAP
1169		vec4 lightMapTexel = texture2D( lightMap, vUv2 );
1170		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1171		irradiance += lightMapIrradiance;
1172	#endif
1173	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1174		iblIrradiance += getIBLIrradiance( geometry.normal );
1175	#endif
1176#endif
1177#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1178	radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
1179	#ifdef USE_CLEARCOAT
1180		clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
1181	#endif
1182#endif`,oI=`#if defined( RE_IndirectDiffuse )
1183	RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
1184#endif
1185#if defined( RE_IndirectSpecular )
1186	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
1187#endif`,lI=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1188	gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1189#endif`,hI=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1190	uniform float logDepthBufFC;
1191	varying float vFragDepth;
1192	varying float vIsPerspective;
1193#endif`,cI=`#ifdef USE_LOGDEPTHBUF
1194	#ifdef USE_LOGDEPTHBUF_EXT
1195		varying float vFragDepth;
1196		varying float vIsPerspective;
1197	#else
1198		uniform float logDepthBufFC;
1199	#endif
1200#endif`,dI=`#ifdef USE_LOGDEPTHBUF
1201	#ifdef USE_LOGDEPTHBUF_EXT
1202		vFragDepth = 1.0 + gl_Position.w;
1203		vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1204	#else
1205		if ( isPerspectiveMatrix( projectionMatrix ) ) {
1206			gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
1207			gl_Position.z *= gl_Position.w;
1208		}
1209	#endif
1210#endif`,uI=`#ifdef USE_MAP
1211	vec4 sampledDiffuseColor = texture2D( map, vUv );
1212	#ifdef DECODE_VIDEO_TEXTURE
1213		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 );
1214	#endif
1215	diffuseColor *= sampledDiffuseColor;
1216#endif`,pI=`#ifdef USE_MAP
1217	uniform sampler2D map;
1218#endif`,fI=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1219	vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1220#endif
1221#ifdef USE_MAP
1222	diffuseColor *= texture2D( map, uv );
1223#endif
1224#ifdef USE_ALPHAMAP
1225	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1226#endif`,mI=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1227	uniform mat3 uvTransform;
1228#endif
1229#ifdef USE_MAP
1230	uniform sampler2D map;
1231#endif
1232#ifdef USE_ALPHAMAP
1233	uniform sampler2D alphaMap;
1234#endif`,gI=`float metalnessFactor = metalness;
1235#ifdef USE_METALNESSMAP
1236	vec4 texelMetalness = texture2D( metalnessMap, vUv );
1237	metalnessFactor *= texelMetalness.b;
1238#endif`,vI=`#ifdef USE_METALNESSMAP
1239	uniform sampler2D metalnessMap;
1240#endif`,yI=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
1241	vColor *= morphTargetBaseInfluence;
1242	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1243		#if defined( USE_COLOR_ALPHA )
1244			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1245		#elif defined( USE_COLOR )
1246			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1247		#endif
1248	}
1249#endif`,xI=`#ifdef USE_MORPHNORMALS
1250	objectNormal *= morphTargetBaseInfluence;
1251	#ifdef MORPHTARGETS_TEXTURE
1252		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1253			if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1254		}
1255	#else
1256		objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
1257		objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
1258		objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
1259		objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
1260	#endif
1261#endif`,bI=`#ifdef USE_MORPHTARGETS
1262	uniform float morphTargetBaseInfluence;
1263	#ifdef MORPHTARGETS_TEXTURE
1264		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1265		uniform sampler2DArray morphTargetsTexture;
1266		uniform ivec2 morphTargetsTextureSize;
1267		vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1268			int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1269			int y = texelIndex / morphTargetsTextureSize.x;
1270			int x = texelIndex - y * morphTargetsTextureSize.x;
1271			ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1272			return texelFetch( morphTargetsTexture, morphUV, 0 );
1273		}
1274	#else
1275		#ifndef USE_MORPHNORMALS
1276			uniform float morphTargetInfluences[ 8 ];
1277		#else
1278			uniform float morphTargetInfluences[ 4 ];
1279		#endif
1280	#endif
1281#endif`,wI=`#ifdef USE_MORPHTARGETS
1282	transformed *= morphTargetBaseInfluence;
1283	#ifdef MORPHTARGETS_TEXTURE
1284		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1285			if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1286		}
1287	#else
1288		transformed += morphTarget0 * morphTargetInfluences[ 0 ];
1289		transformed += morphTarget1 * morphTargetInfluences[ 1 ];
1290		transformed += morphTarget2 * morphTargetInfluences[ 2 ];
1291		transformed += morphTarget3 * morphTargetInfluences[ 3 ];
1292		#ifndef USE_MORPHNORMALS
1293			transformed += morphTarget4 * morphTargetInfluences[ 4 ];
1294			transformed += morphTarget5 * morphTargetInfluences[ 5 ];
1295			transformed += morphTarget6 * morphTargetInfluences[ 6 ];
1296			transformed += morphTarget7 * morphTargetInfluences[ 7 ];
1297		#endif
1298	#endif
1299#endif`,SI=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1300#ifdef FLAT_SHADED
1301	vec3 fdx = dFdx( vViewPosition );
1302	vec3 fdy = dFdy( vViewPosition );
1303	vec3 normal = normalize( cross( fdx, fdy ) );
1304#else
1305	vec3 normal = normalize( vNormal );
1306	#ifdef DOUBLE_SIDED
1307		normal = normal * faceDirection;
1308	#endif
1309	#ifdef USE_TANGENT
1310		vec3 tangent = normalize( vTangent );
1311		vec3 bitangent = normalize( vBitangent );
1312		#ifdef DOUBLE_SIDED
1313			tangent = tangent * faceDirection;
1314			bitangent = bitangent * faceDirection;
1315		#endif
1316		#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
1317			mat3 vTBN = mat3( tangent, bitangent, normal );
1318		#endif
1319	#endif
1320#endif
1321vec3 geometryNormal = normal;`,_I=`#ifdef OBJECTSPACE_NORMALMAP
1322	normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
1323	#ifdef FLIP_SIDED
1324		normal = - normal;
1325	#endif
1326	#ifdef DOUBLE_SIDED
1327		normal = normal * faceDirection;
1328	#endif
1329	normal = normalize( normalMatrix * normal );
1330#elif defined( TANGENTSPACE_NORMALMAP )
1331	vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
1332	mapN.xy *= normalScale;
1333	#ifdef USE_TANGENT
1334		normal = normalize( vTBN * mapN );
1335	#else
1336		normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );
1337	#endif
1338#elif defined( USE_BUMPMAP )
1339	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1340#endif`,AI=`#ifndef FLAT_SHADED
1341	varying vec3 vNormal;
1342	#ifdef USE_TANGENT
1343		varying vec3 vTangent;
1344		varying vec3 vBitangent;
1345	#endif
1346#endif`,MI=`#ifndef FLAT_SHADED
1347	varying vec3 vNormal;
1348	#ifdef USE_TANGENT
1349		varying vec3 vTangent;
1350		varying vec3 vBitangent;
1351	#endif
1352#endif`,EI=`#ifndef FLAT_SHADED
1353	vNormal = normalize( transformedNormal );
1354	#ifdef USE_TANGENT
1355		vTangent = normalize( transformedTangent );
1356		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1357	#endif
1358#endif`,CI=`#ifdef USE_NORMALMAP
1359	uniform sampler2D normalMap;
1360	uniform vec2 normalScale;
1361#endif
1362#ifdef OBJECTSPACE_NORMALMAP
1363	uniform mat3 normalMatrix;
1364#endif
1365#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
1366	vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
1367		vec3 q0 = dFdx( eye_pos.xyz );
1368		vec3 q1 = dFdy( eye_pos.xyz );
1369		vec2 st0 = dFdx( vUv.st );
1370		vec2 st1 = dFdy( vUv.st );
1371		vec3 N = surf_norm;
1372		vec3 q1perp = cross( q1, N );
1373		vec3 q0perp = cross( N, q0 );
1374		vec3 T = q1perp * st0.x + q0perp * st1.x;
1375		vec3 B = q1perp * st0.y + q0perp * st1.y;
1376		float det = max( dot( T, T ), dot( B, B ) );
1377		float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
1378		return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
1379	}
1380#endif`,TI=`#ifdef USE_CLEARCOAT
1381	vec3 clearcoatNormal = geometryNormal;
1382#endif`,PI=`#ifdef USE_CLEARCOAT_NORMALMAP
1383	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
1384	clearcoatMapN.xy *= clearcoatNormalScale;
1385	#ifdef USE_TANGENT
1386		clearcoatNormal = normalize( vTBN * clearcoatMapN );
1387	#else
1388		clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
1389	#endif
1390#endif`,DI=`#ifdef USE_CLEARCOATMAP
1391	uniform sampler2D clearcoatMap;
1392#endif
1393#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1394	uniform sampler2D clearcoatRoughnessMap;
1395#endif
1396#ifdef USE_CLEARCOAT_NORMALMAP
1397	uniform sampler2D clearcoatNormalMap;
1398	uniform vec2 clearcoatNormalScale;
1399#endif`,II=`#ifdef USE_IRIDESCENCEMAP
1400	uniform sampler2D iridescenceMap;
1401#endif
1402#ifdef USE_IRIDESCENCE_THICKNESSMAP
1403	uniform sampler2D iridescenceThicknessMap;
1404#endif`,OI=`#ifdef OPAQUE
1405diffuseColor.a = 1.0;
1406#endif
1407#ifdef USE_TRANSMISSION
1408diffuseColor.a *= material.transmissionAlpha + 0.1;
1409#endif
1410gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,RI=`vec3 packNormalToRGB( const in vec3 normal ) {
1411	return normalize( normal ) * 0.5 + 0.5;
1412}
1413vec3 unpackRGBToNormal( const in vec3 rgb ) {
1414	return 2.0 * rgb.xyz - 1.0;
1415}
1416const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
1417const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
1418const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
1419const float ShiftRight8 = 1. / 256.;
1420vec4 packDepthToRGBA( const in float v ) {
1421	vec4 r = vec4( fract( v * PackFactors ), v );
1422	r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;
1423}
1424float unpackRGBAToDepth( const in vec4 v ) {
1425	return dot( v, UnpackFactors );
1426}
1427vec2 packDepthToRG( in highp float v ) {
1428	return packDepthToRGBA( v ).yx;
1429}
1430float unpackRGToDepth( const in highp vec2 v ) {
1431	return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
1432}
1433vec4 pack2HalfToRGBA( vec2 v ) {
1434	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1435	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1436}
1437vec2 unpackRGBATo2Half( vec4 v ) {
1438	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1439}
1440float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1441	return ( viewZ + near ) / ( near - far );
1442}
1443float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
1444	return linearClipZ * ( near - far ) - near;
1445}
1446float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1447	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1448}
1449float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
1450	return ( near * far ) / ( ( far - near ) * invClipZ - far );
1451}`,LI=`#ifdef PREMULTIPLIED_ALPHA
1452	gl_FragColor.rgb *= gl_FragColor.a;
1453#endif`,BI=`vec4 mvPosition = vec4( transformed, 1.0 );
1454#ifdef USE_INSTANCING
1455	mvPosition = instanceMatrix * mvPosition;
1456#endif
1457mvPosition = modelViewMatrix * mvPosition;
1458gl_Position = projectionMatrix * mvPosition;`,zI=`#ifdef DITHERING
1459	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1460#endif`,FI=`#ifdef DITHERING
1461	vec3 dithering( vec3 color ) {
1462		float grid_position = rand( gl_FragCoord.xy );
1463		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1464		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1465		return color + dither_shift_RGB;
1466	}
1467#endif`,kI=`float roughnessFactor = roughness;
1468#ifdef USE_ROUGHNESSMAP
1469	vec4 texelRoughness = texture2D( roughnessMap, vUv );
1470	roughnessFactor *= texelRoughness.g;
1471#endif`,UI=`#ifdef USE_ROUGHNESSMAP
1472	uniform sampler2D roughnessMap;
1473#endif`,NI=`#if NUM_SPOT_LIGHT_COORDS > 0
1474  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1475#endif
1476#if NUM_SPOT_LIGHT_MAPS > 0
1477  uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1478#endif
1479#ifdef USE_SHADOWMAP
1480	#if NUM_DIR_LIGHT_SHADOWS > 0
1481		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1482		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1483		struct DirectionalLightShadow {
1484			float shadowBias;
1485			float shadowNormalBias;
1486			float shadowRadius;
1487			vec2 shadowMapSize;
1488		};
1489		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1490	#endif
1491	#if NUM_SPOT_LIGHT_SHADOWS > 0
1492		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1493		struct SpotLightShadow {
1494			float shadowBias;
1495			float shadowNormalBias;
1496			float shadowRadius;
1497			vec2 shadowMapSize;
1498		};
1499		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1500	#endif
1501	#if NUM_POINT_LIGHT_SHADOWS > 0
1502		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1503		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1504		struct PointLightShadow {
1505			float shadowBias;
1506			float shadowNormalBias;
1507			float shadowRadius;
1508			vec2 shadowMapSize;
1509			float shadowCameraNear;
1510			float shadowCameraFar;
1511		};
1512		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1513	#endif
1514	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1515		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
1516	}
1517	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1518		return unpackRGBATo2Half( texture2D( shadow, uv ) );
1519	}
1520	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
1521		float occlusion = 1.0;
1522		vec2 distribution = texture2DDistribution( shadow, uv );
1523		float hard_shadow = step( compare , distribution.x );
1524		if (hard_shadow != 1.0 ) {
1525			float distance = compare - distribution.x ;
1526			float variance = max( 0.00000, distribution.y * distribution.y );
1527			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 );
1528		}
1529		return occlusion;
1530	}
1531	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1532		float shadow = 1.0;
1533		shadowCoord.xyz /= shadowCoord.w;
1534		shadowCoord.z += shadowBias;
1535		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1536		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1537		if ( frustumTest ) {
1538		#if defined( SHADOWMAP_TYPE_PCF )
1539			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1540			float dx0 = - texelSize.x * shadowRadius;
1541			float dy0 = - texelSize.y * shadowRadius;
1542			float dx1 = + texelSize.x * shadowRadius;
1543			float dy1 = + texelSize.y * shadowRadius;
1544			float dx2 = dx0 / 2.0;
1545			float dy2 = dy0 / 2.0;
1546			float dx3 = dx1 / 2.0;
1547			float dy3 = dy1 / 2.0;
1548			shadow = (
1549				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1550				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1551				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1552				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1553				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1554				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1555				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1556				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1557				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1558				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1559				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1560				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1561				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
1562				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
1563				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
1564				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
1565				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
1566			) * ( 1.0 / 17.0 );
1567		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
1568			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1569			float dx = texelSize.x;
1570			float dy = texelSize.y;
1571			vec2 uv = shadowCoord.xy;
1572			vec2 f = fract( uv * shadowMapSize + 0.5 );
1573			uv -= f * texelSize;
1574			shadow = (
1575				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
1576				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
1577				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
1578				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
1579				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
1580					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
1581					 f.x ) +
1582				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
1583					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
1584					 f.x ) +
1585				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
1586					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
1587					 f.y ) +
1588				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
1589					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
1590					 f.y ) +
1591				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
1592						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
1593						  f.x ),
1594					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
1595						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
1596						  f.x ),
1597					 f.y )
1598			) * ( 1.0 / 9.0 );
1599		#elif defined( SHADOWMAP_TYPE_VSM )
1600			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
1601		#else
1602			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
1603		#endif
1604		}
1605		return shadow;
1606	}
1607	vec2 cubeToUV( vec3 v, float texelSizeY ) {
1608		vec3 absV = abs( v );
1609		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
1610		absV *= scaleToCube;
1611		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
1612		vec2 planar = v.xy;
1613		float almostATexel = 1.5 * texelSizeY;
1614		float almostOne = 1.0 - almostATexel;
1615		if ( absV.z >= almostOne ) {
1616			if ( v.z > 0.0 )
1617				planar.x = 4.0 - v.x;
1618		} else if ( absV.x >= almostOne ) {
1619			float signX = sign( v.x );
1620			planar.x = v.z * signX + 2.0 * signX;
1621		} else if ( absV.y >= almostOne ) {
1622			float signY = sign( v.y );
1623			planar.x = v.x + 2.0 * signY + 2.0;
1624			planar.y = v.z * signY - 2.0;
1625		}
1626		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
1627	}
1628	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1629		vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
1630		vec3 lightToPosition = shadowCoord.xyz;
1631		float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );		dp += shadowBias;
1632		vec3 bd3D = normalize( lightToPosition );
1633		#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
1634			vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
1635			return (
1636				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
1637				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
1638				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
1639				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
1640				texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
1641				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
1642				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
1643				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
1644				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
1645			) * ( 1.0 / 9.0 );
1646		#else
1647			return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
1648		#endif
1649	}
1650#endif`,VI=`#if NUM_SPOT_LIGHT_COORDS > 0
1651  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1652  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1653#endif
1654#ifdef USE_SHADOWMAP
1655	#if NUM_DIR_LIGHT_SHADOWS > 0
1656		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1657		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1658		struct DirectionalLightShadow {
1659			float shadowBias;
1660			float shadowNormalBias;
1661			float shadowRadius;
1662			vec2 shadowMapSize;
1663		};
1664		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1665	#endif
1666	#if NUM_SPOT_LIGHT_SHADOWS > 0
1667		struct SpotLightShadow {
1668			float shadowBias;
1669			float shadowNormalBias;
1670			float shadowRadius;
1671			vec2 shadowMapSize;
1672		};
1673		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1674	#endif
1675	#if NUM_POINT_LIGHT_SHADOWS > 0
1676		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1677		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1678		struct PointLightShadow {
1679			float shadowBias;
1680			float shadowNormalBias;
1681			float shadowRadius;
1682			vec2 shadowMapSize;
1683			float shadowCameraNear;
1684			float shadowCameraFar;
1685		};
1686		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1687	#endif
1688#endif`,jI=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1689	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1690	vec4 shadowWorldPosition;
1691#endif
1692#if defined( USE_SHADOWMAP )
1693	#if NUM_DIR_LIGHT_SHADOWS > 0
1694		#pragma unroll_loop_start
1695		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1696			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1697			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1698		}
1699		#pragma unroll_loop_end
1700	#endif
1701	#if NUM_POINT_LIGHT_SHADOWS > 0
1702		#pragma unroll_loop_start
1703		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1704			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1705			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1706		}
1707		#pragma unroll_loop_end
1708	#endif
1709#endif
1710#if NUM_SPOT_LIGHT_COORDS > 0
1711	#pragma unroll_loop_start
1712	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
1713		shadowWorldPosition = worldPosition;
1714		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1715			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
1716		#endif
1717		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1718	}
1719	#pragma unroll_loop_end
1720#endif`,GI=`float getShadowMask() {
1721	float shadow = 1.0;
1722	#ifdef USE_SHADOWMAP
1723	#if NUM_DIR_LIGHT_SHADOWS > 0
1724	DirectionalLightShadow directionalLight;
1725	#pragma unroll_loop_start
1726	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1727		directionalLight = directionalLightShadows[ i ];
1728		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1729	}
1730	#pragma unroll_loop_end
1731	#endif
1732	#if NUM_SPOT_LIGHT_SHADOWS > 0
1733	SpotLightShadow spotLight;
1734	#pragma unroll_loop_start
1735	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1736		spotLight = spotLightShadows[ i ];
1737		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1738	}
1739	#pragma unroll_loop_end
1740	#endif
1741	#if NUM_POINT_LIGHT_SHADOWS > 0
1742	PointLightShadow pointLight;
1743	#pragma unroll_loop_start
1744	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1745		pointLight = pointLightShadows[ i ];
1746		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
1747	}
1748	#pragma unroll_loop_end
1749	#endif
1750	#endif
1751	return shadow;
1752}`,HI=`#ifdef USE_SKINNING
1753	mat4 boneMatX = getBoneMatrix( skinIndex.x );
1754	mat4 boneMatY = getBoneMatrix( skinIndex.y );
1755	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
1756	mat4 boneMatW = getBoneMatrix( skinIndex.w );
1757#endif`,WI=`#ifdef USE_SKINNING
1758	uniform mat4 bindMatrix;
1759	uniform mat4 bindMatrixInverse;
1760	uniform highp sampler2D boneTexture;
1761	uniform int boneTextureSize;
1762	mat4 getBoneMatrix( const in float i ) {
1763		float j = i * 4.0;
1764		float x = mod( j, float( boneTextureSize ) );
1765		float y = floor( j / float( boneTextureSize ) );
1766		float dx = 1.0 / float( boneTextureSize );
1767		float dy = 1.0 / float( boneTextureSize );
1768		y = dy * ( y + 0.5 );
1769		vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
1770		vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
1771		vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
1772		vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
1773		mat4 bone = mat4( v1, v2, v3, v4 );
1774		return bone;
1775	}
1776#endif`,qI=`#ifdef USE_SKINNING
1777	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
1778	vec4 skinned = vec4( 0.0 );
1779	skinned += boneMatX * skinVertex * skinWeight.x;
1780	skinned += boneMatY * skinVertex * skinWeight.y;
1781	skinned += boneMatZ * skinVertex * skinWeight.z;
1782	skinned += boneMatW * skinVertex * skinWeight.w;
1783	transformed = ( bindMatrixInverse * skinned ).xyz;
1784#endif`,XI=`#ifdef USE_SKINNING
1785	mat4 skinMatrix = mat4( 0.0 );
1786	skinMatrix += skinWeight.x * boneMatX;
1787	skinMatrix += skinWeight.y * boneMatY;
1788	skinMatrix += skinWeight.z * boneMatZ;
1789	skinMatrix += skinWeight.w * boneMatW;
1790	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
1791	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
1792	#ifdef USE_TANGENT
1793		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
1794	#endif
1795#endif`,YI=`float specularStrength;
1796#ifdef USE_SPECULARMAP
1797	vec4 texelSpecular = texture2D( specularMap, vUv );
1798	specularStrength = texelSpecular.r;
1799#else
1800	specularStrength = 1.0;
1801#endif`,QI=`#ifdef USE_SPECULARMAP
1802	uniform sampler2D specularMap;
1803#endif`,ZI=`#if defined( TONE_MAPPING )
1804	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
1805#endif`,KI=`#ifndef saturate
1806#define saturate( a ) clamp( a, 0.0, 1.0 )
1807#endif
1808uniform float toneMappingExposure;
1809vec3 LinearToneMapping( vec3 color ) {
1810	return toneMappingExposure * color;
1811}
1812vec3 ReinhardToneMapping( vec3 color ) {
1813	color *= toneMappingExposure;
1814	return saturate( color / ( vec3( 1.0 ) + color ) );
1815}
1816vec3 OptimizedCineonToneMapping( vec3 color ) {
1817	color *= toneMappingExposure;
1818	color = max( vec3( 0.0 ), color - 0.004 );
1819	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
1820}
1821vec3 RRTAndODTFit( vec3 v ) {
1822	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
1823	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
1824	return a / b;
1825}
1826vec3 ACESFilmicToneMapping( vec3 color ) {
1827	const mat3 ACESInputMat = mat3(
1828		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
1829		vec3( 0.04823, 0.01566, 0.83777 )
1830	);
1831	const mat3 ACESOutputMat = mat3(
1832		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
1833		vec3( -0.07367, -0.00605,  1.07602 )
1834	);
1835	color *= toneMappingExposure / 0.6;
1836	color = ACESInputMat * color;
1837	color = RRTAndODTFit( color );
1838	color = ACESOutputMat * color;
1839	return saturate( color );
1840}
1841vec3 CustomToneMapping( vec3 color ) { return color; }`,JI=`#ifdef USE_TRANSMISSION
1842	material.transmission = transmission;
1843	material.transmissionAlpha = 1.0;
1844	material.thickness = thickness;
1845	material.attenuationDistance = attenuationDistance;
1846	material.attenuationColor = attenuationColor;
1847	#ifdef USE_TRANSMISSIONMAP
1848		material.transmission *= texture2D( transmissionMap, vUv ).r;
1849	#endif
1850	#ifdef USE_THICKNESSMAP
1851		material.thickness *= texture2D( thicknessMap, vUv ).g;
1852	#endif
1853	vec3 pos = vWorldPosition;
1854	vec3 v = normalize( cameraPosition - pos );
1855	vec3 n = inverseTransformDirection( normal, viewMatrix );
1856	vec4 transmission = getIBLVolumeRefraction(
1857		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
1858		pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
1859		material.attenuationColor, material.attenuationDistance );
1860	material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );
1861	totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );
1862#endif`,$I=`#ifdef USE_TRANSMISSION
1863	uniform float transmission;
1864	uniform float thickness;
1865	uniform float attenuationDistance;
1866	uniform vec3 attenuationColor;
1867	#ifdef USE_TRANSMISSIONMAP
1868		uniform sampler2D transmissionMap;
1869	#endif
1870	#ifdef USE_THICKNESSMAP
1871		uniform sampler2D thicknessMap;
1872	#endif
1873	uniform vec2 transmissionSamplerSize;
1874	uniform sampler2D transmissionSamplerMap;
1875	uniform mat4 modelMatrix;
1876	uniform mat4 projectionMatrix;
1877	varying vec3 vWorldPosition;
1878	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
1879		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
1880		vec3 modelScale;
1881		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
1882		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
1883		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
1884		return normalize( refractionVector ) * thickness * modelScale;
1885	}
1886	float applyIorToRoughness( const in float roughness, const in float ior ) {
1887		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
1888	}
1889	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
1890		float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
1891		#ifdef texture2DLodEXT
1892			return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );
1893		#else
1894			return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );
1895		#endif
1896	}
1897	vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
1898		if ( isinf( attenuationDistance ) ) {
1899			return radiance;
1900		} else {
1901			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
1902			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance * radiance;
1903		}
1904	}
1905	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
1906		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
1907		const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
1908		const in vec3 attenuationColor, const in float attenuationDistance ) {
1909		vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
1910		vec3 refractedRayExit = position + transmissionRay;
1911		vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
1912		vec2 refractionCoords = ndcPos.xy / ndcPos.w;
1913		refractionCoords += 1.0;
1914		refractionCoords /= 2.0;
1915		vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
1916		vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
1917		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
1918		return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
1919	}
1920#endif`,eO=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
1921	varying vec2 vUv;
1922#endif`,tO=`#ifdef USE_UV
1923	#ifdef UVS_VERTEX_ONLY
1924		vec2 vUv;
1925	#else
1926		varying vec2 vUv;
1927	#endif
1928	uniform mat3 uvTransform;
1929#endif`,iO=`#ifdef USE_UV
1930	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
1931#endif`,rO=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
1932	varying vec2 vUv2;
1933#endif`,sO=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
1934	attribute vec2 uv2;
1935	varying vec2 vUv2;
1936	uniform mat3 uv2Transform;
1937#endif`,aO=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
1938	vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
1939#endif`,nO=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_L
1939IGHT_COORDS > 0
1940	vec4 worldPosition = vec4( transformed, 1.0 );
1941	#ifdef USE_INSTANCING
1942		worldPosition = instanceMatrix * worldPosition;
1943	#endif
1944	worldPosition = modelMatrix * worldPosition;
1945#endif`,oO=`varying vec2 vUv;
1946uniform mat3 uvTransform;
1947void main() {
1948	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
1949	gl_Position = vec4( position.xy, 1.0, 1.0 );
1950}`,lO=`uniform sampler2D t2D;
1951uniform float backgroundIntensity;
1952varying vec2 vUv;
1953void main() {
1954	vec4 texColor = texture2D( t2D, vUv );
1955	#ifdef DECODE_VIDEO_TEXTURE
1956		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 );
1957	#endif
1958	texColor.rgb *= backgroundIntensity;
1959	gl_FragColor = texColor;
1960	#include <tonemapping_fragment>
1961	#include <encodings_fragment>
1962}`,hO=`varying vec3 vWorldDirection;
1963#include <common>
1964void main() {
1965	vWorldDirection = transformDirection( position, modelMatrix );
1966	#include <begin_vertex>
1967	#include <project_vertex>
1968	gl_Position.z = gl_Position.w;
1969}`,cO=`#ifdef ENVMAP_TYPE_CUBE
1970	uniform samplerCube envMap;
1971#elif defined( ENVMAP_TYPE_CUBE_UV )
1972	uniform sampler2D envMap;
1973#endif
1974uniform float flipEnvMap;
1975uniform float backgroundBlurriness;
1976uniform float backgroundIntensity;
1977varying vec3 vWorldDirection;
1978#include <cube_uv_reflection_fragment>
1979void main() {
1980	#ifdef ENVMAP_TYPE_CUBE
1981		vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
1982	#elif defined( ENVMAP_TYPE_CUBE_UV )
1983		vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
1984	#else
1985		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
1986	#endif
1987	texColor.rgb *= backgroundIntensity;
1988	gl_FragColor = texColor;
1989	#include <tonemapping_fragment>
1990	#include <encodings_fragment>
1991}`,dO=`varying vec3 vWorldDirection;
1992#include <common>
1993void main() {
1994	vWorldDirection = transformDirection( position, modelMatrix );
1995	#include <begin_vertex>
1996	#include <project_vertex>
1997	gl_Position.z = gl_Position.w;
1998}`,uO=`uniform samplerCube tCube;
1999uniform float tFlip;
2000uniform float opacity;
2001varying vec3 vWorldDirection;
2002void main() {
2003	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2004	gl_FragColor = texColor;
2005	gl_FragColor.a *= opacity;
2006	#include <tonemapping_fragment>
2007	#include <encodings_fragment>
2008}`,pO=`#include <common>
2009#include <uv_pars_vertex>
2010#include <displacementmap_pars_vertex>
2011#include <morphtarget_pars_vertex>
2012#include <skinning_pars_vertex>
2013#include <logdepthbuf_pars_vertex>
2014#include <clipping_planes_pars_vertex>
2015varying vec2 vHighPrecisionZW;
2016void main() {
2017	#include <uv_vertex>
2018	#include <skinbase_vertex>
2019	#ifdef USE_DISPLACEMENTMAP
2020		#include <beginnormal_vertex>
2021		#include <morphnormal_vertex>
2022		#include <skinnormal_vertex>
2023	#endif
2024	#include <begin_vertex>
2025	#include <morphtarget_vertex>
2026	#include <skinning_vertex>
2027	#include <displacementmap_vertex>
2028	#include <project_vertex>
2029	#include <logdepthbuf_vertex>
2030	#include <clipping_planes_vertex>
2031	vHighPrecisionZW = gl_Position.zw;
2032}`,fO=`#if DEPTH_PACKING == 3200
2033	uniform float opacity;
2034#endif
2035#include <common>
2036#include <packing>
2037#include <uv_pars_fragment>
2038#include <map_pars_fragment>
2039#include <alphamap_pars_fragment>
2040#include <alphatest_pars_fragment>
2041#include <logdepthbuf_pars_fragment>
2042#include <clipping_planes_pars_fragment>
2043varying vec2 vHighPrecisionZW;
2044void main() {
2045	#include <clipping_planes_fragment>
2046	vec4 diffuseColor = vec4( 1.0 );
2047	#if DEPTH_PACKING == 3200
2048		diffuseColor.a = opacity;
2049	#endif
2050	#include <map_fragment>
2051	#include <alphamap_fragment>
2052	#include <alphatest_fragment>
2053	#include <logdepthbuf_fragment>
2054	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
2055	#if DEPTH_PACKING == 3200
2056		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2057	#elif DEPTH_PACKING == 3201
2058		gl_FragColor = packDepthToRGBA( fragCoordZ );
2059	#endif
2060}`,mO=`#define DISTANCE
2061varying vec3 vWorldPosition;
2062#include <common>
2063#include <uv_pars_vertex>
2064#include <displacementmap_pars_vertex>
2065#include <morphtarget_pars_vertex>
2066#include <skinning_pars_vertex>
2067#include <clipping_planes_pars_vertex>
2068void main() {
2069	#include <uv_vertex>
2070	#include <skinbase_vertex>
2071	#ifdef USE_DISPLACEMENTMAP
2072		#include <beginnormal_vertex>
2073		#include <morphnormal_vertex>
2074		#include <skinnormal_vertex>
2075	#endif
2076	#include <begin_vertex>
2077	#include <morphtarget_vertex>
2078	#include <skinning_vertex>
2079	#include <displacementmap_vertex>
2080	#include <project_vertex>
2081	#include <worldpos_vertex>
2082	#include <clipping_planes_vertex>
2083	vWorldPosition = worldPosition.xyz;
2084}`,gO=`#define DISTANCE
2085uniform vec3 referencePosition;
2086uniform float nearDistance;
2087uniform float farDistance;
2088varying vec3 vWorldPosition;
2089#include <common>
2090#include <packing>
2091#include <uv_pars_fragment>
2092#include <map_pars_fragment>
2093#include <alphamap_pars_fragment>
2094#include <alphatest_pars_fragment>
2095#include <clipping_planes_pars_fragment>
2096void main () {
2097	#include <clipping_planes_fragment>
2098	vec4 diffuseColor = vec4( 1.0 );
2099	#include <map_fragment>
2100	#include <alphamap_fragment>
2101	#include <alphatest_fragment>
2102	float dist = length( vWorldPosition - referencePosition );
2103	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2104	dist = saturate( dist );
2105	gl_FragColor = packDepthToRGBA( dist );
2106}`,vO=`varying vec3 vWorldDirection;
2107#include <common>
2108void main() {
2109	vWorldDirection = transformDirection( position, modelMatrix );
2110	#include <begin_vertex>
2111	#include <project_vertex>
2112}
2112`,yO=`uniform sampler2D tEquirect;
2113varying vec3 vWorldDirection;
2114#include <common>
2115void main() {
2116	vec3 direction = normalize( vWorldDirection );
2117	vec2 sampleUV = equirectUv( direction );
2118	gl_FragColor = texture2D( tEquirect, sampleUV );
2119	#include <tonemapping_fragment>
2120	#include <encodings_fragment>
2121}`,xO=`uniform float scale;
2122attribute float lineDistance;
2123varying float vLineDistance;
2124#include <common>
2125#include <color_pars_vertex>
2126#include <fog_pars_vertex>
2127#include <morphtarget_pars_vertex>
2128#include <logdepthbuf_pars_vertex>
2129#include <clipping_planes_pars_vertex>
2130void main() {
2131	vLineDistance = scale * lineDistance;
2132	#include <color_vertex>
2133	#include <morphcolor_vertex>
2134	#include <begin_vertex>
2135	#include <morphtarget_vertex>
2136	#include <project_vertex>
2137	#include <logdepthbuf_vertex>
2138	#include <clipping_planes_vertex>
2139	#include <fog_vertex>
2140}`,bO=`uniform vec3 diffuse;
2141uniform float opacity;
2142uniform float dashSize;
2143uniform float totalSize;
2144varying float vLineDistance;
2145#include <common>
2146#include <color_pars_fragment>
2147#include <fog_pars_fragment>
2148#include <logdepthbuf_pars_fragment>
2149#include <clipping_planes_pars_fragment>
2150void main() {
2151	#include <clipping_planes_fragment>
2152	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2153		discard;
2154	}
2155	vec3 outgoingLight = vec3( 0.0 );
2156	vec4 diffuseColor = vec4( diffuse, opacity );
2157	#include <logdepthbuf_fragment>
2158	#include <color_fragment>
2159	outgoingLight = diffuseColor.rgb;
2160	#include <output_fragment>
2161	#include <tonemapping_fragment>
2162	#include <encodings_fragment>
2163	#include <fog_fragment>
2164	#include <premultiplied_alpha_fragment>
2165}`,wO=`#include <common>
2166#include <uv_pars_vertex>
2167#include <uv2_pars_vertex>
2168#include <envmap_pars_vertex>
2169#include <color_pars_vertex>
2170#include <fog_pars_vertex>
2171#include <morphtarget_pars_vertex>
2172#include <skinning_pars_vertex>
2173#include <logdepthbuf_pars_vertex>
2174#include <clipping_planes_pars_vertex>
2175void main() {
2176	#include <uv_vertex>
2177	#include <uv2_vertex>
2178	#include <color_vertex>
2179	#include <morphcolor_vertex>
2180	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2181		#include <beginnormal_vertex>
2182		#include <morphnormal_vertex>
2183		#include <skinbase_vertex>
2184		#include <skinnormal_vertex>
2185		#include <defaultnormal_vertex>
2186	#endif
2187	#include <begin_vertex>
2188	#include <morphtarget_vertex>
2189	#include <skinning_vertex>
2190	#include <project_vertex>
2191	#include <logdepthbuf_vertex>
2192	#include <clipping_planes_vertex>
2193	#include <worldpos_vertex>
2194	#include <envmap_vertex>
2195	#include <fog_vertex>
2196}`,SO=`uniform vec3 diffuse;
2197uniform float opacity;
2198#ifndef FLAT_SHADED
2199	varying vec3 vNormal;
2200#endif
2201#include <common>
2202#include <dithering_pars_fragment>
2203#include <color_pars_fragment>
2204#include <uv_pars_fragment>
2205#include <uv2_pars_fragment>
2206#include <map_pars_fragment>
2207#include <alphamap_pars_fragment>
2208#include <alphatest_pars_fragment>
2209#include <aomap_pars_fragment>
2210#include <lightmap_pars_fragment>
2211#include <envmap_common_pars_fragment>
2212#include <envmap_pars_fragment>
2213#include <fog_pars_fragment>
2214#include <specularmap_pars_fragment>
2215#include <logdepthbuf_pars_fragment>
2216#include <clipping_planes_pars_fragment>
2217void main() {
2218	#include <clipping_planes_fragment>
2219	vec4 diffuseColor = vec4( diffuse, opacity );
2220	#include <logdepthbuf_fragment>
2221	#include <map_fragment>
2222	#include <color_fragment>
2223	#include <alphamap_fragment>
2224	#include <alphatest_fragment>
2225	#include <specularmap_fragment>
2226	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2227	#ifdef USE_LIGHTMAP
2228		vec4 lightMapTexel = texture2D( lightMap, vUv2 );
2229		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2230	#else
2231		reflectedLight.indirectDiffuse += vec3( 1.0 );
2232	#endif
2233	#include <aomap_fragment>
2234	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2235	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2236	#include <envmap_fragment>
2237	#include <output_fragment>
2238	#include <tonemapping_fragment>
2239	#include <encodings_fragment>
2240	#include <fog_fragment>
2241	#include <premultiplied_alpha_fragment>
2242	#include <dithering_fragment>
2243}`,_O=`#define LAMBERT
2244varying vec3 vViewPosition;
2245#include <common>
2246#include <uv_pars_vertex>
2247#include <uv2_pars_vertex>
2248#include <displacementmap_pars_vertex>
2249#include <envmap_pars_vertex>
2250#include <color_pars_vertex>
2251#include <fog_pars_vertex>
2252#include <normal_pars_vertex>
2253#include <morphtarget_pars_vertex>
2254#include <skinning_pars_vertex>
2255#include <shadowmap_pars_vertex>
2256#include <logdepthbuf_pars_vertex>
2257#include <clipping_planes_pars_vertex>
2258void main() {
2259	#include <uv_vertex>
2260	#include <uv2_vertex>
2261	#include <color_vertex>
2262	#include <morphcolor_vertex>
2263	#include <beginnormal_vertex>
2264	#include <morphnormal_vertex>
2265	#include <skinbase_vertex>
2266	#include <skinnormal_vertex>
2267	#include <defaultnormal_vertex>
2268	#include <normal_vertex>
2269	#include <begin_vertex>
2270	#include <morphtarget_vertex>
2271	#include <skinning_vertex>
2272	#include <displacementmap_vertex>
2273	#include <project_vertex>
2274	#include <logdepthbuf_vertex>
2275	#include <clipping_planes_vertex>
2276	vViewPosition = - mvPosition.xyz;
2277	#include <worldpos_vertex>
2278	#include <envmap_vertex>
2279	#include <shadowmap_vertex>
2280	#include <fog_vertex>
2281}`,AO=`#define LAMBERT
2282uniform vec3 diffuse;
2283uniform vec3 emissive;
2284uniform float opacity;
2285#include <common>
2286#include <packing>
2287#include <dithering_pars_fragment>
2288#include <color_pars_fragment>
2289#include <uv_pars_fragment>
2290#include <uv2_pars_fragment>
2291#include <map_pars_fragment>
2292#include <alphamap_pars_fragment>
2293#include <alphatest_pars_fragment>
2294#include <aomap_pars_fragment>
2295#include <lightmap_pars_fragment>
2296#include <emissivemap_pars_fragment>
2297#include <envmap_common_pars_fragment>
2298#include <envmap_pars_fragment>
2299#include <fog_pars_fragment>
2300#include <bsdfs>
2301#include <lights_pars_begin>
2302#include <normal_pars_fragment>
2303#include <lights_lambert_pars_fragment>
2304#include <shadowmap_pars_fragment>
2305#include <bumpmap_pars_fragment>
2306#include <normalmap_pars_fragment>
2307#include <specularmap_pars_fragment>
2308#include <logdepthbuf_pars_fragment>
2309#include <clipping_planes_pars_fragment>
2310void main() {
2311	#include <clipping_planes_fragment>
2312	vec4 diffuseColor = vec4( diffuse, opacity );
2313	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2314	vec3 totalEmissiveRadiance = emissive;
2315	#include <logdepthbuf_fragment>
2316	#include <map_fragment>
2317	#include <color_fragment>
2318	#include <alphamap_fragment>
2319	#include <alphatest_fragment>
2320	#include <specularmap_fragment>
2321	#include <normal_fragment_begin>
2322	#include <normal_fragment_maps>
2323	#include <emissivemap_fragment>
2324	#include <lights_lambert_fragment>
2325	#include <lights_fragment_begin>
2326	#include <lights_fragment_maps>
2327	#include <lights_fragment_end>
2328	#include <aomap_fragment>
2329	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2330	#include <envmap_fragment>
2331	#include <output_fragment>
2332	#include <tonemapping_fragment>
2333	#include <encodings_fragment>
2334	#include <fog_fragment>
2335	#include <premultiplied_alpha_fragment>
2336	#include <dithering_fragment>
2337}`,MO=`#define MATCAP
2338varying vec3 vViewPosition;
2339#include <common>
2340#include <uv_pars_vertex>
2341#include <color_pars_vertex>
2342#include <displacementmap_pars_vertex>
2343#include <fog_pars_vertex>
2344#include <normal_pars_vertex>
2345#include <morphtarget_pars_vertex>
2346#include <skinning_pars_vertex>
2347#include <logdepthbuf_pars_vertex>
2348#include <clipping_planes_pars_vertex>
2349void main() {
2350	#include <uv_vertex>
2351	#include <color_vertex>
2352	#include <morphcolor_vertex>
2353	#include <beginnormal_vertex>
2354	#include <morphnormal_vertex>
2355	#include <skinbase_vertex>
2356	#include <skinnormal_vertex>
2357	#include <defaultnormal_vertex>
2358	#include <normal_vertex>
2359	#include <begin_vertex>
2360	#include <morphtarget_vertex>
2361	#include <skinning_vertex>
2362	#include <displacementmap_vertex>
2363	#include <project_vertex>
2364	#include <logdepthbuf_vertex>
2365	#include <clipping_planes_vertex>
2366	#include <fog_vertex>
2367	vViewPosition = - mvPosition.xyz;
2368}`,EO=`#define MATCAP
2369uniform vec3 diffuse;
2370uniform float opacity;
2371uniform sampler2D matcap;
2372varying vec3 vViewPosition;
2373#include <common>
2374#include <dithering_pars_fragment>
2375#include <color_pars_fragment>
2376#include <uv_pars_fragment>
2377#include <map_pars_fragment>
2378#include <alphamap_pars_fragment>
2379#include <alphatest_pars_fragment>
2380#include <fog_pars_fragment>
2381#include <normal_pars_fragment>
2382#include <bumpmap_pars_fragment>
2383#include <normalmap_pars_fragment>
2384#include <logdepthbuf_pars_fragment>
2385#include <clipping_planes_pars_fragment>
2386void main() {
2387	#include <clipping_planes_fragment>
2388	vec4 diffuseColor = vec4( diffuse, opacity );
2389	#include <logdepthbuf_fragment>
2390	#include <map_fragment>
2391	#include <color_fragment>
2392	#include <alphamap_fragment>
2393	#include <alphatest_fragment>
2394	#include <normal_fragment_begin>
2395	#include <normal_fragment_maps>
2396	vec3 viewDir = normalize( vViewPosition );
2397	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
2398	vec3 y = cross( viewDir, x );
2399	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
2400	#ifdef USE_MATCAP
2401		vec4 matcapColor = texture2D( matcap, uv );
2402	#else
2403		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
2404	#endif
2405	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
2406	#include <output_fragment>
2407	#include <tonemapping_fragment>
2408	#include <encodings_fragment>
2409	#include <fog_fragment>
2410	#include <premultiplied_alpha_fragment>
2411	#include <dithering_fragment>
2412}`,CO=`#define NORMAL
2413#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2414	varying vec3 vViewPosition;
2415#endif
2416#include <common>
2417#include <uv_pars_vertex>
2418#include <displacementmap_pars_vertex>
2419#include <normal_pars_vertex>
2420#include <morphtarget_pars_vertex>
2421#include <skinning_pars_vertex>
2422#include <logdepthbuf_pars_vertex>
2423#include <clipping_planes_pars_vertex>
2424void main() {
2425	#include <uv_vertex>
2426	#include <beginnormal_vertex>
2427	#include <morphnormal_vertex>
2428	#include <skinbase_vertex>
2429	#include <skinnormal_vertex>
2430	#include <defaultnormal_vertex>
2431	#include <normal_vertex>
2432	#include <begin_vertex>
2433	#include <morphtarget_vertex>
2434	#include <skinning_vertex>
2435	#include <displacementmap_vertex>
2436	#include <project_vertex>
2437	#include <logdepthbuf_vertex>
2438	#include <clipping_planes_vertex>
2439#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2440	vViewPosition = - mvPosition.xyz;
2441#endif
2442}`,TO=`#define NORMAL
2443uniform float opacity;
2444#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2445	varying vec3 vViewPosition;
2446#endif
2447#include <packing>
2448#include <uv_pars_fragment>
2449#include <normal_pars_fragment>
2450#include <bumpmap_pars_fragment>
2451#include <normalmap_pars_fragment>
2452#include <logdepthbuf_pars_fragment>
2453#include <clipping_planes_pars_fragment>
2454void main() {
2455	#include <clipping_planes_fragment>
2456	#include <logdepthbuf_fragment>
2457	#include <normal_fragment_begin>
2458	#include <normal_fragment_maps>
2459	gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
2460	#ifdef OPAQUE
2461		gl_FragColor.a = 1.0;
2462	#endif
2463}`,PO=`#define PHONG
2464varying vec3 vViewPosition;
2465#include <common>
2466#include <uv_pars_vertex>
2467#include <uv2_pars_vertex>
2468#include <displacementmap_pars_vertex>
2469#include <envmap_pars_vertex>
2470#include <color_pars_vertex>
2471#include <fog_pars_vertex>
2472#include <normal_pars_vertex>
2473#include <morphtarget_pars_vertex>
2474#include <skinning_pars_vertex>
2475#include <shadowmap_pars_vertex>
2476#include <logdepthbuf_pars_vertex>
2477#include <clipping_planes_pars_vertex>
2478void main() {
2479	#include <uv_vertex>
2480	#include <uv2_vertex>
2481	#include <color_vertex>
2482	#include <morphcolor_vertex>
2483	#include <beginnormal_vertex>
2484	#include <morphnormal_vertex>
2485	#include <skinbase_vertex>
2486	#include <skinnormal_vertex>
2487	#include <defaultnormal_vertex>
2488	#include <normal_vertex>
2489	#include <begin_vertex>
2490	#include <morphtarget_vertex>
2491	#include <skinning_vertex>
2492	#include <displacementmap_vertex>
2493	#include <project_vertex>
2494	#include <logdepthbuf_vertex>
2495	#include <clipping_planes_vertex>
2496	vViewPosition = - mvPosition.xyz;
2497	#include <worldpos_vertex>
2498	#include <envmap_vertex>
2499	#include <shadowmap_vertex>
2500	#include <fog_vertex>
2501}`,DO=`#define PHONG
2502uniform vec3 diffuse;
2503uniform vec3 emissive;
2504uniform vec3 specular;
2505uniform float shininess;
2506uniform float opacity;
2507#include <common>
2508#include <packing>
2509#include <dithering_pars_fragment>
2510#include <color_pars_fragment>
2511#include <uv_pars_fragment>
2512#include <uv2_pars_fragment>
2513#include <map_pars_fragment>
2514#include <alphamap_pars_fragment>
2515#include <alphatest_pars_fragment>
2516#include <aomap_pars_fragment>
2517#include <lightmap_pars_fragment>
2518#include <emissivemap_pars_fragment>
2519#include <envmap_common_pars_fragment>
2520#include <envmap_pars_fragment>
2521#include <fog_pars_fragment>
2522#include <bsdfs>
2523#include <lights_pars_begin>
2524#include <normal_pars_fragment>
2525#include <lights_phong_pars_fragment>
2526#include <shadowmap_pars_fragment>
2527#include <bumpmap_pars_fragment>
2528#include <normalmap_pars_fragment>
2529#include <specularmap_pars_fragment>
2530#include <logdepthbuf_pars_fragment>
2531#include <clipping_planes_pars_fragment>
2532void main() {
2533	#include <clipping_planes_fragment>
2534	vec4 diffuseColor = vec4( diffuse, opacity );
2535	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2536	vec3 totalEmissiveRadiance = emissive;
2537	#include <logdepthbuf_fragment>
2538	#include <map_fragment>
2539	#include <color_fragment>
2540	#include <alphamap_fragment>
2541	#include <alphatest_fragment>
2542	#include <specularmap_fragment>
2543	#include <normal_fragment_begin>
2544	#include <normal_fragment_maps>
2545	#include <emissivemap_fragment>
2546	#include <lights_phong_fragment>
2547	#include <lights_fragment_begin>
2548	#include <lights_fragment_maps>
2549	#include <lights_fragment_end>
2550	#include <aomap_fragment>
2551	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
2552	#include <envmap_fragment>
2553	#include <output_fragment>
2554	#include <tonemapping_fragment>
2555	#include <encodings_fragment>
2556	#include <fog_fragment>
2557	#include <premultiplied_alpha_fragment>
2558	#include <dithering_fragment>
2559}`,IO=`#define STANDARD
2560varying vec3 vViewPosition;
2561#ifdef USE_TRANSMISSION
2562	varying vec3 vWorldPosition;
2563#endif
2564#include <common>
2565#include <uv_pars_vertex>
2566#include <uv2_pars_vertex>
2567#include <displacementmap_pars_vertex>
2568#include <color_pars_vertex>
2569#include <fog_pars_vertex>
2570#include <normal_pars_vertex>
2571#include <morphtarget_pars_vertex>
2572#include <skinning_pars_vertex>
2573#include <shadowmap_pars_vertex>
2574#include <logdepthbuf_pars_vertex>
2575#include <clipping_planes_pars_vertex>
2576void main() {
2577	#include <uv_vertex>
2578	#include <uv2_vertex>
2579	#include <color_vertex>
2580	#include <morphcolor_vertex>
2581	#include <beginnormal_vertex>
2582	#include <morphnormal_vertex>
2583	#include <skinbase_vertex>
2584	#include <skinnormal_vertex>
2585	#include <defaultnormal_vertex>
2586	#include <normal_vertex>
2587	#include <begin_vertex>
2588	#include <morphtarget_vertex>
2589	#include <skinning_vertex>
2590	#include <displacementmap_vertex>
2591	#include <project_vertex>
2592	#include <logdepthbuf_vertex>
2593	#include <clipping_planes_vertex>
2594	vViewPosition = - mvPosition.xyz;
2595	#include <worldpos_vertex>
2596	#include <shadowmap_vertex>
2597	#include <fog_vertex>
2598#ifdef USE_TRANSMISSION
2599	vWorldPosition = worldPosition.xyz;
2600#endif
2601}`,OO=`#define STANDARD
2602#ifdef PHYSICAL
2603	#define IOR
2604	#define SPECULAR
2605#endif
2606uniform vec3 diffuse;
2607uniform vec3 emissive;
2608uniform float roughness;
2609uniform float metalness;
2610uniform float opacity;
2611#ifdef IOR
2612	uniform float ior;
2613#endif
2614#ifdef SPECULAR
2615	uniform float specularIntensity;
2616	uniform vec3 specularColor;
2617	#ifdef USE_SPECULARINTENSITYMAP
2618		uniform sampler2D specularIntensityMap;
2619	#endif
2620	#ifdef USE_SPECULARCOLORMAP
2621		uniform sampler2D specularColorMap;
2622	#endif
2623#endif
2624#ifdef USE_CLEARCOAT
2625	uniform float clearcoat;
2626	uniform float clearcoatRoughness;
2627#endif
2628#ifdef USE_IRIDESCENCE
2629	uniform float iridescence;
2630	uniform float iridescenceIOR;
2631	uniform float iridescenceThicknessMinimum;
2632	uniform float iridescenceThicknessMaximum;
2633#endif
2634#ifdef USE_SHEEN
2635	uniform vec3 sheenColor;
2636	uniform float sheenRoughness;
2637	#ifdef USE_SHEENCOLORMAP
2638		uniform sampler2D sheenColorMap;
2639	#endif
2640	#ifdef USE_SHEENROUGHNESSMAP
2641		uniform sampler2D sheenRoughnessMap;
2642	#endif
2643#endif
2644varying vec3 vViewPosition;
2645#include <common>
2646#include <packing>
2647#include <dithering_pars_fragment>
2648#include <color_pars_fragment>
2649#include <uv_pars_fragment>
2650#include <uv2_pars_fragment>
2651#include <map_pars_fragment>
2652#include <alphamap_pars_fragment>
2653#include <alphatest_pars_fragment>
2654#include <aomap_pars_fragment>
2655#include <lightmap_pars_fragment>
2656#include <emissivemap_pars_fragment>
2657#include <bsdfs>
2658#include <iridescence_fragment>
2659#include <cube_uv_reflection_fragment>
2660#include <envmap_common_pars_fragment>
2661#include <envmap_physical_pars_fragment>
2662#include <fog_pars_fragment>
2663#include <lights_pars_begin>
2664#include <normal_pars_fragment>
2665#include <lights_physical_pars_fragment>
2666#include <transmission_pars_fragment>
2667#include <shadowmap_pars_fragment>
2668#include <bumpmap_pars_fragment>
2669#include <normalmap_pars_fragment>
2670#include <clearcoat_pars_fragment>
2671#include <iridescence_pars_fragment>
2672#include <roughnessmap_pars_fragment>
2673#include <metalnessmap_pars_fragment>
2674#include <logdepthbuf_pars_fragment>
2675#include <clipping_planes_pars_fragment>
2676void main() {
2677	#include <clipping_planes_fragment>
2678	vec4 diffuseColor = vec4( diffuse, opacity );
2679	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2680	vec3 totalEmissiveRadiance = emissive;
2681	#include <logdepthbuf_fragment>
2682	#include <map_fragment>
2683	#include <color_fragment>
2684	#include <alphamap_fragment>
2685	#include <alphatest_fragment>
2686	#include <roughnessmap_fragment>
2687	#include <metalnessmap_fragment>
2688	#include <normal_fragment_begin>
2689	#include <normal_fragment_maps>
2690	#include <clearcoat_normal_fragment_begin>
2691	#include <clearcoat_normal_fragment_maps>
2692	#include <emissivemap_fragment>
2693	#include <lights_physical_fragment>
2694	#include <lights_fragment_begin>
2695	#include <lights_fragment_maps>
2696	#include <lights_fragment_end>
2697	#include <aomap_fragment>
2698	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
2699	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
2700	#include <transmission_fragment>
2701	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
2702	#ifdef USE_SHEEN
2703		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
2704		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;
2705	#endif
2706	#ifdef USE_CLEARCOAT
2707		float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
2708		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
2709		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;
2710	#endif
2711	#include <output_fragment>
2712	#include <tonemapping_fragment>
2713	#include <encodings_fragment>
2714	#include <fog_fragment>
2715	#include <premultiplied_alpha_fragment>
2716	#include <dithering_fragment>
2717}`,RO=`#define TOON
2718varying vec3 vViewPosition;
2719#include <common>
2720#include <uv_pars_vertex>
2721#include <uv2_pars_vertex>
2722#include <displacementmap_pars_vertex>
2723#include <color_pars_vertex>
2724#include <fog_pars_vertex>
2725#include <normal_pars_vertex>
2726#include <morphtarget_pars_vertex>
2727#include <skinning_pars_vertex>
2728#include <shadowmap_pars_vertex>
2729#include <logdepthbuf_pars_vertex>
2730#include <clipping_planes_pars_vertex>
2731void main() {
2732	#include <uv_vertex>
2733	#include <uv2_vertex>
2734	#include <color_vertex>
2735	#include <morphcolor_vertex>
2736	#include <beginnormal_vertex>
2737	#include <morphnormal_vertex>
2738	#include <skinbase_vertex>
2739	#include <skinnormal_vertex>
2740	#include <defaultnormal_vertex>
2741	#include <normal_vertex>
2742	#include <begin_vertex>
2743	#include <morphtarget_vertex>
2744	#include <skinning_vertex>
2745	#include <displacementmap_vertex>
2746	#include <project_vertex>
2747	#include <logdepthbuf_vertex>
2748	#include <clipping_planes_vertex>
2749	vViewPosition = - mvPosition.xyz;
2750	#include <worldpos_vertex>
2751	#include <shadowmap_vertex>
2752	#include <fog_vertex>
2753}`,LO=`#define TOON
2754uniform vec3 diffuse;
2755uniform vec3 emissive;
2756uniform float opacity;
2757#include <common>
2758#include <packing>
2759#include <dithering_pars_fragment>
2760#include <color_pars_fragment>
2761#include <uv_pars_fragment>
2762#include <uv2_pars_fragment>
2763#include <map_pars_fragment>
2764#include <alphamap_pars_fragment>
2765#include <alphatest_pars_fragment>
2766#include <aomap_pars_fragment>
2767#include <lightmap_pars_fragment>
2768#include <emissivemap_pars_fragment>
2769#include <gradientmap_pars_fragment>
2770#include <fog_pars_fragment>
2771#include <bsdfs>
2772#include <lights_pars_begin>
2773#include <normal_pars_fragment>
2774#include <lights_toon_pars_fragment>
2775#include <shadowmap_pars_fragment>
2776#include <bumpmap_pars_fragment>
2777#include <normalmap_pars_fragment>
2778#include <logdepthbuf_pars_fragment>
2779#include <clipping_planes_pars_fragment>
2780void main() {
2781	#include <clipping_planes_fragment>
2782	vec4 diffuseColor = vec4( diffuse, opacity );
2783	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2784	vec3 totalEmissiveRadiance = emissive;
2785	#include <logdepthbuf_fragment>
2786	#include <map_fragment>
2787	#include <color_fragment>
2788	#include <alphamap_fragment>
2789	#include <alphatest_fragment>
2790	#include <normal_fragment_begin>
2791	#include <normal_fragment_maps>
2792	#include <emissivemap_fragment>
2793	#include <lights_toon_fragment>
2794	#include <lights_fragment_begin>
2795	#include <lights_fragment_maps>
2796	#include <lights_fragment_end>
2797	#include <aomap_fragment>
2798	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2799	#include <output_fragment>
2800	#include <tonemapping_fragment>
2801	#include <encodings_fragment>
2802	#include <fog_fragment>
2803	#include <premultiplied_alpha_fragment>
2804	#include <dithering_fragment>
2805}`,BO=`uniform float size;
2806uniform float scale;
2807#include <common>
2808#include <color_pars_vertex>
2809#include <fog_pars_vertex>
2810#include <morphtarget_pars_vertex>
2811#include <logdepthbuf_pars_vertex>
2812#include <clipping_planes_pars_vertex>
2813void main() {
2814	#include <color_vertex>
2815	#include <morphcolor_vertex>
2816	#include <begin_vertex>
2817	#include <morphtarget_vertex>
2818	#include <project_vertex>
2819	gl_PointSize = size;
2820	#ifdef USE_SIZEATTENUATION
2821		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
2822		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
2823	#endif
2824	#include <logdepthbuf_vertex>
2825	#include <clipping_planes_vertex>
2826	#include <worldpos_vertex>
2827	#include <fog_vertex>
2828}`,zO=`uniform vec3 diffuse;
2829uniform float opacity;
2830#include <common>
2831#include <color_pars_fragment>
2832#include <map_particle_pars_fragment>
2833#include <alphatest_pars_fragment>
2834#include <fog_pars_fragment>
2835#include <logdepthbuf_pars_fragment>
2836#include <clipping_planes_pars_fragment>
2837void main() {
2838	#include <clipping_planes_fragment>
2839	vec3 outgoingLight = vec3( 0.0 );
2840	vec4 diffuseColor = vec4( diffuse, opacity );
2841	#include <logdepthbuf_fragment>
2842	#include <map_particle_fragment>
2843	#include <color_fragment>
2844	#include <alphatest_fragment>
2845	outgoingLight = diffuseColor.rgb;
2846	#include <output_fragment>
2847	#include <tonemapping_fragment>
2848	#include <encodings_fragment>
2849	#include <fog_fragment>
2850	#include <premultiplied_alpha_fragment>
2851}`,FO=`#include <common>
2852#include <fog_pars_vertex>
2853#include <morphtarget_pars_vertex>
2854#include <skinning_pars_vertex>
2855#include <shadowmap_pars_vertex>
2856void main() {
2857	#include <beginnormal_vertex>
2858	#include <morphnormal_vertex>
2859	#include <skinbase_vertex>
2860	#include <skinnormal_vertex>
2861	#include <defaultnormal_vertex>
2862	#include <begin_vertex>
2863	#include <morphtarget_vertex>
2864	#include <skinning_vertex>
2865	#include <project_vertex>
2866	#include <worldpos_vertex>
2867	#include <shadowmap_vertex>
2868	#include <fog_vertex>
2869}`,kO=`uniform vec3 color;
2870uniform float opacity;
2871#include <common>
2872#include <packing>
2873#include <fog_pars_fragment>
2874#include <bsdfs>
2875#include <lights_pars_begin>
2876#include <shadowmap_pars_fragment>
2877#include <shadowmask_pars_fragment>
2878void main() {
2879	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
2880	#include <tonemapping_fragment>
2881	#include <encodings_fragment>
2882	#include <fog_fragment>
2883}`,UO=`uniform float rotation;
2884uniform vec2 center;
2885#include <common>
2886#include <uv_pars_vertex>
2887#include <fog_pars_vertex>
2888#include <logdepthbuf_pars_vertex>
2889#include <clipping_planes_pars_vertex>
2890void main() {
2891	#include <uv_vertex>
2892	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
2893	vec2 scale;
2894	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
2895	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
2896	#ifndef USE_SIZEATTENUATION
2897		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
2898		if ( isPerspective ) scale *= - mvPosition.z;
2899	#endif
2900	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
2901	vec2 rotatedPosition;
2902	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
2903	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
2904	mvPosition.xy += rotatedPosition;
2905	gl_Position = projectionMatrix * mvPosition;
2906	#include <logdepthbuf_vertex>
2907	#include <clipping_planes_vertex>
2908	#include <fog_vertex>
2909}`,NO=`uniform vec3 diffuse;
2910uniform float opacity;
2911#include <common>
2912#include <uv_pars_fragment>
2913#include <map_pars_fragment>
2914#include <alphamap_pars_fragment>
2915#include <alphatest_pars_fragment>
2916#include <fog_pars_fragment>
2917#include <logdepthbuf_pars_fragment>
2918#include <clipping_planes_pars_fragment>
2919void main() {
2920	#include <clipping_planes_fragment>
2921	vec3 outgoingLight = vec3( 0.0 );
2922	vec4 diffuseColor = vec4( diffuse, opacity );
2923	#include <logdepthbuf_fragment>
2924	#include <map_fragment>
2925	#include <alphamap_fragment>
2926	#include <alphatest_fragment>
2927	outgoingLight = diffuseColor.rgb;
2928	#include <output_fragment>
2929	#include <tonemapping_fragment>
2930	#include <encodings_fragment>
2931	#include <fog_fragment>
2932}`,vt={alphamap_fragment:h3,alphamap_pars_fragment:c3,alphatest_fragment:d3,alphatest_pars_fragment:u3,aomap_fragment:p3,aomap_pars_fragment:f3,begin_vertex:m3,beginnormal_vertex:g3,bsdfs:v3,iridescence_fragment:y3,bumpmap_pars_fragment:x3,clipping_planes_fragment:b3,clipping_planes_pars_fragment:w3,clipping_planes_pars_vertex:S3,clipping_planes_vertex:_3,color_fragment:A3,color_pars_fragment:M3,color_pars_vertex:E3,color_vertex:C3,common:T3,cube_uv_reflection_fragment:P3,defaultnormal_vertex:D3,displacementmap_pars_vertex:I3,displacementmap_vertex:O3,emissivemap_fragment:R3,emissivemap_pars_fragment:L3,encodings_fragment:B3,encodings_pars_fragment:z3,envmap_fragment:F3,envmap_common_pars_fragment:k3,envmap_pars_fragment:U3,envmap_pars_vertex:N3,envmap_physical_pars_fragment:J3,envmap_vertex:V3,fog_vertex:j3,fog_pars_vertex:G3,fog_fragment:H3,fog_pars_fragment:W3,gradientmap_pars_fragment:q3,lightmap_fragment:X3,lightmap_pars_fragment:Y3,lights_lambert_fragment:Q3,lights_lambert_pars_fragment:Z3,lights_pars_begin:K3,lights_toon_fragment:$3,lights_toon_pars_fragment:eI,lights_phong_fragment:tI,lights_phong_pars_fragment:iI,lights_physical_fragment:rI,lights_physical_pars_fragment:sI,lights_fragment_begin:aI,lights_fragment_maps:nI,lights_fragment_end:oI,logdepthbuf_fragment:lI,logdepthbuf_pars_fragment:hI,logdepthbuf_pars_vertex:cI,logdepthbuf_vertex:dI,map_fragment:uI,map_pars_fragment:pI,map_particle_fragment:fI,map_particle_pars_fragment:mI,metalnessmap_fragment:gI,metalnessmap_pars_fragment:vI,morphcolor_vertex:yI,morphnormal_vertex:xI,morphtarget_pars_vertex:bI,morphtarget_vertex:wI,normal_fragment_begin:SI,normal_fragment_maps:_I,normal_pars_fragment:AI,normal_pars_vertex:MI,normal_vertex:EI,normalmap_pars_fragment:CI,clearcoat_normal_fragment_begin:TI,clearcoat_normal_fragment_maps:PI,clearcoat_pars_fragment:DI,iridescence_pars_fragment:II,output_fragment:OI,packing:RI,premultiplied_alpha_fragment:LI,project_vertex:BI,dithering_fragment:zI,dithering_pars_fragment:FI,roughnessmap_fragment:kI,roughnessmap_pars_fragment:UI,shadowmap_pars_fragment:NI,shadowmap_pars_vertex:VI,shadowmap_vertex:jI,shadowmask_pars_fragment:GI,skinbase_vertex:HI,skinning_pars_vertex:WI,skinning_vertex:qI,skinnormal_vertex:XI,specularmap_fragment:YI,specularmap_pars_fragment:QI,tonemapping_fragment:ZI,tonemapping_pars_fragment:KI,transmission_fragment:JI,transmission_pars_fragment:$I,uv_pars_fragment:eO,uv_pars_vertex:tO,uv_vertex:iO,uv2_pars_fragment:rO,uv2_pars_vertex:sO,uv2_vertex:aO,worldpos_vertex:nO,background_vert:oO,background_frag:lO,backgroundCube_vert:hO,backgroundCube_frag:cO,cube_vert:dO,cube_frag:uO,depth_vert:pO,depth_frag:fO,distanceRGBA_vert:mO,distanceRGBA_frag:gO,equirect_vert:vO,equirect_frag:yO,linedashed_vert:xO,linedashed_frag:bO,meshbasic_vert:wO,meshbasic_frag:SO,meshlambert_vert:_O,meshlambert_frag:AO,meshmatcap_vert:MO,meshmatcap_frag:EO,meshnormal_vert:CO,meshnormal_frag:TO,meshphong_vert:PO,meshphong_frag:DO,meshphysical_vert:IO,meshphysical_frag:OO,meshtoon_vert:RO,meshtoon_frag:LO,points_vert:BO,points_frag:zO,shadow_vert:FO,shadow_frag:kO,sprite_vert:UO,sprite_frag:NO},Te={common:{diffuse:{value:new $e(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Mi},uv2Transform:{value:new Mi},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}
vendor: 5,013 bytes, line 2932
2932,normalScale:{value:new j(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new $e(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 $e(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Mi}},sprite:{diffuse:{value:new $e(16777215)},opacity:{value:1},center:{value:new j(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Mi}}},aa={basic:{uniforms:Mr([Te.common,Te.specularmap,Te.envmap,Te.aomap,Te.lightmap,Te.fog]),vertexShader:vt.meshbasic_vert,fragmentShader:vt.meshbasic_frag},lambert:{uniforms:Mr([Te.common,Te.specularmap,Te.envmap,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.fog,Te.lights,{emissive:{value:new $e(0)}}]),vertexShader:vt.meshlambert_vert,fragmentShader:vt.meshlambert_frag},phong:{uniforms:Mr([Te.common,Te.specularmap,Te.envmap,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.fog,Te.lights,{emissive:{value:new $e(0)},specular:{value:new $e(1118481)},shininess:{value:30}}]),vertexShader:vt.meshphong_vert,fragmentShader:vt.meshphong_frag},standard:{uniforms:Mr([Te.common,Te.envmap,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.roughnessmap,Te.metalnessmap,Te.fog,Te.lights,{emissive:{value:new $e(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:vt.meshphysical_vert,fragmentShader:vt.meshphysical_frag},toon:{uniforms:Mr([Te.common,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.gradientmap,Te.fog,Te.lights,{emissive:{value:new $e(0)}}]),vertexShader:vt.meshtoon_vert,fragmentShader:vt.meshtoon_frag},matcap:{uniforms:Mr([Te.common,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.fog,{matcap:{value:null}}]),vertexShader:vt.meshmatcap_vert,fragmentShader:vt.meshmatcap_frag},points:{uniforms:Mr([Te.points,Te.fog]),vertexShader:vt.points_vert,fragmentShader:vt.points_frag},dashed:{uniforms:Mr([Te.common,Te.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:vt.linedashed_vert,fragmentShader:vt.linedashed_frag},depth:{uniforms:Mr([Te.common,Te.displacementmap]),vertexShader:vt.depth_vert,fragmentShader:vt.depth_frag},normal:{uniforms:Mr([Te.common,Te.bumpmap,Te.normalmap,Te.displacementmap,{opacity:{value:1}}]),vertexShader:vt.meshnormal_vert,fragmentShader:vt.meshnormal_frag},sprite:{uniforms:Mr([Te.sprite,Te.fog]),vertexShader:vt.sprite_vert,fragmentShader:vt.sprite_frag},background:{uniforms:{uvTransform:{value:new Mi},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:vt.background_vert,fragmentShader:vt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:vt.backgroundCube_vert,fragmentShader:vt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:vt.cube_vert,fragmentShader:vt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:vt.equirect_vert,fragmentShader:vt.equirect_frag},distanceRGBA:{uniforms:Mr([Te.common,Te.displacementmap,{referencePosition:{value:new M},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:vt.distanceRGBA_vert,fragmentShader:vt.distanceRGBA_frag},shadow:{uniforms:Mr([Te.lights,Te.fog,{color:{value:new $e(0)},opacity:{value:1}}]),vertexShader:vt.shadow_vert,fragmentShader:vt.shadow_frag}};aa.physical={uniforms:Mr([aa.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null}
vendor: 3,136 bytes, line 2932
2932,clearcoatNormalScale:{value:new j(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 $e(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new j},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new $e(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new $e(1,1,1)},specularColorMap:{value:null}}]),vertexShader:vt.meshphysical_vert,fragmentShader:vt.meshphysical_frag};var Kd={r:0,b:0,g:0};function VO(e,t,i,r,s,a,n){let o=new $e(0),l=a===!0?0:1,h,c,d=null,u=0,p=null;function f(m,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?g(o,l):x&&x.isColor&&(g(x,1),y=!0),(e.autoClear||y)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),x&&(x.isCubeTexture||x.mapping===fd)?(c===void 0&&(c=new Zt(new ks(1,1,1),new Pt({name:"BackgroundCubeMaterial",uniforms:dh(aa.backgroundCube.uniforms),vertexShader:aa.backgroundCube.vertexShader,fragmentShader:aa.backgroundCube.fragmentShader,side:Ki,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(b,A,_){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!==mt,(d!==x||u!==x.version||p!==e.toneMapping)&&(c.material.needsUpdate=!0,d=x,u=x.version,p=e.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null)):x&&x.isTexture&&(h===void 0&&(h=new Zt(new ga(2,2),new Pt({name:"BackgroundMaterial",uniforms:dh(aa.background.uniforms),vertexShader:aa.background.vertexShader,fragmentShader:aa.background.fragmentShader,side:zs,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!==mt,x.matrixAutoUpdate===!0&&x.updateMatrix(),h.material.uniforms.uvTransform.value.copy(x.matrix),(d!==x||u!==x.version||p!==e.toneMapping)&&(h.material.needsUpdate=!0,d=x,u=x.version,p=e.toneMapping),h.layers.enableAll(),m.unshift(h,h.geometry,h.material,0,0,null))}function g(m,v){m.getRGB(Kd,RM(e)),r.buffers.color.setClear(Kd.r,
2932Kd.g,Kd.b,v,n)}return{getClearColor:function(){return o},setClearColor:function(m,v=1){o.set(m),l=v,g(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,g(o,l)},render:f}}function jO(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=m(null),h=l,c=!1;function d(D,k,W,N,F){let Z=!1;if(n){let q=g(N,W,k);h!==q&&(h=q,p(h.object)),Z=v(D,N,W,F),Z&&y(D,N,W,F)}else{let q=k.wireframe===!0;(h.geometry!==N.id||h.program!==W.id||h.wireframe!==q)&&(h.geometry=N.id,h.program=W.id,h.wireframe=q,Z=!0)}F!==null&&i.update(F,34963),(Z||c)&&(c=!1,_(D,k,W,N),F!==null&&e.bindBuffer(34963,i.get(F).buffer))}function u(){return r.isWebGL2?e.createVertexArray():a.createVertexArrayOES()}function p(D){return r.isWebGL2?e.bindVertexArray(D):a.bindVertexArrayOES(D)}function f(D){return r.isWebGL2?e.deleteVertexArray(D):a.deleteVertexArrayOES(D)}function g(D,k,W){let N=W.wireframe===!0,F=o[D.id];F===void 0&&(F={},o[D.id]=F);let Z=F[k.id];Z===void 0&&(Z={},F[k.id]=Z);let q=Z[N];return q===void 0&&(q=m(u()),Z[N]=q),q}function m(D){let k=[],W=[],N=[];for(let F=0;F<s;F++)k[F]=0,W[F]=0,N[F]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:k,enabledAttributes:W,attributeDivisors:N,object:D,attributes:{},index:null}}function v(D,k,W,N){let F=h.attributes,Z=k.attributes,q=0,G=W.getAttributes();for(let Q in G)if(G[Q].location>=0){let ee=F[Q],Y=Z[Q];if(Y===void 0&&(Q==="instanceMatrix"&&D.instanceMatrix&&(Y=D.instanceMatrix),Q==="instanceColor"&&D.instanceColor&&(Y=D.instanceColor)),ee===void 0||ee.attribute!==Y||Y&&ee.data!==Y.data)return!0;q++}return h.attributesNum!==q||h.index!==N}function y(D,k,W,N){let F={},Z=k.attributes,q=0,G=W.getAttributes();for(let Q in G)if(G[Q].location>=0){let ee=Z[Q];ee===void 0&&(Q==="instanceMatrix"&&D.instanceMatrix&&(ee=D.instanceMatrix),Q==="instanceColor"&&D.instanceColor&&(ee=D.instanceColor));let Y={};Y.attribute=ee,ee&&ee.data&&(Y.data=ee.data),F[Q]=Y,q++}h.attributes=F,h.attributesNum=q,h.index=N}function x(){let D=h.newAttributes;for(let k=0,W=D.length;k<W;k++)D[k]=0}function w(D){S(D,0)}function S(D,k){let W=h.newAttributes,N=h.enabledAttributes,F=h.attributeDivisors;W[D]=1,N[D]===0&&(e.enableVertexAttribArray(D),N[D]=1),F[D]!==k&&((r.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](D,k),F[D]=k)}function b(){let D=h.newAttributes,k=h.enabledAttributes;for(let W=0,N=k.length;W<N;W++)k[W]!==D[W]&&(e.disableVertexAttribArray(W),k[W]=0)}function A(D,k,W,N,F,Z){r.isWebGL2===!0&&(W===5124||W===5125)?e.vertexAttribIPointer(D,k,W,F,Z):e.vertexAttribPointer(D,k,W,N,F,Z)}function _(D,k,W,N){if(r.isWebGL2===!1&&(D.isInstancedMesh||N.isInstancedBufferGeometry)&&t.get("ANGLE_instanced_arrays")===null)return;x();let F=N.attributes,Z=W.getAttributes(),q=k.defaultAttributeValues;for(let G in Z){let Q=Z[G];if(Q.location>=0){let ee=F[G];if(ee===void 0&&(G==="instanceMatrix"&&D.instanceMatrix&&(ee=D.instanceMatrix),G==="instanceColor"&&D.instanceColor&&(ee=D.instanceColor)),ee!==void 0){let Y=ee.normalized,$=ee.itemSize,H=i.get(ee);if(H===void 0)continue;let le=H.buffer,re=H.type,te=H.bytesPerElement;if(ee.isInterleavedBufferAttribute){let ae=ee.data,ce=ae.stride,ue=ee.offset;if(ae.isInstancedInterleavedBuffer){for(let xe=0;xe<Q.locationSize;xe++)S(Q.location+xe,ae.meshPerAttribute);D.isInstancedMesh!==!0&&N._maxInstanceCount===void 0&&(N._maxInstanceCount=ae.meshPerAttribute*ae.count)}else for(let xe=0;xe<Q.locationSize;xe++)w(Q.location+xe);e.bindBuffer(34962,le);for(let xe=0;xe<Q.locationSize;xe++)A(Q.location+xe,$/Q.locationSize,re,Y,ce*te,(ue+$/Q.locationSize*xe)*te)}else{if(ee.isInstancedBufferAttribute){for(let ae=0;ae<Q.locationSize;ae++)S(Q.location+ae,ee.meshPerAttribute);D.isInstancedMesh!==!0&&N._maxInstanceCount===void 0&&(N._maxInstanceCount=ee.meshPerAttribute*ee.count)}else for(let ae=0;ae<Q.locationSize;ae++)w(Q.location+ae);e.bindBuffer(34962,le);for(let ae=0;ae<Q.locationSize;ae++)A(Q.location+ae,$/Q.locationSize,re,Y,$*te,$/Q.locationSize*ae*te)}}else if(q!==void 0){let Y=q[G];if(Y!==void 0)switch(Y.length){case 2:e.vertexAttrib2fv(Q.location,Y);break;case 3:e.vertexAttrib3fv(Q.location,Y);break;case 4:e.vertexAttrib4fv(Q.location,Y);break;default:e.vertexAttrib1fv(Q.location,Y)}}}}b()}function E(){P();for(let D in o){let k=o[D];for(let W in k){let N=k[W];for(let F in N)f(N[F].object),delete N[F];delete k[W]}delete o[D]}}function C(D){if(o[D.id]===void 0)return;let k=o[D.id];for(let W in k){let N=k[W];for(let F in N)f(N[F].object),delete N[F];delete k[W]}delete o[D.id]}function T(D){for(let k in o){let W=o[k];if(W[D.id]===void 0)continue;let N=W[D.id];for(let F in N)f(N[F].object),delete N[F];delete W[D.id]}}function P(){O(),c=!0,h!==l&&(h=l,p(h.object))}function O(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:d,reset:P,resetDefaultState:O,dispose:E,releaseStatesOfGeometry:C,releaseStatesOfProgram:T,initAttributes:x,enableAttribute:w,disableUnusedAttributes:b}}function GO(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,d){if(d===0)return;let u,p;if(s)u=e,p="drawArraysInstanced";else if(u=t.get("ANGLE_instanced_arrays"),p="drawArraysInstancedANGLE",u===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_
2932instanced_arrays.");return}u[p](a,h,c,d),i.update(c,a,d)}this.setMode=n,this.render=o,this.renderInstances=l}function HO(e,t,i){let r;function s(){if(r!==void 0)return r;if(t.has("EXT_texture_filter_anisotropic")===!0){let A=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(A){if(A==="highp"){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";A="mediump"}return A==="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,d=e.getParameter(34930),u=e.getParameter(35660),p=e.getParameter(3379),f=e.getParameter(34076),g=e.getParameter(34921),m=e.getParameter(36347),v=e.getParameter(36348),y=e.getParameter(36349),x=u>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:d,maxVertexTextures:u,maxTextureSize:p,maxCubemapSize:f,maxAttributes:g,maxVertexUniforms:m,maxVaryings:v,maxFragmentUniforms:y,vertexTextures:x,floatFragmentTextures:w,floatVertexTextures:S,maxSamples:b}}function WO(e){let t=this,i=null,r=0,s=!1,a=!1,n=new Fr,o=new Mi,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,u){let p=d.length!==0||u||r!==0||s;return s=u,r=d.length,p},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(d,u){i=c(d,u,0)},this.setState=function(d,u,p){let f=d.clippingPlanes,g=d.clipIntersection,m=d.clipShadows,v=e.get(d);if(!s||f===null||f.length===0||a&&!m)a?c(null):h();else{let y=a?0:r,x=y*4,w=v.clippingState||null;l.value=w,w=c(f,u,x,p);for(let S=0;S!==x;++S)w[S]=i[S];v.clippingState=w,this.numIntersection=g?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(d,u,p,f){let g=d!==null?d.length:0,m=null;if(g!==0){if(m=l.value,f!==!0||m===null){let v=p+g*4,y=u.matrixWorldInverse;o.getNormalMatrix(y),(m===null||m.length<v)&&(m=new Float32Array(v));for(let x=0,w=p;x!==g;++x,w+=4)n.copy(d[x]).applyMatrix4(y,o),n.normal.toArray(m,w),m[w+3]=n.constant}l.value=m,l.needsUpdate=!0}return t.numPlanes=g,t.numIntersection=0,m}}function qO(e){let t=new WeakMap;function i(n,o){return o===pv?n.mapping=Vo:o===fv&&(n.mapping=jo),n}function r(n){if(n&&n.isTexture&&n.isRenderTargetTexture===!1){let o=n.mapping;if(o===pv||o===fv)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 a3(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 Pf=class extends to{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=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}
vendor: 8,518 bytes, lines 2932-3007
2932this.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}},Wl=4,Nx=[.125,.215,.35,.446,.526,.582],xo=20,Lm=new Pf,Vx=new $e,Bm=null,mo=(1+Math.sqrt(5))/2,gl=1/mo,jx=[new M(1,1,1),new M(-1,1,1),new M(1,1,-1),new M(-1,1,-1),new M(0,mo,gl),new M(0,mo,-gl),new M(gl,0,mo),new M(-gl,0,mo),new M(mo,gl,0),new M(-mo,gl,0)],Gx=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){Bm=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=qx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Wx(),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(Bm),e.scissorTest=!1,Jd(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Vo||e.mapping===jo?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Bm=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:yt,minFilter:yt,generateMipmaps:!1,type:rn,format:ri,encoding:Fs,depthBuffer:!1},r=Hx(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Hx(e,t,i);let{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=XO(s)),this._blurMaterial=YO(s,e,t)}return r}_compileMaterial(e){let t=new Zt(this._lodPlanes[0],e);this._renderer.compile(t,Lm)}_sceneToCubeUV(e,t,i,r){let s=new mr(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(Vx),o.toneMapping=ua,o.autoClear=!1;let c=new sn({name:"PMREM.Background",side:Ki,depthWrite:!1,depthTest:!1}),d=new Zt(new ks,c),u=!1,p=e.background;p?p.isColor&&(c.color.copy(p),e.background=null,u=!0):(c.color.copy(Vx),u=!0);for(let f=0;f<6;f++){let g=f%3;g===0?(s.up.set(0,a[f],0),s.lookAt(n[f],0,0)):g===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 m=this._cubeSize;Jd(r,g*m,f>2?m:0,m,m),o.setRenderTarget(r),u&&o.render(d,s),o.render(e,s)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=h,o.autoClear=l,e.background=p}_textureToCubeUV(e,t){let i=this._renderer,r=e.mapping===Vo||e.mapping===jo;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=qx()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Wx());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;Jd(t,0,0,3*o,2*o),i.setRenderTarget(t),i.render(a,Lm)}_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=jx[(r-1)%jx.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),d=l.uniforms,u=this._sizeLods[i]-1,p=isFinite(s)?Math.PI/(2*u):2*Math.PI/(2*xo-1),f=s/p,g=isFinite(s)?1+Math.floor(h*f):xo;g>xo&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${xo}`);let m=[],v=0;for(let b=0;b<xo;++b){let A=b/f,_=Math.exp(-A*A/2);m.push(_),b===0?v+=_:b<g&&(v+=2*_)}for(let b=0;b<m.length;b++)m[b]=m[b]/v;d.envMap.value=e.texture,d.samples.value=g,d.weights.value=m,d.latitudinal.value=a==="latitudinal",n&&(d.poleAxis.value=n);let{_lodMax:y}=this;d.dTheta.value=p,d.mipInt.value=y-i;let x=this._sizeLods[r],w=3*x*(r>y-Wl?r-y+Wl:0),S=4*(this._cubeSize-x);Jd(t,w,S,3*x,2*x),o.setRenderTarget(t),o.render(c,Lm)}};function XO(e){let t=[],i=[],r=[],s=e,a=e-Wl+1+Nx.length;for(let n=0;n<a;n++){let o=Math.pow(2,s);i.push(o);let l=1/o;n>e-Wl?l=Nx[n-e+Wl-1]:n===0&&(l=0),r.push(l);let h=1/(o-2),c=-h,d=1+h,u=[c,c,d,c,d,d,c,c,d,d,c,d],p=6,f=6,g=3,m=2,v=1,y=new Float32Array(g*f*p),x=new Float32Array(m*f*p),w=new Float32Array(v*f*p);for(let b=0;b<p;b++){let A=b%3*2/3-1,_=b>2?0:-1,E=[A,_,0,A+2/3,_,0,A+2/3,_+1,0,A,_,0,A+2/3,_+1,0,A,_+1,0];y.set(E,g*f*b),x.set(u,m*f*b);let C=[b,b,b,b,b,b];w.set(C,v*f*b)}let S=new je;S.setAttribute("position",new et(y,g)),S.setAttribute("uv",new et(x,m)),S.setAttribute("faceIndex",new et(w,v)),t.push(S),s>Wl&&s--}return{lodPlanes:t,sizeLods:i,sigmas:r}}function Hx(e,t,i){let r=new Tt(e,t,i);return r.texture.mapping=fd,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Jd(e,t,i,r,s){e.viewport.set(t,i,r,s),e.scissor.set(t,i,r,s)}function YO(e,t,i){let r=new Float32Array(xo),s=new M(0,1,0);return new Pt({name:"SphericalGaussianBlur",defines:{n:xo,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:Sy(),fragmentShader:`
2933
2934			precision mediump float;
2935			precision mediump int;
2936
2937			varying vec3 vOutputDirection;
2938
2939			uniform sampler2D envMap;
2940			uniform int samples;
2941			uniform float weights[ n ];
2942			uniform bool latitudinal;
2943			uniform float dTheta;
2944			uniform float mipInt;
2945			uniform vec3 poleAxis;
2946
2947			#define ENVMAP_TYPE_CUBE_UV
2948			#include <cube_uv_reflection_fragment>
2949
2950			vec3 getSample( float theta, vec3 axis ) {
2951
2952				float cosTheta = cos( theta );
2953				// Rodrigues' axis-angle rotation
2954				vec3 sampleDirection = vOutputDirection * cosTheta
2955					+ cross( axis, vOutputDirection ) * sin( theta )
2956					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
2957
2958				return bilinearCubeUV( envMap, sampleDirection, mipInt );
2959
2960			}
2961
2962			void main() {
2963
2964				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
2965
2966				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
2967
2968					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
2969
2970				}
2971
2972				axis = normalize( axis );
2973
2974				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2975				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
2976
2977				for ( int i = 1; i < n; i++ ) {
2978
2979					if ( i >= samples ) {
2980
2981						break;
2982
2983					}
2984
2985					float theta = dTheta * float( i );
2986					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
2987					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
2988
2989				}
2990
2991			}
2992		`,blending:Ci,depthTest:!1,depthWrite:!1})}function Wx(){return new Pt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Sy(),fragmentShader:`
2993
2994			precision mediump float;
2995			precision mediump int;
2996
2997			varying vec3 vOutputDirection;
2998
2999			uniform sampler2D envMap;
3000
3001			#include <common>
3002
3003			void main() {
3004
3005				vec3 outputDirection = normalize( vOutputDirection );
3006				vec2 uv = equirectUv( outputDirection );
3007
3008				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3009
3010			}
3011		`,blending:Ci,depthTest:!1,depthWrite:!1})}function qx(){return new Pt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Sy(),fragmentShader:`
3012
3013			precision mediump float;
3014			precision mediump int;
3015
3016			uniform float flipEnvMap;
3017
3018			varying vec3 vOutputDirection;
3019
3020			uniform samplerCube envMap;
3021
3022			void main() {
3023
3024				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3025
3026			}
3027		`,blending:Ci,depthTest:!1,depthWrite:!1})}function Sy(){return`
3028
3029		precision mediump float;
3030		precision mediump int;
3031
3032		attribute float faceIndex;
3033
3034		varying vec3 vOutputDirection;
3035
3036		// RH coordinate system; PMREM face-indexing convention
3037		vec3 getDirection( vec2 uv, float face ) {
3038
3039			uv = 2.0 * uv - 1.0;
3040
3041			vec3 direction = vec3( uv, 1.0 );
3042
3043			if ( face == 0.0 ) {
3044
3045				direction = direction.zyx; // ( 1, v, u ) pos x
3046
3047			} else if ( face == 1.0 ) {
3048
3049				direction = direction.xzy;
3050				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3051
3052			} else if ( face == 2.0 ) {
3053
3054				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3055
3056			} else if ( face == 3.0 ) {
3057
3058				direction = direction.zyx;
3059				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3060
3061			} else if ( face == 4.0 ) {
3062
3063				direction = direction.xzy;
3064				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3065
3066			} else if ( face == 5.0 ) {
3067
3068				direction.z *= -1.0; // ( u, v, -1 ) neg z
3069
3070			}
3071
3072			return direction;
3073
3074		}
3075
3076		void main() {
3077
3078			vOutputDirection = getDirection( uv, faceIndex );
3079			gl_Position = vec4( position, 1.0 );
3080
3081		}
3082	`}function QO(e){let t=new WeakMap,i=null;function r(o){if(o&&o.isTexture){let l=o.mapping,h=l===pv||l===fv,c=l===Vo||l===jo;if(h||c)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let d=t.get(o);return i===null&&(i=new Gx(e)),d=h?i.fromEquirectangular(o,d):i.fromCubemap(o,d),t.set(o,d),d.texture}else{if(t.has(o))return t.get(o).texture;{let d=o.image;if(h&&d&&d.height>0||c&&d&&s(d)){i===null&&(i=new Gx(e));let u=h?i.fromEquirectangular(o):i.fromCubemap(o);return t.set(o,u),o.addEventListener("dispose",a),u.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 ZO(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 KO(e,t,i,r){let s={},a=new WeakMap;function n(d){let u=d.target;u.index!==null&&t.remove(u.index);for(let f in u.attributes)t.remove(u.attributes[f]);u.removeEventListener("dispose",n),delete s[u.id];let p=a.get(u);p&&(t.remove(p),a.delete(u)),r.releaseStatesOfGeometry(u),u.isInstancedBufferGeometry===!0&&delete u._maxInstanceCount,i.memory.geometries--}function o(d,u){return s[u.id]===!0||(u.addEventListener("dispose",n),s[u.id]=!0,i.memory.geometries++),u}function l(d){let u=d.attributes;for(let f in u)t.update(u[f],34962);let p=d.morphAttributes;for(let f in p){let g=p[f];for(let m=0,v=g.length;m<v;m++)t.update(g[m],34962)}}function h(d){let u=[],p=d.index,f=d.attributes.position,g=0;if(p!==null){let y=p.array;g=p.version;for(let x=0,w=y.length;x<w;x+=3){let S=y[x+0],b=y[x+1],A=y[x+2];u.push(S,b,b,A,A,S)}}else{let y=f.array;g=f.version;for(let x=0,w=y.length/3-1;x<w;x+=3){let S=x+0,b=x+1,A=x+2;u.push(S,b,b,A,A,S)}}let m=new(EM(u)?Zl:OM)(u,1);m.version=g;let v=a.get(d);v&&t.remove(v),a.set(d,m)}function c(d){let u=a.get(d);if(u){let p=d.index;p!==null&&u.version<p.version&&h(d)}else h(d);return a.get(d)}return{get:o,update:l,getWireframeAttribute:c}}function JO(e,t,i,r){let s=r.isWebGL2,a;function n(u){a=u}let o,l;function h(u){o=u.type,l=u.bytesPerElement}function c(u,p){e.drawElements(a,p,o,u*l),i.update(p,a,1)}function d(u,p,f){if(f===0)return;let g,m;if(s)g=e,m="drawElementsInstanced";else if(g=t.get("ANGLE_instanced_arrays"),m="drawElementsInstancedANGLE",g===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_
3082instanced_arrays.");return}g[m](a,p,o,u*l,f),i.update(p,a,f)}this.setMode=n,this.setIndex=h,this.render=c,this.renderInstances=d}function $O(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 eR(e,t){return e[0]-t[0]}function tR(e,t){return Math.abs(t[1])-Math.abs(e[1])}function iR(e,t,i){let r={},s=new Float32Array(8),a=new WeakMap,n=new ht,o=[];for(let h=0;h<8;h++)o[h]=[h,0];function l(h,c,d,u){let p=h.morphTargetInfluences;if(t.isWebGL2===!0){let f=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,g=f!==void 0?f.length:0,m=a.get(c);if(m===void 0||m.count!==g){let x=function(){D.dispose(),a.delete(c),c.removeEventListener("dispose",x)};m!==void 0&&m.texture.dispose();let w=c.morphAttributes.position!==void 0,S=c.morphAttributes.normal!==void 0,b=c.morphAttributes.color!==void 0,A=c.morphAttributes.position||[],_=c.morphAttributes.normal||[],E=c.morphAttributes.color||[],C=0;w===!0&&(C=1),S===!0&&(C=2),b===!0&&(C=3);let T=c.attributes.position.count*C,P=1;T>t.maxTextureSize&&(P=Math.ceil(T/t.maxTextureSize),T=t.maxTextureSize);let O=new Float32Array(T*P*4*g),D=new DM(O,T,P,g);D.type=Vt,D.needsUpdate=!0;let k=C*4;for(let W=0;W<g;W++){let N=A[W],F=_[W],Z=E[W],q=T*P*4*W;for(let G=0;G<N.count;G++){let Q=G*k;w===!0&&(n.fromBufferAttribute(N,G),O[q+Q+0]=n.x,O[q+Q+1]=n.y,O[q+Q+2]=n.z,O[q+Q+3]=0),S===!0&&(n.fromBufferAttribute(F,G),O[q+Q+4]=n.x,O[q+Q+5]=n.y,O[q+Q+6]=n.z,O[q+Q+7]=0),b===!0&&(n.fromBufferAttribute(Z,G),O[q+Q+8]=n.x,O[q+Q+9]=n.y,O[q+Q+10]=n.z,O[q+Q+11]=Z.itemSize===4?n.w:1)}}m={count:g,texture:D,size:new j(T,P)},a.set(c,m),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;u.getUniforms().setValue(e,"morphTargetBaseInfluence",y),u.getUniforms().setValue(e,"morphTargetInfluences",p),u.getUniforms().setValue(e,"morphTargetsTexture",m.texture,i),u.getUniforms().setValue(e,"morphTargetsTextureSize",m.size)}else{let f=p===void 0?0:p.length,g=r[c.id];if(g===void 0||g.length!==f){g=[];for(let w=0;w<f;w++)g[w]=[w,0];r[c.id]=g}for(let w=0;w<f;w++){let S=g[w];S[0]=w,S[1]=p[w]}g.sort(tR);for(let w=0;w<8;w++)w<f&&g[w][1]?(o[w][0]=g[w][0],o[w][1]=g[w][1]):(o[w][0]=Number.MAX_SAFE_INTEGER,o[w][1]=0);o.sort(eR);let m=c.morphAttributes.position,v=c.morphAttributes.normal,y=0;for(let w=0;w<8;w++){let S=o[w],b=S[0],A=S[1];b!==Number.MAX_SAFE_INTEGER&&A?(m&&c.getAttribute("morphTarget"+w)!==m[b]&&c.setAttribute("morphTarget"+w,m[b]),v&&c.getAttribute("morphNormal"+w)!==v[b]&&c.setAttribute("morphNormal"+w,v[b]),s[w]=A,y+=A):(m&&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;u.getUniforms().setValue(e,"morphTargetBaseInfluence",x),u.getUniforms().setValue(e,"morphTargetInfluences",s)}}return{update:l}}function rR(e,t,i,r){let s=new WeakMap;function a(l){let h=r.render.frame,c=l.geometry,d=t.get(l,c);return s.get(d)!==h&&(t.update(d),s.set(d,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)),d}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 BM=new oi,zM=new DM,FM=new HD,kM=new by,Xx=[],Yx=[],Qx=new Float32Array(16),Zx=new Float32Array(9),Kx=new Float32Array(4);function Th(e,t,i){let r=e[0];if(r==null||r<=0||r>0)return e;let s=t*i,a=Xx[s];if(a===void 0&&(a=new Float32Array(s),Xx[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 Ui(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 Ni(e,t){for(let i=0,r=t.length;i<r;i++)e[i]=t[i]}function Df(e,t){let i=Yx[t];i===void 0&&(i=new Int32Array(t),Yx[t]=i);for(let r=0;r!==t;++r)i[r]=e.allocateTextureUnit();return i}function sR(e,t){let i=this.cache;i[0]!==t&&(e.uniform1f(this.addr,t),i[0]=t)}function aR(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(Ui(i,t))return;e.uniform2fv(this.addr,t),Ni(i,t)}}function nR(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(Ui(i,t))return;e.uniform3fv(this.addr,t),Ni(i,t)}}function oR(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(Ui(i,t))return;e.uniform4fv(this.addr,t),Ni(i,t)}}function lR(e,t){let i=this.cache,r=t.elements;if(r===void 0){if(Ui(i,t))return;e.uniformMatrix2fv(this.addr,!1,t),Ni(i,t)}else{if(Ui(i,r))return;Kx.set(r),e.uniformMatrix2fv(this.addr,!1,Kx),Ni(i,r)}}function hR(e,t){let i=this.cache,r=t.elements;if(r===void 0){if(Ui(i,t))return;e.uniformMatrix3fv(this.addr,!1,t),Ni(i,t)}else{if(Ui(i,r))return;Zx.set(r),e.uniformMatrix3fv(this.addr,!1,Zx),Ni(i,r)}}function cR(e,t){let i=this.cache,r=t.elements;if(r===void 0){if(Ui(i,t))return;e.uniformMatrix4fv(this.addr,!1,t),Ni(i,t)}else{if(Ui(i,r))return;Qx.set(r),e.uniformMatrix4fv(this.addr,!1,Qx),Ni(i,r)}}function dR(e,t){let i=this.cache;i[0]!==t&&(e.uniform1i(this.addr,t),i[0]=t)}function uR(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(Ui(i,t))return;e.uniform2iv(this.addr,t),Ni(i,t)}}function pR(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(Ui(i,t))return;e.uniform3iv(this.addr,t),Ni(i,t)}}function fR(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(Ui(i,t))return;e.uniform4iv(this.addr,t),Ni(i,t)}}function mR(e,t){let i=this.cache;i[0]!==t&&(e.uniform1ui(this.addr,t),i[0]=t)}function gR(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(Ui(i,t))return;e.uniform2uiv(this.addr,t),Ni(i,t)}}function vR(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(Ui(i,t))return;e.uniform3uiv(this.addr,t),Ni(i,t)}}function yR(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(Ui(i,t))return;e.uniform4uiv(this.addr,t),Ni(i,t)}}function xR(e,t,i){let r=this.cache,s=i.allocateTextureUnit();r[0]!==s&&(e.uniform1i(this.addr,s),r[0]=s),i.setTexture2D(t||BM,s)}function bR(e,t,i){let r=this.cache,s=i.allocateTextureUnit();r[0]!==s&&(e.uniform1i(this.addr,s),r[0]=s),i.setTexture3D(t||FM,s)}function wR(e,t,i){let r=this.cache,s=i.allocateTextureUnit();r[0]!==s&&(e.uniform1i(this.addr,s),r[0]=s),i.setTextureCube(t||kM,s)}function SR(e,t,i){let r=this.cache,s=i.allocateTextureUnit();r[0]!==s&&(e.uniform1i(this.addr,s),r[0]=s),i.setTexture2DArray(t||zM,s)}function _R(e){switch(e){case 5126:return sR;case 35664:return aR;case 35665:return nR;case 35666:return oR;case 35674:return lR;case 35675:return hR;case 35676:return cR;case 5124:case 35670:return dR;case 35667:case 35671:return uR;case 35668:case 35672:return pR;case 35669:case 35673:return fR;case 5125:return mR;case 36294:return gR;case 36295:return vR;case 36296:return yR;case 35678:case 36198:case 36298:case 36306:case 35682:return xR;case 35679:case 36299:case 36307:return bR;case 35680:case 36300:case 36308:case 36293:return wR;case 36289:case 36303:case 36311:case 36292:return SR}}function AR(e,t){e.uniform1fv(this.addr,t)}function MR(e,t){let i=Th(t,this.size,2);e.uniform2fv(this.addr,i)}function ER(e,t){let i=Th(t,this.size,3);e.uniform3fv(this.addr,i)}function CR(e,t){let i=Th(t,this.size,4);e.uniform4fv(this.addr,i)}function TR(e,t){let i=Th(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,i)}function PR(e,t){let i=Th(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,i)}function DR(e,t){let i=Th(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,i)}function IR(e,t){e.uniform1iv(this.addr,t)}function OR(e,t){e.uniform2iv(this.addr,t)}function RR(e,t){e.uniform3iv(this.addr,t)}function LR(e,t){e.uniform4iv(this.addr,t)}function BR(e,t){e.uniform1uiv(this.addr,t)}function zR(e,t){e.uniform2uiv(this.addr,t)}function FR(e,t){e.uniform3uiv(this.addr,t)}function kR(e,t){e.uniform4uiv(this.addr,t)}function UR(e,t,i){let r=this.cache,s=t.length,a=Df(i,s);Ui(r,a)||(e.uniform1iv(this.addr,a),Ni(r,a));for(let n=0;n!==s;++n)i.setTexture2D(t[n]||BM,a[n])}function NR(e,t,i){let r=this.cache,s=t.length,a=Df(i,s);Ui(r,a)||(e.uniform1iv(this.addr,a),Ni(r,a));for(let n=0;n!==s;++n)i.setTexture3D(t[n]||FM,a[n])}function VR(e,t,i){let r=this.cache,s=t.length,a=Df(i,s);Ui(r,a)||(e.uniform1iv(this.addr,a),Ni(r,a));for(let n=0;n!==s;++n)i.setTextureCube(t[n]||kM,a[n])}function jR(e,t,i){let r=this.cache,s=t.length,a=Df(i,s);Ui(r,a)||(e.uniform1iv(this.addr,a),Ni(r,a));for(let n=0;n!==s;++n)i.setTexture2DArray(t[n]||zM,a[n])}function GR(e){switch(e){case 5126:return AR;case 35664:return MR;case 35665:return ER;case 35666:return CR;case 35674:return TR;case 35675:return PR;case 35676:return DR;case 5124:case 35670:return IR;case 35667:case 35671:return OR;case 35668:case 35672:return RR;case 35669:case 35673:return LR;case 5125:return BR;case 36294:return zR;case 36295:return FR;case 36296:return kR;case 35678:case 36198:case 36298:case 36306:case 35682:return UR;case 35679:case 36299:case 36307:return NR;case 35680:case 36300:case 36308:case 36293:return VR;case 36289:case 36303:case 36311:case 36292:return jR}}var HR=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.setValue=_R(t.type)}},WR=class{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.size=t.size,this.setValue=GR(t.type)}},qR=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)}}},zm=/(\w+)(\])?(\[|\.)?/g;function Jx(e,t){e.seq.push(t),e.map[t.id]=t}function XR(e,t,i){let r=e.name,s=r.length;for(zm.lastIndex=0;;){let a=zm.exec(r),n=zm.lastIndex,o=a[1],l=a[2]==="]",h=a[3];if(l&&(o=o|0),h===void 0||h==="["&&n+2===s){Jx(i,h===void 0?new HR(o,e,t):new WR(o,e,t));break}else{let c=i.map[o];c===void 0&&(c=new qR(o),Jx(i,c)),i=c}}}var np=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);XR(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 $x(e,t,i){let r=e.createShader(t);return e.shaderSource(r,i),e.compileShader(r),r}var YR=0;function QR(e,t){let i=e.split(`
3083`),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(`
3084`)}function ZR(e){switch(e){case Fs:return["Linear","( value )"];case mt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"]}}function eb(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()+`
3085
3086`+s+`
3087
3088`+QR(e.getShaderSource(t),n)}else return s}function KR(e,t){let i=ZR(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function JR(e,t){let i;switch(t){case aD:i="Linear";break;case nD:i="Reinhard";break;case oD:i="OptimizedCineon";break;case lD:i="ACESFilmic";break;case hD:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),i="Linear"}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function $R(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(bc).join(`
3089`)}function eL(e){let t=[];for(let i in e){let r=e[i];r!==!1&&t.push("#define "+i+" "+r)}return t.join(`
3090`)}function tL(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 bc(e){return e!==""}function tb(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,515 bytes, lines 3090-3101
3090IGHTS/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 ib(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var iL=/^[ \t]*#include +<([\w\d./]+)>/gm;function bv(e){return e.replace(iL,rL)}function rL(e,t){let i=vt[t];if(i===void 0)throw new Error("Can not resolve #include <"+t+">");return bv(i)}var sL=/#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 rb(e){return e.replace(sL,aL)}function aL(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 sb(e){let t="precision "+e.precision+` float;
3091precision `+e.precision+" int;";return e.precision==="highp"?t+=`
3092#define HIGH_PRECISION`:e.precision==="mediump"?t+=`
3093#define MEDIUM_PRECISION`:e.precision==="lowp"&&(t+=`
3094#define LOW_PRECISION`),t}function nL(e){let t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===my?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===FP?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===xc&&(t="SHADOWMAP_TYPE_VSM"),t}function oL(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case Vo:case jo:t="ENVMAP_TYPE_CUBE";break;case fd:t="ENVMAP_TYPE_CUBE_UV";break}return t}function lL(e){let t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case jo:t="ENVMAP_MODE_REFRACTION";break}return t}function hL(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case yM:t="ENVMAP_BLENDING_MULTIPLY";break;case rD:t="ENVMAP_BLENDING_MIX";break;case sD:t="ENVMAP_BLENDING_ADD";break}return t}function cL(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),7*16)),texelHeight:r,maxMip:i}}function dL(e,t,i,r){let s=e.getContext(),a=i.defines,n=i.vertexShader,o=i.fragmentShader,l=nL(i),h=oL(i),c=lL(i),d=hL(i),u=cL(i),p=i.isWebGL2?"":$R(i),f=eL(a),g=s.createProgram(),m,v,y=i.glslVersion?"#version "+i.glslVersion+`
3095`:"";i.isRawShaderMaterial?(m=[f].filter(bc).join(`
3096`),m.length>0&&(m+=`
3097`),v=[p,f].filter(bc).join(`
3098`),v.length>0&&(v+=`
3099`)):(m=[sb(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",`
3100`].filter(bc).join(`
3101`),v=[p,sb(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 "+d:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.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
3101IDESCENCE":"",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!==ua?"#define TONE_MAPPING":"",i.toneMapping!==ua?vt.tonemapping_pars_fragment:"",i.toneMapping!==ua?JR("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",vt.encodings_pars_fragment,KR("linearToOutputTexel",i.outputEncoding),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"",`
3102`].filter(bc).join(`
3103`)),n=bv(n),n=tb(n,i),n=ib(n,i),o=bv(o),o=tb(o,i),o=ib(o,i),n=rb(n),o=rb(o),i.isWebGL2&&i.isRawShaderMaterial!==!0&&(y=`#version 300 es
3104`,m=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
3105`)+`
3106`+m,v=["#define varying in",i.glslVersion===vv?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===vv?"":"#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(`
3107`)+`
3108`+v);let x=y+m+n,w=y+v+o,S=$x(s,35633,x),b=$x(s,35632,w);if(s.attachShader(g,S),s.attachShader(g,b),i.index0AttributeName!==void 0?s.bindAttribLocation(g,0,i.index0AttributeName):i.morphTargets===!0&&s.bindAttribLocation(g,0,"position"),s.linkProgram(g),e.debug.checkShaderErrors){let E=s.getProgramInfoLog(g).trim(),C=s.getShaderInfoLog(S).trim(),T=s.getShaderInfoLog(b).trim(),P=!0,O=!0;
3108if(s.getProgramParameter(g,35714)===!1){P=!1;let D=eb(s,S,"vertex"),k=eb(s,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(g,35715)+`
3109
3110Program Info Log: `+E+`
3111`+D+`
3112`+k)}else E!==""?console.warn("THREE.WebGLProgram: Program Info Log:",E):(C===""||T==="")&&(O=!1);O&&(this.diagnostics={runnable:P,programLog:E,vertexShader:{log:C,prefix:m},fragmentShader:{log:T,prefix:v}})}s.deleteShader(S),s.deleteShader(b);let A;this.getUniforms=function(){return A===void 0&&(A=new np(s,g)),A};let _;return this.getAttributes=function(){return _===void 0&&(_=tL(s,g)),_},this.destroy=function(){r.releaseStatesOfProgram(this),s.deleteProgram(g),this.program=void 0},this.name=i.shaderName,this.id=YR++,this.cacheKey=t,this.usedTimes=1,this.program=g,this.vertexShader=S,this.fragmentShader=b,this}var uL=0,pL=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 fL(e),t.set(e,i)),i}},fL=class{constructor(e){this.id=uL++,this.code=e,this.usedTimes=0}};function mL(e,t,i,r,s,a,n){let o=new xy,l=new pL,h=[],c=s.isWebGL2,d=s.logarithmicDepthBuffer,u=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 g(_,E,C,T,P){let O=T.fog,D=P.geometry,k=_.isMeshStandardMaterial?T.environment:null,W=(_.isMeshStandardMaterial?i:t).get(_.envMap||k),N=W&&W.mapping===fd?W.image.height:null,F=f[_.type];_.precision!==null&&(p=s.getMaxPrecision(_.precision),p!==_.precision&&console.warn("THREE.WebGLProgram.getParameters:",_.precision,"not supported, using",p,"instead."));let Z=D.morphAttributes.position||D.morphAttributes.normal||D.morphAttributes.color,q=Z!==void 0?Z.length:0,G=0;D.morphAttributes.position!==void 0&&(G=1),D.morphAttributes.normal!==void 0&&(G=2),D.morphAttributes.color!==void 0&&(G=3);let Q,ee,Y,$;if(F){let ae=aa[F];Q=ae.vertexShader,ee=ae.fragmentShader}else Q=_.vertexShader,ee=_.fragmentShader,l.update(_),Y=l.getVertexShaderID(_),$=l.getFragmentShaderID(_);let H=e.getRenderTarget(),le=_.alphaTest>0,re=_.clearcoat>0,te=_.iridescence>0;return{isWebGL2:c,shaderID:F,shaderName:_.type,vertexShader:Q,fragmentShader:ee,defines:_.defines,customVertexShaderID:Y,customFragmentShaderID:$,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:p,instancing:P.isInstancedMesh===!0,instancingColor:P.isInstancedMesh===!0&&P.instanceColor!==null,supportsVertexTextures:u,outputEncoding:H===null?e.outputEncoding:H.isXRRenderTarget===!0?H.texture.encoding:Fs,map:!!_.map,matcap:!!_.matcap,envMap:!!W,envMapMode:W&&W.mapping,envMapCubeUVHeight:N,lightMap:!!_.lightMap,aoMap:!!_.aoMap,emissiveMap:!!_.emissiveMap,bumpMap:!!_.bumpMap,normalMap:!!_.normalMap,objectSpaceNormalMap:_.normalMapType===MD,tangentSpaceNormalMap:_.normalMapType===AD,decodeVideoTexture:!!_.map&&_.map.isVideoTexture===!0&&_.map.encoding===mt,clearcoat:re,clearcoatMap:re&&!!_.clearcoatMap,clearcoatRoughnessMap:re&&!!_.clearcoatRoughnessMap,clearcoatNormalMap:re&&!!_.clearcoatNormalMap,iridescence:te,iridescenceMap:te&&!!_.iridescenceMap,iridescenceThicknessMap:te&&!!_.iridescenceThicknessMap,displacementMap:!!_.displacementMap,roughnessMap:!!_.roughnessMap,metalnessMap:!!_.metalnessMap,specularMap:!!_.specularMap,specularIntensityMap:!!_.specularIntensityMap,specularColorMap:!!_.specularColorMap,opaque:_.transparent===!1&&_.blending===Lo,alph
vendor: 6,280 bytes, line 3112
3112aMap:!!_.alphaMap,alphaTest:le,gradientMap:!!_.gradientMap,sheen:_.sheen>0,sheenColorMap:!!_.sheenColorMap,sheenRoughnessMap:!!_.sheenRoughnessMap,transmission:_.transmission>0,transmissionMap:!!_.transmissionMap,thicknessMap:!!_.thicknessMap,combine:_.combine,vertexTangents:!!_.normalMap&&!!D.attributes.tangent,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&!!D.attributes.color&&D.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:!!O,useFog:_.fog===!0,fogExp2:O&&O.isFogExp2,flatShading:!!_.flatShading,sizeAttenuation:_.sizeAttenuation,logarithmicDepthBuffer:d,skinning:P.isSkinnedMesh===!0,morphTargets:D.morphAttributes.position!==void 0,morphNormals:D.morphAttributes.normal!==void 0,morphColors:D.morphAttributes.color!==void 0,morphTargetsCount:q,morphTextureStride:G,numDirLights:E.directional.length,numPointLights:E.point.length,numSpotLights:E.spot.length,numSpotLightMaps:E.spotLightMap.length,numRectAreaLights:E.rectArea.length,numHemiLights:E.hemi.length,numDirLightShadows:E.directionalShadowMap.length,numPointLightShadows:E.pointShadowMap.length,numSpotLightShadows:E.spotShadowMap.length,numSpotLightShadowsWithMaps:E.numSpotLightShadowsWithMaps,numClippingPlanes:n.numPlanes,numClipIntersection:n.numIntersection,dithering:_.dithering,shadowMapEnabled:e.shadowMap.enabled&&C.length>0,shadowMapType:e.shadowMap.type,toneMapping:_.toneMapped?e.toneMapping:ua,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:_.premultipliedAlpha,doubleSided:_.side===vr,flipSided:_.side===Ki,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 m(_){let E=[];if(_.shaderID?E.push(_.shaderID):(E.push(_.customVertexShaderID),E.push(_.customFragmentShaderID)),_.defines!==void 0)for(let C in _.defines)E.push(C),E.push(_.defines[C]);return _.isRawShaderMaterial===!1&&(v(E,_),y(E,_),E.push(e.outputEncoding)),E.push(_.customProgramCacheKey),E.join()}function v(_,E){_.push(E.precision),_.push(E.outputEncoding),_.push(E.envMapMode),_.push(E.envMapCubeUVHeight),_.push(E.combine),_.push(E.vertexUvs),_.push(E.fogExp2),_.push(E.sizeAttenuation),_.push(E.morphTargetsCount),_.push(E.morphAttributeCount),_.push(E.numDirLights),_.push(E.numPointLights),_.push(E.numSpotLights),_.push(E.numSpotLightMaps),_.push(E.numHemiLights),_.push(E.numRectAreaLights),_.push(E.numDirLightShadows),_.push(E.numPointLightShadows),_.push(E.numSpotLightShadows),_.push(E.numSpotLightShadowsWithMaps),_.push(E.shadowMapType),_.push(E.toneMapping),_.push(E.numClippingPlanes),_.push(E.numClipIntersection),_.push(E.depthPacking)}function y(_,E){o.disableAll(),E.isWebGL2&&o.enable(0),E.supportsVertexTextures&&o.enable(1),E.instancing&&o.enable(2),E.instancingColor&&o.enable(3),E.map&&o.enable(4),E.matcap&&o.enable(5),E.envMap&&o.enable(6),E.lightMap&&o.enable(7),E.aoMap&&o.enable(8),E.emissiveMap&&o.enable(9),E.bumpMap&&o.enable(10),E.normalMap&&o.enable(11),E.objectSpaceNormalMap&&o.enable(12),E.tangentSpaceNormalMap&&o.enable(13),E.clearcoat&&o.enable(14),E.clearcoatMap&&o.enable(15),E.clearcoatRoughnessMap&&o.enable(16),E.clearcoatNormalMap&&o.enable(17),E.iridescence&&o.enable(18),E.iridescenceMap&&o.enable(19),E.iridescenceThicknessMap&&o.enable(20),E.displacementMap&&o.enable(21),E.specularMap&&o.enable(22),E.roughnessMap&&o.enable(23),E.metalnessMap&&o.enable(24),E.gradientMap&&o.enable(25),E.alphaMap&&o.enable(26),E.alphaTest&&o.enable(27),E.vertexColors&&o.enable(28),E.vertexAlphas&&o.enable(29),E.vertexUvs&&o.enable(30),E.vertexTangents&&o.enable(31),E.uvsVertexOnly&&o.enable(32),_.push(o.mask),o.disableAll(),E.fog&&o.enable(0),E.useFog&&o.enable(1),E.flatShading&&o.enable(2),E.logarithmicDepthBuffer&&o.enable(3),E.skinning&&o.enable(4),E.morphTargets&&o.enable(5),E.morphNormals&&o.enable(6),E.morphColors&&o.enable(7),E.premultipliedAlpha&&o.enable(8),E.shadowMapEnabled&&o.enable(9),E.physicallyCorrectLights&&o.enable(10),E.doubleSided&&o.enable(11),E.flipSided&&o.enable(12),E.useDepthPacking&&o.enable(13),E.dithering&&o.enable(14),E.specularIntensityMap&&o.enable(15),E.specularColorMap&&o.enable(16),E.transmission&&o.enable(17),E.transmissionMap&&o.enable(18),E.thicknessMap&&o.enable(19),E.sheen&&o.enable(20),E.sheenColorMap&&o.enable(21),E.sheenRoughnessMap&&o.enable(22),E.decodeVideoTexture&&o.enable(23),E.opaque&&o.enable(24),_.push(o.mask)}function x(_){let E=f[_.type],C;if(E){let T=aa[E];C=Ch.clone(T.uniforms)}else C=_.uniforms;return C}function w(_,E){let C;for(let T=0,P=h.length;T<P;T++){let O=h[T];if(O.cacheKey===E){C=O,++C.usedTimes;break}}return C===void 0&&(C=new dL(e,E,_,a),h.push(C)),C}function S(_){if(--_.usedTimes===0){let E=h.indexOf(_);h[E]=h[h.length-1],h.pop(),_.destroy()}}function b(_){l.remove(_)}function A(){l.dispose()}return{getParameters:g,getProgramCacheKey:m,getUniforms:x,acquireProgram:w,releaseProgram:S,releaseShaderCache:b,programs:h,dispose:A}}function gL(){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}
vendor: 9,632 bytes, lines 3112-3118
3112function s(){e=new WeakMap}return{get:t,remove:i,update:r,dispose:s}}function vL(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 ab(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 nb(){let e=[],t=0,i=[],r=[],s=[];function a(){t=0,i.length=0,r.length=0,s.length=0}function n(d,u,p,f,g,m){let v=e[t];return v===void 0?(v={id:d.id,object:d,geometry:u,material:p,groupOrder:f,renderOrder:d.renderOrder,z:g,group:m},e[t]=v):(v.id=d.id,v.object=d,v.geometry=u,v.material=p,v.groupOrder=f,v.renderOrder=d.renderOrder,v.z=g,v.group=m),t++,v}function o(d,u,p,f,g,m){let v=n(d,u,p,f,g,m);p.transmission>0?r.push(v):p.transparent===!0?s.push(v):i.push(v)}function l(d,u,p,f,g,m){let v=n(d,u,p,f,g,m);p.transmission>0?r.unshift(v):p.transparent===!0?s.unshift(v):i.unshift(v)}function h(d,u){i.length>1&&i.sort(d||vL),r.length>1&&r.sort(u||ab),s.length>1&&s.sort(u||ab)}function c(){for(let d=t,u=e.length;d<u;d++){let p=e[d];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 yL(){let e=new WeakMap;function t(r,s){let a=e.get(r),n;return a===void 0?(n=new nb,e.set(r,[n])):s>=a.length?(n=new nb,a.push(n)):n=a[s],n}function i(){e=new WeakMap}return{get:t,dispose:i}}function xL(){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 $e};break;case"SpotLight":i={position:new M,direction:new M,color:new $e,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new M,color:new $e,distance:0,decay:0};break;case"HemisphereLight":i={direction:new M,skyColor:new $e,groundColor:new $e};break;case"RectAreaLight":i={color:new $e,position:new M,halfWidth:new M,halfHeight:new M};break}return e[t.id]=i,i}}}function bL(){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 j};break;case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new j};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new j,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=i,i}}}var wL=0;function SL(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function _L(e,t){let i=new xL,r=bL(),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 be,o=new be;function l(c,d){let u=0,p=0,f=0;for(let T=0;T<9;T++)s.probe[T].set(0,0,0);let g=0,m=0,v=0,y=0,x=0,w=0,S=0,b=0,A=0,_=0;c.sort(SL);let E=d!==!0?Math.PI:1;for(let T=0,P=c.length;T<P;T++){let O=c[T],D=O.color,k=O.intensity,W=O.distance,N=O.shadow&&O.shadow.map?O.shadow.map.texture:null;if(O.isAmbientLight)u+=D.r*k*E,p+=D.g*k*E,f+=D.b*k*E;else if(O.isLightProbe)for(let F=0;F<9;F++)s.probe[F].addScaledVector(O.sh.coefficients[F],k);else if(O.isDirectionalLight){let F=i.get(O);if(F.color.copy(O.color).multiplyScalar(O.intensity*E),O.castShadow){let Z=O.shadow,q=r.get(O);q.shadowBias=Z.bias,q.shadowNormalBias=Z.normalBias,q.shadowRadius=Z.radius,q.shadowMapSize=Z.mapSize,s.directionalShadow[g]=q,s.directionalShadowMap[g]=N,s.directionalShadowMatrix[g]=O.shadow.matrix,w++}s.directional[g]=F,g++}else if(O.isSpotLight){let F=i.get(O);F.position.setFromMatrixPosition(O.matrixWorld),F.color.copy(D).multiplyScalar(k*E),F.distance=W,F.coneCos=Math.cos(O.angle),F.penumbraCos=Math.cos(O.angle*(1-O.penumbra)),F.decay=O.decay,s.spot[v]=F;let Z=O.shadow;if(O.map&&(s.spotLightMap[A]=O.map,A++,Z.updateMatrices(O),O.castShadow&&_++),s.spotLightMatrix[v]=Z.matrix,O.castShadow){let q=r.get(O);q.shadowBias=Z.bias,q.shadowNormalBias=Z.normalBias,q.shadowRadius=Z.radius,q.shadowMapSize=Z.mapSize,s.spotShadow[v]=q,s.spotShadowMap[v]=N,b++}v++}else if(O.isRectAreaLight){let F=i.get(O);F.color.copy(D).multiplyScalar(k),F.halfWidth.set(O.width*.5,0,0),F.halfHeight.set(0,O.height*.5,0),s.rectArea[y]=F,y++}else if(O.isPointLight){let F=i.get(O);if(F.color.copy(O.color).multiplyScalar(O.intensity*E),F.distance=O.distance,F.decay=O.decay,O.castShadow){let Z=O.shadow,q=r.get(O);q.shadowBias=Z.bias,q.shadowNormalBias=Z.normalBias,q.shadowRadius=Z.radius,q.shadowMapSize=Z.mapSize,q.shadowCameraNear=Z.camera.near,q.shadowCameraFar=Z.camera.far,s.pointShadow[m]=q,s.pointShadowMap[m]=N,s.pointShadowMatrix[m]=O.shadow.matrix,S++}s.point[m]=F,m++}else if(O.isHemisphereLight){let F=i.get(O);F.skyColor.copy(O.color).multiplyScalar(k*E),F.groundColor.copy(O.groundColor).multiplyScalar(k*E),s.hemi[x]=F,x++}}y>0&&(t.isWebGL2||e.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=Te.LTC_FLOAT_1,s.rectAreaLTC2=Te.LTC_FLOAT_2):e.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=Te.LTC_HALF_1,s.rectAreaLTC2=Te.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=u,s.ambient[1]=p,s.ambient[2]=f;let C=s.hash;(C.directionalLength!==g||C.pointLength!==m||C.spotLength!==v||C.rectAreaLength!==y||C.hemiLength!==x||C.numDirectionalShadows!==w||C.numPointShadows!==S||C.numSpotShadows!==b||C.numSpotMaps!==A)&&(s.directional.length=g,s.spot.length=v,s.rectArea.length=y,s.point.length=m,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+A-_,s.spotLightMap.length=A,s.numSpotLightShadowsWithMaps=_,C.directionalLength=g,C.pointLength=m,C.spotLength=v,C.rectAreaLength=y,C.hemiLength=x,C.numDirectionalShadows=w,C.numPointShadows=S,C.numSpotShadows=b,C.numSpotMaps=A,s.version=wL++)}function h(c,d){let u=0,p=0,f=0,g=0,m=0,v=d.matrixWorldInverse;for(let y=0,x=c.length;y<x;y++){let w=c[y];if(w.isDirectionalLight){let S=s.directional[u];S.direction.setFromMatrixPosition(w.matrixWorld),a.setFromMatrixPosition(w.target.matrixWorld),S.direction.sub(a),S.direction.transformDirection(v),u++}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[g];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),g++}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[m];S.direction.setFromMatrixPosition(w.matrixWorld),S.direction.transformDirection(v),m++}}}return{setup:l,setupView:h,state:s}}function ob(e,t){let i=new _L(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 AL(e,t){let i=new WeakMap;function r(a,n=0){let o=i.get(a),l;return o===void 0?(l=new ob(e,t),i.set(a,[l])):n>=o.length?(l=new ob(e,t),o.push(l)):l=o[n],l}function s(){i=new WeakMap}return{get:r,dispose:s}}var UM=class extends md{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=hn,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}},ML=class extends md{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}},EL=`void main() {
3113	gl_Position = vec4( position, 1.0 );
3114}`,CL=`uniform sampler2D shadow_pass;
3115uniform vec2 resolution;
3116uniform float radius;
3117#include <packing>
3118void main() {
3119	const float samples = float( VSM_SAMPLES );
3120	float mean = 0.0;
3121	float squared_mean = 0.0;
3122	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
3123	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
3124	for ( float i = 0.0; i < samples; i ++ ) {
3125		float uvOffset = uvStart + i * uvStride;
3126		#ifdef HORIZONTAL_PASS
3127			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
3128			mean += distribution.x;
3129			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3130		#else
3131			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
3132			mean += depth;
3133			squared_mean += depth * depth;
3134		#endif
3135	}
3136	mean = mean / samples;
3137	squared_mean = squared_mean / samples;
3138	float std_dev = sqrt( squared_mean - mean * mean );
3139	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3140}`;function TL(e,t,i){let r=new wy,s=new j,a=new j,n=new ht,o=new UM({depthPacking:AM}),l=new ML,h={},c=i.maxTextureSize,d={[zs]:Ki,[Ki]:zs,[vr]:vr},u=new Pt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new j},radius:{value:4}},vertexShader:EL,fragmentShader:CL}),p=u.clone();p.defines.HORIZONTAL_PASS=1;let f=new je;f.setAttribute("position",new et(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new Zt(f,u),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=my,this.render=function(w,S,b){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||w.length===0)return;let A=e.getRenderTarget(),_=e.getActiveCubeFace(),E=e.getActiveMipmapLevel(),C=e.state;C.setBlending(Ci),C.buffers.color.setClear(1,1,1,1),C.buffers.depth.setTest(!0),C.setScissorTest(!1);for(let T=0,P=w.length;T<P;T++){let O=w[T],D=O.shadow;if(D===void 0){console.warn("THREE.WebGLShadowMap:",O,"has no shadow.");continue}if(D.autoUpdate===!1&&D.needsUpdate===!1)continue;s.copy(D.mapSize);let k=D.getFrameExtents();if(s.multiply(k),a.copy(D.mapSize),(s.x>c||s.y>c)&&(s.x>c&&(a.x=Math.floor(c/k.x),s.x=a.x*k.x,D.mapSize.x=a.x),s.y>c&&(a.y=Math.floor(c/k.y),s.y=a.y*k.y,D.mapSize.y=a.y)),D.map===null){let N=this.type!==xc?{minFilter:wt,magFilter:wt}:{};D.map=new Tt(s.x,s.y,N),D.map.texture.name=O.name+".shadowMap",D.camera.updateProjectionMatrix()}e.setRenderTarget(D.map),e.clear();let W=D.getViewportCount();for(let N=0;N<W;N++){let F=D.getViewport(N);n.set(a.x*F.x,a.y*F.y,a.x*F.z,a.y*F.w),C.viewport(n),D.updateMatrices(O,N),r=D.getFrustum(),x(S,b,D.camera,O,this.type)}D.isPointLightShadow!==!0&&this.type===xc&&v(D,b),D.needsUpdate=!1}m.needsUpdate=!1,e.setRenderTarget(A,_,E)};function v(w,S){let b=t.update(g);u.defines.VSM_SAMPLES!==w.blurSamples&&(u.defines.VSM_SAMPLES=w.blurSamples,p.defines.VSM_SAMPLES=w.blurSamples,u.needsUpdate=!0,p.needsUpdate=!0),w.mapPass===null&&(w.mapPass=new Tt(s.x,s.y)),u.uniforms.shadow_pass.value=w.map.texture,u.uniforms.resolution.value=w.mapSize,u.uniforms.radius.value=w.radius,e.setRenderTarget(w.mapPass),e.clear(),e.renderBufferDirect(S,null,b,u,g,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,g,null)}function y(w,S,b,A,_,E){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 P=C.uuid,O=S.uuid,D=h[P];D===void 0&&(D={},h[P]=D);let k=D[O];k===void 0&&(k=C.clone(),D[O]=k),C=k}return C.visible=S.visible,C.wireframe=S.wireframe,E===xc?C.side=S.shadowSide!==null?S.shadowSide:S.side:C.side=S.shadowSide!==null?S.shadowSide:d[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=A,C.farDistance=_),C}function x(w,S,b,A,_){if(w.visible===!1)return;if(w.layers.test(S.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&_===xc)&&(!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 P=C.groups;for(let O=0,D=P.length;O<D;O++){let k=P[O],W=T[k.materialIndex];if(W&&W.visible){let N=y(w,W,A,b.near,b.far,_);e.renderBufferDirect(b,null,C,N,w,k)}}}else if(T.visible){let P=y(w,T,A,b.near,b.far,_);e.renderBufferDirect(b,null,C,P,w,null)}}let E=w.children;for(let C=0,T=E.length;C<T;C++)x(E[C],S,b,A,_)}}
3140function PL(e,t,i){let r=i.isWebGL2;function s(){let K=!1,me=new ht,we=null,Be=new ht(0,0,0,0);return{setMask:function(at){we!==at&&!K&&(e.colorMask(at,at,at,at),we=at)},setLocked:function(at){K=at},setClear:function(at,Mt,pi,ji,js){js===!0&&(at*=ji,Mt*=ji,pi*=ji),me.set(at,Mt,pi,ji),Be.equals(me)===!1&&(e.clearColor(at,Mt,pi,ji),Be.copy(me))},reset:function(){K=!1,we=null,Be.set(-1,0,0,0)}}}function a(){let K=!1,me=null,we=null,Be=null;return{setTest:function(at){at?le(2929):re(2929)},setMask:function(at){me!==at&&!K&&(e.depthMask(at),me=at)},setFunc:function(at){if(we!==at){switch(at){case ZP:e.depthFunc(512);break;case KP:e.depthFunc(519);break;case JP:e.depthFunc(513);break;case uv:e.depthFunc(515);break;case $P:e.depthFunc(514);break;case eD:e.depthFunc(518);break;case tD:e.depthFunc(516);break;case iD:e.depthFunc(517);break;default:e.depthFunc(515)}we=at}},setLocked:function(at){K=at},setClear:function(at){Be!==at&&(e.clearDepth(at),Be=at)},reset:function(){K=!1,me=null,we=null,Be=null}}}function n(){let K=!1,me=null,we=null,Be=null,at=null,Mt=null,pi=null,ji=null,js=null;return{setTest:function(Kt){K||(Kt?le(2960):re(2960))},setMask:function(Kt){me!==Kt&&!K&&(e.stencilMask(Kt),me=Kt)},setFunc:function(Kt,gs,Lr){(we!==Kt||Be!==gs||at!==Lr)&&(e.stencilFunc(Kt,gs,Lr),we=Kt,Be=gs,at=Lr)},setOp:function(Kt,gs,Lr){(Mt!==Kt||pi!==gs||ji!==Lr)&&(e.stencilOp(Kt,gs,Lr),Mt=Kt,pi=gs,ji=Lr)},setLocked:function(Kt){K=Kt},setClear:function(Kt){js!==Kt&&(e.clearStencil(Kt),js=Kt)},reset:function(){K=!1,me=null,we=null,Be=null,at=null,Mt=null,pi=null,ji=null,js=null}}}let o=new s,l=new a,h=new n,c=new WeakMap,d=new WeakMap,u={},p={},f=new WeakMap,g=[],m=null,v=!1,y=null,x=null,w=null,S=null,b=null,A=null,_=null,E=!1,C=null,T=null,P=null,O=null,D=null,k=e.getParameter(35661),W=!1,N=0,F=e.getParameter(7938);F.indexOf("WebGL")!==-1?(N=parseFloat(/^WebGL (\d)/.exec(F)[1]),W=N>=1):F.indexOf("OpenGL ES")!==-1&&(N=parseFloat(/^OpenGL ES (\d)/.exec(F)[1]),W=N>=2);let Z=null,q={},G=e.getParameter(3088),Q=e.getParameter(2978),ee=new ht().fromArray(G),Y=new ht().fromArray(Q);function $(K,me,we){let Be=new Uint8Array(4),at=e.createTexture();e.bindTexture(K,at),e.texParameteri(K,10241,9728),e.texParameteri(K,10240,9728);for(let Mt=0;Mt<we;Mt++)e.texImage2D(me+Mt,0,6408,1,1,0,6408,5121,Be);return at}let H={};H[3553]=$(3553,3553,1),H[34067]=$(34067,34069,6),o.setClear(0,0,0,1),l.setClear(1),h.setClear(0),le(2929),l.setFunc(uv),Ne(!1),Fe($1),le(2884),Re(Ci);function le(K){u[K]!==!0&&(e.enable(K),u[K]=!0)}function re(K){u[K]!==!1&&(e.disable(K),u[K]=!1)}function te(K,me){return p[K]!==me?(e.bindFramebuffer(K,me),p[K]=me,r&&(K===36009&&(p[36160]=me),K===36160&&(p[36009]=me)),!0):!1}function ae(K,me){let we=g,Be=!1;if(K)if(we=f.get(me),we===void 0&&(we=[],f.set(me,we)),K.isWebGLMultipleRenderTargets){let at=K.texture;if(we.length!==at.length||we[0]!==36064){for(let Mt=0,pi=at.length;Mt<pi;Mt++)we[Mt]=36064+Mt;we.length=at.length,Be=!0}}else we[0]!==36064&&(we[0]=36064,Be=!0);else we[0]!==1029&&(we[0]=1029,Be=!0);Be&&(i.isWebGL2?e.drawBuffers(we):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(we))}function ce(K){return m!==K?(e.useProgram(K),m=K,!0):!1}let ue={[zl]:32774,[UP]:32778,[NP]:32779};if(r)ue[rx]=32775,ue[sx]=32776;else{let K=t.get("EXT_blend_minmax");K!==null&&(ue[rx]=K.MIN_EXT,ue[sx]=K.MAX_EXT)}let xe={[VP]:0,[jP]:1,[GP]:768,[gM]:770,[QP]:776,[XP]:774,[WP]:772,[HP]:769,[vM]:771,[YP]:775,[qP]:773};function Re(K,me,we,Be,at,Mt,pi,ji){if(K===Ci){v===!0&&(re(3042),v=!1);return}if(v===!1&&(le(3042),v=!0),K!==kP){if(K!==y||ji!==E){if((x!==zl||b!==zl)&&(e.blendEquation(32774),x=zl,b=zl),ji)switch(K){case Lo:e.blendFuncSeparate(1,771,1,771);break;case ex:e.blendFunc(1,1);break;case tx:e.blendFuncSeparate(0,769,0,1);break;case ix:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",K);break}else switch(K){case Lo:e.blendFuncSeparate(770,771,1,771);break;case ex:e.blendFunc(770,1);break;case tx:e.blendFuncSeparate(0,769,0,1);break;case ix:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",K);break}w=null,S=null,A=null,_=null,y=K,E=ji}return}at=at||me,Mt=Mt||we,pi=pi||Be,(me!==x||at!==b)&&(e.blendEquationSeparate(ue[me],ue[at]),x=me,b=at),(we!==w||Be!==S||Mt!==A||pi!==_)&&(e.blendFuncSeparate(xe[we],xe[Be],xe[Mt],xe[pi]),w=we,S=Be,A=Mt,_=pi),y=K,E=!1}
vendor: 4,400 bytes, line 3140
3140function Ae(K,me){K.side===vr?re(2884):le(2884);let we=K.side===Ki;me&&(we=!we),Ne(we),K.blending===Lo&&K.transparent===!1?Re(Ci):Re(K.blending,K.blendEquation,K.blendSrc,K.blendDst,K.blendEquationAlpha,K.blendSrcAlpha,K.blendDstAlpha,K.premultipliedAlpha),l.setFunc(K.depthFunc),l.setTest(K.depthTest),l.setMask(K.depthWrite),o.setMask(K.colorWrite);let Be=K.stencilWrite;h.setTest(Be),Be&&(h.setMask(K.stencilWriteMask),h.setFunc(K.stencilFunc,K.stencilRef,K.stencilFuncMask),h.setOp(K.stencilFail,K.stencilZFail,K.stencilZPass)),Me(K.polygonOffset,K.polygonOffsetFactor,K.polygonOffsetUnits),K.alphaToCoverage===!0?le(32926):re(32926)}function Ne(K){C!==K&&(K?e.frontFace(2304):e.frontFace(2305),C=K)}function Fe(K){K!==BP?(le(2884),K!==T&&(K===$1?e.cullFace(1029):K===zP?e.cullFace(1028):e.cullFace(1032))):re(2884),T=K}function Ee(K){K!==P&&(W&&e.lineWidth(K),P=K)}function Me(K,me,we){K?(le(32823),(O!==me||D!==we)&&(e.polygonOffset(me,we),O=me,D=we)):re(32823)}function Xe(K){K?le(3089):re(3089)}function We(K){K===void 0&&(K=33984+k-1),Z!==K&&(e.activeTexture(K),Z=K)}function V(K,me,we){we===void 0&&(Z===null?we=33984+k-1:we=Z);let Be=q[we];Be===void 0&&(Be={type:void 0,texture:void 0},q[we]=Be),(Be.type!==K||Be.texture!==me)&&(Z!==we&&(e.activeTexture(we),Z=we),e.bindTexture(K,me||H[K]),Be.type=K,Be.texture=me)}function B(){let K=q[Z];K!==void 0&&K.type!==void 0&&(e.bindTexture(K.type,null),K.type=void 0,K.texture=void 0)}function ne(){try{e.compressedTexImage2D.apply(e,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Se(){try{e.compressedTexImage3D.apply(e,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function R(){try{e.texSubImage2D.apply(e,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Ce(){try{e.texSubImage3D.apply(e,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Ue(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Ie(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function de(){try{e.texStorage2D.apply(e,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Ve(){try{e.texStorage3D.apply(e,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function Le(){try{e.texImage2D.apply(e,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function qe(){try{e.texImage3D.apply(e,arguments)}catch(K){console.error("THREE.WebGLState:",K)}}function tt(K){ee.equals(K)===!1&&(e.scissor(K.x,K.y,K.z,K.w),ee.copy(K))}function Ye(K){Y.equals(K)===!1&&(e.viewport(K.x,K.y,K.z,K.w),Y.copy(K))}function Ze(K,me){let we=d.get(me);we===void 0&&(we=new WeakMap,d.set(me,we));let Be=we.get(K);Be===void 0&&(Be=e.getUniformBlockIndex(me,K.name),we.set(K,Be))}function Wt(K,me){let we=d.get(me).get(K);c.get(me)!==we&&(e.uniformBlockBinding(me,we,K.__bindingPointIndex),c.set(me,we))}function si(){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),u={},Z=null,q={},p={},f=new WeakMap,g=[],m=null,v=!1,y=null,x=null,w=null,S=null,b=null,A=null,_=null,E=!1,C=null,T=null,P=null,O=null,D=null,ee.set(0,0,e.canvas.width,e.canvas.height),Y.set(0,0,e.canvas.width,e.canvas.height),o.reset(),l.reset(),h.reset()}return{buffers:{color:o,depth:l,stencil:h},enable:le,disable:re,bindFramebuffer:te,drawBuffers:ae,useProgram:ce,setBlending:Re,setMaterial:Ae,setFlipSided:Ne,setCullFace:Fe,setLineWidth:Ee,setPolygonOffset:Me,setScissorTest:Xe,activeTexture:We,bindTexture:V,unbindTexture:B,compressedTexImage2D:ne,compressedTexImage3D:Se,texImage2D:Le,texImage3D:qe,updateUBOMapping:Ze,uniformBlockBinding:Wt,texStorage2D:de,texStorage3D:Ve,texSubImage2D:R,texSubImage3D:Ce,compressedTexSubImage2D:Ue,compressedTexSubImage3D:Ie,scissor:tt,viewport:Ye,reset:si}}
3140function DL(e,t,i,r,s,a,n){let o=s.isWebGL2,l=s.maxTextures,h=s.maxCubemapSize,c=s.maxTextureSize,d=s.maxSamples,u=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,g,m=new WeakMap,v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(V,B){return v?new OffscreenCanvas(V,B):qc("canvas")}function x(V,B,ne,Se){let R=1;if((V.width>Se||V.height>Se)&&(R=Se/Math.max(V.width,V.height)),R<1||B===!0)if(typeof HTMLImageElement<"u"&&V instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&V instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&V instanceof ImageBitmap){let Ce=B?Cp:Math.floor,Ue=Ce(R*V.width),Ie=Ce(R*V.height);g===void 0&&(g=y(Ue,Ie));let de=ne?y(Ue,Ie):g;return de.width=Ue,de.height=Ie,de.getContext("2d").drawImage(V,0,0,Ue,Ie),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+V.width+"x"+V.height+") to ("+Ue+"x"+Ie+")."),de}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 xv(V.width)&&xv(V.height)}function S(V){return o?!1:V.wrapS!==ii||V.wrapT!==ii||V.minFilter!==wt&&V.minFilter!==yt}function b(V,B){return V.generateMipmaps&&B&&V.minFilter!==wt&&V.minFilter!==yt}function A(V){e.generateMipmap(V)}function _(V,B,ne,Se,R=!1){if(o===!1)return B;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 Ce=B;return B===6403&&(ne===5126&&(Ce=33326),ne===5131&&(Ce=33325),ne===5121&&(Ce=33321)),B===33319&&(ne===5126&&(Ce=33328),ne===5131&&(Ce=33327),ne===5121&&(Ce=33323)),B===6408&&(ne===5126&&(Ce=34836),ne===5131&&(Ce=34842),ne===5121&&(Ce=Se===mt&&R===!1?35907:32856),ne===32819&&(Ce=32854),ne===32820&&(Ce=32855)),(Ce===33325||Ce===33326||Ce===33327||Ce===33328||Ce===34842||Ce===34836)&&t.get("EXT_color_buffer_float"),Ce}function E(V,B,ne){return b(V,ne)===!0||V.isFramebufferTexture&&V.minFilter!==wt&&V.minFilter!==yt?Math.log2(Math.max(B.width,B.height))+1:V.mipmaps!==void 0&&V.mipmaps.length>0?V.mipmaps.length:V.isCompressedTexture&&Array.isArray(V.image)?B.mipmaps.length:1}function C(V){return V===wt||V===ax||V===nm?9728:9729}function T(V){let B=V.target;B.removeEventListener("dispose",T),O(B),B.isVideoTexture&&f.delete(B)}function P(V){let B=V.target;B.removeEventListener("dispose",P),k(B)}function O(V){let B=r.get(V);if(B.__webglInit===void 0)return;let ne=V.source,Se=m.get(ne);if(Se){let R=Se[B.__cacheKey];R.usedTimes--,R.usedTimes===0&&D(V),Object.keys(Se).length===0&&m.delete(ne)}r.remove(V)}function D(V){let B=r.get(V);e.deleteTexture(B.__webglTexture);let ne=V.source,Se=m.get(ne);delete Se[B.__cacheKey],n.memory.textures--}function k(V){let B=V.texture,ne=r.get(V),Se=r.get(B);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(ne.__webglFramebuffer[R]),ne.__webglDepthbuffer&&e.deleteRenderbuffer(ne.__webglDepthbuffer[R]);else{if(e.deleteFramebuffer(ne.__webglFramebuffer),ne.__webglDepthbuffer&&e.deleteRenderbuffer(ne.__webglDepthbuffer),ne.__webglMultisampledFramebuffer&&e.deleteFramebuffer(ne.__webglMultisampledFramebuffer),ne.__webglColorRenderbuffer)for(let R=0;R<ne.__webglColorRenderbuffer.length;R++)ne.__webglColorRenderbuffer[R]&&e.deleteRenderbuffer(ne.__webglColorRenderbuffer[R]);ne.__webglDepthRenderbuffer&&e.deleteRenderbuffer(ne.__webglDepthRenderbuffer)}if(V.isWebGLMultipleRenderTargets)for(let R=0,Ce=B.length;R<Ce;R++){let Ue=r.get(B[R]);Ue.__webglTexture&&(e.deleteTexture(Ue.__webglTexture),n.memory.textures--),r.remove(B[R])}r.remove(B),r.remove(V)}let W=0;function N(){W=0}function F(){let V=W;return V>=l&&console.warn("THREE.WebGLTextures: Trying to use "+V+" texture units while this GPU supports only "+l),W+=1,V}function Z(V){let B=[];return B.push(V.wrapS),B.push(V.wrapT),B.push(V.wrapR||0),B.push(V.magFilter),B.push(V.minFilter),B.push(V.anisotropy),B.push(V.internalFormat),B.push(V.format),B.push(V.type),B.push(V.generateMipmaps),B.push(V.premultiplyAlpha),B.push(V.flipY),B.push(V.unpackAlignment),B.push(V.encoding),B.join()}function q(V,B){let ne=r.get(V);if(V.isVideoTexture&&Xe(V),V.isRenderTargetTexture===!1&&V.version>0&&ne.__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{re(ne,V,B);return}}i.bindTexture(3553,ne.__webglTexture,33984+B)}function G(V,B){let ne=r.get(V);if(V.version>0&&ne.__version!==V.version){re(ne,V,B);return}i.bindTexture(35866,ne.__webglTexture,33984+B)}function Q(V,B){let ne=r.get(V);if(V.version>0&&ne.__version!==V.version){re(ne,V,B);return}i.bindTexture(32879,ne.__webglTexture,33984+B)}function ee(V,B){let ne=r.get(V);if(V.version>0&&ne.__version!==V.version){te(ne,V,B);return}i.bindTexture(34067,ne.__webglTexture,33984+B)}let Y={[Ya]:10497,[ii]:33071,[mv]:33648},$={[wt]:9728,[ax]:9984,[nm]:9986,[yt]:9729,[cD]:9985,[ch]:9987};function H(V,B,ne){if(ne?(e.texParameteri(V,10242,Y[B.wrapS]),e.texParameteri(V,10243,Y[B.wrapT]),(V===32879||V===35866)&&e.texParameteri(V,32882,Y[B.wrapR]),e.texParameteri(V,10240,$[B.magFilter]),e.texParameteri(V,10241,$[B.minFilter])):(e.texParameteri(V,10242,33071),e.texParameteri(V,10243,33071),(V===32879||V===35866)&&e.texParameteri(V,32882,33071),(B.wrapS!==ii||B.wrapT!==ii)&&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(B.magFilter)),e.texParameteri(V,10241,C(B.minFilter)),B.minFilter!==wt&&B.minFilter!==yt&&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(B.magFilter===wt||B.minFilter!==nm&&B.minFilter!==ch||B.type===Vt&&t.has("OES_texture_float_linear")===!1||o===!1&&B.type===rn&&t.has("OES_texture_half_float_linear")===!1)return;(B.anisotropy>1||r.get(B).__currentAnisotropy)&&(e.texParameterf(V,Se.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(B.anisotropy,s.getMaxAnisotropy())),r.get(B).__currentAnisotropy=B.anisotropy)}}function le(V,B){let ne=!1;V.__webglInit===void 0&&(V.__webglInit=!0,B.addEventListener("dispose",T));let Se=B.source,R=m.get(Se);R===void 0&&(R={},m.set(Se,R));let Ce=Z(B);if(Ce!==V.__cacheKey){R[Ce]===void 0&&(R[Ce]={texture:e.createTexture(),usedTimes:0},n.memory.textures++,ne=!0),R[Ce].usedTimes++;let Ue=R[V.__cacheKey];Ue!==void 0&&(R[V.__cacheKey].usedTimes--,Ue.usedTimes===0&&D(B)),V.__cacheKey=Ce,V.__webglTexture=R[Ce].texture}return ne}function re(V,B,ne){let Se=3553;(B.isDataArrayTexture||B.isCompressedArrayTexture)&&(Se=35866),B.isData3DTexture&&(Se=32879);let R=le(V,B),Ce=B.source;i.bindTexture(Se,V.__webglTexture,33984+ne);let Ue=r.get(Ce);if(Ce.version!==Ue.__version||R===!0){i.activeTexture(33984+ne),e.pixelStorei(37440,B.flipY),e.pixelStorei(37441,B.premultiplyAlpha),e.pixelStorei(3317,B.unpackAlignment),e.pixelStorei(37443,0);let Ie=S(B)&&w(B.image)===!1,de=x(B.image,Ie,!1,c);de=We(B,de);let Ve=w(de)||o,Le=a.convert(B.format,B.encoding),qe=a.convert(B.type),tt=_(B.internalFormat,Le,qe,B.encoding,B.isVideoTexture);H(Se,B,Ve);let Ye,Ze=B.mipmaps,Wt=o&&B.isVideoTexture!==!0,si=Ue.__version===void 0||R===!0,K=E(B,de,Ve);
3140if(B.isDepthTexture)tt=6402,o?B.type===Vt?tt=36012:B.type===Qa?tt=33190:B.type===Bo?tt=35056:tt=33189:B.type===Vt&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),B.format===zo&&tt===6402&&B.type!==bM&&B.type!==Qa&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),B.type=Qa,qe=a.convert(B.type)),B.format===Go&&tt===6402&&(tt=34041,B.type!==Bo&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),B.type=Bo,qe=a.convert(B.type))),si&&(Wt?i.texStorage2D(3553,1,tt,de.width,de.height):i.texImage2D(3553,0,tt,de.width,de.height,0,Le,qe,null));else if(B.isDataTexture)if(Ze.length>0&&Ve){Wt&&si&&i.texStorage2D(3553,K,tt,Ze[0].width,Ze[0].height);for(let me=0,we=Ze.length;me<we;me++)Ye=Ze[me],Wt?i.texSubImage2D(3553,me,0,0,Ye.width,Ye.height,Le,qe,Ye.data):i.texImage2D(3553,me,tt,Ye.width,Ye.height,0,Le,qe,Ye.data);B.generateMipmaps=!1}else Wt?(si&&i.texStorage2D(3553,K,tt,de.width,de.height),i.texSubImage2D(3553,0,0,0,de.width,de.height,Le,qe,de.data)):i.texImage2D(3553,0,tt,de.width,de.height,0,Le,qe,de.data);else if(B.isCompressedTexture)if(B.isCompressedArrayTexture){Wt&&si&&i.texStorage3D(35866,K,tt,Ze[0].width,Ze[0].height,de.depth);for(let me=0,we=Ze.length;me<we;me++)Ye=Ze[me],B.format!==ri?Le!==null?Wt?i.compressedTexSubImage3D(35866,me,0,0,0,Ye.width,Ye.height,de.depth,Le,Ye.data,0,0):i.compressedTexImage3D(35866,me,tt,Ye.width,Ye.height,de.depth,0,Ye.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Wt?i.texSubImage3D(35866,me,0,0,0,Ye.width,Ye.height,de.depth,Le,qe,Ye.data):i.texImage3D(35866,me,tt,Ye.width,Ye.height,de.depth,0,Le,qe,Ye.data)}else{Wt&&si&&i.texStorage2D(3553,K,tt,Ze[0].width,Ze[0].height);for(let me=0,we=Ze.length;me<we;me++)Ye=Ze[me],B.format!==ri?Le!==null?Wt?i.compressedTexSubImage2D(3553,me,0,0,Ye.width,Ye.height,Le,Ye.data):i.compressedTexImage2D(3553,me,tt,Ye.width,Ye.height,0,Ye.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Wt?i.texSubImage2D(3553,me,0,0,Ye.width,Ye.height,Le,qe,Ye.data):i.texImage2D(3553,me,tt,Ye.width,Ye.height,0,Le,qe,Ye.data)}else if(B.isDataArrayTexture)Wt?(si&&i.texStorage3D(35866,K,tt,de.width,de.height,de.depth),i.texSubImage3D(35866,0,0,0,0,de.width,de.height,de.depth,Le,qe,de.data)):i.texImage3D(35866,0,tt,de.width,de.height,de.depth,0,Le,qe,de.data);else if(B.isData3DTexture)Wt?(si&&i.texStorage3D(32879,K,tt,de.width,de.height,de.depth),i.texSubImage3D(32879,0,0,0,0,de.width,de.height,de.depth,Le,qe,de.data)):i.texImage3D(32879,0,tt,de.width,de.height,de.depth,0,Le,qe,de.data);else if(B.isFramebufferTexture){if(si)if(Wt)i.texStorage2D(3553,K,tt,de.width,de.height);else{let me=de.width,we=de.height;for(let Be=0;Be<K;Be++)i.texImage2D(3553,Be,tt,me,we,0,Le,qe,null),me>>=1,we>>=1}}else if(Ze.length>0&&Ve){Wt&&si&&i.texStorage2D(3553,K,tt,Ze[0].width,Ze[0].height);for(let me=0,we=Ze.length;me<we;me++)Ye=Ze[me],Wt?i.texSubImage2D(3553,me,0,0,Le,qe,Ye):i.texImage2D(3553,me,tt,Le,qe,Ye);B.generateMipmaps=!1}else Wt?(si&&i.texStorage2D(3553,K,tt,de.width,de.height),i.texSubImage2D(3553,0,0,0,Le,qe,de)):i.texImage2D(3553,0,tt,Le,qe,de);b(B,Ve)&&A(Se),Ue.__version=Ce.version,B.onUpdate&&B.onUpdate(B)}V.__version=B.version}function te(V,B,ne){if(B.image.length!==6)return;let Se=le(V,B),R=B.source;i.bindTexture(34067,V.__webglTexture,33984+ne);let Ce=r.get(R);if(R.version!==Ce.__version||Se===!0){i.activeTexture(33984+ne),e.pixelStorei(37440,B.flipY),e.pixelStorei(37441,B.premultiplyAlpha),e.pixelStorei(3317,B.unpackAlignment),e.pixelStorei(37443,0);let Ue=B.isCompressedTexture||B.image[0].isCompressedTexture,Ie=B.image[0]&&B.image[0].isDataTexture,de=[];for(let me=0;me<6;me++)!Ue&&!Ie?de[me]=x(B.image[me],!1,!0,h):de[me]=Ie?B.image[me].image:B.image[me],de[me]=We(B,de[me]);let Ve=de[0],Le=w(Ve)||o,qe=a.convert(B.format,B.encoding),tt=a.convert(B.type),Ye=_(B.internalFormat,qe,tt,B.encoding),Ze=o&&B.isVideoTexture!==!0,Wt=Ce.__version===void 0||Se===!0,si=E(B,Ve,Le);H(34067,B,Le);let K;if(Ue){Ze&&Wt&&i.texStorage2D(34067,si,Ye,Ve.width,Ve.height);for(let me=0;me<6;me++){K=de[me].mipmaps;for(let we=0;we<K.length;we++){let Be=K[we];B.format!==ri?qe!==null?Ze?i.compressedTexSubImage2D(34069+me,we,0,0,Be.width,Be.he
vendor: 7,731 bytes, line 3140
3140ight,qe,Be.data):i.compressedTexImage2D(34069+me,we,Ye,Be.width,Be.height,0,Be.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ze?i.texSubImage2D(34069+me,we,0,0,Be.width,Be.height,qe,tt,Be.data):i.texImage2D(34069+me,we,Ye,Be.width,Be.height,0,qe,tt,Be.data)}}}else{K=B.mipmaps,Ze&&Wt&&(K.length>0&&si++,i.texStorage2D(34067,si,Ye,de[0].width,de[0].height));for(let me=0;me<6;me++)if(Ie){Ze?i.texSubImage2D(34069+me,0,0,0,de[me].width,de[me].height,qe,tt,de[me].data):i.texImage2D(34069+me,0,Ye,de[me].width,de[me].height,0,qe,tt,de[me].data);for(let we=0;we<K.length;we++){let Be=K[we].image[me].image;Ze?i.texSubImage2D(34069+me,we+1,0,0,Be.width,Be.height,qe,tt,Be.data):i.texImage2D(34069+me,we+1,Ye,Be.width,Be.height,0,qe,tt,Be.data)}}else{Ze?i.texSubImage2D(34069+me,0,0,0,qe,tt,de[me]):i.texImage2D(34069+me,0,Ye,qe,tt,de[me]);for(let we=0;we<K.length;we++){let Be=K[we];Ze?i.texSubImage2D(34069+me,we+1,0,0,qe,tt,Be.image[me]):i.texImage2D(34069+me,we+1,Ye,qe,tt,Be.image[me])}}}b(B,Le)&&A(34067),Ce.__version=R.version,B.onUpdate&&B.onUpdate(B)}V.__version=B.version}function ae(V,B,ne,Se,R){let Ce=a.convert(ne.format,ne.encoding),Ue=a.convert(ne.type),Ie=_(ne.internalFormat,Ce,Ue,ne.encoding);r.get(B).__hasExternalTextures||(R===32879||R===35866?i.texImage3D(R,0,Ie,B.width,B.height,B.depth,0,Ce,Ue,null):i.texImage2D(R,0,Ie,B.width,B.height,0,Ce,Ue,null)),i.bindFramebuffer(36160,V),Me(B)?u.framebufferTexture2DMultisampleEXT(36160,Se,R,r.get(ne).__webglTexture,0,Ee(B)):(R===3553||R>=34069&&R<=34074)&&e.framebufferTexture2D(36160,Se,R,r.get(ne).__webglTexture,0),i.bindFramebuffer(36160,null)}function ce(V,B,ne){if(e.bindRenderbuffer(36161,V),B.depthBuffer&&!B.stencilBuffer){let Se=33189;if(ne||Me(B)){let R=B.depthTexture;R&&R.isDepthTexture&&(R.type===Vt?Se=36012:R.type===Qa&&(Se=33190));let Ce=Ee(B);Me(B)?u.renderbufferStorageMultisampleEXT(36161,Ce,Se,B.width,B.height):e.renderbufferStorageMultisample(36161,Ce,Se,B.width,B.height)}else e.renderbufferStorage(36161,Se,B.width,B.height);e.framebufferRenderbuffer(36160,36096,36161,V)}else if(B.depthBuffer&&B.stencilBuffer){let Se=Ee(B);ne&&Me(B)===!1?e.renderbufferStorageMultisample(36161,Se,35056,B.width,B.height):Me(B)?u.renderbufferStorageMultisampleEXT(36161,Se,35056,B.width,B.height):e.renderbufferStorage(36161,34041,B.width,B.height),e.framebufferRenderbuffer(36160,33306,36161,V)}else{let Se=B.isWebGLMultipleRenderTargets===!0?B.texture:[B.texture];for(let R=0;R<Se.length;R++){let Ce=Se[R],Ue=a.convert(Ce.format,Ce.encoding),Ie=a.convert(Ce.type),de=_(Ce.internalFormat,Ue,Ie,Ce.encoding),Ve=Ee(B);ne&&Me(B)===!1?e.renderbufferStorageMultisample(36161,Ve,de,B.width,B.height):Me(B)?u.renderbufferStorageMultisampleEXT(36161,Ve,de,B.width,B.height):e.renderbufferStorage(36161,de,B.width,B.height)}}e.bindRenderbuffer(36161,null)}function ue(V,B){if(B&&B.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,V),!(B.depthTexture&&B.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(B.depthTexture).__webglTexture||B.depthTexture.image.width!==B.width||B.depthTexture.image.height!==B.height)&&(B.depthTexture.image.width=B.width,B.depthTexture.image.height=B.height,B.depthTexture.needsUpdate=!0),q(B.depthTexture,0);let ne=r.get(B.depthTexture).__webglTexture,Se=Ee(B);if(B.depthTexture.format===zo)Me(B)?u.framebufferTexture2DMultisampleEXT(36160,36096,3553,ne,0,Se):e.framebufferTexture2D(36160,36096,3553,ne,0);else if(B.depthTexture.format===Go)Me(B)?u.framebufferTexture2DMultisampleEXT(36160,33306,3553,ne,0,Se):e.framebufferTexture2D(36160,33306,3553,ne,0);else throw new Error("Unknown depthTexture format")}function xe(V){let B=r.get(V),ne=V.isWebGLCubeRenderTarget===!0;if(V.depthTexture&&!B.__autoAllocateDepthBuffer){if(ne)throw new Error("target.depthTexture not supported in Cube render targets");ue(B.__webglFramebuffer,V)}else if(ne){B.__webglDepthbuffer=[];for(let Se=0;Se<6;Se++)i.bindFramebuffer(36160,B.__webglFramebuffer[Se]),B.__webglDepthbuffer[Se]=e.createRenderbuffer(),ce(B.__webglDepthbuffer[Se],V,!1)}else i.bindFramebuffer(36160,B.__webglFramebuffer),B.__webglDepthbuffer=e.createRenderbuffer(),ce(B.__webglDepthbuffer,V,!1);i.bindFramebuffer(36160,null)}function Re(V,B,ne){let Se=r.get(V);B!==void 0&&ae(Se.__webglFramebuffer,V,V.texture,36064,3553),ne!==void 0&&xe(V)}function Ae(V){let B=V.texture,ne=r.get(V),Se=r.get(B);V.addEventListener("dispose",P),V.isWebGLMultipleRenderTargets!==!0&&(Se.__webglTexture===void 0&&(Se.__webglTexture=e.createTexture()),Se.__version=B.version,n.memory.textures++);let R=V.isWebGLCubeRenderTarget===!0,Ce=V.isWebGLMultipleRenderTargets===!0,Ue=w(V)||o;if(R){ne.__webglFramebuffer=[];for(let Ie=0;Ie<6;Ie++)ne.__webglFramebuffer[Ie]=e.createFramebuffer()}else{if(ne.__webglFramebuffer=e.createFramebuffer(),Ce)if(s.drawBuffers){let Ie=V.texture;for(let de=0,Ve=Ie.length;de<Ve;de++){let Le=r.get(Ie[de]);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&&Me(V)===!1){let Ie=Ce?B:[B];ne.__webglMultisampledFramebuffer=e.createFramebuffer(),ne.__webglColorRenderbuffer=[],i.bindFramebuffer(36160,ne.__webglMultisampledFramebuffer);for(let de=0;de<Ie.length;de++){let Ve=Ie[de];ne.__webglColorRenderbuffer[de]=e.createRenderbuffer(),e.bindRenderbuffer(36161,ne.__webglColorRenderbuffer[de]);let Le=a.convert(Ve.format,Ve.encoding),qe=a.convert(Ve.type),tt=_(Ve.internalFormat,Le,qe,Ve.encoding,V.isXRRenderTarget===!0),Ye=Ee(V);e.renderbufferStorageMultisample(36161,Ye,tt,V.width,V.height),e.framebufferRenderbuffer(36160,36064+de,36161,ne.__webglColorRenderbuffer[de])}e.bindRenderbuffer(36161,null),V.depthBuffer&&(ne.__webglDepthRenderbuffer=e.createRenderbuffer(),ce(ne.__webglDepthRenderbuffer,V,!0)),i.bindFramebuffer(36160,null)}}if(R){i.bindTexture(34067,Se.__webglTexture),H(34067,B,Ue);for(let Ie=0;Ie<6;Ie++)ae(ne.__webglFramebuffer[Ie],V,B,36064,34069+Ie);b(B,Ue)&&A(34067),i.unbindTexture()}else if(Ce){let Ie=V.texture;for(let de=0,Ve=Ie.length;de<Ve;de++){let Le=Ie[de],qe=r.get(Le);i.bindTexture(3553,qe.__webglTexture),H(3553,Le,Ue),ae(ne.__webglFramebuffer,V,Le,36064+de,3553),b(Le,Ue)&&A(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),H(Ie,B,Ue),ae(ne.__webglFramebuffer,V,B,36064,Ie),b(B,Ue)&&A(Ie),i.unbindTexture()}V.depthBuffer&&xe(V)}function Ne(V){let B=w(V)||o,ne=V.isWebGLMultipleRenderTargets===!0?V.texture:[V.texture];for(let Se=0,R=ne.length;Se<R;Se++){let Ce=ne[Se];if(b(Ce,B)){let Ue=V.isWebGLCubeRenderTarget?34067:3553,Ie=r.get(Ce).__webglTexture;i.bindTexture(Ue,Ie),A(Ue),i.unbindTexture()}}}function Fe(V){if(o&&V.samples>0&&Me(V)===!1){let B=V.isWebGLMultipleRenderTargets?V.texture:[V.texture],ne=V.width,Se=V.height,R=16384,Ce=[],Ue=V.stencilBuffer?33306:36096,Ie=r.get(V),de=V.isWebGLMultipleRenderTargets===!0;if(de)for(let Ve=0;Ve<B.length;Ve++)i.bindFramebuffer(36160,Ie.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+Ve,36161,null),i.bindFramebuffer(36160,Ie.__webglFramebuffer),e.framebufferTexture2D(36009,36064+Ve,3553,null,0);i.bindFramebuffer(36008,Ie.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,Ie.__webglFramebuffer);for(let Ve=0;Ve<B.length;
3140Ve++){Ce.push(36064+Ve),V.depthBuffer&&Ce.push(Ue);let Le=Ie.__ignoreDepthValues!==void 0?Ie.__ignoreDepthValues:!1;if(Le===!1&&(V.depthBuffer&&(R|=256),V.stencilBuffer&&(R|=1024)),de&&e.framebufferRenderbuffer(36008,36064,36161,Ie.__webglColorRenderbuffer[Ve]),Le===!0&&(e.invalidateFramebuffer(36008,[Ue]),e.invalidateFramebuffer(36009,[Ue])),de){let qe=r.get(B[Ve]).__webglTexture;e.framebufferTexture2D(36009,36064,3553,qe,0)}e.blitFramebuffer(0,0,ne,Se,0,0,ne,Se,R,9728),p&&e.invalidateFramebuffer(36008,Ce)}if(i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,null),de)for(let Ve=0;Ve<B.length;Ve++){i.bindFramebuffer(36160,Ie.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064+Ve,36161,Ie.__webglColorRenderbuffer[Ve]);let Le=r.get(B[Ve]).__webglTexture;i.bindFramebuffer(36160,Ie.__webglFramebuffer),e.framebufferTexture2D(36009,36064+Ve,3553,Le,0)}i.bindFramebuffer(36009,Ie.__webglMultisampledFramebuffer)}}function Ee(V){return Math.min(d,V.samples)}function Me(V){let B=r.get(V);return o&&V.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&B.__useRenderToTexture!==!1}function Xe(V){let B=n.render.frame;f.get(V)!==B&&(f.set(V,B),V.update())}function We(V,B){let ne=V.encoding,Se=V.format,R=V.type;return V.isCompressedTexture===!0||V.isVideoTexture===!0||V.format===yv||ne!==Fs&&(ne===mt?o===!1?t.has("EXT_sRGB")===!0&&Se===ri?(V.format=yv,V.minFilter=yt,V.generateMipmaps=!1):B=TM.sRGBToLinear(B):(Se!==ri||R!==xr)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",ne)),B}this.allocateTextureUnit=F,this.resetTextureUnits=N,this.setTexture2D=q,this.setTexture2DArray=G,this.setTexture3D=Q,this.setTextureCube=ee,this.rebindTextures=Re,this.setupRenderTarget=Ae,this.updateRenderTargetMipmap=Ne,this.updateMultisampleRenderTarget=Fe,this.setupDepthRenderbuffer=xe,this.setupFrameBufferTexture=ae,this.useMultisampledRTT=Me}function IL(e,t,i){let r=i.isWebGL2;function s(a,n=null){let o;if(a===xr)return 5121;if(a===fD)return 32819;if(a===mD)return 32820;if(a===dD)return 5120;if(a===uD)return 5122;if(a===bM)return 5123;if(a===pD)return 5124;if(a===Qa)return 5125;if(a===Vt)return 5126;if(a===rn)return r?5131:(o=t.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(a===gD)return 6406;if(a===ri)return 6408;if(a===vD)return 6409;if(a===yD)return 6410;if(a===zo)return 6402;if(a===Go)return 34041;if(a===yv)return o=t.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(a===sp)return 6403;if(a===xD)return 36244;if(a===Sp)return 33319;if(a===bD)return 33320;if(a===wM)return 36249;if(a===om||a===lm||a===hm||a===cm)if(n===mt)if(o=t.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(a===om)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(a===lm)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(a===hm)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(a===cm)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=t.get("WEBGL_compressed_texture_s3tc"),o!==null){if(a===om)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===lm)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===hm)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===cm)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===nx||a===ox||a===lx||a===hx)if(o=t.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(a===nx)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===ox)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===lx)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===hx)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===wD)return o=t.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(a===cx||a===dx)if(o=t.get("WEBGL_compressed_texture_etc"),o!==null){if(a===cx)return n===mt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(a===dx)return n===mt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(a===ux||a===px||a===fx||a===mx||a===gx||a===vx||a===yx||a===xx||a===bx||a===wx||a===Sx||a===_x||a===Ax||a===Mx)if(o=t.get("WEBGL_compressed_texture_astc"),o!==null){if(a===ux)return n===mt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(a===px)return n===mt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(a===fx)return n===mt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(a===mx)return n===mt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(a===gx)return n===mt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(a===vx)return n===mt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(a===yx)return n===mt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(a===xx)return n===mt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(a===bx)return n===mt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(a===wx)return n===mt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(a===Sx)return n===mt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(a===_x)return n===mt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(a===Ax)return n===mt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(a===Mx)return n===mt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(a===dm)if(o=t.get("EXT_texture_compression_bptc"),o!==null){if(a===dm)return n===mt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(a===SD||a===Ex||a===Cx||a===Tx)if(o=t.get("EXT_texture_compression_rgtc"),o!==null){if(a===dm)return o.COMPRESSED_RED_RGT
vendor: 5,331 bytes, line 3140
3140C1_EXT;if(a===Ex)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(a===Cx)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(a===Tx)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return a===Bo?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 OL=class extends mr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}},Ka=class extends Ut{constructor(){super(),this.isGroup=!0,this.type="Group"}},RL={type:"move"},Fm=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ka,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 Ka,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 Ka,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 g=t.getJointPose(f,i),m=this._getHandJoint(l,f);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.jointRadius=g.radius),m.visible=g!==null}let h=l.joints["index-finger-tip"],c=l.joints["thumb-tip"],d=h.position.distanceTo(c.position),u=.02,p=.005;l.inputState.pinching&&d>u+p?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=u-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(RL)))}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 Ka;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}},uh=class extends oi{constructor(e,t,i,r,s,a,n,o,l,h){if(h=h!==void 0?h:zo,h!==zo&&h!==Go)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&h===zo&&(i=Qa),i===void 0&&h===Go&&(i=Bo),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:wt,this.minFilter=o!==void 0?o:wt,this.flipY=!1,this.generateMipmaps=!1}},LL=class extends ur{constructor(e,t){super();let i=this,r=null,s=1,a=null,n="local-floor",o=1,l=null,h=null,c=null,d=null,u=null,p=null,f=t.getContextAttributes(),g=null,m=null,v=[],y=[],x=new Set,w=new Map,S=new mr;S.layers.enable(1),S.viewport=new ht;let b=new mr;b.layers.enable(2),b.viewport=new ht;let A=[S,b],_=new OL;_.layers.enable(1),_.layers.enable(2);let E=null,C=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(G){let Q=v[G];return Q===void 0&&(Q=new Fm,v[G]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(G){let Q=v[G];return Q===void 0&&(Q=new Fm,v[G]=Q),Q.getGripSpace()},this.getHand=function(G){let Q=v[G];return Q===void 0&&(Q=new Fm,v[G]=Q),Q.getHandSpace()};function T(G){let Q=y.indexOf(G.inputSource);if(Q===-1)return;let ee=v[Q];ee!==void 0&&ee.dispatchEvent({type:G.type,data:G.inputSource})}function P(){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",P),r.removeEventListener("inputsourceschange",O);for(let G=0;G<v.length;G++){let Q=y[G];
3140Q!==null&&(y[G]=null,v[G].disconnect(Q))}E=null,C=null,e.setRenderTarget(g),u=null,d=null,c=null,r=null,m=null,q.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(G){s=G,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(G){n=G,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(G){l=G},this.getBaseLayer=function(){return d!==null?d:u},this.getBinding=function(){return c},this.getFrame=function(){return p},this.getSession=function(){return r},this.setSession=async function(G){if(r=G,r!==null){if(g=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",P),r.addEventListener("inputsourceschange",O),f.xrCompatible!==!0&&await t.makeXRCompatible(),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let Q={antialias:r.renderState.layers===void 0?f.antialias:!0,alpha:f.alpha,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:s};u=new XRWebGLLayer(r,t,Q),r.updateRenderState({baseLayer:u}),m=new Tt(u.framebufferWidth,u.framebufferHeight,{format:ri,type:xr,encoding:e.outputEncoding,stencilBuffer:f.stencil})}else{let Q=null,ee=null,Y=null;f.depth&&(Y=f.stencil?35056:33190,Q=f.stencil?Go:zo,ee=f.stencil?Bo:Qa);let $={colorFormat:32856,depthFormat:Y,scaleFactor:s};c=new XRWebGLBinding(r,t),d=c.createProjectionLayer($),r.updateRenderState({layers:[d]}),m=new Tt(d.textureWidth,d.textureHeight,{format:ri,type:xr,depthTexture:new uh(d.textureWidth,d.textureHeight,ee,void 0,void 0,void 0,void 0,void 0,void 0,Q),stencilBuffer:f.stencil,encoding:e.outputEncoding,samples:f.antialias?4:0});let H=e.properties.get(m);H.__ignoreDepthValues=d.ignoreDepthValues}m.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 O(G){for(let Q=0;Q<G.removed.length;Q++){let ee=G.removed[Q],Y=y.indexOf(ee);Y>=0&&(y[Y]=null,v[Y].disconnect(ee))}for(let Q=0;Q<G.added.length;Q++){let ee=G.added[Q],Y=y.indexOf(ee);if(Y===-1){for(let H=0;H<v.length;H++)if(H>=y.length){y.push(ee),Y=H;break}else if(y[H]===null){y[H]=ee,Y=H;break}if(Y===-1)break}let $=v[Y];$&&$.connect(ee)}}let D=new M,k=new M;function W(G,Q,ee){D.setFromMatrixPosition(Q.matrixWorld),k.setFromMatrixPosition(ee.matrixWorld);let Y=D.distanceTo(k),$=Q.projectionMatrix.elements,H=ee.projectionMatrix.elements,le=$[14]/($[10]-1),re=$[14]/($[10]+1),te=($[9]+1)/$[5],ae=($[9]-1)/$[5],ce=($[8]-1)/$[0],ue=(H[8]+1)/H[0],xe=le*ce,Re=le*ue,Ae=Y/(-ce+ue),Ne=Ae*-ce;Q.matrixWorld.decompose(G.position,G.quaternion,G.scale),G.translateX(Ne),G.translateZ(Ae),G.matrixWorld.compose(G.position,G.quaternion,G.scale),G.matrixWorldInverse.copy(G.matrixWorld).invert();let Fe=le+Ae,Ee=re+Ae,Me=xe-Ne,Xe=Re+(Y-Ne),We=te*re/Ee*Fe,V=ae*re/Ee*Fe;G.projectionMatrix.makePerspective(Me,Xe,We,V,Fe,Ee)}function N(G,Q){Q===null?G.matrixWorld.copy(G.matrix):G.matrixWorld.multiplyMatrices(Q.matrixWorld,G.matrix),G.matrixWorldInverse.copy(G.matrixWorld).invert()}this.updateCamera=function(G){if(r===null)return;_.near=b.near=S.near=G.near,_.far=b.far=S.far=G.far,(E!==_.near||C!==_.far)&&(r.updateRenderState({depthNear:_.near,depthFar:_.far}),E=_.near,C=_.far);let Q=G.parent,ee=_.cameras;N(_,Q);for(let $=0;$<ee.length;$++)N(ee[$],Q);_.matrixWorld.decompose(_.position,_.quaternion,_.scale),G.matrix.copy(_.matrix),G.matrix.decompose(G.position,G.quaternion,G.scale);let Y=G.children;for(let $=0,H=Y.length;$<H;$++)Y[$].updateMatrixWorld(!0);ee.length===2?W(_,S,b):_.projectionMatrix.copy(S.projectionMatrix)},this.getCamera=function(){return _},this.getFoveation=function(){if(!(d===null&&u===null))return o},this.setFoveation=function(G){o=G,d!==null&&(d.fixedFoveation=G),u!==null&&u.fixedFoveation!==void 0&&(u.fixedFoveation=G)},this.getPlanes=function(){return x};let F=null;function Z(G,Q){if(h=Q.getViewerPose(l||a),p=Q,h!==null){let ee=h.views;u!==null&&(e.setRenderTargetFramebuffer(m,u.framebuffer),e.setRenderTarget(m));let Y=!1;ee.length!==_.cameras.length&&(_.cameras.length=0,Y=!0);for(let $=0;$<ee.length;$++){let H=ee[$],le=null;if(u!==null)le=u.getViewport(H);else{let te=c.getViewSubImage(d,H);le=te.viewport,$===0&&(e.setRenderTargetTextures(m,te.colorTexture,d.ignoreDepthValues?void 0:te.depthStencilTexture),e.setRenderTarget(m))}let re=A[$];re===void 0&&(re=new mr,re.layers.enable($),re.viewport=new ht,A[$]=re),re.matrix.fromArray(H.transform.matrix),re.projectionMatrix.fromArray(H.projectionMatrix),re.viewport.set(le.x,le.y,le.width,le.height),$===0&&_.matrix.copy(re.matrix),Y===!0&&_.cameras.push(re)}}for(let ee=0;ee<v.length;ee++){let Y=y[ee],$=v[ee];Y!==null&&$!==void 0&&$.update(Y,Q,l||a)}if(F&&F(G,Q),Q.detectedPlanes){i.dispatchEvent({type:"planesdetected",data:Q.detectedPlanes});let ee=null;for(let Y of x)Q.detectedPlanes.has(Y)||(ee===null&&(ee=[]),ee.push(Y));if(ee!==null)for(let Y of ee)x.delete(Y),w.delete(Y),i.dispatchEvent({type:"planeremoved",data:Y});for(let Y of Q.detectedPlanes)if(!x.has(Y))x.add(Y),w.set(Y,Q.lastChangedTime),i.dispatchEvent({type:"planeadded",data:Y});else{let $=w.get(Y);Y.lastChangedTime>$&&(w.set(Y,Y.lastChangedTime),i.dispatchEvent({type:"planechanged",data:Y}))}}p=null}
3140let q=new LM;q.setAnimationLoop(Z),this.setAnimationLoop=function(G){F=G},this.dispose=function(){}}};function BL(e,t){function i(g,m){m.color.getRGB(g.fogColor.value,RM(e)),m.isFog?(g.fogNear.value=m.near,g.fogFar.value=m.far):m.isFogExp2&&(g.fogDensity.value=m.density)}function r(g,m,v,y,x){m.isMeshBasicMaterial||m.isMeshLambertMaterial?s(g,m):m.isMeshToonMaterial?(s(g,m),c(g,m)):m.isMeshPhongMaterial?(s(g,m),h(g,m)):m.isMeshStandardMaterial?(s(g,m),d(g,m),m.isMeshPhysicalMaterial&&u(g,m,x)):m.isMeshMatcapMaterial?(s(g,m),p(g,m)):m.isMeshDepthMaterial?s(g,m):m.isMeshDistanceMaterial?(s(g,m),f(g,m)):m.isMeshNormalMaterial?s(g,m):m.isLineBasicMaterial?(a(g,m),m.isLineDashedMaterial&&n(g,m)):m.isPointsMaterial?o(g,m,v,y):m.isSpriteMaterial?l(g,m):m.isShadowMaterial?(g.color.value.copy(m.color),g.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function s(g,m){g.opacity.value=m.opacity,m.color&&g.diffuse.value.copy(m.color),m.emissive&&g.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(g.map.value=m.map),m.alphaMap&&(g.alphaMap.value=m.alphaMap),m.bumpMap&&(g.bumpMap.value=m.bumpMap,g.bumpScale.value=m.bumpScale,m.side===Ki&&(g.bumpScale.value*=-1)),m.displacementMap&&(g.displacementMap.value=m.displacementMap,g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias),m.emissiveMap&&(g.emissiveMap.value=m.emissiveMap),m.normalMap&&(g.normalMap.value=m.normalMap,g.normalScale.value.copy(m.normalScale),m.side===Ki&&g.normalScale.value.negate()),m.specularMap&&(g.specularMap.value=m.specularMap),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest);let v=t.get(m).envMap;if(v&&(g.envMap.value=v,g.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=m.reflectivity,g.ior.value=m.ior,g.refractionRatio.value=m.refractionRatio),m.lightMap){g.lightMap.value=m.lightMap;let w=e.physicallyCorrectLights!==!0?Math.PI:1;g.lightMapIntensity.value=m.lightMapIntensity*w}m.aoMap&&(g.aoMap.value=m.aoMap,g.aoMapIntensity.value=m.aoMapIntensity);let y;m.map?y=m.map:m.specularMap?y=m.specularMap:m.displacementMap?y=m.displacementMap:m.normalMap?y=m.normalMap:m.bumpMap?y=m.bumpMap:m.roughnessMap?y=m.roughnessMap:m.metalnessMap?y=m.metalnessMap:m.alphaMap?y=m.alphaMap:m.emissiveMap?y=m.emissiveMap:m.clearcoatMap?y=m.clearcoatMap:m.clearcoatNormalMap?y=m.clearcoatNormalMap:m.clearcoatRoughnessMap?y=m.clearcoatRoughnessMap:m.iridescenceMap?
3140y=m.iridescenceMap:m.iridescenceThicknessMap?y=m.iridescenceThicknessMap:m.specularIntensityMap?y=m.specularIntensityMap:m.specularColorMap?y=m.specularColorMap:m.transmissionMap?y=m.transmissionMap:m.thicknessMap?y=m.thicknessMap:m.sheenColorMap?y=m.sheenColorMap:m.sheenRoughnessMap&&(y=m.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),g.uvTransform.value.copy(y.matrix));let x;m.aoMap?x=m.aoMap:m.lightMap&&(x=m.lightMap),x!==void 0&&(x.isWebGLRenderTarget&&(x=x.texture),x.matrixAutoUpdate===!0&&x.updateMatrix(),g.uv2Transform.value.copy(x.matrix))}function a(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity}function n(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize+m.gapSize,g.scale.value=m.scale}function o(g,m,v,y){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*v,g.scale.value=y*.5,m.map&&(g.map.value=m.map),m.alphaMap&&(g.alphaMap.value=m.alphaMap),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest);let x;m.map?x=m.map:m.alphaMap&&(x=m.alphaMap),x!==void 0&&(x.matrixAutoUpdate===!0&&x.updateMatrix(),g.uvTransform.value.copy(x.matrix))}function l(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.rotation.value=m.rotation,m.map&&(g.map.value=m.map),m.alphaMap&&(g.alphaMap.value=m.alphaMap),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest);let v;m.map?v=m.map:m.alphaMap&&(v=m.alphaMap),v!==void 0&&(v.matrixAutoUpdate===!0&&v.updateMatrix(),g.uvTransform.value.copy(v.matrix))}function h(g,m){g.specular.value.copy(m.specular),g.shininess.value=Math.max(m.shininess,1e-4)}function c(g,m){m.gradientMap&&(g.gradientMap.value=m.gradientMap)}function d(g,m){g.roughness.value=m.roughness,g.metalness.value=m.metalness,m.roughnessMap&&(g.roughnessMap.value=m.roughnessMap),m.metalnessMap&&(g.metalnessMap.value=m.metalnessMap),t.get(m).envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function u(g,m,v){g.ior.value=m.ior,m.sheen>0&&(g.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),g.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(g.sheenColorMap.value=m.sheenColorMap),m.sheenRoughnessMap&&(g.sheenRoughnessMap.value=m.sheenRoughnessMap)),m.clearcoat>0&&(g.clearcoat.value=m.clearcoat,g.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(g.clearcoatMap.value=m.clearcoatMap),m.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap),m.clearcoatNormalMap&&(g.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),g.clearcoatNormalMap.value=m.clearcoatNormalMap,m.side===Ki&&g.clearcoatNormalScale.value.negate())),m.iridescence>0&&(g.iridescence.value=m.iridescence,g.iridescenceIOR.value=m.iridescenceIOR,g.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(g.iridescenceMap.value=m.iridescenceMap),m.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=m.iridescenceThicknessMap)),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=v.texture,g.transmissionSamplerSize.value.set(v.width,v.height),m.transmissionMap&&(g.transmissionMap.value=m.transmissionMap),g.thickness.value=m.thickness,m.thicknessMap&&(g.thicknessMap.value=m.thicknessMap),g.attenuationDistance.value=m.attenuationDistance,g.attenuationColor.value.copy(m.attenuationColor)),g.specularIntensity.value=m.specularIntensity,g.specularColor.value.copy(m.specularColor),m.specularIntensityMap&&(g.specularIntensityMap.value=m.specularIntensityMap),m.specularColorMap&&(g.specularColorMap.value=m.specularColorMap)}function p(g,m){m.matcap&&(g.matcap.value=m.matcap)}function f(g,m){g.referencePosition.value.copy(m.referencePosition),g.nearDistance.value=m.nearDistance,g.farDistance.value=m.farDistance}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function zL(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",m));let S=x.program;r.updateUBOMapping(y,S);let b=t.render.frame;a[y.id]!==b&&(u(y),a[y.id]=b)}function c(y){let x=d();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 d(){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 u(y){let x=s[y.id],w=y.uniforms,S=y.__cache;e.bindBuffer(35345,x);for(let b=0,A=w.length;b<A;b++){let _=w[b];if(p(_,b,S)===!0){let E=_.__offset,C=Array.isArray(_.value)?_.value:[_.value],T=0;for(let P=0;P<C.length;P++){let O=C[P],D=g(O);typeof O=="number"?(_.__data[0]=O,e.bufferSubData(35345,E+T,_.__data)):O.isMatrix3?(_.__data[0]=O.elements[0],_.__data[1]=O.elements[1],_.__data[2]=O.elements[2],_.__data[3]=O.elements[0],_.__data[4]=O.elements[3],_.__data[5]=O.elements[4],_.__data[6]=O.elements[5],_.__data[7]=O.elements[0],_.__data[8]=O.elements[6],_.__data[9]=O.elements[7],_.__data[10]=O.elements[8],_.__data[11]=O.elements[0]):(O.toArray(_.__data,T),T+=D.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(35345,E,_.__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],A=[];for(let _=0;_<b.length;_++)A.push(b[_].clone());w[x]=A}return!0}
3140else if(typeof S=="number"){if(w[x]!==S)return w[x]=S,!0}else{let b=Array.isArray(w[x])?w[x]:[w[x]],A=Array.isArray(S)?S:[S];for(let _=0;_<b.length;_++){let E=b[_];if(E.equals(A[_])===!1)return E.copy(A[_]),!0}}return!1}function f(y){let x=y.uniforms,w=0,S=16,b=0;for(let A=0,_=x.length;A<_;A++){let E=x[A],C={boundary:0,storage:0},T=Array.isArray(E.value)?E.value:[E.value];for(let P=0,O=T.length;P<O;P++){let D=T[P],k=g(D);C.boundary+=k.boundary,C.storage+=k.storage}if(E.__data=new Float32Array(C.storage/Float32Array.BYTES_PER_ELEMENT),E.__offset=w,A>0){b=w%S;let P=S-b;b!==0&&P-C.boundary<0&&(w+=S-b,E.__offset=w)}w+=C.storage}return b=w%S,b>0&&(w+=S-b),y.__size=w,y.__cache={},this}function g(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 m(y){let x=y.target;x.removeEventListener("dispose",m);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 FL(){let e=qc("canvas");return e.style.display="block",e}function NM(e={}){this.isWebGLRenderer=!0;let t=e.canvas!==void 0?e.canvas:FL(),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 d=null,u=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=Fs,this.physicallyCorrectLights=!1,this.toneMapping=ua,this.toneMappingExposure=1;let g=this,m=!1,v=0,y=0,x=null,w=-1,S=null,b=new ht,A=new ht,_=null,E=t.width,C=t.height,T=1,P=null,O=null,D=new ht(0,0,E,C),k=new ht(0,0,E,C),W=!1,N=new wy,F=!1,Z=!1,q=null,G=new be,Q=new j,ee=new M,Y={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function $(){return x===null?T:1}let H=i;function le(U,oe){for(let fe=0;fe<U.length;fe++){let se=U[fe],ge=t.getContext(se,oe);if(ge!==null)return ge}return null}try{let U={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${Mh}`),t.addEventListener("webglcontextlost",tt,!1),t.addEventListener("webglcontextrestored",Ye,!1),t.addEventListener("webglcontextcreationerror",Ze,!1),H===null){let oe=["webgl2","webgl","experimental-webgl"];if(g.isWebGL1Renderer===!0&&oe.shift(),H=le(oe,U),H===null)throw le(oe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}H.getShaderPrecisionFormat===void 0&&(H.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(U){throw console.error("THREE.WebGLRenderer: "+U.message),U}let re,te,ae,ce,ue,xe,Re,Ae,Ne,Fe,Ee,Me,Xe,We,V,B,ne,Se,R,Ce,Ue,Ie,de,Ve;function Le(){re=new ZO(H),te=new HO(H,re,e),re.init(te),Ie=new IL(H,re,te),ae=new PL(H,re,te),ce=new $O,ue=new gL,xe=new DL(H,re,ae,ue,te,Ie,ce),Re=new qO(g),Ae=new QO(g),Ne=new l3(H,te),de=new jO(H,re,Ne,te),Fe=new KO(H,Ne,ce,de),Ee=new rR(H,Fe,Ne,ce),R=new iR(H,te,xe),B=new WO(ue),Me=new mL(g,Re,Ae,re,te,de,B),Xe=new BL(g,ue),We=new yL,V=new AL(re,te),Se=new VO(g,Re,Ae,ae,Ee,c,n),ne=new TL(g,Ee,te),Ve=new zL(H,ce,te,ae),Ce=new GO(H,re,ce,te),Ue=new JO(H,re,ce,te),ce.programs=Me.programs,g.capabilities=te,g.extensions=re,g.properties=ue,g.renderLists=We,g.shadowMap=ne,g.state=ae,g.info=ce}Le();let qe=new LL(g,H);this.xr=qe,this.getContext=function(){return H},this.getContextAttributes=function(){return H.getContextAttributes()},this.forceContextLoss=function(){let U=re.get("WEBGL_lose_context");U&&U.loseContext()},this.forceContextRestore=function(){let U=re.get("WEBGL_lose_context");U&&U.restoreContext()},this.getPixelRatio=function(){return T},this.setPixelRatio=function(U){U!==void 0&&(T=U,this.setSize(E,C,!1))}
3140,this.getSize=function(U){return U.set(E,C)},this.setSize=function(U,oe,fe){if(qe.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}E=U,C=oe,t.width=Math.floor(U*T),t.height=Math.floor(oe*T),fe!==!1&&(t.style.width=U+"px",t.style.height=oe+"px"),this.setViewport(0,0,U,oe)},this.getDrawingBufferSize=function(U){return U.set(E*T,C*T).floor()},this.setDrawingBufferSize=function(U,oe,fe){E=U,C=oe,T=fe,t.width=Math.floor(U*fe),t.height=Math.floor(oe*fe),this.setViewport(0,0,U,oe)},this.getCurrentViewport=function(U){return U.copy(b)},this.getViewport=function(U){return U.copy(D)},this.setViewport=function(U,oe,fe,se){U.isVector4?D.set(U.x,U.y,U.z,U.w):D.set(U,oe,fe,se),ae.viewport(b.copy(D).multiplyScalar(T).floor())},this.getScissor=function(U){return U.copy(k)},this.setScissor=function(U,oe,fe,se){U.isVector4?k.set(U.x,U.y,U.z,U.w):k.set(U,oe,fe,se),ae.scissor(A.copy(k).multiplyScalar(T).floor())},this.getScissorTest=function(){return W},this.setScissorTest=function(U){ae.setScissorTest(W=U)},this.setOpaqueSort=function(U){P=U},this.setTransparentSort=function(U){O=U},this.getClearColor=function(U){return U.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(U=!0,oe=!0,fe=!0){let se=0;U&&(se|=16384),oe&&(se|=256),fe&&(se|=1024),H.clear(se)},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",tt,!1),t.removeEventListener("webglcontextrestored",Ye,!1),t.removeEventListener("webglcontextcreationerror",Ze,!1),We.dispose(),V.dispose(),ue.dispose(),Re.dispose(),Ae.dispose(),Ee.dispose(),de.dispose(),Ve.dispose(),Me.dispose(),qe.dispose(),qe.removeEventListener("sessionstart",Be),qe.removeEventListener("sessionend",at),q&&(q.dispose(),q=null),Mt.stop()};function tt(U){U.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),m=!0}function Ye(){console.log("THREE.WebGLRenderer: Context Restored."),m=!1;let U=ce.autoReset,oe=ne.enabled,fe=ne.autoUpdate,se=ne.needsUpdate,ge=ne.type;Le(),ce.autoReset=U,ne.enabled=oe,ne.autoUpdate=fe,ne.needsUpdate=se,ne.type=ge}function Ze(U){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",U.statusMessage)}function Wt(U){let oe=U.target;oe.removeEventListener("dispose",Wt),si(oe)}function si(U){K(U),ue.remove(U)}function K(U){let oe=ue.get(U).programs;oe!==void 0&&(oe.forEach(function(fe){Me.releaseProgram(fe)}),U.isShaderMaterial&&Me.releaseShaderCache(U))}this.renderBufferDirect=function(U,oe,fe,se,ge,Ge){oe===null&&(oe=Y);let ct=ge.isMesh&&ge.matrixWorld.determinant()<0,ut=tm(U,oe,fe,se,ge);ae.setMaterial(se,ct);let Ke=fe.index,Lt=1;se.wireframe===!0&&(Ke=Fe.getWireframeAttribute(fe),Lt=2);let xt=fe.drawRange,bt=fe.attributes.position,gt=xt.start*Lt,Di=(xt.start+xt.count)*Lt;Ge!==null&&(gt=Math.max(gt,Ge.start*Lt),Di=Math.min(Di,(Ge.start+Ge.count)*Lt)),Ke!==null?(gt=Math.max(gt,0),Di=Math.min(Di,Ke.count)):bt!=null&&(gt=Math.max(gt,0),Di=Math.min(Di,bt.count));let Kr=Di-gt;if(Kr<0||Kr===1/0)return;de.setup(ge,se,ut,fe,Ke);let _a,ai=Ce;if(Ke!==null&&(_a=Ne.get(Ke),ai=Ue,ai.setIndex(_a)),ge.isMesh)se.wireframe===!0?(ae.setLineWidth(se.wireframeLinewidth*$()),ai.setMode(1)):ai.setMode(4);else if(ge.isLine){let _t=se.linewidth;_t===void 0&&(_t=1),ae.setLineWidth(_t*$()),ge.isLineSegments?ai.setMode(1):ge.isLineLoop?ai.setMode(2):ai.setMode(3)}else ge.isPoints?ai.setMode(0):ge.isSprite&&ai.setMode(4);if(ge.isInstancedMesh)ai.renderInstances(gt,Kr,ge.count);else if(fe.isInstancedBufferGeometry){let _t=fe._maxInstanceCount!==void 0?fe._maxInstanceCount:1/0,vs=Math.min(fe.instanceCount,_t);ai.renderInstances(gt,Kr,vs)}else ai.render(gt,Kr)},this.compile=function(U,oe){function fe(se,ge,Ge){se.transparent===!0&&se.side===vr&&se.forceSinglePass===!1?(se.side=Ki,se.needsUpdate=!0,Lr(se,ge,Ge),se.side=zs,se.needsUpdate=!0,Lr(se,ge,Ge),se.side=vr):Lr(se,ge,Ge)}
vendor: 2,371 bytes, line 3140
3140u=V.get(U),u.init(),f.push(u),U.traverseVisible(function(se){se.isLight&&se.layers.test(oe.layers)&&(u.pushLight(se),se.castShadow&&u.pushShadow(se))}),u.setupLights(g.physicallyCorrectLights),U.traverse(function(se){let ge=se.material;if(ge)if(Array.isArray(ge))for(let Ge=0;Ge<ge.length;Ge++){let ct=ge[Ge];fe(ct,U,se)}else fe(ge,U,se)}),f.pop(),u=null};let me=null;function we(U){me&&me(U)}function Be(){Mt.stop()}function at(){Mt.start()}let Mt=new LM;Mt.setAnimationLoop(we),typeof self<"u"&&Mt.setContext(self),this.setAnimationLoop=function(U){me=U,qe.setAnimationLoop(U),U===null?Mt.stop():Mt.start()},qe.addEventListener("sessionstart",Be),qe.addEventListener("sessionend",at),this.render=function(U,oe){if(oe!==void 0&&oe.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(m===!0)return;U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),oe.parent===null&&oe.matrixWorldAutoUpdate===!0&&oe.updateMatrixWorld(),qe.enabled===!0&&qe.isPresenting===!0&&(qe.cameraAutoUpdate===!0&&qe.updateCamera(oe),oe=qe.getCamera()),U.isScene===!0&&U.onBeforeRender(g,U,oe,x),u=V.get(U,f.length),u.init(),f.push(u),G.multiplyMatrices(oe.projectionMatrix,oe.matrixWorldInverse),N.setFromProjectionMatrix(G),Z=this.localClippingEnabled,F=B.init(this.clippingPlanes,Z),d=We.get(U,p.length),d.init(),p.push(d),pi(U,oe,0,g.sortObjects),d.finish(),g.sortObjects===!0&&d.sort(P,O),F===!0&&B.beginShadows();let fe=u.state.shadowsArray;if(ne.render(fe,U,oe),F===!0&&B.endShadows(),this.info.autoReset===!0&&this.info.reset(),Se.render(d,U),u.setupLights(g.physicallyCorrectLights),oe.isArrayCamera){let se=oe.cameras;for(let ge=0,Ge=se.length;ge<Ge;ge++){let ct=se[ge];ji(d,U,ct,ct.viewport)}}else ji(d,U,oe);x!==null&&(xe.updateMultisampleRenderTarget(x),xe.updateRenderTargetMipmap(x)),U.isScene===!0&&U.onAfterRender(g,U,oe),de.resetDefaultState(),w=-1,S=null,f.pop(),f.length>0?u=f[f.length-1]:u=null,p.pop(),p.length>0?d=p[p.length-1]:d=null};function pi(U,oe,fe,se){if(U.visible===!1)return;if(U.layers.test(oe.layers)){if(U.isGroup)fe=U.renderOrder;else if(U.isLOD)U.autoUpdate===!0&&U.update(oe);else if(U.isLight)u.pushLight(U),U.castShadow&&u.pushShadow(U);else if(U.isSprite){if(!U.frustumCulled||N.intersectsSprite(U)){se&&ee.setFromMatrixPosition(U.matrixWorld).applyMatrix4(G);let Ge=Ee.update(U),ct=U.material;
3140ct.visible&&d.push(U,Ge,ct,fe,ee.z,null)}}else if((U.isMesh||U.isLine||U.isPoints)&&(U.isSkinnedMesh&&U.skeleton.frame!==ce.render.frame&&(U.skeleton.update(),U.skeleton.frame=ce.render.frame),!U.frustumCulled||N.intersectsObject(U))){se&&ee.setFromMatrixPosition(U.matrixWorld).applyMatrix4(G);let Ge=Ee.update(U),ct=U.material;if(Array.isArray(ct)){let ut=Ge.groups;for(let Ke=0,Lt=ut.length;Ke<Lt;Ke++){let xt=ut[Ke],bt=ct[xt.materialIndex];bt&&bt.visible&&d.push(U,Ge,bt,fe,ee.z,xt)}}else ct.visible&&d.push(U,Ge,ct,fe,ee.z,null)}}let ge=U.children;for(let Ge=0,ct=ge.length;Ge<ct;Ge++)pi(ge[Ge],oe,fe,se)}function ji(U,oe,fe,se){let ge=U.opaque,Ge=U.transmissive,ct=U.transparent;u.setupLightsView(fe),F===!0&&B.setGlobalState(g.clippingPlanes,fe),Ge.length>0&&js(ge,oe,fe),se&&ae.viewport(b.copy(se)),ge.length>0&&Kt(ge,oe,fe),Ge.length>0&&Kt(Ge,oe,fe),ct.length>0&&Kt(ct,oe,fe),ae.buffers.depth.setTest(!0),ae.buffers.depth.setMask(!0),ae.buffers.color.setMask(!0),ae.setPolygonOffset(!1)}function js(U,oe,fe){let se=te.isWebGL2;q===null&&(q=new Tt(1,1,{generateMipmaps:!0,type:re.has("EXT_color_buffer_half_float")?rn:xr,minFilter:ch,samples:se&&a===!0?4:0})),g.getDrawingBufferSize(Q),se?q.setSize(Q.x,Q.y):q.setSize(Cp(Q.x),Cp(Q.y));let ge=g.getRenderTarget();g.setRenderTarget(q),g.clear();let Ge=g.toneMapping;g.toneMapping=ua,Kt(U,oe,fe),g.toneMapping=Ge,xe.updateMultisampleRenderTarget(q),xe.updateRenderTargetMipmap(q),g.setRenderTarget(ge)}function Kt(U,oe,fe){let se=oe.isScene===!0?oe.overrideMaterial:null;for(let ge=0,Ge=U.length;ge<Ge;ge++){let ct=U[ge],ut=ct.object,Ke=ct.geometry,Lt=se===null?ct.material:se,xt=ct.group;ut.layers.test(fe.layers)&&gs(ut,oe,fe,Ke,Lt,xt)}}function gs(U,oe,fe,se,ge,Ge){U.onBeforeRender(g,oe,fe,se,ge,Ge),U.modelViewMatrix.multiplyMatrices(fe.matrixWorldInverse,U.matrixWorld),U.normalMatrix.getNormalMatrix(U.modelViewMatrix),ge.onBeforeRender(g,oe,fe,se,U,Ge),ge.transparent===!0&&ge.side===vr&&ge.forceSinglePass===!1?(ge.side=Ki,ge.needsUpdate=!0,g.renderBufferDirect(fe,oe,se,ge,U,Ge),ge.side=zs,ge.needsUpdate=!0,g.renderBufferDirect(fe,oe,se,ge,U,Ge),ge.side=vr):g.renderBufferDirect(fe,oe,se,ge,U,Ge),U.onAfterRender(g,oe,fe,se,ge,Ge)}function Lr(U,oe,fe){oe.isScene!==!0&&(oe=Y);let se=ue.get(U),ge=u.state.lights,Ge=u.state.shadowsArray,ct=ge.state.version,ut=Me.getParameters(U,ge.state,Ge,oe,fe),Ke=Me.getProgramCacheKey(ut),Lt=se.programs;se.environment=U.isMeshStandardMaterial?oe.environment:null,se.fog=oe.fog,se.envMap=(U.isMeshStandardMaterial?Ae:Re).get(U.envMap||se.environment),Lt===void 0&&(U.addEventListener("dispose",Wt),Lt=new Map,se.programs=Lt);let xt=Lt.get(Ke);if(xt!==void 0){if(se.currentProgram===xt&&se.lightsStateVersion===ct)return il(U,ut),xt}else ut.uniforms=Me.getUniforms(U),U.onBuild(fe,ut,g),U.onBeforeCompile(ut,g),xt=Me.acquireProgram(ut,Ke),Lt.set(Ke,xt),se.uniforms=ut.uniforms;let bt=se.uniforms;(!U.isShaderMaterial&&!U.isRawShaderMaterial||U.clipping===!0)&&(bt.clippingPlanes=B.uniform),il(U,ut),se.needsLights=jh(U),se.lightsStateVersion=ct,se.needsLights&&(bt.ambientLightColor.value=ge.state.ambient,bt.lightProbe.value=ge.state.probe,bt.directionalLights.value=ge.state.directional,bt.directionalLightShadows.value=ge.state.directionalShadow,bt.spotLights.value=ge.state.spot,bt.spotLightShadows.value=ge.state.spotShadow,bt.rectAreaLights.value=ge.state.rectArea,bt.ltc_1.value=ge.state.rectAreaLTC1,bt.ltc_2.value=ge.state.rectAreaLTC2,bt.pointLights.value=ge.state.point,bt.pointLightShadows.value=ge.state.pointShadow,bt.hemisphereLights.value=ge.state.hemi,bt.directionalShadowMap.value=ge.state.directionalShadowMap,bt.directionalShadowMatrix.value=ge.state.directionalShadowMatrix,bt.spotShadowMap.value=ge.state.spotShadowMap,bt.spotLightMatrix.value=ge.state.spotLightMatrix,bt.spotLightMap.value=ge.state.spotLightMap,bt.pointShadowMap.value=ge.state.pointShadowMap,bt.pointShadowMatrix.value=ge.state.pointShadowMatrix);let gt=xt.getUniforms(),Di=np.seqWithValue(gt.seq,bt);return se.currentProgram=xt,se.uniformsList=Di,xt}function il(U,oe){let fe=ue.get(U);fe.outputEncoding=oe.outputEncoding,fe.instancing=oe.instancing,fe.skinning=oe.skinning,fe.morphTargets=oe.morphTargets,fe.morphNormals=oe.morphNormals,fe.morphColors=oe.morphColors,fe.morphTargetsCount=oe.morphTargetsCount,fe.numClippingPlanes=oe.numClippingPlanes,fe.numIntersection=oe.numClipIntersection,fe.vertexAlphas=oe.vertexAlphas,fe.vertexTangents=oe.vertexTangents,fe.toneMapping=oe.toneMapping}function tm(U,oe,fe,se,ge){oe.isScene!==!0&&(oe=Y),xe.resetTextureUnits();let Ge=oe.fog,ct=se.isMeshStandardMaterial?oe.environment:null,ut=x===null?g.outputEncoding:x.isXRRenderTarget===!0?x.texture.encoding:Fs,Ke=(se.isMeshStandardMaterial?Ae:Re).get(se.envMap||ct),Lt=se.vertexColors===!0&&!!fe.attributes.color&&fe.attributes.color.itemSize===4,xt=!!se.normalMap&&!!fe.attributes.tangent,bt=!!fe.morphAttributes.position,gt=!!fe.morphAttributes.normal,Di=!!fe.morphAttributes.color,Kr=se.toneMapped?g.toneMapping:ua,_a=fe.morphAttributes.position||fe.morphAttributes.normal||fe.morphAttributes.color,ai=_a!==void 0?_a.length:0,_t=ue.get(se),vs=u.state.lights;if(F===!0&&(Z===!0||U!==S)){let z=U===S&&se.id===w;B.setState(se,U,z)}let St=!1;se.version===_t.__version?(_t.needsLights&&_t.lightsStateVersion!==vs.state.ver
vendor: 5,094 bytes, line 3140
3140sion||_t.outputEncoding!==ut||ge.isInstancedMesh&&_t.instancing===!1||!ge.isInstancedMesh&&_t.instancing===!0||ge.isSkinnedMesh&&_t.skinning===!1||!ge.isSkinnedMesh&&_t.skinning===!0||_t.envMap!==Ke||se.fog===!0&&_t.fog!==Ge||_t.numClippingPlanes!==void 0&&(_t.numClippingPlanes!==B.numPlanes||_t.numIntersection!==B.numIntersection)||_t.vertexAlphas!==Lt||_t.vertexTangents!==xt||_t.morphTargets!==bt||_t.morphNormals!==gt||_t.morphColors!==Di||_t.toneMapping!==Kr||te.isWebGL2===!0&&_t.morphTargetsCount!==ai)&&(St=!0):(St=!0,_t.__version=se.version);let Aa=_t.currentProgram;St===!0&&(Aa=Lr(se,oe,ge));let so=!1,dn=!1,Gs=!1,I=Aa.getUniforms(),L=_t.uniforms;if(ae.useProgram(Aa.program)&&(so=!0,dn=!0,Gs=!0),se.id!==w&&(w=se.id,dn=!0),so||S!==U){if(I.setValue(H,"projectionMatrix",U.projectionMatrix),te.logarithmicDepthBuffer&&I.setValue(H,"logDepthBufFC",2/(Math.log(U.far+1)/Math.LN2)),S!==U&&(S=U,dn=!0,Gs=!0),se.isShaderMaterial||se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshStandardMaterial||se.envMap){let z=I.map.cameraPosition;z!==void 0&&z.setValue(H,ee.setFromMatrixPosition(U.matrixWorld))}(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial)&&I.setValue(H,"isOrthographic",U.isOrthographicCamera===!0),(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial||se.isShadowMaterial||ge.isSkinnedMesh)&&I.setValue(H,"viewMatrix",U.matrixWorldInverse)}if(ge.isSkinnedMesh){I.setOptional(H,ge,"bindMatrix"),I.setOptional(H,ge,"bindMatrixInverse");let z=ge.skeleton;z&&(te.floatVertexTextures?(z.boneTexture===null&&z.computeBoneTexture(),I.setValue(H,"boneTexture",z.boneTexture,xe),I.setValue(H,"boneTextureSize",z.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 X=fe.morphAttributes;if((X.position!==void 0||X.normal!==void 0||X.color!==void 0&&te.isWebGL2===!0)&&R.update(ge,fe,se,Aa),(dn||_t.receiveShadow!==ge.receiveShadow)&&(_t.receiveShadow=ge.receiveShadow,I.setValue(H,"receiveShadow",ge.receiveShadow)),se.isMeshGouraudMaterial&&se.envMap!==null&&(L.envMap.value=Ke,L.flipEnvMap.value=Ke.isCubeTexture&&Ke.isRenderTargetTexture===!1?-1:1),dn&&(I.setValue(H,"toneMappingExposure",g.toneMappingExposure),_t.needsLights&&im(L,Gs),Ge&&se.fog===!0&&Xe.refreshFogUniforms(L,Ge),Xe.refreshMaterialUniforms(L,se,T,C,q),np.upload(H,_t.uniformsList,L,xe)),se.isShaderMaterial&&se.uniformsNeedUpdate===!0&&(np.upload(H,_t.uniformsList,L,xe),se.uniformsNeedUpdate=!1),se.isSpriteMaterial&&I.setValue(H,"center",ge.center),I.setValue(H,"modelViewMatrix",ge.modelViewMatrix),I.setValue(H,"normalMatrix",ge.normalMatrix),I.setValue(H,"modelMatrix",ge.matrixWorld),ge.previousModelViewMatrix&&I.setValue(H,"previousModelViewMatrix",ge.previousModelViewMatrix),U.previousProjectionMatrix&&I.setValue(H,"previousProjectionMatrix",U.previousProjectionMatrix),se.isShaderMaterial||se.isRawShaderMaterial){let z=se.uniformsGroups;for(let J=0,_e=z.length;J<_e;J++)if(te.isWebGL2){let Ma=z[J];Ve.update(Ma,Aa),Ve.bind(Ma,Aa)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Aa}function im(U,oe){U.ambientLightColor.needsUpdate=oe,U.lightProbe.needsUpdate=oe,U.directionalLights.needsUpdate=oe,U.directionalLightShadows.needsUpdate=oe,U.pointLights.needsUpdate=oe,U.pointLightShadows.needsUpdate=oe,U.spotLights.needsUpdate=oe,U.spotLightShadows.needsUpdate=oe,U.rectAreaLights.needsUpdate=oe,U.hemisphereLights.needsUpdate=oe}function jh(U){return U.isMeshLambertMaterial||U.isMeshToonMaterial||U.isMeshPhongMaterial||U.isMeshStandardMaterial||U.isShadowMaterial||U.isShaderMaterial&&U.lights===!0}this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return x},this.setRenderTargetTextures=function(U,oe,fe){ue.get(U.texture).__webglTexture=oe,ue.get(U.depthTexture).__webglTexture=fe;let se=ue.get(U);se.__hasExternalTextures=!0,se.__hasExternalTextures&&(se.__autoAllocateDepthBuffer=fe===void 0,se.__autoAllocateDepthBuffer||re.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),se.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(U,oe){let fe=ue.get(U);fe.__webglFramebuffer=oe,fe.__useDefaultFramebuffer=oe===void 0},this.setRenderTarget=function(U,oe=0,fe=0){x=U,v=oe,y=fe;let se=!0,ge=null,Ge=!1,ct=!1;if(U){let ut=ue.get(U);ut.__useDefaultFramebuffer!==void 0?(ae.bindFramebuffer(36160,null),se=!1):ut.__webglFramebuffer===void 0?xe.setupRenderTarget(U):ut.__hasExternalTextures&&xe.rebindTextures(U,ue.get(U.texture).__webglTexture,ue.get(U.depthTexture).__webglTexture);let Ke=U.texture;(Ke.isData3DTexture||Ke.isDataArrayTexture||Ke.isCompressedArrayTexture)&&(ct=!0);let Lt=ue.get(U).__webglFramebuffer;
3140U.isWebGLCubeRenderTarget?(ge=Lt[oe],Ge=!0):te.isWebGL2&&U.samples>0&&xe.useMultisampledRTT(U)===!1?ge=ue.get(U).__webglMultisampledFramebuffer:ge=Lt,b.copy(U.viewport),A.copy(U.scissor),_=U.scissorTest}else b.copy(D).multiplyScalar(T).floor(),A.copy(k).multiplyScalar(T).floor(),_=W;if(ae.bindFramebuffer(36160,ge)&&te.drawBuffers&&se&&ae.drawBuffers(U,ge),ae.viewport(b),ae.scissor(A),ae.setScissorTest(_),Ge){let ut=ue.get(U.texture);H.framebufferTexture2D(36160,36064,34069+oe,ut.__webglTexture,fe)}else if(ct){let ut=ue.get(U.texture),Ke=oe||0;H.framebufferTextureLayer(36160,36064,ut.__webglTexture,fe||0,Ke)}w=-1},this.readRenderTargetPixels=function(U,oe,fe,se,ge,Ge,ct){if(!(U&&U.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ut=ue.get(U).__webglFramebuffer;if(U.isWebGLCubeRenderTarget&&ct!==void 0&&(ut=ut[ct]),ut){ae.bindFramebuffer(36160,ut);try{let Ke=U.texture,Lt=Ke.format,xt=Ke.type;if(Lt!==ri&&Ie.convert(Lt)!==H.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let bt=xt===rn&&(re.has("EXT_color_buffer_half_float")||te.isWebGL2&&re.has("EXT_color_buffer_float"));if(xt!==xr&&Ie.convert(xt)!==H.getParameter(35738)&&!(xt===Vt&&(te.isWebGL2||re.has("OES_texture_float")||re.has("WEBGL_color_buffer_float")))&&!bt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}oe>=0&&oe<=U.width-se&&fe>
3140=0&&fe<=U.height-ge&&H.readPixels(oe,fe,se,ge,Ie.convert(Lt),Ie.convert(xt),Ge)}finally{let Ke=x!==null?ue.get(x).__webglFramebuffer:null;ae.bindFramebuffer(36160,Ke)}}},this.readRenderTargetPixelsAsync=async function(U,oe,fe,se,ge,Ge,ct){if(!(U&&U.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ut=ue.get(U).__webglFramebuffer;if(U.isWebGLCubeRenderTarget&&ct!==void 0&&(ut=ut[ct]),ut){let Ke=U.texture,Lt=Ke.format,xt=Ke.type;if(oe>=0&&oe<=U.width-se&&fe>=0&&fe<=U.height-ge){ae.bindFramebuffer(H.FRAMEBUFFER,ut);let bt=H.createBuffer();H.bindBuffer(H.PIXEL_PACK_BUFFER,bt),H.bufferData(H.PIXEL_PACK_BUFFER,Ge.byteLength,H.STREAM_READ),H.readPixels(oe,fe,se,ge,Ie.convert(Lt),Ie.convert(xt),0);let gt=x!==null?ue.get(x).__webglFramebuffer:null;ae.bindFramebuffer(H.FRAMEBUFFER,gt);let Di=H.fenceSync(H.SYNC_GPU_COMMANDS_COMPLETE,0);return H.flush(),await jD(H,Di,4),H.bindBuffer(H.PIXEL_PACK_BUFFER,bt),H.getBufferSubData(H.PIXEL_PACK_BUFFER,0,Ge),H.deleteBuffer(bt),H.deleteSync(Di),Ge}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(U,oe,fe=0){let se=Math.pow(2,-fe),ge=Math.floor(oe.image.width*se),Ge=Math.floor(oe.image.height*se);xe.setTexture2D(oe,0),H.copyTexSubImage2D(3553,fe,0,0,U.x,U.y,ge,Ge),ae.unbindTexture()},this.copyTextureToTexture=function(U,oe,fe,se=0){let ge=oe.image.width,Ge=oe.image.height,ct=Ie.convert(fe.format),ut=Ie.convert(fe.type);xe.setTexture2D(fe,0),H.pixelStorei(37440,fe.flipY),H.pixelStorei(37441,fe.premultiplyAlpha),H.pixelStorei(3317,fe.unpackAlignment),oe.isDataTexture?H.texSubImage2D(3553,se,U.x,U.y,ge,Ge,ct,ut,oe.image.data):oe.isCompressedTexture?H.compressedTexSubImage2D(3553,se,U.x,U.y,oe.mipmaps[0].width,oe.mipmaps[0].height,ct,oe.mipmaps[0].data):H.texSubImage2D(3553,se,U.x,U.y,ct,ut,oe.image),se===0&&fe.generateMipmaps&&H.generateMipmap(3553),ae.unbindTexture()},this.copyTextureToTexture3D=function(U,oe,fe,se,ge=0){if(g.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Ge=U.max.x-U.min.x+1,ct=U.max.y-U.min.y+1,ut=U.max.z-U.min.z+1,Ke=Ie.convert(se.format),Lt=Ie.convert(se.type),xt;if(se.isData3DTexture)xe.setTexture3D(se,0),xt=32879;else if(se.isDataArrayTexture)xe.setTexture2DArray(se,0),xt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}H.pixelStorei(37440,se.flipY),H.pixelStorei(37441,se.premultiplyAlpha),H.pixelStorei(3317,se.unpackAlignment);let bt=H.getParameter(3314),gt=H.getParameter(32878),Di=H.getParameter(3316),Kr=H.getParameter(3315),_a=H.getParameter(32877),ai=fe.isCompressedTexture?fe.mipmaps[0]:fe.image;H.pixelStorei(3314,ai.width),H.pixelStorei(32878,ai.height),H.pixelStorei(3316,U.min.x),H.pixelStorei(3315,U.min.y),H.pixelStorei(32877,U.min.z),fe.isDataTexture||fe.isData3DTexture?H.texSubImage3D(xt,ge,oe.x,oe.y,oe.z,Ge,ct,ut,Ke,Lt,ai.data):fe.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),H.compressedTexSubImage3D(xt,ge,oe.x,oe.y,oe.z,Ge,ct,ut,Ke,ai.data)):H.texSubImage3D(xt,ge,oe.x,oe.y,oe.z,Ge,ct,ut,Ke,Lt,ai),H.pixelStorei(3314,bt),H.pixelStorei(32878,gt),H.pixelStorei(3316,Di),H.pixelStorei(3315,Kr),H.pixelStorei(32877,_a),ge===0&&se.generateMipmaps&&H.generateMipmap(xt),ae.unbindTexture()},this.initRenderTarget=function(U){ue.get(U).__webglFramebuffer===void 0&&xe.setupRenderTarget(U)},this.initTexture=function(U){U.isCubeTexture?xe.setTextureCube(U,0):U.isData3DTexture?xe.setTexture3D(U,0):U.isDataArrayTexture||U.isCompressedArrayTexture?xe.setTexture2DArray(U,0):xe.setTexture2D(U,0),ae.unbindTexture()},this.resetState=function(){v=0,y=0,x=null,ae.reset(),de.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}var kL=class extends NM{};kL.prototype.isWebGL1Renderer=!0;var VM=class{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new $e(e),this.near=t,this.far=i}clone(){return new VM(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}},Gr=class extends Ut{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}},UL=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=gv,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=ds()}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=ds()),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=ds()),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}}},Sr=new M,wv=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,647 bytes, line 3140
3140get 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++)Sr.fromBufferAttribute(this,t),Sr.applyMatrix4(e),this.setXYZ(t,Sr.x,Sr.y,Sr.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Sr.fromBufferAttribute(this,t),Sr.applyNormalMatrix(e),this.setXYZ(t,Sr.x,Sr.y,Sr.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Sr.fromBufferAttribute(this,t),Sr.transformDirection(e),this.setXYZ(t,Sr.x,Sr.y,Sr.z);return this}setX(e,t){return this.normalized&&(t=Qt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Qt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Qt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Qt(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=Za(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Za(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Za(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Za(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Qt(t,this.array),i=Qt(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=Qt(t,this.array),i=Qt(i,this.array),r=Qt(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=Qt(t,this.array),i=Qt(i,this.array),r=Qt(r,this.array),s=Qt(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 et(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 wv(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}}},jM=class extends Ut{constructor(){super(),this.isBone=!0,this.type="Bone"}},Pr=class extends oi{constructor(e=null,t=1,i=1,r,s,a,n,o,l=wt,h=wt,c,d){super(null,a,n,o,l,h,r,s,c,d),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},lb=new be,NL=new be,_y=class{constructor(e=[],t=[]){this.uuid=ds(),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 be)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let i=new be;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:NL;lb.multiplyMatrices(n,t[s]),lb.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new _y(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=MM(e),e=Math.max(e,4);let t=new Float32Array(e*e*4);t.set(this.boneMatrices);let i=new Pr(t,e,e,ri,Vt);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 jM),this.bones.push(a),this.boneInverses.push(new be().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}},Xc=class extends et{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}},hb=new be,cb=new be,$d=[],VL=new be,Zh=new Zt,jL=class extends Zt{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Xc(new Float32Array(i*16),16),this.instanceColor=null,this.count=i,this.frustumCulled=!1;for(let r=0;r<i;r++)this.setMatrixAt(r,VL)}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(Zh.geometry=this.geometry,Zh.material=this.material,Zh.material!==void 0)for(let s=0;s<r;s++){this.getMatrixAt(s,hb),cb.multiplyMatrices(i,hb),Zh.matrixWorld=cb,Zh.raycast(e,$d);for(let a=0,n=$d.length;a<n;a++){let o=$d[a];o.instanceId=s,o.object=this,t.push(o)}$d.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Xc(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"})}},io=class extends md{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new $e(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}},db=new M,ub=new M,pb=new be,km=new Eh,eu=new Hr,Tp=class extends Ut{constructor(e=new je,t=new io){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++)db.fromBufferAttribute(t,r-1),ub.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=db.distanceTo(ub);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(),eu.copy(i.boundingSphere),eu.applyMatrix4(r),eu.radius+=s,e.ray.intersectsSphere(eu)===!1)return;pb.copy(r).invert(),km.copy(e.ray).applyMatrix4(pb);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,d=new M,u=this.isLineSegments?2:1,p=i.index,f=i.attributes.position;if(p!==null){let g=Math.max(0,a.start),m=Math.min(p.count,a.start+a.count);for(let v=g,y=m-1;v<y;v+=u){let x=p.getX(v),w=p.getX(v+1);if(l.fromBufferAttribute(f,x),h.fromBufferAttribute(f,w),km.distanceSqToSegment(l,h,d,c)>o)continue;d.applyMatrix4(this.matrixWorld);let S=e.ray.origin.distanceTo(d);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 g=Math.max(0,a.start),m=Math.min(f.count,a.start+a.count);for(let v=g,y=m-1;v<y;v+=u){if(l.fromBufferAttribute(f,v),h.fromBufferAttribute(f,v+1),
vendor: 4,176 bytes, line 3140
3140km.distanceSqToSegment(l,h,d,c)>o)continue;d.applyMatrix4(this.matrixWorld);let x=e.ray.origin.distanceTo(d);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}}}}},fb=new M,mb=new M,gd=class extends Tp{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)fb.fromBufferAttribute(t,r),mb.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+fb.distanceTo(mb);e.setAttribute("lineDistance",new De(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}},GL=class extends oi{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:yt,this.magFilter=s!==void 0?s:yt,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)}},HL=class extends oi{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}},ba=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,d=(a-h)/c;return(r+d)/(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 j: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 be;for(let u=0;u<=e;u++){let p=u/e;r[u]=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),d=Math.abs(r[0].z);h<=l&&(l=h,i.set(1,0,0)),c<=l&&(l=c,i.set(0,1,0)),d<=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 u=1;u<=e;u++){if(s[u]=s[u-1].clone(),a[u]=a[u-1].clone(),n.crossVectors(r[u-1],r[u]),n.length()>Number.EPSILON){n.normalize();let p=Math.acos(_i(r[u-1].dot(r[u]),-1,1));s[u].applyMatrix4(o.makeRotationAxis(n,p))}a[u].crossVectors(r[u],s[u])}if(t===!0){let u=Math.acos(_i(s[0].dot(s[e]),-1,1));u/=e,r[0].dot(n.crossVectors(s[0],s[e]))>0&&(u=-u);for(let p=1;p<=e;p++)s[p].applyMatrix4(o.makeRotationAxis(r[p],u*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: 6,984 bytes, line 3140
3140ype,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},If=class extends ba{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 j,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),d=o-this.aX,u=l-this.aY;o=d*h-u*c+this.aX,l=d*c+u*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}},WL=class extends If{constructor(e,t,i,r,s,a){super(e,t,i,i,r,s,a),this.isArcCurve=!0,this.type="ArcCurve"}};function Ay(){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,d){let u=(n-a)/h-(o-a)/(h+c)+(o-n)/c,p=(o-n)/c-(l-n)/(c+d)+(l-o)/d;u*=c,p*=c,s(n,o,u,p)},calc:function(a){let n=a*a,o=n*a;return e+t*a+i*n+r*o}}}var tu=new M,Um=new Ay,Nm=new Ay,Vm=new Ay,qL=class extends ba{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]:(tu.subVectors(r[0],r[1]).add(r[0]),l=tu);let c=r[n%s],d=r[(n+1)%s];if(this.closed||n+2<s?h=r[(n+2)%s]:(tu.subVectors(r[s-1],r[s-2]).add(r[s-1]),h=tu),this.curveType==="centripetal"||this.curveType==="chordal"){let u=this.curveType==="chordal"?.5:.25,p=Math.pow(l.distanceToSquared(c),u),f=Math.pow(c.distanceToSquared(d),u),g=Math.pow(d.distanceToSquared(h),u);f<1e-4&&(f=1),p<1e-4&&(p=f),g<1e-4&&(g=f),Um.initNonuniformCatmullRom(l.x,c.x,d.x,h.x,p,f,g),Nm.initNonuniformCatmullRom(l.y,c.y,d.y,h.y,p,f,g),Vm.initNonuniformCatmullRom(l.z,c.z,d.z,h.z,p,f,g)}else this.curveType==="catmullrom"&&(Um.initCatmullRom(l.x,c.x,d.x,h.x,this.tension),Nm.initCatmullRom(l.y,c.y,d.y,h.y,this.tension),Vm.initCatmullRom(l.z,c.z,d.z,h.z,this.tension));return i.set(Um.calc(o),Nm.calc(o),Vm.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 gb(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 XL(e,t){let i=1-e;return i*i*t}function YL(e,t){return 2*(1-e)*e*t}function QL(e,t){return e*e*t}function Ic(e,t,i,r){return XL(e,t)+YL(e,i)+QL(e,r)}function ZL(e,t){let i=1-e;return i*i*i*t}function KL(e,t){let i=1-e;return 3*i*i*e*t}function JL(e,t){return 3*(1-e)*e*e*t}function $L(e,t){return e*e*e*t}function Oc(e,t,i,r,s){return ZL(e,t)+KL(e,i)+JL(e,r)+$L(e,s)}var Os=class extends ba{constructor(e=new j,t=new j,i=new j,r=new j){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new j){let i=t,r=this.v0,s=this.v1,a=this.v2,n=this.v3;return i.set(Oc(e,r.x,s.x,a.x,n.x),Oc(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}},op=class extends ba{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(Oc(e,r.x,s.x,a.x,n.x),Oc(e,r.y,s.y,a.y,n.y),Oc(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}},Bs=class extends ba{constructor(e=new j,t=new j){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new j){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 j;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}},GM=class extends ba{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}},Qn=class extends ba{constructor(e=new j,t=new j,i=new j){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}
vendor: 10,177 bytes, line 3140
3140getPoint(e,t=new j){let i=t,r=this.v0,s=this.v1,a=this.v2;return i.set(Ic(e,r.x,s.x,a.x),Ic(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}},eB=class extends ba{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(Ic(e,r.x,s.x,a.x),Ic(e,r.y,s.y,a.y),Ic(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}},My=class extends ba{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new j){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(gb(n,o.x,l.x,h.x,c.x),gb(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 j().fromArray(r))}return this}},tB=Object.freeze({__proto__:null,ArcCurve:WL,CatmullRomCurve3:qL,CubicBezierCurve:Os,CubicBezierCurve3:op,EllipseCurve:If,LineCurve:Bs,LineCurve3:GM,QuadraticBezierCurve:Qn,QuadraticBezierCurve3:eB,SplineCurve:My}),HM=class extends ba{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 Bs(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 tB[r.type]().fromJSON(r))}return this}},Pp=class extends HM{constructor(e){super(),this.type="Path",this.currentPoint=new j,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 Bs(this.currentPoint.clone(),new j(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){let s=new Qn(this.currentPoint.clone(),new j(e,t),new j(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,a){let n=new Os(this.currentPoint.clone(),new j(e,t),new j(i,r),new j(s,a));return this.curves.push(n),this.currentPoint.set(s,a),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),i=new My(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 If(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}},WM=class extends je{constructor(e=[new j(0,-.5),new j(.5,0),new j(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=_i(r,0,Math.PI*2);let s=[],a=[],n=[],o=[],l=[],h=1/t,c=new M,d=new j,u=new M,p=new M,f=new M,g=0,m=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:g=e[v+1].x-e[v].x,m=e[v+1].y-e[v].y,u.x=m*1,u.y=-g,u.z=m*0,f.copy(u),u.normalize(),o.push(u.x,u.y,u.z);break;case e.length-1:o.push(f.x,f.y,f.z);break;default:g=e[v+1].x-e[v].x,m=e[v+1].y-e[v].y,u.x=m*1,u.y=-g,u.z=m*0,p.copy(u),u.x+=f.x,u.y+=f.y,u.z+=f.z,u.normalize(),o.push(u.x,u.y,u.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),d.x=v/t,d.y=S/(e.length-1),n.push(d.x,d.y);let b=o[3*S+0]*x,A=o[3*S+1],_=o[3*S+0]*w;l.push(b,A,_)}}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,A=x+1;s.push(w,S,A),s.push(b,A,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 WM(e.points,e.segments,e.phiStart,e.phiLength)}},Ey=class extends je{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=[],d=[],u=[],p=0,f=[],g=i/2,m=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(d,3)),this.setAttribute("uv",new De(u,2));function v(){let x=new M,w=new M,S=0,b=(t-e)/i;for(let A=0;A<=s;A++){let _=[],E=A/s,C=E*(t-e)+e;for(let T=0;T<=r;T++){let P=T/r,O=P*o+n,D=Math.sin(O),k=Math.cos(O);w.x=C*D,w.y=-E*i+g,w.z=C*k,c.push(w.x,w.y,w.z),x.set(D,b,k).normalize(),d.push(x.x,x.y,x.z),u.push(P,1-E),_.push(p++)}f.push(_)}for(let A=0;A<r;A++)for(let _=0;_<s;_++){let E=f[_][A],C=f[_+1][A],T=f[_+1][A+1],P=f[_][A+1];h.push(E,C,P),h.push(C,T,P),S+=6}l.addGroup(m,S,0),m+=S}function y(x){let w=p,S=new j,b=new M,A=0,_=x===!0?e:t,E=x===!0?1:-1;for(let T=1;T<=r;T++)c.push(0,g*E,0),d.push(0,E,0),u.push(.5,.5),p++;let C=p;for(let T=0;T<=r;T++){let P=T/r*o+n,O=Math.cos(P),D=Math.sin(P);b.x=_*D,b.y=g*E,b.z=_*O,c.push(b.x,b.y,b.z),d.push(0,E,0),S.x=O*.5+.5,S.y=D*.5*E+.5,u.push(S.x,S.y),p++}for(let T=0;T<r;T++){let P=w+T,O=C+T;x===!0?h.push(O,O+1,P):h.push(O+1,O,P),A+=3}l.addGroup(m,A,x===!0?1:2),m+=A}}static fromJSON(e){return new Ey(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Cy=class extends Ey{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 Cy(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Ty=class extends je{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)u(t[S+0],y),u(t[S+1],x),u(t[S+2],w),o(y,x,w,v)}function o(v,y,x,w){let S=w+1,b=[];for(let A=0;A<=S;A++){b[A]=[];let _=v.clone().lerp(x,A/S),E=y.clone().lerp(x,A/S),C=S-A;for(let T=0;T<=C;T++)T===0&&A===S?b[A][T]=_:b[A][T]=_.clone().lerp(E,T/C)}for(let A=0;A<S;A++)for(let _=0;_<2*(S-A)-1;_++){let E=Math.floor(_/2);_%2===0?(d(b[A][E+1]),d(b[A+1][E]),d(b[A][E])):(d(b[A][E+1]),d(b[A+1][E+1]),d(b[A+1][E]))}}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=g(v)/2/Math.PI+.5,w=m(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 d(v){s.push(v.x,v.y,v.z)}function u(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 j,b=new j,A=new j;for(let _=0,E=0;_<s.length;_+=9,E+=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[E+0],a[E+1]
vendor: 4,103 bytes, line 3140
3140),b.set(a[E+2],a[E+3]),A.set(a[E+4],a[E+5]),w.copy(v).add(y).add(x).divideScalar(3);let C=g(w);f(S,E+0,v,C),f(b,E+2,y,C),f(A,E+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 g(v){return Math.atan2(v.z,-v.x)}function m(v){return Math.atan2(-v.y,Math.sqrt(v.x*v.x+v.z*v.z))}}static fromJSON(e){return new Ty(e.vertices,e.indices,e.radius,e.details)}},qM=class extends Ty{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 qM(e.radius,e.detail)}},Dp=class extends Pp{constructor(e){super(e),this.uuid=ds(),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 Pp().fromJSON(r))}return this}},iB={triangulate:function(e,t,i=2){let r=t&&t.length,s=r?t[0]*i:e.length,a=XM(e,0,s,i,!0),n=[];if(!a||a.next===a.prev)return n;let o,l,h,c,d,u,p;if(r&&(a=oB(e,t,a,i)),e.length>80*i){o=h=e[0],l=c=e[1];for(let f=i;f<s;f+=i)d=e[f],u=e[f+1],d<o&&(o=d),u<l&&(l=u),d>h&&(h=d),u>c&&(c=u);p=Math.max(h-o,c-l),p=p!==0?32767/p:0}return Yc(a,n,i,o,l,p,0),n}};function XM(e,t,i,r,s){let a,n;if(s===yB(e,t,i,r)>0)for(a=t;a<i;a+=r)n=vb(a,e[a],e[a+1],n);else for(a=i-r;a>=t;a-=r)n=vb(a,e[a],e[a+1],n);return n&&Of(n,n.next)&&(Zc(n),n=n.next),n}function Ho(e,t){if(!e)return e;t||(t=e);let i=e,r;do if(r=!1,!i.steiner&&(Of(i,i.next)||ni(i.prev,i,i.next)===0)){if(Zc(i),i=t=i.prev,i===i.next)break;r=!0}else i=i.next;while(r||i!==t);return t}function Yc(e,t,i,r,s,a,n){if(!e)return;!n&&a&&uB(e,r,s,a);let o=e,l,h;for(;e.prev!==e.next;){if(l=e.prev,h=e.next,a?sB(e,r,s,a):rB(e)){t.push(l.i/i|0),t.push(e.i/i|0),t.push(h.i/i|0),Zc(e),e=h.next,o=h.next;continue}if(e=h,e===o){n?n===1?(e=aB(Ho(e),t,i),Yc(e,t,i,r,s,a,2)):n===2&&nB(e,t,i,r,s,a):Yc(Ho(e),t,i,r,s,a,1);break}}}function rB(e){let t=e.prev,i=e,r=e.next;if(ni(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,d=o<l?o<h?o:h:l<h?l:h,u=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<=u&&f.y>=d&&f.y<=p&&ql(s,o,a,l,n,h,f.x,f.y)&&ni(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function sB(e,t,i,r){let s=e.prev,a=e,n=e.next;if(ni(s,a,n)>=0)return!1;let o=s.x,l=a.x,h=n.x,c=s.y,d=a.y,u=n.y,p=o<l?o<h?o:h:l<h?l:h,f=c<d?c<u?c:u:d<u?d:u,g=o>l?o>h?o:h:l>h?l:h,m=c>d?c>u?c:u:d>u?d:u,v=Sv(p,f,t,i,r),y=Sv(g,m,t,i,r),x=e.prevZ,w=e.nextZ;for(;x&&x.z>=v&&w&&w.z<=y;){if(x.x>=p&&x.x<=g&&x.y>=f&&x.y<=m&&x!==s&&x!==n&&ql(o,c,l,d,h,u,x.x,x.y)&&ni(x.prev,x,x.next)>=0||(x=x.prevZ,w.x>=p&&w.x<=g&&w.y>=f&&w.y<=m&&w!==s&&w!==n&&ql(o,c,l,d,h,u,w.x,w.y)&&ni(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;x&&x.z>=v;){if(x.x>=p&&x.x<=g&&x.y>=f&&x.y<=m&&x!==s&&x!==n&&ql(o,c,l,d,h,u,x.x,x.y)&&ni(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;w&&w.z<=y;){if(w.x>=p&&w.x<=g&&w.y>=f&&w.y<=m&&w!==s&&w!==n&&ql(o,c,l,d,h,u,w.x,w.y)&&ni(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function aB(e,t,i){let r=e;do{let s=r.prev,a=r.next.next;!Of(s,a)&&YM(s,r,r.next,a)&&Qc(s,a)&&Qc(a,s)&&(t.push(s.i/i|0),t.push(r.i/i|0),t.push(a.i/i|0),Zc(r),Zc(r.next),r=e=a),r=r.next}
vendor: 18,014 bytes, line 3140
3140while(r!==e);return Ho(r)}function nB(e,t,i,r,s,a){let n=e;do{let o=n.next.next;for(;o!==n.prev;){if(n.i!==o.i&&mB(n,o)){let l=QM(n,o);n=Ho(n,n.next),l=Ho(l,l.next),Yc(n,t,i,r,s,a,0),Yc(l,t,i,r,s,a,0);return}o=o.next}n=n.next}while(n!==e)}function oB(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=XM(e,o,l,r,!1),h===h.next&&(h.steiner=!0),s.push(fB(h));for(s.sort(lB),a=0;a<s.length;a++)i=hB(s[a],i);return i}function lB(e,t){return e.x-t.x}function hB(e,t){let i=cB(e,t);if(!i)return t;let r=QM(i,e);return Ho(r,r.next),Ho(i,i.next)}function cB(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 u=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(u<=a&&u>r&&(r=u,s=i.x<i.next.x?i:i.next,u===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,d;i=s;do a>=i.x&&i.x>=l&&a!==i.x&&ql(n<h?a:r,n,l,h,n<h?r:a,n,i.x,i.y)&&(d=Math.abs(n-i.y)/(a-i.x),Qc(i,e)&&(d<c||d===c&&(i.x>s.x||i.x===s.x&&dB(s,i)))&&(s=i,c=d)),i=i.next;while(i!==o);return s}function dB(e,t){return ni(e.prev,e,t.prev)<0&&ni(t.next,e,e.next)<0}function uB(e,t,i,r){let s=e;do s.z===0&&(s.z=Sv(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,pB(s)}function pB(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 Sv(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 fB(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 ql(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 mB(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!gB(e,t)&&(Qc(e,t)&&Qc(t,e)&&vB(e,t)&&(ni(e.prev,e,t.prev)||ni(e,t.prev,t))||Of(e,t)&&ni(e.prev,e,e.next)>0&&ni(t.prev,t,t.next)>0)}function ni(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Of(e,t){return e.x===t.x&&e.y===t.y}function YM(e,t,i,r){let s=ru(ni(e,t,i)),a=ru(ni(e,t,r)),n=ru(ni(i,r,e)),o=ru(ni(i,r,t));return!!(s!==a&&n!==o||s===0&&iu(e,i,t)||a===0&&iu(e,r,t)||n===0&&iu(i,e,r)||o===0&&iu(i,t,r))}function iu(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 ru(e){return e>0?1:e<0?-1:0}function gB(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&&YM(i,i.next,e,t))return!0;i=i.next}while(i!==e);return!1}function Qc(e,t){return ni(e.prev,e,e.next)<0?ni(e,t,e.next)>=0&&ni(e,e.prev,t)>=0:ni(e,t,e.prev)<0||ni(e,e.next,t)<0}function vB(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 QM(e,t){let i=new _v(e.i,e.x,e.y),r=new _v(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 vb(e,t,i,r){let s=new _v(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 Zc(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 _v(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 yB(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 ZM=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 ZM.area(e)<0}static triangulateShape(e,t){let i=[],r=[],s=[];yb(e),xb(i,e);let a=e.length;t.forEach(yb);for(let o=0;o<t.length;o++)r.push(a),a+=t[o].length,xb(i,t[o]);let n=iB.triangulate(i,r);for(let o=0;o<n.length;o+=3)s.push(n.slice(o,o+3));return s}};function yb(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function xb(e,t){for(let i=0;i<t.length;i++)e.push(t[i].x),e.push(t[i].y)}var KM=class extends Ty{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 KM(e.radius,e.detail)}},Kl=class extends je{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,d=new M,u=[],p=[],f=[],g=[];for(let m=0;m<=i;m++){let v=[],y=m/i,x=0;m==0&&a==0?x=.5/t:m==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),d.copy(c).normalize(),f.push(d.x,d.y,d.z),g.push(S+x,1-y),v.push(l++)}h.push(v)}for(let m=0;m<i;m++)for(let v=0;v<t;v++){let y=h[m][v+1],x=h[m][v],w=h[m+1][v],S=h[m+1][v+1];(m!==0||a>0)&&u.push(y,x,S),(m!==i-1||o<Math.PI)&&u.push(x,w,S)}this.setIndex(u),this.setAttribute("position",new De(p,3)),this.setAttribute("normal",new De(f,3)),this.setAttribute("uv",new De(g,2))}static fromJSON(e){return new Kl(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}},JM=class extends je{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,d=new M;for(let u=0;u<=i;u++)for(let p=0;p<=r;p++){let f=p/r*s,g=u/i*Math.PI*2;c.x=(e+t*Math.cos(g))*Math.cos(f),c.y=(e+t*Math.cos(g))*Math.sin(f),c.z=t*Math.sin(g),n.push(c.x,c.y,c.z),h.x=e*Math.cos(f),h.y=e*Math.sin(f),d.subVectors(c,h).normalize(),o.push(d.x,d.y,d.z),l.push(p/r),l.push(u/i)}for(let u=1;u<=i;u++)for(let p=1;p<=r;p++){let f=(r+1)*u+p-1,g=(r+1)*(u-1)+p-1,m=(r+1)*(u-1)+p,v=(r+1)*u+p;a.push(f,g,v),a.push(g,m,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 JM(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}},$M=class extends je{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,d=new M,u=new M,p=new M,f=new M,g=new M,m=new M;for(let y=0;y<=i;++y){let x=y/i*s*Math.PI*2;v(x,s,a,e,u),v(x+.01,s,a,e,p),g.subVectors(p,u),m.addVectors(p,u),f.crossVectors(g,m),m.crossVectors(f,g),f.normalize(),m.normalize();for(let w=0;w<=r;++w){let S=w/r*Math.PI*2,b=-t*Math.cos(S),A=t*Math.sin(S);c.x=u.x+(b*m.x+A*f.x),c.y=u.y+(b*m.y+A*f.y),c.z=u.z+(b*m.z+A*f.z),o.push(c.x,c.y,c.z),d.subVectors(c,u).normalize(),l.push(d.x,d.y,d.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,A=(r+1)*(y-1)+x;n.push(w,S,A),n.push(S,b,A)}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 A=Math.cos(y),_=Math.sin(y),E=w/x*y,C=Math.cos(E);b.x=S*(2+C)*.5*A,b.y=S*(2+C)*_*.5,b.z=S*Math.sin(E)*.5}}static fromJSON(e){return new $M(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}},xB=class extends Pt{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}};function gn(e,t,i){return e2(e)?new e.constructor(e.subarray(t,i!==void 0?i:e.length)):e.slice(t,i)}function su(e,t,i){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT=="number"?new t(e):Array.prototype.slice.call(e)}function e2(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function bB(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 bb(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 t2(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 Rf=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_(){}},wB=class extends Rf{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:Gl,endingEnd:Gl}}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 Hl:s=e,n=2*t-i;break;case Mp: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 Hl:a=e,o=2*i-t;break;case Mp: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,d=this._weightPrev,u=this._weightNext,p=(i-t)/(r-t),f=p*p,g=f*p,m=-d*g+2*d*f-d*p,v=(1+d)*g+(-1.5-2*d)*f+(-.5+d)*p+1,y=(-1-u)*g+(1.5+u)*f+.5*p,x=u*g-u*f;for(let w=0;w!==n;++w)s[w]=m*a[h+w]+v*a[l+w]+y*a[o+w]+x*a[c+w];return s}},i2=class extends Rf{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 d=0;d!==n;++d)s[d]=a[l+d]*c+a[o+d]*h;return s}},SB=class extends Rf{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}},wa=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=su(t,this.TimeBufferType),this.values=su(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:su(e.times,Array),values:su(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new SB(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new i2(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new wB(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case _p:t=this.InterpolantFactoryMethodDiscrete;break;case Ap: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 _p;case this.InterpolantFactoryMethodLinear:return Ap;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=gn(i,s,a),this.values=gn(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&&e2(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=gn(this.times),t=gn(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,d=c-i,u=c+i;for(let p=0;p!==i;++p){let f=t[c+p];if(f!==t[d+p]||f!==t[u+p]){o=!0;break}}}if(o){if(n!==a){e[a]=e[n];let c=n*i,d=a*i;for(let u=0;u!==i;++u)t[d+u]=t[c+u]}++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=gn(e,0,a),this.values=gn(t,0,a*i)):(this.times=e,this.values=t),this}clone(){let e=gn(this.times,0),t=gn(this.values,0),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};wa.prototype.TimeBufferType=Float32Array;wa.prototype.ValueBufferType=Float32Array;wa.prototype.DefaultInterpolation=Ap;var Ph=class extends wa{};Ph.prototype.ValueTypeName="bool";Ph.prototype.ValueBufferType=Array;Ph.prototype.DefaultInterpolation=_p;Ph.prototype.InterpolantFactoryMethodLinear=void 0;Ph.prototype.InterpolantFactoryMethodSmooth=void 0;var r2=class extends wa{};r2.prototype.ValueTypeName="color";var Ip=class extends wa{};Ip.prototype.ValueTypeName="number";var _B=class extends Rf{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)ot.slerpFlat(s,0,a,l-n,a,l,o);return s}},vd=class extends wa{InterpolantFactoryMethodLinear(e){return new _B(this.times,this.values,this.getValueSize(),e)}};vd.prototype.ValueTypeName="quaternion";vd.prototype.DefaultInterpolation=Ap;vd.prototype.InterpolantFactoryMethodSmooth=void 0;var Dh=class extends wa{};Dh.prototype.ValueTypeName="string";Dh.prototype.ValueBufferType=Array;Dh.prototype.DefaultInterpolation=_p;Dh.prototype.InterpolantFactoryMethodLinear=void 0;Dh.prototype.InterpolantFactoryMethodSmooth=void 0;var Op=class extends wa{};Op.prototype.ValueTypeName="vector";var Av=class{constructor(e,t=-1,i,r=vy){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=ds(),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(MB(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(wa.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=bB(o);o=bb(o,1,h),l=bb(l,1,h),!r&&o[0]===0&&(o.push(s),l.push(l[0])),a.push(new Ip(".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],d=r[c];d||(r[c]=d=[]),d.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,d,u,p){if(d.length!==0){let f=[],g=[];t2(d,f,g,u),f.length!==0&&p.push(new h(c,f,g))}},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 d={},u;for(u=0;
vendor: 7,565 bytes, line 3140
3140u<c.length;u++)if(c[u].morphTargets)for(let p=0;p<c[u].morphTargets.length;p++)d[c[u].morphTargets[p]]=-1;for(let p in d){let f=[],g=[];for(let m=0;m!==c[u].morphTargets.length;++m){let v=c[u];f.push(v.time),g.push(v.morphTarget===p?1:0)}r.push(new Ip(".morphTargetInfluence["+p+"]",f,g))}o=d.length*a}else{let d=".bones["+t[h].name+"]";i(Op,d+".position",c,"pos",r),i(vd,d+".quaternion",c,"rot",r),i(Op,d+".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 AB(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ip;case"vector":case"vector2":case"vector3":case"vector4":return Op;case"color":return r2;case"quaternion":return vd;case"bool":case"boolean":return Ph;case"string":return Dh}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function MB(e){if(e.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=AB(e.type);if(e.times===void 0){let i=[],r=[];t2(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 Rp={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={}}},s2=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,d=l.length;c<d;c+=2){let u=l[c],p=l[c+1];if(u.global&&(u.lastIndex=0),u.test(h))return p}return null}}},EB=new s2,yd=class{constructor(e){this.manager=e!==void 0?e:EB,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}},Ia={},CB=class extends Error{constructor(e,t){super(e),this.response=t}},Mv=class extends yd{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=Rp.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Ia[e]!==void 0){Ia[e].push({onLoad:t,onProgress:i,onError:r});return}Ia[e]=[],Ia[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=Ia[e],c=l.body.getReader(),d=l.headers.get("Content-Length")||l.headers.get("X-File-Size"),u=d?parseInt(d):0,p=u!==0,f=0,g=new ReadableStream({start(m){v();function v(){c.read().then(({done:y,value:x})=>{if(y)m.close();else{f+=x.byteLength;let w=new ProgressEvent("progress",{lengthComputable:p,loaded:f,total:u});for(let S=0,b=h.length;S<b;S++){let A=h[S];A.onProgress&&A.onProgress(w)}m.enqueue(x),v()}})}}});return new Response(g)}else throw new CB(`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,d=new TextDecoder(c);return l.arrayBuffer().then(u=>d.decode(u))}}}).then(l=>{Rp.add(e,l);let h=Ia[e];delete Ia[e];for(let c=0,d=h.length;c<d;c++){let u=h[c];u.onLoad&&u.onLoad(l)}}).catch(l=>{let h=Ia[e];if(h===void 0)throw this.manager.itemError(e),l;delete Ia[e];for(let c=0,d=h.length;c<d;c++){let u=h[c];u.onError&&u.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}},TB=class extends yd{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=Rp.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;let n=qc("img");function o(){h(),Rp.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}},PB=class extends yd{constructor(e){super(e)}load(e,t,i,r){let s=new oi,a=new TB(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}},xd=class extends Ut{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new $e(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}},DB=class extends xd{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Ut.DEFAULT_UP),this.updateMatrix(),this.groundColor=new $e(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}},jm=new be,wb=new M,Sb=new M,Py=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new j(512,512),this.map=null,this.mapPass=null,this.matrix=new be,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new wy,this._frameExtents=new j(1,
vendor: 5,977 bytes, line 3140
31401),this._viewportCount=1,this._viewports=[new ht(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;wb.setFromMatrixPosition(e.matrixWorld),t.position.copy(wb),Sb.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Sb),t.updateMatrixWorld(),jm.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jm),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(jm)}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.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},IB=class extends Py{constructor(){super(new mr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){let t=this.camera,i=Wc*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}},OB=class extends xd{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(Ut.DEFAULT_UP),this.updateMatrix(),this.target=new Ut,this.distance=i,this.angle=r,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new IB}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}},_b=new be,Kh=new M,Gm=new M,RB=class extends Py{constructor(){super(new mr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new j(4,2),this._viewportCount=6,this._viewports=[new ht(2,1,1,1),new ht(0,1,1,1),new ht(3,1,1,1),new ht(1,1,1,1),new ht(3,0,1,1),new ht(1,0,1,1)],this._cubeDirections=[new 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()),Kh.setFromMatrixPosition(e.matrixWorld),i.position.copy(Kh),Gm.copy(i.position),Gm.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(Gm),i.updateMatrixWorld(),r.makeTranslation(-Kh.x,-Kh.y,-Kh.z),_b.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_b)}},LB=class extends xd{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 RB}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}},BB=class extends Py{constructor(){super(new Pf(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},zB=class extends xd{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ut.DEFAULT_UP),this.updateMatrix(),this.target=new Ut,this.shadow=new BB}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},a2=class extends je{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}},n2=class extends yd{constructor(e){super(e)}load(e,t,i,r){let s=this,a=new Mv(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(d,u){if(t[u]!==void 0)return t[u];let p=d.interleavedBuffers[u],f=s(d,p.buffer),g=Ld(p.type,f),m=new UL(g,p.stride);return m.uuid=p.uuid,t[u]=m,m}function s(d,u){if(i[u]!==void 0)return i[u];let p=d.arrayBuffers[u],f=new Uint32Array(p).buffer;return i[u]=f,f}let a=e.isInstancedBufferGeometry?new a2:new je,n=e.data.index;if(n!==void 0){let d=Ld(n.type,n.array);a.setIndex(new et(d,1))}let o=e.data.attributes;for(let d in o){let u=o[d],p;if(u.isInterleavedBufferAttribute){let f=r(e.data,u.data);p=new wv(f,u.itemSize,u.offset,u.normalized)}else{let f=Ld(u.type,u.array),g=u.isInstancedBufferAttribute?Xc:et;p=new g(f,u.itemSize,u.normalized)}u.name!==void 0&&(p.name=u.name),u.usage!==void 0&&p.setUsage(u.usage),u.updateRange!==void 0&&(p.updateRange.offset=u.updateRange.offset,p.updateRange.count=u.updateRange.count),a.setAttribute(d,p)}let l=e.data.morphAttributes;if(l)for(let d in l){let u=l[d],p=[];for(let f=0,g=u.length;f<g;f++){let m=u[f],v;if(m.isInterleavedBufferAttribute){let y=r(e.data,m.data);v=new wv(y,m.itemSize,m.offset,m.normalized)}else{let y=Ld(m.type,m.array);v=new et(y,m.itemSize,m.normalized)}m.name!==void 0&&(v.name=m.name),p.push(v)}a.morphAttributes[d]=p}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);let h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let d=0,u=h.length;d!==u;++d){let p=h[d];a.addGroup(p.start,p.count,p.materialIndex)}let c=e.data.boundingSphere;if(c!==void 0){let d=new M;c.center!==void 0&&d.fromArray(c.center),a.boundingSphere=new Hr(
vendor: 4,214 bytes, line 3140
3140d,c.radius)}return e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}},FB=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Ab(),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=Ab();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function Ab(){return(typeof performance>"u"?Date:performance).now()}var kB=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;for(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){ot.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){let a=this._workIndex*s;ot.multiplyQuaternionsFlat(e,a,e,t,e,i),ot.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}}},Dy="\\[\\]\\.:\\/",UB=new RegExp("["+Dy+"]","g"),Iy="[^"+Dy+"]",NB="[^"+Dy.replace("\\.","")+"]",VB=/((?:WC+[\/:])*)/.source.replace("WC",Iy),jB=/(WCOD+)?/.source.replace("WCOD",NB),GB=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Iy),HB=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Iy),WB=new RegExp("^"+VB+jB+GB+HB+"$"),qB=["material","materials","bones","map"],XB=class{constructor(e,t,i){let r=i||qt.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()}},qt=class{constructor(e,t,i){this.path=t,this.parsedPath=i||qt.parseTrackName(t),this.node=qt.f
vendor: 12,504 bytes, line 3140
3140indNode(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 qt.Composite(e,t,i):new qt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(UB,"")}static parseTrackName(e){let t=WB.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);qB.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}_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=qt.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}};qt.Composite=XB;qt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};qt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};qt.prototype.GetterByBindingType=[qt.prototype._getValue_direct,qt.prototype._getValue_array,qt.prototype._getValue_arrayElement,qt.prototype._getValue_toArray];qt.prototype.SetterByBindingTypeAndVersioning=[[qt.prototype._setValue_direct,qt.prototype._setValue_direct_setNeedsUpdate,qt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[qt.prototype._setValue_array,qt.prototype._setValue_array_setNeedsUpdate,qt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[qt.prototype._setValue_arrayElement,qt.prototype._setValue_arrayElement_setNeedsUpdate,qt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[qt.prototype._setValue_fromArray,qt.prototype._setValue_fromArray_setNeedsUpdate,qt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var YB=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:Gl,endingEnd:Gl};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=_M,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 _D:for(let h=0,c=o.length;h!==c;++h)o[h].evaluate(a),l[h].accumulateAdditive(n);break;case vy: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===gy;if(e===0)return s===-1?r:a&&(s&1)===1?t-r:r;if(i===SM){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=Hl,r.endingEnd=Hl):(e?r.endingStart=this.zeroSlopeAtStart?Hl:Gl:r.endingStart=Mp,t?r.endingEnd=this.zeroSlopeAtEnd?Hl:Gl:r.endingEnd=Mp)}_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}},QB=new Float32Array(1),ZB=class extends ur{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 d=r[c],u=d.name,p=h[u];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,u));continue}let f=t&&t._propertyBindings[c].binding.parsedPath;
vendor: 6,114 bytes, line 3140
3140p=new kB(qt.create(i,u,f),d.ValueTypeName,d.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,o,u),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;let c=n.actionByRoot,d=(e._localRoot||this._root).uuid;delete c[d],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 i2(new Float32Array(2),new Float32Array(2),1,QB),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"?Av.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=vy),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 YB(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"?Av.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))}},ve=class{constructor(e){this.value=e}clone(){return new ve(this.value.clone===void 0?this.value:this.value.clone())}},o2=class{constructor(e,t,i=0,r=1/0){this.ray=new Eh(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new xy,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: 
3140Unsupported camera type: "+t.type)}intersectObject(e,t=!0,i=[]){return Ev(e,this,i,t),i.sort(Mb),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)Ev(e[r],this,i,t);return i.sort(Mb),i}};function Mb(e,t){return e.distance-t.distance}function Ev(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++)Ev(s[a],t,i,!0)}}var Eb=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(_i(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}},Cb=new j,Oy=class{constructor(e=new j(1/0,1/0),t=new j(-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=Cb.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 Cb.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)}},Tb=new M,au=new M,us=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){Tb.subVectors(e,this.start),au.subVectors(this.end,this.start);let i=au.dot(au),r=au.dot(Tb)/i;return t&&(r=_i(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)}},Pb=new M,KB=class extends Ut{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";let i=new je,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 io({fog:!1,toneMapped:!1});this.cone=new gd(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),Pb.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Pb),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},JB=class extends Zt{constructor(e,t,i){let r=new Kl(t,4,2),s=new sn({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)}},Db=new M,nu=new M,Ib=new M,$B=class extends Ut{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 je;r.setAttribute("position",new De([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let s=new io({fog:!1,toneMapped:!1});this.lightPlane=new Tp(r,s),this.add(this.lightPlane),r=new je,r.setAttribute("position",new De([0,0,0,0,0,1],3)),this.targetLine=new Tp(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),Db.setFromMatrixPosition(this.light.matrixWorld),nu.setFromMatrixPosition(this.light.target.matrixWorld),Ib.subVectors(nu,Db),this.lightPlane.lookAt(nu),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(nu),this.targetLine.scale.z
vendor: 14,193 bytes, line 3140
3140=Ib.length()}},ou=new M,li=new to,Lp=class extends gd{constructor(e){let t=new je,i=new io({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 $e(16755200),h=new $e(16711680),c=new $e(43775),d=new $e(16777215),u=new $e(3355443);this.setColors(l,h,c,d,u)}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;li.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),fi("c",t,e,li,0,0,-1),fi("t",t,e,li,0,0,1),fi("n1",t,e,li,-i,-r,-1),fi("n2",t,e,li,i,-r,-1),fi("n3",t,e,li,-i,r,-1),fi("n4",t,e,li,i,r,-1),fi("f1",t,e,li,-i,-r,1),fi("f2",t,e,li,i,-r,1),fi("f3",t,e,li,-i,r,1),fi("f4",t,e,li,i,r,1),fi("u1",t,e,li,i*.7,r*1.1,-1),fi("u2",t,e,li,-i*.7,r*1.1,-1),fi("u3",t,e,li,0,r*2,-1),fi("cf1",t,e,li,-i,0,1),fi("cf2",t,e,li,i,0,1),fi("cf3",t,e,li,0,-r,1),fi("cf4",t,e,li,0,r,1),fi("cn1",t,e,li,-i,0,-1),fi("cn2",t,e,li,i,0,-1),fi("cn3",t,e,li,0,-r,-1),fi("cn4",t,e,li,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function fi(e,t,i,r,s,a,n){ou.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],ou.x,ou.y,ou.z)}}var Bp=class extends gd{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 je;s.setIndex(new et(i,1)),s.setAttribute("position",new De(r,3)),super(s,new io({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()}},ez=class extends gd{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 je;r.setAttribute("position",new De(t,3)),r.setAttribute("color",new De(i,3));let s=new io({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){let r=new $e,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()}},qa=tz();function tz(){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);)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 iz(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=_i(e,-65504,65504),qa.floatView[0]=e;let t=qa.uint32View[0],i=t>>23&511;return qa.baseTable[i]+((t&8388607)>>qa.shiftTable[i])}function rz(e){let t=e>>10;return qa.uint32View[0]=qa.mantissaTable[qa.offsetTable[t]+(e&1023)]+qa.exponentTable[t],qa.floatView[0]}var sz=Object.freeze({__proto__:null,fromHalfFloat:rz,toHalfFloat:iz});typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Mh}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Mh);var Jh=".",Ry=Symbol("target"),l2=Symbol("unsubscribe");function Cv(e){return e instanceof Date||e instanceof Set||e instanceof Map||e instanceof WeakSet||e instanceof WeakMap||ArrayBuffer.isView(e)}function az(e){return(typeof e=="object"?e===null:typeof e!="function")||e instanceof RegExp}var oa=Array.isArray;function Ly(e){return typeof e=="symbol"}var nz={after:(e,t)=>oa(e)?e.slice(t.length):t===""?e:e.slice(t.length+1),concat:(e,t)=>oa(e)?(e=[...e],t&&e.push(t),e):t&&t.toString!==void 0?(e!==""&&(e+=Jh),Ly(t)?e+t.toString():e+t):e,initial:e=>{if(oa(e))return e.slice(0,-1);if(e==="")return e;let t=e.lastIndexOf(Jh);return t===-1?"":e.slice(0,t)},last:e=>{if(oa(e))return e[e.length-1]||"";if(e==="")return e;let t=e.lastIndexOf(Jh);return t===-1?e:e.slice(t+1)},walk:(e,t)=>{if(oa(e))for(let i of e)t(i);else if(e!==""){let i=0,r=e.indexOf(Jh);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(Jh,i)}},get(e,t){return this.walk(t,i=>{e&&(e=e[i])}),e}},as=nz;function oz(e){return typeof e=="object"&&typeof e.next=="function"}function lz(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[Ry].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 Ob(e,t,i){return e.isUnsubscribed||t.ignoreSymbols&&Ly(i)||t.ignoreUnderscores&&i.charAt(0)==="_"||"ignoreKeys"in t&&t.ignoreKeys.includes(i)}var hz=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,as.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 Tv(e){return toString.call(e)==="[object Object]"}function lu(){return!0}function vl(e,t){return e.length!==t.length||e.some((i,r)=>t[r]!==i)}var h2=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),cz=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),c2={push:lu,pop:lu,shift:lu,unshift:lu,copyWithin:vl,reverse:vl,sort:vl,splice:vl,flat:vl,fill:vl},dz=new Set([...h2,...cz,...Object.keys(c2)]);function hu(e,t){if(e.size!==t.size)return!0;for(let i of e)if(!t.has(i))return!0;return!1}var d2=["keys","values","entries"],u2=new Set(["has","toString"]),p2={add:hu,clear:hu,delete:hu,forEach:hu},uz=new Set([...u2,...Object.keys(p2),...d2]);function cu(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 pz=new Set([...u2,"get"]),f2={set:cu,clear:cu,delete:cu,forEach:cu},fz=new Set([...pz,...Object.keys(f2),...d2]),Zn=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 h2.has(e)}_shallowClone(e){let t=e;if(Tv(e))t={...e};else if(oa(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?(oa(r)?this._onIsChanged=c2[t]:r instanceof Set?this._onIsChanged=p2[t]:r instanceof Map&&(this._onIsChanged=f2[t]),r):i}update(e,t,i){let r=as.after(e,this._path);if(t!=="length"){let s=this.clone;as.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],as.get(e,t.path)[t.property]=t.previous}isChanged(e){return this._onIsChanged===void 0?this._isChanged:this._onIsChanged(this.clone,e)}},Rb=class extends Zn{static isHandledMethod(e){return dz.has(e)}},mz=class extends Zn{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}},Lb=class extends Zn{static isHandledMethod(e){return uz.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)}},Bb=class extends Zn{static isHandledMethod(e){return fz.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)}},gz=class extends Zn{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)}},vz=class extends Zn{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)}},Fl=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return Tv(e)||oa(e)||Cv(e)}static isHandledMethod(e,t){return Tv(e)?Zn.isHandledMethod(t):oa(e)?Rb.isHandledMethod(t):e instanceof Set?Lb.isHandledMethod(t):e instanceof Map?Bb.isHandledMethod(t):Cv(e)}get isCloning(){return this._stack.length>0}start(e,t,i){let r=Zn;oa(e)?r=Rb:e instanceof Date?r=mz:e instanceof Set?r=Lb:e instanceof Map?r=Bb:e instanceof WeakSet?r=gz:e instanceof WeakMap&&(r=vz),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=Fl.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}},yz={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},By=(e,t,i={})=>{i={...yz,...i};let r=Symbol("ProxyTarget"),{equals:s,isShallow:a,ignoreDetached:n,details:o}=i,l=new hz(s),h=typeof i.onValidate=="function",c=new Fl(h),d=(y,x,w,S,b)=>
3140!h||c.isCloning||i.onValidate(as.concat(l.getPath(y),x),w,S,b)===!0,u=(y,x,w,S)=>{!Ob(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(as.concat(y,x),w,S,b)},f=y=>y&&(y[r]||y),g=(y,x,w,S)=>az(y)||w==="constructor"||a&&!Fl.isHandledMethod(x,w)||Ob(l,i,w)||l.isGetInvariant(x,w)||n&&l.isDetached(x,e)?y:(S===void 0&&(S=l.getPath(x)),l.getProxy(y,as.concat(S,w),m,r)),m={get(y,x,w){if(Ly(x)){if(x===r||x===Ry)return y;if(x===l2&&!l.isUnsubscribed&&l.getPath(y).length===0)return l.unsubscribe(),y}let S=Cv(y)?Reflect.get(y,x):Reflect.get(y,x,w);return g(S,y,x)},set(y,x,w,S){w=f(w);let b=y[r]||y,A=b[x];if(s(A,w)&&x in y)return!0;let _=d(y,x,w,A);return _&&l.setProperty(b,x,w,S,A)?(u(y,x,y[x],A),!0):!_},defineProperty(y,x,w){if(!l.isSameDescriptor(w,y,x)){let S=y[x];d(y,x,w.value,S)&&l.defineProperty(y,x,w,S)&&u(y,x,w.value,S)}return!0},deleteProperty(y,x){if(!Reflect.has(y,x))return!0;let w=Reflect.get(y,x),S=d(y,x,void 0,w);return S&&l.deleteProperty(y,x,w)?(u(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))&&Fl.isHandledType(S)){let b=as.initial(l.getPath(y)),A=Fl.isHandledMethod(S,y.name);c.start(S,b,w);let _=Reflect.apply(y,c.preferredThisArg(y,x,S),A?w.map(T=>f(T)):w),E=c.isChanged(S,s),C=c.stop();if(Fl.isHandledType(_)&&A&&(x instanceof Map&&y.name==="get"&&(b=as.concat(b,w[0])),_=l.getProxy(_,b,m)),E){let T={name:y.name,args:w,result:_},P=c.isCloning?as.initial(b):b,O=c.isCloning?as.last(b):"";d(as.get(e,P),O,S,C,T)?p(P,O,S,C,T):c.undo(S)}return(x instanceof Map||x instanceof Set)&&oz(_)?lz(_,y,x,b,g):_}return Reflect.apply(y,x,w)}},v=l.getProxy(e,i.pathAsArray?[]:"",m);return t=t.bind(v),h&&(i.onValidate=i.onValidate.bind(v)),v};By.target=e=>e&&e[Ry]||e;By.unsubscribe=e=>e[l2]||e;var zb=By,xz=typeof global=="object"&&global&&global.Object===Object&&global,m2=xz,bz=typeof self=="object"&&self&&self.Object===Object&&self,wz=m2||bz||Function("return this")(),Ns=wz,Sz=Ns.Symbol,fs=Sz,g2=Object.prototype,_z=g2.hasOwnProperty,Az=g2.toString,$h=fs?fs.toStringTag:void 0;function Mz(e){var t=_z.call(e,$h),i=e[$h];try{e[$h]=void 0;var r=!0}catch{}var s=Az.call(e);return r&&(t?e[$h]=i:delete e[$h]),s}var Ez=Mz,Cz=Object.prototype,Tz=Cz.toString;function Pz(e){return Tz.call(e)}var Dz=Pz,Iz="[object Null]",Oz="[object Undefined]",Fb=fs?fs.toStringTag:void 0;function Rz(e){return e==null?e===void 0?Oz:Iz:Fb&&Fb in Object(e)?Ez(e):Dz(e)}var Ko=Rz;function Lz(e){return e!=null&&typeof e=="object"}var an=Lz,Bz="[object Symbol]";function zz(e){return typeof e=="symbol"||an(e)&&Ko(e)==Bz}var bd=zz;function Fz(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 v2=Fz,kz=Array.isArray,va=kz,Uz=1/0,kb=fs?fs.prototype:void 0,Ub=kb?kb.toString:void 0;function y2(e){if(typeof e=="string")return e;if(va(e))return v2(e,y2)+"";if(bd(e))return Ub?Ub.call(e):"";var t=e+"";return t=="0"&&1/e==-Uz?"-0":t}var Nz=y2,Vz=/\s/;function jz(e){for(var t=e.length;t--&&Vz.test(e.charAt(t)););return t}var Gz=jz,Hz=/^\s+/;function Wz(e){return e&&e.slice(0,Gz(e)+1).replace(Hz,"")}var qz=Wz;function Xz(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Us=Xz,Nb=NaN,Yz=/^[-+]0x[0-9a-f]+$/i,Qz=/^0b[01]+$/i,Zz=/^0o[0-7]+$/i,Kz=parseInt;function Jz(e){if(typeof e=="number")return e;if(bd(e))return Nb;if(Us(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Us(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=qz(e);var i=Qz.test(e);return i||Zz.test(e)?Kz(e.slice(2),i?2:8):Yz.test(e)?Nb:+e}var Vb=Jz;function $z(e){return e}var x2=$z,eF="[object AsyncFunction]",tF="[object Function]",iF="[object GeneratorFunction]",rF="[object Proxy]";function sF(e){if(!Us(e))return!1;var t=Ko(e);return t==tF||t==iF||t==eF||t==rF}var b2=sF,aF=Ns["__core-js_shared__"],Hm=aF,jb=function(){var e=/[^.]+$/.exec(Hm&&Hm.keys&&Hm.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function nF(e){return!!jb&&jb in e}var oF=nF,lF=Function.prototype,hF=lF.toString;function cF(e){if(e!=null){try{return hF.call(e)}catch{}try{return e+""}catch{}}return""}var Jo=cF,dF=/[\\^$.*+?()[\]{}|]/g,uF=/^\[object .+?Constructor\]$/,pF=Function.prototype,fF=Object.prototype,mF=pF.toString,gF=fF.hasOwnProperty,vF=RegExp("^"+mF.call(gF).replace(dF,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function yF(e){if(!Us(e)||oF(e))return!1;var t=b2(e)?vF:uF;return t.test(Jo(e))}var xF=yF;function bF(e,t){return e==null?void 0:e[t]}var wF=bF;function SF(e,t){var i=wF(e,t);return xF(i)?i:void 0}var $o=SF,_F=$o(Ns,"WeakMap"),Pv=_F,Gb=Object.create,AF=function(){function e(){}return function(t){if(!Us(t))return{};if(Gb)return Gb(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}}(),MF=AF;function EF(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 CF=EF;function TF(e,t){var i=-1,r=e.length;for(t||(t=Array(r));++i<r;)t[i]=e[i];return t}var PF=TF,DF=800,IF=16,OF=Date.now;function RF(e){var t=0,i=0;return function(){var r=OF(),s=IF-(r-i);if(i=r,s>0){if(++t>=DF)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var LF=RF;function BF(e){return function(){return e}}var zF=BF,FF=function(){try{var e=$o(Object,"defineProperty");return e({},"",{}),e}catch{}}(),zp=FF,kF=zp?function(e,t){return zp(e,"toString",{configurable:!0,enumerable:!1,value:zF(t),writable:!0})}:x2,UF=kF,NF=LF(UF),VF=NF;function jF(e,t){for(var i=-1,r=e==null?0:e.length;++i<r&&t(e[i],i,e)!==!1;);return e}var GF=jF,HF=9007199254740991,WF=/^(?:0|[1-9]\d*)$/;function qF(e,t){var i=typeof e;return t=t??HF,!!t&&(i=="number"||i!="symbol"&&WF.test(e))&&e>-1&&e%1==0&&e<t}var zy=qF;function XF(e,t,i){t=="__proto__"&&zp?zp(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}var w2=XF;function YF(e,t){return e===t||e!==e&&t!==t}var Fy=YF,QF=Object.prototype,ZF=QF.hasOwnProperty;function KF(e,t,i){var r=e[t];(!(ZF.call(e,t)&&Fy(r,i))||i===void 0&&!(t in e))&&w2(e,t,i)}var ky=KF;function JF(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?w2(i,o,l):ky(i,o,l)}return i}var wd=JF,Hb=Math.max;function $F(e,t,i){return t=Hb(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,a=Hb(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),CF(e,this,o)}}var ek=$F,tk=9007199254740991;function ik(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=tk}var Uy=ik;function rk(e){return e!=null&&Uy(e.length)&&!b2(e)}var S2=rk,sk=Object.prototype;function ak(e){var t=e&&e.constructor,i=typeof t=="function"&&t.prototype||sk;return e===i}var Ny=ak;function nk(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}var ok=nk,lk="[object Arguments]";function hk(e){return an(e)&&Ko(e)==lk}var Wb=hk,_2=Object.prototype,ck=_2.hasOwnProperty,dk=_2.propertyIsEnumerable,uk=Wb(function(){return arguments}())?Wb:function(e){return an(e)&&ck.call(e,"callee")&&!dk.call(e,"callee")},Vy=uk;function pk(){return!1}var fk=pk,A2=typeof exports=="object"&&exports&&!exports.nodeType&&exports,qb=A2&&typeof module=="object"&&module&&!module.nodeType&&module,mk=qb&&qb.exports===A2,Xb=mk?Ns.Buffer:void 0,gk=Xb?Xb.isBuffer:void 0,vk=gk||fk,Fp=vk,yk="[object Arguments]",xk="[object Array]",bk="[object Boolean]",wk="[object Date]",Sk="[object Error]",_k="[object Function]",Ak="[object Map]",Mk="[object Number]",Ek="[object Object]",Ck="[object RegExp]",Tk="[object Set]",Pk="[object String]",Dk="[object WeakMap]",Ik="[object ArrayBuffer]",Ok="[object DataView]",Rk="[object Float32Array]",Lk="[object Float64Array
3140]",Bk="[object Int8Array]",zk="[object Int16Array]",Fk="[object Int32Array]",kk="[object Uint8Array]",Uk="[object Uint8ClampedArray]",Nk="[object Uint16Array]",Vk="[object Uint32Array]",ti={};ti[Rk]=ti[Lk]=ti[Bk]=ti[zk]=ti[Fk]=ti[kk]=ti[Uk]=ti[Nk]=ti[Vk]=!0;ti[yk]=ti[xk]=ti[Ik]=ti[bk]=ti[Ok]=ti[wk]=ti[Sk]=ti[_k]=ti[Ak]=ti[Mk]=ti[Ek]=ti[Ck]=ti[Tk]=ti[Pk]=ti[Dk]=!1;function jk(e){return an(e)&&Uy(e.length)&&!!ti[Ko(e)]}var Gk=jk;function Hk(e){return function(t){return e(t)}}var jy=Hk,M2=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Rc=M2&&typeof module=="object"&&module&&!module.nodeType&&module,Wk=Rc&&Rc.exports===M2,Wm=Wk&&m2.process,qk=function(){try{var e=Rc&&Rc.require&&Rc.require("util").types;return e||Wm&&Wm.binding&&Wm.binding("util")}catch{}}(),ph=qk,Yb=ph&&ph.isTypedArray,Xk=Yb?jy(Yb):Gk,E2=Xk,Yk=Object.prototype,Qk=Yk.hasOwnProperty;function Zk(e,t){var i=va(e),r=!i&&Vy(e),s=!i&&!r&&Fp(e),a=!i&&!r&&!s&&E2(e),n=i||r||s||a,o=n?ok(e.length,String):[],l=o.length;for(var h in e)(t||Qk.call(e,h))&&!(n&&(h=="length"||s&&(h=="offset"||h=="parent")||a&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||zy(h,l)))&&o.push(h);return o}var C2=Zk;function Kk(e,t){return function(i){return e(t(i))}}var T2=Kk,Jk=T2(Object.keys,Object),$k=Jk,e4=Object.prototype,t4=e4.hasOwnProperty;function i4(e){if(!Ny(e))return $k(e);var t=[];for(var i in Object(e))t4.call(e,i)&&i!="constructor"&&t.push(i);return t}var r4=i4;function s4(e){return S2(e)?C2(e):r4(e)}var Gy=s4;function a4(e){var t=[];if(e!=null)for(var i in Object(e))t.push(i);return t}var n4=a4,o4=Object.prototype,l4=o4.hasOwnProperty;function h4(e){if(!Us(e))return n4(e);var t=Ny(e),i=[];for(var r in e)r=="constructor"&&(t||!l4.call(e,r))||i.push(r);return i}var c4=h4;function d4(e){return S2(e)?C2(e,!0):c4(e)}var Eo=d4,u4=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,p4=/^\w*$/;function f4(e,t){if(va(e))return!1;var i=typeof e;return i=="number"||i=="symbol"||i=="boolean"||e==null||bd(e)?!0:p4.test(e)||!u4.test(e)||t!=null&&e in Object(t)}var m4=f4,g4=$o(Object,"create"),Kc=g4;function v4(){this.__data__=Kc?Kc(null):{},this.size=0}var y4=v4;function x4(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var b4=x4,w4="__lodash_hash_undefined__",S4=Object.prototype,_4=S4.hasOwnProperty;function A4(e){var t=this.__data__;if(Kc){var i=t[e];return i===w4?void 0:i}return _4.call(t,e)?t[e]:void 0}var M4=A4,E4=Object.prototype,C4=E4.hasOwnProperty;function T4(e){var t=this.__data__;return Kc?t[e]!==void 0:C4.call(t,e)}var P4=T4,D4="__lodash_hash_undefined__";function I4(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Kc&&t===void 0?D4:t,this}var O4=I4;function Ih(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])}}Ih.prototype.clear=y4;Ih.prototype.delete=b4;Ih.prototype.get=M4;Ih.prototype.has=P4;Ih.prototype.set=O4;var Qb=Ih;function R4(){this.__data__=[],this.size=0}var L4=R4;function B4(e,t){for(var i=e.length;i--;)if(Fy(e[i][0],t))return i;return-1}var Lf=B4,z4=Array.prototype,F4=z4.splice;function k4(e){var t=this.__data__,i=Lf(t,e);if(i<0)return!1;var r=t.length-1;return i==r?t.pop():F4.call(t,i,1),--this.size,!0}var U4=k4;function N4(e){var t=this.__data__,i=Lf(t,e);return i<0?void 0:t[i][1]}var V4=N4;function j4(e){return Lf(this.__data__,e)>-1}var G4=j4;function H4(e,t){var i=this.__data__,r=Lf(i,e);return r<0?(++this.size,i.push([e,t])):i[r][1]=t,this}var W4=H4;function Oh(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])}}Oh.prototype.clear=L4;Oh.prototype.delete=U4;Oh.prototype.get=V4;Oh.prototype.has=G4;Oh.prototype.set=W4;var Bf=Oh,q4=$o(Ns,"Map"),Jc=q4;function X4(){this.size=0,this.__data__={hash:new Qb,map:new(Jc||Bf),string:new Qb}}var Y4=X4;function Q4(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Z4=Q4;function K4(e,t){var i=e.__data__;return Z4(t)?i[typeof t=="string"?"string":"hash"]:i.map}var zf=K4;function J4(e){var t=zf(this,e).delete(e);return this.size-=t?1:0,t}var $4=J4;function eU(e){return zf(this,e).get(e)}var tU=eU;function iU(e){return zf(this,e).has(e)}var rU=iU;function sU(e,t){var i=zf(this,e),r=i.size;return i.set(e,t),this.size+=i.size==r?0:1,this}var aU=sU;function Rh(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])}}Rh.prototype.clear=Y4;Rh.prototype.delete=$4;Rh.prototype.get=tU;Rh.prototype.has=rU;Rh.prototype.set=aU;var Ff=Rh,nU="Expected a function";function Hy(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(nU);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(Hy.Cache||Ff),i}Hy.Cache=Ff;var oU=Hy,lU=500;function hU(e){var t=oU(e,function(r){return i.size===lU&&i.clear(),r}),i=t.cache;return t}var cU=hU,dU=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,uU=/\\(\\)?/g,pU=cU(function(e){var t=[];
3140return e.charCodeAt(0)===46&&t.push(""),e.replace(dU,function(i,r,s,a){t.push(s?a.replace(uU,"$1"):r||i)}),t}),fU=pU;function mU(e){return e==null?"":Nz(e)}var gU=mU;function vU(e,t){return va(e)?e:m4(e,t)?[e]:fU(gU(e))}var Lh=vU,yU=1/0;function xU(e){if(typeof e=="string"||bd(e))return e;var t=e+"";return t=="0"&&1/e==-yU?"-0":t}var kf=xU;function bU(e,t){t=Lh(t,e);for(var i=0,r=t.length;e!=null&&i<r;)e=e[kf(t[i++])];return i&&i==r?e:void 0}var P2=bU;function wU(e,t){for(var i=-1,r=t.length,s=e.length;++i<r;)e[s+i]=t[i];return e}var Wy=wU,Zb=fs?fs.isConcatSpreadable:void 0;function SU(e){return va(e)||Vy(e)||!!(Zb&&e&&e[Zb])}var _U=SU;function D2(e,t,i,r,s){var a=-1,n=e.length;for(i||(i=_U),s||(s=[]);++a<n;){var o=e[a];t>0&&i(o)?t>1?D2(o,t-1,i,r,s):Wy(s,o):r||(s[s.length]=o)}return s}var AU=D2;function MU(e){var t=e==null?0:e.length;return t?AU(e,1):[]}var EU=MU;function CU(e){return VF(ek(e,void 0,EU),e+"")}var I2=CU,TU=T2(Object.getPrototypeOf,Object),qy=TU,PU="[object Object]",DU=Function.prototype,IU=Object.prototype,O2=DU.toString,OU=IU.hasOwnProperty,RU=O2.call(Object);function LU(e){if(!an(e)||Ko(e)!=PU)return!1;var t=qy(e);if(t===null)return!0;var i=OU.call(t,"constructor")&&t.constructor;return typeof i=="function"&&i instanceof i&&O2.call(i)==RU}var BU=LU;function zU(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 FU=zU;function kU(){this.__data__=new Bf,this.size=0}var UU=kU;function NU(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}var VU=NU;function jU(e){return this.__data__.get(e)}var GU=jU;function HU(e){return this.__data__.has(e)}var WU=HU,qU=200;function XU(e,t){var i=this.__data__;if(i instanceof Bf){var r=i.__data__;if(!Jc||r.length<qU-1)return r.push([e,t]),this.size=++i.size,this;i=this.__data__=new Ff(r)}return i.set(e,t),this.size=i.size,this}var YU=XU;function Bh(e){var t=this.__data__=new Bf(e);this.size=t.size}Bh.prototype.clear=UU;Bh.prototype.delete=VU;Bh.prototype.get=GU;Bh.prototype.has=WU;Bh.prototype.set=YU;var lp=Bh;function QU(e,t){return e&&wd(t,Gy(t),e)}var ZU=QU;function KU(e,t){return e&&wd(t,Eo(t),e)}var JU=KU,R2=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Kb=R2&&typeof module=="object"&&module&&!module.nodeType&&module,$U=Kb&&Kb.exports===R2,Jb=$U?Ns.Buffer:void 0,$b=Jb?Jb.allocUnsafe:void 0;function eN(e,t){if(t)return e.slice();var i=e.length,r=$b?$b(i):new e.constructor(i);return e.copy(r),r}var tN=eN;function iN(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 rN=iN;function sN(){return[]}var L2=sN,aN=Object.prototype,nN=aN.propertyIsEnumerable,ew=Object.getOwnPropertySymbols,oN=ew?function(e){return e==null?[]:(e=Object(e),rN(ew(e),function(t){return nN.call(e,t)}))}:L2,Xy=oN;function lN(e,t){return wd(e,Xy(e),t)}var hN=lN,cN=Object.getOwnPropertySymbols,dN=cN?function(e){for(var t=[];e;)Wy(t,Xy(e)),e=qy(e);return t}:L2,B2=dN;function uN(e,t){return wd(e,B2(e),t)}var pN=uN;function fN(e,t,i){var r=t(e);return va(e)?r:Wy(r,i(e))}var z2=fN;function mN(e){return z2(e,Gy,Xy)}var Dv=mN;function gN(e){return z2(e,Eo,B2)}var F2=gN,vN=$o(Ns,"DataView"),Iv=vN,yN=$o(Ns,"Promise"),Ov=yN,xN=$o(Ns,"Set"),Rv=xN,tw="[object Map]",bN="[object Object]",iw="[object Promise]",rw="[object Set]",sw="[object WeakMap]",aw="[object DataView]",wN=Jo(Iv),SN=Jo(Jc),_N=Jo(Ov),AN=Jo(Rv),MN=Jo(Pv),go=Ko;(Iv&&go(new Iv(new ArrayBuffer(1)))!=aw||Jc&&go(new Jc)!=tw||Ov&&go(Ov.resolve())!=iw||Rv&&go(new Rv)!=rw||Pv&&go(new Pv)!=sw)&&(go=function(e){var t=Ko(e),i=t==bN?e.constructor:void 0,r=i?Jo(i):"";if(r)switch(r){case wN:return aw;case SN:return tw;case _N:return iw;case AN:return rw;case MN:return sw}return t});var $c=go,EN=Object.prototype,CN=EN.hasOwnProperty;function TN(e){var t=e.length,i=new e.constructor(t);return t&&typeof e[0]=="string"&&CN.call(e,"index")&&(i.index=e.index,i.input=e.input),i}var PN=TN,DN=Ns.Uint8Array,kp=DN;function IN(e){var t=new e.constructor(e.byteLength);return new kp(t).set(new kp(e)),t}var Yy=IN;function ON(e,t){var i=t?Yy(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}var RN=ON,LN=/\w*$/;function BN(e){var t=new e.constructor(e.source,LN.exec(e));return t.lastIndex=e.lastIndex,t}
vendor: 4,229 bytes, line 3140
3140var zN=BN,nw=fs?fs.prototype:void 0,ow=nw?nw.valueOf:void 0;function FN(e){return ow?Object(ow.call(e)):{}}var kN=FN;function UN(e,t){var i=t?Yy(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}var NN=UN,VN="[object Boolean]",jN="[object Date]",GN="[object Map]",HN="[object Number]",WN="[object RegExp]",qN="[object Set]",XN="[object String]",YN="[object Symbol]",QN="[object ArrayBuffer]",ZN="[object DataView]",KN="[object Float32Array]",JN="[object Float64Array]",$N="[object Int8Array]",e5="[object Int16Array]",t5="[object Int32Array]",i5="[object Uint8Array]",r5="[object Uint8ClampedArray]",s5="[object Uint16Array]",a5="[object Uint32Array]";function n5(e,t,i){var r=e.constructor;switch(t){case QN:return Yy(e);case VN:case jN:return new r(+e);case ZN:return RN(e,i);case KN:case JN:case $N:case e5:case t5:case i5:case r5:case s5:case a5:return NN(e,i);case GN:return new r;case HN:case XN:return new r(e);case WN:return zN(e);case qN:return new r;case YN:return kN(e)}}var o5=n5;function l5(e){return typeof e.constructor=="function"&&!Ny(e)?MF(qy(e)):{}}var h5=l5,c5="[object Map]";function d5(e){return an(e)&&$c(e)==c5}var u5=d5,lw=ph&&ph.isMap,p5=lw?jy(lw):u5,f5=p5,m5="[object Set]";function g5(e){return an(e)&&$c(e)==m5}var v5=g5,hw=ph&&ph.isSet,y5=hw?jy(hw):v5,x5=y5,b5=1,w5=2,S5=4,k2="[object Arguments]",_5="[object Array]",A5="[object Boolean]",M5="[object Date]",E5="[object Error]",U2="[object Function]",C5="[object GeneratorFunction]",T5="[object Map]",P5="[object Number]",N2="[object Object]",D5="[object RegExp]",I5="[object Set]",O5="[object String]",R5="[object Symbol]",L5="[object WeakMap]",B5="[object ArrayBuffer]",z5="[object DataView]",F5="[object Float32Array]",k5="[object Float64Array]",U5="[object Int8Array]",N5="[object Int16Array]",V5="[object Int32Array]",j5="[object Uint8Array]",G5="[object Uint8ClampedArray]",H5="[object Uint16Array]",W5="[object Uint32Array]",Jt={};Jt[k2]=Jt[_5]=Jt[B5]=Jt[z5]=Jt[A5]=Jt[M5]=Jt[F5]=Jt[k5]=Jt[U5]=Jt[N5]=Jt[V5]=Jt[T5]=Jt[P5]=Jt[N2]=Jt[D5]=Jt[I5]=Jt[O5]=Jt[R5]=Jt[j5]=Jt[G5]=Jt[H5]=Jt[W5]=!0;Jt[E5]=Jt[U2]=Jt[L5]=!1;function hp(e,t,i,r,s,a){var n,o=t&b5,l=t&w5,h=t&S5;if(i&&(n=s?i(e,r,s,a):i(e)),n!==void 0)return n;if(!Us(e))return e;var c=va(e);if(c){if(n=PN(e),!o)return PF(e,n)}else{var d=$c(e),u=d==U2||d==C5;if(Fp(e))return tN(e,o);if(d==N2||d==k2||u&&!s){if(n=l||u?{}:h5(e),!o)return l?pN(e,JU(n,e)):hN(e,ZU(n,e))}else{if(!Jt[d])return s?e:{};n=o5(e,d,o)}}a||(a=new lp);var p=a.get(e);if(p)return p;a.set(e,n),x5(e)?e.forEach(function(m){n.add(hp(m,t,i,m,e,a))}):f5(e)&&e.forEach(function(m,v){n.set(v,hp(m,t,i,v,e,a))});var f=h?l?F2:Dv:l?Eo:Gy,g=c?void 0:f(e);return GF(g||e,function(m,v){g&&(v=m,m=e[v]),ky(n,v,hp(m,t,i,v,e,a))}),n}var V2=hp,q5=1,X5=4;function Y5(e){return V2(e,q5|X5)}var Uf=Y5,Q5="__lodash_hash_undefined__";function Z5(e){return this.__data__.set(e,Q5),this}var K5=Z5;function J5(e){return this.__data__.has(e)}var $5=J5;function Up(e){var t=-1,i=e==null?0:e.length;for(this.__data__=new Ff;++t<i;)this.add(e[t])}Up.prototype.add=Up.prototype.push=K5;Up.prototype.has=$5;var eV=Up;function tV(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 iV=tV;function rV(e,t){return e.has(t)}var sV=rV,aV=1,nV=2;function oV(e,t,i,r,s,a){var n=i&aV,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 d=-1,u=!0,p=i&nV?new eV:void 0;for(a.set(e,t),a.set(t,e);++d<o;){var f=e[d],g=t[d];if(r)var m=n?r(g,f,d,t,e,a):r(f,g,d,e,t,a);if(m!==void 0){if(m)continue;u=!1;break}if(p){if(!iV(t,function(v,y){if(!sV(p,y)&&(f===v||s(f,v,i,r,a)))return p.push(y)})){u=!1;break}}else if(!(f===g||s(f,g,i,r,a))){u=!1;break}}return a.delete(e),a.delete(t),u}var j2=oV;function lV(e){var t=-1,i=Array(e.size);return e.forEach(function(r,s){i[++t]=[s,r]}),i}var hV=lV;function cV(e){var t=-1,i=Array(e.size);return e.forEach(function(r){i[++t]=r}),i}var dV=cV,uV=1,pV=2,fV="[object Boolean]",mV="[object Date]",gV="[object Error]",vV="[object Map]",yV="[object Number]",xV="[object RegExp]",bV="[object Set]",wV="[object String]",SV="[object Symbol]",_V="[object ArrayBuffer]",AV="[object DataView]",cw=fs?fs.prototype:void 0,qm=cw?cw.valueOf
vendor: 1,671 bytes, line 3140
3140:void 0;function MV(e,t,i,r,s,a,n){switch(i){case AV:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case _V:return!(e.byteLength!=t.byteLength||!a(new kp(e),new kp(t)));case fV:case mV:case yV:return Fy(+e,+t);case gV:return e.name==t.name&&e.message==t.message;case xV:case wV:return e==t+"";case vV:var o=hV;case bV:var l=r&uV;if(o||(o=dV),e.size!=t.size&&!l)return!1;var h=n.get(e);if(h)return h==t;r|=pV,n.set(e,t);var c=j2(o(e),o(t),r,s,a,n);return n.delete(e),c;case SV:if(qm)return qm.call(e)==qm.call(t)}return!1}var EV=MV,CV=1,TV=Object.prototype,PV=TV.hasOwnProperty;function DV(e,t,i,r,s,a){var n=i&CV,o=Dv(e),l=o.length,h=Dv(t),c=h.length;if(l!=c&&!n)return!1;for(var d=l;d--;){var u=o[d];if(!(n?u in t:PV.call(t,u)))return!1}var p=a.get(e),f=a.get(t);if(p&&f)return p==t&&f==e;var g=!0;a.set(e,t),a.set(t,e);for(var m=n;++d<l;){u=o[d];var v=e[u],y=t[u];if(r)var x=n?r(y,v,u,t,e,a):r(v,y,u,e,t,a);if(!(x===void 0?v===y||s(v,y,i,r,a):x)){g=!1;break}m||(m=u=="constructor")}if(g&&!m){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)&&(g=!1)}return a.delete(e),a.delete(t),g}var IV=DV,OV=1,dw="[object Arguments]",uw="[object Array]",du="[object Object]",RV=Object.prototype,pw=RV.hasOwnProperty;function LV(e,t,i,r,s,a){var n=va(e),o=va(t),l=n?uw:$c(e),h=o?uw:$c(t);l=l==dw?du:l,h=h==dw?du:h;var c=l==du,d=h==du,u=l==h;if(u&&Fp(e)){if(!Fp(t))return!1;n=!0,c=!1}if(u&&!c)return a||(a=new lp),n||E2(e)?j2(e,t,i,r,s,a):EV(e,t,l,i,r,s,a);if(!(i&OV)){var p=c&&pw.call(e,"__wrapped__"),f=d&&pw.call(t,"__wrapped__");
3140if(p||f){var g=p?e.value():e,m=f?t.value():t;return a||(a=new lp),s(g,m,i,r,a)}}return u?(a||(a=new lp),IV(e,t,i,r,s,a)):!1}var BV=LV;function G2(e,t,i,r,s){return e===t?!0:e==null||t==null||!an(e)&&!an(t)?e!==e&&t!==t:BV(e,t,i,r,G2,s)}var zV=G2;function FV(e,t){return e!=null&&t in Object(e)}var kV=FV;function UV(e,t,i){t=Lh(t,e);for(var r=-1,s=t.length,a=!1;++r<s;){var n=kf(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&&Uy(s)&&zy(n,s)&&(va(e)||Vy(e)))}var NV=UV;function VV(e,t){return e!=null&&NV(e,t,kV)}var jV=VV,GV=function(){return Ns.Date.now()},Xm=GV,HV="Expected a function",WV=Math.max,qV=Math.min;function XV(e,t,i){var r,s,a,n,o,l,h=0,c=!1,d=!1,u=!0;if(typeof e!="function")throw new TypeError(HV);t=Vb(t)||0,Us(i)&&(c=!!i.leading,d="maxWait"in i,a=d?WV(Vb(i.maxWait)||0,t):a,u="trailing"in i?!!i.trailing:u);function p(b){var A=r,_=s;return r=s=void 0,h=b,n=e.apply(_,A),n}function f(b){return h=b,o=setTimeout(v,t),c?p(b):n}function g(b){var A=b-l,_=b-h,E=t-A;return d?qV(E,a-_):E}function m(b){var A=b-l,_=b-h;return l===void 0||A>=t||A<0||d&&_>=a}function v(){var b=Xm();if(m(b))return y(b);o=setTimeout(v,g(b))}function y(b){return o=void 0,u&&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(Xm())}function S(){var b=Xm(),A=m(b);if(r=arguments,s=this,l=b,A){if(o===void 0)return f(l);if(d)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 ed=XV;function YV(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var QV=YV;function ZV(e,t){return e>t}var KV=ZV;function JV(e,t){return t.length<2?e:P2(e,FU(t,0,-1))}var $V=JV;function ej(e,t){return zV(e,t)}var Qy=ej;function tj(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&&!bd(n):i(n,o)))var o=n,l=a}return l}var ij=tj;function rj(e){return e&&e.length?ij(e,x2,KV):void 0}var sj=rj;function aj(e,t){return t=Lh(t,e),e=$V(e,t),e==null||delete e[kf(QV(t))]}var nj=aj;function oj(e){return BU(e)?void 0:e}var lj=oj,hj=1,cj=2,dj=4,uj=I2(function(e,t){var i={};if(e==null)return i;var r=!1;t=v2(t,function(a){return a=Lh(a,e),r||(r=a.length>1),a}),wd(e,F2(e),i),r&&(i=V2(i,hj|cj|dj,lj));for(var s=t.length;s--;)nj(i,t[s]);return i}),Lv=uj;function pj(e,t,i,r){if(!Us(e))return e;t=Lh(t,e);for(var s=-1,a=t.length,n=a-1,o=e;o!=null&&++s<a;){var l=kf(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=Us(c)?c:zy(t[s+1])?[]:{})}ky(o,l,h),o=o[l]}return e}var fj=pj;function mj(e,t,i){for(var r=-1,s=t.length,a={};++r<s;){var n=t[r],o=P2(e,n);i(o,n)&&fj(a,Lh(n,e),o)}return a}var gj=mj;function vj(e,t){return gj(e,t,function(i,r){return jV(e,r)})}var yj=vj,xj=I2(function(e,t){return e==null?{}:yj(e,t)}),pa=xj,bj="Expected a function";function wj(e,t,i){var r=!0,s=!0;if(typeof e!="function")throw new TypeError(bj);return Us(i)&&(r="leading"in i?!!i.leading:r,s="trailing"in i?!!i.trailing:s),ed(e,t,{leading:r,maxWait:t,trailing:s})}var Sj=wj;function H2(e){for(let t of Object.keys(e))e[t]===void 0&&delete e[t];return e}function ms(e,t){return Object.setPrototypeOf(e,t),e}var _j=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().includes(" electron/"),Aj=()=>typeof window>"u"?!1:window.navigator.platform.toUpperCase().includes("MAC"),Mj=()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(window.navigator.userAgent)||Nf&&"ontouchend"in document,Ej=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,Cj=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0,Tj=()=>
3140{if(typeof window>"u")return!1;let e=navigator.userAgent,t=navigator.vendor;return/Safari/i.test(e)&&/Apple Computer/.test(t)},Pj=()=>{if(typeof window>"u")return null;let e=navigator.userAgent.match(/Version\/(\d+\.\d)/);return e&&e[1]},Dj=()=>{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"},W2=_j();W2&&Dj();var Nf=Aj(),Sd=Mj(),Ij=Ej(),Qr=Cj(),fw=Tj(),Oj=Number(Pj());function q2(e){return Array.isArray(e)?e:[e]}function X2(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 uu(e){return Nf?e.metaKey:e.ctrlKey}function Rj(e){return e.wheelDeltaY===0||e.deltaY===0?Nf&&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 st=[],Np={},wc={},cp={};function Y2(e){st.includes(e)||st.push(e)}function Jl(e){delete Np[e.pointerId];for(let t=0;t<st.length;t++)if(st[t].pointerId===e.pointerId){st.splice(t,1);break}}function Lj(){st.splice(0,st.length)}function Vp(e){if(e.pointerType!=="touch")return;let t=Np[e.pointerId];t===void 0&&(t={x:0,y:0},Np[e.pointerId]=t),t.x=e.pageX,t.y=e.pageY}function Ym(e){let t=e.pointerId===st[0].pointerId?st[1]:st[0];return Np[t.pointerId]}function Q2(e){wc[e.key]=!0,cp[e.key]=cp[e.key]===void 0?1:cp[e.key]+1}function Z2(e){if(Nf&&wc.Meta)for(let t in wc)wc[t]=!1;else wc[e.key]=!1;cp={}}function Bj(e){e.addEventListener("pointerdown",Y2,!0),e.addEventListener("pointerdown",Vp,!0),e.addEventListener("pointermove",Vp,!0),e.addEventListener("pointerup",Jl,!0),e.addEventListener("pointercancel",Jl,!0),e.addEventListener("pointerleave",Jl,!0),window.addEventListener("keydown",Q2,!0),window.addEventListener("keyup",Z2,!0)}function zj(e){e.removeEventListener("pointerdown",Y2,!0),e.removeEventListener("pointerdown",Vp,!0),e.removeEventListener("pointermove",Vp,!0),e.removeEventListener("pointerup",Jl,!0),e.removeEventListener("pointercancel",Jl,!0),e.removeEventListener("pointerleave",Jl,!0),window.removeEventListener("keydown",Q2,!0),window.removeEventListener("keyup",Z2,!0)}var K2,Fj=new Promise(e=>{K2=e}),pu;function kj(){if(pu)return pu;async function e(){let t="https://unpkg.com/@splinetool/[email protected]/build",i=$n(()=>import("./navmesh-BFd9Mv4x.js"),[]),[r,s]=await Promise.all([i,fetch(`${t}/navmesh.wasm`).then(o=>o.arrayBuffer())]),a=r.default,n=await a({wasmBinary:s});K2(n)}return pu=e(),pu}var J2,Uj=new Promise(e=>{J2=e}),fu;function Nj(){if(fu)return fu;async function e(){let t=await $n(()=>import("./physics-BM4kW-A5.js"),[]);await t.init(),J2(t)}return fu=e(),fu}var Je=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,Je.prototype),r}}add(e,t){var i;return((i=this.runOp({type:1,id:e,data:t}))==null?void 0:i.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,Je.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,Je.prototype),delete s[i],{data:s,actual:e,reverse:{type:1,id:i,data:r}}}}return null}};function Zy(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"&&Zy(r)}return Object.freeze(e)}function Vj(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 $2=class extends Error{};function Qm(e){let t={...e};return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),t}function Bn(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 Ky(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 jj(){return typeof process<"u"}function eE(e,t){for(let i of e)t(i.id,i.data)!==!0&&eE(i.children,t)}function tE(e,t){if(t(e.id,e.data)!==!0)for(let i of e.children)tE(i,t)}var lr=class extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,lr.prototype)}deepFreeze(){let e=0;for(;e<this.length;)Zy(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);
vendor: 29,973 bytes, line 3140
3140if(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){var t;return(t=this.get(e))==null?void 0:t.data}has(e){return this.childrenOf(e)!==void 0}get(e){return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){var t;return e===null?this:(t=this.get(e))==null?void 0:t.children}traverseFrom(e,t){if(e===null)this.traverse(t);else{let i=this.get(e);i&&tE(i,t)}}traverse(e){eE(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,lr.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 d=t;for(;d!==null;){if(d===void 0)throw new Error;if(d===r)throw new $2("cyclic tree");d=this.parent(d)}}let s=this.parent(r);if(s===void 0)return null;let a=s,n=this.childrenArray(s),o=n.findIndex(d=>d.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((d,u)=>d.fi-u.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)=>Vj(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 Bn(0,i,i);{let s=r[0].fi;return Bn(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 Bn(n,n+i,i)}else return Bn(s.fi,a.fi,i)}}},jp;(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})(jp||(jp={}));var He=class extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,He.prototype)}deepFreeze(){let e=0;for(;e<this.length;)Zy(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){var t;return(t=this.get(e))==null?void 0:t.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let 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,He.prototype);let t=e;return jj()||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 Bn(0,t,t);{let r=i[0].fi;return Bn(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 Bn(a,a+t,t)}else return Bn(r.fi,s.fi,t)}}};function fh(e){return e&&typeof e=="object"&&e instanceof Ti}var Ti=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&&!fh(i))return null;r+=1}i=i?Qm(i):new Ti;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=Qm(o),delete i[e.path[r-1]])}else{let o=t[r-1];if(o){let l=Qm(o);l[e.path[r-1]]=i,i=l}else{let l=new Ti;l[e.path[r-1]]=i,i=l}}r-=1}let a=Object.setPrototypeOf(i,Ti.prototype),n={...e,props:s};return{data:a,actual:e,reverse:n}}},Hn;(e=>{function t(s,a){return td(s,a)??s}e.apply=t;function i(s,a){return $y(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=Fi.zoomOnce(l,o[n]),l===void 0)return a;if(!fh(l))return;n+=1}if(l===void 0)return a;if(fh(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=Jy([a],l);return h?(console.log(h),h):a}else return a}e.filterOp=r})(Hn||(Hn={}));function Jy(e,t){if(t===void 0)return;let i=!1,r=e.map(s=>{let a=s.id,n=td(s.data,t[a]);if(i=i||n!==void 0,n===void 0&&(n=s.data),s.children){let o=Jy(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 Gj(e,t){if(t===void 0)return;let i=!1,r=e.map(s=>{let a=s.id,n=td(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 td(e,t){if(!fh(t))return t;if(e instanceof lr){let i=Jy(e,t);return i!==void 0&&Object.setPrototypeOf(i,Object.getPrototypeOf(e)),i}else{if(e instanceof He)return Gj(e,t);if(Array.isArray(e)){let i=!1,r=e.map((s,a)=>{let n=td(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 Ti)return $y(e,t);if(e&&typeof e=="object"){let i={},r=!1;for(let[s,a]of Object.entries(e)){let n=td(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 $y(e,t){if(e===void 0)return t;if(t===void 0)return e;if(!fh(t))return t;if(!fh(e))return Hn.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 Ti;for(let s of i){let a=$y(e===void 0?void 0:e[s],t===void 0?void 0:t[s]);r[s]=a}return r}function Hj(e,t){let i={cur:[],result:[],len:0};return e=id(e,t,i)??e,[e,i.result]}function Gp(e,t){return e===null?null:(e.cur[e.len]=t,e.len+=1,e)}function Hp(e){e&&(e.len-=1)}function Wj(e){if(e===null)return null;e.result.push(e.cur.slice(0,e.len))}function iE(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=id(a.data,t,Gp(i,n));Hp(i),r=r||l!==void 0,l===void 0&&(l=a.data);let h=iE(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 qj(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=id(a.data,t,Gp(i,n));return Hp(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 id(e,t,i){if(e instanceof lr){let r=iE(e,t,i);return r!==void 0&&Object.setPrototypeOf(r,Object.getPrototypeOf(e)),r}else{if(e instanceof He)return qj(e,t,i);if(Array.isArray(e)){let r=!1,s=e.map((a,n)=>{let o=id(a,t,Gp(i,n));return Hp(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"&&!Ky(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=id(n,t,Gp(i,a));Hp(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&&Wj(i),r}else return}}var Wp;(e=>{function t(i,r){let s=Fi.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})(Wp||(Wp={}));var Qi;(e=>{function t(l,h){return{...l,path:l.path.slice(h)}}e.drop=t;function i(l,h){var c;return((c=r(l,h))==null?void 0:c.data)??l}e.applySimple=i;function r(l,h){var u,p;let c=h.path;for(var d=[];;){let f;if(l instanceof Ti&&h.type===0&&(f=l.runOp({...h,path:c.slice(d.length)}),f===null&&(f=void 0)),f===void 0&&d.length===c.length&&(l instanceof lr||l instanceof He||l instanceof Je?f=l.runOp(h):f=jp.runOp(l,h)),f!==void 0)if(f!==null){let v=f.data;for(let y=d.length-1;y>=0;y--){let x=c[y],w=d[y];if(w instanceof lr){if(typeof x=="number")throw new Error("illegal arg");v=w.modifyById(x,v)}else if(w instanceof He){if(typeof x=="number")throw new Error("illegal arg");v=w.modifyById(x,v)}else if(w instanceof Je){if(typeof x=="number")throw new Error("illegal arg");v=w.modifyById(x,v)}else if(w instanceof Ti){let S={...w,[x]:v};v=Object.setPrototypeOf(S,Ti.prototype)}else if(typeof w=="object")if(Array.isArray(w)){if(typeof x=="string"&&(x=parseInt(x),isNaN(x)))throw new Error("Invalid path");let S=v;v=[...w],v[x]=S}else v={...w,[x]:v};else return null}return{data:v,actual:{...f.actual,path:c},reverse:{...f.reverse,path:c}}}else return null;let g=c[d.length],m;if(l instanceof lr){if(typeof g=="number")throw new Error("");m=(u=l.get(g))==null?void 0:u.data}else if(l instanceof He){if(typeof g=="number")throw new Error("");m=(p=l.get(g))==null?void 0:p.data}else l!==null&&(m=l[g]);if(m!==void 0)d.push(l),l=m;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})(Qi||(Qi={}));var Bv;(e=>{function t(){return[]}e.empty=t;function i(h,c){let d=[];for(let u of h){let[p,...f]=u.path;p===c&&d.push({...u,path:f})}return d}e.removePrefix=i;function r(h,c){return h.map(d=>({...d,path:[c,...d.path]}))}e.addPrefix=r;function s(h,c){return[...h,...c]}e.concat=s;function a(h,c){return[...h.filter(d=>!c.some(u=>Qi.subsumed(d,u))),...c]}e.compress=a;function n(h,c){return h.every(d=>c.every(u=>Qi.commutative(d,u)))}e.commutative=n;function o(h,c){for(let d of c){let u=l(h,d);u!==null&&(h=u.data)}return h}e.applyAll=o;function l(h,c){var d=h;let u=[],p=[];for(let f of c)try{if(f.type===3||f.type===5&&f.path[f.path.length-1]==="variables"){let g,m,v;if(f.type===3?(g=Fi.zoom(d,[...f.path,f.id]),v=Qi.apply(d,{...f,type:2})):(g=Fi.zoom(d,[...f.path,f.id,"value"]),v=Qi.apply(d,f)),v!==null){d=v.data;let[y,x]=Hj(d,{[f.id]:g});d=y;for(let w=0;w<x.length;w++){let S=x[w],b=S.pop();if(typeof b=="number"){let A=[b];for(let E=w+1;E<x.length;E++){let C=x[E],T=C[C.length-1];if(typeof T=="number"&&Fi.equal(S,C.slice(0,C.length-1)))A.push(T),x.splice(E,1);else break}let _=Fi.zoom(d,S);m=_.map((E,C)=>A.includes(C)?f.id:E),g=_,b=S.pop()}else{if(b==="alphaOverride"||b==="alpha"){g/=100;let A=g,_=Fi.zoom(d,S.slice(0,S.length-2)),E=_.layers.map(C=>C.id===S[S.length-1]?{...C,data:{...C.data,[b]:A}}:C);Object.setPrototypeOf(E,Object.getPrototypeOf(_.layers)),_.layers=E}m=f.id}u.push({type:0,path:S,props:{[b]:g}}),p.push({type:0,path:S,props:{[b]:m}})}p.push(v.reverse),u.push(v.actual)}}else{let g=Qi.apply(d,f);g!==null&&(u.push(g.actual),d=g.data,p.push(g.reverse))}}catch(g){if(g instanceof $2)return null;throw g}return{data:d,actual:u,reverse:p.reverse()}}e.apply=l})(Bv||(Bv={}));var rE=Symbol(),Xj=Symbol(),Vf=Symbol(),_d=class{reportOp(e,t,i=[]){let r=this;if(t===null)return;r._current=t.data;let s=i;for(;!(r instanceof aE);){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[Vf];i&&i(),delete this._children[e]}}}},Yj=class extends _d{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 this._current={...this._current,[e]:t}}runOp(e){this.reportOp(e,jp.runOp(this._current,e),e.path)}},Qj=class extends _d{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,Je.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},sE={get(e,t){if(t===Vf)return()=>{e._parent=null};if(t===rE)return e._current;if(t===Xj)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=jf(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]}}},Zj={...sE,set(e,t,i){let r={type:0,props:{[t]:vi(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}},Kj={...sE,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}},e1=class extends _d{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[Vf]=()=>{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){var n;let{_current:t,_children:i}=this,r=i===void 0?void 0:i[e];if(r!==void 0)return r;let s=(n=t.get(e))==null?void 0:n.data,a=jf(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)}},t1=class extends _d{constructor(e,t,i){super(),this._children={},this._parent=e,this._path=t,this._current=i,this[Vf]=()=>{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){var n;let{_current:t,_children:i}=this,r=i===void 0?void 0:i[e];if(r!==void 0)return r;let s=(n=t.get(e))==null?void 0:n.data,a=jf(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 Zm(e,t,i){if(e.length>0){let r=e[e.length-1];if(r.type===0&&t.type===0&&Fi.equal(r.path,i)){Object.assign(r.props,t.props);return}}e.push({...t,path:i})}var aE=class extends _d{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){Zm(this.ts,t,e),Zm(this.actual,i,e),Zm(this.reverse,r,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function jf(e,t,i){return i instanceof lr?new e1(e,t,i):i instanceof He?new t1(e,t,i):i instanceof Je?new Proxy(new Qj(e,t,i),Kj):i!==null&&typeof i=="object"?Ky(i)?i:new Proxy(new Yj(e,t,i),Zj):i}function nE(e){let t=new aE(e);return[jf(t,"",e),t]}function rd(e,t){let[i,r]=nE(e);return t(i),r.result()}function vi(e){return e instanceof e1||e instanceof t1?e._current:e!==null&&typeof e=="object"?e[rE]:e}var Fi;(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 lr||a instanceof e1)&&typeof n=="string"||(a instanceof He||a instanceof t1)&&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})(Fi||(Fi={}));function Jj(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 Yt(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 oE=class{},mw=class extends oE{constructor(e){super(),this.id=e}},gw=class extends oE{constructor(e){super(),this.data=e}},zv;try{zv=new TextDecoder}catch{}var ke,Wn,ie=0,Ur={},Bt,zn,ns=0,la=0,Yr,en,Ir=[],kt,vw={useRecords:!1,mapsAsObjects:!0},lE=class{},hE=new lE;hE.name="MessagePack 0xC1";var mh=!1,qp=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(ke)return mE(()=>(kv(),this?this.unpack(e,t):qp.prototype.unpack.call(vw,e,t)));Wn=t>-1?t:e.length,ie=0,la=0,zn=null,Yr=null,ke=e;try{kt=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(i){throw ke=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 qp){if(Ur=this,this.structures)return Bt=this.structures,mu();(!Bt||Bt.length>0)&&(Bt=[])}else Ur=vw,(!Bt||Bt.length>0)&&(Bt=[]);return mu()}unpackMultiple(e,t){let i,r=0;try{mh=!0;let s=e.length,a=this?this.unpack(e,s):Hf.unpack(e,s);if(t){for(t(a);ie<s;)if(r=ie,t(mu())===!1)return}else{for(i=[a];ie<s;)r=ie,i.push(mu());return i}}catch(s){throw s.lastPosition=r,s.values=i,s}finally{mh=!1,kv()}}_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 mu(){try{if(!Ur.trusted&&!mh){let t=Bt.sharedLength||0;t<Bt.length&&(Bt.length=t)}let e=ci();if(ie==Wn)Bt.restoreStructures&&yw(),Bt=null,ke=null,en&&(en=null);else if(ie>Wn){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}else if(!mh)throw new Error("Data read, but end of buffer not reached");return e}catch(e){throw Bt.restoreStructures&&yw(),kv(),(e instanceof RangeError||e.message.startsWith("Unexpected end of buffer"))&&(e.incomplete=!0),e}}function yw(){for(let e in Bt.restoreStructures)Bt[e]=Bt.restoreStructures[e];Bt.restoreStructures=null}function ci(){let e=ke[ie++];if(e<160)if(e<128){if(e<64)return e;{let t=Bt[e&63]||Ur.getStructures&&cE()[e&63];return t?(t.read||(t.read=i1(t,e&63)),t.read()):e}}else if(e<144)if(e-=128,Ur.mapsAsObjects){let t={};for(let i=0;i<e;i++)t[uE()]=ci();return t}else{let t=new Map;for(let i=0;i<e;i++)t.set(ci(),ci());return t}else{e-=144;let t=new Array(e);for(let i=0;i<e;i++)t[i]=ci();return t}else if(e<192){let t=e-160;if(la>=ie)return zn.slice(ie-ns,(ie+=t)-ns);if(la==0&&Wn<140){let i=t<16?r1(t):dE(t);if(i!=null)return i}return Fv(t)}else{let t;switch(e){case 192:return null;case 193:return Yr?(t=ci(),t>0?Yr[1].slice(Yr.position1,Yr.position1+=t):Yr[0].slice(Yr.position0,Yr.position0-=t)):hE;case 194:return!1;case 195:return!0;case 196:return Km(ke[ie++]);case 197:return t=kt.getUint16(ie),ie+=2,Km(t);case 198:return t=kt.getUint32(ie),ie+=4,Km(t);case 199:return lo(ke[ie++]);case 200:return t=kt.getUint16(ie),ie+=2,lo(t);case 201:return t=kt.getUint32(ie),ie+=4,lo(t);case 202:if(t=kt.getFloat32(ie),Ur.useFloat32>2){let i=s1[(ke[ie]&127)<<1|ke[ie+1]>>7];return ie+=4,(i*t+(t>0?.5:-.5)>>0)/i}return ie+=4,t;case 203:return t=kt.getFloat64(ie),ie+=8,t;case 204:return ke[ie++];case 205:return t=kt.getUint16(ie),ie+=2,t;case 206:return t=kt.getUint32(ie),ie+=4,t;case 207:return Ur.int64AsNumber?(t=kt.getUint32(ie)*4294967296,t+=kt.getUint32(ie+4)):t=kt.getBigUint64(ie),ie+=8,t;case 208:return kt.getInt8(ie++);case 209:return t=kt.getInt16(ie),ie+=2,t;case 210:return t=kt.getInt32(ie),ie+=4,t;case 211:return Ur.int64AsNumber?(t=kt.getInt32(ie)*4294967296,t+=kt.getUint32(ie+4)):t=kt.getBigInt64(ie),ie+=8,t;case 212:if(t=ke[ie++],t==114)return _w(ke[ie++]&63);{let i=Ir[t];if(i)return i.read?(ie++,i.read(ci())):i.noBuffer?(ie++,i()):i(ke.subarray(ie,++ie));throw new Error("Unknown extension "+t)}case 213:return t=ke[ie],t==114?(ie++,_w(ke[ie++]&63,ke[ie++])):lo(2);case 214:return lo(4);case 215:return lo(8);case 216:return lo(16);case 217:return t=ke[ie++],la>=ie?zn.slice(ie-ns,(ie+=t)-ns):e6(t);case 218:return t=kt.getUint16(ie),ie+=2,la>=ie?zn.slice(ie-ns,(ie+=t)-ns):t6(t);case 219:return t=kt.getUint32(ie),ie+=4,la>=ie?zn.slice(ie-ns,(ie+=t)-ns):i6(t);case 220:return t=kt.getUint16(ie),ie+=2,bw(t);case 221:return t=kt.getUint32(ie),ie+=4,bw(t);case 222:return t=kt.getUint16(ie),ie+=2,ww(t);case 223:return t=kt.getUint32(ie),ie+=4,ww(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 $j=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function i1(e,t){function i(){if(i.count++>2){let s=e.read=new Function("r","return function(){return {"+e.map(a=>$j.test(a)?a+":r()":"["+JSON.stringify(a)+"]:r()").join(",")+"}}")(ci);return e.highByte===0&&(e.read=xw(t,e.read)),s()}let r={};for(let s=0,a=e.length;s<a;s++){let n=e[s];r[n]=ci()}return r}return i.count=0,e.highByte===0?xw(t,i):i}var xw=(e,t)=>function(){let i=ke[ie++];if(i===0)return t();let r=e<32?-(e+(i<<5)):e+(i<<5),s=Bt[r]||cE()[r];if(!s)throw new Error("Record id is not defined for "+r);return s.read||(s.read=i1(s,e)),s.read()};function cE(){let e=mE(()=>(ke=null,Ur.getStructures()));return Bt=Ur._mergeStructures(e,Bt)}var Fv=Gf,e6=Gf,t6=Gf,i6=Gf;function Gf(e){let t;if(e<16&&(t=r1(e)))return t;if(e>64&&zv)return zv.decode(ke.subarray(ie,ie+=e));let i=ie+e,r=[];for(t="";ie<i;){let s=ke[ie++];if(!(s&128))r.push(s);else if((s&224)===192){let a=ke[ie++]&63;r.push((s&31)<<6|a)}else if((s&240)===224){let a=ke[ie++]&63,n=ke[ie++]&63;r.push((s&31)<<12|a<<6|n)}else if((s&248)===240){let a=ke[ie++]&63,n=ke[ie++]&63,o=ke[ie++]&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+=Wi.apply(String,r),r.length=0)}return r.length>0&&(t+=Wi.apply(String,r)),t}function bw(e){let t=new Array(e);for(let i=0;i<e;i++)t[i]=ci();return t}function ww(e){if(Ur.mapsAsObjects){let t={};for(let i=0;i<e;i++)t[uE()]=ci();return t}else{let t=new Map;for(let i=0;i<e;i++)t.set(ci(),ci());return t}}var Wi=String.fromCharCode;function dE(e){let t=ie,i=new Array(e);for(let r=0;r<e;r++){let s=ke[ie++];if((s&128)>0){ie=t;return}i[r]=s}return Wi.apply(String,i)}function r1(e){if(e<4)if(e<2){if(e===0)return"";{let t=ke[ie++];if((t&128)>1){ie-=1;return}return Wi(t)}}else{let t=ke[ie++],i=ke[ie++];if((t&128)>0||(i&128)>0){ie-=2;return}if(e<3)return Wi(t,i);let r=ke[ie++];if((r&128)>0){ie-=3;return}return Wi(t,i,r)}else{let t=ke[ie++],i=ke[ie++],r=ke[ie++],s=ke[ie++];if((t&128)>0||(i&128)>0||(r&128)>0||(s&128)>0){ie-=4;return}if(e<6){if(e===4)return Wi(t,i,r,s);{let a=ke[ie++];if((a&128)>0){ie-=5;return}return Wi(t,i,r,s,a)}}else if(e<8){let a=ke[ie++],n=ke[ie++];if((a&128)>0||(n&128)>0){ie-=6;return}if(e<7)return Wi(t,i,r,s,a,n);let o=ke[ie++];if((o&128)>0){ie-=7;return}return Wi(t,i,r,s,a,n,o)}else{let a=ke[ie++],n=ke[ie++],o=ke[ie++],l=ke[ie++];if((a&128)>0||(n&128)>0||(o&128)>0||(l&128)>0){ie-=8;return}if(e<10){if(e===8)return Wi(t,i,r,s,a,n,o,l);{let h=ke[ie++];if((h&128)>0){ie-=9;return}return Wi(t,i,r,s,a,n,o,l,h)}}else if(e<12){let h=ke[ie++],c=ke[ie++];if((h&128)>0||(c&128)>0){ie-=10;return}if(e<11)return Wi(t,i,r,s,a,n,o,l,h,c);let d=ke[ie++];if((d&128)>0){ie-=11;return}return Wi(t,i,r,s,a,n,o,l,h,c,d)}else{let h=ke[ie++],c=ke[ie++],d=ke[ie++],u=ke[ie++];if((h&128)>0||(c&128)>0||(d&128)>0||(u&128)>0){ie-=12;return}if(e<14){if(e===12)return Wi(t,i,r,s,a,n,o,l,h,c,d,u);{let p=ke[ie++];if((p&128)>
31400){ie-=13;return}return Wi(t,i,r,s,a,n,o,l,h,c,d,u,p)}}else{let p=ke[ie++],f=ke[ie++];if((p&128)>0||(f&128)>0){ie-=14;return}if(e<15)return Wi(t,i,r,s,a,n,o,l,h,c,d,u,p,f);let g=ke[ie++];if((g&128)>0){ie-=15;return}return Wi(t,i,r,s,a,n,o,l,h,c,d,u,p,f,g)}}}}}function Km(e){return Ur.copyBuffers?Uint8Array.prototype.slice.call(ke,ie,ie+=e):ke.subarray(ie,ie+=e)}function lo(e){let t=ke[ie++];if(Ir[t])return Ir[t](ke.subarray(ie,ie+=e));throw new Error("Unknown extension type "+t)}var Sw=new Array(4096);function uE(){let e=ke[ie++];if(e>=160&&e<192){if(e=e-160,la>=ie)return zn.slice(ie-ns,(ie+=e)-ns);if(!(la==0&&Wn<180))return Fv(e)}else return ie--,ci();let t=(e<<5^(e>1?kt.getUint16(ie):e>0?ke[ie]:0))&4095,i=Sw[t],r=ie,s=ie+e-3,a,n=0;if(i&&i.bytes==e){for(;r<s;){if(a=kt.getUint32(r),a!=i[n++]){r=1879048192;break}r+=4}for(s+=3;r<s;)if(a=ke[r++],a!=i[n++]){r=1879048192;break}if(r===s)return ie=r,i.string;s-=3,r=ie}for(i=[],Sw[t]=i,i.bytes=e;r<s;)a=kt.getUint32(r),i.push(a),r+=4;for(s+=3;r<s;)a=ke[r++],i.push(a);let o=e<16?r1(e):dE(e);return o!=null?i.string=o:i.string=Fv(e)}var _w=(e,t)=>{var i=ci();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=i1(i,r),i.read()},pE=typeof self=="object"?self:global;Ir[0]=()=>{};Ir[0].noBuffer=!0;Ir[101]=()=>{let e=ci();return(pE[e[0]]||Error)(e[1])};Ir[105]=e=>{let t=kt.getUint32(ie-4);en||(en=new Map);let i=ke[ie],r;i>=144&&i<160||i==220||i==221?r=[]:r={};let s={target:r};en.set(t,s);let a=ci();return s.used?Object.assign(r,a):(s.target=a,a)};Ir[112]=e=>{let t=kt.getUint32(ie-4),i=en.get(t);return i.used=!0,i.target};Ir[115]=()=>new Set(ci());var fE=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(e=>e+"Array");Ir[116]=e=>{let t=e[0],i=fE[t];if(!i)throw new Error("Could not find typed array for code "+t);return new pE[i](Uint8Array.prototype.slice.call(e,1).buffer)};Ir[120]=()=>{let e=ci();return new RegExp(e[0],e[1])};Ir[98]=e=>{let t=(e[0]<<24)+(e[1]<<16)+(e[2]<<8)+e[3],i=ie;ie+=t-4,Yr=[ci(),ci()],Yr.position0=0,Yr.position1=0;let r=ie;ie=i;try{return ci()}finally{ie=r}};Ir[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 mE(e){let t=Wn,i=ie,r=ns,s=la,a=zn,n=en,o=Yr,l=new Uint8Array(ke.slice(0,Wn)),h=Bt,c=Bt.slice(0,Bt.length),d=Ur,u=mh,p=e();return Wn=t,ie=i,ns=r,la=s,zn=a,en=n,Yr=o,ke=l,mh=u,Bt=h,Bt.splice(0,Bt.length,...c),Ur=d,kt=new DataView(ke.buffer,ke.byteOffset,ke.byteLength),p}function kv(){ke=null,en=null,Bt=null}function r6(e){e.unpack?Ir[e.type]=e.unpack:Ir[e.type]=e}var s1=new Array(147);for(let e=0;e<256;e++)s1[e]=+("1e"+Math.floor(45.15-e*.30103));var Hf=new qp({useRecords:!1});Hf.unpack;Hf.unpackMultiple;Hf.unpack;var s6=new Float32Array(1);new Uint8Array(s6.buffer,0,4);var dp;try{dp=new TextEncoder}catch{}var Xp,a1,Wf=typeof Buffer<"u",Jm=Wf?Buffer.allocUnsafeSlow:Uint8Array,gE=Wf?Buffer:Uint8Array,Aw=Wf?4294967296:2144337920,ye,mi,he=0,Hs,Ws=null,a6=/[\u0080-\uFFFF]/,ec=Symbol("record-id"),vE=class extends qp{constructor(e){super(e),this.offset=0;let t,i,r,s,a,n=0,o=gE.prototype.utf8Write?function(b,A,_){return ye.utf8Write(b,A,_)}:dp&&dp.encodeInto?function(b,A){return dp.encodeInto(b,ye.subarray(A)).written}:!1,l=this;e||(e={});let h=e&&e.sequential,c=e.structures||e.saveStructures,d=e.maxSharedStructures;if(d==null&&(d=c?32:0),d>8160)throw new Error("Maximum maxSharedStructure is 8160");let u=e.maxOwnStructures;u==null&&(u=c?32:64),h&&!e.saveStructures&&(this.structures=[]);let p=d>32||u+d>64,f=d+64,g=d+u+64;if(g>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let m=[],v=0,y=0;this.pack=this.encode=function(b,A){if(ye||(ye=new Jm(8192),mi=new DataView(ye.buffer,0,8192),he=0),Hs=ye.length-10,Hs-he<2048?(ye=new Jm(ye.length),mi=new DataView(ye.buffer,0,ye.length),Hs=ye.length-10,he=0):he=he+7&2147483640,t=he,a=l.structuredClone?new Map:null,l.bundleStrings?(Ws=["",""],ye[he++]=214,ye[he++]=98,Ws.position=he-t,he+=4):Ws=null,i=l.structures,i){i.uninitialized&&(i=l._mergeStructures(l.getStructures()));let _=i.sharedLength||0;if(_>d)throw new Error("Shared structures is larger than maximum shared structures, tr
3140y increasing maxSharedStructures to "+i.sharedLength);if(!i.transitions){i.transitions=Object.create(null);for(let E=0;E<_;E++){let C=i[E];if(!C)continue;let T,P=i.transitions;for(let O=0,D=C.length;O<D;O++){let k=C[O];T=P[k],T||(T=P[k]=Object.create(null)),P=T}P[ec]=E+64}n=_}h||(i.nextId=_+64)}r&&(r=!1),s=i||[];try{if(x(b),Ws){mi.setUint32(Ws.position+t,he-Ws.position-t);let _=Ws;Ws=null,x(_[0]),x(_[1])}if(l.offset=he,a&&a.idsToInsert){he+=a.idsToInsert.length*6,he>Hs&&S(he),l.offset=he;let _=o6(ye.subarray(t,he),a.idsToInsert);return a=null,_}return A&l6?(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,m.length>0&&(m=[]);else if(m.length>0&&!h){for(let _=0,E=m.length;_<E;_++)m[_][ec]=0;m=[]}if(r&&l.saveStructures){let _=i.sharedLength||d;i.length>_&&(i=i.slice(0,_));let E=ye.subarray(t,he);return l.saveStructures(i,n)===!1?(l._mergeStructures(l.getStructures()),l.pack(b)):(n=_,E)}}A&h6&&(he=t)}};let x=b=>{he>Hs&&(ye=S(he));var A=typeof b,_;if(A==="string"){let E=b.length;if(Ws&&E>=8&&E<4096){let P=a6.test(b);Ws[P?0:1]+=b,ye[he++]=193,x(P?-E:E);return}let C;E<32?C=1:E<256?C=2:E<65536?C=3:C=5;let T=E*3;if(he+T>Hs&&(ye=S(he+T)),E<64||!o){let P,O,D,k=he+C;for(P=0;P<E;P++)O=b.charCodeAt(P),O<128?ye[k++]=O:O<2048?(ye[k++]=O>>6|192,ye[k++]=O&63|128):(O&64512)===55296&&((D=b.charCodeAt(P+1))&64512)===56320?(O=65536+((O&1023)<<10)+(D&1023),P++,ye[k++]=O>>18|240,ye[k++]=O>>12&63|128,ye[k++]=O>>6&63|128,ye[k++]=O&63|128):(ye[k++]=O>>12|224,ye[k++]=O>>6&63|128,ye[k++]=O&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,mi.setUint32(he,_),he+=4),he+=_}else if(A==="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,mi.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,mi.setInt16(he,b),he+=2):(ye[he++]=210,mi.setInt32(he,b),he+=4);else{let E;if((E=this.useFloat32)>0&&b<4294967296&&b>=-2147483648){ye[he++]=202,mi.setFloat32(he,b);let C;if(E<4||(C=b*s1[(ye[he]&127)<<1|ye[he+1]>>7])>>0===C){he+=4;return}else he--}ye[he++]=203,mi.setFloat64(he,b),he+=8}else if(A==="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,mi.setUint32(he,C.id),he+=4;return}else a.set(b,{offset:he-t})}let E=b.constructor;if(E===Object)w(b,!0);else if(E===Array){_=b.length,_<16?ye[he++]=144|_:_<65536?(ye[he++]=220,ye[he++]=_>>8,ye[he++]=_&255):(ye[he++]=221,mi.setUint32(he,_),he+=4);for(let C=0;C<_;C++)x(b[C])}else if(E===Map){_=b.size,_<16?ye[he++]=128|_:_<65536?(ye[he++]=222,ye[he++]=_>>8,ye[he++]=_&255):(ye[he++]=223,mi.setUint32(he,_),he+=4);for(let[C,T]of b)x(C),x(T)}else{for(let C=0,T=Xp.length;C<T;C++){let P=a1[C];if(b instanceof P){let O=Xp[C];if(O.write){O.type&&(ye[he++]=212,ye[he++]=O.type,ye[he++]=0),x(O.write.call(this,b));return}let D=ye,k=mi,W=he;ye=null;let N;try{N=O.pack.call(this,b,F=>(ye=D,D=null,he+=F,he>Hs&&S(he),{target:ye,targetView:mi,position:he-F}),x)}finally{D&&(ye=D,mi=k,he=W,Hs=ye.length-10)}N&&(N.length+he>Hs&&S(N.length+he),he=n6(N,ye,he,O.type));return}}w(b,!b.hasOwnProperty)}}else if(A==="boolean")ye[he++]=b?195:194;else if(A==="bigint"){if(b<BigInt(1)<<BigInt(63)&&b>=-(BigInt(1)<<BigInt(63)))ye[he++]=211,mi.setBigInt64(he,b);else if(b<BigInt(1)<<BigInt(64)&&b>0)ye[he++]=207,mi.setBigUint64(he,b);else if(this.largeBigIntToFloat)ye[he++]=203,mi.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(A==="undefined")this.encodeUndefinedAsNil?ye[he++]=192:(ye[he++]=212,ye[he++]=0,ye[he++]=0);else if(A==="function")x(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+A)},w=this.useRecords===!1?this.variableMapSize?b=>{let A=Object.keys(b),_=A.length;_<16?ye[he++]=128|_:_<65536?(ye[he++]=222,ye[he++]=_>>8,ye[he++]=_&255):(ye[he++]=223,mi.setUint32(he,_),he+=4);let E;for(let C=0;C<_;C++)x(E=A[C]),x(b[E])}:(b,A)=>{ye[he++]=222;let _=he-t;he+=2;let E=0;for(let C in b)(A||b.hasOwnProperty(C))&&(x(C),x(b[C]),E++);ye[_+++t]=E>>8,ye[_+t]=E&255}:b=>{let A=Object.keys(b),_,E=s.transitions||(s.transitions=Object.create(null)),C=0;for(let P=0,O=A.length;P<O;P++){let D=A[P];_=E[D],_||(_=E[D]=Object.create(null),C++),E=_}let T=E[ec];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(A)?(T=s.nextOwnId,T<g||(T=f),s.nextOwnId=T+1):(T>=g&&(T=f),s.nextId=T+1);let P=A.highByte=T>=96&&p?T-96>>5:-1;E[ec]=T,s[T-64]=A,T<f?(A.isShared=!0,s.sharedLength=T-63,r=!0,P>=0?(ye[he++]=(T&31)+96,ye[he++]=P):ye[he++]=T):(P>=0?(ye[he++]=213,ye[he++]=114,ye[he++]=(T&31)+96,ye[he++]=P):(ye[he++]=212,ye[he++]=114,ye[he++]=T),C&&(v+=y*C),m.length>=u&&(m.shift()[ec]=0),m.push(E),x(A))}for(let P=0,O=A.length;P<O;P++)x(b[A[P]])},S=b=>{let A;if(b>
314016777216){if(b-t>Aw)throw new Error("Packed buffer would be larger than maximum buffer size");A=Math.min(Aw,Math.round(Math.max((b-t)*(b>67108864?1.25:2),4194304)/4096)*4096)}else A=(Math.max(b-t<<2,ye.length-1)>>12)+1<<12;let _=new Jm(A);return mi=new DataView(_.buffer,0,A),ye.copy?ye.copy(_,0,t,b):_.set(ye.slice(t,b)),he-=t,t=0,Hs=_.length-10,ye=_}}useBuffer(e){ye=e,mi=new DataView(ye.buffer,ye.byteOffset,ye.byteLength),he=0}};a1=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,lE];Xp=[{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?Mw(e,16,t):Ew(Wf?Buffer.from(e):new Uint8Array(e),t)}},{pack(e,t){let i=e.constructor;i!==gE&&this.structuredClone?Mw(e,fE.indexOf(i.name),t):Ew(e,t)}},{pack(e,t){let{target:i,position:r}=t(1);i[r]=193}}];function Mw(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 Ew(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 n6(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 o6(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)");a1.unshift(e.Class),Xp.unshift(e)}r6(e)}var yE=new vE({useRecords:!1});yE.pack;yE.pack;var l6=512,h6=1024,Cw=new vE({structuredClone:!0});zh({Class:Je.prototype.constructor,type:1,write(e){return{...e}},read(e){return Object.setPrototypeOf(e,Je.prototype),e}});zh({Class:He.prototype.constructor,type:2,write(e){return[...e]},read(e){return Object.setPrototypeOf(e,He.prototype),e}});zh({Class:lr.prototype.constructor,type:3,write(e){return[...e]},read(e){return Object.setPrototypeOf(e,lr.prototype),e}});
3140zh({Class:mw.prototype.constructor,type:4,write(e){return e.id},read(e){return new mw(e)}});zh({Class:gw.prototype.constructor,type:5,write(e){return e.data},read(e){return new gw(e)}});zh({Class:Ti.prototype.constructor,type:6,write(e){return{...e}},read(e){return Object.setPrototypeOf(e,Ti.prototype),e}});function c6(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 Uv(e){if(Ky(e))return e;if(Array.isArray(e))return e.map(Uv);if(typeof e=="object"&&e!==null){let t={};for(let i of Object.keys(e).sort())t[i]=Uv(e[i]);return Object.setPrototypeOf(t,Object.getPrototypeOf(e)),t}else return e}var Nv;(e=>{function t(s){return Cw.pack(s)}e.serialize=t;function i(s){return Cw.unpack(s)}e.deserialize=i;function r(s){return c6(t(Uv(s))).toString()}e.checksum=r})(Nv||(Nv={}));var Tw;(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})(Tw||(Tw={}));function Pw(e){return e==="MouseDown"||e==="MouseUp"||e==="KeyDown"||e==="KeyUp"||e==="Collision"||e==="Trigger"}var fr={LookAt:[],Follow:["Create"],DragDrop:["Transition","Animation","Audio","Particles","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseHover:["Transition","Animation","Particles","Create","Destroy","SwitchCamera","SceneTransition","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Scroll:["Transition","Animation","Create","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Start:["Transition","Animation","Audio","Particles","Video","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],Conditional:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseDown:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MouseUp:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],MousePress:["Transition","Animation","Audio","Particles","Video","Link","Create","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyDown:["Transition","Animation","Audio","Particles","Video","Link","Create","Destroy","SwitchCamera","SceneTransition","Reset","SetVariable","DynamicVariablePlay","Conditional","ClearLocalStorage","UserAPI"],KeyUp:["Transition","Animation","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","Audio","Particles","Create","Conditional"],Collision:["Transition","Animation","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"]},Dw;(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,actions:new He}:{type:r,disabled:!1,key:void 0,actions:new He}}e.defaultData=i})(Dw||(Dw={}));var Yp;(e=>{function t(i){return{type:"Property",value:[i??null,"position","x"]}}e.propertyDefaultData=t,e.valueDefaultData={type:"Literal",value:0}})(Yp||(Yp={}));var Vv;(e=>{function t(s){return{type:"Comparison",operator:"==",lOperand:Yp.propertyDefaultData(s),rOperand:{...Yp.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})(Vv||(Vv={}));var Iw;(e=>{function t(i){return i.find(r=>r==="ifActions"||r==="elseActions")!==void 0}e.isConditionalSubActions=t})(Iw||(Iw={}));var Ow;(e=>{function t(r){return r.type==="Conditional"}e.is=t;function i(r){return{type:"Conditional",disabled:!1,inActions:new He,outActions:new He,condition:Vv.distanceDefaultData(r)}}e.defaultData=i})(Ow||(Ow={}));var Rw;(e=>e.defaultData={type:"DragDrop",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 He,drop:new He}})(Rw||(Rw={}));var jv;(e=>e.defaultData={type:"Follow",disabled:!1,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 He})(jv||(jv={}));var Gv;(e=>e.defaultData={type:"LookAt",disabled:!1,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})(Gv||(Gv={}));var Lw;(e=>{function t(r){return r.type==="MouseHover"}e.is=t;function i(){return{type:"MouseHover",disabled:!1,actions:new He}}e.defaultData=i})(Lw||(Lw={}));var Bw;(e=>{function t(r){return r.type==="Scroll"}e.is=t;function i(){return{type:"Scroll",disabled:!1,steps:100,trigger:"load",startFrom:"enter",enterAnchor:"top",startOffset:0,endAfter:400,actions:new He}}e.defaultData=i})(Bw||(Bw={}));var zw;(e=>{function t(r){return r.type==="Start"}e.is=t;function i(){return{type:"Start",disabled:!1,actions:new He}}e.defaultData=i})(zw||(zw={}));var Fw;(e=>{function t(r){return r.type==="Collision"}e.is=t;function i(){return{type:"Collision",disabled:!1,target:"character",actions:new He}}e.defaultData=i})(Fw||(Fw={}));var kw;(e=>{function t(r){return r.type==="Trigger"}e.is=t;function i(r,s){return{type:"Trigger",disabled:!1,target:"all",triggeringObjects:[],actions:new He,triggerZone:"box",position:s.toArray(),rotation:[0,0,0],size:r.toArray(),radius:r.length()/2,helperVisible:!0}}e.defaultData=i})(kw||(kw={}));var Hv;(e=>
vendor: 27,779 bytes, line 3140
3140{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 He},o={size:"tablet",operator:"<",actions:new He},l={size:[...e.defaultSizes.custom],operator:"<>",actions:new He},h=new He;return h.push({id:Oe.generateUUID(),fi:0,data:n},{id:Oe.generateUUID(),fi:1,data:o},{id:Oe.generateUUID(),fi:2,data:l}),{type:"Resize",disabled:!1,orientation:"horizontal",breakpoints:h}}e.defaultData=s;function a(){return{size:[...e.defaultSizes.custom],operator:"<>",actions:new He}}e.defaultBreakpointData=a})(Hv||(Hv={}));var Wv;(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 Object 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",actions:new He,variableId:"",objectId:null,property:"Position X"}}e.defaultData=i})(Wv||(Wv={}));var Uw;(e=>{function t(r){return r.type==="API"}e.is=t;function i(){return{disabled:!1,type:"API",successActions:new He,errorActions:new He,userAPIId:""}}e.defaultData=i})(Uw||(Uw={}));var Nw;(e=>{function t(r){return r.type==="WEBHOOK"}e.is=t;function i(){return{disabled:!1,type:"WEBHOOK",actions:new He,userWebhookId:""}}e.defaultData=i})(Nw||(Nw={}));var Vw;(e=>{function t(r){return r.type==="AIAssistantListener"}e.is=t;function i(){return{disabled:!1,type:"AIAssistantListener",actions:new He,analysis:"average",analysisRange:[0,71],analysisSingle:0}}e.defaultData=i})(Vw||(Vw={}));var jw;(e=>{function t(r){return r.type==="AIAssistantTrigger"}e.is=t;function i(){return{disabled:!1,description:"",type:"AIAssistantTrigger",actions:new He}}e.defaultData=i})(jw||(jw={}));var Fh="personal camera",Lc="a218fcc3-276b-49b9-b485-49037fd14f5f",d6=2960946,Zr=5526619,Ja;(e=>{function t(f,g){return f[0]===g[0]&&f[1]===g[1]}e.isEqual=t;function i(f,g,m){return[f[0]+(g[0]-f[0])*m,f[1]+(g[1]-f[1])*m]}e.lerp=i;function r(f,g){return[f[0]+g[0],f[1]+g[1]]}e.add=r;function s(f,g){return[f[0]-g[0],f[1]-g[1]]}e.sub=s;function a(f,g){return[f[0]*g[0],f[1]*g[1]]}e.multiply=a;function n(f,g){return[f[0]/g[0],f[1]/g[1]]}e.divide=n;function o(f,g){return Math.pow(g[0]-f[0],2)+Math.pow(g[1]-f[1],2)}e.distanceSquared=o;function l(f,g){return Math.sqrt(o(f,g))}e.distance=l;function h(f,g){return f[0]*g[0]+f[1]*g[1]}e.dot=h;function c(f,g){return[f[0]*g,f[1]*g]}e.scalarMultiply=c;function d(f,g,m){let v=e.sub(g,f),y=e.sub(m,f),x=e.dot(v,y)/e.dot(v,v),w=e.scalarMultiply(v,x);return e.add(f,w)}e.projectionOnto=d;function u(f,g,m){return l(f,d(f,g,m))}e.projectionOntoDistance=u;function p(f,g){return[(f[0]+g[0])*.5,(f[1]+g[1])*.5]}e.center=p})(Ja||(Ja={}));var ko;(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})(ko||(ko={}));var Qp;(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})(Qp||(Qp={}));var Gw;(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})(Gw||(Gw={}));var gh;(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})(gh||(gh={}));var nr;(e=>{function t(h){return typeof h=="object"&&typeof h.r=="number"&&typeof h.g=="number"&&typeof h.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(h){return{r:Math.round(h.r*255),g:Math.round(h.g*255),b:Math.round(h.b*255),a:1}}e.toRgb255a1=i;function r(h){return{r:h.r,g:h.g,b:h.b}}e.clone=r;function s(h){return h=Math.floor(h),{r:(h>>16&255)/255,g:(h>>8&255)/255,b:(h&255)/255}}e.fromHex=s;function a(h){return Math.round(h.r*255)*65536+Math.round(h.g*255)*256+Math.round(h.b*255)}e.toHex=a;function n(h,c){return h.r===c.r&&h.g===c.g&&h.b===c.b}e.equals=n;function o(h,c){return h.r.toFixed(2)===c.r.toFixed(2)&&h.g.toFixed(2)===c.g.toFixed(2)&&h.b.toFixed(2)===c.b.toFixed(2)}e.equalsFixed=o;function l(h,c,d){return{r:h.r+(c.r-h.r)*d,g:h.g+(c.g-h.g)*d,b:h.b+(c.b-h.b)*d}}e.lerp=l})(nr||(nr={}));var Gt;(e=>{e.white={...nr.white,a:1},e.transparent={...nr.white,a:0};function t(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}}e.from0to1=t;function i(l,h){return{...nr.fromHex(l),a:h}}e.fromHexAndA=i;function r(l){return{r:Math.round(l.r*255),g:Math.round(l.g*255),b:Math.round(l.b*255),a:l.a}}e.toRgb255a1=r;function s(l,h){return nr.equals(l,h)&&l.a===h.a}e.equals=s;function a(l,h){return nr.equalsFixed(l,h)&&l.a.toFixed(2)===h.a.toFixed(2)}e.equalsFixed=a;function n(l,h,c){return{r:l.r+(h.r-l.r)*c,g:l.g+(h.g-l.g)*c,b:l.b+(h.b-l.b)*c,a:l.a+(h.a-l.a)*c}}e.lerp=n;function o({r:l,g:h,b:c,a:d}=e.white){return`rgba(${l*255}, ${h*255}, ${c*255}, ${d})`}e.toStyle=o})(Gt||(Gt={}));var qv;(e=>e.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]})(qv||(qv={}));var Hw;(e=>e.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(Hw||(Hw={}));var Ww;(e=>e.defaultData={control1:[.5,0],control2:[.5,1]})(Ww||(Ww={}));var Cn;(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]))(Cn||(Cn={}));function qw(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 Wo;(e=>{e.all=["PerspectiveCamera","OrthographicCamera"];function t(i){return e.all.includes(i)}e.is=t})(Wo||(Wo={}));var vh;(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){var r,s;return i.type==="PerspectiveCamera"?((r=i.perspective)==null?void 0:r.zoom)??1:((s=i.orthographic)==null?void 0:s.zoom)??1}e.getZoom=t})(vh||(vh={}));var Fn;(e=>{function t(r,s=.1){return{disabled:!1,type:"linear",hideBase:!1,count:3,radial:{radius:Math.max(r[0],r[1])*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[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"},linear:{scale:[1,1,1],rotation:[0,0,0],position:[r[0]+r[0]*s,0,0]},grid:{count:[2,2,2],size:r.map(a=>a*(1+s)),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(r,s){let a={...r};if(xE.forEach(n=>{Object.assign(a,{[n]:s[n]??r[n]})}),a.radial={...r.radial},s.radial){let n=r.radial,o=s.radial;bE.forEach(l=>{Object.assign(a.radial,{[l]:o[l]??n[l]})})}if(a.linear={...r.linear},s.linear){let n=r.linear,o=s.linear;wE.forEach(l=>{Object.assign(a.linear,{[l]:o[l]??n[l]})})}if(a.grid={...r.grid},s.grid){let n=r.grid,o=s.grid;SE.forEach(l=>{Object.assign(a.grid,{[l]:o[l]??n[l]})})}if(a.toObject={...r.toObject},s.toObject){let n=r.toObject,o=s.toObject;_E.forEach(l=>{Object.assign(a.toObject,{[l]:o[l]??n[l]})})}if(a.randomnessObject={...r.randomnessObject},s.randomnessObject){let n=r.randomnessObject,o=s.randomnessObject;AE.forEach(l=>{Object.assign(a.randomnessObject,{[l]:o[l]??n[l]})})}return a}e.merge=i})(Fn||(Fn={}));var Xv;(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})(Xv||(Xv={}));var xE=["count"],bE=["radius","start","end","position","scale","rotation"],wE=["position","scale","rotation"],SE=["count","size"],_E=["count","position","scale","rotation"],AE=["strength","scale","rotation","position","movement","seed","freqScale"],Yv;(e=>{e.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function t(i){return e.all.includes(i)}e.is=t})(Yv||(Yv={}));var Qv;(e=>{function t(r){return i(r)}e.defaultData=t;function i(r){if(r==="PointLight")return{type:r,color:Gt.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,penumbraSize:.5,depth:1e5};if(r==="SpotLight")return{type:r,color:Gt.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:Gt.white,intensity:1,shadows:!0,size:2e3,depth:1e5,penumbraSize:.5,shadowResolution:1024,shadowRadius:1};throw new Error("not implemented")}})(Qv||(Qv={}));var Zp;(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}))(Zp||(Zp={}));var yh;(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]})(yh||(yh={}));var Zv;(e=>{e.defaultData={castShadow:!0,receiveShadow:!0};function t(i,r){return i.castShadow===r.castShadow&&i.receiveShadow===r.receiveShadow}e.equals=t})(Zv||(Zv={}));var Kv;(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})(Kv||(Kv={}));var Jv;(e=>e.defaultData={...Kv.defaultData,...Zv.defaultData})(Jv||(Jv={}));var Xw;(e=>{function t(i,r){var a,n;let s=[];if("material"in i){let o=typeof i.material=="string"?r.materials[i.material]??((a=r.lib.materials[i.material])==null?void 0:a.asset):i.material;o&&s.push(o)}else if("materials"in i)for(let o of i.materials){let l=typeof o=="string"?r.materials[o]??((n=r.lib.materials[o])==null?void 0:n.asset):o;l&&s.push(l)}return s}e.getMaterialData=t})(Xw||(Xw={}));var Kp;(e=>(e.defaultVideo={data:"",thumb:"/_assets/_videos/catThumb.png",type:"video",name:"Cat video"},e.maxSize=3e7))(Kp||(Kp={}));var Yw;(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})(Yw||(Yw={}));function u6(e){return e.type!=="displace"}var Qw;(e=>{function t(i){return i==="phong"||i==="toon"||i==="lambert"||i==="physical"}e.is=t})(Qw||(Qw={}));var ME=["mode","gradientType","noiseType","displacementType","projection","cnormal","crop","axis","side"],p6=["wrapping","image","video","name","minFilter","magFilter"],qi;(e=>{function t(a,n){let{texture:o,...l}=n;if(Object.assign(a,l),o){let h=a.texture;h&&Object.assign(h,o)}}e.patch=t;function i(a,n){return a==="light"&&n?r(n):s(a)}e.defaultData=i;function r(a){let n={mode:0,isMask:!1,visible:!0,bumpMap:void 0,bumpMapIntensity:5,roughnessMap:void 0,alphaOverride:1};switch(a){case"phong":return{...n,category:"phong",specular:{r:.2,g:.2,b:.2},shininess:5,type:"light",visible:!0,mode:0,occlusion:!0,alpha:.6};case"toon":return{...n,category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1};case"lambert":return{...n,category:"lambert",emissive:{r:0,g:0,b:0},type:"light",alpha:1,visible:!0,mode:0,occlusion:!0};case"physical":return{...n,category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0,occlusion:!0}}}function s(a){let n={alpha:1,mode:0,isMask:!1,visible:!0};switch(a){case"texture":return{...n,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{...n,type:"video",size:[128,128],blending:0,axis:"x",side:2,projection:0,texture:{video:Kp.defaultVideo,wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006},crop:!1};case"color":return{...n,type:"color",color:nr.fromHex(Zr)};case"depth":return{...n,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{...n,type:"normal",cnormal:[1,1,1]};case"gradient":return{...n,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{...n,type:"noise",size:[100,100,100],noiseType:0,scale:1,move:1,colorA:{...nr.fromHex(6710886),a:1},colorB:{...nr.fromHex(6710886),a:1},colorC:{...nr.fromHex(16777215),a:1},colorD:{...nr.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{...n,type:"fresnel",color:Gt.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{...n,type:"rainbow",filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"toon":return{...n,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:Gt.fromHexAndA(0,0),offset:[0,0,0]};case"outline":return{...n,type:"outline",outlineColor:Gt.fromHexAndA(0,1),contourColor:Gt.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{...n,type:"matcap",texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0],rotation:0,minFilter:1008,magFilter:1006}};case"transmission":return{...n,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{...n,type:"pattern",style:0,projection:0,axis:"y",blending:0,offset:[0,0],colorA:{...nr.fromHex(0),a:1},colorB:{...nr.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}}}})(qi||(qi={}));var Zi;(e=>{function t(c){return!c.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(c){let d="";return c.layers.forEach(u=>{Object.entries(u.data).forEach(([p,f])=>{d+=`${p}${f}`,Array.isArray(f)?f.forEach(g=>d+=`${g}`):typeof f=="object"?Object.values(f).forEach(g=>{typeof g=="number"?d+=`${g.toFixed(4)}`:d+=`${g}`}):d+=`${f}`})}),d}e.getHash=i;function r(){return{layers:new He}}e.defaultEmptyData=r;function s(c="layer1",d="layer2"){return n("phong",c,d)}e.defaultData=s;function a(c,d){return{...c,name:d}}e.withName=a;function n(c,d="layer1",u="layer2"){let p=new He;return p.push({fi:0,data:qi.defaultData("light",c),id:d}),p.push({fi:1,data:qi.defaultData("color"),id:u}),{layers:p}}e.defaultTwoLayerData=n;function o(c){let d=qi.defaultData("texture");c&&Object.assign(d.texture,{image:c});let u=new He;return u.push({fi:0,data:d,id:"layer1"}),u.push({fi:1,data:{...qi.defaultData("transmission"),alpha:1},id:"layer2"}),u.push({fi:2,data:{...qi.defaultData("light","lambert"),alpha:0},id:"layer3"}),{layers:u}}e.defaultUIObjectMaterial=o;function l(c,d="phong",u="layer1",p="layer2"){let f=qi.defaultData("texture");Object.assign(f.texture,{image:c});let g=new He;return g.push({fi:0,data:f,id:u}),g.push({fi:1,data:qi.defaultData("light",d),id:p}),{layers:g}}e.defaultTwoLayerTextureData=l;function h(c,d="phong",u="layer1",p="layer2"){let f=qi.defaultData("video");Object.assign(f.texture,{video:c});let g=new He;return g.push({fi:0,data:f,id:u}),g.push({fi:1,data:qi.defaultData("light",d),id:p}),{layers:g}}e.defaultTwoLayerVideoTextureData=h})(Zi||(Zi={}));var Jp;(e=>{function t(){return{points:new He,roundness:0,shapeHoles:[],isClosed:!1}}e.defaultData=t})(Jp||(Jp={}));var $p;(e=>{function t(){return{points:new He,lastInsertionPlane:null,subdivisions:12,isClosed:!1}}e.defaultData=t})($p||($p={}));var EE={type:"Ellipse",width:50,height:50,spikes:16,angle:360,innerRadius:0},$v;(e=>{function t(i,r){let s={...i};return TE.forEach(a=>{Object.assign(s,{[a]:r[a]??i[a]})}),s}e.merge=t})($v||($v={}));var CE={shape:EE,depth:1,offset:0,bevel:50,bevelSides:6,angle:0,twist:0,startScale:1,endScale:1,capType:"flat"},TE=["depth","offset","angle","twist","startScale","endScale"],ef;(e=>{function t(r){return r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="UIGeometry"}e.is2DParametricMesh=t;function i(r){return r==="PolygonGeometry"||r==="PolygonGeometry"||r==="RectangleGeometry"||r==="StarGeometry"||r==="TriangleGeometry"||r==="EllipseGeometry"||r==="PathGeometry"||r==="VectorGeometry"||r==="ConeGeometry"||r==="CubeGeometry"||r==="CylinderGeometry"||r==="DodecahedronGeometry"||r==="HelixGeometry"||r==="IcosahedronGeometry"||r==="LatheGeometry"||r==="PyramidGeometry"||r==="SphereGeometry"||r==="PlaneGeometry"||r==="BackdropGeometry"||r==="TorusGeometry"||r==="TorusKnotGeometry"||r==="BooleanGeometry"||r==="TextGeometry"||r==="InputGeometry"}e.isParametricMesh=i})(ef||(ef={}));var e0;(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,$v.merge(s.extrusion,r.extrusion))),s}e.merge=t})(e0||(e0={}));var Pn;(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:$p.defaultData(),extrusion:CE};if(i==="VectorGeometry")return{width:1,height:1,type:i,subdivisions:12,shape:Jp.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})(Pn||(Pn={}));var $m=["width","height","depth"],t0;(e=>e.defaultData={enabled:!1,useBackgroundColor:!1,color:nr.white,near:.1,far:2e3})(t0||(t0={}));var tf;(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}}})(tf||(tf={}));var i0;(e=>e.defaultData={softShadowQuality:"low"})(i0||(i0={}));var r0;(e=>e.defaultData={enabled:!0,color:{r:.8274509803921568,g:.8274509803921568,b:.8274509803921568},intensity:.75})(r0||(r0={}));var s0;(e=>e.defaultData={occlusion:!1,aoFullRes:!1,radius:256,bias:.5,aoColor:{r:.19607843137254902,g:.19607843137254902,b:.19607843137254902}})(s0||(s0={}));var xh;(e=>e.defaultData={usePhysics:!1,gravity:-10})(xh||(xh={}));var a0;(e=>e.defaultData={playCamera:Fh,gameControlObject:null})(a0||(a0={}));var n0;(e=>e.defaultData={backgroundColor:Gt.fromHexAndA(d6,1),postprocessing:tf.defaultData,fog:t0.defaultData,globalPhysics:xh.defaultData,ambient:r0.defaultData,ao:s0.defaultData,shadow:i0.defaultData,publish:a0.defaultData})(n0||(n0={}));var o0;(e=>e.defaultData={colliderType:"box",size:[100,100,100],colliderHelperVisible:!0,forceType:"collider",forceRange:"global",forceIntensity:.5,forceDambing:.95})(o0||(o0={}));var Zw;(e=>{function t(r){return r==="Component"||r==="Instance"}e.isComponentRelated=t;function i(r){return r==="Empty"||r==="Instance"}e.isEmptyOrComponent=i})(Zw||(Zw={}));var bh;(e=>{e.identity={...qv.identity,hiddenMatrix:gh.identity};function t(s){return{position:s.position,rotation:s.rotation,scale:s.scale,hiddenMatrix:s.hiddenMatrix}}e.fromObject=t;function i(s,a){return{position:(a==null?void 0:a.position)||s.position,rotation:(a==null?void 0:a.rotation)||s.rotation,scale:(a==null?void 0:a.scale)||s.scale,hiddenMatrix:(a==null?void 0:a.hiddenMatrix)||s.hiddenMatrix}}e.merge=i;function r(s,a){return H2({position:ko.isEqual(s.position,a.position)?void 0:a.position,rotation:ko.isEqual(s.rotation,a.rotation)?void 0:a.rotation,scale:ko.isEqual(s.scale,a.scale)?null:a.scale,hiddenMatrix:gh.isEqual(s.hiddenMatrix,a.hiddenMatrix)?void 0:a.hiddenMatrix})}e.diff=r})(bh||(bh={}));var ki;(e=>e.defaultData={states:new He,events:new He,visible:!0,raycastLock:!1,physics:yh.defaultData,pathSnapping:{pathId:null,slide:0,offset:0,orientation:"tangential"},...bh.identity,cloner:null})(ki||(ki={}));var l0;(e=>e.defaultData={type:"Empty",...ki.defaultData})(l0||(l0={}));var Kw;(e=>e.defaultData={type:"ParticleCollider",...o0.defaultData,...ki.defaultData})(Kw||(Kw={}));var Jw;(e=>e.defaultData={type:"Component",...ki.defaultData})(Jw||(Jw={}));var $w;(e=>e.defaultData={type:"Particle",...ki.defaultData,...Zp.defaultData})($w||($w={}));var Dn;(e=>e.defaultData={type:"Mesh",...ki.defaultData,...Jv.defaultData})(Dn||(Dn={}));var sd;(e=>e.defaultData={...ki.defaultData,...bh.identity,position:[0,0,vh.DefaultTargetOffset],...vh.defaultData})(sd||(sd={}));var h0;(e=>{function t(i){return{...ki.defaultData,...Qv.defaultData(i)}}e.defaultData=t,e.defaultDirectionalLightData={...e.defaultData("DirectionalLight"),position:[200,300,300],name:"Directional Light",intensity:.7}})(h0||(h0={}));var rf;(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})(rf||(rf={}));var kn;(e=>{e.rootOverrideProps=["physics","events"],e.compositeNonOptionalOverrideProps=["geometry"],e.compositeEntireOverrideOverrideProps=["material"];function t(r,s){return{...ki.defaultData,...s,component:r,overrides:new Ti,physics:void 0,events:void 0,type:"Instance"}}e.ofComponent=t;function i(r){let s=bh.fromObject(r.data);return t(r.id,s)}e.fromComponentData=i})(kn||(kn={}));var wh;(e=>{e.defaultData={type:"Page",...ki.defaultData,physics:{...yh.defaultData,fusedBody:!1},...n0.defaultData,camera:sd.defaultData};function t(i){return i.uiScene!==void 0}e.isUIPage=t})(wh||(wh={}));var c0;(e=>(e.defaultCamera={position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:gh.identity,name:"Play Camera",visible:!0,raycastLock:!1,physics:yh.defaultData,states:new He,events:new He,cloner:null,pathSnapping:{pathId:null,orientation:"tangential",slide:0,offset:0},...vh.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",...ki.defaultData,...Dn.defaultData,geometry:Pn.defaultData("RectangleGeometry"),material:Zi.defaultTwoLayerData("phong","layer1","layer2")},e.defaultBooleanObject={name:"Boolean",...ki.defaultData,...Dn.defaultData,geometry:Pn.defaultData("BooleanGeometry"),material:Zi.defaultTwoLayerData("phong","layer1","layer2")},e.defaultShapeBlendObject={name:"Shape Blend",...ki.defaultData,...Dn.defaultData,geometry:Pn.defaultData("ShapeBlendGeometry"),material:Zi.defaultTwoLayerData("phong","layer1","layer2")},e.defaultTextObject={name:"Text",...ki.defaultData,...Dn.defaultData,geometry:Pn.defaultData("TextGeometry"),material:Zi.defaultTwoLayerData("phong","layer1","layer2")},e.defaultInputObject={name:"Input",...ki.defaultData,...Dn.defaultData,geometry:Pn.defaultData("InputGeometry"),material:Zi.defaultTwoLayerData("phong","layer1","layer2")}))(c0||(c0={}));var Co;(e=>{function t(a,n){let o={name:n};return a.type==="Mesh"?(o.geometry={},"material"in a&&(o.material={layers:new Ti}),"materials"in a&&(o.materials=a.materials.map(l=>({layers:new Ti})))):Wo.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=rd(o.material,l=>
3140{if(typeof l!="string")for(let[h,c]of Object.entries(n.material.layers)){let d=l.layers.data(h);d&&qi.patch(d,c)}}).data),o.materials&&n.materials&&(o.materials=rd(o.materials,l=>{var h,c;for(let d=0;d<o.materials.length;d++){let u=n.materials[d];if(typeof u!="string")for(let[p,f]of Object.entries(u.layers)){let g=(c=(h=l[d])==null?void 0:h.layers)==null?void 0:c.data(p);g&&qi.patch(g,f)}}}).data),o}function r(a,n){let o,l=[],h={orthographic:0,perspective:0,geometry:0};function c(d,u){for(let[p,f]of Object.entries(u.layers)){let{texture:g,...m}=f;if(g!==void 0&&Object.keys(g).length>0){let v={path:[...d,"layers",p,"texture"],props:g,type:0};l.push(v)}if(Object.keys(m).length>0){let v={path:[...d,"layers",p],props:m,type:0};l.push(v)}}}for(let[d,u]of Object.entries(n))if(d!=="name")if(d==="cloner")l.push(...Xv.toOps(u,["cloner"]));else if(d==="pathSnapping")l.push({path:[d],props:{slide:u.slide,offset:u.offset},type:0});else if(d==="material")c(["material"],u);else if(d==="materials")for(let[p,f]of Object.entries(u))c(["materials",p],f);else if(h[d]===0){if(d==="geometry"&&u.extrusion!==void 0){let p={path:[d,"extrusion"],props:u.extrusion,type:0};l.push(p),u={...u},delete u.extrusion}if(Object.keys(u).length>0){let p={path:[d],props:u,type:0};l.push(p)}}else o===void 0&&(o={path:[],props:{},type:0},l.push(o)),o.props[d]=u;return l}e.toOps=r;function s(a,n){var l,h,c,d,u,p;if(n===void 0)return a;let o={...a};if(Object.assign(o,bh.merge(o,n)),Object.assign(o,{pathSnapping:Object.assign({},o.pathSnapping,{slide:((l=n.pathSnapping)==null?void 0:l.slide)??((h=o.pathSnapping)==null?void 0:h.slide)??0,offset:((c=n.pathSnapping)==null?void 0:c.offset)??((d=o.pathSnapping)==null?void 0:d.offset)??0})}),Wo.is(a.type)){o.orthographic={...o.orthographic},o.perspective={...o.perspective};let f=n;((u=f.orthographic)==null?void 0:u.zoom)!==void 0&&(o.orthographic.zoom=f.orthographic.zoom),((p=f.perspective)==null?void 0:p.zoom)!==void 0&&(o.perspective.zoom=f.perspective.zoom),f.isUpVectorFlipped!==void 0&&(o.isUpVectorFlipped=f.isUpVectorFlipped),f.targetOffset!==void 0&&(o.targetOffset=f.targetOffset)}else if(a.type==="Mesh")"geometry"in n&&Object.assign(o,{geometry:e0.merge(o.geometry,n.geometry)}),(n.material||n.materials)&&(o=i(o,n)),o.cloner&&"cloner"in n&&Object.assign(o,{cloner:Fn.merge(o.cloner,n.cloner)});else if(a.type==="Empty")o.cloner&&"cloner"in n&&Object.assign(o,{cloner:Fn.merge(o.cloner,n.cloner)});else if(Yv.is(a.type)){let f=n;f.intensity!==void 0&&(o.intensity=f.intensity),f.color!==void 0&&(typeof f.color=="string"?o.color=f.color:o.color=nr.clone(f.color))}return o}e.patch=s}
3140)(Co||(Co={}));var sf;(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,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})(sf||(sf={}));var Un;(e=>e.defaultData={orbitControls:sf.defaultData,playPage:Lc,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},video:{format:"mp4",imageFormat:"jpg",fps:30,mbps:80,ratio:Math.max(1,typeof window<"u"?Math.floor(window.devicePixelRatio):1),stopMode:"manual",duration:5e3},web:{logo:!0,compress:!0,preset:1,preload:!0,hint:!1,imageQuality:70}},stopRaycast:!0,hdTransmission:!1})(Un||(Un={}));var d0;(e=>e.defaultData={id:"basic",label:"Basic",style:"None",prompt:""})(d0||(d0={}));var u0;(e=>e.defaultData={weather:0,shadows:0,lightOrigin:0,temperature:0,sun:0,camera:0,environment:0,particles:0,nature:0,floor:0})(u0||(u0={}));var To;(e=>(e.defaultData=()=>({mode:"line-art-both",prompt:"",negativePrompt:"",style:{...d0.defaultData},isRandomSeed:!0,seed:e.generateSeed(),guessMode:!1,advanced:!1,steps:20,guidanceScale:7.5,controlNetScale:1,modifiers:u0.defaultData}),e.generateSeed=()=>Math.round(Math.random()*1e5)))(To||(To={}));var ad;(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)=>{var l;if(o.type==="Instance"){let h=(l=of.getComponentData(r,o.component))==null?void 0:l.data;h&&a(n,o,h.events)}else a(n,o,o.events)})}e.traverseModuleInstances=i})(ad||(ad={}));var Po;(e=>{e.TRASH_CAN_ID="830a2708-8ed9-49cf-a68e-085299892222",e.defaultLight={fi:-1,data:h0.defaultDirectionalLightData,id:"830a2708-8ed9-49cf-a68e-085299899103",children:[]};function t(s=!0,a=[]){let n=[],o=c0.defaultMeshObject;s&&(n.push({...e.defaultLight}
vendor: 24,410 bytes, line 3140
3140),n.push({fi:1,id:"7ba78968-2a55-48f2-b14c-5191da3e075e",data:o,children:[]})),n.push(...a);let l=new lr;return l.push({fi:1,id:Lc,data:{...wh.defaultData,name:"Scene 1"},children:n}),l}e.createDefaultObjectTreeWithPage=t,e.defaultData={objects:t(),publish:Un.defaultData,styles:To.defaultData()},e.emptyDataWithoutPage=function(){return{objects:new lr,publish:Un.defaultData,styles:To.defaultData()}},e.emptyDataWithPage=function(s=!0){return{objects:t(s),publish:Un.defaultData,styles:To.defaultData()}},e.emptyData=function(){return{objects:new lr,publish:{...Un.defaultData},styles:To.defaultData()}};function i(s){return{...e.defaultData,objects:ms(s,lr.prototype)}}e.withObjs=i;function r(s,a){return i([{id:s,data:a,children:[],fi:0}])}e.withObj=r})(Po||(Po={}));var Bc;(e=>e.defaultData={preset:"fullscreen",allowResponsive:!1,size:[512,512],coords:[0,0],sceneScale:1,color:{r:0,g:0,b:0,a:.5}})(Bc||(Bc={}));var p0;(e=>(e.defaultData=t=>({url:t,name:"New Webhook",parametersSchemas:new He}),e.defaultParameterValueByType=t=>t==="number"?0:t==="boolean"?!1:""))(p0||(p0={}));var eS;(e=>e.defaultData=(t,i="GET")=>({url:t,method:i,name:"New API",headers:new He,queries:new He,autoStart:!0}))(eS||(eS={}));var hr;(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})(hr||(hr={}));var f0;(e=>e.all=["images","videos","colors","audios","particles","fonts","materials","variables"])(f0||(f0={}));var tS;(e=>e.all=[...f0.all,"components"])(tS||(tS={}));var iS;(e=>{function t(){return{images:new Je,videos:new Je,colors:new Je,audios:new Je,particles:new Je,fonts:new Je,materials:new Je,components:new Je,variables:new Je,userAPIs:new Je,userWebhooks:new Je}}e.defaultData=t})(iS||(iS={}));var nn;(e=>{function t(){return{images:new Je,videos:new Je,colors:new Je,audios:new Je,particles:new Je,fonts:new Je,materials:new Je,components:new Je,variables:new Je,userAPIs:new Je,userWebhooks:new Je}}e.defaultData=t})(nn||(nn={}));var os;(e=>{function t(){let n={};return n["89b10010-844c-11ec-a8a3-0242ac120002"]={r:.5,g:.5,b:.5,a:1,name:"Default Color"},ms(n,Je.prototype)}e.defaultColors=t;function i(){return ms({},Je.prototype)}e.defaultImages=i;function r(){return{catelogs:new Je,materials:new Je,images:new Je,videos:new Je,colors:new Je,audios:new Je,particles:new Je,fonts:new Je,variables:new He,userAPIs:new Je,userWebhooks:new Je,lib:nn.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})(os||(os={}));var af;(e=>e.list=["idle","move","jump","run"])(af||(af={}));var nf;(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 He,move:new He,jump:new He,run:new He},navmesh:{enabled:!1,ch:6,cs:6,walkableClimb:5,walkableHeight:1,walkableRadius:0,zones:"all",objects:[],helperVisible:!0,destinationHelperRadius:0,destinationHelperColor:Gt.fromHexAndA(3728051,1)}}))(nf||(nf={}));function rS(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={...pa(vi(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={...vi(t),near:Math.max(t.near,0),far:Math.max(t.far,0)};Object.assign(t,i)}})}function In(e,t){Object.values(e.shared.materials).forEach(i=>t(i))}function On(e,t){e.scene.objects.traverse((i,r)=>{"materials"in r?r.materials.forEach((s,a)=>{s===void 0&&(r.materials[a]=Zi.defaultData(),s=r.materials[a]),typeof s!="string"&&t(s)}):"material"in r?typeof r.material!="string"&&(r.material===void 0&&(r.material=Zi.defaultData()),t(r.material)):r.type==="Mesh"&&(r.material===void 0&&(r.material=Zi.defaultData()),t(r.material)),"overrides"in r&&Object.values(r.overrides).forEach(s=>{s.material&&typeof s.material!="string"&&Object.getPrototypeOf(s.material)!==Ti.prototype&&t(s.material)})})}function f6(e){Object.assign(e.scene.publish,{orbitControls:{...sf.defaultData,...vi(e.scene.publish.orbitControls)}})}function m6(e){Object.assign(e.scene.publish.settings,{video:{...Un.defaultData.settings.video,...vi(e.scene.publish.settings.video)}})}function g6(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((ME.includes(s)||typeof a=="boolean")&&delete r[s],s==="texture")for(let[n,o]of Object.entries(a))(p6.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 v6(e){e.scene.publish.withBackground=!0}function y6(e){e.scene.publish.settings.web={compress:!0,preload:!0,preset:1,logo:!0,hint:!1}}function x6(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 b6(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 w6(e){e.scene.objects.traverse((t,i)=>{let r=e.scene.objects.unproxy().parent(t);if(r){let s=vi(e.scene.objects.data(r));s&&s.type==="Mesh"&&s.geometry.type==="BooleanGeometry"&&i.type==="Mesh"&&(i.visible=vi(i).booleanExclude!==!0)}})}function S6(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 _6(e){function t(r){Object.setPrototypeOf(r,Ti.prototype),r.texture&&Object.setPrototypeOf(r.texture,Ti.prototype)}function i(r){Object.setPrototypeOf(r,Ti.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=vi(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=vi(l).layers;i(h),l.layers=h}})})}function sS(e){e.layers===void 0&&Object.assign(e,Zi.defaultTwoLayerData("lambert"))}function eg(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={...vi(t),colors:i,steps:r};Object.assign(t,s)}})}function A6(e){e.scene.objects.traverse((t,i)=>{i.type==="Mesh"&&(i.geometry.type==="BooleanGeometry"||i.geometry.type==="SubdivGeometry")&&(i.geometry.phongAngle=35)})}function aS(e){e.scene.objects.traverse((t,i)=>{"materials"in i?i.materials.forEach(r=>{typeof r!="string"&&eg(r)}):"material"in i&&typeof i.material!="string"&&eg(i.material)}),Object.values(e.shared.materials).forEach(t=>eg(t))}function M6(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 E6(e){e.shared.audios=ms({},Je.prototype)}function C6(e){e.shared.videos=ms({},Je.prototype)}function T6(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 P6(e){Object.entries(vi(e.shared.images)).filter(t=>t[1].asset===!1).map(t=>t[0]).forEach(t=>{delete e.shared.images[t]}),Object.entries(vi(e.shared.audios)).filter(t=>t[1].asset===!1).map(t=>t[0]).forEach(t=>{delete e.shared.audios[t]})}function D6(e){e.scene.publish.settings.web.preload=!1}function nS(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 oS(e){e.layers&&e.layers.forEach(t=>{u6(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 I6(e){e.shared.fonts=ms({},Je.prototype)}function O6(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 R6(e){let t=[];e.scene.objects.traverse((i,r)=>{let s=r;if(s.type==="TextFrame"){let a=Zi.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=O6(s.font);e.shared.fonts[o]===void 0&&(e.shared.fonts[o]={name:o});let l={name:s.name,...ki.defaultData,...Dn.defaultData,flatShading:!1,wireframe:!1,geometry:{...Pn.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:vi(s.states),events:vi(s.events),visible:s.visible,raycastLock:s.raycastLock,position:s.position,rotation:s.rotation,scale:s.scale,hiddenMatrix:s.hiddenMatrix},h=vi(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 L6(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 He,move:new He,jump:new He}});else{let a=new He;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:Oe.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,pa(n,"mass","stiffness","damping","velocity")):n.easing===5&&Object.assign(c,{control1:{...n.control1},control2:{...n.control2}});let d={repeat:n.repeat?-1:0,delay:n.delay,delayDirection:n.delayDirection,direction:n.cycle&&n.rewind?"pingpong-rewind":n.cycle?"pingpong":"normal"},u={state:n.state,...d,...c},p={allowSlerp:!0,type:"Transition",object:n.object,repeat:0,delay:0,delayDirection:void 0,direction:"normal",tweens:new He({fi:0,id:Oe.generateUUID(),data:h},{fi:1,id:Oe.generateUUID(),data:u})};a.push({fi:l,id:o,data:p})}),delete s.targets)}})})}function B6(e){e.scene.objects.traverse((t,i)=>{function r(s,a){var l;let n=new He,o=[];if(i.events.forEach((h,c,d)=>{if(h.type==="Audio"&&h.trigger===a){let u;o.push(c),h.interaction==="play"?u={...pa(h,"interaction","audio","delay","volume","loop"),triggerAfter:"after"in h?h.after:void 0,toggle:"after"in h?h.toggle:void 0,type:"Audio"}:(h.interaction==="pause"||h.interaction==="stop")&&(u={...pa(h,"interaction","delay","object","playAudio"),type:"Audio"}),u&&n.push({fi:d,id:c,data:u})}}),o.forEach(h=>i.events.delete(h)),n.length){let h=(l=i.events.find(c=>c.type===s))==null?void 0:l.data;h?"actions"in h&&h.actions.insertBefore(null,n):i.events.insertBefore(null,[{id:Oe.generateUUID(),data:{type:s,actions:n}}])}}r("Start","start"),r("MouseDown","mouseDown"),r("MouseUp","mouseUp"),r("KeyDown","keyDown"),r("KeyUp","keyUp")})}function lS(e){var i;let t=(i=e.layers.find(r=>r.type==="light"))==null?void 0:i.data;if((t==null?void 0:t.category)==="basic"){let r=qi.defaultData("light","phong"),s=t;Object.assign(s,r),s.visible=!1}}function hS(e){In(e,lS),On(e,lS)}function z6(e){e.scene.objects.traverse((t,i)=>{i.type==="Mesh"&&i.geometry.type==="SubdivGeometry"&&(i.geometry.scaleBaked||(i.geometry.scaleBaked=[1,1,1]))})}function F6(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 k6(e){e.scene.objects.traverse((t,i)=>{i.type==="Mesh"&&i.geometry.type==="NonParametricGeometry"&&!("material"in i)&&!("materials"in i)&&(i.material=Zi.defaultTwoLayerData("phong"))})}function U6(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 N6(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 V6(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 j6(e){let{video:t}=e.scene.publish.settings;t.format==="gif"&&t.fps>48&&(t.fps=15)}function G6(e){e.scene.objects.traverse((t,i)=>{i.events.forEach(r=>{r.type==="GameControl"&&(r.resetYPosition=Math.abs(r.resetYPosition-i.position[1]))})})}function H6(e){let t=e.scene.environment.usePhysics;e.scene.objects.traverse((i,r)=>{t&&r.physics===null?r.collision=!1:r.collision="visibility"})}function W6(e){e.scene.objects.traverse((t,i)=>{i.events.forEach(r=>{r.type==="GameControl"&&(r.navmesh=nf.defaultDataThirdPerson.navmesh)})})}function q6(e){e.scene.styles||(e.scene.styles=To.defaultData())}function cS(e){e.layers.forEach(t=>{t.type==="light"&&t.category!=="toon"&&t.occlusion===void 0&&(t.occlusion=!0)})}function X6(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}),On(e,cS),In(e,cS)}function Y6(e){e.scene.objects.traverse((t,i)=>{i.events.forEach(r=>{r.type==="GameControl"&&Object.assign(r.gameActions,{run:new He})})})}function Q6(e){e.scene.objects.traverse((t,i)=>{i.events.forEach(r=>{r.type==="GameControl"&&(r.keyAssignments=[...r.keyAssignments,["run","⇧"],["none","Ctrl"]])})})}function dS(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.bumpMapIntensity===void 0&&(t.bumpMapIntensity=5)})}function Z6(e,t){if(t<1&&(On(e,rS),In(e,rS),e.schema=1),t<2&&(f6(e),e.schema=2),t<3&&(g6(e),e.schema=3),t<4&&(v6(e),e.schema=4),t<5&&(y6(e),e.schema=5),t<6&&(x6(e),e.schema=6),t<7&&(b6(e),e.schema=7),t<8&&(e.schema=8),t<9&&(aS(e),e.schema=9),t<10&&(A6(e),e.schema=10),t<11&&(M6(e),e.schema=11),t<12&&(aS(e),e.schema=12),t<13&&(E6(e),e.schema=13),t<14&&(T6(e),e.schema=14),t<15&&(P6(e),e.schema=15),t<16&&(D6(e),e.schema=16),t<17&&(On(e,nS),In(e,nS),e.schema=17),t<18&&(On(e,sS),In(e,sS),e.schema=18),t<19&&(m6(e),e.schema=19),t<20&&(I6(e),R6(e),e.schema=20),t<21&&(L6(e),B6(e),e.schema=21),t<22&&(hS(e),e.schema=22),t<23&&(z6(e),e.schema=23),t<24&&(F6(e),e.schema=24),(t<25||e.shared.videos===void 0)&&(C6(e),t<25&&(e.schema=25)),t<26&&(w6(e),e.schema=26),t<27&&(S6(e),e.schema=27),t<28&&(hS(e),e.schema=28),t<29&&(_6(e),e.schema=29),t<30&&(k6(e),e.schema=30),t<31&&(U6(e),e.schema=31),t<33&&(N6(e),e.schema=33),t<34&&(V6(e),e.schema=34),t<35&&(j6(e),e.schema=35),t<36&&(G6(e),e.schema=36),t<37&&(H6(e),e.schema=37),t<38&&(On(e,oS),In(e,oS),e.schema=38),t<39&&(W6(e),e.schema=39),t<40&&(q6(e),e.schema=40),t<41&&(X6(e),e.schema=41),t<42&&(Y6(e),e.schema=42),t<43&&(Q6(e),e.schema=43),t<99){On(e,dS),In(e,dS),e.scene.publish.playCamera===null&&(e.scene.publish.playCamera=Fh);let i=vi(e.scene.objects),r=e.scene.objects;e.scene.publish.playPage=Lc,r.insertBefore(null,null,[{id:Lc,data:{...wh.defaultData,backgroundColor:e.scene.backgroundColor,fog:e.scene.fog,postprocessing:e.scene.postprocessing,ao:pa(e.scene.environment.ambientLight,"occlusion","aoFullRes","radius","bias","aoColor"),publish:{playCamera:e.scene.publish.playCamera,gameControlObject:e.scene.publish.gameControlObject},shadow:pa(e.scene.environment.ambientLight,"softShadowQuality"),globalPhysics:{...xh.defaultData,...pa(e.scene.environment,"usePhysics","gravity")},camera:vi(e.scene.ownerCamera)??wh.defaultData.camera,name:"Scene"},children:[]}]);for(let n of i)n.id!==Po.TRASH_CAN_ID&&r.move(Lc,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,yh.defaultData)),o.physics!==void 0&&o.physics!==null&&(o.physics.enabled=o.collision??"visibility",delete o.collision)}),e.schema=99}}function uS(e){e.layers&&e.layers.forEach(t=>{t.type==="light"&&t.alphaOverride===void 0&&(t.alphaOverride=1)})}function K6(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 J6(e){var t;Array.isArray(vi(e.events))&&((t=e.events)==null||t.forEach(i=>{"disabled"in i||(i.disabled=!1),(i.type==="MouseDown"||i.type==="MouseUp"||i.type==="MousePress")&&(i.mode=i.mode||"Object")}))}var kl=180/Math.PI;function pS(e){e.rotation=e.rotation.slice(0,3).map(t=>t*kl)}function PE(e){var i,r;pS(e),e.type==="Page"&&pS(e.camera),(i=e.states)==null||i.forEach(s=>{s.rotation===void 0||s.rotation===null||(s.rotation=s.rotation.slice(0,3).map(a=>a*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(vi(e.events))&&((r=e.events)==null||r.forEach(s=>{(s.type==="MouseDown"||s.type==="MouseUp"||s.type==="MousePress"||s.type==="KeyDown"||s.type==="KeyUp"||s.type==="KeyPress"||s.type==="Collision"||s.type==="Trigger")&&(s.runMode=s.toggle?"Toggle":"Repeat")}))}function $6(e){e.shared.variables=ms({},Je.prototype)}function eG(e){let t=vi(e.shared.variables);e.shared.variables=ms(Object.entries(t??{}).map(([i,r],s)=>({fi:s,id:i,data:r})),He.prototype)}var ja=115;function DE(e,t){t(e.data);for(let i of e.children)DE(i,t)}function tG(e){let t=e.schema??104;t!==ja&&t<105&&(DE(e.asset,PE),e.schema=105)}function iG(e){e.shared.particles=ms({},Je.prototype),e.shared.lib&&(e.shared.lib.particles=nn.defaultData().particles)}function rG(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 sG(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 aG(e){e.scene.objects.traverse((t,i)=>{var r;Array.isArray(vi(i.events))!==!1&&((r=i.events)==null||r.forEach(s=>{var n,o,l,h,c,d,u,p,f,g,m;let a=s.runMode;s.type==="MouseDown"||s.type==="MouseUp"||s.type==="KeyDown"||s.type==="KeyUp"||s.type==="Collision"||s.type==="Trigger"?(n=s.actions)==null||n.forEac
3140h(v=>{v.type==="Transition"&&(v.runMode=a??"Repeat"),(v.type==="Animation"||v.type==="SwitchCamera")&&(v.runMode=a==="Toggle"?"Toggle":"Normal")}):s.type==="MouseHover"||s.type==="MousePress"||s.type==="KeyPress"?(o=s.actions)==null||o.forEach(v=>{(v.type==="Transition"||v.type==="Animation"||v.type==="SwitchCamera")&&(v.runMode="Toggle")}):s.type==="GameControl"?(delete s.actions,Object.keys(s.gameActions).forEach(v=>{var y;(y=s.gameActions[v])==null||y.forEach(x=>{x.type==="Transition"&&(x.runMode="Repeat"),x.type==="Animation"&&(x.runMode="Normal")})})):s.type==="DragDrop"?(delete s.actions,(h=(l=s.dragDropActions)==null?void 0:l.drag)==null||h.forEach(v=>{(v.type==="Transition"||v.type==="Animation"||v.type==="SwitchCamera")&&(v.runMode="Toggle")}),(d=(c=s.dragDropActions)==null?void 0:c.drop)==null||d.forEach(v=>{(v.type==="Transition"||v.type==="Animation"||v.type==="SwitchCamera")&&(v.runMode="Toggle")})):s.type==="Resize"?(delete s.actions,(u=s.breakpoints)==null||u.forEach(v=>{var y;(y=v.actions)==null||y.forEach(x=>{(x.type==="Transition"||x.type==="Animation"||x.type==="SwitchCamera")&&(x.runMode="Toggle")})})):s.type==="Start"?(p=s.actions)==null||p.forEach(v=>{v.type==="Transition"&&(v.runMode="Once"),(v.type==="Animation"||v.type==="SwitchCamera")&&(v.runMode="Normal")}):s.type==="VariableChange"||s.type==="Scroll"?(f=s.actions)==null||f.forEach(v=>{v.type==="Transition"&&(v.runMode="Repeat"),(v.type==="Animation"||v.type==="SwitchCamera")&&(v.runMode="Normal")}):s.type==="Conditional"&&(delete s.actions,(g=s.inActions)==null||g.forEach(v=>{v.type==="Transition"&&(v.runMode="Repeat"),(v.type==="Animation"||v.type==="SwitchCamera")&&(v.runMode="Normal")}),(m=s.outActions)==null||m.forEach(v=>{v.type==="Transition"&&(v.runMode="Repeat"),(v.type==="Animation"||v.type==="SwitchCamera")&&(v.runMode="Normal")}))}))})}function nG(e){e.shared.userAPIs=ms({},Je.prototype),e.shared.userWebhooks=ms({},Je.prototype),e.shared.lib&&(e.shared.lib.userAPIs=nn.defaultData().userAPIs,e.shared.lib.userWebhooks=nn.defaultData().userWebhooks)}function IE(e){let t=e.schema??0;if(t!==ja){console.warn("updating from ",t,"to ",ja),Z6(e,t),t<100&&(e.scene.publish.joystickSizeAndXYOffset===void 0&&(e.scene.publish.joystickSizeAndXYOffset=Un.defaultData.joystickSizeAndXYOffset),e.schema=100),t<101&&(On(e,uS),In(e,uS),e.schema=101),t<102&&(K6(e),e.schema=102),t<104&&(e.shared.catelogs=new Je,e.shared.lib=nn.defaultData(),e.schema=104),t<105&&($6(e),e.scene.objects.traverse((i,r)=>{PE(r)}),e.schema=105);for(let i of Object.values(e.shared.lib.components))tG(i);t<106&&(eG(e),e.schema=106),t<107&&(e.shared.lib.variables=nn.defaultData().variables,e.schema=107),t<109&&(iG(e),e.schema=109),t<110&&(rG(e),e.schema=110),t<111&&(e.scene.objects.traverse((i,r)=>{J6(r)}),e.schema=111),t<112&&(sG(e),e.schema=112),t<113&&(aG(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&&(nG(e),e.schema=115)}}var of;(e=>{e.defaultData={schema:ja,scene:Po.defaultData,frames:new Je().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",Bc.defaultData),shared:{...os.emptyData(),colors:os.defaultColors()}},e.emptyDataForImports=function(){let a=Po.emptyDataWithPage();return{schema:ja,scene:a,frames:new Je().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",Bc.defaultData),shared:{...os.emptyData(),colors:os.defaultColors(),images:os.defaultImages()}}},e.emptyData=function(){return{schema:ja,scene:Po.emptyDataWithPage(),frames:new Je().add("72fc2993-2da3-4b6b-96ac-2879db3a28bd",Bc.defaultData),shared:os.emptyData()}},e.clipboard2dData=function(){return{schema:ja,scene:Po.emptyData(),frames:new Je,shared:os.emptyData()}},e.collabHelper={...Bv,updateSchema(a){return(a.schema??0)<ja?rd(a,IE):(a.schema??0)-ja}};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:nn.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}}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})(of||(of={}));var m0;(e=>e.emptyImage={data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=",name:"empty"})(m0||(m0={}));var fS;(e=>{function t(i){return!0}e.is=t})(fS||(fS={}));var lf;(e=>{e.defaultData={position:[0,0],scale:[1,1],rotation:0,shear:[0,0]};function t(r,s){return{position:(s==null?void 0:s.position)??r.position,rotation:(s==null?void 0:s.rotation)??r.rotation,scale:(s==null?void 0:s.scale)??r.scale,shear:(s==null?void 0:s.shear)??r.shear}}e.merge=t;function i(r,s){return H2({position:Ja.isEqual(r.position,s.position)?void 0:s.position,rotation:r.rotation===s.rotation?void 0:s.rotation,scale:Ja.isEqual(r.scale,s.scale)?void 0:s.scale,shear:r.shear&&s.shear&&Ja.isEqual(r.shear,s.shear)?void 0:s.shear})}e.diff=i})(lf||(lf={}));var g0;(e=>e.defaultData={horizontalConstraint:0,verticalConstraint:0})(g0||(g0={}));var mS;(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}
vendor: 4,249 bytes, line 3140
3140)(mS||(mS={}));var hf;(e=>e.defaultData={opacity:1,fill:{color:Gt.fromHexAndA(Zr,1),enabled:!0},stroke:{color:Gt.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:Gt.from0to1([0,0,0,1]),enabled:!1,spread:0},innerShadow:{offset:[10,10],blurRadius:10,color:Gt.from0to1([0,0,0,1]),enabled:!1,spread:0}})(hf||(hf={}));var Do;(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,lf.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,d]of Object.entries(o))c!=="name"&&(l===void 0&&(l={path:[],props:{},type:0},h.push(l)),l.props[c]=d);return h}e.toOps=a})(Do||(Do={}));var nd;(e=>e.defaultData={...lf.defaultData,...g0.defaultData,states:new He,events:new He,visible:!0,raycastLock:!1})(nd||(nd={}));var Sh;(e=>e.defaultData={...nd.defaultData,...hf.defaultData})(Sh||(Sh={}));var cf;(e=>e.defaultData={cornerRadius:[0,0,0,0]})(cf||(cf={}));var v0;(e=>e.defaultData={...Sh.defaultData,type:"ellipse2d",width:100,height:100,name:"Ellipse"})(v0||(v0={}));var od;(e=>e.defaultData={...Sh.defaultData,...cf.defaultData,type:"rectangle2d",width:100,height:100,name:"Rectangle"})(od||(od={}));var y0;(e=>e.defaultData={...Sh.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"})(y0||(y0={}));var x0;(e=>e.defaultData={...Sh.defaultData,type:"path2d",path:"",name:"Path"})(x0||(x0={}));var gS;(e=>{function t(i){return i.type==="ellipse2d"||i.type==="rectangle2d"||i.type==="text2d"||i.type==="vector2d"||i.type==="path2d"}e.is=t})(gS||(gS={}));var df;(e=>e.defaultData={...nd.defaultData,name:"Group",type:"group2d"})(df||(df={}));var b0;(e=>e.defaultData=()=>({...nd.defaultData,...cf.defaultData,...hf.defaultData,name:"Frame",type:"frame2d",clipped:!0,width:200,height:200,fill:{color:Gt.fromHexAndA(4737101,1),enabled:!0},stroke:{color:Gt.fromHexAndA(0,1),thickness:1,enabled:!1,mode:"inside"},backgroundBlur:{radius:2,enabled:!1},layerBlur:{radius:2,enabled:!1}}))(b0||(b0={}));var Uo;(e=>{function t(n){switch(n){case"rectangle2d":return{...od.defaultData};case"ellipse2d":return{...v0.defaultData};case"text2d":return{...y0.defaultData};case"vector2d":return{...od.defaultData};case"path2d":return{...x0.defaultData};case"frame2d":return{...b0.defaultData()};case"group2d":return{...df.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})(Uo||(Uo={}));var w0;(e=>(e.defaultData={name:"UI",type:"scene2d",objects:new lr},e.emptyData=function(){return{type:"scene2d",objects:new lr}}))(w0||(w0={}));function Io(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={}
3140,o=e[0].morphTargetsRelative,l=new je,h=0;for(let c=0;c<e.length;++c){let d=e[c],u=0;if(i!==(d.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 d.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;a[p]===void 0&&(a[p]=[]),a[p].push(d.attributes[p]),u++}if(u!==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!==d.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 d.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(d.morphAttributes[p])}if(t){let p;if(i)p=d.index.count;else if(d.attributes.position!==void 0)p=d.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,d=[];for(let u=0;u<e.length;++u){let p=e[u].index;for(let f=0;f<p.count;++f)d.push(p.getX(f)+c);c+=e[u].attributes.position.count}l.setIndex(d)}for(let c in a){let d=vS(a[c]);if(!d)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+c+" attribute."),null;l.setAttribute(c,d)}for(let c in n){let d=n[c][0].length;if(d===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[c]=[];for(let u=0;u<d;++u){let p=[];for(let g=0;g<n[c].length;++g)p.push(n[c][g][u]);let f=vS(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 vS(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 et(a,i,r)}var oG=Math.pow(2,-24),gu=class{constructor(){}};function ha(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 yS(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 xS(e,t){t.set(e)}function bS(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 vu(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 tc(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 lG(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 et(s,1));for(let a=0;a<i;a++)s[a]=a}}function hG(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 tg(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,d=1/0,u=1/0,p=1/0,f=-1/0,g=-1/0,m=-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,A=w+S;b<a&&(a=b),A>l&&(l=A),v&&w<d&&(d=w),v&&w>f&&(f=w);let _=e[y+2],E=e[y+3],C=_-E,T=_+E;C<n&&(n=C),T>h&&(h=T),v&&_<u&&(u=_),v&&_>g&&(g=_);let P=e[y+4],O=e[y+5],D=P-O,k=P+O;D<o&&(o=D),k>c&&(c=k),v&&P<p&&(p=P),v&&P>m&&(m=P)}r[0]=a,r[1]=n,r[2]=o,r[3]=l,r[4]=h,r[5]=c,v&&(s[0]=d,s[1]=u,s[2]=p,s[3]=f,s[4]=g,s[5]=m)}function cG(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,d=(t+i)*6;c<d;c+=6){let u=e[c+0];u<s&&(s=u),u>o&&(o=u);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 dG(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 d=t[a*6+h*2+0];t[a*6+h*2+0]=t[n*6+h*2+0],t[n*6+h*2+0]=d;let u=t[a*6+h*2+1];t[a*6+h*2+1]=t[n*6+h*2+1],t[n*6+h*2+1]=u}a++,n--}else return a}}var Fa=32,uG=(e,t)=>e.candidate-t.candidate,vn=new Array(Fa).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),yu=new Float32Array(6);function pG(e,t,i,r,s,a){let n=-1,o=0;if(a===0)n=yS(t),n!==-1&&(o=(t[n]+t[n+3])/2);else if(a===1)n=yS(e),n!==-1&&(o=fG(i,r,s,n));else if(a===2){let l=tc(e),h=1.25*s,c=r*6,d=(r+s)*6;for(let u=0;u<3;u++){let p=t[u],f=(t[u+3]-p)/Fa;if(s<Fa/4){let g=[...vn];g.length=s;let m=0;for(let y=c;y<d;y+=6,m++){let x=g[m];x.candidate=i[y+2*u],x.count=0;
vendor: 7,316 bytes, line 3140
3140let{bounds:w,leftCacheBounds:S,rightCacheBounds:b}=x;for(let A=0;A<3;A++)b[A]=1/0,b[A+3]=-1/0,S[A]=1/0,S[A+3]=-1/0,w[A]=1/0,w[A+3]=-1/0;vu(y,i,w)}g.sort(uG);let v=s;for(let y=0;y<v;y++){let x=g[y];for(;y+1<v&&g[y+1].candidate===x.candidate;)g.splice(y+1,1),v--}for(let y=c;y<d;y+=6){let x=i[y+2*u];for(let w=0;w<v;w++){let S=g[w];x>=S.candidate?vu(y,i,S.rightCacheBounds):(vu(y,i,S.leftCacheBounds),S.count++)}}for(let y=0;y<v;y++){let x=g[y],w=x.count,S=s-x.count,b=x.leftCacheBounds,A=x.rightCacheBounds,_=0;w!==0&&(_=tc(b)/l);let E=0;S!==0&&(E=tc(A)/l);let C=1+1.25*(_*w+E*S);C<h&&(n=u,h=C,o=x.candidate)}}else{for(let v=0;v<Fa;v++){let y=vn[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<d;v+=6){let y=~~((i[v+2*u]-p)/f);y>=Fa&&(y=Fa-1);let x=vn[y];x.count++,vu(v,i,x.bounds)}let g=vn[Fa-1];xS(g.bounds,g.rightCacheBounds);for(let v=Fa-2;v>=0;v--){let y=vn[v],x=vn[v+1];bS(y.bounds,x.rightCacheBounds,y.rightCacheBounds)}let m=0;for(let v=0;v<Fa-1;v++){let y=vn[v],x=y.count,w=y.bounds,S=vn[v+1].rightCacheBounds;x!==0&&(m===0?xS(w,yu):bS(w,yu,yu)),m+=x;let b=0,A=0;m!==0&&(b=tc(yu)/l);let _=s-m;_!==0&&(A=tc(S)/l);let E=1+1.25*(b*m+A*_);E<h&&(n=u,h=E,o=y.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${a} used.`);return{axis:n,pos:o}}function fG(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 mG(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 d=0;d<s;d++){let u=d*3,p=d*6,f,g,m;n?(f=r[u+0],g=r[u+1],m=r[u+2]):(f=r[u+0]*h+l,g=r[u+1]*h+l,m=r[u+2]*h+l);for(let v=0;v<3;v++){let y,x,w;n?(y=i[c[v]](f),x=i[c[v]](g),w=i[c[v]](m)):(y=o[f+v],x=o[g+v],w=o[m+v]);let S=y;x<S&&(S=x),w<S&&(S=w);let b=y;x>b&&(b=x),w>b&&(b=w);let A=(b-S)/2,_=v*2;a[p+_+0]=S+A,a[p+_+1]=A+(Math.abs(S)+A)*oG,S<t[v]&&(t[v]=S),b>t[v+3]&&(t[v+3]=b)}}return a}function gG(e,t){function i(v){u&&u(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=pG(v.boundingData,w,n,y,x,d);if(b.axis===-1)return i(y+x),v.offset=y,v.count=x,v;let A=dG(o,n,y,x,b);if(A===y||A===y+x)i(y+x),v.offset=y,v.count=x;else{v.splitAxis=b.axis;let _=new gu,E=y,C=A-y;v.left=_,_.boundingData=new Float32Array(6),tg(n,E,C,_.boundingData,a),r(_,E,C,a,S+1);let T=new gu,P=A,O=x-C;v.right=T,T.boundingData=new Float32Array(6),tg(n,P,O,T.boundingData,a),r(T,P,O,a,S+1)}return v}lG(e,t);let s=new Float32Array(6),a=new Float32Array(6),n=mG(e,s),o=e.index.array,l=t.maxDepth,h=t.verbose,c=t.maxLeafTris,d=t.strategy,u=t.onProgress,p=e.index.count/3,f=!1,g=[],m=hG(e);if(m.length===1){let v=m[0],y=new gu;y.boundingData=s,cG(n,v.offset,v.count,a),r(y,v.offset,v.count,a),g.push(y)}else for(let v of m){let y=new gu;y.boundingData=new Float32Array(6),tg(n,v.offset,v.count,y.boundingData,a),r(y,v.offset,v.count,a),g.push(y)}return g}function vG(e,t){let i=gG(e,t),r,s,a,n=[],o=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let c=0;c<i.length;c++){let d=i[c],u=l(d),p=new o(32*u);r=new Float32Array(p),s=new Uint32Array(p),a=new Uint16Array(p),h(0,d),n.push(p)}return n;function l(c){return c.count?1:1+l(c.left)+l(c.right)}function h(c,d){let u=c/4,p=c/2,f=!!d.count,g=d.boundingData;for(let m=0;m<6;m++)r[u+m]=g[m];if(f){let m=d.offset,v=d.count;return s[u+6]=m,a[p+14]=v,a[p+15]=65535,c+32}else{let m=d.left,v=d.right,y=d.splitAxis,x;if(x=h(c+32,m),x/4>Math.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return s[u+6]=x/4,x=h(x,v),s[u+7]=y,x}}}var on=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}};on.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 yG=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),d=h.dot(o),u=h.dot(h),p=i.dot(o),f=o.dot(o)*u-d*d,g,m;f!==0?g=(c*d-p*u)/f:g=0,m=(c+g*d)/u,a.x=g,a.y=m}}(),n1=function(){let e=new j,t=new M,i=new M;return function(r,s,a,n){yG(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 d=t,u=i;if(r.closestPointToPoint(c,!0,t),s.closestPointToPoint(h,!0,i),d.distanceToSquared(c)<=u.distanceToSquared(h)){a.copy(d),n.copy(c);return}else{a.copy(h),n.copy(u);return}}}}(),xG=function(){let e=new M,t=new M,i=new Fr,r=new us;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 d=a.getPlane(i);if(Math.abs(d.distanceToPoint(o))<=n){let u=d.projectPoint(o,t);if(a.containsPoint(u))return!0}return!1}}(),bG=1e-15;function yl(e){return Math.abs(e)<bG}var ln=class extends or{constructor(...e){super(...e),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new M),this.satBounds=new Array(4).fill().map(()=>new on),this.points=[this.a,this.b,this.c],this.sphere=new Hr,this.plane=new Fr,this.needsUpdate=!0}intersectsSphere(e){return xG(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],d=a[2];c.subVectors(t,i),d.setFromPoints(c,r);let u=s[3],p=a[3];u.subVectors(i,e),p.setFromPoints(u,r),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(n,e),this.needsUpdate=!1}};ln.prototype.closestPointToSegment=function(){let e=new M,t=new M,i=new us;return function(r,s=null,a=null){let{start:n,end:o}=r,l=this.points,h,c=1/0;for(let d=0;d<3;d++){let u=(d+1)%3;i.start.copy(l[d]),i.end.copy(l[u]),n1(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)}}();ln.prototype.intersectsTriangle=function(){let e=new ln,t=new Array(3),i=new Array(3),r=new on,s=new on,a=new M,n=new M,o=new M,l=new M,h=new us,c=new us,d=new us;return function(u,p=null,f=!1){this.needsUpdate&&this.update(),u.isExtendedTriangle?u.needsUpdate&&u.update(
3140):(e.copy(u),e.update(),u=e);let g=this.plane,m=u.plane;if(Math.abs(g.normal.dot(m.normal))>1-1e-10){let v=this.satBounds,y=this.satAxes;i[0]=u.a,i[1]=u.b,i[2]=u.c;for(let S=0;S<4;S++){let b=v[S],A=y[S];if(r.setFromPoints(A,i),b.isSeparated(r))return!1}let x=u.satBounds,w=u.satAxes;t[0]=this.a,t[1]=this.b,t[2]=this.c;for(let S=0;S<4;S++){let b=x[S],A=w[S];if(r.setFromPoints(A,t),b.isSeparated(r))return!1}for(let S=0;S<4;S++){let b=y[S];for(let A=0;A<4;A++){let _=w[A];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 O=0;O<3;O++){let D=v[O],k=v[(O+1)%3];h.start.copy(D),h.end.copy(k),h.delta(n);let W=y?c.start:c.end,N=yl(m.distanceToPoint(D));if(yl(m.normal.dot(n))&&N){c.copy(h),x=2;break}if((m.intersectLine(h,W)||N)&&!yl(W.distanceTo(k))){if(x++,y)break;y=!0}}if(x===1&&u.containsPoint(c.end))return p&&(p.start.copy(c.end),p.end.copy(c.end)),!0;if(x!==2)return!1;let w=u.points,S=!1,b=0;for(let O=0;O<3;O++){let D=w[O],k=w[(O+1)%3];h.start.copy(D),h.end.copy(k),h.delta(o);let W=S?d.start:d.end,N=yl(g.distanceToPoint(D));if(yl(g.normal.dot(o))&&N){d.copy(h),b=2;break}if((g.intersectLine(h,W)||N)&&!yl(W.distanceTo(k))){if(b++,S)break;S=!0}}if(b===1&&this.containsPoint(d.end))return p&&(p.start.copy(d.end),p.end.copy(d.end)),!0;if(b!==2)return!1;if(c.delta(n),d.delta(o),n.dot(o)<0){let O=d.start;d.start=d.end,d.end=O}let A=c.start.dot(n),_=c.end.dot(n),E=d.start.dot(n),C=d.end.dot(n),T=_<E,P=A<C;return A!==C&&E!==_&&T===P?!1:(p&&(l.subVectors(c.start,d.start),l.dot(n)>0?p.start.copy(c.start):p.start.copy(d.start),l.subVectors(c.end,d.end),l.dot(n)<0?p.end.copy(c.end):p.end.copy(d.end)),!0)}}}();ln.prototype.distanceToPoint=function(){let e=new M;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}}();ln.prototype.distanceToTriangle=function(){let e=new M,t=new M,i=["a","b","c"],r=new us,s=new us;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 d,u=i[c],p=a[u];this.closestPointToPoint(p,e),d=p.distanceToSquared(e),d<h&&(h=d,n&&n.copy(e),o&&o.copy(p));let f=this[u];a.closestPointToPoint(f,e),d=f.distanceToSquared(e),d<h&&(h=d,n&&n.copy(f),o&&o.copy(e))}for(let c=0;c<3;c++){let d=i[c],u=i[(c+1)%3];r.set(this[d],this[u]);for(let p=0;p<3;p++){let f=i[p],g=i[(p+1)%3];s.set(a[f],a[g]),n1(r,s,e,t);let m=e.distanceToSquared(t);m<h&&(h=m,n&&n.copy(e),o&&o.copy(t))}}return Math.sqrt(h)}}();var ya=class{constructor(e,t,i){this.isOrientedBox=!0,this.min=new M,this.max=new M,this.matrix=new be,this.invMatrix=new be,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 on),this.alignedSatBounds=new Array(3).fill().map(()=>new on),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}};ya.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 d=1*l|2*h|4*c,u=r[d];u.x=l?i.x:t.x,u.y=h?i.y:t.y,u.z=c?i.z:t.z,u.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],d=1<<l,u=r[d];h.subVectors(n,u),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}}();ya.prototype.intersectsBox=function(){let e=new on;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}}();ya.prototype.intersectsTriangle=function(){let e=new ln,t=new Array(3),i=new on,r=new on,s=new M;return function(a){this.needsUpdate&&this.update(),a.isExtendedTriangle?a.needsUpdate&&a.update():(e.copy(a),e.update(
vendor: 1,545 bytes, line 3140
3140),a=e);let n=this.satBounds,o=this.satAxes;t[0]=a.a,t[1]=a.b,t[2]=a.c;for(let d=0;d<3;d++){let u=n[d],p=o[d];if(i.setFromPoints(p,t),u.isSeparated(i))return!1}let l=a.satBounds,h=a.satAxes,c=this.points;for(let d=0;d<3;d++){let u=l[d],p=h[d];if(i.setFromPoints(p,c),u.isSeparated(i))return!1}for(let d=0;d<3;d++){let u=o[d];for(let p=0;p<4;p++){let f=h[p];if(s.crossVectors(u,f),i.setFromPoints(s,t),r.setFromPoints(s,c),i.isSeparated(r))return!1}}return!0}}();ya.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}}();ya.prototype.distanceToPoint=function(){let e=new M;return function(t){return this.closestPointToPoint(t,e),t.distanceTo(e)}}();ya.prototype.distanceToBox=function(){let e=["x","y","z"],t=new Array(12).fill().map(()=>new us),i=new Array(12).fill().map(()=>new us),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,d=a.max,u=this.points,p=1/0;for(let g=0;g<8;g++){let m=u[g];s.copy(m).clamp(c,d);let v=m.distanceToSquared(s);if(v<p&&(p=v,o&&o.copy(m),l&&l.copy(s),v<h))return Math.sqrt(v)}let f=0;for(let g=0;g<3;g++)for(let m=0;m<=1;m++)for(let v=0;v<=1;v++){let y=(g+1)%3,x=(g+2)%3,w=m<<y|v<<x,S=1<<g|m<<y|v<<x,b=u[w],A=u[S];t[f].set(b,A);let _=e[g],E=e[y],C=e[x],T=i[f],P=T.start,O=T.end;
3140P[_]=c[_],P[E]=m?c[E]:d[E],P[C]=v?c[C]:d[E],O[_]=d[_],O[E]=m?c[E]:d[E],O[C]=v?c[C]:d[E],f++}for(let g=0;g<=1;g++)for(let m=0;m<=1;m++)for(let v=0;v<=1;v++){s.x=g?d.x:c.x,s.y=m?d.y:c.y,s.z=v?d.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 g=0;g<12;g++){let m=t[g];for(let v=0;v<12;v++){let y=i[v];n1(m,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 xl=new M,bl=new M,wl=new M,xu=new j,bu=new j,wu=new j,wS=new M,SS=new M,_S=new M,Su=new M;function wG(e,t,i,r,s,a){let n;return a===Ki?n=e.intersectTriangle(r,i,t,!0,s):n=e.intersectTriangle(t,i,r,a!==vr,s),n===null?null:{distance:e.origin.distanceTo(s),point:s.clone()}}function SG(e,t,i,r,s,a,n,o,l){xl.fromBufferAttribute(t,a),bl.fromBufferAttribute(t,n),wl.fromBufferAttribute(t,o);let h=wG(e,xl,bl,wl,Su,l);if(h){r&&(xu.fromBufferAttribute(r,a),bu.fromBufferAttribute(r,n),wu.fromBufferAttribute(r,o),h.uv=or.getInterpolation(Su,xl,bl,wl,xu,bu,wu,new j)),s&&(xu.fromBufferAttribute(s,a),bu.fromBufferAttribute(s,n),wu.fromBufferAttribute(s,o),h.uv1=or.getInterpolation(Su,xl,bl,wl,xu,bu,wu,new j)),i&&(wS.fromBufferAttribute(i,a),SS.fromBufferAttribute(i,n),_S.fromBufferAttribute(i,o),h.normal=or.getInterpolation(Su,xl,bl,wl,wS,SS,_S,new M),h.normal.dot(e.direction)>0&&h.normal.multiplyScalar(-1));let c={a,b:n,c:o,normal:new M,materialIndex:0};or.getNormal(xl,bl,wl,c.normal),h.face=c,h.faceIndex=a}return h}function OE(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:d,uv1:u}=e.attributes,p=SG(i,h,c,d,u,n,o,l,t);return p?(p.faceIndex=r,s&&s.push(p),p):null}function _G(e,t,i,r,s,a){for(let n=r,o=r+s;n<o;n++)OE(e,t,i,n,a)}function AG(e,t,i,r,s){let a=1/0,n=null;for(let o=r,l=r+s;o<l;o++){let h=OE(e,t,i,o);h&&h.distance<a&&(n=h,a=h.distance)}return n}function na(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 AS(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(na(n,h*3,o,l),n.needsUpdate=!0,r(n,h,s,a))return!0;return!1}var RE=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 Rn(e,t){return t[e+15]===65535}function $l(e,t){return t[e+6]}function ld(e,t){return t[e+14]}function hd(e){return e+8}function cd(e,t){return t[e+6]}function MG(e,t){return t[e+7]}var Xl=new xi,uf=new M,EG=["x","y","z"];function S0(e,t,i,r,s){let a=e*2,n=kh,o=qn,l=Xn;if(Rn(a,o)){let h=$l(e,l),c=ld(a,o);_G(t,i,r,h,c,s)}else{let h=hd(e);
3140pf(h,n,r,uf)&&S0(h,t,i,r,s);let c=cd(e,l);pf(c,n,r,uf)&&S0(c,t,i,r,s)}}function _0(e,t,i,r){let s=e*2,a=kh,n=qn,o=Xn;if(Rn(s,n)){let l=$l(e,o),h=ld(s,n);return AG(t,i,r,l,h)}else{let l=MG(e,o),h=EG[l],c=r.direction[h]>=0,d,u;c?(d=hd(e),u=cd(e,o)):(d=cd(e,o),u=hd(e));let p=pf(d,a,r,uf)?_0(d,t,i,r):null;if(p){let g=p.point[h];if(c?g<=a[u+l]:g>=a[u+l+3])return p}let f=pf(u,a,r,uf)?_0(u,t,i,r):null;return p&&f?p.distance<=f.distance?p:f:p||f||null}}var CG=function(){let e,t,i=[],r=new RE(()=>new xi);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,d=0){function u(y){let x=y*2,w=qn,S=Xn;for(;!Rn(x,w);)y=hd(y),x=y*2;return $l(y,S)}function p(y){let x=y*2,w=qn,S=Xn;for(;!Rn(x,w);)y=cd(y,S),x=y*2;return $l(y,S)+ld(x,w)}let f=a*2,g=kh,m=qn,v=Xn;if(Rn(f,m)){let y=$l(a,v),x=ld(f,m);return ha(a,g,e),l(y,x,!1,d,c+a,e)}else{let y=hd(a),x=cd(a,v),w=y,S=x,b,A,_,E;if(h&&(_=e,E=t,ha(w,g,_),ha(S,g,E),b=h(_),A=h(E),A<b)){w=x,S=y;let W=b;b=A,A=W,_=E}_||(_=e,ha(w,g,_));let C=Rn(w*2,m),T=o(_,C,b,d+1,c+w),P;if(T===2){let W=u(w),N=p(w)-W;P=l(W,N,!0,d+1,c+w,_)}else P=T&&s(w,n,o,l,h,c,d+1);if(P)return!0;E=t,ha(S,g,E);let O=Rn(S*2,m),D=o(E,O,A,d+1,c+S),k;if(D===2){let W=u(S),N=p(S)-W;k=l(W,N,!0,d+1,c+S,E)}else k=D&&s(S,n,o,l,h,c,d+1);return!!k}}}(),TG=function(){let e=new ln,t=new ln,i=new be,r=new ya,s=new ya;return function a(n,o,l,h,c=null){let d=n*2,u=kh,p=qn,f=Xn;if(c===null&&(l.boundingBox||l.computeBoundingBox(),r.set(l.boundingBox.min,l.boundingBox.max,h),c=r),Rn(d,p)){let g=o,m=g.index,v=g.attributes.position,y=l.index,x=l.attributes.position,w=$l(n,f),S=ld(d,p);if(i.copy(h).invert(),l.boundsTree)return ha(n,u,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 A=w*3,_=(S+w)*3;A<_;A+=3)if(na(t,A,m,v),t.needsUpdate=!0,b.intersectsTriangle(t))return!0;return!1}});for(let b=w*3,A=S+w*3;b<A;b+=3){na(e,b,m,v),e.a.applyMatrix4(i),e.b.applyMatrix4(i),e.c.applyMatrix4(i),e.needsUpdate=!0;for(let _=0,E=y.count;_<E;_+=3)if(na(t,_,y,x),t.needsUpdate=!0,e.intersectsTriangle(t))return!0}}else{let g=n+8,m=f[n+6];return ha(g,u,Xl),!!(c.intersectsBox(Xl)&&a(g,o,l,h,c)||(ha(m,u,Xl),c.intersectsBox(Xl)&&a(m,o,l,h,c)))}}}();function pf(e,t,i,r){return ha(e,t,Xl),i.intersectBox(Xl,r)}var A0=[],up,kh,qn,Xn;function Sc(e){up&&A0.push(up),up=e,kh=new Float32Array(e),qn=new Uint16Array(e),Xn=new Uint32Array(e)}function _u(){up=null,kh=null,qn=null,Xn=null,A0.length&&Sc(A0.pop())}var ig=Symbol("skip tree generation"),rg=new xi,sg=new xi,Sl=new be,ho=new ya,ic=new ya,rc=new M,Au=new M,PG=new M,DG=new M,IG=new M,MS=new xi,qs=new RE(()=>new ln),zc=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."),zc.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."),zc.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 zc(t,{...i,[ig]:!0});if(a._roots=s,i.setIndex){let n=t.getIndex();if(n===null){let o=new et(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
3140:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[ig]:!1},t),t.useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,t[ig]||(this._roots=vG(e,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new xi))),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 d=0,u=h.length;d<u;d++)s=h[d],a=new Uint32Array(s),n=new Uint16Array(s),o=new Float32Array(s),c(0,l),l+=s.byteLength;function c(d,u,p=!1){let f=d*2;if(n[f+15]===65535){let g=a[d+6],m=n[f+14],v=1/0,y=1/0,x=1/0,w=-1/0,S=-1/0,b=-1/0;for(let A=3*g,_=3*(g+m);A<_;A++){let E=i[A],C=r.getX(E),T=r.getY(E),P=r.getZ(E);C<v&&(v=C),C>w&&(w=C),T<y&&(y=T),T>S&&(S=T),P<x&&(x=P),P>b&&(b=P)}return o[d+0]!==v||o[d+1]!==y||o[d+2]!==x||o[d+3]!==w||o[d+4]!==S||o[d+5]!==b?(o[d+0]=v,o[d+1]=y,o[d+2]=x,o[d+3]=w,o[d+4]=S,o[d+5]=b,!0):!1}else{let g=d+8,m=a[d+6],v=g+u,y=m+u,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,A=x||S,_=!1;b&&(_=c(g,u,x));let E=!1;A&&(E=c(m,u,x));let C=_||E;if(C)for(let T=0;T<3;T++){let P=g+T,O=m+T,D=o[P],k=o[P+3],W=o[O],N=o[O+3];o[d+T]=D<W?D:W,o[d+T+3]=k>N?k:N}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],d=s[l+14];e(o,h,new Float32Array(i,n*4,6),c,d)}else{let c=n+8,d=r[n+6],u=r[n+7];e(o,h,new Float32Array(i,n*4,6),u)||(a(c,o+1),a(d,o+1))}}}raycast(e,t=zs){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 d=n?t[o[h].materialIndex].side:l,u=s.length;if(Sc(i[h]),S0(0,r,d,e,s),_u(),n){let p=o[h].materialIndex;for(let f=u,g=s.length;f<g;f++)s[f].face.materialIndex=p}}return s}raycastFirst(e,t=zs){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 d=a?t[o[h].materialIndex].side:l;Sc(i[h]);let u=_0(0,r,d,e);_u(),u!=null&&(n==null||u.distance<n.distance)&&(n=u,a&&(u.face.materialIndex=o[h].materialIndex))}return n}intersectsGeometry(e,t){let i=this.geometry,r=!1;for(let s of this._roots)if(Sc(s),r=TG(0,i,e,t),_u(),r)break;return r}shapecast(e,t,i){let r=this.geometry;if(e instanceof Function){if(t){let d=t;t=(u,p,f,g)=>{let m=p*3;return d(u,m,m+1,m+2,f,g)}}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=qs.getPrimitive(),{boundsTraverseOrder:a,intersectsBounds:n,intersectsRange:o,intersectsTriangle:l}=e;if(o&&l){let d=o;o=(u,p,f,g,m)=>d(u,p,f,g,m)?!0:AS(u,p,r,l,f,g,s)}else o||(l?o=(d,u,p,f)=>AS(d,u,r,l,p,f,s):o=(d,u,p)=>p);let h=!1,c=0;for(let d of this._roots){if(Sc(d),h=CG(0,r,n,o,a,c),_u(),h)break;c+=d.byteLength}return qs.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;Sl.copy(t).invert();let h=qs.getPrimitive(),c=qs.getPrimitive();if(s){let u=function(p,f,g,m,v,y,x,w){for(let S=g,b=g+m;S<b;S++){na(c,S*3,o,l),c.a.applyMatrix4(t),c.b.applyMatrix4(t),c.c.applyMatrix4(t),c.needsUpdate=!0;for(let A=p,_=p+f;A<_;A++)if(na(h,A*3,a,n),h.needsUpdate=!0,s(h,c,A,S,v,y,x,w))return!0}return!1};if(r){let p=r;r=function(f,g,m,v,y,x,w,S){return p(f,g,m,v,y,x,w,S)?!0:u(f,g,m,v,y,x,w,S)}}else r=u}e.getBoundingBox(sg),sg.applyMatrix4(t);let d=this.shapecast({intersectsBounds:u=>sg.intersectsBox(u),intersectsRange:(u,p,f,g,m,v)=>(rg.copy(v),rg.applyMatrix4(Sl),e.shapecast({intersectsBounds:y=>rg.intersectsBox(y),intersectsRange:(y,x,w,S,b)=>r(u,p,y,x,g,m,S,b)}))});return qs.releasePrimitive(h),qs.releasePrimitive(c),d}intersectsBox(e,t){return ho.set(e.min,e.max,t),ho.needsUpdate=!0,this.shapecast({intersectsBounds:i=>ho.intersectsBox(i),intersectsTriangle:i=>ho.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(),ho.set(e.boundingBox.min,e.boundingBox.max,t),ho.needsUpdate=!0;let n=this.geometry,o=n.attributes.position,l=n.index,h=e.attributes.position,c=e.index,d=qs.getPrimitive(),u=qs.getPrimitive(),p=Au,f=PG,g=null,m=null;r&&(g=DG,m=IG);let v=1/0,y=null,x=null;return Sl.copy(t).invert(),ic.matrix.copy(Sl),this.shapecast({boun
vendor: 5,794 bytes, line 3140
3140dsTraverseOrder:w=>ho.distanceToBox(w),intersectsBounds:(w,S,b)=>b<v&&b<a?(S&&(ic.min.copy(w.min),ic.max.copy(w.max),ic.needsUpdate=!0),!0):!1,intersectsRange:(w,S)=>{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:b=>ic.distanceToBox(b),intersectsBounds:(b,A,_)=>_<v&&_<a,intersectsRange:(b,A)=>{for(let _=b*3,E=(b+A)*3;_<E;_+=3){na(u,_,c,h),u.a.applyMatrix4(t),u.b.applyMatrix4(t),u.c.applyMatrix4(t),u.needsUpdate=!0;for(let C=w*3,T=(w+S)*3;C<T;C+=3){na(d,C,l,o),d.needsUpdate=!0;let P=d.distanceToTriangle(u,p,g);if(P<v&&(f.copy(p),m&&m.copy(g),v=P,y=C/3,x=_/3),P<s)return!0}}}});{let b=c?c.count:h.count;for(let A=0,_=b;A<_;A+=3){na(u,A,c,h),u.a.applyMatrix4(t),u.b.applyMatrix4(t),u.c.applyMatrix4(t),u.needsUpdate=!0;for(let E=w*3,C=(w+S)*3;E<C;E+=3){na(d,E,l,o),d.needsUpdate=!0;let T=d.distanceToTriangle(u,p,g);if(T<v&&(f.copy(p),m&&m.copy(g),v=T,y=E/3,x=A/3),T<s)return!0}}}}}),qs.releasePrimitive(d),qs.releasePrimitive(u),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(m):r.point=m.clone(),r.point.applyMatrix4(Sl),f.applyMatrix4(Sl),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=>(rc.copy(e).clamp(h.min,h.max),rc.distanceToSquared(e)),intersectsBounds:(h,c,d)=>d<n&&d<a,intersectsTriangle:(h,c)=>{h.closestPointToPoint(e,rc);let d=e.distanceToSquared(rc);return d<n&&(Au.copy(rc),n=d,o=c),d<s}}),n===1/0)return null;let l=Math.sqrt(n);return t.point?t.point.copy(Au):t.point=Au.clone(),t.distance=l,t.faceIndex=o,t}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(t=>{ha(0,new Float32Array(t),MS),e.union(MS)}),e}},M0=eo(DP()),OG=.5*(Math.sqrt(3)-1),sc=(3-Math.sqrt(3))/6,RG=1/3,Xs=1/6,Fc=e=>Math.floor(e)|0,ES=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]),ag=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 LG(e=Math.random){let t=LE(e),i=new Float64Array(t).map(s=>ES[s%12*2]),r=new Float64Array(t).map(s=>ES[s%12*2+1]);return function(s,a){let n=0,o=0,l=0,h=(s+a)*OG,c=Fc(s+h),d=Fc(a+h),u=(c+d)*sc,p=c-u,f=d-u,g=s-p,m=a-f,v,y;g>m?(v=1,y=0):(v=0,y=1);let x=g-v+sc,w=m-y+sc,S=g-1+2*sc,b=m-1+2*sc,A=c&255,_=d&255,E=.5-g*g-m*m;if(E>=0){let P=A+t[_],O=i[P],D=r[P];E*=E,n=E*E*(O*g+D*m)}let C=.5-x*x-w*w;if(C>=0){let P=A+v+t[_+y],O=i[P],D=r[P];C*=C,o=C*C*(O*x+D*w)}let T=.5-S*S-b*b;if(T>=0){let P=A+1+t[_+1],O=i[P],D=r[P];T*=T,l=T*T*(O*S+D*b)}return 70*(n+o+l)}}function BG(e=Math.random){let t=LE(e),i=new Float64Array(t).map(a=>ag[a%12*3]),r=new Float64Array(t).map(a=>ag[a%12*3+1]),s=new Float64Array(t).map(a=>ag[a%12*3+2]);return function(a,n,o){let l,h,c,d,u=(a+n+o)*RG,p=Fc(a+u),f=Fc(n+u),g=Fc(o+u),m=(p+f+g)*Xs,v=p-m,y=f-m,x=g-m,w=a-v,S=n-y,b=o-x,A,_,E,C,T,P;w>=S?S>=b?(A=1,_=0,E=0,C=1,T=1,P=0):w>=b?(A=1,_=0,E=0,C=1,T=0,P=1):(A=0,_=0,E=1,C=1,T=0,P=1):S<b?(A=0,_=0,E=1,C=0,T=1,P=1):w<b?(A=0,_=1,E=0,C=0,T=1,P=1):(A=0,_=1,E=0,C=1,T=1,P=0);let O=w-A+Xs,D=S-_+Xs,k=b-E+Xs,W=w-C+2*Xs,N=S-T+2*Xs,F=b-P+2*Xs,Z=w-1+3*Xs,q=S-1+3*Xs,G=b-1+3*Xs,Q=p&255,ee=f&255,Y=g&255,$=.6-w*w-S*S-b*b;if($<0)l=0;else{let te=Q+t[ee+t[Y]];$*=$,l=$*$*(i[te]*w+r[te]*S+s[te]*b)}let H=.6-O*O-D*D-k*k;if(H<0)h=0;else{let te=Q+A+t[ee+_+t[Y+E]];H*=H,h=H*H*(i[te]*O+r[te]*D+s[te]*k)}let le=.6-W*W-N*N-F*F;if(le<0)c=0;else{let te=Q+C+t[ee+T+t[Y+P]];le*=le,c=le*le*(i[te]*W+r[te]*N+s[te]*F)}let re=.6-Z*Z-q*q-G*G;if(re<0)d=0;else{let te=Q+1+t[ee+1+t[Y+1]];re*=re,d=re*re*(i[te]*Z+r[te]*q+s[te]*G)}return 32*(l+h+c+d)}}function LE(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 ws=new or,zG=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;ws.a.fromBufferAttribute(e,r),ws.b.fromBufferAttribute(e,r+1),ws.c.fromBufferAttribute(e,r+2),s*=ws.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),ws.a.fromBufferAttribute(this.positionAttribute,e*3),ws.b.fromBufferAttribute(this.positionAttribute,e*3+1),ws.c.fromBufferAttribute(this.positionAttribute,e*3+2),t.set(0,0,0).addScaledVector(ws.a,r).addScaledVector(ws.b,s).addScaledVector(ws.c,1-(r+s)),ws.getNormal(i),this}},FG=eo(fM()),kG=new be,UG=new be,NG=new be,qo;(e=>{function t(i){return i&&i.__isSPEObject}e.is=t})(qo||(qo={}));var o1=e=>class extends e{constructor(){super(...arguments),this.previousModelViewMatrix=new be,this.copyPreviousMatrix=!0,this.hiddenMatrix=new be,this.matrixWorldRigid=new be,this.shearScale=new be,this.shearScaleInv=new be}get __isSPEObject(){return!0}isDescendantOf(t){t instanceof Ut&&(t=t.uuid);let i=this;for(;i.parent;){if(i.parent.uuid===t)return!0;
3140i=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.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)),i)for(let s of this.children)s.updateWorldMatrix(!1,!0)}traverseChildren(t,i=0){for(let r of this.children)qo.is(r)&&r.traverseObject(t,i+1)}traverseObject(t,i=0){if(t(this,i)!==!0)for(let r of this.children)qo.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,FG.SVD)(i),n=kG.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=UG.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=NG.copy(o).transpose();
vendor: 4,453 bytes, line 3140
3140this.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 be().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),r.multiply(t.parent.matrixWorld)),"hiddenMatrix"in t&&t.hiddenMatrix instanceof be?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)}},VG=class extends o1(Ut){},jG=e=>e.type==="Mesh",cr=class extends VG{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==null?void 0:i.object)!==t&&(i&&this.remove(i),i=new cr(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.expand(),e+=1,t=this.object.entityChildren(e)}for(;this.children.length>e;)this.remove(this.children[e])}get visible(){var e;return this.playModeVisible!==void 0?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&((e=this.object.dataPatched.cloner)==null?void 0:e.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 jG(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}},bo=new M,wo=new M,eh=new be,BE=[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)],GG=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],HG=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],CS=(e,t,i)=>{e.updateEntityBoxSize(bo,wo),eh.copy(t).multiply(e.matrixWorld),wo.x===0&&wo.y===0&&wo.z===0?i.push(new M(bo.x,bo.y,bo.z).applyMatrix4(eh)):BE.forEach(r=>{i.push(r.clone().multiply(wo).add(bo).applyMatrix4(eh))})},TS=class extends xi{constructor(){super(...arguments),this.matrix=new be,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 be().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}CS(s,t,r)}}):CS(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(eh.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(wo).multiplyScalar(.5),this.getCenter(bo),eh.copy(this.matrix).setPosition(bo),this.vertices=BE.map(e=>e.clone().multiply(wo).applyMatrix4(eh))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=GG.map(([e,t])=>new us(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=HG.map(([e,t])=>this.vertices[e].clone().add(this.vertices[t]).multiplyScalar(.5))}},Nn={Cloner:()=>{},changeEntityProptotype:()=>{},createEntity:()=>{}},WG=class extends HM{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 d=0;d<c.length;d++){let u=c[d];i&&i.equals(u)||(t.push(u),i=u)}}return this.autoClose&&t.length>
31401&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}},E0=.001;function C0(e,t,i){return t.clone().sub(e).cross(t.clone().sub(i)).length()<=E0}function ng(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 C0(i,r,a)&&C0(i,s,a)}function zE(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++)C0(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 d=i[c].data,u=new M(...d.position),p=new M(...d.controlPrevious.position),f=new M(...d.controlNext.position),g={position:u,baseRoundness:d.roundness,controlPrevious:p,controlNext:f};if(d.roundness===0||!e.isClosed&&(c===0||c===n-1)){o[c]={...g,removedLength:0};continue}let m=s&&c==0?n-1:c-1,v=s&&c==n-1?0:c+1,y=i[m].data,x=i[v].data,w=new M(...y.position),S=new M(...x.position),b=w.clone().sub(u).normalize(),A=S.clone().sub(u).normalize();Object.assign(g,{prevDir:b,nextDir:A});let _=ng(y,d),E=ng(d,x);if(!_||!E)o[c]={...g,removedLength:0};else{let C=b.clone().add(A).normalize(),T=C.clone().cross(b).length()/b.dot(C);o[c]={...g,tan:T,removedLength:d.roundness/T}}}for(let c=0;c<a;c++){let d=c,u=s&&c===n-1?0:c+1,p=o[d],f=o[u];if(p.removedLength!==0||f.removedLength!==0){let g=p.position.distanceTo(f.position);p.removedLength=Math.min(p.removedLength,g/2),f.removedLength=Math.min(f.removedLength,g/2)}}let l=[];for(let c=0;c<a;c++){let d=c,u=s&&c===n-1?0:c+1,p=o[d],f=o[u],g=null;if(!ng(i[d].data,i[u].data))p.position.distanceTo(f.position)>E0&&(g=new op(p.position,p.controlNext,f.controlPrevious,f.position));else{let m=p.position.clone(),v=f.position.clone();(p.removedLength!==0||f.removedLength!==0)&&(p.nextDir&&m.add(p.nextDir.clone().setLength(p.removedLength)),f.prevDir&&v.add(f.prevDir.clone().setLength(f.removedLength))),m.distanceTo(v)>E0&&(g=new op(m,m.clone().lerp(v,.3),v.clone().lerp(m,.3),v))}l[2*c+1]=g}for(let c=0;c<n;c++){let d=o[c];if(d.removedLength===0){l[2*c]=null;continue}let u=d.position,p=d.prevDir.clone().multiplyScalar(d.removedLength).add(u),f=d.nextDir.clone().multiplyScalar(d.removedLength).add(u),g=d.tan*d.removedLength,m=d.prevDir.clone().add(d.nextDir).normalize(),v=p.clone().lerp(f,.5),y=p.distanceTo(f)/2,x=m.clone().multiplyScalar(Math.sqrt(Math.pow(g,2)-Math.pow(y,2))).add(v),w=m.clone().multiplyScalar(-g).add(x),S=u.distanceTo(w)/u.distanceTo(v),b=d.prevDir.clone().multiplyScalar(S*u.distanceTo(p)).add(u),A=b.clone().lerp(w,2),_=p.clone().lerp(b,4/3),E=f.clone().lerp(A,4/3);l[2*c]=new op(p,_,E,f)}let h=new WG;return l.forEach(c=>{c&&h.add(c)}),h}var Ct;(e=>{function t(i){return i&&i.__isEntity}e.is=t})(Ct||(Ct={}));var Ga=e=>Ct.is(e),qG={type:"completeState",isfromEntity:!0},XG=["x","y","z"],og=new M,YG=new M().set(0,1,0),l1=e=>class extends o1(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.reversibleToState=null,this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new TS,this._recursiveBBox=new TS,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(Ct.is(i))return i}entityChildrenCount(){let t=this.children.length;for(;t--;)if(Ct.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(Ct.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)Co.toOps(this.data,s.data).forEac
vendor: 4,343 bytes, line 3140
3140h(a=>{let n=Wp.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=Co.patch(this.data,s),Co.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=>{Ga(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(Ct.is(i[r]))return i[r];if(Ct.is(t))return t.traverseSortNextHelper()}}sortNext(){let t=this.children;return this.children.length>0&&Ct.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)Ga(i)&&t(i)}traverseEntityAncestors(t){this.traverseAncestors(i=>{Ct.is(i)&&t(i)})}traverseConcreteEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)Ga(r)&&r.isConcreteEntity&&r.traverseEntity(t,i+1)}traverseEntity(t,i=0){if(t(this,i)!==!0)for(let r of this.children)Ga(r)&&r.traverseEntity(t,i+1)}traverseVisibleEntity(t){t(this);for(let i of this.children)Ga(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=>Ga(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*Oe.RAD2DEG,this.rotation.y*Oe.RAD2DEG,this.rotation.z*Oe.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return Lv(i,t)}getTransformValues(t,i,r){return i[t].map((s,a)=>(r==null?void 0:r.shared.getVariable(s,[this.uuid,t,XG[a]]))??s)}updateTransformState(t,i){let r=!1;return t.position&&(this.position.fromArray(this.getTransformValues("position",t,i)),r=!0),t.rotation&&(og.fromArray(this.getTransformValues("rotation",t,i)).multiplyScalar(Oe.DEG2RAD),this.rotation.setFromVector3(og),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??gh.identity)),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)})}dispose(){this.disposed=!0,this.cloner&&(this.cloner.removeFromParent(),this.cloner=void 0)}disposeChildrenRecursively(){for(let t of this.children)Ct.is(t)&&t.disposeRecursively()}
3140disposeRecursively(){this.dispose(),this.children.forEach(t=>{Ct.is(t)&&t.disposeRecursively()})}toState(t=[]){let i={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(t)};return Lv(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=Yt(t.path,["states","*"]);if(o!==null){if(t.type===0){let[l]=o;if((this==null?void 0: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 d=Fi.zoom(c,t.path.slice(2));if(d)for(let u in t.props)t.props[u]===void 0&&u in d&&(h[u]=d[u])}}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,...d}=l;l=d}if(t.props.material!==void 0&&"material"in l){let{material:c,...d}=l;l=d}let h=Fi.removeOverridden(t.path,t.props,l);n={...t,props:h}}}if(this.updateByPatchedOpBase(n,Co.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),r),Yt(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 d=r.scene.findInstance([this.uuid,...l]);d&&(d.overrideData=t.props[c],d.updateState(Hn.apply(d.component.data,d.overrideData),r))}}else{let c=r.scene.findInstance([this.uuid,...l]);if(c){let d=Fi.zoom(c.component.data,h);if(t={...t,path:h},t.type===0){let u=t.props;if(d)for(let[p,f]of Object.entries(t.props))f===void 0&&(u===t.props&&(u={...t.props}),u[p]=d[p]);t={...t,props:u}}c.overrideData=rf.resolve(i.overrides,l),c.updateByOp(t,Qi.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(Yt(t.path,[h])){l=t;break}l!==void 0&&this.instances.forEach(h=>{if(h.isInstanceRoot){let c=Hn.filterOp(h.overrideData,l);c&&h.updateByOp(c,Qi.applySimple(h.data,c),r,!0)}}),this.instances.forEach(h=>{if(!h.isInstanceRoot){let c=Hn.filterOp(h.overrideData,t);if(c){let d;a===h.data&&t===c?d=i:d=Qi.applySimple(h.data,c),h.updateByOp(c,d,r,!0)}}})}}updateByPatchedOpBase(t,i,r){if(this.dataPatched=i,t.path.length===0&&t.type===0)t.props.type!==void 0&&!Wo.is(t.props.type)&&Nn.changeEntityProptotype(this,i,r);else if(t.path.length===1&&t.path[0]==="geometry"&&t.type===0&&"type"in t.props){Nn.changeEntityProptotype(this,i,r);for(let s of this.children)Ct.is(s)&&s.updateVisible(r.scene)}this.updateByPatchedOp(t,i,r)}updateByPatchedOp(t,i,r){var s;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 a=(s=i.morphTargetInfluences.get(t.path[1]))==null?void 0:s.data.name;a&&this.updateMorphInfluences(a,r.shared.getVariable(t.props.value,[this.uuid,"morphTargetInfluences",a]))}if(Yt(t.path,["pathSnapping"])!==null&&this.updatePathSnapping(i.pathSnapping),Yt(t.path,["cloner"])!==null){let a=Qi.drop(t,1);a.path.length===0&&a.type===0&&a.props.disabled===!0?this.setFromClonerState(null,r):this.cloner?this.cloner.updateState(i.cloner,r.scene):(this.setFromClonerState(i.cloner,r),this.expandCloner(r.scene)),this.updateVisible(r.scene)}}updatePathSnapping(t=this.dataPatched.pathSnapping){this._updatedPathSnapping=t,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(t){var f,g,m,v,y;let i=((f=this._updatedPathSnapping)==null?void 0:f.pathId)??this.dataPatched.pathSnapping.pathId,r=((g=this._updatedPathSnapping)==null?void 0:g.slide)??this.dataPatched.pathSnapping.slide??0,s=((m=this._updatedPathSnapping)==null?void 0:m.offset)??this.dataPatched.pathSnapping.offset??0,a=((v=this._updatedPathSnapping)==null?void 0:v.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=zE(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 d=this.parent?(y=this.parent)==null?void 0:y.matrixWorld:new be;n.updateMatrixWorld();let u=new be().multiplyMatrices(d.clone().invert(),n.matrixWorld);c.applyMatrix4(u);let p={position:c.toArray(),rotation:o.rotation};if(a==="tangential"){let x=new be().extractRotation(n.matrixWorld),w=l.getTangentAt(h).applyMatrix4(x).add(c),S=new be().lookAt(c,w,YG),b=og.setFromEuler(new zi().setFromRotationMatrix(S)).multiplyScalar(Oe.RAD2DEG);p={...p,rotation:b.toArray()}}this.updateTransformState(p),this.traverseEntity(x=>{x._cameraType&&x.dispatchEvent(qG)})}updateVisible(t){var r;if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||((r=this.dataPatched.cloner)==null?void 0:r.hideBase)!==!0),!t)return;let i=!1;this.traverseEntity(s=>{if(s.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==null?void 0: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 Nn.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 Nn.Cloner(this,t),i.scene.addPendingExpandCloner(this)):this.cloner.updateState(t,i.scene))}expandCloner(t){!this.disposed&&this.cloner&&this.cloner.expandClones(t)}invalidateClonerTransform(t){this.cloner&&this.cloner.invalidateTransform(t)}requestRender(){this.dispatchEvent({type:"requestRender"})}},FE=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){var l,h;let i=(l=e.parameters)==null?void 0:l.radiusTop,r=(h=e.parameters)==null?void 0:h.radiusBottom,s=Object.assign({},(t==null?void 0:t.parameters)??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},e.parameters);s.thetaLength=Oe.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 c=Math.max(n,o)*2;s.width=c,s.depth=c}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:
3140o,thetaLength:l,radiusTop:h,radiusBottom:c,cornerRadius:d,cornerSegments:u,hollow:p}=e.parameters,f;return l===0?(f=new je,f.setAttribute("position",new De([],3))):d||p?f=new kE(h,c,r,s,a,n,o,l*Math.PI/180,d,d,u,p):f=new Ey(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 yn(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}function PS(e){return new j(e.y,-e.x)}var kE=class extends je{constructor(e,t,i,r,s,a,n,o,l,h,c,d,u=!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=[],g=[],m=[],v=0,y=i/2,x=new M,w=new M;u&&e==0&&(e=l),u&&t==0&&(t=h);let S=new j(e,y),b=new j(t,-y),A=null,_=null,E=null,C=null,T=S.clone().sub(b),P=0,O=0,D=0;d>0&&(P=Math.min(e,t)*(1-d),O=e-P,D=t-P);let k=S.clone();k.x-=P;let W=Math.PI-T.angle(),N=T.angle(),F=Math.tan(N/2),Z=Math.tan(W/2),q=F+Z,G=d?q:Z,Q=d?q:F;if(l=Math.min(l,(e-O)/G,T.length()/q),h=Math.min(h,(t-D)/Q,T.length()/q),l>0){let re=l/F;A=S.clone().sub(new j(re,l)),d&&(E=A.clone(),E.x-=P-q*l),S.sub(T.clone().setLength(re))}if(h>0){let re=h/Z;_=b.clone().sub(new j(re,-h)),b.add(T.clone().setLength(re)),d&&(C=_.clone(),C.x-=P-q*h,k.sub(T.clone().setLength(re)))}T=S.clone().sub(b);let ee=T.length()<.5,Y=[];for(let re=0;re<=r;re++){let te=[],ae=re/r,ce=ae*o+n,ue=new j(Math.sin(ce),Math.cos(ce));C&&_?($(te,ae,ue,W,h,C,-1,!0),$(te,ae,ue,N,h,_,-1,!1)):_?(H(te,ue,_.x,0,-1),$(te,ae,ue,N,h,_,-1,!1)):a||H(te,ue,t,D,-1);let xe=PS(T).normalize();if(yn(xe,ue,x),!ee)for(let Re=0;Re<=s;Re++){let Ae=Re/s,Ne=T.clone().multiplyScalar(Ae).add(b);yn(Ne,ue,w),f.push(w.x,w.y,w.z),g.push(x.x,x.y,x.z),m.push(ae,.5+w.y/i),te.push(v++)}if(E&&A?($(te,ae,ue,W,l,A,1,!1),$(te,ae,ue,N,l,E,1,!0)):A?($(te,ae,ue,W,l,A,1,!1),H(te,ue,A.x,0,1)):a||H(te,ue,e,O,1),d&&!ee){let Re=PS(T).multiplyScalar(-1).normalize();yn(Re,ue,x);for(let Ae=0;Ae<=s;Ae++){let Ne=Ae/s,Fe=T.clone().multiplyScalar(-Ne).add(k);yn(Fe,ue,w),f.push(w.x,w.y,w.z),g.push(x.x,x.y,x.z),m.push(ae,.5+w.y/i),te.push(v++)}}d&&!a&&te.push(te[0]),Y.push(te)}for(let re=0;re<Y.length-1;re++)for(let te=0;te<Y[0].length-1;te++){if(a&&d&&te==s)continue;let ae=Y[re][te],ce=Y[re+1][te],ue=Y[re+1][te+1],xe=Y[re][te+1],Re=f[ue*3+0],Ae=f[ue*3+2];p.push(ae,ce,xe),(Re!=0||Ae!=0)&&p.push(ce,ue,xe)}o<Math.PI*2&&(le(-1,Y[0],n),le(1,Y[Y.length-1],n+o)),this.setIndex(p),this.setAttribute("position",new De(f,3)),this.setAttribute("normal",new De(g,3)),this.setAttribute("uv",new De(m,2));function $(re,te,ae,ce,ue,xe,Re,Ae){for(let Ne=0;Ne<c+1;Ne++){let Fe=Ne/c,Ee=Re<0?Fe:1-Fe;Ae&&(Ee-=1),Ee*=ce;let Me=new j(Math.sin(Ee),Math.cos(Ee)*Re),Xe=Me.clone().multiplyScalar(ue).add(xe);yn(Xe,ae,w),f.push(w.x,w.y,w.z),yn(Me,ae,x),g.push(x.x,x.y,x.z),m.push(te,.5+w.y/i),re.push(v++)}}function H(re,te,ae,ce,ue){let xe=new M,Re=new j,Ae=[ae,ce];ue<0&&Ae.reverse();for(let Ne of Ae)Re.set(Ne,y*ue),yn(Re,te,xe),f.push(xe.x,xe.y,xe.z),g.push(0,ue,0),m.push(.5,.5),re.push(v++)}function le(re,te,ae){let ce=new j(Math.sin(ae),Math.cos(ae)),ue=new j(-Math.cos(ae),Math.sin(ae)),xe=new M,Re=re<0?(Fe,Ee,Me)=>p.push(Fe,Ee,Me):(Fe,Ee,Me)=>p.push(Fe,Me,Ee),Ae=new j((e+t+O+D)/4,0);yn(Ae,ce,xe),f.push(xe.x,xe.y,xe.z),g.push(ue.x,0,ue.y),m.push(.5,.5);let Ne=v++;for(let Fe of te){let Ee=f.slice(Fe*3,Fe*3+3);f.push(...Ee),g.push(ue.x,0,ue.y);let Me=m.slice(Fe*2,Fe*2+2);m.push(...Me),v++}for(let Fe=Ne+1;Fe<v-1;Fe++)Re(Ne,Fe,Fe+1);Re(Ne,v-1,Ne+1)}}},QG=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0: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=Oe.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:
vendor: 5,369 bytes, line 3140
3140o,thetaLength:l,cornerRadiusTop:h,cornerRadiusBottom:c,cornerSegments:d}=e.parameters,u;return l===0?(u=new je,u.setAttribute("position",new De([],3))):h>0||c>0||l<360?u=new kE(0,t/2,r,s,a,n,o,l*Math.PI/180,h,c,d,0,!0):u=new Cy(t/2,r,s,a,n),u.scale(1,1,i/t),Object.assign(u,{userData:{...e,type:"ConeGeometry"}})}},ZG=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0: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 ks(t,i,r,s,a,n):h=new KG(t,i,r,s,a,n,o,l),Object.assign(h,{userData:{...e,type:"CubeGeometry"}})}},lg=Math.PI/2,KG=class extends je{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=[],d=[],u=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),g(1,1,1),g(-1,1,1),g(1,-1,1),g(-1,-1,1),g(1,1,-1),g(-1,1,-1),g(1,-1,-1),g(-1,-1,-1)),this.setIndex(l),this.setAttribute("position",new De(h,3)),this.setAttribute("normal",new De(c,3)),this.setAttribute("uv",new De(d,2));function p(m,v,y,x,w,S,b,A,_,E){let C=(S-2*n)/_,T=(b-2*n)/E,P=S/2-n,O=b/2-n,D=A/2,k=_+1,W=E+1,N=0,F=new M;for(let Z=0;Z<W;Z++){let q=Z*T-O;for(let G=0;G<k;G++){let Q=G*C-P;F[m]=Q*x,F[v]=q*w,F[y]=D,h.push(F.x,F.y,F.z),F[m]=0,F[v]=0,F[y]=A>0?1:-1,c.push(F.x,F.y,F.z),d.push(G/_),d.push(1-Z/E),N+=1}}for(let Z=0;Z<E;Z++)for(let q=0;q<_;q++){let G=u+q+k*Z,Q=u+q+k*(Z+1),ee=u+(q+1)+k*(Z+1),Y=u+(q+1)+k*Z;l.push(G,Q,Y),l.push(Q,ee,Y)}u+=N}function f(m,v,y,x,w,S,b,A,_,E){let C=(b-2*n)/E,T=b/2-n,P=A/2-n,O=_/2,D=E+1,k=0,W=new M,N=new M;for(let F=0;F<o+1;F++){let Z=F/o*lg,q=Math.sin(Z)*n,G=(1-Math.cos(Z))*n,Q=Math.sin(Z),ee=Math.cos(Z);W[v]=(P+q)*w,W[y]=(O-G)*S,N[m]=0,N[v]=Q*Math.sign(W[v]),N[y]=ee*Math.sign(W[y]);for(let Y=0;Y<D;Y++){let $=Y*C-T;W[m]=$*x,h.push(W.x,W.y,W.z),c.push(N.x,N.y,N.z),d.push(Y/E),d.push(0),k+=1}}for(let F=0;F<o;F++)for(let Z=0;Z<E;Z++){let q=u+Z+D*F,G=u+Z+D*(F+1),Q=u+(Z+1)+D*(F+1),ee=u+(Z+1)+D*F;l.push(q,G,ee),l.push(G,Q,ee)}u+=k}function g(m,v,y){let x=new M,w=new M(e/2,t/2,i/2);w.subScalar(n);let S=[],b=m*v*y>0?(_,E,C)=>l.push(_,E,C):(_,E,C)=>l.push(_,C,E);for(let _=0;_<=o;_++){let E=[],C=lg*(1-_/o),T=Math.cos(C),P=Math.sin(C),O=0;for(let D=0;D<=_;D++){let k=Math.cos(O),W=Math.sin(O);x.x=T*k,x.y=P,x.z=T*W;let N=w.clone().addScaledVector(x,n);h.push(m*N.x,v*N.y,y*N.z),c.push(m*x.x,v*x.y,y*x.z),d.push(0,0),E.push(u++),O+=lg/_}S.push(E)}let A=S.length-1;for(let _=0;_<A;_++){let E=S[_],C=S[_+1],T=E.length-1;b(E[0],C[1],C[0]);for(let P=1;P<=T;P++)b(E[P-1],E[P],C[P]),b(E[P],C[P+1],C[P])}}}},h1=class extends je{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(){var N;s=Math.min(1-1e-5,s),s==0&&(a=0);let d={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],u=new M,p=u.clone(),f=new or,g=s*r,m=r-g,v=a+1,y=new M,x=(F,Z)=>y.subVectors(F,Z).normalize(),w=(F,Z)=>Array(F).fill(void 0).map(Z),S=w(e.length/3,(F,Z)=>new M().fromArray(e,Z*3).setLength(r)),b=[],A=1e6;for(let F=0;F<S.length;F++){let Z=S[F],q=[],G,Q,ee,Y=1e10,$=-1;for(;($=t.indexOf(F,$+1))!=-1;){let te=$-$%3;G=t[te+($+1)%3],Q=t[te+($+2)%3],ee=Z.distanceToSquared(S[G]),Y=Math.min(Y,ee),q.push([G,Q,ee])}Y+=1e-6;let H=[],le=0,re=q.length;for(let te=0;te<re;te++){[G,Q,ee]=q[le];let ae=((N=b[G])==null?void 0:N.includes(F))==!0;ee<=Y&&H.push(G+ +ae*A),le=q.findIndex(ce=>ce[0]==Q)}b.push(H)}let _=[];{let F=0,Z=0,q,G,Q=d==3;for(let ee=0;ee<=a;ee++){q=ee*(ee+1)/2,G=(ee+1)*(ee+2)/2;for(let Y=0;Y<a-ee;Y++)[F,Z]=[q+Y+ee+2,G+Y+ee+3],_.push(q,G,...Q?[Z,q]:[F,G],Z,F),[q,G]=[F,Z];_.push(q,G,q+a+2)}}let E=u.clone(),C=u.clone(),T=u.clone(),P=u.clone(),O=u.clone(),D=[],k=w(S.length,()=>w(d,()=>u.clone()));for(let F=0;F<S.length;F++){u.copy(S[F]).normalize(),E.copy(u).multiplyScalar(m);let Z=b[F];for(let H=0;H<Z.length;H++){let le=Z[H],re=Z[(H+1)%d];f.setFromPointsAndIndices(S,F,le%A,re%A),f.b.sub(f.a).setLength(1e10).add(f.a),f.c.sub(f.a).setLength(1e10).add(f.a),f.closestPointToPoint(E,k[F][H])}let q=[],G=[],Q=[],ee=new M;a==0&&[...k[F]].reduce((H,le)=>H.add(le),ee).multiplyScalar(1/d);for(let H=0;H<d;H++){let le=[],re=(H-1+d)%d,te=k[F][re],ae=k[F][H];u.copy(te).sub(E),p.copy(ae).sub(E);let ce=E.angleTo(u),ue=u.angleTo(p),xe=Math.cos(ce)*g;
3140a==0?C.copy(ee):C.copy(E).setLength(m+xe),G.push(xe);let Re=[C,te,ae];for(let Ae=0;Ae<2;Ae++){let Ne=Re[Ae],Fe=Re[Ae+1];P.subVectors(Ne,E),O.subVectors(Fe,E),T.crossVectors(P,O).normalize();for(let Ee=0;Ee<v;Ee++){let Me=[ce,ue][Ae]*Ee/v;u.copy(P).applyAxisAngle(T,Me).add(E),q.push(u.clone()),Ae&&(x(u,E),le.push([Ee==0?Ne:u.clone(),y.clone()]))}Ae&&(x(Fe,E),le.push([Fe,y.clone()]))}Q.push(le)}D.push(Q);let Y=2*v,$=2;for(let H=0;H<d;H++){let le=Y*H,re=Y*((H+1)%d),te=[q[le]];for(let ce=1;ce<v;ce++){P=q[le+ce],O=q[re+ce],te.push(P);for(let ue=1,xe=ce-$+1;ue<=xe;ue++)u.lerpVectors(P,O,ue/(xe+1)),u.sub(E).setLength(G[H]).add(E),te.push(u.clone());te.push(O)}for(let ce=0;ce<v;ce++)te.push(q[ce+v+le]);te.push(q[re+v]);let ae=_.map(ce=>te[ce]);n.push(...ae.map(ce=>[ce.x,ce.y,ce.z]).flat()),l.push(...ae.map(ce=>(x(ce,E),[y.x,y.y,y.z])).flat())}}let W=[];for(let F=0;F<b.length;F++)for(let Z=0;Z<d;Z++){let q=b[F][Z];if(q<A){let G=b[q].findIndex(Y=>Y%A==F),Q=D[F][Z],ee=D[q][G];for(let Y=0;Y<v;Y++){let $=Q[Y],H=ee[v-Y],le=Q[Y+1],re=ee[v-(Y+1)];[$,H,le,le,H,re].forEach(te=>{n.push(te[0].x,te[0].y,te[0].z),l.push(te[1].x,te[1].y,te[1].z)})}W.push(Q[0][0],ee[v][0],Q[v][0],ee[0][0])}}for(;W.length;){let F,Z,q,G;[F,Z]=W.splice(0,2);let Q=[F];for(;F!=Z;)Q.push(Z),q=W.indexOf(Z),G=q%2,Z=W.splice(q-G,2)[1-G];y.subVectors(Q[0],Q[1]).cross(u.subVectors(Q[0],Q[2])).normalize();let ee=y.dot(Q[0])<0;ee&&y.negate();for(let Y=1;Y<=Q.length-2;
3140Y++)[Q[Y+ +ee],Q[Y+1-+ee],Q[0]].forEach($=>{n.push($.x,$.y,$.z),l.push(y.x,y.y,y.z)})}}function c(){let d=new M;for(let b=0;b<n.length;b+=3){d.x=n[b+0],d.y=n[b+1],d.z=n[b+2];let A=w(d)/2/Math.PI+.5,_=S(d)/Math.PI+.5;o.push(A,1-_)}let u=new M,p=new M,f=new M,g=new M,m=new j,v=new j,y=new j,x=(b,A,_,E)=>{E<0&&b.x===1&&(o[A]=b.x-1),_.x===0&&_.z===0&&(o[A]=E/2/Math.PI+.5)};for(let b=0,A=0;b<n.length;b+=9,A+=6){u.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]),m.set(o[A+0],o[A+1]),v.set(o[A+2],o[A+3]),y.set(o[A+4],o[A+5]),g.copy(u).add(p).add(f).divideScalar(3);let _=w(g);x(m,A+0,u,_),x(v,A+2,p,_),x(y,A+4,f,_)}for(let b=0;b<o.length;b+=6){let A=o[b+0],_=o[b+2],E=o[b+4],C=Math.max(A,_,E),T=Math.min(A,_,E);C>.9&&T<.1&&(A<.2&&(o[b+0]+=1),_<.2&&(o[b+2]+=1),E<.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 h1(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}},JG=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0: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)})}}
vendor: 42,879 bytes, line 3140
3140static build(e){let{width:t,height:i,depth:r,detail:s,corner:a,cornerSides:n}=e.parameters,o=s===0&&a!==0?new UE(t*.5,a,n):new qM(t*.5,s);return o.scale(1,i/t,r/t),Object.assign(o,{userData:{...e,type:"DodecahedronGeometry"}})}},UE=class extends h1{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 UE(e.radius,e.corner,e.cornerSides)}},ac=1e-12,c1=class{constructor(e){this.position=new j,this.startPosition=new j,this.uuid=Oe.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 c1(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},T0=class extends c1{constructor(e){super(e.position),this.parent=e}copy(e){return super.copy(e),this}clone(){return new T0(this.parent).copy(this)}},th=class extends c1{constructor(e,t){super(t),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=e,this.controls.push(new T0(this),new T0(this))}static create(e,t){let i=new th(e,new j(...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 th(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){var i,r;let e=(i=this.curveBefore)==null?void 0:i.getTangentAt(1),t=(r=this.curveAfter)==null?void 0:r.getTangentAt(0);return[e,t]}computeNormals(e=new j,t=new j){let[i,r]=this.computeTangents();return i&&r&&(DS(i,e),DS(r,t)),[e,t]}computeTangent(e=new j){let[t,i]=this.computeTangents();return t&&i&&e.copy(t).add(i).normalize(),e}computeNormal(e=new j){let[t,i]=this.computeNormals();return e.copy(t).add(i).normalize(),e}};function DS(e,t=new j){let i=e.length();return t.set(-e.y/i,e.x/i)}var d1=e=>e,Uh=new j,qf=new j,$G=new j,eH=new j,tH=new j,iH=new j,NE=new M,VE=new M;function rH(e){let t=new j;t.addVectors(e.v0,Uh.subVectors(e.v1,e.v0).multiplyScalar(2/3));let i=new j;return i.addVectors(e.v2,qf.subVectors(e.v1,e.v2).multiplyScalar(2/3)),new Os(e.v0,t,i,e.v2)}function _c(e,t,i=Number.EPSILON){return Math.abs(e-t)<i}function sH(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function aH(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function jE(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 nH(e,t,i){return OS(e,t)&&OS(t,i)&&P0(e.position,t.position,i.position)}function P0(e,t,i){return Uh.copy(t).sub(e).cross(qf.copy(i).sub(e))===0}function oH(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 lH(e,t,i){let r=e.distanceTo(i),s=t.distanceTo(i);return r<s?t:e}function hH(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)),d;return jE(t,e,i)>Math.PI&&(c*=-1),_c(h,o)?d=(o+h)*(r/c-.5)*8/3/(n-l):d=(n+l)*(r/c-.5)*8/3/(h-o),s.set(t.x-d*o,t.y+d*n),a.set(i.x+d*h,i.y-d*l),[s,a]}function IS(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function OS(e,t){return P0(e.position,e.controls[1].position,t.position)&&P0(e.position,t.controls[0].position,t.position)}function cH(e,t,i,r,s=.5){let a=Uh.subVectors(t,e).multiplyScalar(s).add(e),n=qf.subVectors(i,t).multiplyScalar(s).add(t),o=$G.subVectors(r,i).multiplyScalar(s).add(i),l=a,h=eH.subVectors(n,a).multiplyScalar(s).add(a),c=tH.subVectors(o,n).multiplyScalar(s).add(n),d=o,u=iH.subVectors(c,h).multiplyScalar(s).add(h);return[e.x,e.y,l.x,l.y,h.x,h.y,u.x,u.y,c.x,c.y,d.x,d.y,r.x,r.y]}function dH(e,t,i=12,r=!0){let s=VE.set(0,0,0),a,n=0;for(let o=0;o<t.length;o++){let l=d1(t[o]),h=Uh,c=No(l,i);for(let d=0;d<=c;d++)if(l instanceof Os||l instanceof Qn||l instanceof Bs){if(l.getPoint(d/c,h),s.set(h.x,h.y,0),a!==void 0&&aH(a,s))continue;a===void 0&&(a=NE),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 uH(e,t,i,r=12,s=!0){let a=VE.set(0,0,0),n=0,o=[];for(let l=0;l<t.length;l++){if(i[l]===!1)continue;let h,c=d1(t[l]),d=Uh,u=No(c,r);o.push(u);for(let p=0;p<=u;p++)if(c instanceof Os||c instanceof Qn||c instanceof Bs){if(c.getPoint(p/u,d),a.set(d.x,d.y,0),h==null?void 0:h.equals(a))continue;h===void 0?h=NE:(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 RS(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=No(n.roundedCurveCorner,t)*.5;s>0&&(r[s-1]+=l),o+=l}n.curveAfter!==void 0&&(o+=No(n.curveAfter,t)),r.push(o)}return e.length>0&&i&&e[0].roundedCurveCorner!==void 0&&(r[e.length-1]+=No(e[0].roundedCurveCorner,t)*.5),r}function No(e,t=12){return e&&e instanceof If?t*2:e&&(e instanceof Bs||e instanceof GM)?1:e&&e instanceof My?t*e.points.length:t}function pH(e,t,i=12,r=!0){let s,a=0;for(let n=0;n<t.length;n++){let o=d1(t[n]),l=No(o,i),h=Uh;for(let c=0;c<=l;c++)if(o instanceof Os||o instanceof Qn||o instanceof Bs){if(o.getPoint(c/l,h),s!==void 0&&sH(s,h,ac))continue;s===void 0&&(s=qf),s.copy(h),e.push(h.x,h.y),a++}}return _c(e[0],e[e.length-2],ac)&&_c(e[1],e[e.length-1],ac)&&(e.pop(),e.pop()),r&&a>1&&!(_c(e[a-1],e[1],ac)&&_c(e[a-2],e[0],ac))&&(e.push(e[0],e[1]),a++),e}var hg=new j,fH=new j,mH=new j,gH=new j,vH=new j,yH=new j,di=class extends Dp{constructor(e=100,t=100){super(),this.points=[],this.shapeHoles=[],this.plane=new Fr(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=Oe.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=e,this._height=t}static createFromState(e,t,i){let r=new di;return r.isClosed=e.isClosed,r.points=e.points.map(s=>th.create(s.id,s.data)),typeof e.roundness=="number"&&(r.roundness=e.roundness),r.shapeHoles=e.shapeHoles.map(s=>di.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=hg.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=Oe.generateUUID()){let r;e instanceof j?r=e:r=new j(e,t);let s=new th(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 dH(e,i?this.roundedCurves:this.curves,t,this.autoClose),r.reduce((s,a)=>s+a,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=RS(this.points,e,!1),this.roundedCurveDivisions=RS(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,i=12){return uH(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),pH(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=No(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(IS(r,s)){let l=r.position.distanceTo(s.position);return r.position.distanceTo(hg.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){IS(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!=null&&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&&nH(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 d=s.roundedCurveBefore,u=s.roundedCurveAfter,p=h.getLength(),f=c.getLength(),g=Math.min(o,p*.499),m=Math.min(o,f*.499),v=Math.min(g,m),y=1-v/p,x=v/f,w=h.getPointAt(y,hg),S=c.getPointAt(x,fH);this._subSplitCurve(h,d,y,w,void 0),this._subSplitCurve(c,u,x,void 0,S);let b;if(this.useCubicForRoundedCorners){let A=jE(w,s.position,S)/2,_=Math.tan(A)*w.distanceTo(s.position),[E,C]=oH(w,S,_,mH,gH),T=lH(E,C,s.position),[P,O]=hH(T,w,S,_,vH,yH);b=new Os(w.clone(),P.clone(),O.clone(),S.clone())}else b=new Qn(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 Bs)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=cH(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 di(this._width,this._height);return e.points=this.points.map(t=>t.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(t=>t.clone()),e}toJSON(){return{points:this.points.reduce((e,t)=>e.concat(t.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){var i;this.points=[],this.pointIDs=0;let t=e.points.length/7;for(let r=0;r<t;r++){let s=r*7,a=e.points[s+0],n=e.points[s+1],o=e.points[s+2],l=e.points[s+3],h=e.points[s+4],c=e.points[s+5],d=e.points[s+6],u=new th(Oe.generateUUID(),new j(a,n));u.controls[0].position.set(o,l),u.controls[1].position.set(h,c),u.roundness=d,this.points.push(u)}return this.shapeHoles=(i=e.shapeHoles)!=null&&i.length?e.shapeHoles.map(r=>{let s=new di;return s.fromJSON(r),s}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e,t=!1){this.isText=t;let i=(s,a)=>{a instanceof Os&&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 Qn&&(s[n]=rH(s[n]));for(n=0,o=s.length;n<o;n++){let c=s[n],d=n>0?s[n-1]:null,u;c instanceof Os?(u=this.createPoint(c.v0),u.controls[1].position.copy(c.v1)):c instanceof Bs&&(u=this.createPoint(c.v1)),u!==void 0&&(d!==null&&i(u,d),a.push(u))}let l=s[s.length-1],h=!1;return l instanceof Os?l.v3.equals(a[0].position)&&(a[0].controls[0].position.copy(l.v2),h=!0):l instanceof Bs&&l.v2.equals(a[0].position)&&(h=!0),this.isClosed=h,a};return this.points=r(e.curves),e instanceof Dp&&(this.shapeHoles=e.holes.map(s=>{let a=new di;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){var r;let i=(r=this.getPointByUuid(e))==null?void 0:r.controls[0];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}updateNextControl(e,t){var r;let i=(r=this.getPointByUuid(e))==null?void 0:r.controls[1];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}},D0=Math.PI*2;function cg({x:e,y:t},i,r,s,a){return{x:e*i+s,y:t*r+a}}function xH(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 LS(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 bH(e,t,i,r,s,a,n,o,l,h){let c=Math.pow(s,2),d=Math.pow(a,2),u=Math.pow(n,2),p=Math.pow(o,2),f=c*d-c*p-d*u;f<0&&(f=0),f/=c*p+d*u,f=Math.sqrt(f)*(l===h?-1:1);let g=f*s/a*o,m=f*-a/s*n,v=g+(e+i)/2,y=m+(t+r)/2,x=(n-g)/s,w=(o-m)/a,S=(-n-g)/s,b=(-o-m)/a,A=LS(1,0,x,w),_=LS(x,w,S,b);return!h&&_>0&&(_-=D0),h&&_<0&&(_+=D0),{centerx:v,centery:y,ang1:A,ang2:_}}function wH({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 d=Math.pow(h,2)/Math.pow(s,2)+Math.pow(c,2)/Math.pow(a,2);d>1&&(s*=Math.sqrt(d),a*=Math.sqrt(d));let u=bH(e,t,i,r,s,a,h,c,n,o),{ang1:p,ang2:f}=u,{centerx:g,centery:m}=u,v=Math.abs(f)/(D0/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(xH(p,f)),p+=f;return l.map(x=>{let{x:w,y:S}=cg(x[0],s,a,g,m),{x:b,y:A}=cg(x[1],s,a,g,m),{x:_,y:E}=cg(x[2],s,a,g,m);return{x1:w,y1:S,x2:b,y2:A,x:_,y:E}})}var jt;(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"})(jt||(jt={}));var Ai;(function(e){e[e.POLYGONS=0]="POLYGONS",e[e.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",e[e.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(Ai||(Ai={}));function nt(e,t){if(!e)throw t||"Assertion Failed!"}var Qe=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){nt(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){nt(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){nt(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){nt(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}(),nc=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}(),Mu=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}(),Ul=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}(),BS=function(){function e(){var t=new Ul,i=new nc,r=new Mu(0),s=new Mu(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 Mu(0),r=new Mu(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;nt(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;nt(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 Ul,i=new Ul,r=new nc,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 Ul;this.makeVertex_(a,i,t.Org),t.Org.anEdge=t}if(!r){var n=new nc;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 nc;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 Ul;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 nc;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&&Qe.vertCCW(r.Lprev.Org,r.Org,a.Lnext.Lnext.Org)&&Qe.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){nt(s.prev===a),l=s.anEdge;do nt(l.Sym!==l),nt(l.Sym.Sym===l),nt(l.Lnext.Onext.Sym===l),nt(l.Onext.Sym.Lnext===l),nt(l.Lface===s),l=l.Lnext;while(l!==s.anEdge)}for(nt(s.prev===a&&s.anEdge===null),o=i,o=i;(n=o.next)!==i;o=n){nt(n.prev===o),l=n.anEdge;do nt(l.Sym!==l),nt(l.Sym.Sym===l),nt(l.Lnext.Onext.Sym===l),nt(l.Onext.Sym.Lnext===l),nt(l.Org===n),l=l.Onext;while(l!==n.anEdge)}for(nt(n.prev===o&&n.anEdge===null),h=r,h=r;(l=h.next)!==r;h=l)nt(l.Sym.next===h.Sym),nt(l.Sym!==l),nt(l.Sym.Sym===l),nt(l.Org!==null),nt(l.Dst!==null),nt(l.Lnext.Onext.Sym===l),nt(l.Onext.Sym.Lnext===l);nt(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}(),zS=function(){function e(){this.handle=null}return e}(),FS=function(){function e(){this.key=null,this.node=0}return e}(),SH=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 zS,this.handles[r]=new FS;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,nt(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 zS;for(a=this.handles.length,this.handles.length=this.max+1,s=a;s<this.handles.length;s++)this.handles[s]=new FS}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;nt(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}(),dg=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}(),kS=function(){function e(){this.key=null,this.next=null,this.prev=null}return e}(),_H=function(){function e(t,i){this.frame=t,this.leq=i,this.head=new kS,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 kS;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}(),AH=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?Qe.vertLeq(a.Org,n.Org)?Qe.edgeSign(n.Dst,a.Org,n.Org)<=0:Qe.edgeSign(a.Dst,n.Org,a.Org)>=0:Qe.edgeSign(n.Dst,s,n.Org)<=0;if(n.Dst===s)return Qe.edgeSign(a.Dst,s,a.Org)>=0;var o=Qe.edgeEval(a.Dst,s,a.Org),l=Qe.edgeEval(n.Dst,s,n.Org);return o>=l},e.deleteRegion=function(t,i){i.fixUpperEdge&&nt(i.eUp.winding===0),i.eUp.activeRegion=null,t.dict.delete(i.nodeUp)},e.fixUpperEdge=function(t,i,r){nt(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 dg;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 jt.ODD:return(i&1)!==0;case jt.NONZERO:return i!==0;case jt.POSITIVE:return i>0;case jt.NEGATIVE:return i<0;case jt.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,d=!0;h=r;do nt(Qe.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,!d&&e.checkForRightSplice(t,l)&&(e.addWinding(h,c),e.deleteRegion(t,l),t.mesh.delete(c)),d=!1,l=o,c=h;l.dirty=!0,nt(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=Qe.vertL1dist(i,t),a=Qe.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(Qe.vertLeq(s.Org,a.Org)){if(Qe.edgeSign(a.Dst,s.Org,a.Org)>0)return!1;Qe.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(Qe.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(nt(!Qe.vertEq(s.Dst,a.Dst)),Qe.vertLeq(s.Dst,a.Dst)){if(Qe.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(Qe.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,d,u=new Ul,p,f;if(nt(!Qe.vertEq(h,l)),nt(Qe.edgeSign(l,t.event,n)<=0),nt(Qe.edgeSign(h,t.event,o)>=0),nt(n!==t.event&&o!==t.event),nt(!i.fixUpperEdge&&!r.fixUpperEdge),n===o||(c=Math.min(n.t,l.t),d=Math.max(o.t,h.t),c>d))return!1;if(Qe.vertLeq(n,o)){if(Qe.edgeSign(h,n,o)>0)return!1}else if(Qe.edgeSign(l,o,n)<0)return!1;return e.debugEvent(t),Qe.intersect(l,n,h,o,u),nt(Math.min(n.t,l.t)<=u.t),nt(u.t<=Math.max(o.t,h.t)),nt(Math.min(h.s,l.s)<=u.s),nt(u.s<=Math.max(o.s,n.s)),Qe.vertLeq(u,t.event)&&(u.s=t.event.s,u.t=t.event.t),p=Qe.vertLeq(n,o)?n:o,Qe.vertLeq(p,u)&&(u.s=p.s,u.t=p.t),Qe.vertEq(u,n)||Qe.vertEq(u,o)?(e.checkForRightSplice(t,i),!1):!Qe.vertEq(l,t.event)&&Qe.edgeSign(l,t.event,u)>=0||!Qe.vertEq(h,t.event)&&Qe.edgeSign(h,t.event,u)<=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):(Qe.edgeSign(l,t.event,u)>=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),Qe.edgeSign(h,t.event,u)<=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=u.s,s.Org.t=u.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),Qe.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),Qe.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}Qe.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,Qe.vertEq(s.Org,r)){nt(!1),e.spliceMergeVertices(t,s,r.anEdge);return}if(!Qe.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}nt(!1),i=e.topRightRegion(i),l=e.regionBelow(i),n=l.eUp.Sym,a=o=n.Onext,l.fixUpperEdge&&(nt(a!==n),e.deleteRegion(t,l),t.mesh.delete(n),n=a.Oprev),t.mesh.splice(r.anEdge,n),Qe.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 dg;if(h.eUp=i.anEdge.Sym,r=t.dict.search(h).key,s=e.regionBelow(r),!!s){if(n=r.eUp,o=s.eUp,Qe.edgeSign(n.Dst,i,n.Org)===0){e.connectLeftDegenerate(t,r,i);return}if(a=Qe.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);nt(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 dg,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 _H(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||(nt(i.fixUpperEdge),nt(++r===1)),nt(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,Qe.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 SH(a,Qe.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,nt(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||!Qe.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}(),MH=function(){function e(){this.mesh=new BS,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=jt.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],d=[0,0,0],u=[0,0,0],p=[null,null,null],f=[null,null,null],g=this.mesh.vHead;i=g.next;for(var m=0;m<3;++m)a=i.coords[m],h[m]=a,f[m]=i,l[m]=a,p[m]=i;for(i=g.next;i!==g;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=g.next;i!==g;i=i.next)d[0]=i.coords[0]-s.coords[0],d[1]=i.coords[1]-s.coords[1],d[2]=i.coords[2]-s.coords[2],u[0]=c[1]*d[2]-c[2]*d[1],u[1]=c[2]*d[0]-c[0]*d[2],u[2]=c[0]*d[1]-c[1]*d[0],n=u[0]*u[0]+u[1]*u[1]+u[2]*u[2],n>o&&(o=n,t[0]=u[0],t[1]=u[1],t[2]=u[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(;Qe.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;Qe.vertLeq(r.Org,r.Dst);r=r.Lnext);s=r.Lprev;for(var a=void 0;r.Lnext!==s;)if(Qe.vertLeq(r.Dst,s.Org)){for(;s.Lnext!==r&&(Qe.edgeGoesLeft(s.Lnext)||Qe.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&&(Qe.edgeGoesRight(r.Lprev)||Qe.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)a=t.connect(r,r.Lprev),r=a.Sym;r=r.Lnext}
3140if(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===Ai.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 d=h.n*s;this.vertices[d+0]=h.coords[0],this.vertices[d+1]=h.coords[1],s>2&&(this.vertices[d+2]=h.coords[2]),this.vertexIndices[h.n]=h.idx}for(var u=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[u++]=h.n,l++,a=a.Lnext}while(a!==c.anEdge);for(var p=l;p<r;++p)this.elements[u++]=-1;if(i===Ai.CONNECTED_POLYGONS){a=c.anEdge;do this.elements[u++]=this.getNeighbourFace_(a),a=a.Lnext;while(a!==c.anEdge);for(var f=l;f<r;++f)this.elements[u++]=-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 BS),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=jt.ODD),i===void 0&&(i=Ai.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_(),AH.computeInterior(this,n);var o=this.mesh;return i===Ai.BOUNDARY_CONTOURS?this.setWindingNumber_(o,1,!0):this.tessellateInterior_(o),n&&o.check(),i===Ai.BOUNDARY_CONTOURS?this.outputContours_(o,s):this.outputPolymesh_(o,i,r,s),!0},e}();function Vn(e){var t=e.windingRule,i=t===void 0?jt.ODD:t,r=e.elementType,s=r===void 0?Ai.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,d=e.contours,u=d===void 0?[]:d,p=e.strict,f=p===void 0?!0:p,g=e.debug,m=g===void 0?!1:g;if(!u&&f)throw new Error("Contours can't be empty");if(u){var v=new MH;e.edgeCreateCallback&&(v.edgeCreateCallback=e.edgeCreateCallback),e.vertexIdCallback&&(v.vertexIdCallback=e.vertexIdCallback);for(var y=0;y<u.length;y++)v.addContour(l||2,u[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:m?v.mesh:void 0}}}jt.ODD;jt.NONZERO;jt.POSITIVE;jt.NEGATIVE;jt.ABS_GEQ_TWO;Ai.POLYGONS;Ai.CONNECTED_POLYGONS;Ai.BOUNDARY_CONTOURS;var I0=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*I0.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*I0.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)}},GE=I0;GE.eSize=8*Float32Array.BYTES_PER_ELEMENT;var EH=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 CH(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 d=new EH([],(y,x)=>x.max-y.max),u=PH(e),p=new ff(s+l/2,a+h/2,0,e);p.d>u.d&&(u=p);let f=2;function g(y,x,w){let S=new ff(y,x,w,e);if(f++,S.max>u.d+i&&d.push(S),S.d>u.d&&(u=S,r&&console.log(`found best ${Math.round(1e4*S.d)/1e4} after ${f} probes`),u.d>t))return t}let m=c/2;for(let y=s;y<n;y+=c)for(let x=a;x<o;x+=c)g(y+m,x+m,m);for(;d.length;){let{max:y,x,y:w,h:S}=d.pop();if(y-u.d<=i)break;m=S/2,g(x-m,w-m,m),g(x+m,w-m,m),g(x-m,w+m,m),g(x+m,w+m,m)}r&&console.log(`num probes: ${f}
3141best distance: ${u.d}`);let v=[u.x,u.y];return v.distance=u.d,v.distance}function ff(e,t,i,r){this.x=e,this.y=t,this.h=i,this.d=TH(e,t,r),this.max=this.d+this.h*Math.SQRT2}function TH(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,DH(e,t,h,c))}return s===0?0:(r?1:-1)*Math.sqrt(s)}function PH(e){let t=0,i=0,r=0,s=e[0];for(let n=0,o=s.length,l=o-1;n<o;l=n++){let h=s[n],c=s[l],d=h[0]*c[1]-c[0]*h[1];i+=(h[0]+c[0])*d,r+=(h[1]+c[1])*d,t+=d*3}let a=new ff(i/t,r/t,0,e);return t===0||a.d<0?new ff(s[0][0],s[0][1],0,e):a}function DH(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 u1={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},HE={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},WE={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},ug=(e,t)=>([i,r])=>(r<i&&(r+=t),(e>=i?e:e+t)<=r),p1=class extends je{constructor(e,t,i=0,r=12,s=3,a=jt.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(E=>{let C=E.extractShapePointsToFlatArray([],r),T=[];for(let P=C.length-1;P>=1;P-=2){let O=C[P-1],D=C[P-0];T.push(O,D)}return T}),h=[],c=[];for(let E=0;E<o.length;E+=2)c.push([o[E],o[E+1]]);h.push(c);for(let E=0;E<l.length;E++){let C=l[E],T=[];for(let P=0;P<C.length;P+=2)T.push([C[P],C[P+1]]);h.push(T)}let d;e.isText?d=new Oy().setFromPoints(e.points.map(E=>E.position)).getSize(new j).length()*.1:h[0].length===0?d=i:i>0?d=CH(h,i):d=1e-5,i<=0?(this._bevel=0,this._bevelSegments=0):(this._bevel=Math.min(i,d,t/2),this._bevelSegments=Math.floor(s));let u;
3141try{u=Vn({windingRule:a,elementType:Ai.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[o]})}catch{u=u1}let p;try{p=Vn({windingRule:jt.ODD,elementType:Ai.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...l]})}catch{p=HE}if(!u)throw new Error("error generating geometry");let f=u.elementCount;if(p){u.elementCount+=p.elementCount;for(let E=0;E<p.elements.length;E++){let C=p.elements[E],T=E%2===0?u.vertexCount:0;u.elements.push(C+T)}for(let E=0;E<p.vertexIndices.length;E++){let C=p.vertexIndices[E],T=u.vertexCount;u.vertexIndices.push(C+T)}for(let E=0;E<p.vertices.length;E++){let C=p.vertices[E];u.vertices.push(C)}}let g=1/0,m=-1/0,v=1/0,y=-1/0;for(let E=0,C=u.vertexCount;E<C;E++){let T=E*2,P=u.vertices[T+0],O=u.vertices[T+1];P<g&&(g=P),P>m&&(m=P),O<v&&(v=O),O>y&&(y=O)}this._minX=g,this._minY=v,this._width=m-g,this._height=y-v,this._buffer=new GE(this._computeBufferEstimatedSize(u));let x=[],w=[];for(let E=u.elementCount-1;E>=0;E--){let C=E>=f,T=E*2,P=u.elements[T+0],O=u.elements[T+1],D=P+O,k={start:P,count:O,normals:[],continuous:[],concave:[]},W=P,N=D-1,F=P+1,Z=this._shape.roundedCurves.length;do{let Y=W-P,$=u.vertices[N*2+0],H=u.vertices[N*2+1],le=u.vertices[W*2+0],re=u.vertices[W*2+1],te=u.vertices[F*2+0],ae=u.vertices[F*2+1],ce=le-$,ue=re-H,xe=Math.sqrt(ce*ce+ue*ue);ce/=xe,ue/=xe;let Re=le-te,Ae=re-ae,Ne=Math.sqrt(Re*Re+Ae*Ae);Re/=Ne,Ae/=Ne,k.normals[Y*2+0]=-Ae,k.normals[Y*2+1]=Re,k.concave[Y]=ce*Ae-ue*Re>0;let Fe=u.vertexIndices[W];if(Array.isArray(Fe))k.continuous[Y]=!1;else{let[Ee,Me]=this._shape.getCurveIndexFromVertexId(Fe-1,!0);if(Me>0&&Me<1)k.continuous[Y]=!0;else{let Xe=Me===1?Ee+1:Ee-1;Xe=(Xe+Z)%Z;let We=Me===1?0:1,V=this._shape.roundedCurves[Ee].getTangent(Me),B=this._shape.roundedCurves[Xe].getTangent(We);k.continuous[Y]=V.dot(B)>.95}}C&&(k.normals[Y*2+0]*=-1,k.normals[Y*2+1]*=-1),[N,W,F]=[W,F,F+1],F>=D&&(F-=O)}while(F!==P+1);let q=[];q.push({bevelI:0,angle:0,size:0,boundary:{vertices:u.vertices.slice(P*2,D*2),vertexCount:O,vertexIndices:new Array(O).fill(!0).map((Y,$)=>[$,$]),elements:[0,O],elementCount:1,mesh:null},reverseMap:[],insetPoints:u.vertices.slice(P*2,D*2)});let G=0;for(let Y=1;Y<=this._bevelSegments;Y++){let $=Y/this._bevelSegments*Math.PI/2,H=(1-Math.cos($))*this._bevel,le=[],re=[],te=0;for(let ce=0;ce<O;ce++){let ue=ce*2,xe=(ce-1+O)%O*2,Re=u.vertices[k.start*2+ue+0],Ae=u.vertices[k.start*2+ue+1],Ne=-k.normals[xe+0]*H,Fe=-k.normals[xe+1]*H,Ee=-k.normals[ue+0]*H,Me=-k.normals[ue+1]*H;if(k.concave[ce]||!k.concave[ce]&&C){let Xe=Math.atan2(Fe,Ne),We=Math.atan2(Me,Ee);We>Xe&&(We-=Math.PI*2);let V=We-Xe;if(k.continuous[ce]||C){let B=Xe+V/2,ne=Math.cos(B)*H,Se=Math.sin(B)*H;le[2*te+0]=Re+ne*(C?-1:1),le[2*te+1]=Ae+Se*(C?-1:1),re[te]=ce,te++}else{let B=Math.max(1,Math.floor(r/4*Math.abs(V)/Math.PI));for(let ne=0;ne<=B;ne++){let Se=Xe+V*(ne/B),R=Math.cos(Se)*H,Ce=Math.sin(Se)*H;le[2*te+0]=Re+R,le[2*te+1]=Ae+Ce,re[te]=ce,te++}}}else le[2*te+0]=Re+Ne,le[2*te+1]=Ae+Fe,re[te]=ce,te++,le[2*te+0]=Re,le[2*te+1]=Ae,re[te]=ce,te++,le[2*te+0]=Re+Ee,le[2*te+1]=Ae+Me,re[te]=ce,te++}let ae=Vn({windingRule:jt.POSITIVE,elementType:Ai.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[le],edgeCreateCallback:ce=>{let ue=ce.Org.idx,xe=re[ue],Re=re[(ue+1)%re.length];ce.idx=[xe,Re],ce.Sym.idx=[Re,xe]},vertexIdCallback:ce=>{let ue=ce.Lprev.idx;return[ue?ue[1]:0,ce.idx?ce.idx[0]:0]}});if(!ae)throw console.log("Error"),new Error(`error generating bevel geometry for ${Y}'th loop`);if(!ae.vertexCount){let ce=(Y-1)/this._bevelSegments*Math.PI/2;G=(1-Math.sin(ce))*this._bevel;break}for(let ce=0;ce<ae.vertexIndices.length;ce++){let[ue,xe]=ae.vertexIndices[ce];if(ue===xe)continue;let Re=xe;xe<ue&&(Re+=O);for(let Ae=ue;Ae<Re;Ae++){let Ne=Ae%O,Fe=(Ae+1)%O;if(!k.continuous[Ne]||!k.continuous[Fe]){ae.vertexIndices[ce]=[ue,Ne],ae.vertexIndices.splice(ce+1,0,[Fe,xe]),ae.vertices.splice((ce+1)*2,0,ae.vertices[ce*2],ae.vertices[ce*2+1]);break}}}q.push({bevelI:Y,angle:$,size:H,boundary:ae,reverseMap:re,insetPoints:le})}let Q=(Y,$,H)=>{let le=0,re=Y.boundary.vertexIndices.length;for(;le<re&&H(Y.boundary.vertexIndices[$]);)$=($+1)%re,le++;return le},ee=x.length;for(let Y=1;Y<q.length;Y++){let $=q[Y-1],H=q[Y],le=$.boundary.vertexIndices.length,re=H.boundary.vertexIndices.length;if(!le||!re)break;let te=k.concave.length,ae=0,ce=ug(ae,O);for(;!$.boundary.vertexIndices.filter(ce).length||!H.boundary.vertexIndices.filter(ce).length;)ae++,ce=ug(ae,O);let ue=$.boundary.vertexIndices.findIndex(ce),xe=H.boundary.vertexIndices.findIndex(ce);do ue=(ue+1)%le;while(ce($.boundary.vertexIndices[ue]));do xe=(xe+1)%re;while(ce(H.boundary.vertexIndices[xe]));ae=(ae+1)%O;let Re=ae,Ae=0,Ne=this._buildBevelVert(k,$,(ue-1+le)%le,void 0,Ae),Fe=this._buildBevelVert(k,H,(xe-1+re)%re,void 0,Ae),Ee=Ne,Me=Fe,Xe,We,V=!1;do{Ae=(ae||te)/te,ce=ug(ae,O);let B=Q($,ue,ce),ne=Q(H,xe,ce),Se=V;if(V=!1,B&&!ne){for(let R=0;R<B;R++)Xe=this._buildBevelVert(k,$,(ue+R)%le,R/(B-1),Ae),x.push(Ee.topN,Xe.topP,Me.topN),n===!1&&x.push(Xe.bottomP,Ee.bottomN,Me.bottomN
3141),Ee=Xe;V=!0}else if(!B&&ne)for(let R=0;R<ne;R++)We=this._buildBevelVert(k,H,(xe+R)%re,R/(ne-1),Ae),x.push(Me.topN,Ee.topP,We.topP),n===!1&&x.push(Ee.bottomP,Me.bottomN,We.bottomP),Me=We;else if(B&&ne)if(Xe=this._buildBevelVert(k,$,ue,0,Ae),We=this._buildBevelVert(k,H,xe,0,Ae),Se?(x.push(Ee.topN,We.topP,Me.topN),x.push(Ee.topN,Xe.topP,We.topP),n===!1&&(x.push(We.bottomP,Ee.bottomN,Me.bottomN),x.push(We.bottomP,Xe.bottomP,Ee.bottomN))):(x.push(Me.topN,Ee.topN,Xe.topP),x.push(Me.topN,Xe.topP,We.topP),n===!1&&(x.push(Xe.bottomP,Ee.bottomN,Me.bottomN),x.push(Xe.bottomP,Me.bottomN,We.bottomP))),Ee=Xe,Me=We,B===ne)for(let R=1;R<B;R++)Xe=this._buildBevelVert(k,$,(ue+R)%le,R/(B-1),Ae),We=this._buildBevelVert(k,H,(xe+R)%re,R/(ne-1),Ae),x.push(Ee.topN,Xe.topP,Me.topN),x.push(Me.topN,Xe.topP,We.topP),n===!1&&(x.push(Xe.bottomP,Ee.bottomN,Me.bottomN),x.push(Xe.bottomP,Me.bottomN,We.bottomP)),Ee=Xe,Me=We;else if(B>ne){let R=B/ne,Ce=0;for(let Ue=1;Ue<B;Ue++)Xe=this._buildBevelVert(k,$,(ue+Ue)%le,Ue/(B-1),Ae),x.push(Ee.topN,Xe.topP,Me.topN),n===!1&&x.push(Xe.bottomP,Ee.bottomN,Me.bottomN),Ee=Xe,Ue>(Ce+1)*R&&(Ce++,We=this._buildBevelVert(k,H,(xe+Ce)%re,Ce/(ne-1),Ae),x.push(Me.topN,Xe.topP,We.topP),n===!1&&x.push(Xe.bottomP,Me.bottomN,We.bottomP),Me=We)}else{let R=ne/B,Ce=0;for(let Ue=1;Ue<ne;Ue++)We=this._buildBevelVert(k,H,(xe+Ue)%re,Ue/(ne-1),Ae),x.push(Me.topN,Xe.topP,We.topP),n===!1&&x.push(Xe.bottomP,Me.bottomN,We.bottomP),Me=We,Ue>(Ce+1)*R&&(Ce++,Xe=this._buildBevelVert(k,$,(ue+Ce)%le,Ce/(B-1),Ae),x.push(Ee.topN,Xe.topP,Me.topN),n===!1&&x.push(Xe.bottomP,Ee.bottomN,Me.bottomN),Ee=Xe)}ue=(ue+B)%le,xe=(xe+ne)%re,ae=(ae+1)%te}while(ae!==Re)}if(n===!1&&this._depth>this._bevel*2&&this._buildWall(q,k,x),C){let Y=[];for(let $=x.length-1;$>=ee+2;$-=3){let H=x[$-2],le=x[$-1],re=x[$-0];Y.push(re,le,H)}x.splice(ee,x.length-ee,...Y)}if(C){let Y=[];for(let $=q[q.length-1].boundary.vertices.length-1;$>=1;$-=2){let H=q[q.length-1].boundary.vertices[$-1],le=q[q.length-1].boundary.vertices[$-0];Y.push(H,le)}w.push(Y)}if(!C){let Y=q[q.length-1],$;try{$=Vn({windingRule:q.length>1?jt.POSITIVE:jt.ODD,elementType:Ai.POLYGONS,vertexSize:2,strict:!0,contours:[Y.insetPoints,...w]})}catch{$=WE}if(!$)throw new Error("Error generating geometry for surface");l.length===0&&this._bevel<d&&Object.assign(this,{useNgonForTopBottomFaceDuringBake:!0});for(let H=0;H<$.elementCount*3;H+=3){let le=this._buildSurfaceVert($,$.elements[H+0],G),re=this._buildSurfaceVert($,$.elements[H+1],G),te=this._buildSurfaceVert($,$.elements[H+2],G);x.push(le.top,re.top,te.top),n===!1&&x.push(te.bottom,re.bottom,le.bottom)}}this.vertexCache={}}this._buffer.shrink();let S=new et(Uint32Array.from(x),1),b=new et(this._buffer.positions,3),A=new et(this._buffer.normals,3),_=new et(this._buffer.uvs,2);b.needsUpdate=!0,A.needsUpdate=!0,_.needsUpdate=!0,S.needsUpdate=!0,this.setAttribute("position",b),this.setAttribute("normal",A),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,d={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]=d,d}_buildBevelVert(e,t,i,r=1,s){let a=`${t.bevelI}
3141:${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,d;n!==o?(h=n,l=o,d=!1,c=e.continuous[h]&&e.continuous[l]):(l=n,h=(l-1+e.count)%e.count,d=e.concave[l]&&t.bevelI>0,c=e.continuous[l]||d);let u=Math.cos(t.angle),p=Math.sin(t.angle),f=i*2,g=l*2,m=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[g+0],A=e.normals[g+1],_=e.normals[m+0],E=e.normals[m+1];if(d){let D=_-b,k=E-A;b=b+D*(1-r),A=A+k*(1-r);let W=Math.sqrt(b*b+A*A);b/=W,A/=W}let C=this.forPathBevel?this._buffer.get(c?1:2):this._buffer.get(c?2:4),T=C*3,P=C*2,O={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*u,this._buffer.normals[T+1]=A*u,this._buffer.normals[T+2]=p,this._buffer.uvs[P+0]=w,this._buffer.uvs[P+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*u,this._buffer.normals[T+4]=A*u,this._buffer.normals[T+5]=-p,this._buffer.uvs[P+2]=S,this._buffer.uvs[P+3]=w),c||(this.forPathBevel?(C+=1,T+=3,P+=2):(C+=2,T+=6,P+=4),O.topP=C+0,O.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]=_*u,this._buffer.normals[T+1]=E*u,this._buffer.normals[T+2]=p,this._buffer.uvs[P+0]=w,this._buffer.uvs[P+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]=_*u,this._buffer.normals[T+4]=E*u,this._buffer.normals[T+5]=-p,this._buffer.uvs[P+2]=S,this._buffer.uvs[P+3]=w)),this.vertexCache[a]=O,O}clone(){let e=new p1(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=Uf(this.userData),e}},qE=class extends je{constructor(e,t=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=jt.ODD,this.elementType=Ai.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=e,this._curveSegments=t,this._triangulationOptions=Object.assign({windingRule:jt.ODD,elementType:Ai.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let r=this._shape.extractShapePointsToFlatArray([],this._curveSegments),s=this._shape.shapeHoles.map(u=>u.extractShapePointsToFlatArray([],this._curveSegments)),a,n=!0,o=!0,l,h;for(let u=0,p=r.length/2;u<p;u++){let f=u*2,g=r[f+0],m=r[f+1];if(l!==void 0&&g!==l&&(n=!1),h!==void 0&&m!==h&&(o=!1),l=g,h=m,!n&&!o)break}if(!n&&!o)try{a=Vn({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=u1}let c=(a==null?void 0:a.vertexCount)??1,d=(a==null?void 0:a.elementCount)??1;if(this._positionAttribute=new et(new Float32Array(c*3),3),this._normalAttribute=new et(new Float32Array(c*3),3),this._uvAttribute=new et(new Float32Array(c*2),2),this._indexAttribute=new et(new Uint32Array(d*3),1),a){let u=1/0,p=-1/0,f=1/0,g=-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<u&&(u=S),S>p&&(p=S),b<f&&(f=b),b>g&&(g=b)}let m=p-u,v=g-f;for(let y=0,x=c;y<x;y++){let w=y*2,S=a.vertices[w+0],b=a.vertices[w+1],A=(S-u)/m,_=(b-f)/v;this._positionAttribute.setXYZ(y,S,b,0),this._normalAttribute.setXYZ(y,0,0,1),this._uvAttribute.setXY(y,A,_)}for(let y=0,x=d;y<x;y++){let w=y*3,S=a.elements[w+0],b=a.elements[w+1],A=a.elements[w+2];this._indexAttribute.setX(w+0,S),this._indexAttribute.setX(w+1,b),this._indexAttribute.setX(w+2,A)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,((a==null?void 0:a.elementCount)??1)*3)}clone(){let e=new qE(this._shape,this._curveSegments);return e.userData=Uf(this.userData),e}},XE=class extends p1{constructor(e,t,i=0,r=12,s=3,a=jt.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 XE(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=Uf(this.userData),e}},el=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){var h,c;let i=Object.assign({},(t==null?void 0:t.parameters)??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:jt.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==null?void 0:t.shape),o=(n==null?void 0:n.roundness)??i.roun
vendor: 7,190 bytes, line 3141
3141dness;n!==void 0&&(n instanceof di?(n.width!==r||n.height!==s)&&n.applySize(r,s):n=new di(r,s).fromJSON(n),((h=e.parameters)==null?void 0:h.roundness)!==void 0&&((c=e.parameters)==null?void 0:c.roundness)>0&&n.update());let l=n??new di(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 qE(e.shape,s,{windingRule:n}):o=new XE(e.shape,t,i,s,r,n),Object.assign(o,{userData:{...e,type:"VectorGeometry"}})}},YE=Math.PI*2,f1=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0:t.parameters)??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return i.angle=Oe.clamp(i.angle,0,360),{shape:e.shape&&e.shape instanceof di?e.shape:new di,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,d=i*.5,u=IH(h,c,d,s*Math.PI/180,r,a);h.isClosed=!0,h.update();let p;return s===0?(p=new je,p.setAttribute("position",new De([],3))):p=el.create({shape:h,parameters:{subdivisions:u,depth:n,extrudeBevelSize:o,extrudeBevelSegments:l}}),Object.assign(p,{userData:{...e,type:"EllipseGeometry"}})}};function IH(e,t,i,r,s,a){if(r>=YE)return s>30||s%4===0?(RH(e,t,i,a),Math.round(s/4)):US(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=wH({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?OH(e,n.x,n.y,h,s,t,i,a):US(e,r,s,t,i,a)}function OH(e,t,i,r,s,a,n,o){let l=Math.round(s/r.length);e.addPoint(ih(t,i));for(let h=0,c=r.length;h<c;h++){let d=r[h],u=e.points[h],p=ih(d.x,d.y);u.controls[1].position.set(d.x1,d.y1),p.controls[0].position.set(d.x2,d.y2),e.addPoint(p)}return o>0?QE(e,a,n,o):e.addPoint(ih(0,0)),l}function US(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(ih(h,c))}return t<YE?a>0?QE(e,r,s,a):e.addPoint(ih(0,0)):(e.removePoint(e.points[e.points.length-1]),a>0&&ZE(e,r,s,a)),1}function RH(e,t,i,r=0,s=0,a=0){let n=.5522847498,o=t*n,l=i*n;e.addPoint(Eu(s-t,a,s-t,a-l,s-t,a+l)),e.addPoint(Eu(s,a+i,s-o,a+i,s+o,a+i)),e.addPoint(Eu(s+t,a,s+t,a+l,s+t,a-l)),e.addPoint(Eu(s,a-i,s+o,a-i,s-o,a-i)),r>0&&ZE(e,t,i,r)}function ih(e,t){return new th(Oe.generateUUID(),new j(e,t))}function Eu(e,t,i,r,s,a){let n=ih(e,t);return n.controls[0].position.set(i,r),n.controls[1].position.set(s,a),n}function QE(e,t,i,r){KE(e,t,i,r).forEach(s=>e.addPoint(s))}function ZE(e,t,i,r){let s=KE(e,t,i,r),a=new di;s.forEach(n=>a.addPoint(n)),a.isClosed=!0,e.shapeHoles.push(a)}function KE(e,t,i,r){let s=r*t/100,a=s*(Math.abs(i)/Math.abs(t)),n=new j(s/t,a/i),o=e.points.map(l=>{let h=l.clone();return h.uuid=Oe.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 LH=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0: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:d}=e.parameters,u=new JE(!1,t,i,r,s,a,n,o,l,h,c,d);return Object.assign(u,{userData:{...e,type:"HelixGeometry"}})}},pg=new Zl([0,0,0],1),JE=class extends je{constructor(e=!0,t=1,i=1,r=1,s=1,a=1,n=1,o=1,l=1,h=1,c=1,d=1){if(super(),a===0)return;let u=e&&a===1;u&&(d=0),c>100&&(c=100),c===0&&(d=0);let p=()=>new M,f=new M,g=p(),m=p(),v=p(),y,x,w,S,b,A,_,E,C=p(),T=p(),P=p(),O=p(),D=p(),k=p(),W=p(),N=p(),F=i-2*o+.001,Z=F/a,q=Math.ceil(n*a),G=q+1,Q=F/q,ee=-F/2,Y=h+1,$=2*Math.PI/h,H=Math.PI/2/d,le=.01,re=Math.min((1-c/100)*o,o-le),te=o-re,ae=0,ce=2,ue=d*ce+ce,xe=Y*ue/ce,Re=xe+Y*G,Ae=Math.max(0,Y*(G+ue)),[Ne,Fe,Ee]=[3,3,2].map(de=>Array(Ae*de).fill(0)),Me=[],Xe=s-o;function We(de,Ve){let Le=Math.PI/2;A=Ve*Q,E=2*Math.PI*(A%Z)/Z+Le,A+=ee,_=Math.sin(E)*Xe,b=Math.cos(E)*Xe,e?de.set(b,_,A):de.set(b,A,_)}We(f,-1e-10),We(g,0),C.copy(f),We(f,1);let V=f.distanceTo(g),B=u?0:te+re,ne=V*q+2*B,Se=re,R=ne-B;for(let de=0;de<=q;de++){We(m,de),N.subVectors(m,C).normalize(),C.copy(m),k.copy(m).setComponent(+e+1,0).normalize(),W.crossVectors(N,k).normalize();let Ve=de===0,Le=de===q,qe=Ve?3*Math.PI/2:H,tt=Ve?Se:R,Ye=Ve?Y:Re,Ze=Ve?0:Ae-Y,Wt=N.clone().multiplyScalar(Ve?-te:te).add(m),si=N.clone().multiplyScalar(Ve?-1:1).normalize();for(let K=0;K<Y;K++){let me=K*$;if(T.addVectors(f.copy(k).multiplyScalar(o*Math.cos(me)),g.copy(W).multiplyScalar(o*Math.sin(me))),P.copy(T).normalize(),Ve||Le){u||(ae=Ze+K,[0,1,2].forEach(we=>{Ne[ae*3+we]=Wt.getComponent(we),Fe[ae*3+we]=si.getComponent(we)}),Ee[ae*2]=+Le,Ee[ae*2+1]=K/h),g.copy(P).multiplyScalar(re),v.addVectors(m,g);for(let we=0;we<d;we++){let Be=we*H+qe;O.addVectors(f.copy(N).multiplyScalar(te*Math.sin(Be)),g.copy(P).multiplyScalar(te*Math.cos(Be))),D.copy(O).normalize(),g.addVectors(v,O),O.normalize(),ae=Ye+we*Y+K,[0,1,2].forEach(Mt=>{Ne[ae*3+Mt]=g.getComponent(Mt),Fe[ae*3+Mt]=D.getComponent(Mt)});let at=+Ve+Math.sin(Be);Ee[ae*2]=(tt+te*at)/ne,Ee[ae*2+1]=K/h}}g.addVectors(m,T),ae=xe+de*Y+K,[0,1,2].forEach(we=>{Ne[ae*3+we]=g.getComponent(we),Fe[ae*3+we]=P.getComponent(we)}),Ee[ae*2]=(B+de*V)/ne,Ee[ae*2+1]=K/h}}let Ce=G+2*d+ce,[Ue,Ie]=[+u,Ce-1];for(let de=Ue;de<=Ie-1;de++){let Ve=u&&de===Ie-1;for(let Le=0;Le<Y-1;Le++)y=de*Y+Le,x=y+1,w=(Ve?Le:y)+Y,S=(Ve?Le+1:x)+Y,de===0?Me.push(x,S,w):de===Ce-2?Me.push(y,x,w):Me.push(y,x,w,x,S,w)}this.setIndex(Me),this.setAttribute("position",new De(Ne,3)),this.setAttribute("normal",new De(Fe,3)),this.setAttribute("uv",new De(Ee,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 d=0;d<e.radialSegments;d++)s=h*i+d,a=s+1,n=(c?d:s)+i,o=(c?d+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,pg.array=r,pg.count=r.length,pg}},BH=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0: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)})}}
3141static build(e){let{width:t,height:i,depth:r,detail:s,corner:a,cornerSides:n}=e.parameters,o=s===0&&a!==0?new $E(t*.5,a,n):new KM(t*.5,s);return o.scale(1,i/t,r/t),Object.assign(o,{userData:{...e,type:"IcosahedronGeometry"}})}},$E=class extends h1{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 $E(e.radius,e.corner,e.cornerSides)}},zH=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){var r;(((r=e.parameters)==null?void 0:r.points)??[]).forEach(s=>{Array.isArray(s)&&(s.x=s[0],s.y=s[1])});let i=Object.assign({},(t==null?void 0: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 Dp;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 WM(s.extractPoints(r).shape,i);return a.rotateZ(Math.PI),Object.assign(a,{userData:{...e,type:"LatheGeometry"}})}},Ys=new be,fg=new Ut,Cu=new M,mf=class extends ur{constructor(){super(),this.uuid=Oe.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 Mi().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 Ys.makeRotationX(e),this.applyMatrix4(Ys),this}rotateY(e){return Ys.makeRotationY(e),this.applyMatrix4(Ys),this}rotateZ(e){return Ys.makeRotationZ(e),this.applyMatrix4(Ys),this}translate(e,t,i){return Ys.makeTranslation(e,t,i),this.applyMatrix4(Ys),this}scale(e,t,i){return Ys.makeScale(e,t,i),this.applyMatrix4(Ys),this}lookAt(e){return fg.lookAt(e),fg.updateMatrix(),this.applyMatrix4(fg.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 d=0;d<s.count;d++)t.vertices.push(new M().fromBufferAttribute(s,d)),n!==void 0&&t.colors.push(new $e().fromBufferAttribute(n,d));function h(d,u,p,f){let g=n===void 0?[]:[t.colors[d].clone(),t.colors[u].clone(),t.colors[p].clone()],m=a===void 0?[]:[new M().fromBufferAttribute(a,d),new M().fromBufferAttribute(a,u),new M().fromBufferAttribute(a,p)],v=new O0(d,u,p,m,g,f);t.faces.push(v),o!==void 0&&t.faceVertexUvs[0].push([new j().fromBufferAttribute(o,d),new j().fromBufferAttribute(o,u),new j().fromBufferAttribute(o,p)]),l!==void 0&&t.faceVertexUvs[1].push([new j().fromBufferAttribute(l,d),new j().fromBufferAttribute(l,u),new j().fromBufferAttribute(l,p)])}let c=e.groups;if(c.length>0)for(let d=0;d<c.length;d++){let u=c[d],p=u.start,f=u.count;for(let g=p,m=p+f;g<m;g+=3)i!==void 0?h(i.getX(g),i.getX(g+1),i.getX(g+2),u.materialIndex):h(g,g+1,g+2,u.materialIndex)}else if(i!==void 0)for(let d=0;d<i.count;d+=3)h(i.getX(d),i.getX(d+1),i.getX(d+2));else for(let d=0;d<s.count;d+=3)h(d,d+1,d+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(Cu).negate(),this.translate(Cu.x,Cu.y,Cu.z),this}normalize(){this.computeBoundingSphere();let e=this.boundingSphere.center,t=this.boundingSphere.radius,i=t===0?1:1/t,r=new be;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];
3141r.__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 mf;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];
3141r.normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals}}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new xi),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Hr),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 Mi().getNormalMatrix(t));for(let d=0,u=n.length;d<u;d++){let p=n[d].clone();t!==void 0&&p.applyMatrix4(t),a.push(p)}for(let d=0,u=c.length;d<u;d++)h.push(c[d].clone());for(let d=0,u=l.length;d<u;d++){let p=l[d],f,g,m=p.vertexNormals,v=p.vertexColors,y=new O0(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=m.length;x<w;x++)f=m[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++)g=v[x],y.vertexColors.push(g.clone());y.materialIndex=p.materialIndex+i,o.push(y)}for(let d=0,u=e.faceVertexUvs.length;d<u;d++){let p=e.faceVertexUvs[d];this.faceVertexUvs[d]===void 0&&(this.faceVertexUvs[d]=[]);for(let f=0,g=p.length;f<g;f++){let m=p[f],v=[];for(let y=0,x=m.length;y<x;y++)v.push(m[y].clone());this.faceVertexUvs[d].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 d=0;d<3;d++)if(c[d]===c[(d+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],g=!0,m=!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,g),b=h(b,2,m),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 A=this.faceVertexUvs[0][p];i.push(u(A[0]),u(A[1]),u(A[2]))}if(y&&i.push(c(f.normal)),x){let A=f.vertexNormals;i.push(c(A[0]),c(A[1]),c(A[2]))}if(w&&i.push(d(f.color)),S){let A=f.vertexColors;i.push(d(A[0]),d(A[1]),d(A[2]))}}function h(p,f,g){return g?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 d(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 u(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 mf().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 d=0,u=t.length;d<u;d++)this.vertices.push(t[d].clone());let i=e.colors;for(let d=0,u=i.length;d<u;d++)this.colors.push(i[d].clone());let r=e.faces;for(let d=0,u=r.length;d<u;d++)this.faces.push(r[d].clone());for(let d=0,u=e.faceVertexUvs.length;d<u;d++){let p=e.faceVertexUvs[d];this.faceVertexUvs[d]===void 0&&(this.faceVertexUvs[d]=[]);for(let f=0,g=p.length;f<g;f++){let m=p[f],v=[];for(let y=0,x=m.length;y<x;y++){let w=m[y];v.push(w.clone())}this.faceVertexUvs[d].push(v)}}let s=e.morphTargets;for(let d=0,u=s.length;d<u;d++){let p={};if(p.name=s[d].name,s[d].vertices!==void 0){p.vertices=[];for(let f=0,g=s[d].vertices.length;f<g;f++)p.vertices.push(s[d].vertices[f].clone())}if(s[d].normals!==void 0){p.normals=[];for(let f=0,g=s[d].normals.length;f<g;f++)p.normals.push(s[d].normals[f].clone())}this.morphTargets.push(p)}let a=e.morphNormals;for(let d=0,u=a.length;d<u;d++){let p={};if(a[d].vertexNormals!==void 0){p.vertexNormals=[];for(let f=0,g=a[d].vertexNormals.length;f<g;f++){let m=a[d].vertexNormals[f],v={};v.a=m.a.clone(),v.b=m.b.clone(),v.c=m.c.clone(),p.vertexNormals.push(v)}}if(a[d].faceNormals!==void 0){p.faceNormals=[];for(let f=0,g=a[d].faceNormals.length;f<g;f++)p.faceNormals.push(a[d].faceNormals[f].clone())}this.morphNormals.push(p)}let n=e.skinWeights;for(let d=0,u=n.length;d<u;d++)this.skinWeights.push(n[d].clone());let o=e.skinIndices;for(let d=0,u=o.length;d<u;d++)this.skinIndices.push(o[d].clone());let l=e.lineDistances;for(let d=0,u=l.length;d<u;d++)this.lineDistances.push(l[d]);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 FH().fromGeometry(this),t=new je,i=new Float32Array(e.vertices.length*3);if(t.setAttribute("position",Tu.call(new et(i,3),e.vertices)),e.normals.length>0){let r=new Float32Array(e.normals.length*3);t.setAttribute("normal",Tu.call(new et(r,3),e.normals))}if(e.colors.length>0){let r=new Float32Array(e.colors.length*3);t.setAttribute("color",NS.call(new et(r,3),e.colors))}if(e.uvs.length>0){let r=new Float32Array(e.uvs.length*2);t.setAttribute("uv",VS.call(new et(r,2),e.uvs))}if(e.uvs2.length>0){let r=new Float32Array(e.uvs2.length*2);t.setAttribute("uv2",VS.call(new et(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(Tu.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",jS.call(r,e.skinIndices))}if(e.skinWeights.length>0){let r=new De(e.skinWeights.length*4,4);t.setAttribute("skinWeight",jS.call(r,e.skinWeights))}
3141return 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 je,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",Tu.call(r,i.vertices)),t.setAttribute("color",NS.call(s,i.colors)),i.lineDistances&&i.lineDistances.length===i.vertices.length){let a=new De(i.lineDistances.length,1);t.setAttribute("lineDistance",kH.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}};mf.prototype.isGeometry=!0;var FH=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 m=0;m<o;m++)l[m]={name:n[m].name,data:[]};this.morphTargets.position=l}let h=e.morphNormals,c=h.length,d;if(c>0){d=[];for(let m=0;m<c;m++)d[m]={name:h[m].name,data:[]};this.morphTargets.normal=d}let u=e.skinIndices,p=e.skinWeights,f=u.length===i.length,g=p.length===i.length;i.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let m=0;m<t.length;m++){let v=t[m];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][m];w!==void 0?this.uvs.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",m),this.uvs.push(new j,new j,new j))}if(a===!0){let w=r[1][m];w!==void 0?this.uvs2.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",m),this.uvs2.push(new j,new j,new j))}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[m];d[w].data.push(S.a,S.b,S.c)}f&&this.skinIndices.push(u[v.a],u[v.b],u[v.c]),g&&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}},O0=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 $e,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 kH(e){return this.array.set(e),this}function NS(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 $e),t[i++]=a.r,t[i++]=a.g,t[i++]=a.b}return this}function VS(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 j),t[i++]=a.x,t[i++]=a.y}return this}function Tu(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 jS(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 ht),t[i++]=a.x,t[i++]=a.y,t[i++]=a.z,t[i++]=a.w}return this}var UH=["a","b","c"];function NH(e,t){switch(t){case"c":return e.c;case"b":return e.b;case"a":default:return e.a}}function mg(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],d=i[o];h={a:c,b:d,newEdge:null,faces:[]},r.set(l,h)}h.faces.push(s),a[e].edges.push(h),a[t].edges.push(h)}function VH(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 Pu(e,t,i,r,s){e.push(new O0(t,i,r,void 0,void 0,s))}function _l(e,t){return Math.abs(t-e)/2+Math.min(e,t)}function Du(e,t,i,r){e.push([t.clone(),i.clone(),r.clone()])}var jH=class{constructor(e=1){this.subdivisions=e}modify(e){e instanceof je?e=new mf().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,d=[],u=new Map;VH(o,l,d,u);let p=[],f,g,m,v,y,x,w;for(let le of Array.from(u.keys())){for(g=u.get(le),m=new M,y=3/8,x=1/8,w=g.faces.length,w!=2&&(y=.5,x=0,w!=1),m.addVectors(g.a,g.b).multiplyScalar(y),t.set(0,0,0),a=0;a<w;a++){for(v=g.faces[a],n=0;n<3&&(f=o[NH(v,UH[n])],!(f!==g.a&&f!==g.b));n++);f&&t.add(f)}t.multiplyScalar(x),m.add(t),g.newEdge=p.length,p.push(m)}let S,b,A,_,E,C,T,P=[];for(r=0,s=o.length;r<s;r++){for(C=o[r],E=d[r].edges,i=E.length,i==3?S=3/16:i>3&&(S=3/(8*i)),b=1-i*Number(S),A=S,i<=2&&(i==2?(b=3/4,A=1/8):i==1||i==0),T=C.clone().multiplyScalar(b),t.set(0,0,0),a=0;a<i;a++)_=E[a],f=_.a!==C?_.a:_.b,t.add(f);t.multiplyScalar(Number(A)),T.add(t),P.push(T)}let O=P.concat(p),D=P.length,k,W,N,F=[],Z=[],q,G,Q,ee,Y=new j,$=new j,H=new j;for(r=0,s=l.length;r<s;r++)v=l[r],k=Number(mg(v.a,v.b,u).newEdge)+D,W=Number(mg(v.b,v.c,u).newEdge)+D,N=Number(mg(v.c,v.a,u).newEdge)+D,Pu(F,k,W,N,v.materialIndex),Pu(F,v.a,k,N,v.materialIndex),Pu(F,v.b,W,k,v.materialIndex),Pu(F,v.c,N,W,v.materialIndex),c&&(q=h[r],G=q[0],Q=q[1],ee=q[2],Y.set(_l(G.x,Q.x),_l(G.y,Q.y)),$.set(_l(Q.x,ee.x),_l(Q.y,ee.y)),H.set(_l(G.x,ee.x),_l(G.y,ee.y)),Du(Z,Y,$,H),Du(Z,G,Y,H),Du(Z,Q,$,Y),Du(Z,ee,H,$));e.vertices=O,e.faces=F,c&&(e.faceVertexUvs[0]=Z)}},Oi=new M,GH=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=e.geometry??(t==null?void 0:t.geometry)??new je().copy(new ks(100,100,100)),r;t===void 0?(i.computeBoundingBox(),i.boundingBox.getSize(Oi),r={width:Oi.x,height:Oi.y,depth:Oi.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 je().copy(new ks(100,100,100)),n=a.userData.parameters;n===void 0?(a.computeBoundingBox(),a.boundingBox.getSize(Oi)):Oi.set(n.width,n.height,n.depth),(t!==Oi.x||i!==Oi.y||r!==Oi.z)&&a.scale(Oi.x===0?1:t/Oi.x,Oi.y===0?1:i/Oi.y,Oi.z===0?1:r/Oi.z);let o=a.originalGeometry;try{s>0?(o===void 0||(n==null?void 0:n.subdivisions)!==s)&&(o===void 0&&(o=a),a=new jH(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 n2(i).load(e,r=>{let s=this.normalizeInputs({geometry:r});r.boundingBox.getSize(Oi);let a=100/Oi.x;
vendor: 26,688 bytes, lines 3141-3142
3141Object.assign(s.parameters,{width:100,height:Oi.y*a,depth:Oi.z*a}),t(this.build(s))})}},eC=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0:t.parameters)??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},e.parameters);return{shape:e.shape&&e.shape instanceof di?e.shape:new di,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,d=0,u=0,p=2*Math.PI/r;for(let g=0;g<r;g++){let m=p*g,v=d+Math.sin(m)*h,y=u+Math.cos(m)*c;l.addPoint(l.createPoint(v,y))}l.isClosed=!0;for(let g=0,m=l.points.length;g<m;g++)l.points[g].roundness=s;l.roundness=s,l.update();let f=el.create({shape:l,parameters:{roundness:s,depth:a,extrudeBevelSize:n,extrudeBevelSegments:o}});return Object.assign(f,{userData:{...e,type:"PolygonGeometry"}})}},HH=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0: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 qH(t*.5,i,s,a,n,o,l);return h.scale(1,1,r/t),Object.assign(h,{userData:{...e,type:"PyramidGeometry"}})}};function oc(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}function vg(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 WH(e,t,i){let r=e.clone().sub(t),s=i.clone().sub(t);return r.projectOnVector(s),r.add(t)}var qH=class extends je{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=[],d=0,u=t/2,p=Math.PI/i,f=e*Math.cos(Math.PI/i),g=2*Math.PI/i,m=(i-2)*Math.PI/i,v=Math.PI-m,y=new M(0,-u,0),x=new M(0,u,0),w=new j(e,-u),S=new j(f,-u),b=new j(0,x.y).sub(S),A=new j(0,x.y).sub(w),_=new j(b.y,-b.x).normalize(),E=new j(A.y,-A.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 N=new M(_.x,_.y,0),F=new M(Math.cos(g)*N.x,N.y,Math.sin(g)*N.x);T=N.angleTo(F)}let P=a/Math.tan((Math.PI-b.angle())/2),O=a/Math.tan((Math.PI-T)/2),D=new M;if(!s){l.push(y.x,y.y,y.z),h.push(0,-1,0),c.push(0,0);let N=d++,F=[],Z=w.clone(),q=P/Math.cos(Math.PI/i);Z.x-=q;for(let G=0;G<i;G++){let Q=G/i*Math.PI*2+p,ee=new j(Math.sin(Q),Math.cos(Q));oc(Z,ee,D),l.push(D.x,D.y,D.z),h.push(0,-1,0),c.push(0,0),F.push(d++)}for(let G=0;G<F.length;G++)o.push(F[G],N,F[(G+1)%F.length])}{let N=new M,F=new M,Z=new M,q=new M,G=new M,Q=new M;for(let ee=0;ee<i;ee++){let Y=ee/i*Math.PI*2+p,$=(ee+.5)/i*Math.PI*2+p,H=(ee+1)/i*Math.PI*2+p,le=new j(Math.sin(Y),Math.cos(Y)),re=new j(Math.sin($),Math.cos($)),te=new j(Math.sin(H),Math.cos(H));oc(w,le,F),oc(w,te,Z),oc(_,re,N),vg(x,F,Z,O,O,q),l.push(q.x,q.y,q.z),vg(F,x,Z,O,P,G),l.push(G.x,G.y,G.z),vg(Z,F,x,P,O,Q),l.push(Q.x,Q.y,Q.z),h.push(N.x,N.y,N.z),h.push(N.x,N.y,N.z),h.push(N.x,N.y,N.z),c.push(0,0),c.push(0,0),c.push(0,0);let ae=d++,ce=d++,ue=d++;if(o.push(ae,ce,ue),a>0){{let Ae=F.clone().add(Z).multiplyScalar(.5),Ne=x.clone().sub(Ae).normalize(),Fe=y.clone().sub(Ae).normalize().add(Ne).normalize().multiplyScalar(-1),Ee=Q.clone().sub(G);k(Ae,Ee,Fe,b.angle())}let xe,Re;{let Ae=new M;oc(E,te,Ae);let Ne=Q.clone().add(q).multiplyScalar(.5);Ne=WH(Ne,Z,x);let Fe=Q.clone().sub(q);[xe,Re]=k(Ne,Fe,Ae,T,q.y)}{let Ae=xe,Ne=Ae.clone().setY(0).normalize(),Fe=new M(0,-1,0),Ee=Ne.clone().cross(Fe);W(Ae,Ne,Fe,Ee)}{let Ae=b.angle(),Ne=Math.PI-Ae,Fe=x.clone();Fe.y-=a/Math.sin(Ae-Math.PI/2);let Ee=new M,Me=[];for(let We=0;We<n;We++){let V=[],B=Math.PI/2-Ne*We/n,ne=Math.cos(B),Se=Math.sin(B),R=$;for(let Ce=0;Ce<=We;Ce++){let Ue=Math.cos(R),Ie=Math.sin(R);N.x=ne*Ie,N.y=Se,N.z=ne*Ue,Ee.copy(Fe).addScaledVector(N,a),l.push(Ee.x,Ee.y,Ee.z),h.push(N.x,N.y,N.z),c.push(0,0),V.push(d++),R+=Math.PI*2/We/i}Me.push(V)}Re.reverse(),Me.push(Re);let Xe=Me.length-1;for(let We=0;We<Xe;We++){let V=Me[We],B=Me[We+1],ne=V.length-1;o.push(B[1],V[0],B[0]);for(let Se=1;Se<=ne;Se++)o.push(V[Se],V[Se-1],B[Se]),o.push(B[Se+1],V[Se],B[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(N,F,Z,q,G){let Q=-q/2,ee=(Math.PI-q)/2,Y=F.clone().normalize().cross(Z);N.addScaledVector(Z,-a/Math.sin(ee));let $=new M,H=new M,le=1,re=d,te=[];for(let ae=0;ae<=n;ae++){let ce=Q+ae/n*q;H.set(0,0,0),H.addScaledVector(Y,Math.sin(ce)),H.addScaledVector(Z,Math.cos(ce));for(let ue=0;ue<=le;ue++){let xe=ue/le-.5;if($.copy(N),$.addScaledVector(F,xe),$.addScaledVector(H,a),G!=null){let Re=Math.max(0,$.y-G);$.addScaledVector(F,-Re/F.y)}l.push($.x,$.y,$.z),h.push(H.x,H.y,H.z),c.push(0,0),ue===0&&te.push(d),d++}}for(let ae=0;ae<n;ae++)for(let ce=0;ce<le;ce++){let ue=re+ce+(le+1)*ae,xe=ue+(le+1),Re=xe+1,Ae=ue+1;o.push(ue,xe,Ae),o.push(xe,Re,Ae)}return[N.clone().addScaledVector(F,.5),te]}function W(N,F,Z,q){let G=Math.PI/2,Q=A.angle()-G,ee=[],Y=new M,$=new M;for(let le=0;le<=n;le++){let re=[],te=le/n;for(let ae=0;ae<=le;ae++){let ce=((le?ae/le:0)-.5)*v,ue=Math.cos(ce),xe=Math.sin(ce),Re=Math.atan(Math.tan(Q)*ue),Ae=(G+Re)*te,Ne=Math.cos(Ae),Fe=Math.sin(Ae);Y.set(0,0,0),Y.addScaledVector(F,Fe*ue),Y.addScaledVector(Z,Ne),Y.addScaledVector(q,Fe*xe),$.copy(N).addScaledVector(Y,a),l.push($.x,$.y,$.z),h.push(Y.x,Y.y,Y.z),c.push(0,0),re.push(d++)}ee.push(re)}let H=ee.length-1;for(let le=0;le<H;le++){let re=ee[le],te=ee[le+1],ae=re.length-1;o.push(re[0],te[1],te[0]);for(let ce=1;ce<=ae;ce++)o.push(re[ce-1],re[ce],te[ce]),o.push(re[ce],te[ce+1],te[ce])}}}},m1=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0:t.parameters)??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters),r=Object.assign((t==null?void 0:t.ui)??{enabledIndieCorners:!1},e.ui);return{shape:e.shape&&e.shape instanceof di?e.shape:new di,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},d={x:h.x,y:h.y};function u(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:u(s[0],s[0]+s[3],s[0]+s[1]),p[1]=s[1]===0?0:u(s[1],s[1]+s[2],s[1]+s[0]),p[2]=s[2]===0?0:u(s[2],s[2]+s[1],s[2]+s[3]),p[3]=s[3]===0?0:u(s[3],s[3]+s[0],s[3]+s[2]);let f=c.x,g=d.x,m=d.y,v=c.y;t.addPoint(t.createPoint(f,m)),t.addPoint(t.createPoint(g,m)),t.addPoint(t.createPoint(g,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=el.create({shape:t,parameters:{depth:n,extrudeBevelSize:o,extrudeBevelSegments:l}});return Object.assign(x,{userData:{...e,type:"RectangleGeometry"}})}},XH=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0:t.parameters)??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},e.parameters);return i.thetaLength=Oe.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 je,c.setAttribute("position",new De([],3))):c=new Kl(.5*t,s,a,n,o,l,h*Oe.DEG2RAD),c.scale(1,i/t,r/t),Object.assign(c,{userData:{...e,type:"SphereGeometry"}})}},YH=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0: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 ga(t,i,r,s);return a.scale(1,1,1),Object.assign(a,{userData:{...e,type:"PlaneGeometry"}})}},QH=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0: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 ZH(t,i,r,s,a,n);return Object.assign(o,{userData:{...e,type:"BackdropGeometry"}})}},ZH=class extends je{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=[],d=Math.PI/2,u=(le=0,re=0,te=0)=>new M(le,re,te),p=u(),f=u(),[g,m,v]=[t/2,e/2,i/2],y=-m,x=+m,[w,S,b]=[u(y,-g,+v),u(y,-g,-v),u(y,+g,-v)],A=(le,re=!1)=>Math.sin(le-Math.PI/(1+ +re)),_=(le,re=!1)=>Math.cos(le-Math.PI/(1+ +re));b.y=Math.sin(r)*t-g;let E=Math.cos(r)*t-v,C=w.z-h;r<=d?(b.z=Math.min(E,C),b.z==C&&(b.y-=(E-C)/Math.tan(d-r))):S.z=Math.min(S.z-E-v,w.z-h),p.subVectors(w,S),f.subVectors(b,S);let T=Math.min(p.length(),f.length())*s/100,P=T*Math.tan(r/2),O=T/Math.cos(r/2),D=p.clone().normalize().add(f.normalize()).setLength(O).add(S);p.set(0,A(r,!0),_(r,!0)),c.push([b,p.clone()]);let k=(Math.PI-r)/a;for(let le=0;le<=a;le++){let re=d+r+le*k;p.set(0,Math.sin(re)*P,Math.cos(re)*P),p.add(D),f.set(0,A(re),_(re)),c.push([p.clone(),f.clone()])}c.push([w,u(0,1,0)]);let W=Math.sin(k/2)*P*2,N=c.length-1,F=c[0][0].distanceTo(c[1][0]),Z=c[N-1][0].distanceTo(c[N][0]),q=F+W*a+Z;c[0].push(1);for(let le=0;le<=a;le++)c[le+1].push(1-(F+le*W)/q);c[N].push(0);let[G,Q,ee]=c[0],Y,$,H;for(let le=1;le<c.length;le++)[Y,$,H]=c[le],n.push(y,G.y,G.z,y,Y.y,Y.z,x,G.y,G.z,x,G.y,G.z,y,Y.y,Y.z,x,Y.y,Y.z),o.push(0,Q.y,Q.z,0,$.y,$.z,0,Q.y,Q.z,0,Q.y,Q.z,0,$.y,$.z,0,$.y,$.z),l.push(0,ee,0,H,1,ee,1,ee,0,H,1,H),[G,Q,ee]=[Y,$,H];this.setAttribute("position",new De(n,3)),this.setAttribute("normal",new De(o,3)),this.setAttribute("uv",new De(l,2))}},tC=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0: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 di?e.shape:new di,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,d=t*.5,u=i*.5,p=0,f=0,g=n*Math.PI/360/s,m=Math.PI/2*3*-1,v=d*r/100,y=u*r/100;if(s===3&&r===50){g=2*Math.PI/s;for(let w=0;w<s;w++){let S=g*w,b=p+Math.sin(S)*d,A=f+Math.cos(S)*u;c.addPoint(c.createPoint(b,A))}}else for(let w=0;w<s;w++){let S=p+Math.cos(m)*d,b=f+Math.sin(m)*u;c.addPoint(c.createPoint(S,b)),m+=g,S=p+Math.cos(m)*v,b=f+Math.sin(m)*y,c.addPoint(c.createPoint(S,b)),m+=g}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=el.create({shape:c,parameters:{roundness:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}});return Object.assign(x,{userData:{...e,type:"StarGeometry"}})}},KH=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0: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 ga(t,i);return Object.assign(r,{userData:{...e,type:"TextFrameGeometry"}})}},JH=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0: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=$H(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 $H(e,t,i,r,s,a,n,o,l,h,c){[t,i]=[i,t],n=t/2;let d=Oe.clamp(s/360,0,1);if(d===0){let u=new je;return u.setAttribute("position",new De([],3)),u}return d===1&&(h=0),new JE(!0,e,t,i,r,d,a,n,o,l,h,c)}var eW=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0: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 $M(o,i,r,s,a,n);return Object.assign(l,{userData:{...e,type:"TorusKnotGeometry"}})}},tW=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0: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 di?e.shape:new di,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 u=0,p=l.points.length;u<p;u++)l.points[u].roundness=r;l.roundness=r,l.update();let d=el.create({shape:l,parameters:{roundness:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:n}});return Object.assign(d,{userData:{...e,type:"TriangleGeometry"}})}};function iW(e,t){let i=2*Math.PI;return(e%i+i)%i===(t%i+i)%i}function rW(e){return/^(rgba)?\(\s*(\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\s*\)$/.exec(e.toLowerCase())}function sW(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;case 5:default:r=i,s=l,a=h;break}return{r:r*255,g:s*255,b:a*255}}function aW(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 nW(e){return e=Math.floor(e),{r:e>>16&255,g:e>>8&255,b:e&255}}function oW(e,t,i){return(e<<16)+(t<<8)+i}function lW(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 hW(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 cW={parseRgba:rW,hsvToRgb:sW,rgbToHsv:aW,hexToRgb:nW,rgbToHex:oW,rgbToHexString:lW,hexStringToRgb:hW},dW=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)})}},uW=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)})}},pe=class{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+pe.version}static addUnaryOp(e){return pe.max_unop_len=Math.max(e.length,pe.max_unop_len),pe.unary_ops[e]=1,pe}static addBinaryOp(e,t,i){return pe.max_binop_len=Math.max(e.length,pe.max_binop_len),pe.binary_ops[e]=t,i?pe.right_associative.add(e):pe.right_associative.delete(e),pe}static addIdentifierChar(e){return pe.additional_identifier_chars.add(e),pe}static addLiteral(e,t){return pe.literals[e]=t,pe}static removeUnaryOp(e){return delete pe.unary_ops[e],e.length===pe.max_unop_len&&(pe.max_unop_len=pe.getMaxKeyLen(pe.unary_ops)),pe}static removeAllUnaryOps(){return pe.unary_ops={},pe.max_unop_len=0,pe}static removeIdentifierChar(e){return pe.additional_identifier_chars.delete(e),pe}static removeBinaryOp(e){return delete pe.binary_ops[e],e.length===pe.max_binop_len&&(pe.max_binop_len=pe.getMaxKeyLen(pe.binary_ops)),pe.right_associative.delete(e),pe}static removeAllBinaryOps(){return pe.binary_ops={},pe.max_binop_len=0,pe}static removeLiteral(e){return delete pe.literals[e],pe}static removeAllLiterals(){return pe.literals={},pe}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 pe(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 pe.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!pe.binary_ops[String.fromCharCode(e)]||pe.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return pe.isIdentifierStart(e)||pe.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(pe.hooks[e]){let i={context:this,node:t};return pe.hooks.run(e,i),i.node}return t}searchHook(e){if(pe.hooks[e]){let t={context:this};return pe.hooks[e].find(function(i){return i.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===pe.SPACE_CODE||e===pe.TAB_CODE||e===pe.LF_CODE||e===pe.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:pe.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===pe.SEMCOL_CODE||i===pe.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,pe.max_binop_len),t=e.length;for(;t>0;){if(pe.binary_ops.hasOwnProperty(e)&&(!pe.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!pe.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:pe.binaryPrecedence(t),right_a:pe.right_associative.has(t)},n=this.gobbleToken(),n||this.throwError("Expected expression after "+t),r=[a,s,n];t=this.gobbleBinaryOp();){if(i=pe.binaryPrecedence(t),i===0){this.index-=t.length;break}s={value:t,prec:i,right_a:pe.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:pe.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:pe.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,pe.isDecimalDigit(e)||e===pe.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===pe.SQUOTE_CODE||e===pe.DQUOTE_CODE)r=this.gobbleStringLiteral();else if(e===pe.OBRACK_CODE)r=this.gobbleArray();else{for(t=this.expr.substr(this.index,pe.max_unop_len),i=t.length;i>0;){if(pe.unary_ops.hasOwnProperty(t)&&(!pe.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!pe.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:pe.UNARY_EXP,operator:t,argument:s,prefix:!0})}t=t.substr(0,--i)}pe.isIdentifierStart(e)?(r=this.gobbleIdentifier(),pe.literals.hasOwnProperty(r.name)?r={type:pe.LITERAL,value:pe.literals[r.name],raw:r.name}:r.name===pe.this_str&&(r={type:pe.THIS_EXP})):e===pe.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===pe.PERIOD_CODE||t===pe.OBRACK_CODE||t===pe.OPAREN_CODE||t===pe.QUMARK_CODE;){let i;if(t===pe.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==pe.PERIOD_CODE)break;i=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===pe.OBRACK_CODE?(e={type:pe.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()},this.gobbleSpaces(),t=this.code,t!==pe.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===pe.OPAREN_CODE?e={type:pe.CALL_EXP,arguments:this.gobbleArguments(pe.CPAREN_CODE),callee:e}:(t===pe.PERIOD_CODE||i)&&(i&&this.index--,this.gobbleSpaces(),e={type:pe.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(;pe.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);if(this.code===pe.PERIOD_CODE)for(e+=this.expr.charAt(this.index++);pe.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++));pe.isDecimalDigit(this.code);)e+=this.expr.charAt(this.index++);pe.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+e+this.char+")")}return i=this.code,pe.isIdentifierStart(i)?this.throwError("Variable names cannot start with a number ("+e+this.char+")"):(i===pe.PERIOD_CODE||e.length===1&&e.charCodeAt(0)===pe.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:pe.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+=`
3142`;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:pe.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(pe.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,pe.isIdentifierPart(e));)this.index++;return{type:pe.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===pe.CPAREN_CODE&&r&&r>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}else if(s===pe.COMMA_CODE){if(this.index++,r++,r!==t.length){if(e===pe.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===pe.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===pe.COMPOUND)&&this.throwError("Expected comma"),t.push(a)}}return i||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(pe.CPAREN_CODE);if(this.code===pe.CPAREN_CODE)return this.index++,e.length===1?e[0]:e.length?{type:pe.SEQUENCE_EXP,expressions:e}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:pe.ARRAY_EXP,elements:this.gobbleArguments(pe.CBRACK_CODE)}}},pW=new dW;Object.assign(pe,{hooks:pW,plugins:new uW(pe),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"});pe.max_unop_len=pe.getMaxKeyLen(pe.unary_ops);pe.max_binop_len=pe.getMaxKeyLen(pe.binary_ops);var _h=e=>new pe(e).parse(),fW=Object.getOwnPropertyNames(pe);
3142fW.forEach(e=>{_h[e]===void 0&&e!=="prototype"&&(_h[e]=pe[e])});_h.Jsep=pe;var mW="ConditionalExpression",gW={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:mW,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 :")}})}};_h.plugins.register(gW);function Xf(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 iC=class{constructor(e,t,i){var r;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(s=>s()),this.emitter=Xf(),this._innerCallUserAPI=async s=>{var a,n,o;this.emitter.emit("start",{userAPIId:this.id}),this.isLoading=!0,this.isLoading=!1;try{this.result=await wW(this.userAPI,s),this.error="null",this.emitter.emit("success",{userAPIId:this.id})}catch(l){let h=((o=(n=(a=l.message)==null?void 0:a.split("_:_"))==null?void 0:n[0])==null?void 0:o.replace("status:",""))??"null";this.error=h,this.result=null,this.emitter.emit("error",{userAPIId:this.id})}this.isLoading=!1,this.isPrefetched=!0,this.isLoaded=!0},((r=t==null?void 0:t.integration)==null?void 0:r.type)==="OpenAI"?this.result={content:""}:t.method==="GET"&&t.url!==""&&(this.prefetchPromise=this.prefetch(i)),this._debouncedCallUserAPI=this._innerCallUserAPI,this._updateDebouncedCallUserAPI(),this._debouncedPrefetch=ed(this.prefetch,1e3,{trailing:!0})}_updateDebouncedCallUserAPI(){this._debouncedCallUserAPI=this.userAPI.debounce!==void 0&&this.userAPI.debounce>0?ed(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 Fi.zoom(this.result,e)}catch(t){console.error(t)}}retrieveZoomedKeyValues(e){if(this.result){let t=e&&e.length?Fi.zoom(this.result,e):this.result;if(bW(t))return Object.entries(t);if(xW(t))return t.map((i,r)=>[r.toString(),i]);throw yW(t)?new Error("This path points to a value, use retrieveValue() instead. "+(e==null?void 0:e.join("."))):new Error("Path error"+(e==null?void 0: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 vW(e){let t=new Headers;return e.headers.forEach(i=>{i.data.key!==""&&t.append(i.data.key,i.data.value)}),t}function yW(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e===null}function xW(e){return Array.isArray(e)}function bW(e){return typeof e=="object"&&e!==null}async function wW(e,t,i=new AbortController){var l,h,c,d;let r,s=e.url,a=((l=e.proxy)==null?void 0:l.enabled)??!1,n;if(((h=e.integration)==null?void 0:h.type)==="OpenAI"){let u=Ac(e.integration.prompt===""?[]:JSON.parse(e.integration.prompt),t),p=e.integration.behavior===""?[]:Ac(JSON.parse(e.integration.behavior),t);n=`{
3143		"model": "${e.integration.model}",
3144		"messages": [${e.integration.useBehavior?`
3145		{
3146			"role": "system",
3147			"content": "${p}"
3148		},`:""}
3149		{
3150			"role": "user",
3151			"content": "${u}"
3152		}
3153		]
3154	}`}if(a){s=`https://apis.spline.design/file/${e.proxy.fileId}/external-api/request?uuidexternalapi=${e.proxy.proxyId}`;let u;n!==void 0?u=n:e.method==="POST"&&e.body&&(u=Ac(JSON.parse(e.body),t)),u!==void 0&&(s+=`&data=${encodeURIComponent(u.replace(/(\r\n|\n|\r|\t)/gm,""))}`)}else((c=e.integration)==null?void 0:c.type)==="OpenAI"?r=n:e.method==="POST"&&e.body&&(r=Ac(JSON.parse(e.body),t));let o=await fetch(s,{method:a?"GET":e.method,headers:a?void 0:vW(e),signal:i.signal,body:r});if(!o.ok)throw new Error("status:"+o.status+"_:_"+o.statusText);if(((d=e.integration)==null?void 0:d.type)==="OpenAI"){let u=await o.json();return a&&(u=u.response),{content:u.choices[0].message.content}}else{let u=await o.json();return a&&(u=u.response),u}}var rC=(e,t)=>{if(typeof e=="string"){let i=t.getVariable(e);if(i)return rC(i,t)}return hr.isBoolean(e)?hr.getDisplayedValue(e).toLowerCase():hr.getDisplayedValue(e)},Ac=(e,t)=>e.map((i,r)=>{if("text"in i)return i.text;if("type"in i){if(i.type==="paragraph")return(r>0?`
3155`:"")+Ac(i.children,t);
vendor: 6,474 bytes, line 3155
3155if(i.type==="variable"){let s=t.getVariable(i.variableId);if(s!==void 0)return rC(s,t)}}return""}).join(""),SW=["+","-","*","/","(",")","==","!=",">","<",">=","<=","and","or","!","%","^",","],_W=["0","1","2","3","4","5","6","7","8","9","."],AW=["sin","cos","tan","asin","acos","atan","atan2","sqrt","abs","log","exp","floor","ceil","round","min","max","random"];function MW(e){return typeof e!="string"?!1:!isNaN(e)&&!isNaN(parseFloat(e))}_h.addBinaryOp("^",11,!0);function sC(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 iC){let d=c.retrieveValue(l.slice(1));d!==void 0&&(r+=d)}continue}if("objType"in o&&o.objType==="webhook"){let l=JSON.parse(o.id),[h,c]=l,d=t.getUserWebhook(h);if(d!==void 0){let u=d.getParameterValue(c);u!==void 0&&(r+=u)}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,d)=>{var p;let u=(p=d.events)==null?void 0:p.find(f=>f.id===o.objId);u&&(h=u)}),h!==void 0&&h.data.type==="AIAssistantListener"){let c=l==null?void 0:l.computeAnalysisForListenerEvent(h.data);if(c!==void 0){r+=c;continue}}}r+=(l==null?void 0: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=hr.getDisplayedValue(h);i==="number"&&hr.isTextValue(h)&&Array.isArray(h.textValue)&&h.textValue.length===1?c=parseFloat(c).toString():i==="boolean"&&hr.isBoolean(h)?c=h?"true":"false":i==="boolean"&&hr.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"&&!MW(o.name)&&!_W.includes(o.name)&&!SW.includes(o.name)&&!AW.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=_h(r)}catch(n){console.error(r,n);return}let a;try{a=Ot(s)}catch(n){console.error(r,s,n)}return a}function Ot(e){switch(e.type){case"BinaryExpression":switch(e.operator){case"==":return+(Ot(e.left)===Ot(e.right));case"!=":return+(Ot(e.left)!==Ot(e.right));case">":return+(Ot(e.left)>Ot(e.right));case">=":return+(Ot(e.left)>=Ot(e.right));case"<":return+(Ot(e.left)<Ot(e.right));case"<=":return+(Ot(e.left)<=Ot(e.right));case"+":return Ot(e.left)+Ot(e.right);case"-":return Ot(e.left)-Ot(e.right);case"*":return Ot(e.left)*Ot(e.right);case"/":return Ot(e.left)/Ot(e.right);case"%":return Ot(e.left)%Ot(e.right);case"&&":return Ot(e.left)&&Ot(e.right);case"||":return Ot(e.left)||Ot(e.right);case"^":return Math.pow(Ot(e.left),Ot(e.right));default:throw new Error("Unknown operator: "+e.operator)}case"UnaryExpression":switch(e.operator){case"-":return-Ot(e.argument);case"!":return+!Ot(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=Ot(e.arguments[0])}catch(r){console.warn(r)}if(e.arguments.length>=2)try{i=Ot(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(Ot))}else throw new Error("Unknown node");default:throw new Error("Unknown node type: "+e.type)}}var EW=new be,CW=new be;function TW(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=Oe.lerp(a.length(),o.length(),i);a.lerp(o,i).setLength(l)}),new be().makeBasis(r[0],r[1],r[2])}var PW=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},(t==null?void 0: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==null?void 0:t.shapeData)??f1.create({parameters:EE}).userData.shape;return{path:e.path??$p.defaultData(),parameters:Object.assign(i,{width:r,height:s,depth:a,extrusion:{...CE,...i.extrusion}}),shapeData:n}}static build(e){if(e.path.points.length>=2){let t=new DW(e);return Object.assign(t,{userData:{...e,type:"PathGeometry"}})}else return Object.assign(new je,{userData:{...e,type:"PathGeometry"}})}},DW=class extends je{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)||!iW(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 N=0;N<o;N++){let F=this.inputs.path.isClosed?(N+a)%e.length:Math.min(N+a,e.length-1);l.push(e[F].clone()),h.push(t[F].clone())}let c=(N,F,Z)=>{l[N]=l[N].clone().lerp(l[F],Z),h[N]=TW(h[N],h[F],Z)},d=0,u=r*s%1;(!this.inputs.path.isClosed||i<=1)&&(u||r===0)&&(d=u,c(0,1,d));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 N=l.length-1;l[N].copy(l[0]),h[N].copy(h[0])}this._applyPathModifiers(h,d,p);let{bevel:g,bevelSides:m}=this.inputs.parameters.extrusion,v=g>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,A;v==="round"&&(A=new p1(this.inputs.shapeData,2*g,g,y,m,void 0,!0),b=A.getAttribute("position").count);let _=0,E=0;w.sort((N,F)=>
3155N.start-F.start),w.forEach(N=>{N.verticesStart=_,N.verticesCount=N.continuous.reduce((F,Z,q)=>F+(q===0||!Z?2:1),0),E+=N.verticesCount,_=E});let C=E*o,T,P=0;if(this._isOpenEnded()&&v==="flat"){try{T=Vn({windingRule:jt.ODD,elementType:Ai.POLYGONS,polySize:3,vertexSize:2,strict:!0,contours:x})}catch{T=WE}P=T.vertexCount}let O=C+2*P+b*2,D=C+2*P,k={positions:new Float32Array(O*3),normals:new Float32Array(O*3),uvs:new Float32Array(O*2)},W=[];if(w.forEach(N=>{this._extrudeRegion(N,S,h,l,k,W,this._isGeometryClosed()&&!this._isOpenEnded())}),T&&(this._closeEnd(T,C,W,k,h[0],l[0],!1),this._closeEnd(T,C+P,W,k,h[h.length-1],l[l.length-1],!0)),A){k.positions.set(A.getAttribute("position").array,D*3),k.normals.set(A.getAttribute("normal").array,D*3),k.uvs.set(A.getAttribute("uv").array,D*2);for(let q=D;q<D+b;q++)k.uvs[q*2+1]=1e-4;let N=W.length;W.push(...A.getIndex().array.map(q=>q+D)),D+=b,k.positions.set(A.getAttribute("position").array,D*3),k.normals.set(A.getAttribute("normal").array,D*3),k.uvs.set(A.getAttribute("uv").array,D*2);let F=W.length;W.push(...A.getIndex().array.map(q=>q+D)),this.setAttribute("position",new et(k.positions,3)),this.setAttribute("normal",new et(k.normals,3)),this.setAttribute("uv",new et(k.uvs,2)),this.setIndex(W);let Z=EW;Z.copy(h[h.length-1]).setPosition(l[l.length-1]),this.applyMatrix4OnRange(Z,D,O),Z.copy(h[0]).setPosition(l[0]).multiply(CW.makeScale(1,1,-1)),this.applyMatrix4OnRange(Z,D-b,D),this.reverseIndicesOnRange(N,F)}else this.setAttribute("position",new et(k.positions,3)),this.setAttribute("normal",new et(k.normals,3)),this.setAttribute("uv",new et(k.uvs,2)),this.setIndex(W)}_extractPathPoints(){let e=zE(this.inputs.path).getPoints(this.inputs.path.subdivisions);if(e.length<2)return[];let t=[e[0]];return e.forEach(i=>{t[t.length-1].distanceToSquared(i)>.001&&t.push(i)}),this.inputs.path.isClosed&&t[t.length-1].distanceTo(t[0])<.001&&t.pop(),t}_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 g=e[f],m;f===0?m=r?e[e.length-2]:g.clone().multiplyScalar(2).sub(e[1]):m=e[f-1];let v;f===i-1?v=r?e[1]:g.clone().multiplyScalar(2).sub(e[f-1]):v=e[f+1];let y=g.clone().sub(m).normalize(),x=v.clone().sub(g).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 A=new be().makeBasis(S,b,w);t.push(A)}let h=r?a:n,c=r?s:new M(0,1,0),d=h.clone().cross(o).normalize(),u=Math.acos(c.dot(d));if(isNaN(u))return t;let p=c.clone().cross(d);h.dot(p)>0&&(u*=-1);for(let f=1;f<t.length;f++){let g=new be().makeRotationZ(u*f/t.length);t[f].multiply(g)}return t}_applyPathModifiers(e,t,i){let r=e.length,{angle:s,twist:a,startScale:n,endScale:o}=this.inputs.parameters.extrusion,l=new be,h=new be;return e.forEach((c,d)=>{let u=d===0?0:d===r-1?1:(d-t)/(r-(i===0?0:1)-(t+(1-i)));l.makeRotationZ(Oe.lerp(s,s+a,u)*Oe.DEG2RAD);let p=Oe.lerp(n,o,u);h.makeScale(p,p,p),c.multiply(l).multiply(h)}),e}_computeShapePoints(e=12,t=jt.ODD){let i=this.inputs.shapeData,r=i.extractShapePointsToFlatArray([],e),s=i.shapeHoles.map(h=>{let c=h.extractShapePointsToFlatArray([],e),d=[];for(let u=c.length-1;u>=1;u-=2){let p=c[u-1],f=c[u-0];d.push(p,f)}return d}),a;try{a=Vn({windingRule:t,elementType:Ai.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[r]})}catch{a=u1}let n;try{n=Vn({windingRule:jt.ODD,elementType:Ai.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...s]})}catch{n=HE}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],d=h%2===0?a.vertexCount:0;a.elements.push(c+d)}for(let h=0;h<n.vertexIndices.length;h++){let c=n.vertexIndices[h],d=a.vertexCount;a.vertexIndices.push(c+d)}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 d=h*2;a.vertices[d+0],a.vertices[d+1]}let l=[];for(let h=a.elementCount-1;h>=0;h--){let c=h>=o,d=h*2,u=a.elements[d+0],p=a.elements[d+1],f=u+p,g={start:u,count:p,normals:[],isHole:c,continuous:[],verticesStart:0,verticesCount:0};l.push(g);let m=u,v=f-1,y=u+1,x=i.roundedCurves.length;do{let w=m-u;a.vertices[v*2+0],a.vertices[v*2+1];let S=a.vertices[m*2+0],b=a.vertices[m*2+1],A=a.vertices[y*2+0],_=a.vertices[y*2+1],E=S-A,C=b-_,T=Math.sqrt(E*E+C*C);E/=T,C/=T,g.normals[w*2+0]=-C,g.normals[w*2+1]=E;let P=a.vertexIndices[m];if(Array.isArray(P))g.continuous[w]=!1;else{let[O,D]=i.getCurveIndexFromVertexId(P-1,!0);if(D>0&&D<1)g.continuous[w]=!0;else{let k=D===1?O+1:O-1;k=(k+x)%x;let W=D===1?0:1,N=i.roundedCurves[O].getTangent(D),F=i.roundedCurves[k].getTangent(W);g.continuous[w]=N.dot(F)>.95}}
3155c&&(g.normals[w*2+0]*=-1,g.normals[w*2+1]*=-1),[v,m,y]=[m,y,y+1],y>=f&&(y-=p)}while(y!==u+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,d=new j;i.forEach((p,f)=>{let g=r[f],m=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(g),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(),d.set(v===0?1:v/e.count,f/(i.length-1)),this._insertVertex(s,m,h,c,d),m++,!e.continuous[v]||v===0){if(v===0)c.set(e.normals[v*2+0],e.normals[v*2+1],0),d.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,m,h,c,d),m++}}});let u=i.length-1;for(let p=0;p<u;p++){let f=e.verticesStart*i.length+e.verticesCount*p,g=e.verticesStart*i.length+e.verticesCount*(p+1),m=0;for(let v=0;v<e.count;v++){(!e.continuous[v]||v===0)&&m++;let y=v===e.count-1?0:m+1,x=f+m,w=f+y,S=g+y,b=g+m;e.isHole?a.push(x,S,w,x,b,S):a.push(x,w,S,x,S,b),m++}}}_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 j;for(let u=0;u<o;u++){let p=2*u;h.set(e.vertices[p+0],e.vertices[p+1],0).applyMatrix4(s).add(a),this._insertVertex(r,t+u,h,l,c)}let d=e.elements;for(let u=0;u<e.elementCount;u++){let p=3*u,f=d[p+0]+t,g=d[p+(n?1:2)]+t,m=d[p+(n?2:1)]+t;i.push(f,g,m)}}applyMatrix4OnRange(e,t,i){let r=e.elements,s=new Mi().getNormalMatrix(e).elements,a,n,o,l,h=this.attributes.position,c=this.attributes.normal;if(!h||!c)return;let d=h.array,u=c.array,p=h.itemSize;for(let f=t*p,g=i*p;f<g;f+=p){if(f===t)debugger;a=d[f+0],n=d[f+1],o=d[f+2],l=1/(r[3]*a+r[7]*n+r[11]*o+r[15]),d[f+0]=(r[0]*a+r[4]*n+r[8]*o+r[12])*l,d[f+1]=(r[1]*a+r[5]*n+r[9]*o+r[13])*l,d[f+2]=(r[2]*a+r[6]*n+r[10]*o+r[14])*l,a=u[f+0],n=u[f+1],o=u[f+2],u[f+0]=s[0]*a+s[3]*n+s[6]*o,u[f+1]=s[1]*a+s[4]*n+s[7]*o,u[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 aC(){let e=new je;return e.setAttribute("position",new et(new Float32Array([]),3)),e.setIndex(new et(new Uint16Array([]),1)),e}var IW=aC().attributes,OW=12,RW=1,R0=class extends je{constructor(e,t){super(),this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],Object.assign(this.attributes,IW),this.userData={parameters:e,type:"TextGeometry"};let i=t.getFont(e.font);i!=null&&i.isLoaded?(this.font=i,this.update(e)):this.updateFont(e.font,t).then(()=>{this.update(e),t==null||t.requestRender()})}async updateFont(e,t){let i=t.getFont(e);i&&(this.font=i,await i.loadingPromise)}update(e){let t=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!(t!=null&&t.isLoaded)){console.warn("Cannot update text because its font is not loaded");return}let{width:i,height:r,depth:s,extrudeBevelSize:a,extrudeBevelSegments:n,text:o,textTransform:l}=e,h=hr.getDisplayedValue(o),c=l===2?h.toUpperCase():l===3?h.toLowerCase():h,d=LW(e,t,c),{shapes:u,charWidths:p,charCoords:f}=t.generateShapes(d,e),g=(typeof i=="number"?i:1)*.5,m=(typeof r=="number"?r:1)*.5,v=u.map(w=>new di().fromShape(w,!0));this.vectorShapes=v;let y=v.map(w=>el.create({shape:w,parameters:{depth:s,extrudeBevelSegments:n,extrudeBevelSize:a,windingRule:s<=0?jt.NONZERO:jt.ODD,subdivisions:this.isLowResolution&&s>0?RW:OW}})),x=y.length?Io(y):aC();x.translate(-g,m,0),this.dispose(),this.wrappedText=d,this.charCoords=f,this.charWidths=p,this.deleteAttribute("extrudeNormal"),Object.entries(x.attributes).forEach(([w,S])=>{this.setAttribute(w,S)}),this.setIndex(x.index),this.computeBoundingSphere()}clone(){let e=ms(new je,R0.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}
3155copy(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){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:e}})}get text(){return this.userData.parameters.text??""}};function LW(e,t,i){let r=[""],s="";for(let a of i)s+=a,a===" "||a===`
3156`?(r[r.length-1]+=s,s="",a===`
3157`&&r.push("")):t.getTextWidth(r[r.length-1]+s,e)>e.width&&(r[r.length-1].length&&r.push(""),t.getTextWidth(r[r.length-1]+s,e)>e.width&&(s.length===1?(r[r.length-1]+=s,s=""):(r[r.length-1]+=s.slice(0,-1),s=s[s.length-1],r.push(""))));return r[r.length-1]+=s,r}var nC,oC=new Promise(e=>{nC=e}),GS=!1,Iu;function BW(){if(GS)return;if(Iu)return Iu;async function e(){let t="https://unpkg.com/@splinetool/[email protected]/build",i=$n(()=>import("./process-B9H0U9ag.js"),[]),[r,s]=await Promise.all([i,fetch(`${t}/process.wasm`).then(o=>o.arrayBuffer())]),a=r.default,n=await a({wasmBinary:s});nC(n),GS=!0}return Iu=e(),Iu}var zW=["font"];function dd(e,t,i,r){var h,c;let s,a,n;e.type==="PathGeometry"?(a=JSON.parse(JSON.stringify(e)),n=[[],["extrusion"]]):(a={...e},n=[[]]);for(let d of n){let u=a;for(let p of d)u=u[p];for(s in u){let p=u[s];qw(p)&&!zW.includes(s)&&(u[s]=t.getVariable(p,[r.uuid,"geometry",...d,s]),qw(u[s])&&(u[s]=1))}}let o={parameters:a,type:a.type};if(a.type==="PathGeometry")o.path=a.path;else if(a.type==="VectorGeometry"){let d=di.createFromState(a.shape,a.width,a.height);o.shape=d}else if(a.type==="NonParametricGeometry"){if(a.data.groups&&((h=a.data.groups)==null||h.forEach(d=>d.materialIndex=Math.max(d.materialIndex??0,0))),o.geometry=new n2().parse(a),o.geometry.groups.length===0){let d=o.geometry;d.addGroup(0,Math.max(((c=d.getIndex())==null?void 0:c.count)??0,d.getAttribute("position").count),0)}}else if(a.type==="SubdivGeometry"){let d=new Er(a,i);return d.data=e,d}else{if(a.type==="TextGeometry")return new R0(a,t);if(a.type==="InputGeometry")return new R0(a,t);if(a.type==="UIGeometry")return m1.create({parameters:{width:a.width,height:a.height,cornerRadius:a.cornerRadius,cornerType:a.cornerType}})}let l;try{l=YS(o)}catch(d){console.error(d)}if(!l){let d=di.createFromState(Jp.defaultData(),100,100);o.shape=d,l=YS(o)}return l}var FW=new be;function L0(e,t,i,r){let s=e.position.array,a=e.normal.array,n=FW.makeScale(t,i,r).invert().elements,o,l,h;for(var c=0,d=s.length;c<d;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 Ou=new xi,Al=new M,it;oC.then(e=>{it=e});var HS=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),WS=new Uint32Array([0,1,2,3]),qS=new Uint8Array([4]),Er=class extends je{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,r=ko.div(t,i);this.subdividedGeometry&&L0(this.subdividedGeometry.attributes,...r),this.originalGeometry&&L0(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(Al.fromArray(r));let a=Al.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}=Er.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new ks(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&&(Er.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;
3157e.boundingSphere===null&&(e.boundingSphere=new Hr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;Ou.setFromBufferAttribute(t),Ou.getCenter(i),e.boundingSphere.radius=i.distanceTo(Ou.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Ou.getSize(Al);let r={width:Al.x,height:Al.y,depth:Al.z};return this.userData.parameters=r,r}static build(e,t,i,r){let s,a,n,o=(e==null?void 0:e.phongAngle)??35;i===!1&&(o=-1),t&&(it.free_bvh(t),it.free_subdivision_surface(t));try{s=Er.allocate(e,r)}catch(l){console.error(l,e),s=Er.allocate({positionWASM:HS,indexWASM:WS,verticesPerFaceWASM:qS},r)}if(it.set_destination_refinement_level(s,0),a=Er.buildLevel(s,!0,o),e.subdivisions>0)try{it.set_destination_refinement_level(s,e.subdivisions),n=Er.buildLevel(s,!1,o)}catch{try{it.set_destination_refinement_level(s,e.subdivisions-1),n=Er.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:dd(e,i,!1),s;e.type==="TorusGeometry"&&e.arc===Math.PI*2?s=r.getClosedTorusIndicesForBooleanOrSubdiv():s=r.getIndex();let a,n,o,l;({positions:a,triIndices:l}=Yf(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,d=c+e.radialSegments*3;h=[c,d]}return{indices:n,verticesPerFace:o}=lC(a,l,r,h),{positions:a,indices:n,verticesPerFace:o}}static allocate(e,t){var x;let i,r,s,a=[],n=[];e.positionWASM&&e.positionWASM.length>0?(i=e.positionWASM,r=e.indexWASM,s=e.verticesPerFaceWASM):(i=HS,r=WS,s=qS);let o=i.length,l=r.length,h=s.length,c=i.length+a.length+n.length,d=r.length+s.length,u=c*Float32Array.BYTES_PER_ELEMENT+d*Uint32Array.BYTES_PER_ELEMENT,p=c*Float32Array.BYTES_PER_ELEMENT,f=it._malloc(u),g=new Float32Array(it.HEAPF32.buffer,f,c),m=new Uint32Array(it.HEAPU32.buffer,f+p,d);g.set(i,0),g.set(a,i.length),g.set(n,i.length+a.length),m.set(r,0),m.set(s,r.length);let v;(x=e==null?void 0:e.scaleBaked)!=null&&x.some(w=>w!==1)&&(v=new be().makeScale(...e.scaleBaked)),t&&(v?v.premultiply(t):v=t);let y=v?it.alloc_subdivision_surface2(f,o,f+p,l,f+p+r.length*Uint32Array.BYTES_PER_ELEMENT,h,v.elements):it.alloc_subdivision_surface(f,o,f+p,l,f+p+r.length*Uint32Array.BYTES_PER_ELEMENT,h);return it._free(f),y}static buildLevel(e,t,i,r,s){let a=s?it.get_mesh_data2(e,t?it.Level.CONTROL:it.Level.REFINED,i,s.elements):it.get_mesh_data(e,t?it.Level.CONTROL:it.Level.REFINED,i),n=8,o=it.HEAPU32.subarray(a>>2,(a>>2)+n),l=o.subarray(4,8),h=0,c=it.HEAPU32[o[h]>>2],d=it.HEAPF32.subarray(c>>2,(c>>2)+l[h]);h++;let u=it.HEAPU32[o[h]>>2],p=it.HEAPF32.subarray(u>>2,(u>>2)+l[h]);h++;let f=it.HEAPU32[o[h]>>2],g=it.HEAPU32.subarray(f>>2,(f>>2)+l[h]);h++;let m=it.HEAPU32[o[h]>>2],v=it.HEAPU32.subarray(m>>2,(m>>2)+l[h]);if(h++,r===void 0){let y=new je;if(y.setIndex(new Zl(v,1)),y.setAttribute("position",new De(d,3)),y.setAttribute("normal",new De(p,3)),t){y.setAttribute("faceMap",new Zl(g,1));let x=new Float32Array(p.length/3*4).fill(0);y.setAttribute("color",new et(x,4))}return it.free_mesh_data(a),y.userData.type="SubdivGeometry",y}r.getAttribute("position").copyArray(d),r.getAttribute("normal").copyArray(p),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,it.free_mesh_data(a)}static freeSubdivPointer(e){it.free_bvh(e),it.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let r=it.get_wireframe_data_for_base_level(e),s=4,a=it.HEAPU32.subarray(r>>2,(r>>2)+s),n=a.subarray(2,4),o=0,l=it.HEAPU32[a[o]>>2],h=it.HEAPF32.subarray(l>>2,(l>>2)+n[o]);o++;let c=it.HEAPU32[a[o]>>2],d=it.HEAPU32.subarray(c>>2,(c>>2)+n[o]);if(t===void 0){let u=new je;u.setAttribute("position",new De(h,3));let p=new Float32Array(h.length);for(let f=0,g=h.length;f<g;)p[f++]=i.r,p[f++]=i.g,p[f++]=i.b;return u.setAttribute("color",new et(p,3)),u.setIndex(new Zl(d,1)),it.free_wireframe_data_for_base_level(r),u}t.getAttribute("position").copyArray(h),t.attributes.position.needsUpdate=!0,it.free_wireframe_data_for_base_level(r)}static updateCollabMesh(e,t,i){let r=t===0;r||it.set_destination_refinement_level(e,t);let s=i?it.get_topological_data2(e,r?it.Level.CONTROL:it.Level.REFINED,i.elements):it.get_topological_data(e,r?it.Level.CONTROL:it.Level.REFINED),a=6,n=it.HEAPU32.subarray(s>>2,(s>>2)+a),o=n.subarray(3,6),l=0,h=it.HEAPU32[n[l]>>2],c=new Float32Array(it.HEAPF32.subarray(h>>2,(h>>2)+o[l]));l++;let d=it.HEAPU32[n[l]>>2],u=new Uint32Array(it.HEAPU32.subarray(d>>2,(d>>2)+o[l]));l++;let p=it.HEAPU32[n[l]>>2],f=new Uint8Array(it.HEAPU32.subarray(p>>2,(p>>2)+o[l]));return it.free_topological_data(s),{positions:c,indices:u,verticesPerFace:f}}},XS=["getX","getY","getZ"];function Yf(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,d="";for(let u=0;u<3;u++)d+=`${~~(e[XS[u]](c)*o)},`;if(d in i)a.push(i[d]);else{for(let u=0;u<3;u++)n.push(e[XS[u]](c));i[d]=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 Ru=new M,yg=new M,xg=new M,bg=new M;function lC(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 u=l.length/2/h;l=l.filter((p,f)=>Math.floor(f/2)%u===0)}let c=0;for(let u=0;u<l.length;u+=2)c+=(l[u]-l[(u===0?l.length:u)-2])*(l[u+1]+l[(u===0?l.length:u)-1]);e.length=0;let d=0;if(c<0)for(let u=0;u<l.length;u+=2)e.push(l[u],l[u+1],0),s.push(d++);else for(let u=l.length-2;u>=0;u-=2)e.push(l[u],l[u+1],0),s.push(d++);return a.push(d),{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;
3157if((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]){Ru.set(e[t[o]*3],e[t[o]*3+1],e[t[o]*3+2]),yg.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]),bg.set(e[t[o+5]*3],e[t[o+5]*3+1],e[t[o+5]*3+2]),yg.sub(Ru).normalize(),xg.sub(Ru).normalize(),bg.sub(Ru).normalize();let l=yg.cross(xg).dot(bg);Math.abs(l)>.005||r&&r.some((h,c)=>c%2===1?!1:o>=r[c]&&o<r[c+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 d=0,u=0;d<e.length;d+=3,u++)e[d+2]===0&&(l.push(u),c++),e[d+2]===n&&h.push(u);if(i.userData.parameters.extrudeBevelSize===0){let d=h[0];h[0]=h[1],h[1]=d}l.reverse(),s.push(...l,...h),a.push(c,c)}return{indices:s,verticesPerFace:a}}var Na={};TP(Na,{calcBoolean:()=>jW,calcBooleanTopological:()=>VW,freeMeshSet:()=>qW,getMeshSet:()=>GW,hasOpenEdges:()=>HW,transformMeshSet:()=>WW});var hC,kW=new Promise(e=>{hC=e}),Lu;function UW(){if(Lu)return Lu;async function e(){let t="https://unpkg.com/@splinetool/[email protected]/build",i=$n(()=>import("./boolean-BpCokwB2.js"),[]),[r,s]=await Promise.all([i,fetch(`${t}/boolean.wasm`).then(o=>o.arrayBuffer())]),a=r.default,n=await a({wasmBinary:s});hC(n)}return Lu=e(),Lu}var Et,rh;kW.then(e=>Et=e);function NW(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}=Yf(e.getAttribute("position"),s),o;if(t&&i){let{indices:l,verticesPerFace:h}=lC(a,n,e);o=h.length,r=[];for(let c=0,d=0;c<o;c++){r.push(h[c]);for(let u=0;u<h[c];u++)r.push(l[d++])}}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 cC(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=Et._malloc(s);return(Number.isInteger(e[0])?new Uint32Array(Et.HEAPU32.buffer,a,t):new Float32Array(Et.HEAPF32.buffer,a,t)).set(e,0),a}function dC(e){switch(e){case 0:return Et.OP.UNION;case 1:return Et.OP.INTERSECTION;case 2:return Et.OP.A_MINUS_B;default:throw new Error("Unknown boolean operation "+e)}}function VW(e,t){rh===void 0&&(rh=Et.init_csg());let i=cC(e),r=Et.csg_calc_topological(rh,i,e.length,dC(t));Et._free(i);let s=6,a=Et.HEAPU32.subarray(r>>2,(r>>2)+s),n=a.subarray(3,6),o=0,l=Et.HEAPU32[a[o]>>2],h=new Float32Array(Et.HEAPF32.subarray(l>>2,(l>>2)+n[o]));o++;let c=Et.HEAPU32[a[o]>>2],d=new Uint32Array(Et.HEAPU32.subarray(c>>2,(c>>2)+n[o]));o++;let u=Et.HEAPU32[a[o]>>2],p=new Uint8Array(Et.HEAPU32.subarray(u>>2,(u>>2)+n[o]));return Et.free_mesh_data(r),{positions:h,indices:d,verticesPerFace:p}}function jW(e,t,i,r){rh===void 0&&(rh=Et.init_csg());let s=cC(e),a=Et.csg_calc(rh,s,e.length,r,dC(t));Et._free(s);let n=5,o=Et.HEAPU32.subarray(a>>2,(a>>2)+n),l=o.subarray(2,5),h=0,c=Et.HEAPU32[o[h]>>2],d=Et.HEAPF32.subarray(c>>2,(c>>2)+l[h]);h++;let u=Et.HEAPU32[o[h]>>2],p=Et.HEAPF32.subarray(u>>2,(u>>2)+l[h]);h++;let f=l[h];i.setAttribute("position",new De(d,3)),i.setAttribute("normal",new De(p,3));let g=Et.HEAPF32.subarray((a>>2)+5,(a>>2)+5+6);return i.boundingSphere===null&&(i.boundingSphere=new Hr),i.boundingSphere.center.set(g[0],g[1],g[2]),i.boundingSphere.radius=(g[3]**2+g[4]**2+g[5]**2)**.5,i.userData.parameters={width:g[3]*2,height:g[4]*2,depth:g[5]*2},Et.free_mesh_data(a),f}function GW(e,t,i){if(Et===void 0)return-1;let r,s,a;if(t&&e.userData.positions!==void 0){let m=e.userData;a=m.verticesPerFace.length,r=m.positions,s=Array(m.verticesPerFace.reduce((v,y)=>v+y,0)+a);for(let v=0,y=0,x=0;v<m.verticesPerFace.length;v++){s[x++]=m.verticesPerFace[v];for(let w=0;w<m.verticesPerFace[v];w++)s[x++]=m.indices[y++]}}else({positions:r,faceIndices:s,nFaces:a}=NW(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,d=l*Float32Array.BYTES_PER_ELEMENT,u=Et._malloc(c),p=new Float32Array(Et.HEAPF32.buffer,u,l),f=new Uint32Array(Et.HEAPU32.buffer,u+d,h);p.set(r,0),f.set(s,0);let g=Et.get_csg_mesh(u,n,u+d,o,a);return Et._free(u),g}
vendor: 53,853 bytes, lines 3157-3459
3157function HW(e){return Et.has_open_edges(e)}function WW(e,t){Et.transform_csg_mesh(e,t.elements)}function qW(e){Et.free_csg_mesh(e)}var XW={ConeGeometry:QG,CubeGeometry:ZG,CylinderGeometry:FE,DodecahedronGeometry:JG,EllipseGeometry:f1,HelixGeometry:LH,IcosahedronGeometry:BH,LatheGeometry:zH,NonParametricGeometry:GH,PolygonGeometry:eC,PyramidGeometry:HH,RectangleGeometry:m1,SphereGeometry:XH,PlaneGeometry:YH,BackdropGeometry:QH,StarGeometry:tC,TextFrameGeometry:KH,TorusGeometry:JH,TorusKnotGeometry:eW,TriangleGeometry:tW,PathGeometry:PW,VectorGeometry:el},YS=e=>XW[e.type].create(e);function Ml(e){return e!==null&&"booleanOp"in e}var uC=class extends l1(Zt){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new be}updateVisible(e){super.updateVisible(e),this.visible=!Ml(this.parent)&&this.visible,Ml(this.parent)&&this.parent.invalidateDownstreamBooleanData()}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Na.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Ml(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)e instanceof uC&&(e.freeBooleanPointer(),Ml(e)&&e.invalidateUpstreamBooleanData())}updateTransformState(e,t){let i=super.updateTransformState(e,t);return i&&Ml(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(e=!1){super.onVariableUpdate(e),Ml(this.parent)&&this.invalidateDownstreamBooleanData(!0)}},Bu=new xi;function g1(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 d=t;d<i;d++){let u=e.getX(d),p=e.getY(d),f=e.getZ(d);u<a&&(a=u),p<n&&(n=p),f<o&&(o=f),u>l&&(l=u),p>h&&(h=p),f>c&&(c=f)}Bu.min.set(a,n,o),Bu.max.set(l,h,c),Bu.getCenter(r),Bu.getSize(s).multiplyScalar(.5)}var YW=new je,QW=new sn,Or=class extends uC{constructor(e,t){super(YW,QW),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?g1(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}},Tn=class{constructor(e){if(this.hashProperties=void 0,this.isNode=!0,this.shortcuts={},Tn.uuidContext===null)throw new Error("plz startContext");Tn.uuidContext===Tn.globalContext?this.uuid="_gid"+Tn.uuidContext.nodeContextUuid++:this.uuid="_uid"+Tn.uuidContext.nodeContextUuid++,this.type=e,this.name=""}static startContext(e){this.uuidContext===null||this.uuidContext===Tn.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}},Bi=Tn;Bi.globalContext={nodeContextUuid:0},Bi.uuidContext=Tn.globalContext;var QS=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}},ZW=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}},Nr=new ZW,Ht=class extends Bi{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=Oe.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}},Wr=class extends Ht{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))}},sr=class extends Wr{constructor(e=0,t){super("v2"),this.nodeType="Vector2",this.value=e instanceof j?e:new j(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)}},ss=class extends Wr{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)}},dr=class extends $e{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}},Va=class extends Wr{constructor(e){super("v4"),this.nodeType="Vector4",this.value=e instanceof dr?e:new dr(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)}},KW=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,ZS=/[a-z_0-9]+/gi,Pe=class extends Ht{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=ZS.exec(this.src);)l.push(a);for(let h=0;h<l.length;h++){let c=l[h],d=c[0],u=this.isMethod?!this.getInputByName(d):!0,p=d;if(this.keywords[d]||this.useKeywords&&u&&Nr.containsKeyword(d)){let f=this.keywords[d];if(!f){let g=Nr.getKeywordData(d);g.cache&&(f=e.keywords[d]),f=f||Nr.getKeyword(d,e),g.cache&&(e.keywords[d]=f)}p=f.build(e)}d!==p&&o[c.index+n-1]!=="."&&(o=o.substring(0,c.index+n)+p+o.substring(c.index+d.length+n),n+=p.length-d.length),this.getIncludeByName(p)===void 0&&Nr.contains(p)&&e.include(Nr.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=KW.exec(this.src);if(this.inputs=[],s&&s.length==4){this.type=s[1],this.name=s[2];let a=s[3].match(ZS);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=""}}},JW=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,pC=class extends Ht{constructor(e="",t){super(),this.src="",this.useDefine=!1,this.nodeType="Const",this.parse(e||pC.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=JW.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)}},Ft=pC;Ft.PI="PI",Ft.PI2="PI2",Ft.RECIPROCAL_PI="RECIPROCAL_PI",Ft.RECIPROCAL_PI2="RECIPROCAL_PI2",Ft.LOG2="LOG2",Ft.EPSILON="EPSILON";var $W=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
3158)*?)}`,"gim"),e8=new RegExp("s*(w*?)s*(w*?)(=|;)","gim"),fC=class extends Ht{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=$W.exec(e);if(t){let i=t[2],r;for(;r=e8.exec(i);)this.inputs.push({type:r[1],name:r[2]});this.name=t[1]}else this.name="";this.type=this.name}},v1=class extends Ht{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)}};Nr.addKeyword("uv",function(){return new v1});Nr.addKeyword("uv2",function(){return new v1(1)});var Nl=class extends Ht{constructor(e,t){super("v4"),this.nodeType="ColorSpace",this.input=e,this.method=t??Nl.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(e){switch(e){case Fs:return["Linear"];case mt:return["sRGB"];default:return[]}}generate(e,t){var n;let i=this.input.build(e,"v4"),r=this.getType(e),s=Nl.Nodes[this.method],a=e.include(s);if(a===Nl.LINEAR_TO_LINEAR)return e.format(i,r,t);if(((n=s.inputs)==null?void 0:n.length)===2){let o=this.factor.build(e,"f");return e.format(a+"( "+i+", "+o+" )",r,t)}else return e.format(a+"( "+i+" )",r,t)}fromEncoding(e){let t=Nl.getEncodingComponents(e);this.method="LinearTo"+t[0],this.factor=t[1]}fromDecoding(e){let t=Nl.getEncodingComponents(e);this.method=t[0]+"ToLinear",this.factor=t[1]}},ca=Nl;ca.Nodes={LinearToLinear:new Pe(["vec4 LinearToLinear( in vec4 value ) {","	return value;","}"].join(`
3159`)),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(`
3160`)),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(`
3161`))},ca.LINEAR_TO_LINEAR="LinearToLinear",ca.SRGB_TO_LINEAR="sRGBToLinear",ca.LINEAR_TO_SRGB="LinearTosRGB";var $t=class extends Pe{constructor(e="",t,i,r,s){super(e,s,r,i,t),this.nodeType="Expression"}},Xa=class extends Wr{constructor(e=new oi,t,i,r){super("v4",{shared:!0}),this.nodeType="Texture",this.value=e,this.uv=t??new v1,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 ca(new $t("",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)}},ze=class extends Wr{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)}},KS=class extends Ht{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)}},mC=class extends Ht{constructor(e,t,i=mC.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)}},zr=mC;zr.ADD="+",zr.SUB="-",zr.MUL="*",zr.DIV="/";var Nt=class extends Ht{constructor(e,t=Nt.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 Nt.MIX:case Nt.CLAMP:case Nt.REFRACT:case Nt.SMOOTHSTEP:case Nt.FACEFORWARD:return 3;case Nt.MIN:case Nt.MAX:case Nt.MOD:case Nt.STEP:case Nt.REFLECT:case Nt.DISTANCE:case Nt.DOT:case Nt.CROSS:case Nt.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 Nt.LENGTH:case Nt.DISTANCE:case Nt.DOT:return"f";case Nt.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 Nt.NEGATE:return e.format("( -"+this.a.build(e,l)+" )",l,t);case Nt.INVERT:return e.format("( 1.0 - "+this.a.build(e,l)+" )",l,t);case Nt.CROSS:i=this.a.build(e,"v3"),r=this.b.build(e,"v3");break;case Nt.STEP:i=this.a.build(e,a===1?"f":l),r=this.b.build(e,l);break;case Nt.MIN:case Nt.MAX:case Nt.MOD:i=this.a.build(e,l),r=this.b.build(e,n===1?"f":l);break;case Nt.REFRACT:i=this.a.build(e,l),r=this.b.build(e,l),s=this.c.build(e,"f");break;case Nt.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 d=this.getNumInputs(e);if(c.length!==d)throw Error(`Arguments not match used in "${this.method}". Require ${d}, currently ${c.length}.`);return e.format(this.method+"( "+c.join(", ")+" )",h,t)}},pt=Nt;pt.RAD="radians",pt.DEG="degrees",pt.EXP="exp",pt.EXP2="exp2",pt.LOG="log",pt.LOG2="log2",pt.SQRT="sqrt",pt.INV_SQRT="inversesqrt",pt.FLOOR="floor",pt.CEIL="ceil",pt.NORMALIZE="normalize",pt.FRACT="fract",pt.SATURATE="saturate",pt.SIN="sin",pt.COS="cos",pt.TAN="tan",pt.ASIN="asin",pt.ACOS="acos",pt.ARCTAN="atan",pt.ABS="abs",pt.SIGN="sign",pt.LENGTH="length",pt.NEGATE="negate",pt.INVERT="invert",pt.MIN="min",pt.MAX="max",pt.MOD="mod",pt.STEP="step",pt.REFLECT="reflect",pt.DISTANCE="distance",pt.DOT="dot",pt.CROSS="cross",pt.POW="pow",pt.MIX="mix",pt.CLAMP="clamp",pt.REFRACT="refract",pt.SMOOTHSTEP="smoothstep",pt.FACEFORWARD="faceforward";var Mc=class extends Ht{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 KS(Mc.Nodes.bilinearCubeUV,[t,i,r]);this.colorSpaceTL=this.colorSpaceTL??new ca(new $t("","v4")),this.colorSpaceTL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTL.input.parse(s.build(e)+".tl"),this.colorSpaceTR=this.colorSpaceTR??new ca(new $t("","v4")),this.colorSpaceTR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTR.input.parse(s.build(e)+".tr"),this.colorSpaceBL=this.colorSpaceBL??new ca(new $t("","v4")),this.colorSpaceBL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBL.input.parse(s.build(e)+".bl"),this.colorSpaceBR=this.colorSpaceBR??new ca(new $t("","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 $t(this.colorSpaceTL.build(e,"v4"),"v4"),this.colorSpaceTRExp=new $t(this.colorSpaceTR.build(e,"v4"),"v4"),this.colorSpaceBLExp=new $t(this.colorSpaceBL.build(e,"v4"),"v4"),this.colorSpaceBRExp=new $t(this.colorSpaceBR.build(e,"v4"),"v4"),e.removeContext();let n=new $t("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 KS(Mc.Nodes.roughnessToMip,[r]),a=new pt(s,Mc.Nodes.m0,Mc.Nodes.cubeUV_maxMipLevel,pt.CLAMP),n=new pt(a,pt.FLOOR),o=new pt(a,pt.FRACT),l=this.bilinearCubeUV(e,this.value,i,n),h=this.bilinearCubeUV(e,this.value,i,new zr(n,new ze(1).setReadonly(!0),zr.ADD)),c=new pt(l,h,o,pt.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)}},B0=Mc;B0.Nodes=function(){let e=new fC(`struct TextureCubeUVData {
3162			vec4 tl;
3163			vec4 tr;
3164			vec4 br;
3165			vec4 bl;
3166			vec2 f;
3167		}`),t=new Ft("float cubeUV_maxMipLevel 8.0",!0),i=new Ft("float cubeUV_minMipLevel 4.0",!0),r=new Ft("float cubeUV_maxTileSize 256.0",!0),s=new Ft("float cubeUV_minTileSize 16.0",!0),a=new Pe(`float getFace(vec3 direction) {
3168				vec3 absDirection = abs(direction);
3169				float face = -1.0;
3170				if (absDirection.x > absDirection.z) {
3171					if (absDirection.x > absDirection.y)
3172						face = direction.x > 0.0 ? 0.0 : 3.0;
3173					else
3174						face = direction.y > 0.0 ? 1.0 : 4.0;
3175				} else {
3176					if (absDirection.z > absDirection.y)
3177						face = direction.z > 0.0 ? 2.0 : 5.0;
3178					else
3179						face = direction.y > 0.0 ? 1.0 : 4.0;
3180				}
3181				return face;
3182		}`);a.useKeywords=!1;let n=new Pe(`vec2 getUV(vec3 direction, float face) {
3183				vec2 uv;
3184				if (face == 0.0) {
3185					uv = vec2(direction.z, direction.y) / abs(direction.x); // pos x
3186				} else if (face == 1.0) {
3187					uv = vec2(-direction.x, -direction.z) / abs(direction.y); // pos y
3188				} else if (face == 2.0) {
3189					uv = vec2(-direction.x, direction.y) / abs(direction.z); // pos z
3190				} else if (face == 3.0) {
3191					uv = vec2(-direction.z, direction.y) / abs(direction.x); // neg x
3192				} else if (face == 4.0) {
3193					uv = vec2(-direction.x, direction.z) / abs(direction.y); // neg y
3194				} else {
3195					uv = vec2(direction.x, direction.y) / abs(direction.z); // neg z
3196				}
3197				return 0.5 * (uv + 1.0);
3198		}`);n.useKeywords=!1;let o=new Pe(`TextureCubeUVData bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {
3199			float face = getFace(direction);
3200			float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);
3201			mipInt = max(mipInt, cubeUV_minMipLevel);
3202			float faceSize = exp2(mipInt);
3203			float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);
3204			vec2 uv = getUV(direction, face) * (faceSize - 1.0);
3205			vec2 f = fract(uv);
3206			uv += 0.5 - f;
3207			if (face > 2.0) {
3208				uv.y += faceSize;
3209				face -= 3.0;
3210			}
3211			uv.x += face * faceSize;
3212			if(mipInt < cubeUV_maxMipLevel){
3213				uv.y += 2.0 * cubeUV_maxTileSize;
3214			}
3215			uv.y += filterInt * 2.0 * cubeUV_minTileSize;
3216			uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);
3217			uv *= texelSize;
3218			vec4 tl = texture2D(envMap, uv);
3219			uv.x += texelSize;
3220			vec4 tr = texture2D(envMap, uv);
3221			uv.y += texelSize;
3222			vec4 br = texture2D(envMap, uv);
3223			uv.x -= texelSize;
3224			vec4 bl = texture2D(envMap, uv);
3225			return TextureCubeUVData( tl, tr, br, bl, f );
3226		}`,[e,a,n,t,i,r,s]);o.useKeywords=!1;let l=new Ft("float r0 1.0",!0),h=new Ft("float v0 0.339",!0),c=new Ft("float m0 -2.0",!0),d=new Ft("float r1 0.8",!0),u=new Ft("float v1 0.276",!0),p=new Ft("float m1 -1.0",!0),f=new Ft("float r4 0.4",!0),g=new Ft("float v4 0.046",!0),m=new Ft("float m4 2.0",!0),v=new Ft("float r5 0.305",!0),y=new Ft("float v5 0.016",!0),x=new Ft("float m5 3.0",!0),w=new Ft("float r6 0.21",!0),S=new Ft("float v6 0.0038",!0),b=new Ft("float m6 4.0",!0),A=[l,h,c,d,u,p,f,g,m,v,y,x,w,S,b],_=new Pe(`float roughnessToMip(float roughness) {
3227			float mip = 0.0;
3228			if (roughness >= r1) {
3229				mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;
3230			} else if (roughness >= r4) {
3231				mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;
3232			} else if (roughness >= r5) {
3233				mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;
3234			} else if (roughness >= r6) {
3235				mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;
3236			} else {
3237				mip = -2.0 * log2(1.16 * roughness);// 1.16 = 1.79^0.25
3238			}
3239			return mip;
3240		}`,A);return{bilinearCubeUV:o,roughnessToMip:_,m0:c,cubeUV_maxMipLevel:t}}();var Vl=class extends Ht{constructor(e){super("v3"),this.nodeType="Normal",this.scope=e??Vl.VIEW}getShared(){return this.scope===Vl.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 Vl.VIEW:e.isShader("vertex")?a="transformedNormal":a="geometryNormal";break;case Vl.LOCAL:e.isShader("vertex")?a="objectNormal":(e.requires.normal=!0,a="vObjectNormal");break;case Vl.WORLD:e.isShader("vertex")?a="inverseTransformDirection( transformedNormal, viewMatrix ).xyz":(e.requires.worldNormal=!0,a="vWNormal");break}return e.format(a,this.getType(e),t)}},Vr=Vl;Vr.LOCAL="local",Vr.WORLD="world",Vr.VIEW="view",Vr.NORMAL="normal";Nr.addKeyword("viewNormal",function(){return new Vr(Vr.VIEW)});Nr.addKeyword("localNormal",function(){return new Vr(Vr.NORMAL)});Nr.addKeyword("worldNormal",function(){return new Vr(Vr.WORLD)});var ka=class extends Ht{constructor(e){super("v3"),this.nodeType="Position",this.scope=e??ka.LOCAL}getType(){switch(this.scope){case ka.PROJECTION:return"v4"}return this.type}getShader(){switch(this.scope){case ka.LOCAL:case ka.WORLD:return!1}return!0}generate(e,t,i,r,s){let a;switch(this.scope){case ka.LOCAL:e.isShader("vertex")?a="transformed":(e.requires.position=!0,a="vPosition");break;case ka.WORLD:if(e.isShader("vertex"))return"( modelMatrix * vec4( transformed, 1.0 ) ).xyz";e.requires.worldPosition=!0,a="vWPosition";break;case ka.VIEW:a=e.isShader("vertex")?"-mvPosition.xyz":"vViewPosition";break;case ka.PROJECTION:a=e.isShader("vertex")?"( projectionMatrix * modelViewMatrix * vec4( position, 1.0 ) )":"vec4( 0.0 )";break}return e.format(a,this.getType(),t)}},Rs=ka;Rs.LOCAL="local",Rs.WORLD="world",Rs.VIEW="view",Rs.PROJECTION="projection";Nr.addKeyword("position",function(){return new Rs});Nr.addKeyword("worldPosition",function(){return new Rs(Rs.WORLD)});Nr.addKeyword("viewPosition",function(){return new Rs(Rs.VIEW)});var ia=class extends Ht{constructor(e){super("v3"),this.nodeType="Reflect",this.scope=e??ia.CUBE}getUnique(e){return!e.context.viewNormal}getType(){switch(this.scope){case ia.SPHERE:return"v2"}return this.type}generate(e,t){let i=this.getUnique(e);if(e.isShader("fragment")){let r;switch(this.scope){case ia.VECTOR:{let s=new Vr(Vr.VIEW),a=e.context.roughness,n=s.build(e,"v3"),o=new Rs(Rs.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 ia.CUBE:{let s=new ia(ia.VECTOR).build(e,"v3"),a="vec3( -"+s+".x, "+s+".yz )";i?(e.addNodeCode(`vec3 reflectCubeVec = ${a};`),r="reflectCubeVec"):r=a;break}case ia.SPHERE:{let s="normalize( ( viewMatrix * vec4( "+new ia(ia.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)}},sh=ia;sh.CUBE="cube",sh.SPHERE="sphere",sh.VECTOR="vector";var t8=class extends Ht{constructor(e=new Xa,t,i){super("v4"),this.nodeType="TextureCube",this.value=e,this.radianceNode=new B0(this.value,t??new sh(sh.VECTOR),i),this.irradianceNode=new B0(this.value,new Vr(Vr.WORLD),new ze(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))}},i8=class extends Wr{constructor(e=new by,t,i){super("v4",{shared:!0}),this.nodeType="CubeTexture",this.value=e,this.uv=t??new sh,this.bias=i}getTexture(e,t){return super.generate(e,t,this.value.uuid,"tc")}generate(e,t){var l;if(t==="samplerCube")return this.getTexture(e,t);let i=this.getTexture(e,t),r=(l=this.uv)==null?void 0:l.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 ca(new $t("",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)}},r8=`
3241uniform int frameIndex;
3242uniform vec2 resolution;
3243uniform mat4 previousModelViewMatrix;
3244uniform mat4 previousProjectionMatrix;
3245
3246varying vec4 vCurrentPosition;
3247varying vec4 vPreviousPosition;
3248`,s8=`
3249layout(location = 1) out vec4 gVelocity;
3250
3251uniform int frameIndex;
3252uniform vec2 resolution;
3253
3254varying vec4 vCurrentPosition;
3255varying vec4 vPreviousPosition;
3256
3257const vec2 haltonSequence[16] = vec2[16](
3258vec2( 0.000000,-0.333334),
3259vec2(-0.500000, 0.333334),
3260vec2( 0.500000,-0.777778),
3261vec2(-0.750000,-0.111112),
3262vec2( 0.250000, 0.555556),
3263vec2(-0.250000,-0.555556),
3264vec2( 0.750000, 0.111112),
3265vec2(-0.875000, 0.777778),
3266vec2(0.125000, -0.925926),
3267vec2(-0.375000, -0.259260),
3268vec2(0.625000, 0.407408),
3269vec2(-0.625000, -0.703704),
3270vec2(0.375000, -0.037038),
3271vec2(-0.125000, 0.629630),
3272vec2(0.875000, -0.481482),
3273vec2(-0.937500, 0.185186));
3274
3275vec2 vogelDiskSample(int sampleIndex, int sampleCount, float angle) {
3276  const float goldenAngle = 2.399963f; // radians
3277  float r = sqrt(float(sampleIndex) + 0.5f) / sqrt(float(sampleCount));
3278  float theta = float(sampleIndex) * goldenAngle + angle;
3279  float sine = sin(theta);
3280  float cosine = cos(theta);
3281  return vec2(cosine, sine) * r;
3282}
3283
3284// Derived from the interleaved gradient function from Jimenez 2014 http:goo.gl/eomGso
3285float getNoiseInterleavedGradient(vec2 screenPos) {
3286    vec3 magic = vec3(0.06711056f, 0.00583715f, 52.9829189f);
3287    return fract(magic.z * fract(dot(screenPos, magic.xy)));
3288}
3289
3290`,a8=`
3291// TODO: This could be generated CPU side and passed to the shader every frame
3292const vec2 haltonSequence[16] = vec2[16](
3293vec2( 0.000000,-0.333334),
3294vec2(-0.500000, 0.333334),
3295vec2( 0.500000,-0.777778),
3296vec2(-0.750000,-0.111112),
3297vec2( 0.250000, 0.555556),
3298vec2(-0.250000,-0.555556),
3299vec2( 0.750000, 0.111112),
3300vec2(-0.875000, 0.777778),
3301vec2(0.125000, -0.925926),
3302vec2(-0.375000, -0.259260),
3303vec2(0.625000, 0.407408),
3304vec2(-0.625000, -0.703704),
3305vec2(0.375000, -0.037038),
3306vec2(-0.125000, 0.629630),
3307vec2(0.875000, -0.481482),
3308vec2(-0.937500, 0.185186));
3309
3310// TODO: Pass correct view size
3311vec2 offset = haltonSequence[frameIndex];
3312offset.x /= resolution.x;
3313offset.y /= resolution.y;
3314
3315vec4 currentPosition = gl_Position;
3316vec4 currentPositionJittered = currentPosition + (vec4(offset.x, offset.y, 0.0, 0.0) * currentPosition.w);
3317
3318// We want to calculate the velocity with unjittered positions
3319// so that things that are not moving get a velocity = 0
3320vCurrentPosition = currentPosition;
3321vPreviousPosition = previousProjectionMatrix * previousModelViewMatrix * vec4(transformed, 1.0);
3322#ifdef OUTLINE_COMPENSATION
3323vPreviousPosition.xy += OUTLINE_COMPENSATION;
3324#endif
3325gl_Position = currentPositionJittered;
3326
3327`,n8=`
3328vec2 oldPos = vPreviousPosition.xy;
3329    oldPos /= vPreviousPosition.w;
3330    oldPos.xy = (oldPos.xy+1.)/2.0;
3331
3332vec2 newPos = vCurrentPosition.xy;
3333    newPos /= vCurrentPosition.w;
3334    newPos.xy = (newPos.xy+1.)/2.0;
3335
3336vec2 velocity = (newPos - oldPos);
3337
3338// Discard fully transparent pixels 
3339if (gl_FragColor.a <= 0.0) discard;
3340
3341gVelocity = vec4(velocity, 0.0, 1.0);
3342`,o8=`
3343layout(location = 1) out vec4 gVelocity;
3344`,l8=`
3345    // Discard fully transparent pixels 
3346    if (gl_FragColor.a <= 0.0) discard;
3347
3348    gVelocity = vec4(0.0, 0.0, 0.0, 1.0);
3349`,JS=["x","y","z","w"],h8=["float","vec2","vec3","vec4"],c8={float:"f",vec2:"v2",vec3:"v3",vec4:"v4",mat4:"v4",int:"i",bool:"b","float[]":"f[]","vec4[]":"v4[]"},d8={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[]"},gC=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+`
3350`);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",`
3351			// NOTE: Include Spline's blending modes. This could be part of BlendNode
3352			#define SPE_BLENDING_NORMAL 0
3353			#define SPE_BLENDING_MULTIPLY 1
3354			#define SPE_BLENDING_SCREEN 2
3355			#define SPE_BLENDING_OVERLAY 3
3356
3357			vec3 spe_normalBlend( vec3 a, vec3 b, float alpha ) {
3358				return mix( a, b, alpha );
3359			}
3360
3361			vec3 spe_multiplyBlend( vec3 a, vec3 b, float alpha ) {
3362				return mix( a, a * b, alpha );
3363			}
3364
3365			vec3 spe_screenBlend( vec3 a, vec3 b, float alpha ) {
3366				vec3 tmp = 1.0 - ( 1.0 - a ) * ( 1.0 - b );
3367				return mix( a, tmp, alpha );
3368			}
3369
3370			vec3 spe_overlayBlend( vec3 a, vec3 b, float alpha ) {
3371				vec3 tmp = mix( 1. - 2. * (1. - a) * (1. - b), 2. * a * b, step( a, vec3(.5) ) );
3372				return clamp( mix( a, tmp, alpha ), 0.0, 1.0 );
3373			}
3374
3375			vec3 spe_blend( vec3 a, vec3 b, float alpha, int mode ) {
3376				if ( mode == SPE_BLENDING_NORMAL ) return spe_normalBlend( a, b, alpha );
3377				else if ( mode == SPE_BLENDING_MULTIPLY ) return spe_multiplyBlend( a, b, alpha );
3378				else if ( mode == SPE_BLENDING_SCREEN ) return spe_screenBlend( a, b, alpha );
3379				else if ( mode == SPE_BLENDING_OVERLAY ) return spe_overlayBlend( a, b, alpha );
3380				return vec3( 1.0 );
3381			}
3382			`,"#include <packing>","#include <common>"].join(`
3383`),this.parsCode={vertex:["float neighbor_offset = 0.0001;",""].join(`
3384`),fragment:["float accumAlpha = 0.0;",`void accumulateAlpha(float alpha) {
3385					accumAlpha += (1.0 - accumAlpha) * alpha;
3386				}`,""].join(`
3387`)},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(r8),this.addFragmentParsCode(s8),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(`
3388				#ifndef SHAPEBLEND 
3389					vObjectNormal = normal;
3390				#else
3391					vObjectNormal = objectNormal;
3392				#endif
3393			`)),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(a8),this.addFragmentFinalCode(n8)),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+`
3394`}addVertexNodeCode(e){this.addNodeCode(e,"vertex")}addFragmentNodeCode(e){this.addNodeCode(e,"fragment")}addNodeCode(e,t){this.nodeCode[t??this.shader]+=e+`
3395`}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+`
3396`}addVertexParsCode(e){this.addParsCode(e,"vertex")}addFragmentParsCode(e){this.addParsCode(e,"fragment")}addParsCode(e,t){this.parsCode[t??this.shader]+=e+`
3397`}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(`
3398`)}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}];
3399`:i+=t+" "+h+" "+o+`;
3400`}return i}getVars(e){return this.inputs.vars[e??this.shader]}getNodeData(e){let t=e instanceof Bi?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 QS({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 QS({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){var a;let r;if(e=typeof e=="string"?Nr.get(e):e,this.context.include===!1)return e.name;e instanceof Pe?r=this.includes.functions:e instanceof Ft?r=this.includes.consts:e instanceof fC&&(r=this.includes.structs);let s=r[this.shader]=r[this.shader]||[];if(e){let n=s[e.name];if(n||(n=s[e.name]={node:e,deps:[]},s.push(n),n.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),(a=e.includes)==null?void 0:a.length)){let o=0;do this.include(e.includes[o++],t);while(o<e.includes.length)}return i&&(n.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 h8[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!=null&&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 Vo:case jo:return new i8(i);case fd:return new t8(new Xa(i));default:return new Xa(i)}else{if(i.isVector2)return new sr(i);if(i.isVector3)return new ss(i);if(i.isVector4)return new Va(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 c8[e]||e}getFormatByType(e){return d8[e]||e}getUUID(e,t){return t=t!==void 0?t:!0,t&&this.cache&&(e=this.cache+"-"+e),e}getElementByIndex(e){return JS[e]}getIndexByElement(e){return JS.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=Fs,t===Fs&&this.context.gamma&&(t=mt),t}},ui=class extends Wr{constructor(e=0,t,i,r){super("c"),this.nodeType="Color",this.value=e instanceof dr?e:new dr(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)}},Xt=class extends Wr{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)}},Cr=class extends Wr{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)}},vo=class extends Wr{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)}},y1=class extends Wr{},u8=class extends y1{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}},z0=class extends y1{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)}},vC=class extends Wr{constructor(e){super("m3"),this.nodeType="Matrix3",this.value=e??new Mi}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)}},xa=class extends Wr{constructor(e){super("m4"),this.nodeType="Matrix4",this.value=e??new be}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 $S(e,t,i,r=0){e.setUvTransform(i[0],i[1],t[0],t[1],0,0,0).premultiply(new Mi().makeRotation(r*Oe.DEG2RAD))}var p8=class extends vC{constructor(e,t,i=0){super(new Mi),this.repeat=e,this.offset=t,this.rotation=i,$S(this.value,e,t,i)}updateMatrix(){$S(this.value,this.repeat,this.offset,this.rotation)}},yo=class extends Wr{constructor(e=1,t){super("v4[]"),this.nodeType="Vector4Array",this.size=e,this.value=Array.isArray(t)?t:t instanceof ht?new Array(e).fill(t):new Array(e).fill(new ht(0))}},e_=class extends Ht{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("+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)}},yC=class extends Ht{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(yC.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)}},F0=yC;F0.Nodes=function(){return{customColor:new Pe(`vec3 customColor(vec3 color, float mask, float alpha, out float calpha) {
3401				float lalpha = alpha * mask;
3402				calpha =  lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0);
3403				accumAlpha += (1.0 - accumAlpha) * lalpha;
3404
3405				return color;
3406			}`)}}();var xC=class extends Ht{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(xC.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)}},bC=xC;bC.Nodes=function(){return{customNormal:new Pe(`vec3 customNormal(vec3 cnormal, vec3 norm, float mask, float alpha, out float calpha) {
3407				vec3 normal = packNormalToRGB( norm ).rgb;
3408				normal *= step( vec3(0.5), cnormal );
3409
3410				float lalpha = alpha * mask;
3411				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3412				accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
3413
3414				return normal;
3415			}`)}}();var Ec=class extends Ht{constructor(e,t,i,r,s,a,n,o,l,h,c,d){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=d,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(Ec.Nodes.cylindrical);break;case 2:r=e.include(Ec.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(`
3416		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) {
3417				vec2 projected = (1. + (position.${n})) / 2.;
3418				vec2 uvs = ( mat * vec3( (projected * 2. - 1.) / (size * .5), 1. ) / 2. + 0.5 ).xy;
3419				writeUv = uvs;
3420
3421				vec4 tmp = texture2D( tex, uvs );
3422
3423				vec3 col = tmp.rgb;
3424				float lalpha = alpha * tmp.a;
3425				${this.side.value===2?"":`lalpha *= step(0.0, ${this.side.value===1?"-1.0 * ":""}dot(vObjectNormal, ${a}));`}
3426
3427				if ( crop > 0.5 ) {
3428					if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 )  {
3429						lalpha = 0.0;
3430					}
3431				}
3432				
3433				lalpha *= mask;
3434
3435				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3436				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3437
3438				return col;
3439			}`);r=e.include(o);break;case 4:r=e.include(Ec.Nodes.triplanar);break;default:r=e.include(Ec.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)}},x1=Ec;x1.Nodes=function(){let e=new Pe(`
3440vec3 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) {
3441                vec3 posN = normalize(position);
3442                float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);
3443                float scaledHeight = position.y / (size.y * 0.5);
3444                float v =  (scaledHeight / 2.) + .5;
3445
3446                vec2 calculatedUv = vec2(u,v);
3447				vec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;
3448				writeUv = uvs;
3449
3450                vec2 df = fwidth(uvs);
3451               	if(df.x > 0.5) df.x = 0.;
3452
3453				#ifdef GL_EXT_shader_texture_lod
3454                vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
3455				#else
3456                vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
3457				#endif
3458
3459				vec3 col = tmp.rgb;
3460				float lalpha = alpha * tmp.a;
3461				if ( crop > 0.5 ) {
3462					if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 )  {
3463						lalpha = 0.0;
3464					}
3465				}
3466
3467				lalpha *= mask;
3468				
3469				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3470				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3471
3472				return col;
3473			}
3474`),t=new Pe(`
3475vec3 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) {
3476                vec3 posN = normalize(vPosition);
3477                float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);
3478                float v = 0.5 + asin(posN.y) / 3.1415;
3479
3480                vec2 calculatedUv = vec2(u,v);
3481				vec2 uvs = ( mat * vec3( calculatedUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;
3482				writeUv = uvs;
3483
3484                vec2 df = fwidth(uvs);
3485               	if(df.x > 0.5) df.x = 0.;
3486				#ifdef GL_EXT_shader_texture_lod
3487                vec4 tmp = texture2DLodEXT(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
3488				#else
3489                vec4 tmp = textureLod(tex, uvs, log2(max(df.x, df.y)*min(textureSize.x, textureSize.y)));
3490				#endif
3491
3492				vec3 col = tmp.rgb;
3493				float lalpha = alpha * tmp.a;
3494				if ( crop > 0.5 ) {
3495					if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 )  {
3496						lalpha = 0.0;
3497					}
3498				}
3499
3500				lalpha *= mask;
3501
3502				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3503				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3504
3505				return col;
3506			}
3507`),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) {
3508				vec2 uvs = ( mat * vec3( vUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;
3509				writeUv = uvs;
3510
3511				vec4 tmp = texture2D( tex, uvs );
3512
3513				vec3 col = tmp.rgb;
3514
3515				float lalpha = alpha * tmp.a;
3516				if ( crop > 0.5 ) {
3517					if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 )  {
3518						lalpha = 0.0;
3519					}
3520				}
3521				
3522				lalpha *= mask;
3523
3524				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
3525				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3526
3527				return col;
3528			}`),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) {
3529				vec3 p = position;
3530				vec2 uv0 = (1.0 + p.xy) / 2.0;     
3531				vec2 uv1 = (1.0 + p.zy) / 2.0;		
3532				vec2 uv2 = (1.0 + p.xz) / 2.0;		
3533	
3534				uv0 = (mat * vec3((uv0 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy;
3535				uv1 = (mat * vec3((uv1 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy;
3536				uv2 = (mat * vec3((uv2 * 2.0 - 1.0) / (size * 0.5), 1.0) / 2.0 + 0.5).xy;
3537
3538				// Range from 3 to 128 seems to be good
3539				float exponent = (1.0 - blending) * 125.0 + 3.0;
3540
3541				vec3 n = vObjectNormal;
3542				vec3 weights = abs(normalize(n));
3543				weights = pow(weights, vec3(exponent));
3544				weights /= dot(weights, vec3(1.0));
3545
3546				// Write out all sets of UVs that we generated
3547				writeUvs0 = uv0;
3548				writeUvs1 = uv1;
3549				writeUvs2 = uv2;
3550				writeWeights = weights;
3551
3552				// Derivatives for LOD
3553				vec2 df0 = fwidth(uv0);
3554				vec2 df1 = fwidth(uv1);
3555				vec2 df2 = fwidth(uv2);
3556				if (df0.x > 0.5) df0.x = 0.0;
3557				if (df1.x > 0.5) df1.x = 0.0;
3558				if (df2.x > 0.5) df2.x = 0.0;
3559
3560				#ifdef GL_EXT_shader_texture_lod
3561                	vec4 tmp = 
3562						texture2DLodEXT(tex, uv0, log2(max(df0.x, df0.y)*min(textureSize.x, textureSize.y))) * weights.z + 
3563						texture2DLodEXT(tex, uv1, log2(max(df1.x, df1.y)*min(textureSize.x, textureSize.y))) * weights.x + 
3564						texture2DLodEXT(tex, uv2, log2(max(df2.x, df2.y)*min(textureSize.x, textureSize.y))) * weights.y;
3565				#else
3566                	vec4 tmp = 
3567						textureLod(tex, uv0, log2(max(df0.x, df0.y)*min(textureSize.x, textureSize.y))) * weights.z + 
3568						textureLod(tex, uv1, log2(max(df1.x, df1.y)*min(textureSize.x, textureSize.y))) * weights.x + 
3569						textureLod(tex, uv2, log2(max(df2.x, df2.y)*min(textureSize.x, textureSize.y))) * weights.y;
3570				#endif
3571
3572				vec3 col = tmp.rgb;
3573				float lalpha = alpha * tmp.a;
3574
3575				// Apply cropping across all 3 planes
3576				if ( crop > 0.5 ) {
3577					if ( uv0.x < 0.0 || uv0.x > 1.0 || uv0.y < 0.0 || uv0.y > 1.0 )  {
3578						lalpha = 0.0;
3579					}
3580					if ( uv1.x < 0.0 || uv1.x > 1.0 || uv1.y < 0.0 || uv1.y > 1.0 )  {
3581						lalpha = 0.0;
3582					}
3583					if ( uv2.x < 0.0 || uv2.x > 1.0 || uv2.y < 0.0 || uv2.y > 1.0 )  {
3584						lalpha = 0.0;
3585					}
3586				}
3587
3588				lalpha *= mask;
3589				calpha =  lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0);
3590				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3591
3592				return col;//n * 0.5 + 0.5;
3593			}			
3594			`);return{cylindrical:e,spherical:t,uv:i,triplanar:r}}();var Cc=class extends Ht{constructor(e,t,i,r,s,a,n,o,l,h,c,d){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=d,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) {
3595               vec4 color = colors[0];
3596               #ifdef ${i}_IS_VECTOR
3597                   #ifdef ${i}_LINEAR
3598                       #ifdef ${i}_WORLDSPACE
3599                       float depth = vectorLinearWorldSpaceDepth(direction, origin, near, far);
3600                       #else
3601                       float depth = vectorLinearObjectSpaceDepth(direction, origin, near, far);
3602                       #endif
3603                   #else
3604                       #ifdef ${i}_WORLDSPACE
3605                           float depth = vectorSphericalWorldSpaceDepth(origin, near, far);
3606                       #else
3607                           float depth = vectorSphericalObjectSpaceDepth(origin, near, far);
3608                       #endif
3609                   #endif
3610               #else
3611                   float dist = length(vWPosition - cameraPosition);
3612			       float depth = ( dist - near ) / ( far - near );
3613               #endif
3614
3615
3616              float p;
3617              #ifdef ${i}_SMOOTH
3618				for ( int i = 1; i < ${i}_MAX_COLORS; i++ ) {
3619						p = clamp( ( depth - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );
3620						color = mix(color, colors[i], smoothstep(0.0, 1.0, p));
3621					}
3622              #else
3623                for ( int i = 1; i < ${i}_MAX_COLORS; i++ ) {
3624                   p = clamp(( depth - steps[i - 1] ) / ( steps[i] - steps[i - 1] ), 0.0, 1.0);
3625                   color = mix(color, colors[i], p);
3626                 }
3627              #endif
3628
3629               float lalpha = alpha * color.a * mask;
3630               calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));
3631			   accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3632			   
3633               return color.rgb;
3634			}`,[Cc.Nodes.vectorLinearWorldSpaceDepth,Cc.Nodes.vectorLinearObjectSpaceDepth,Cc.Nodes.vectorSphericalObjectSpaceDepth,Cc.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)}},wC=Cc;wC.Nodes=function(){let e=new Pe(`float vectorLinearWorldSpaceDepth(vec3 direction, vec3 origin, float near, float far) {
3635               vec3 n = normalize(direction);
3636               float dist = (n.x*(vWPosition.x - origin.x) + n.y*(vWPosition.y - origin.y) + n.z*(vWPosition.z - origin.z));
3637               return ( dist - near ) / ( far - near );
3638            }`),t=new Pe(`float vectorLinearObjectSpaceDepth(vec3 direction, vec3 origin, float near, float far) {
3639               vec3 n = normalize(direction);
3640               float dist = (n.x*(position.x - origin.x) + n.y*(position.y - origin.y) + n.z*(position.z - origin.z));
3641               return ( dist - near ) / ( far - near );
3642            }`),i=new Pe(`float vectorSphericalWorldSpaceDepth(vec3 origin, float near, float far) {
3643               float dist = length(vWPosition - origin);
3644               return ( dist - near ) / ( far - near );
3645            }`),r=new Pe(`float vectorSphericalObjectSpaceDepth(vec3 origin, float near, float far) {
3646               float dist = length(position - origin);
3647               return ( dist - near ) / ( far - near );
3648            }`);return{vectorLinearWorldSpaceDepth:e,vectorLinearObjectSpaceDepth:t,vectorSphericalWorldSpaceDepth:i,vectorSphericalObjectSpaceDepth:r}}();var f8=class extends Ht{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,052 bytes, lines 3648-3704
3648let 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) {
3649					float fresnel = bias + scale * pow( abs( factor + dot( normalize( vWorldViewDir ), normalize( vWNormal ) ) ), intensity );
3650
3651					float lalpha = clamp(fresnel, 0.0, 1.0) * alpha * mask;
3652					calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));
3653					accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3654
3655					return color;
3656				}`),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)}},SC=class extends Ht{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(SC.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)}},_C=SC;_C.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) {
3657				vec4 color = colors[0];
3658				vec2 m = morph / vUv.xy;
3659				vec2 rot = vec2( 0.5 + m.x, m.y );
3660				vec2 dt = vec2(
3661					cos( angle ) * rot.x - sin( angle ) * rot.y,
3662					sin( angle ) * rot.x + cos( angle ) * rot.y
3663				);
3664				vec2 pt = ( vUv - 0.5 + offset ) / 2.0 + dt / 2.0;
3665				float t = dot( pt, dt ) / dot( dt, dt );
3666				if ( gradientType == 1 ) {
3667					t = distance (
3668						( vUv + morph ) * 3.0,
3669						( vUv + offset ) + 1.0
3670					) + angle;
3671				} else if ( gradientType == 2 ) {
3672					float polar = atan(
3673						vUv.x + morph.x - 0.5 + offset.x,
3674						vUv.y + morph.y - 0.5 + offset.y
3675					) * -1.0;
3676					t = fract( ( angle / PI / -2.0 ) + 0.5 * ( polar / PI ) );
3677				}
3678
3679				float p;
3680				if (smoothed) {
3681					for ( int i = 1; i < GRAD_MAX; i++ ) {
3682						p = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );
3683						color = mix(color, colors[i], smoothstep(0.0, 1.0, p));
3684					}
3685
3686				} else {
3687					for ( int i = 1; i < GRAD_MAX; i++ ) {
3688						p = clamp( ( t - steps[i-1] ) / ( steps[i] - steps[i-1] ), 0.0, 1.0 );
3689						color = mix(color, colors[i], p);
3690					}
3691				}
3692
3693				float lalpha = alpha * color.a * mask;
3694				calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));
3695				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3696				
3697				return color.xyz;
3698			}`)}}();var AC=class extends Ht{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(AC.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)}},MC=AC;MC.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) {
3699					vec3 viewDir = normalize( vViewPosition );
3700					vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3701					vec3 y = cross( viewDir, x );
3702					vec2 uv = vec2( dot( x, normal ), dot( y, normal ) );
3703					uv = mat2( cos(rotation), sin(rotation), -sin(rotation), cos(rotation) ) * uv;
3704					uv = uv * 0.495 + 0.5;
3705					vec4 matcapColor = texture2D( matcapTex, uv );
3706
3707					float lalpha = alpha * mask;
3708					calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));
3709					accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
3710					
3711					return matcapColor.rgb;
3712            	}`)}}();var kr=function(){let e=new Pe(`vec3 random3(vec3 c) {
3713			float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0)));
3714			vec3 r;
3715			r.z = fract(512.0*j);
3716			j *= .125;
3717			r.x = fract(512.0*j);
3718			j *= .125;
3719			r.y = fract(512.0*j);
3720			return r-0.5;
3721		}`),t=new Pe(`float simplexFast(vec3 p) {
3722			 vec3 s = floor(p + dot(p, vec3(F3)));
3723			 mediump vec3 x = p - s + dot(s, vec3(G3));
3724			 mediump vec3 hs = s;
3725			 
3726			 mediump vec3 e = step(vec3(0.0), x - x.yzx);
3727			 mediump vec3 i1 = e*(1.0 - e.zxy);
3728			 mediump vec3 i2 = 1.0 - e.zxy*(1.0 - e);
3729				
3730			 mediump vec3 x1 = x - i1 + G3;
3731			 mediump vec3 x2 = x - i2 + 2.0*G3;
3732			 mediump vec3 x3 = x - 1.0 + 3.0*G3;
3733			 
3734			 mediump vec4 w, d;
3735			 
3736			 w.x = dot(x, x);
3737			 w.y = dot(x1, x1);
3738			 w.z = dot(x2, x2);
3739			 w.w = dot(x3, x3);
3740			 
3741			 w = max(0.6 - w, 0.0);
3742			 
3743			 d.x = dot(random3(hs), x);
3744			 d.y = dot(random3(hs + i1), x1);
3745			 d.z = dot(random3(hs + i2), x2);
3746			 d.w = dot(random3(hs + 1.0), x3);
3747			 
3748			 w *= w;
3749			 w *= w;
3750			 d *= w;
3751			 
3752			 return dot(d, vec4(52.0));
3753		}`,[e]);t.keywords.F3=new Ft("float F3 0.3333333"),t.keywords.G3=new Ft("float G3 0.1666667");let i=new Pe(`float simplexPrecise(vec3 p) {
3754			 vec3 s = floor(p + dot(p, vec3(F3)));
3755			 vec3 x = p - s + dot(s, vec3(G3));
3756			 
3757			 vec3 e = step(vec3(0.0), x - x.yzx);
3758			 vec3 i1 = e*(1.0 - e.zxy);
3759			 vec3 i2 = 1.0 - e.zxy*(1.0 - e);
3760				
3761			 vec3 x1 = x - i1 + G3;
3762			 vec3 x2 = x - i2 + 2.0*G3;
3763			 vec3 x3 = x - 1.0 + 3.0*G3;
3764			 
3765			 vec4 w, d;
3766			 
3767			 w.x = dot(x, x);
3768			 w.y = dot(x1, x1);
3769			 w.z = dot(x2, x2);
3770			 w.w = dot(x3, x3);
3771			 
3772			 w = max(0.6 - w, 0.0);
3773			 
3774			 d.x = dot(random3(s), x);
3775			 d.y = dot(random3(s + i1), x1);
3776			 d.z = dot(random3(s + i2), x2);
3777			 d.w = dot(random3(s + 1.0), x3);
3778			 
3779			 w *= w;
3780			 w *= w;
3781			 d *= w;
3782			 
3783			 return dot(d, vec4(52.0));
3784		}`,[e]);i.keywords.F3=new Ft("float F3 0.3333333"),i.keywords.G3=new Ft("float G3 0.1666667");let r=new Pe(`float simplexFractal(vec3 m) {
3785			mat3 rot1 = mat3(-0.37, 0.36, 0.85,-0.14,-0.93, 0.34,0.92, 0.01,0.4);
3786			mat3 rot2 = mat3(-0.55,-0.39, 0.74, 0.33,-0.91,-0.24,0.77, 0.12,0.63);
3787			mat3 rot3 = mat3(-0.71, 0.52,-0.47,-0.08,-0.72,-0.68,-0.7,-0.45,0.56);
3788			return 0.5333333 * simplexFast(m * rot1)
3789				 + 0.2666667 * simplexFast(2.0 * m * rot2)
3790				 + 0.1333333 * simplexFast(4.0 * m * rot3)
3791				 + 0.0666667 * simplexFast(8.0 * m);
3792		}`,[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) {
3793		  const vec2  C = vec2(1.0/6.0, 1.0/3.0) ;
3794		  const vec4  D = vec4(0.0, 0.5, 1.0, 2.0);
3795		  vec3 i  = floor(v + dot(v, C.yyy) );
3796		  vec3 x0 =   v - i + dot(i, C.xxx) ;
3797		  vec3 g = step(x0.yzx, x0.xyz);
3798		  vec3 l = 1.0 - g;
3799		  vec3 i1 = min( g.xyz, l.zxy );
3800		  vec3 i2 = max( g.xyz, l.zxy );
3801		  vec3 x1 = x0 - i1 + 1.0 * C.xxx;
3802		  vec3 x2 = x0 - i2 + 2.0 * C.xxx;
3803		  vec3 x3 = x0 - 1. + 3.0 * C.xxx;
3804		  i = mod(i, 289.0 ); 
3805		  vec4 p = permute( permute( permute( 
3806					 i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
3807				   + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) 
3808				   + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
3809		  float n_ = 1.0/7.0; // N=7
3810		  vec3  ns = n_ * D.wyz - D.xzx;
3811		  vec4 j = p - 49.0 * floor(p * ns.z *ns.z);  //  mod(p,N*N)
3812		  vec4 x_ = floor(j * ns.z);
3813		  vec4 y_ = floor(j - 7.0 * x_ );    // mod(j,N)
3814		  vec4 x = x_ *ns.x + ns.yyyy;
3815		  vec4 y = y_ *ns.x + ns.yyyy;
3816		  vec4 h = 1.0 - abs(x) - abs(y);
3817		  vec4 b0 = vec4( x.xy, y.xy );
3818		  vec4 b1 = vec4( x.zw, y.zw );
3819		  vec4 s0 = floor(b0)*2.0 + 1.0;
3820		  vec4 s1 = floor(b1)*2.0 + 1.0;
3821		  vec4 sh = -step(h, vec4(0.0));
3822		  vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
3823		  vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
3824		  vec3 p0 = vec3(a0.xy,h.x);
3825		  vec3 p1 = vec3(a0.zw,h.y);
3826		  vec3 p2 = vec3(a1.xy,h.z);
3827		  vec3 p3 = vec3(a1.zw,h.w);
3828		  vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
3829		  p0 *= norm.x;
3830		  p1 *= norm.y;
3831		  p2 *= norm.z;
3832		  p3 *= norm.w;
3833		  vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
3834		  m = m * m;
3835		  return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), 
3836										dot(p2,x2), dot(p3,x3) ) );
3837		}`,[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){
3838			vec3 a = floor(p);
3839			vec3 d = p - a;
3840			d = d * d * (3.0 - 2.0 * d);
3841			vec4 b = a.xxyy + vec4(0.0, 1.0, 0.0, 1.0);
3842			vec4 k1 = perm(b.xyxy);
3843			vec4 k2 = perm(k1.xyxy + b.zzww);
3844			vec4 c = k2 + a.zzzz;
3845			vec4 k3 = perm(c);
3846			vec4 k4 = perm(c + 1.0);
3847			vec4 o1 = fract(k3 * (1.0 / 41.0));
3848			vec4 o2 = fract(k4 * (1.0 / 41.0));
3849			vec4 o3 = o2 * d.z + o1 * (1.0 - d.z);
3850			vec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x);
3851			return o4.y * d.y + o4.x * (1.0 - d.y);
3852		}`,[l]),c=new Pe(`float fbm(vec3 x) {
3853			float v = 0.0;
3854			float a = 0.5;
3855			vec3 shift = vec3(100);
3856			for (int i = 0; i < NUM_OCTAVES; ++i) {
3857				v += a * noise(x);
3858				x = x * 2.0 + shift;
3859				a *= 0.5;
3860			}
3861			return v;
3862		}`,[h]);c.keywords.NUM_OCTAVES=new Ft("int NUM_OCTAVES 5");
3862let d=new Pe("vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}"),u=new Pe(`float perlin(vec3 P){
3863		  vec3 Pi0 = floor(P);
3864		  vec3 Pi1 = Pi0 + vec3(1.0);
3865		  Pi0 = mod(Pi0, 289.0);
3866		  Pi1 = mod(Pi1, 289.0);
3867		  vec3 Pf0 = fract(P);
3868		  vec3 Pf1 = Pf0 - vec3(1.0);
3869		  vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
3870		  vec4 iy = vec4(Pi0.yy, Pi1.yy);
3871		  vec4 iz0 = Pi0.zzzz;
3872		  vec4 iz1 = Pi1.zzzz;
3873		  vec4 ixy = permute(permute(ix) + iy);
3874		  vec4 ixy0 = permute(ixy + iz0);
3875		  vec4 ixy1 = permute(ixy + iz1);
3876		  vec4 gx0 = ixy0 / 7.0;
3877		  vec4 gy0 = fract(floor(gx0) / 7.0) - 0.5;
3878		  gx0 = fract(gx0);
3879		  vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);
3880		  vec4 sz0 = step(gz0, vec4(0.0));
3881		  gx0 -= sz0 * (step(0.0, gx0) - 0.5);
3882		  gy0 -= sz0 * (step(0.0, gy0) - 0.5);
3883		  vec4 gx1 = ixy1 / 7.0;
3884		  vec4 gy1 = fract(floor(gx1) / 7.0) - 0.5;
3885		  gx1 = fract(gx1);
3886		  vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);
3887		  vec4 sz1 = step(gz1, vec4(0.0));
3888		  gx1 -= sz1 * (step(0.0, gx1) - 0.5);
3889		  gy1 -= sz1 * (step(0.0, gy1) - 0.5);
3890		  vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);
3891		  vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);
3892		  vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);
3893		  vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);
3894		  vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);
3895		  vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);
3896		  vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);
3897		  vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);
3898		  vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
3899		  g000 *= norm0.x;
3900		  g010 *= norm0.y;
3901		  g100 *= norm0.z;
3902		  g110 *= norm0.w;
3903		  vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
3904		  g001 *= norm1.x;
3905		  g011 *= norm1.y;
3906		  g101 *= norm1.z;
3907		  g111 *= norm1.w;
3908		  float n000 = dot(g000, Pf0);
3909		  float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));
3910		  float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));
3911		  float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));
3912		  float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));
3913		  float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));
3914		  float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));
3915		  float n111 = dot(g111, Pf1);
3916		  vec3 fade_xyz = fade(Pf0);
3917		  vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);
3918		  vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
3919		  float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); 
3920		  return 2.2 * n_xyz;
3921		}`,[s,a,d]),p=new Pe(`float hashwithoutsine13(vec3 p3)
3922		{
3923			p3  = fract(p3 * .1031);
3924			p3 += dot(p3, p3.yzx + 33.33);
3925			return fract((p3.x + p3.y) * p3.z);
3926		}`),f=new Pe(`vec3 hashwithoutsine33(vec3 p3)
3927		{
3928			p3 = fract(p3 * vec3(.1031, .1030, .0973));
3929			p3 += dot(p3, p3.yxz+33.33);
3930			return fract((p3.xxy + p3.yxx)*p3.zyx);
3931		}`),g=new Pe(`float metric(in vec3 p)
3932		{
3933			// L2 
3934			return length(p);
3935
3936			// Chebyshev 
3937			// vec3 a = abs(p);
3938			// return max(a.x, max(a.y, a.z));
3939		}`),m=new Pe(`float smin( float a, float b, float k )
3940		{
3941			float h = smoothstep(0.0, 1.0, 0.5 + 0.5 * (b - a) / k);
3942			float correction = k * h * (1.0 - h);
3943			return mix(b, a, h) - correction;
3944		}`),v=new Pe(`float smax( float a, float b, float k )
3945		{
3946			float h = smoothstep(1.0, 0.0, 0.5 + 0.5 * (a - b) / k);
3947			float correction = k * h * (1.0 - h);
3948			return mix(a, b, h) + correction;
3949		}`),y=new Pe(`float remap(float value, float input_min, float input_max, float output_min, float output_max) {
3950			// Compute width of each interval
3951			float input_width = input_max - input_min;
3952			float output_width = output_max - output_min;
3953		
3954			// Convert input range into a 0-1 range 
3955			float scaled = (value - input_min) / input_width;
3956		
3957			// Convert the 0-1 range into a value in output range
3958			return output_min + (scaled * output_width);
3959		}`),x=new Pe(`float voronoi(in vec3 x, in int style, in float smoothness, in float seed, in int quality) 
3960		{
3961			// Integer and fractional parts of this point's coordinates
3962			ivec3 p = ivec3(floor(x));
3963			vec3 f = fract(x);
3964
3965			// Different variables that we will use to construct noise:
3966			//
3967			// f1: distance to the closest feature point
3968			// f2: distance to the second closest feature point
3969			// e: distance to the closest edge (cell boundary)
3970			//
3971			// We also compute "smooth" versions of all of the above quantites, essentially
3972			// replacing "hard" minimums with "smooth" minimums (described by IQ)
3973			float f1_smooth = 8.0;
3974			float f1 = 8.0;
3975			float f2_smooth = 8.0;
3976			float f2 = 8.0;
3977			float e_smooth = 8.0;
3978			float e = 8.0;
3979
3980			// Variables stored from closest cell
3981			ivec3 mb;
3982			vec3 mr; 
3983
3984			int steps = quality;
3985			
3986			for (int x = -steps; x <= steps; x++) 
3987			for (int y = -steps; y <= steps; y++)
3988			for (int z = -steps; z <= steps; z++)
3989			{
3990				ivec3 b = ivec3(x, y, z);
3991				vec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f;
3992				float d = length(r);
3993				
3994				f1_smooth = smin(d, f1_smooth, smoothness);
3995
3996				// Store un-smoothed distances too 
3997				if (d < f1) 
3998				{
3999					f2 = f1;
4000					f1 = d;
4001
4002					mb = ivec3(x, y, z);
4003					mr = r;
4004				} 
4005				else if (d < f2) 
4006				{
4007					f2 = d;
4008				}
4009			}	
4010			
4011			// Second pass for edge distance  
4012			// skip for styles don't need
4013			if (style != 0 &&  style != 5 && style != 7)
4014			for (int x = -steps; x <= steps; x++) 
4015			for (int y = -steps; y <= steps; y++)
4016			for (int z = -steps; z <= steps; z++)
4017			{
4018				// Start search at the cell that contains the closest point to "x" (found in 1st pass)
4019				ivec3 b = mb + ivec3(x, y, z);
4020				vec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f;
4021				float d1 = dot(0.5 * (mr + r), (r - mr)); 				// IQ normalizes "r - mr" but that breaks things for the smooth version?
4022				float d2 = dot(0.5 * (mr + r), normalize(r - mr));
4023
4024				e_smooth = smin(d1, e_smooth, smoothness);
4025
4026				e = min(e, d2);
4027
4028				// Also compute a smooth version of F2 in this pass
4029				{
4030					ivec3 b = ivec3(x, y, z);
4031					if (b != mb) 
4032					{
4033						vec3 r = vec3(b) + hashwithoutsine33(vec3(p + b) + seed) - f;
4034						float d = length(r);
4035
4036						f2_smooth = smin(d, f2_smooth, smoothness);
4037					}
4038				}
4039			}
4040
4041			// Different visualization modes 
4042			if (style == 0) 
4043			{
4044				return f1_smooth;
4045			}
4046			if (style == 1) 
4047			{
4048				return f2_smooth;
4049			}
4050			if (style == 2) 
4051			{
4052				return f2_smooth - f1_smooth;
4053				
4054				// "Pebbles" also cool
4055				//return step(0.2, f2_smooth - f1_smooth);
4056			}
4057			if (style == 3) 
4058			{
4059				// This one is really good for rock / stone effects
4060				float a = f1; 
4061				float b = f2;
4062				float k = 3.0;
4063				float h = max(k - abs(a - b), 0.0) / k;
4064				float final = min(a, b) - h * h * k * (1.0 / 4.0);
4065				return final;
4066			}
4067			if (style == 4) 
4068			{
4069				// Some random adjustments to make this style stand out more 
4070				return exp(5.0 * e_smooth);
4071			}
4072			if (style == 5) 
4073			{
4074				return pow(f1_smooth, 3.0);
4075			}
4076			if (style == 6) 
4077			{				
4078				const float eps = 0.0125;
4079
4080				// Thicker lines as the user increases the smoothness slider
4081				float thickness = smoothness * 0.25 + eps;
4082
4083				// Blurrier lines as the user increases the smoothness slider
4084				float blur = pow(smoothness, 3.0) * 0.25 + eps;
4085
4086				return smoothstep(
4087					thickness - thickness * blur, 
4088					thickness + thickness * blur, 
4089					e
4090				);
4091			}
4092			if (style == 7) 
4093			{
4094				return hashwithoutsine13(vec3(p + mb) + seed);
4095			}
4096		}
4097	`,[p,f,g,m,v,y]);return{simplexFast:t,simplexPrecise:i,simplexFractal:r,simplexAshima:n,fbm:c,perlin:u,voronoi:x}}(),EC=class extends Ht{constructor(e,t,i,r,s,a,n,o,l,h,c,d,u,p,f,g,m,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=d,this.voronoiStyle=p,this.highCut=f,this.lowCut=g,this.smoothness=m,this.seed=v,this.quality=y,this.isMask=u,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"?`
4098		float v = ${a}(st + move, voronoiStyle, smoothness, seed, quality);
4099
4100		// Apply clipping to colors
4101		v = remap(v, lowCut, highCut, 0.0, 1.0);
4102		v = smax(v, 0.0, smoothness * 0.25);
4103		v = smin(v, 1.0, smoothness * 0.25);
4104
4105		// Note that the voronoi mode only uses colors "A" and "C" from the UI 
4106		vec4 color = mix(colorA, colorC, v); 
4107		`:`
4108		vec3 q = vec3(${a}(st),
4109					   ${a}(st + vec3(1.0)),
4110					   ${a}(st + vec3(1.0)));
4111		vec3 r = vec3(${a}(st + vec3(distortion, 1.0) * q + vec3(fA, 1.0) + move),
4112					  ${a}(st + vec3(distortion, 1.0) * q + vec3(fB, 1.0) + move), 
4113					  ${a}(st * q));
4114		float f = ${a}(st + r);
4115		vec4 color;
4116		color = mix(colorA, colorB, clamp((f * f) * 4.0, 0.0, 1.0));
4117		color = mix(color, colorC, clamp(length(q), 0.0, 1.0));
4118		color = mix(color, colorD, clamp(length(r.x), 0.0, 1.0));
4119		`,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) 
4120			{
4121                // Prevent scale of zero 
4122				scale = max(abs(scale), 0.001);
4123
4124				vec3 st = position / size;
4125				st /= scale;
4126
4127				${n}
4128
4129				float lalpha = alpha * color.a * mask;
4130				calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));
4131				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
4132
4133				return clamp(color, 0.0, 1.0).rgb;
4134			}`,[kr.simplexFast,kr.simplexFractal,kr.simplexAshima,kr.fbm,kr.perlin,kr.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)}};EC.numOctaves=5;var CC=class extends Ht{constructor(e,t,i,r,s,a,n,o,l,h,c,d,u,p,f,g){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=d,this.normalMap=u,this.depthMap=p,this.pixelRatio=f,this.alpha=g,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(`
4135                vID = randomColor.r;
4136                vec2 ${i}_offset = vec2(0.0);
4137                if (${a}) {
4138                    vec4 ${i}_clipPosition = projectionMatrix * (modelViewMatrix * vec4(transformed, 1.0));
4139                    // NOTE: For certain shapes, like spheres, we get incorrect extrusion when the
4140                    // normals face the camera directly. So we hackily fix this by offsetting the normal
4141                    // by a tiny amount.
4142                    vec3 ${i}_clipNormal = mat3(projectionMatrix) * (mat3(modelViewMatrix) * extrudeNormal) + 0.0000001;
4143                    ${i}_offset = normalize(${i}_clipNormal.xy) / ${s} * (${r} / 2.0) * ${i}_clipPosition.w * 2.0 * ${n};
4144                    ${i}_clipPosition.xy += ${i}_offset;
4145                    // TODO(MAX): To handle multiple outline layers, we only want to extrude
4146                    // if this offset is the biggest of all the potential offsets
4147                    gl_Position = ${i}_clipPosition;
4148                }
4149            `)}if(e.isShader("fragment")){e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let r=e.include(CC.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."),""}},TC=CC;TC.Nodes=function(){let e=new Pe(`
4150float sobelSample(sampler2D t, sampler2D d, vec2 uv, vec2 resolution, float outlineWidth, float pixelRatio)
4151{
4152    vec2 halton = haltonSequence[frameIndex];
4153    float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);
4154    float temporalAngle  = temporalOffset * PI2;
4155
4156    vec2 texelSize = (vec2(1.0) / resolution);
4157    vec2 offsetSize = texelSize * outlineWidth * pixelRatio;
4158
4159    vec2 uvSamples[9];
4160    vec4 normalSamples[9];
4161
4162	uvSamples[0] = uv + vec2( -offsetSize.x, -offsetSize.y) + (vogelDiskSample(0, 9, temporalAngle) * texelSize);
4163	uvSamples[1] = uv + vec2(0.0, -offsetSize.y) + (vogelDiskSample(1, 9, temporalAngle) * texelSize);
4164	uvSamples[2] = uv + vec2(  offsetSize.x, -offsetSize.y) + (vogelDiskSample(2, 9, temporalAngle) * texelSize);
4165	uvSamples[3] = uv + vec2( -offsetSize.x, 0.0) + (vogelDiskSample(3, 9, temporalAngle) * texelSize);
4166	uvSamples[4] = uv;
4167	uvSamples[5] = uv + vec2(  offsetSize.x, 0.0) + (vogelDiskSample(5, 9, temporalAngle) * texelSize);
4168	uvSamples[6] = uv + vec2( -offsetSize.x, offsetSize.y) + (vogelDiskSample(6, 9, temporalAngle) * texelSize);
4169	uvSamples[7] = uv + vec2(0.0, offsetSize.y) + (vogelDiskSample(7, 9, temporalAngle) * texelSize);
4170	uvSamples[8] = uv + vec2(  offsetSize.x, offsetSize.y) + (vogelDiskSample(8, 9, temporalAngle) * texelSize);
4171
4172
4173    normalSamples[0] = texture2D(t, uvSamples[0]);
4174    normalSamples[1] = texture2D(t, uvSamples[1]);
4175    normalSamples[2] = texture2D(t, uvSamples[2]);
4176    normalSamples[3] = texture2D(t, uvSamples[3]);
4177    normalSamples[4] = texture2D(t, uvSamples[4]);
4178    normalSamples[5] = texture2D(t, uvSamples[5]);
4179    normalSamples[6] = texture2D(t, uvSamples[6]);
4180    normalSamples[7] = texture2D(t, uvSamples[7]);
4181    normalSamples[8] = texture2D(t, uvSamples[8]);
4182
4183    float depthBias = 0.0001;
4184    // TODO(MAX): Can we somehow reduce the number of conditionals here with MATH?!
4185    if (normalSamples[0].a != vID && normalSamples[0].a != 0.0) {
4186        float depthAtSample = texture2D(d, uvSamples[0]).r + depthBias;
4187        if (gl_FragCoord.z > depthAtSample) {
4188           return 0.0;
4189        }
4190    }
4191
4192    if (normalSamples[1].a != vID && normalSamples[1].a != 0.0) {
4193        float depthAtSample = texture2D(d, uvSamples[1]).r + depthBias;
4194        if (gl_FragCoord.z > depthAtSample) {
4195           return 0.0;
4196        }
4197    }
4198
4199    if (normalSamples[2].a != vID && normalSamples[2].a != 0.0) {
4200        float depthAtSample = texture2D(d, uvSamples[2]).r + depthBias;
4201        if (gl_FragCoord.z > depthAtSample) {
4202           return 0.0;
4203        }
4204    }
4205
4206    if (normalSamples[3].a != vID && normalSamples[3].a != 0.0) {
4207        float depthAtSample = texture2D(d, uvSamples[3]).r + depthBias;
4208        if (gl_FragCoord.z > depthAtSample) {
4209           return 0.0;
4210        }
4211    }
4212
4213
4214    if (normalSamples[4].a != vID && normalSamples[4].a != 0.0) {
4215        float depthAtSample = texture2D(d, uvSamples[4]).r + depthBias;
4216        if (gl_FragCoord.z > depthAtSample) {
4217           return 0.0;
4218        }
4219    }
4220
4221    if (normalSamples[5].a != vID && normalSamples[5].a != 0.0) {
4222        float depthAtSample = texture2D(d, uvSamples[5]).r + depthBias;
4223        if (gl_FragCoord.z > depthAtSample) {
4224           return 0.0;
4225        }
4226    }
4227
4228    if (normalSamples[6].a != vID && normalSamples[6].a != 0.0) {
4229        float depthAtSample = texture2D(d, uvSamples[6]).r + depthBias;
4230        if (gl_FragCoord.z > depthAtSample) {
4231           return 0.0;
4232        }
4233    }
4234
4235    if (normalSamples[7].a != vID && normalSamples[7].a != 0.0) {
4236        float depthAtSample = texture2D(d, uvSamples[7]).r + depthBias;
4237        if (gl_FragCoord.z > depthAtSample) {
4238           return 0.0;
4239        }
4240    }
4241
4242    if (normalSamples[8].a != vID && normalSamples[8].a != 0.0) {
4243        float depthAtSample = texture2D(d, uvSamples[8]).r + depthBias;
4244        if (gl_FragCoord.z > depthAtSample) {
4245           return 0.0;
4246        }
4247    }
4248
4249    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);
4250  	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);
4251
4252    float edgeNormal = sqrt(dot(sobel_edge_h, sobel_edge_h) + dot(sobel_edge_v, sobel_edge_v));
4253    return edgeNormal;
4254}
4255`);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) {
4256                vec3 result = outlineColor;
4257                float resultAlpha = 0.0;
4258
4259                vec3 N = normalize(vWNormal);
4260                vec2 nuv = (gl_FragCoord.xy / resolution);
4261                float sobelSample = compensation ? sobelSample(normalMap, depthMap, nuv, resolution, outlineWidth / 2., pixelRatio) : sobelSample(normalMap, depthMap, nuv, resolution, outlineWidth, pixelRatio);
4262                resultAlpha = smoothstep(outlineThreshold - outlineSmoothing, outlineThreshold + outlineSmoothing, sobelSample);
4263
4264                //resultAlpha = 1.0;
4265                //result = vec3(sobelSample);
4266
4267                float t = 1.0 - contourThreshold;
4268                if(positionalLines) {
4269                    vec3 NDir = position * contourDirection;
4270                    float NT = NDir.x + NDir.y + NDir.z;
4271                    float f  = fract(NT * contourFrequency * 0.01);
4272                    float df = fwidth(NT * contourFrequency);
4273
4274                    float g = smoothstep(df * (contourWidth * 0.01), df * (contourWidth * 0.01 * 2.0), f);
4275                    if (g < 1.0 && resultAlpha == 0.0) {
4276                        result = contourColor;
4277                        resultAlpha = 1.0;
4278                    }
4279                 }
4280                 else {
4281                    vec3 NDir = N * contourDirection;
4282                    float NT = NDir.x + NDir.y + NDir.z;
4283                    float df = fwidth(NT * contourThreshold);
4284                    float f = sin(NT * 1.0 * contourFrequency);
4285                    float g = smoothstep(0.0, df * contourWidth, 1.0 - f);
4286
4287                    if (df > (t * 0.5) && g < 1.0 && resultAlpha == 0.0) {
4288                        result = contourColor;
4289                        resultAlpha = 1.0 - g;
4290                    }
4291                 }
4292
4293                 float lalpha = alpha * resultAlpha * mask;
4294                 calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
4295                 accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
4296				 
4297                 return result;
4298             }`,[e])}}();var Ua=class extends Ht{constructor(e,t,i,r,s,a,n,o,l,h,c,d,u,p,f,g,m,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=d,this.rotation=u,this.vertical=p,this.horizontal=f,this.sides=g,this.isMask=v,this.alpha=m,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)
4299				{
4300					vec3 p3 = fract(vec3(p.xyx) * .1031);
4301					p3 += dot(p3, p3.yzx + 33.33);
4302					return fract((p3.x + p3.y) * p3.z);
4303				}`),a=new Pe(`vec2 rotate_uv(in vec2 uv, float a, bool repeat) 
4304				{
4305					const float mid = 0.5;
4306					float radians = a * (PI / 180.0);
4307					vec2 rotated = vec2(
4308						cos(radians) * (uv.x - mid) + sin(radians) * (uv.y - mid) + mid,
4309						cos(radians) * (uv.y - mid) - sin(radians) * (uv.x - mid) + mid
4310					);
4311					return repeat ? fract(rotated): rotated;
4312				}`),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)`,d=this.style.value===2?`${i}(uv1, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv1, frequency, size, variation, smoothness_remapped, zigzag, rotation)`,u=this.style.value===2?`${i}(uv2, frequency, size, variation, smoothness_remapped, zigzag, rotation, sides)`:`${i}(uv2, frequency, size, variation, smoothness_remapped, zigzag, rotation)`;n=`
4313				vec3 p = position;
4314				float factor = 0.0125;
4315				vec2 uv0 = fract(p.xy * factor);
4316				vec2 uv1 = fract(p.zy * factor);
4317				vec2 uv2 = fract(p.xz * factor);
4318				
4319				uv0 = rotate_uv(uv0 + offset, rotation, true);
4320				uv1 = rotate_uv(uv1 + offset, rotation, true);
4321				uv2 = rotate_uv(uv2 + offset, rotation, true);
4322	
4323				float d0 = ${c};
4324				float d1 = ${d};
4325				float d2 = ${u};
4326				
4327				// Range from 3 to 128 seems to be good
4328				float exponent = (1.0 - blending) * 125.0 + 3.0;
4329
4330				vec3 n = vObjectNormal;
4331				vec3 weights = abs(normalize(n));
4332				weights = pow(weights, vec3(exponent));
4333				weights /= dot(weights, vec3(1.0));
4334				d0 *= weights.z;
4335				d1 *= weights.x;
4336				d2 *= weights.y;
4337				float draw = d0 + d1 + d2;
4338	
4339				vec2 custom_uv = uv0 * weights.z + uv1 * weights.x + uv2 * weights.y;
4340				`}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)`,d="";this.axis.value===0?d=`float radius = length(p);
4341					float theta = atan(p.y, p.z);
4342					float phi = acos(p.x / radius);`:this.axis.value===1?d=`float radius = length(p);
4343					float theta = atan(p.x, p.z);
4344					float phi = acos(p.y / radius);`:(this.axis.value,d=`float radius = length(p);
4345					float theta = atan(p.y, p.x);
4346					float phi = acos(p.z / radius);`);let u="";switch(this.projection.value){case 0:u="custom_uv = vUv.st;";break;case 1:break;case 2:u=`
4347							vec3 p = position;
4348							${d}
4349							custom_uv = vec2(theta, phi);
4350							custom_uv /= PI;
4351							`;break}n=`
4352				vec2 custom_uv;
4353				${u}
4354	
4355				custom_uv += offset;
4356				custom_uv = fract(custom_uv);
4357				custom_uv = rotate_uv(custom_uv, rotation, true);
4358	
4359				float draw = ${c};
4360				`}
vendor: 4,304 bytes, lines 4360-4433
4360let 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) {
4361					const float TWO_PI = PI * 2.0;
4362					float smoothness_remapped = pow(smoothness, 5.0);	
4363
4364					${n}
4365
4366					// Construct final output color
4367					vec4 color = mix(colorA, colorB, draw);
4368					color.a = clamp(color.a, 0.0, 1.0);
4369
4370					// Apply cuts
4371					color.a *= 
4372						step(vertical.x, custom_uv.y) * 
4373						step(custom_uv.y, vertical.y);
4374					color.a *= 
4375						step(horizontal.x, abs(custom_uv.x)) * 
4376						step(abs(custom_uv.x), horizontal.y);
4377
4378					// Accumulate alpha 
4379					float lalpha = alpha * clamp(color.a, 0.0, 1.0) * mask;
4380					calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));
4381					accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
4382
4383					return clamp(color, 0.0, 1.0).rgb;
4384				}`,[a,s,Ua.DrawFunctions.circle,Ua.DrawFunctions.ring,Ua.DrawFunctions.polygon,Ua.DrawFunctions.cross,Ua.DrawFunctions.diamond,Ua.DrawFunctions.checkerboard,Ua.DrawFunctions.line,Ua.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)}},PC=Ua;PC.DrawFunctions=function(){let e=new Pe(`float hashwithoutsine12(vec2 p) {
4385				vec3 p3 = fract(vec3(p.xyx) * 0.1031);
4386				p3 += dot(p3, p3.yzx + 33.33);
4387				return fract((p3.x + p3.y) * p3.z);
4388			}`),t=new Pe(`vec2 tile_and_center(in vec2 uv, in vec2 frequency, in float variation, in float zigzag, in float rotation) {
4389                // Create tiles in UV-space
4390                uv *= frequency;
4391
4392                // Integer coords
4393                vec2 i = floor(uv);
4394
4395                // Offset every other row based on zigzag param, then compute fractional coords
4396                float row_offset = mod(i.y, 2.0);
4397                uv.x += row_offset * zigzag;
4398                vec2 f = fract(uv);
4399
4400				// Rotate the tile itself:
4401				// const float mid = 0.5;
4402				// f = vec2(
4403				// 	cos(rotation) * (f.x - mid) + sin(rotation) * (f.y - mid) + mid,
4404				// 	cos(rotation) * (f.y - mid) - sin(rotation) * (f.x - mid) + mid
4405				// );
4406				// f = fract(f);
4407
4408                f = f * 2.0 - 1.0;
4409
4410				// Recompute integer coords after shifting - then, random value per tile 
4411				i = floor(uv);
4412				float rand = (hashwithoutsine12(i) * 5.0 + 1.0);
4413				float jitter = mix(1.0, rand, variation);
4414				f *= jitter;
4415
4416                return f;
4417            }`,[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) {
4418                vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);
4419                return smoothstep(
4420                    -smoothness, 
4421                     smoothness, 
4422                     length(f) - size
4423                );
4424            }`,[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) {
4425                vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);
4426
4427				float d = length(f);
4428                const float inner_width = 0.5;
4429
4430                float outer = smoothstep(-smoothness, smoothness, d - size);
4431                float inner = smoothstep(-smoothness, smoothness, d - size * inner_width);
4432				return outer + (1.0 - inner);   
4433            }
4433`,[t]),s=new Pe(`float sdf_ngon(in vec2 p, in float r, in int n) {
4434                float an = (PI * 2.0) / float(n);
4435                float he = r * tan(0.5 * an);
4436                
4437                // Rotate to first sector
4438                p = -p.yx; 
4439                float bn = an * floor((atan(p.y, p.x) + 0.5 * an) / an);
4440                vec2  cs = vec2(cos(bn), sin(bn));
4441                p = mat2(cs.x, -cs.y, cs.y, cs.x)*p;
4442            
4443                // Side of polygon
4444                return length(p - vec2(r, clamp(p.y, -he, he))) * sign(p.x - r);
4445            }
4446            
4447            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) {
4448                vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);
4449                return smoothstep(-smoothness, smoothness, sdf_ngon(f, size, sides));
4450            }`,[t]),a=new Pe(`float sdf_cross(in vec2 p, in vec2 b, float r ) {
4451                p = abs(p); 
4452				p = (p.y > p.x) ? p.yx : p.xy;
4453                vec2  q = p - b;
4454                float k = max(q.y, q.x);
4455                vec2  w = (k > 0.0) ? q : vec2(b.y - p.x, -k);
4456                return sign(k) * length(max(w, 0.0)) + r;
4457            }
4458            
4459            // Avoid namespace conflicts 
4460            float xcross(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {
4461                vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);
4462                return smoothstep(-smoothness, smoothness, sdf_cross(f, vec2(size, size * 0.25), smoothness));
4463            }`,[t]),n=new Pe(`float ndot(vec2 a, vec2 b) { 
4464                return a.x*b.x - a.y*b.y; 
4465            }
4466            
4467            float sdf_diamond(in vec2 p, in vec2 b) {
4468                p = abs(p);
4469                float h = clamp(ndot(b - 2.0 * p, b) / dot(b, b), -1.0, 1.0);
4470                float d = length(p - 0.5 * b * vec2(1.0 - h, 1.0 + h));
4471                return d * sign(p.x * b.y + p.y * b.x - b.x * b.y);
4472            }
4473
4474            float diamond(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {
4475                vec2 f = tile_and_center(uv, frequency, variation, zigzag, rotation);
4476	            return smoothstep(-smoothness, smoothness, sdf_diamond(f, vec2(size)));
4477            }`,[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) {
4478                uv *= frequency;
4479                vec2 i = floor(uv);
4480
4481                float offset = mod(i.y, 2.0);
4482
4483                uv.x += offset + zigzag * offset;
4484                float x = floor(uv.x);
4485                
4486                return mod(x, 2.0);
4487            }`),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) {
4488                vec2 f = tile_and_center(uv, frequency, 0.0, zigzag, rotation);
4489				
4490				// Different approach for variation param here
4491				float row = floor(uv * frequency).y;
4492				float rand = hashwithoutsine12(vec2(row));
4493				float s = mix(size, size * rand, variation);
4494
4495				return smoothstep(
4496					s - smoothness, 
4497					s + smoothness, 
4498					abs(f.y)
4499				);
4500            }`,[t]),h=new Pe(`// Uses bisection 
4501            float udf_cos(in vec2 p, in float a, in float b, in float c, in float d) {
4502                // Convert all data to a primitive cosine wave
4503                p = c * (p - vec2(d, a));
4504                
4505                const float TWO_PI = PI * 2.0;
4506
4507                // Reduce to principal half cycle
4508                p.x = mod(p.x, TWO_PI); 
4509                if (p.x > PI) {
4510                    p.x = TWO_PI - p.x;
4511                }
4512            
4513                // Find zero of derivative (minimize distance)
4514                float xa = 0.0;
4515                float xb = TWO_PI;
4516
4517                // 24 bit precision
4518                for (int i = 0; i < 24; i++) {
4519                    float x = 0.5 * (xa + xb);
4520                    float y = x - p.x + b * c * sin(x) * (p.y - b * c * cos(x));
4521                    if (y < 0.0) xa = x; 
4522                    else xb = x;
4523                }
4524                float x = 0.5 * (xa + xb);
4525                
4526                // Compute distance    
4527                vec2 q = vec2(x, b * c * cos(x));
4528                return length(p - q) / c;
4529            }
4530
4531            float wave(in vec2 uv, in vec2 frequency, in float size, in float variation, in float smoothness, in float zigzag, in float rotation) {
4532                float repeat = frequency.x;
4533                uv *= repeat;
4534                vec2 i = floor(uv);
4535                float row_offset = mod(i.y, 2.0);
4536                uv.x += row_offset * zigzag;
4537                vec2 f = vec2(uv.x, fract(uv.y));
4538
4539                // Generalized cosine: y(x) = a + b * cos(cx + d)
4540                const float amplitude = 0.125;
4541                float wave_frequency = frequency.y * 0.1;
4542                float distance_estimate = udf_cos(f, 0.50, amplitude, wave_frequency * (2.0 * PI), 0.0);
4543
4544				// Different approach for variation param here
4545				float rand = hashwithoutsine12(vec2(i.y));
4546				float s = mix(size, size * rand, variation);
4547
4548                return smoothstep(-smoothness, smoothness, distance_estimate - s * 0.5);
4549            }`);return{tileAndCenter:t,circle:i,ring:r,polygon:s,cross:a,diamond:n,checkerboard:o,line:l,wave:h}}();var DC=class extends Ht{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(DC.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)}},IC=DC;IC.Nodes=function(){let e=new Pe(`vec3 attenuation(vec3 wavelengths, float filmThickness, float movement, float noiseStrength, float noiseScale, vec3 offset) {
4550				float f = 0.0;
4551				
4552				if (noiseStrength != 0.0) {
4553					vec3 st = position / noiseScale;
4554					float noise = simplexFast(1.6 * st + vec3(1.8, 1.5, 1.9) * simplexFast(st) + vec3(1.7, 9.2, 1.0));
4555					f = noise * noiseStrength;
4556				}
4557
4558				vec3 waves = wavelengths * vec3(1.0, 0.8, 0.6) + 1.0;
4559				float angle = dot(normalize(vWorldViewDir + (offset * -0.001)), normalize(vWNormal));
4560
4561				mediump vec3 color = cos((((filmThickness + f) / waves) * angle) + movement);
4562				return .5 + .5 * color;
4563			 }`,[kr.simplexFast]);
vendor: 4,701 bytes, lines 4563-4656
4563return{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) {
4564				mediump vec3 res = clamp(attenuation(wavelengths, filmThickness, movement, noiseStrength, noiseScale, offset), 0.0, 2.0);
4565
4566				float rainbowContribution = clamp(res.r + res.g + res.b, 0.0, 1.0);
4567
4568				float lalpha = alpha * rainbowContribution * mask;
4569				calpha = mix(lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0), lalpha, float(isMask));
4570				accumAlpha += (1.0 - accumAlpha) * lalpha * (1.0 - float(isMask));
4571
4572				return res;
4573			 }`,[e])}}();var OC=class extends Ht{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(OC.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)}},RC=OC;RC.Nodes=function(){let e=new Pe(`float rand(float n) {
4574				return fract(sin(n) * 43758.5453123);
4575			}`),t=new Pe(`float hash1(float p) { 
4576				p = fract(p * 0.011); 
4577				p *= p + 7.5; 
4578				p *= p + p; 
4579				return fract(p); 
4580			}`),i=new Pe(`float valueNoise(vec3 x) {
4581				const vec3 step = vec3(110, 241, 171);
4582			
4583				vec3 i = floor(x);
4584				vec3 f = fract(x);
4585			 
4586				// For performance, compute the base input to a 1D hash from the integer part of the argument and the 
4587				// incremental change to the 1D based on the 3D -> 1D wrapping
4588				float n = dot(i, step);
4589			
4590				vec3 u = f * f * (3.0 - 2.0 * f);
4591				return mix(mix(mix( hash1(n + dot(step, vec3(0, 0, 0))), hash1(n + dot(step, vec3(1, 0, 0))), u.x),
4592							   mix( hash1(n + dot(step, vec3(0, 1, 0))), hash1(n + dot(step, vec3(1, 1, 0))), u.x), u.y),
4593						   mix(mix( hash1(n + dot(step, vec3(0, 0, 1))), hash1(n + dot(step, vec3(1, 0, 1))), u.x),
4594							   mix( hash1(n + dot(step, vec3(0, 1, 1))), hash1(n + dot(step, vec3(1, 1, 1))), u.x), u.y), u.z);
4595			}`,[t]),r=new Pe(`vec3 hash3(vec3 x) {
4596				x = vec3(dot(x,vec3(127.1, 311.7, 74.7)),
4597						 dot(x,vec3(269.5, 183.3, 246.1)),
4598						 dot(x,vec3(113.5, 271.9, 124.6)));
4599			
4600				return fract(sin(x)*43758.5453123);
4601			}`),s=new Pe(`vec3 voronoiNoise(in vec3 x)
4602			{
4603				vec3 p = floor(x);
4604				vec3 f = fract(x);
4605
4606				float id = 0.0;
4607				vec2 res = vec2(100.0);
4608
4609				for(int k=-1; k<=1; k++)
4610				for(int j=-1; j<=1; j++)
4611				for(int i=-1; i<=1; i++)
4612				{
4613					vec3 b = vec3(float(i), float(j), float(k));
4614
4615					// Comment out the "+ hash(p + b);" part below to get "square" cells
4616					vec3 r = vec3(b) - f + hash3(p + b);
4617					float d = dot(r, r);
4618
4619					if (d < res.x)
4620					{
4621						id = dot(p + b, vec3(1.0, 57.0, 113.0));
4622						res = vec2(d, res.x);			
4623					}
4624					else if (d < res.y)
4625					{
4626						res.y = d;
4627					}
4628				}
4629
4630				return vec3(sqrt(res), abs(id));
4631			}
4632			`,[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) {
4633				float t = 0.0;
4634				float shadow = 1.0;
4635
4636				if (positioning == 0) {
4637
4638					// Can't do this mode if lighting is "none"
4639					#if (defined(PHONG) || defined(LAMBERT) || defined(STANDARD))
4640
4641						// Algorithm from Chapter 10 of Graphics Shaders
4642						const vec3 weights = vec3(0.2125, 0.7154, 0.0721);
4643						vec3 lpos;
4644						vec3 l;
4645						float dproduct;
4646
4647						#if (NUM_POINT_LIGHTS > 0)
4648
4649							#if defined(USE_SHADOWMAP) && (NUM_POINT_LIGHT_SHADOWS > 0)
4650								PointLightShadow pointLightShadow;
4651							#endif 
4652
4653							#pragma unroll_loop_start
4654							for (int i = 0; i < NUM_POINT_LIGHTS; i++) {
4655								// Light positions are in view-space for some reason?
4656								lpos = (inverse(viewMatrix) * vec4(pointLights[UNROLLED_LOOP_INDEX].position, 1.0
4656)).xyz;
4657								l = normalize(lpos - worldPosition);
4658								
4659								dproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5;
4660								
4661								// TODO: we want to use "intensity" but it isn't available in the shader code
4662								//dproduct += dot(pointLights[UNROLLED_LOOP_INDEX].color, weights);
4663
4664								t = max(t, dproduct);
4665
4666								// Accumulate shadow contribution
4667								#if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS)
4668									pointLightShadow = pointLightShadows[UNROLLED_LOOP_INDEX];
4669									shadow *= getPointShadow( 
4670											pointShadowMap[UNROLLED_LOOP_INDEX], 
4671											pointLightShadow.shadowMapSize, 
4672											pointLightShadow.shadowBias, 
4673											pointLightShadow.shadowRadius,
4674											vPointShadowCoord[UNROLLED_LOOP_INDEX], 
4675											pointLightShadow.shadowCameraNear, 
4676											pointLightShadow.shadowCameraFar);
4677								#endif
4678							}
4679							#pragma unroll_loop_end
4680
4681						#endif
4682
4683						#if NUM_DIR_LIGHTS > 0 
4684							
4685							#if defined(USE_SHADOWMAP) && (NUM_DIR_LIGHT_SHADOWS > 0)
4686								DirectionalLightShadow directionalLightShadow;
4687							#endif 
4688
4689							#pragma unroll_loop_start
4690							for (int i = 0; i < NUM_DIR_LIGHTS; i++) {
4691								// Use the direction vector for directional lights instead
4692								l = (inverse(viewMatrix) * vec4(directionalLights[UNROLLED_LOOP_INDEX].direction, 0.0)).xyz;
4693		
4694								dproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5;
4695								t = max(t, dproduct);
4696
4697								// Accumulate shadow contribution
4698								#if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS)
4699									directionalLightShadow = directionalLightShadows[UNROLLED_LOOP_INDEX];
4700									shadow *= getShadow( 
4701										UNROLLED_LOOP_INDEX,
4702										directionalShadowMap[UNROLLED_LOOP_INDEX], 
4703										directionalLightShadow.shadowMapSize, 
4704										directionalLightShadow.shadowBias, 
4705										directionalLightShadow.shadowRadius, 
4706										vDirectionalShadowCoord[UNROLLED_LOOP_INDEX]);
4707								#endif
4708							}
4709							#pragma unroll_loop_end
4710
4711						#endif
4712
4713						#if NUM_SPOT_LIGHTS > 0 
4714							
4715							#if defined(USE_SHADOWMAP) && (NUM_SPOT_LIGHT_SHADOWS > 0)
4716								SpotLightShadow spotLightShadow;
4717							#endif 
4718
4719							#pragma unroll_loop_start
4720							for (int i = 0; i < NUM_SPOT_LIGHTS; i++) {
4721								lpos = (inverse(viewMatrix) * vec4(spotLights[UNROLLED_LOOP_INDEX].position, 1.0)).xyz;
4722								l = normalize(lpos - worldPosition);
4723								
4724								dproduct = dot(l, normalize(worldNormal)) * 0.5 + 0.5;
4725								t = max(t, dproduct);
4726
4727								// Accumulate shadow contribution
4728								#if defined(USE_SHADOWMAP) && (UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS)
4729									spotLightShadow = spotLightShadows[UNROLLED_LOOP_INDEX];
4730									shadow *= getShadow(
4731										UNROLLED_LOOP_INDEX,
4732										spotShadowMap[UNROLLED_LOOP_INDEX], 
4733										spotLightShadow.shadowMapSize, 
4734										spotLightShadow.shadowBias, 
4735										spotLightShadow.shadowRadius, 
4736										vSpotLightCoord[UNROLLED_LOOP_INDEX]);
4737								#endif
4738							}
4739							#pragma unroll_loop_end
4740
4741						#endif
4742
4743						t = clamp(t, 0.0, 1.0);
4744				
4745					#endif
4746
4747				} else if (positioning == 1) {
4748					
4749					vec3 origin = mix(position, worldPosition, float(isWorldSpace));
4750					vec3 direction = normalize(source - origin);
4751					t = dot(direction, normalize(worldNormal)) * 0.5 + 0.5;	
4752
4753				} else {
4754
4755					vec3 origin = worldPosition;
4756					vec3 source = cameraPosition - offset;
4757					vec3 direction = normalize(source - origin);
4758					t = dot(direction, normalize(worldNormal)) * 0.5 + 0.5;	
4759					
4760				}
4761
4762				if (noiseStrength > 0.0) {
4763					// Distort with noise
4764					vec3 st = position / noiseScale;
4765					
4766					// Voronoi "smooth" noise
4767					float noise = 1.0 - voronoiNoise(st).x;
4768
4769					// Voronoi cellular noise
4770					//float noise = 1.0 - rand(voronoiNoise(st).z);
4771
4772					// Position warp noise
4773					// vec3 offset = vec3(
4774					// 	simplexFast(st),
4775					// 	simplexFast(st + vec3(111.1, 143.89, 217.19)),
4776					// 	simplexFast(st + vec3(171.1, 247.89, 117.23))
4777					// );
4778					// st += offset;
4779					// float noise = valueNoise(st);
4780
4781					t += noise * noiseStrength;
4782				}
4783
4784				t = clamp(t, 0.0, 1.0);
4785
4786				// Compute ramp color
4787				float p;
4788				vec4 color = colors[0];
4789				for (int i = 1; i < COLORS_MAX; i++) {
4790					p = clamp((t - steps[i-1]) / (steps[i] - steps[i-1]), 0.0, 1.0);
4791					color = mix(color, colors[i], smoothstep(0.0, 1.0, p));
4792				}
4793
4794				// Incorporate custom shadow color
4795				if (positioning == 0) {
4796
4797					vec3 blendedShadow = mix(color.rgb, shadowColor.rgb, shadowColor.a);
4798					color.rgb = mix(blendedShadow, color.rgb, shadow);
4799				
4800				}
4801
4802				// Accumulate alpha as usual
4803				float lalpha = alpha * color.a * mask;
4804				calpha =  lalpha / clamp(lalpha + accumAlpha, 0.00001, 1.0);
4805				accumAlpha += (1.0 - accumAlpha) * lalpha;
4806
4807				return color.xyz;
4808
4809            }`,[kr.simplexFast,e,i,s])}}();var m8=function(){return{textureBicubic:new Pe(`float w0( float a ) {
4810            return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
4811        }
4812    
4813        float w1( float a ) {
4814            return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
4815        }
4816    
4817        float w2( float a ){
4818            return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
4819        }
4820    
4821        float w3( float a ) {
4822            return ( 1.0 / 6.0 ) * ( a * a * a );
4823        }
4824    
4825        // g0 and g1 are the two amplitude functions
4826        float g0( float a ) {
4827            return w0( a ) + w1( a );
4828        }
4829    
4830        float g1( float a ) {
4831            return w2( a ) + w3( a );
4832        }
4833    
4834        // h0 and h1 are the two offset functions
4835        float h0( float a ) {
4836            return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
4837        }
4838    
4839        float h1( float a ) {
4840            return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
4841        }
4842    
4843        vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
4844            uv = uv * texelSize.zw + 0.5;
4845    
4846            vec2 iuv = floor( uv );
4847            vec2 fuv = fract( uv );
4848    
4849            float g0x = g0( fuv.x );
4850            float g1x = g1( fuv.x );
4851            float h0x = h0( fuv.x );
4852            float h1x = h1( fuv.x );
4853            float h0y = h0( fuv.y );
4854            float h1y = h1( fuv.y );
4855    
4856            vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
4857            vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
4858            vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
4859            vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
4860    
4861            return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + 
4862                   g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
4863        }
4864
4865        vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
4866            vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
4867            vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
4868            vec2 fLodSizeInv = 1.0 / fLodSize;
4869            vec2 cLodSizeInv = 1.0 / cLodSize;
4870            vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
4871            vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
4872            return mix( fSample, cSample, fract( lod ) );
4873        }`)}}();function g8(e,t){return e>=t?new j(t/e,1):new j(1,e/t)}var LC=class extends Ht{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,rt.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(LC.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)}},BC=LC;BC.Nodes=function(){let e=new Pe(`vec3 blur(sampler2D sp, vec2 U, vec2 scale, float lod, sampler2D dm, vec2 unrefractedU, vec2 aspectRatio) {
4874                // Slightly modified version of this:
4875                // https://www.shadertoy.com/view/ltScRG
4876
4877				// Special case for blur == 0.0
4878				if (lod == 0.0) {
4879					#ifdef TEXTURE_LOD_EXT
4880					return texture2DLodEXT( sp, U, 0.0).rgb;
4881					#else
4882					return textureLod( sp, U, 0.0).rgb;
4883					#endif
4884				}
4885				
4886				vec2 texelSize = vec2(1.0) / resolution;
4887                vec2 halton = haltonSequence[frameIndex];
4888                float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);
4889                float temporalAngle  = temporalOffset * PI2;
4890				vec3 res = vec3(0.0);
4891                vec2 uv = vec2(0.0);
4892                vec2 offset = vec2(0.0);
4893                vec2 vogelSample = vec2(0.0);
4894                for (int i = 0; i < NUM_SAMPLES; i++) {
4895                    vogelSample =  vogelDiskSample(i, NUM_SAMPLES, temporalAngle) * texelSize;
4896                    offset = vogelSample * scale * (lod * 10.0); // TODO: used to be hardcoded to 20
4897                    uv = U + offset;
4898                    float opaqueDepth = unpackRGBAToDepth(textureLod(dm, uv, lod));
4899                    if (opaqueDepth != 0.0 && opaqueDepth < gl_FragCoord.z) {
4900                        uv = unrefractedU;
4901                        lod = lod > 4.0 ? lod : lod / 2.0;
4902                    }
4903                    res += textureLod(sp, uv, lod).rgb;
4904                }
4905                return res / float(NUM_SAMPLES);
4906            }`),t=new Pe(`vec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {
4907		        // Direction of refracted light.
4908		        vec3 refractionVector = refract( -v,  n, 1.0 / ior );
4909		        
4910				// Compute rotation-independant scaling of the model matrix.
4911		        vec3 modelScale;
4912		        modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
4913		        modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
4914		        modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
4915
4916		        // The thickness is specified in local space
4917		        return normalize( refractionVector ) * thickness * modelScale;
4918	        }`),i=new Pe(`float applyIorToRoughness( float roughness, float ior ) {
4919				// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and
4920				// an IOR of 1.5 results in the default amount of microfacet refraction.
4921				return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
4922			}`),r=new Pe(`vec3 getTransmissionSample( vec2 fragCoord, float roughness, float ior, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 unrefractedCoords, vec2 aspectRatio) {
4923				// Threejs exports do not pass a depth map to this shader, so we have to fallback to the "Threejs method of blurring" - see
4924				// also the code in convertTransmission.ts, which runs during export
4925				#ifdef IS_THREEJS_EXPORT
4926					float lod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness / 5.0, ior);
4927					return textureBicubic(transmissionSamplerMap, fragCoord.xy, lod).rgb;
4928				#else
4929					float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
4930					float lod = applyIorToRoughness(roughness, ior);
4931					return blur(transmissionSamplerMap, fragCoord, vec2(lod), min(framebufferLod / 5.5, 8.5), transmissionDepthMap, unrefractedCoords, aspectRatio);
4932				#endif
4933			}`,[m8.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 ) {
4934				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
4935				vec3 refractedRayExit = position + transmissionRay;
4936
4937				// Project refracted vector on the framebuffer, while mapping to normalized device coordinates.
4938				vec4 ndcPos = projMatrix * viewMatrix *  vec4( refractedRayExit, 1.0 );
4939				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
4940				refractionCoords += 1.0;
4941				refractionCoords /= 2.0;
4942
4943				vec4 ndcPosUnrefracted = projMatrix * viewMatrix * vec4(position, 1.0 );
4944				vec2 unrefractedCoords = ndcPosUnrefracted.xy / ndcPosUnrefracted.w;
4945				unrefractedCoords += 1.0;
4946				unrefractedCoords /= 2.0;
4947
4948				// Sample framebuffer to get pixel the refracted ray hits.
4949				return getTransmissionSample( refractionCoords, roughness, ior, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, unrefractedCoords, aspectRatio );
4950    		}`,[r,t]);
vendor: 4,467 bytes, lines 4950-4991
4950return{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) {
4951                vec3 v = vec3(0.);
4952                if (isOrthographic) {
4953                    v = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
4954                } else {
4955                    v = normalize(vWPosition - cameraPosition);
4956                }
4957                vec3 transmission = getIBLVolumeRefraction(vWNormal, -v, roughness,  vWPosition, modelMatrix, viewMatrix, projectionMatrix, ior, thickness, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, aspectRatio );
4958                
4959				float lalpha = alpha * mask;
4960				calpha =  lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
4961				accumAlpha += ( 1.0 - accumAlpha ) * alpha;
4962
4963				return transmission;
4964            }`,[s])}}();var k0=(e=>(e.NOISE="noise",e.MAP="map",e))(k0||{}),zC=class extends Ht{constructor(e,t,i,r,s,a,n,o,l,h,c){super("v3"),this.displacementTypeIndex=new Xt(0),this.nodeType="VertexDisplacement",this.intensity=e,this.movementOrTexture=t,Object.values(k0)[this.displacementTypeIndex.value]==="map"&&(this.mat=new vC(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(k0)[this.displacementTypeIndex.value]){case"map":{i=e.include(zC.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) {
4965							return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));
4966						}`),n=s=="voronoi"?`
4967					float v = ${s}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1), voronoiStyle, smoothness, seed, quality);
4968					v = remap(v, lowCut, highCut, 0.0, 1.0);
4969					v = smax(v, 0.0, smoothness * 0.25);
4970					v = smin(v, 1.0, smoothness * 0.25);
4971
4972					return p + n * v * intensity;
4973					`:`
4974					return p + n * ${s}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1)) * intensity;
4975					`,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) {
4976							${n}
4977						}`,[kr.simplexPrecise,kr.simplexFractal,kr.simplexAshima,kr.fbm,kr.perlin,kr.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) {
4978							vec3 displaced_position = distorted(position, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality);
4979							vec3 tangent1 = orthogonal(normal);
4980							vec3 tangent2 = normalize(cross(normal, tangent1));
4981
4982                            // TODO(Max): The distance to the neighbors was originally scaled by 0.1.
4983                            // This caused some small oval/circular visual artifacts in the lighting.
4984                            // For now, simply using neighbors further away betters the problem,
4985                            // but we should figure out the underlying cause when we have some time.
4986                            // Maybe its related to how we calculate the tangent and bitangent?
4987							vec3 nearby1 = position + tangent1;
4988							vec3 nearby2 = position + tangent2;
4989							vec3 distorted1 = distorted(nearby1, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality);
4990							vec3 distorted2 = distorted(nearby2, normal, scale, intensity, offset, neighbor_offset, movement, voronoiStyle, smoothness, seed, highCut, lowCut, quality);
4991							displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));
4992							return displaced_position;
4993						}`,[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)}},FC=zC;FC.Nodes=function(){let e=new Pe(`vec3 orthogonal(vec3 v) {
4994				return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));
4995			}`),t=new Pe(`float displacementMapTexture(sampler2D tex, float crop, vec2 uv, mat3 mat, vec2 offset) {
4996				vec2 uvs = (mat * vec3(uv * 2.0 - 1.0, 1.0) / 2.0 + 0.5).xy + offset;
4997				vec4 tmp = texture2D(tex, uvs);
4998				vec3 col = tmp.rgb;
4999				if (crop > 0.5) {
5000					if ( uvs.x < 0.0 || uvs.x > 1.0 || uvs.y < 0.0 || uvs.y > 1.0 )  {
5001						return 0.0;
5002					}
5003				}
5004				return col.r;
5005			}`);return{map:new Pe(`vec3 vertexDisplacementMap(vec3 position, vec3 normal, sampler2D tex, vec2 uv, float crop, mat3 mat, float intensity, out vec3 displaced_normal) {
5006				vec3 displaced_position = position + normal * displacementMapTexture(tex, crop, uv, mat, vec2(0.0)) * intensity;
5007				vec3 tangent1 = normalize(orthogonal(normal));
5008				vec3 tangent2 = normalize(cross(normal, tangent1));
5009				vec3 nearby1 = position + tangent1 * 0.1;
5010				vec3 nearby2 = position + tangent2 * 0.1;
5011				vec3 distorted1 = nearby1 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;
5012				vec3 distorted2 = nearby2 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;
5013				displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));
5014				return displaced_position;
5015			}`,[e,t])}}();var rt={normalRenderTarget:new Xa,normalRenderTargetDepth:new Xa,transmissionRenderTarget:new Xa,aspectRatio:new sr,transmissionSize:new sr(2048,2048),transmissionRenderTargetDepth:new Xa,aoRenderTarget:new Xa,aoEnabled:new Cr,pixelRatioNode:new ze(1),resolution:new sr,penumbraSize:new vo(5,.5),frameIndex:new Xt(0),transmissionLod:new Xt(2)};for(let e of Object.values(rt))e.isRenderGlobal=!0;var kC={skiaWasmUrl:"https://unpkg.com/@splinetool/[email protected]/build/ui.wasm"},b1=class extends Bi{constructor(){super("basic"),this.nodeType="Basic",this.color=new ui(Zr),this.shadingAlpha=new ze(1),this.shadingBlend=new Xt(0),this.previousModelViewMatrix=new xa,this.previouseProjectionMatrix=new xa}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:rt.frameIndex}),e.mergeUniform({resolution:rt.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(Ch.merge([Te.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(`
5016`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",`
5017				#include <skinbase_vertex>
5018				#include <skinnormal_vertex>
5019				#if !defined( USE_LAYER_DISPLACE )
5020					#include <defaultnormal_vertex>
5021				#endif
5022
5023				vec3 displaced_position = position;
5024				vec3 displaced_normal = normal;
5025
5026				#if defined( USE_LAYER_DISPLACE )
5027					vec3 transformed;
5028					vec3 transformedNormal;
5029				#endif
5030				`,"#include <normal_vertex>",`
5031				#if !defined( USE_LAYER_DISPLACE )
5032					#include <begin_vertex>
5033				#endif /* !USE_LAYER_DISPLACE */
5034				`];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5034":""),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(`
5035`)}else{this.color===void 0&&(this.color=new ui(Zr)),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(`
5036`));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(`
5037`)}return t}},v8=class extends Bi{constructor(){super("lambert"),this.nodeType="Lambert",this.color=new ui(Zr),this.emissive=new ui(0),this.emissiveIntensity=new ze(1),this.previousModelViewMatrix=new xa,this.previouseProjectionMatrix=new xa,this.shadingAlpha=new ze(1),this.shadingBlend=new Xt(0),this.occlusion=new Cr(!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:rt.frameIndex}),e.mergeUniform({resolution:rt.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(Ch.merge([Te.fog,Te.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(`
5038`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",`
5039				#include <skinbase_vertex>
5040				#include <skinnormal_vertex>
5041				#ifndef USE_LAYER_DISPLACE
5042					#include <defaultnormal_vertex>
5043				#endif
5044
5045				vec3 displaced_position = position;
5046				vec3 displaced_normal = objectNormal;
5047
5048				#ifdef USE_LAYER_DISPLACE
5049					vec3 transformed;
5050					vec3 transformedNormal;
5051				#endif
5052				`,"#include <normal_vertex>",`
5053				#ifndef USE_LAYER_DISPLACE
5054					#include <begin_vertex>
5055				#endif
5056				`];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5056":""),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>",`
5057					vec3 diffuse = vec3( 1.0 );
5058					GeometricContext geometry;
5059					geometry.position = mvPosition.xyz;
5060					geometry.normal = normalize( transformedNormal );
5061					geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
5062				`),r.push(`
5063					GeometricContext backGeometry;
5064					backGeometry.position = geometry.position;
5065					backGeometry.normal = -geometry.normal;
5066					backGeometry.viewDir = geometry.viewDir;
5067					vLightFront = vec3( 0.0 );
5068					vIndirectFront = vec3( 0.0 );
5069					#ifdef DOUBLE_SIDED
5070						vLightBack = vec3( 0.0 );
5071						vIndirectBack = vec3( 0.0 );
5072					#endif
5073					IncidentLight directLight;
5074					float dotNL;
5075					vec3 directLightColor_Diffuse;
5076					vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
5077					vIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );
5078					#ifdef DOUBLE_SIDED
5079						vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
5080						vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );
5081					#endif
5082					#if NUM_POINT_LIGHTS > 0
5083						#pragma unroll_loop_start
5084						for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
5085							getPointLightInfo( pointLights[ i ], geometry, directLight );
5086							dotNL = dot( geometry.normal, directLight.direction );
5087							directLightColor_Diffuse = directLight.color;
5088							vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
5089							#ifdef DOUBLE_SIDED
5090								vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
5091							#endif
5092						}
5093						#pragma unroll_loop_end
5094					#endif
5095					#if NUM_SPOT_LIGHTS > 0
5096						#pragma unroll_loop_start
5097						for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
5098							getSpotLightInfo( spotLights[ i ], geometry, directLight );
5099							dotNL = dot( geometry.normal, directLight.direction );
5100							directLightColor_Diffuse = directLight.color;
5101							vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
5102							#ifdef DOUBLE_SIDED
5103								vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
5104							#endif
5105						}
5106						#pragma unroll_loop_end
5107					#endif
5108					#if NUM_DIR_LIGHTS > 0
5109						#pragma unroll_loop_start
5110						for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
5111							getDirectionalLightInfo( directionalLights[ i ], geometry, directLight );
5112							dotNL = dot( geometry.normal, directLight.direction );
5113							directLightColor_Diffuse = directLight.color;
5114							vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
5115							#ifdef DOUBLE_SIDED
5116								vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
5117							#endif
5118						}
5119						#pragma unroll_loop_end
5120					#endif
5121					#if NUM_HEMI_LIGHTS > 0
5122						#pragma unroll_loop_start
5123						for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
5124							vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
5125							#ifdef DOUBLE_SIDED
5126								vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );
5127							#endif
5128						}
5129						#pragma unroll_loop_end
5130					#endif
5131				`,"	#include <shadowmap_vertex>","	#include <fog_vertex>"),r.push("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;"),t=r.join(`
5132`)}else{e.mergeUniform({penumbraSize:rt.penumbraSize}),e.mergeUniform({frameIndex:rt.frameIndex}),e.mergeUniform({aoMap:rt.aoRenderTarget}),e.mergeUniform({aoEnabled:rt.aoEnabled}),this.color===void 0&&(this.color=new ui(Zr)),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,561 bytes, lines 5132-5179
5132),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(`
5133`));let d=["#include <normal_fragment_begin>",`
5134				// NOTE: gl_FrontFacing alternative using face normal estimation.
5135				vec3 viewdx = dFdx(vViewPosition);
5136				vec3 viewdy = dFdy(vViewPosition);
5137				vec3 faceNormal = normalize(cross(viewdx, viewdy));
5138				bool isFrontFacing = (dot(normal, faceNormal) >= 0.0);
5139				`,"#include <clipping_planes_fragment>"];d.push(i.code,"vec3 diffuseColor = "+i.result+";","ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );"),h&&d.push(h.code,"#ifdef ALPHATEST","if ( "+h.result+" <= ALPHATEST ) discard;","#endif"),d.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&&d.push(r.code,"reflectedLight.directDiffuse += "+r.result+" * "+s.result+";"),d.push("vec3 ao = aoEnabled && "+a.result+" ? tex2D(aoMap, gl_FragCoord.xy / resolution).rgb : vec3(1.0);","vec3 outgoingLight = (reflectedLight.directDiffuse + reflectedLight.indirectDiffuse) ;");let u="1.0";this.mask&&(this.mask.analyze(e),u=`luminance(${this.mask.flow(e,"v3").result})`),d.push(`
5140				if (outgoingLight != diffuseColor) {
5141					float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
5142					accumAlpha += ( 1.0 - accumAlpha ) * ${n.result} * ${u} * lightAccu;
5143					outgoingLight = spe_blend( diffuseColor, outgoingLight, ${n.result} * ${u}, ${o.result} );
5144
5145					outgoingLight *= ao;
5146				}
5147				`),l&&d.push(l.code,`outgoingLight = spe_blend(outgoingLight, ${l.result}, 1.0, SPE_BLENDING_NORMAL);`),h?d.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${h.result} );`):d.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),c&&d.push(`gl_FragColor.a *= ${c.result};`),d.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=d.join(`
5148`)}return t}},Ah=function(){let e=new Pe(`vec2 dHdxy(sampler2D bumpMap, vec2 bumpMapUv, float bumpScale) {
5149
5150            // Gradient of UVs w.r.t. X coordinate (in screen-space)
5151            vec2 dSTdx = dFdx(bumpMapUv);
5152
5153            // Gradient of UVs w.r.t. Y coordinate (in screen-space)
5154            vec2 dSTdy = dFdy(bumpMapUv);
5155            
5156            // Forward differencing
5157            float Hll = bumpScale * luminance(texture(bumpMap, bumpMapUv).rgb);
5158            float dBx = bumpScale * luminance(texture(bumpMap, bumpMapUv + dSTdx).rgb) - Hll;
5159            float dBy = bumpScale * luminance(texture(bumpMap, bumpMapUv + dSTdy).rgb) - Hll;
5160            
5161            return vec2( dBx, dBy );
5162        }`),t=new Pe(`vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
5163            vec3 vSigmaX = dFdx( surf_pos.xyz );
5164            vec3 vSigmaY = dFdy( surf_pos.xyz );
5165            vec3 vN = surf_norm; // normalized
5166            
5167            vN = normalize(vN);
5168
5169            vec3 R1 = cross( vSigmaY, vN );
5170            vec3 R2 = cross( vN, vSigmaX );
5171
5172            R1 = normalize(R1);
5173            R2 = normalize(R2);
5174    
5175            float fDet = dot( vSigmaX, R1 ) * faceDirection;
5176    
5177            vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
5178            return normalize( abs( fDet ) * vN - vGrad );
5179        }`);
vendor: 1,697 bytes, lines 5179-5198
5179return{dHdxy:e,perturbNormalArb:t}}(),y8=class extends Bi{constructor(){super("phong"),this.nodeType="Phong",this.color=new ui(Zr),this.specular=new ui(1118481),this.shininess=new ze(30),this.previousModelViewMatrix=new xa,this.previouseProjectionMatrix=new xa,this.shadingAlpha=new ze(1),this.shadingBlend=new Xt(0),this.occlusion=new Cr(!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:rt.frameIndex}),e.mergeUniform({resolution:rt.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(Ch.merge([Te.fog,Te.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(`
5180`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",`
5181				#include <skinbase_vertex>
5182				#include <skinnormal_vertex>
5183				#ifndef USE_LAYER_DISPLACE
5184					#include <defaultnormal_vertex>
5185				#endif
5186
5187				vec3 displaced_position = position;
5188				vec3 displaced_normal = objectNormal;
5189
5190				#ifdef USE_LAYER_DISPLACE
5191					vec3 transformed;
5192					vec3 transformedNormal;
5193				#endif
5194				`,"#include <normal_vertex>",`
5195				#ifndef USE_LAYER_DISPLACE
5196					#include <begin_vertex>
5197				#endif
5198				`];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5198":""),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(`
5199`)}else{e.mergeUniform({penumbraSize:rt.penumbraSize}),e.mergeUniform({frameIndex:rt.frameIndex}),e.mergeUniform({aoMap:rt.aoRenderTarget}),e.mergeUniform({aoEnabled:rt.aoEnabled}),this.color===void 0&&(this.color=new ui(Zr)),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(`
5200`));let d=["#include <normal_fragment_begin>",`
5201				// NOTE: gl_FrontFacing alternative using face normal estimation.
5202				vec3 viewdx = dFdx(vViewPosition);
5203				vec3 viewdy = dFdy(vViewPosition);
5204				vec3 faceNormal = normalize(cross(viewdx,viewdy));
5205				if (dot(normal, faceNormal) < 0.0) {
5206					normal *= -1.0;
5207				}
5208				`,"	BlinnPhongMaterial material;"];if(this.bumpMap){e.include(Ah.dHdxy),e.include(Ah.perturbNormalArb);let p=this.bumpMap.texture.flow(e,"t"),f=this.bumpMap.flow(e,"v3"),g=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",m="";this.bumpMap.projection.value===4?m=`
5209					vec3 bumpNormal = vec3(0.0);
5210					{
5211						vec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0;
5212						vec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1;
5213						vec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2;
5214						vec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;
5215
5216						vec2 grad0 = dHdxy(${p.result}, uv0, ${g});
5217						vec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection);
5218
5219						vec2 grad1 = dHdxy(${p.result}, uv1, ${g});
5220						vec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection);
5221
5222						vec2 grad2 = dHdxy(${p.result}, uv2, ${g});
5223						vec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection);
5224						
5225						bumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y;
5226						bumpNormal = normalize(bumpNormal);
5227					}
5228
5229					normal = bumpNormal;
5230					`:m=`
5231					vec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs;
5232					vec2 grad = dHdxy(${p.result}, bumpMapCachedUv, ${g});
5233					normal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection );
5234					`,d.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates
5235					${f.result};
5236					${m}
5237					`)}d.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&&d.push(h.code,"#ifdef ALPHATEST","if ( "+h.result+" <= ALPHATEST ) discard;","#endif"),d.push("material.diffuseColor = diffuseColor;"),d.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include <lights_fragment_begin>","#include <lights_fragment_end>"),d.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 u="1.0";this.mask&&(this.mask.analyze(e),u=`luminance(${this.mask.flow(e,"v3").result})`),d.push(`
5238				if (outgoingLight != diffuseColor) {
5239					float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
5240					accumAlpha += ( 1.0 - accumAlpha ) * ${n.result} * ${u} * lightAccu;
5241					outgoingLight = spe_blend( diffuseColor, outgoingLight, ${n.result} * ${u}, ${o.result} );
5242					
5243					outgoingLight *= ao;
5244				}
5245				`),l&&d.push(l.code,`outgoingLight = spe_blend(outgoingLight, ${l.result}, 1.0, SPE_BLENDING_NORMAL);`),h?d.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${h.result});`):d.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),c&&d.push(`gl_FragColor.a *= ${c.result};`),d.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=d.join(`
5246`)}return t}},x8=class extends Bi{constructor(){super("standard"),this.nodeType="Standard",this.color=new ui(Zr),this.roughness=new ze(.3),this.metalness=new ze(0),this.reflectivity=new ze(.5),this.previousModelViewMatrix=new xa,this.previouseProjectionMatrix=new xa,this.shadingAlp
vendor: 1,586 bytes, lines 5246-5265
5246ha=new ze(1),this.shadingBlend=new Xt(0),this.occlusion=new Cr(!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:rt.frameIndex}),e.mergeUniform({resolution:rt.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(Ch.merge([Te.fog,Te.lights])),Te.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(`
5247`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",`
5248				#include <skinbase_vertex>
5249				#include <skinnormal_vertex>
5250				#if !defined( USE_LAYER_DISPLACE )
5251					#include <defaultnormal_vertex>
5252				#endif
5253
5254				vec3 displaced_position = position;
5255				vec3 displaced_normal = objectNormal;
5256
5257				#if defined( USE_LAYER_DISPLACE )
5258					vec3 transformed;
5259					vec3 transformedNormal;
5260				#endif
5261				`,"#include <normal_vertex>",`
5262				#if !defined( USE_LAYER_DISPLACE )
5263					#include <begin_vertex>
5264				#endif /* !USE_LAYER_DISPLACE */
5265				`];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5265":""),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(`
5266`)}else{e.mergeUniform({penumbraSize:rt.penumbraSize}),e.mergeUniform({frameIndex:rt.frameIndex}),e.mergeUniform({aoMap:rt.aoRenderTarget}),e.mergeUniform({aoEnabled:rt.aoEnabled});let i={gamma:!0};this.color===void 0&&(this.color=new ui(Zr)),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,d=this.alphaOverride?this.alphaOverride.flow(e,"f"):void 0,u=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(`
5267`));let p=["#include <clipping_planes_fragment>","	#include <normal_fragment_begin>",`
5268				// NOTE: gl_FrontFacing alternative using face normal estimation.
5269				vec3 viewdx = dFdx(vViewPosition);
5270				vec3 viewdy = dFdy(vViewPosition);
5271				vec3 faceNormal = normalize(cross(viewdx,viewdy));
5272				if (dot(normal, faceNormal) < 0.0) {
5273					normal *= -1.0;
5274				}
5275				`,"	PhysicalMaterial material;","	material.diffuseColor = vec3( 1.0 );"];if(this.bumpMap){e.include(Ah.dHdxy),e.include(Ah.perturbNormalArb);let g=this.bumpMap.texture.flow(e,"t"),m=this.bumpMap.flow(e,"v3"),v=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",y="";this.bumpMap.projection.value===4?y=`
5276					vec3 bumpNormal = vec3(0.0);
5277					{
5278						vec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0;
5279						vec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1;
5280						vec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2;
5281						vec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;
5282
5283						vec2 grad0 = dHdxy(${g.result}, uv0, ${v});
5284						vec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection);
5285
5286						vec2 grad1 = dHdxy(${g.result}, uv1, ${v});
5287						vec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection);
5288
5289						vec2 grad2 = dHdxy(${g.result}, uv2, ${v});
5290						vec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection);
5291						
5292						bumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y;
5293						bumpNormal = normalize(bumpNormal);
5294					}
5295
5296					normal = bumpNormal;
5297					`:y=`
5298					vec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs;
5299					vec2 grad = dHdxy(${g.result}, bumpMapCachedUv, ${v});
5300					normal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection );
5301					`,p.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates
5302					${m.result};
5303					${y}
5304					`)}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 g=this.roughnessMap.texture.flow(e,"t"),m=this.roughnessMap.flow(e,"v3"),v="";this.roughnessMap.projection.value===4?v=`
5305					float roughnessChange = 1.0;
5306					{
5307						vec2 uv0 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs0;
5308						vec2 uv1 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs1;
5309						vec2 uv2 = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs2;
5310						vec3 weights = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;
5311
5312						float r0 = luminance(texture(${g.result}, uv0).rgb) * roughnessScale;
5313						float r1 = luminance(texture(${g.result}, uv1).rgb) * roughnessScale;
5314						float r2 = luminance(texture(${g.result}, uv2).rgb) * roughnessScale;
5315
5316						roughnessChange = (r0 * weights.z + r1 * weights.x + r2 * weights.y);
5317					}
5318					float roughnessFactor = roughnessChange * ${a.result};
5319					`:v=`
5320					vec2 roughnessMapCachedUv = g${this.roughnessMap.uuid.toString().replace(/-/g,"")}_writeUvs;
5321
5322					vec4 vals = texture(${g.result},  roughnessMapCachedUv);
5323					float roughnessFactor = luminance(vals.rgb) * ${a.result};
5324					`,p.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates
5325					${m.result};
5326
5327					const float roughnessScale = 1.0;
5328
5329					${v}
5330				`)}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 );"),u?p.push(u.code,"material.specularColor = mix( vec3( 0.16 * pow2( "+u.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(`
5331				if (outgoingLight != diffuseColor) {
5332					float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
5333					accumAlpha += ( 1.0 - accumAlpha ) * ${o.result} * ${f} * lightAccu;
5334					outgoingLight = spe_blend( diffuseColor, outgoingLight, ${o.result} * ${f}, ${l.result} );
5335					
5336					outgoingLight *= ao;
5337				}
5338				`),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 );"),d&&p.push(`gl_FragColor.a *= ${d.result};`),p.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=p.join(`
5339`)}return t}},b8=class extends Bi{constructor(){super("toon"),this.nodeType="Toon",this.color=new ui(Zr),this.specular=new ui(1118481),this.shininess=new ze(30),this.previousModelViewMatrix=new xa,this.previouseProjectionMatrix=new xa,this.shadingAlp
vendor: 1,393 bytes, lines 5339-5358
5339ha=new ze(1),this.shadingBlend=new Xt(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:rt.frameIndex}),e.mergeUniform({resolution:rt.resolution}),e.mergeUniform({previousModelViewMatrix:this.previousModelViewMatrix}),e.mergeUniform({previousProjectionMatrix:this.previouseProjectionMatrix}),e.mergeUniform(Ch.merge([Te.fog,Te.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(`
5340`));let r=["#include <beginnormal_vertex>","#include <morphnormal_vertex>",`
5341				#include <skinbase_vertex>
5342				#include <skinnormal_vertex>
5343				#ifndef USE_LAYER_DISPLACE
5344					#include <defaultnormal_vertex>
5345				#endif
5346
5347				vec3 displaced_position = position;
5348				vec3 displaced_normal = objectNormal;
5349
5350				#ifdef USE_LAYER_DISPLACE
5351					vec3 transformed;
5352					vec3 transformedNormal;
5353				#endif
5354				`,"#include <normal_vertex>",`
5355				#ifndef USE_LAYER_DISPLACE
5356					#include <begin_vertex>
5357				#endif
5358				`];i&&r.push(i.code,i.result?"displaced_position = "+i.result+";
5358":""),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(`
5359`)}else{e.mergeUniform({penumbraSize:rt.penumbraSize}),e.mergeUniform({frameIndex:rt.frameIndex}),e.mergeUniform({aoMap:rt.aoRenderTarget}),e.mergeUniform({aoEnabled:rt.aoEnabled}),this.color===void 0&&(this.color=new ui(Zr)),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>",`
5360					varying vec3 vViewPosition;
5361					struct ToonMaterial {
5362						vec3	diffuseColor;
5363						vec3	specularColor;
5364						float	specularShininess;
5365						float	specularStrength;
5366					};
5367					void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
5368						vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
5369			
5370						reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
5371						reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
5372					}
5373					void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
5374						reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
5375					}
5376					#define RE_Direct				RE_Direct_Toon
5377					#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon
5378					#define Material_LightProbeLOD( material )	(0)
5379					`,"#include <shadowmap_pars_fragment>","#include <bumpmap_pars_fragment>","#include <normalmap_pars_fragment>"].join(`
5380`));let c=["#include <normal_fragment_begin>",`
5381				// NOTE: gl_FrontFacing alternative using face normal estimation.
5382				vec3 viewdx = dFdx(vViewPosition);
5383				vec3 viewdy = dFdy(vViewPosition);
5384				vec3 faceNormal = normalize(cross(viewdx,viewdy));
5385				if (dot(normal, faceNormal) < 0.0) {
5386					normal *= -1.0;
5387				}
5388				`,"	ToonMaterial material;"];if(this.bumpMap){e.include(Ah.dHdxy),e.include(Ah.perturbNormalArb);let u=this.bumpMap.texture.flow(e,"t"),p=this.bumpMap.flow(e,"v3"),f=this.bumpMapIntensity?this.bumpMapIntensity.flow(e,"f").result:"1.0",g="";this.bumpMap.projection.value===4?g=`
5389					vec3 bumpNormal = vec3(0.0);
5390					{
5391						vec2 uv0 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs0;
5392						vec2 uv1 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs1;
5393						vec2 uv2 = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs2;
5394						vec3 weights = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_triplanarWeights;
5395
5396						vec2 grad0 = dHdxy(${u.result}, uv0, ${f});
5397						vec3 n0 = perturbNormalArb(-vViewPosition, normal, grad0, faceDirection);
5398
5399						vec2 grad1 = dHdxy(${u.result}, uv1, ${f});
5400						vec3 n1 = perturbNormalArb(-vViewPosition, normal, grad1, faceDirection);
5401
5402						vec2 grad2 = dHdxy(${u.result}, uv2, ${f});
5403						vec3 n2 = perturbNormalArb(-vViewPosition, normal, grad2, faceDirection);
5404						
5405						bumpNormal = n0 * weights.z + n1 * weights.x + n2 * weights.y;
5406						bumpNormal = normalize(bumpNormal);
5407					}
5408
5409					normal = bumpNormal;
5410					`:g=`
5411					vec2 bumpMapCachedUv = g${this.bumpMap.uuid.toString().replace(/-/g,"")}_writeUvs;
5412					vec2 grad = dHdxy(${u.result}, bumpMapCachedUv, ${f});
5413					normal = perturbNormalArb( - vViewPosition, normal, grad, faceDirection );
5414					`,c.push(`// Call the Texture Layer's function once here so that it writes out its procedural UV coordinates
5415					${p.result};
5416					${g}
5417					`)}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 d="1.0";this.mask&&(this.mask.analyze(e),d=`luminance(${this.mask.flow(e,"v3").result})`),c.push(`
5418				if (outgoingLight != diffuseColor) {
5419					float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
5420					accumAlpha += ( 1.0 - accumAlpha ) * ${a.result} * ${d} * lightAccu;
5421					outgoingLight = spe_blend( diffuseColor, outgoingLight, ${a.result} * ${d}, ${n.result} );
5422				}
5423				`),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(`
5424`)}return t}},w8=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.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)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,setTimeout(()=>{this.hasClean=!1,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),t=t.next,t.prev=this.head,this.head.next=t;this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(e){var t;return(t=this.cache.get(e))==null?void 0:t.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}},S8=class extends w8{create(e){return URL.createObjectURL(new Blob([e]))}dispose(e,t){URL.revokeObjectURL(t)}},wg;function _8(e){return typeof e=="string"?e:(wg||(wg=new S8),wg.load(e))}var A8=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}},M8=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}},UC=class extends A8{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
5424ine=!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=>{var n;r=(n=a.target)==null?void 0:n.result,s(null)}}),this.img.src=r}else this.img.src=e;this.img.onloadeddata=()=>{t()}}else this.img=new Image,this.img.src=_8(e),this.img.onload=t,await new Promise(r=>{this.img.onload=()=>{t(),r(null)}})}getTexture(e,t=1008,i=1006){var s,a;let r=(a=(s=this._cache[e])==null?void 0:s[t])==null?void 0:a[i];if(r)return r;{let n;return this.isBuffer?n=this.img.texture:this.isVideo?n=new GL(this.img,void 0,e,e):n=new oi(this.img,void 0,e,e,i,t),this.loaded&&(n.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]=n,n}}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==null||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()}},Ln=class extends UC{};function E8(e,t){var i=D8(t);return i.formatToParts?T8(i,e):P8(i,e)}var C8={year:0,month:1,day:2,hour:3,minute:4,second:5};function T8(e,t){try{for(var i=e.formatToParts(t),r=[],s=0;s<i.length;s++){var a=C8[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 P8(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 Sg={};function D8(e){if(!Sg[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";Sg[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 Sg[e]}function NC(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 t_=36e5,I8=6e4,_g={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-]\d{2}):?(\d{2})$/};function VC(e,t,i){var r,s;if(!e||(r=_g.timezoneZ.exec(e),r))return 0;var a;if(r=_g.timezoneHH.exec(e),r)return a=parseInt(r[1],10),i_(a)?-(a*t_):NaN;if(r=_g.timezoneHHMM.exec(e),r){a=parseInt(r[1],10);var n=parseInt(r[2],10);return i_(a,n)?(s=Math.abs(a)*t_+n*I8,a>0?-s:s):NaN}if(L8(e)){t=new Date(t||Date.now());var o=i?t:O8(t),l=U0(o,e),h=i?l:R8(t,l,e);return-h}return NaN}function O8(e){return NC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}function U0(e,t){var i=E8(e,t),r=NC(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 R8(e,t,i){var r=e.getTime(),s=r-t,a=U0(new Date(s),i);if(t===a)return t;s-=a-t;var n=U0(new Date(s),i);return a===n?a:Math.max(a,n)}function i_(e,t){return-23<=e&&e<=23&&(t==null||0<=t&&t<=59)}var r_={};function L8(e){if(r_[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),r_[e]=!0,!0}catch{return!1}}var B8=eo(IP(),1),s_=eo(OP(),1),z8=/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/,F8=z8,Ag=36e5,a_=6e4,k8=2,Tr={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,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:F8};function U8(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?k8:(0,B8.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=N8(e),a=V8(s.date,r),n=a.year,o=a.restDateString,l=j8(o,n);if(isNaN(l))return new Date(NaN);if(l){var h=l.getTime(),c=0,d;if(s.time&&(c=G8(s.time),isNaN(c)))return new Date(NaN);if(s.timeZone||i.timeZone){if(d=VC(s.timeZone||i.timeZone,new Date(h+c)),isNaN(d))return new Date(NaN)}else d=(0,s_.default)(new Date(h+c)),d=(0,s_.default)(new Date(h+c+d));return new Date(h+c+d)}else return new Date(NaN)}function N8(e){var t={},i=Tr.dateTimePattern.exec(e),r;if(i?(t.date=i[1],r=i[3]):(i=Tr.datePattern.exec(e),i?(t.date=i[1],r=i[2]):(t.date=null,r=e)),r){var s=Tr.timeZone.exec(r);s?(t.time=r.replace(s[1],""),t.timeZone=s[1].trim()):t.time=r}return t}function V8(e,t){var i=Tr.YYY[t],r=Tr.YYYYY[t],s;if(s=Tr.YYYY.exec(e)||r.exec(e),s){var a=s[1];return{year:parseInt(a,10),restDateString:e.slice(a.length)}}if(s=Tr.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 j8(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=Tr.MM.exec(e),i)return r=new Date(0),s=parseInt(i[1],10)-1,o_(t,s)?(r.setUTCFullYear(t,s),r):new Date(NaN);if(i=Tr.DDD.exec(e),i){r=new Date(0);var n=parseInt(i[1],10);return q8(t,n)?(r.setUTCFullYear(t,0,n),r):new Date(NaN)}if(i=Tr.MMDD.exec(e),i){r=new Date(0),s=parseInt(i[1],10)-1;var o=parseInt(i[2],10);return o_(t,s,o)?(r.setUTCFullYear(t,s,o),r):new Date(NaN)}if(i=Tr.Www.exec(e),i)return a=parseInt(i[1],10)-1,l_(t,a)?n_(t,a):new Date(NaN);if(i=Tr.WwwD.exec(e),i){a=parseInt(i[1],10)-1;var l=parseInt(i[2],10)-1;return l_(t,a,l)?n_(t,a,l):new Date(NaN)}return null}function G8(e){var t,i,r;if(t=Tr.HH.exec(e),t)return i=parseFloat(t[1].replace(",",".")),Mg(i)?i%24*Ag:NaN;if(t=Tr.HHMM.exec(e),t)return i=parseInt(t[1],10),r=parseFloat(t[2].replace(",",".")),Mg(i,r)?i%24*Ag+r*a_:NaN;
5424if(t=Tr.HHMMSS.exec(e),t){i=parseInt(t[1],10),r=parseInt(t[2],10);var s=parseFloat(t[3].replace(",","."));return Mg(i,r,s)?i%24*Ag+r*a_+s*1e3:NaN}return null}function n_(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 H8=[31,28,31,30,31,30,31,31,30,31,30,31],W8=[31,29,31,30,31,30,31,31,30,31,30,31];function jC(e){return e%400===0||e%4===0&&e%100!==0}function o_(e,t,i){if(t<0||t>11)return!1;if(i!=null){if(i<1)return!1;var r=jC(e);if(r&&i>W8[t]||!r&&i>H8[t])return!1}return!0}function q8(e,t){if(t<1)return!1;var i=jC(e);return!(i&&t>366||!i&&t>365)}function l_(e,t,i){return!(t<0||t>52||i!=null&&(i<0||i>6))}function Mg(e,t,i){return!(e!=null&&(e<0||e>=25)||t!=null&&(t<0||t>=60)||i!=null&&(i<0||i>=60))}function X8(e,t,i){var r=U8(e,i),s=VC(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 Dr(e,t){return t.color(e)}function h_(e=new Date,t){let i=t.format,r=e.getSeconds(),s=e;t&&t.timeZone!==null&&(s=X8(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 Y8(e,t){switch(e.type){case"fresnel":return K8(e,t);case"gradient":return J8(e,t);case"depth":return $8(e,t);case"normal":return e9(e,t);case"noise":return t9(e,t);case"rainbow":return i9(e,t);case"toon":return r9(e,t);case"outline":return s9(e,t);case"transmission":return a9(e,t);case"color":return Z8(e,t);case"pattern":return n9(e,t)}}function Q8(e){return{type:e.type}}function Vs(e,t){let{alpha:i,mode:r,isMask:s}=e,a=typeof i=="string"?(Number(t.getVariable(i))??100)/100:i;return{...Q8(e),alpha:a,mode:r,isMask:s}}function Z8(e,t){return{...Vs(e,t),color:Dr(e.color,t)}}function K8(e,t){let{bias:i,scale:r,intensity:s,factor:a,color:n}=e;return{...Vs(e,t),color:Dr(n,t),bias:i,scale:r,intensity:s,factor:a}}function J8(e,t){let{gradientType:i,smooth:r,colors:s,steps:a,angle:n,offset:o,morph:l}=e;return{...Vs(e,t),gradientType:i,smooth:r,colors:s.map(h=>new ht(h[0],h[1],h[2],h[3])),num:s.length,steps:a,offset:new j(...o),morph:new j(...l),angle:n}}function $8(e,t){let{gradientType:i,near:r,far:s,isVector:a,isWorldSpace:n,origin:o,direction:l,colors:h,steps:c,smooth:d}=e;return{...Vs(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(u=>u!==void 0?new ht(u[0],u[1],u[2],u[3]):new ht(0,0,0,0)),steps:c.slice(0,h.length),smooth:d}}function e9(e,t){let{cnormal:i}=e;return{...Vs(e,t),cnormal:new M(i[0],i[1],i[2])}}function t9(e,t){return{...Vs(e,t),scale:e.scale,move:e.move,fA:new j(...e.fA),fB:new j(...e.fB),size:new M(...e.size),distortion:new j(...e.distortion),colorA:Dr(e.colorA,t),colorB:Dr(e.colorB,t),colorC:Dr(e.colorC,t),colorD:Dr(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 i9(e,t){return{...Vs(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 r9(e,t){return{...Vs(e,t),positioning:e.positioning,colors:e.colors.map(i=>new ht(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.noiseStrength,noiseScale:e.noiseScale,shadowColor:Dr(e.shadowColor,t),offset:new M(...e.offset)}}function s9(e,t){return{...Vs(e,t),outlineColor:Dr(e.outlineColor,t),contourColor:Dr(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 a9(e,t){return{...Vs(e,t),thickness:e.thickness,ior:e.ior,roughness:e.roughness}}function n9(e,t){return{...Vs(e,t),style:e.style,projection:e.projection,axis:e.axis,blending:e.blending,offset:new j(...e.offset),colorA:Dr(e.colorA,t),colorB:Dr(e.colorB,t),frequency:new j(...e.frequency),size:e.size,variation:e.variation,smoothness:e.smoothness,zigzag:e.zigzag,rotation:e.rotation,vertical:new j(...e.vertical),horizontal:new j(...e.horizontal),sides:e.sides}}var gf=class extends dr{},o9={noise:["noiseType"],texture:["projection","axis","side"],video:["projection","axis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"]},l9={depth:["colors"]};function h9(e,t,i){var a,n;if(t==="isMask")return!0;let r=o9[e.type],s=l9[e.type];if(s!==void 0){let o=e.color;if(s.includes(t)){let l=(n=(a=o[t])==null?void 0:a.value)==null?void 0:n.length;if(l!==void 0&&l!==i.length)return!0}}return r!==void 0?r.includes(t):!1}function GC(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 Ln||l.image.deref(),l.image=o}if("video"in a){let n=a.video,o=t.video(n),l=r;l.image instanceof Ln||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=(a.rotation??0)*Oe.DEG2RAD,s;if("repeat"in a||"offset"in a||"rotation"in a){let n="mat",o=i.uniforms[`f${i.id}_${n}`];"repeat"in a&&(o.repeat=a.repeat),"offset"in a&&(o.offset=a.offset),"rotation"in a&&(o.rotation=a.rotation??0),o.updateMatrix()}return s}function c9(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(WC(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 y1))switch(s=s||h9(i,a,n),o.constructor){case ui:if(typeof n=="string"){let l=t.getColor(n);l&&(o.value=l);break}else{let l=n;o.value instanceof gf?o.value=new dr(l.r,l.g,l.b,l.a):o.setRGBA(l);break}case Va:if(typeof n=="string"){let l=t.getColor(n);l&&(o.value=l);break}else{let l=n;o.value instanceof gf?o.value=new dr(l.r,l.g,l.b,l.a):o.value.setRGBA(l.r,l.g,l.b,l.a);break}case sr:{let l=n;o.value.setX(l[0]),o.value.setY(l[1]);break}case ss:{let l=n;o.value.setX(l[0]),o.value.setY(l[1]),o.value.setZ(l[2]);break}case Xa:{GC(n,t,i);break}case yo:{o.value=n.map(l=>new ht(...l));break}default:{o.value=n;break}}}return s}var Xo=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable(typeof e=="number"?e*100:e,i)??100)/100))??1,Ad=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)WC(a,this,i,s)}get type(){return this.data.type}static create(e,t,i,r){if(i.type==="light")return sa.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 z0(s,i.texture.wrapping,i.texture.minFilter??1008,i.texture.magFilter??1006),n=new u8(s),o=new p8(i.texture.repeat,i.texture.offset,i.texture.rotation??0),l=new ze(i.crop?1:0),h=new Xt(i.projection??0),c=new Xt(["x","y","z"].indexOf(i.axis)??0),d=new Xt(i.side??0),u=new sr(i.size?new j(i.size[0],i.size[1]):new j(100,100)),p=new ze(i.blending??0),f=new ze(Xo(i.alpha,r)),g=new Xt(i.mode??0),m=new Cr(i.isMask??!1),v=new x1(a,n,l,h,c,d,u,p,o,f,g,m),y=new $t(v.calpha,"f");return new hi(e,t,i,{texture:a,textureSize:n,crop:l,projection:h,axis:c,side:d,size:u,blending:p,mat:o,alpha:f,mode:g,isMask:m},v,g,y,m,r)}else if(i.type==="matcap"){let s=r.image(i.texture.image),a=new z0(s,i.texture.wrapping,i.texture.minFilter??1008,i.texture.magFilter??1006),n=new ze(Xo(i.alpha,r)),o=new Xt(i.mode??0),l=new Cr(i.isMask??!1),h=new ze((i.texture.rotation??0)*Oe.DEG2RAD),c=new MC(a,n,o,l,h),d=new $t(c.calpha,"f");return new hi(e,t,i,{texture:a,alpha:n,mode:o,isMask:l,rotation:h},c,o,d,l,r)}else if(i.type==="displace")if(i.displacementType==="noise"){let s=new ss(new M(...i.offset)),a=new ze(i.scale??10),n=new ze(i.intensity??8),o=new ze(i.movement??1),l=new Xt(i.noiseType??0),h=new Xt(i.voronoiStyle??0),c=new ze(i.smoothness??.5),d=new ze(i.seed??0),u=new ze(i.highCut??1),p=new ze(i.lowCut??0),f=new Xt(i.quality??1),g=new FC(n,o,s,h,c,d,u,p,f,a,l);return new HC(e,t,i,{offset:s,scale:a,intensity:n,movement:o,noiseType:l,voronoiStyle:h,smoothness:c,seed:d,highCut:u,lowCut:p,quality:f},g,r)}else throw new Error;else return p9(e,t,i,r)}updateByOp(e,t,i){let r=e;if(r.path[0]===void 0){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):c9(r.props,i.shared,this,t)}else if(r.path[0]==="texture")return"texture"in t||"video"in t?GC(r.props,i.shared,this):!0;return!1}dispose(){if(d9(this)){let e=this.uniforms[`f${this.id}_texture`];if(!e)return!1;let t=e;t.image instanceof Ln||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)}
vendor: 6,103 bytes, line 5424
5424getNode(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}},hi=class extends Ad{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}},HC=class extends Ad{constructor(e,t,i,r,s,a){super(e,t,i,r,a),this.position=s}},sa=class extends Ad{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 ze(Xo(i.alpha,r)),n=new Xt(i.mode),o=new ze(i.bumpMapIntensity),l=new ze(Xo(i.alphaOverride,r)),h;if(!i.visible)s=new b1,h={};else if(i.category==="lambert"){s=new v8;let c=new ui(r.color(i.emissive)??0),d=new Cr(i.occlusion??!0);h={emissive:c,occlusion:d},s.emissive=c,s.occlusion=d}else if(i.category==="toon"){s=new b8;let c=new ze(i.shininess??30),d=new ui(r.color(i.specular)??1118481);h={shininess:c,specular:d},s.shininess=c,s.specular=d}else if(i.category==="physical"){s=new x8;let c=new ze(i.roughness??.3),d=new ze(i.metalness??0),u=new ze(i.reflectivity??.5),p=new Cr(i.occlusion??!0);h={roughness:c,metalness:d,reflectivity:u,occlusion:p},s.roughness=c,s.metalness=d,s.reflectivity=u,s.occlusion=p}else{s=new y8;let c=new ze(i.shininess??30),d=new ui(i.specular!==void 0?r.color(i.specular)??1118481:1118481),u=new Cr(i.occlusion??!0);h={shininess:c,specular:d,occlusion:u},s.shininess=c,s.specular=d,s.occlusion=u}return s.alpha=new ze(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 sa(e,t,i,s,h,r)}get category(){return this.node.category}};function d9(e){let t=e instanceof Ad?e.type:e;return t==="texture"||t==="video"||t==="displace_map"||t==="matcap"}function es(e){return{alpha:new ze(e.alpha??1),mode:new Xt(e.mode??0),isMask:new Cr(e.isMask??!1)}}function u9(e,t,i,r,s){switch(e.type){case"color":{let a=new ui(r.color??Zr),n=es(r),o=new F0(a,n.alpha),l=new $t(o.calpha,"f");return new hi(t,i,e,{color:a,...n},o,n.mode,l,n.isMask,s)}case"fresnel":{let a=new ui(r.color??16777215),n=new ze(r.bias??.1),o=new ze(r.scale??1),l=new ze(r.intensity??2),h=new ze(r.factor??1),c=es(r),d=new f8(a,n,o,l,h,c.alpha,c.mode,c.isMask),u=new $t(d.calpha,"f");return new hi(t,i,e,{color:a,bias:n,scale:o,intensity:l,factor:h,...c},d,c.mode,u,c.isMask,s)}case"rainbow":{let a=new ze(r.filmThickness??30),n=new ze(r.movement??0),o=new ss(r.wavelengths??new M(0,0,0)),l=new ze(r.noiseStrength??0),h=new ze(r.noiseScale??1),c=new ss(r.offset??new M(0,0,0)),d=es(r),u=new IC(a,n,o,l,h,c,d.alpha,d.isMask),p=new $t(u.calpha,"f");return new hi(t,i,e,{filmThickness:a,movement:n,wavelengths:o,noiseStrength:l,noiseScale:h,offset:c,...d},u,d.mode,p,d.isMask,s)}case"transmission":{let a=new ze(r.thickness??10),n=new ze(r.ior??1.5),o=new ze(r.roughness??.5),l=rt.transmissionSize,h=rt.transmissionRenderTarget,c=rt.transmissionRenderTargetDepth,d=window.innerWidth,u=window.innerHeight,p=d>=u?new sr(u/d,1):new sr(1,d/u),f=es(r),g=new BC(a,n,o,l,h,c,p,f.alpha),m=new $t(g.calpha,"f");return new hi(t,i,e,{thickness:a,ior:n,roughness:o,aspectRatio:p,...f},g,f.mode,m,f.isMask,s)}case"toon":{let a=new Xt(r.positioning??0),n;r.colors?n=new yo(r.colors.length,r.colors):(n=new yo(10,new ht(0,0,0,1)),n.value[1]=new ht(1,1,1,1));let o;r.steps?o=new vo(r.steps.length,r.steps):(o=new vo(10,1),o.value[0]=0);let l=new ss(r.source??new M(0,0,0)),h=new Cr(r.isWorldSpace??!0),c=new ze(r.noiseStrength??0),d=new ze(r.noiseScale??1),u=new Va(r.shadowColor),p=new ss(r.offset??new M(0,0,0)),f=es(r),g=new RC(a,n,o,l,h,c,d,u,p,f.alpha),m=new $t(g.calpha,"f");return new hi(t,i,e,{positioning:a,colors:n,steps:o,source:l,isWorldSpace:h,noiseStrength:c,noiseScale:d,shadowColor:u,offset:p,...f},g,f.mode,m,f.isMask,s)}case"outline":{let a=new ui(r.outlineColor??16777215),n=new ui(r.contourColor??16777215),o=new ze(r.outlineWidth??.1),l=new ze(r.contourWidth??.1),h=new ze(r.outlineThreshold??.1),c=new ze(r.contourThreshold??.1),d=new ze(r.outlineSmoothing??.1),u=new ze(r.contourFrequency??.1),p=new ss(r.contourDirection??new M(0,1,0)),f=new Cr(r.positionalLines??!1),g=new Cr(r.compensation??!0),m=rt.normalRenderTarget,v=rt.normalRenderTargetDepth,y=rt.pixelRatioNode,x=rt.resolution,w=es(r),S=new TC(a,n,o,l,h,c,d,u,p,f,g,x,m,v,y,w.alpha),b=new $t(S.calpha,"f");return new hi(t,i,e,{outlineColor:a,contourColor:n,outlineWidth:o,contourWidth:l,outlineThreshold:h,contourThreshold:c,outlineSmoothing:d,contourFrequency:u,contourDirection:p,positionalLines:f,compensation:g,...w},S,w.mode,b,w.isMask,s)}case"depth":{let a=new Xt(r.gradientType??0),n=new Cr(r.smooth??!1),o=new ze(r.near??50),l=new ze(r.far??200),h=new ze(r.isVector??1),c=new ze(r.isWorldSpace??0),d=new ss(r.origin??new M),u=new ss(r.direction??new M),p;r.colors?p=new yo(r.colors.length,r.colors):(p=new yo(2,new ht(0,0,0,1)),p.value[1]=new ht(1,1,1,1));let f;r.steps?f=new vo(r.steps.length,r.steps):(f=new vo(2,1),f.value[0]=0);let g=es(r),m=new wC(a,n,o,l,h,c,d,u,p,f,g.alpha,g.isMask),v=new $t(m.calpha,"f");return new hi(t,i,e,{gradientType:a,smooth:n,near:o,far:l,isVector:h,isWorldSpace:c,origin:d,direction:u,colors:p,steps:f,...g},m,g.mode,v,g.isMask,s)}case"noise":{let a=new ze(r.scale??1),n=new ss(r.size??new M(100,100,100)),o=new ze(r.move??1),l=new sr(r.fA??new j(1.7,9.2)),h=new sr(r.fB??new j(8.3,2.8)),c=new sr(r.distortion??new j(1,1)),d=new Va(r.colorA),u=new Va(r.colorB),p=new Va(r.colorC),f=new Va(r.colorD),g=new Xt(r.noiseType??0),m=new Xt(r.voronoiStyle??0),v=new ze(r.highCut??1),y=new ze(r.lowCut??0),x=new ze(r.smoothness??.5),w=new ze(r.seed??.5),S=new Xt(r.quality??1),b=es(r),A=new EC(a,n,o,l,h,c,d,u,p,f,b.alpha,g,b.isMask,m,v,y,x,w,S),_=new $t(A.calpha,"f");return new hi(t,i,e,{scale:a,size:n,move:o,fA:l,fB:h,distortion:c,colorA:d,colorB:u,colorC:p,c
5424olorD:f,noiseType:g,...b,voronoiStyle:m,highCut:v,lowCut:y,smoothness:x,seed:w,quality:S},A,b.mode,_,b.isMask,s)}case"normal":{let a=new ss(r.cnormal??new M(1,1,1)),n=es(r),o=new bC(a,n.alpha),l=new $t(o.calpha,"f");return new hi(t,i,e,{cnormal:a,...n},o,n.mode,l,n.isMask,s)}case"gradient":{let a=new Xt(r.gradientType??0),n=new Cr(r.smooth??!1),o;r.colors?o=new yo(r.colors.length,r.colors):(o=new yo(10,new ht(0,0,0,1)),o.value[1]=new ht(1,1,1,1));let l;r.steps?l=new vo(r.steps.length,r.steps):(l=new vo(10,1),l.value[0]=0);let h=new sr(r.offset??new j(0,0)),c=new sr(r.morph??new j(0,0)),d=new ze(r.angle??0),u=es(r),p=new _C(a,n,o,l,h,c,d,u.alpha,u.isMask),f=new $t(p.calpha,"f");return new hi(t,i,e,{gradientType:a,smooth:n,colors:o,steps:l,offset:h,morph:c,angle:d,...u},p,u.mode,f,u.isMask,s)}case"pattern":{let a=new Xt(r.style??0),n=new Xt(r.projection??0),o=new Xt(["x","y","z"].indexOf(r.axis)??0),l=new ze(r.blending??0),h=new sr(r.offset??new j(0,0)),c=new Va(r.colorA),d=new Va(r.colorB),u=new sr(r.frequency??new j(10,10)),p=new ze(r.size??.5),f=new ze(r.variation??0),g=new ze(r.smoothness??.5),m=new ze(r.zigzag??0),v=new ze(r.rotation??0),y=new sr(r.vertical??new j(0,1)),x=new sr(r.horizontal??new j(0,1)),w=new Xt(r.sides??6),S=es(r),b=new PC(a,n,o,l,h,c,d,u,p,f,g,m,v,y,x,w,S.alpha,S.isMask),A=new $t(b.calpha,"f");return new hi(t,i,e,{style:a,projection:n,axis:o,blending:l,offset:h,colorA:c,colorB:d,frequency:u,size:p,variation:f,smoothness:g,zigzag:m,rotation:v,vertical:y,horizontal:x,sides:w,...S},b,S.mode,A,S.isMask,s)}default:{let a=new ui(1,0,0,1),n=es(r),o=new F0(a,n.alpha),l=new $t(o.calpha,"f");return new hi(t,i,e,{color:a,...n},o,n.mode,l,n.isMask,s)}}}function p9(e,t,i,r){let s=Y8(i,r);return u9(i,e,t,s,r)}function WC(e,t,i,r){if(i.type==="displace"&&(e==="intensity"||e==="visible")){let s=t.uniforms[`f${t.id}_intensity`];return s?(s.value=i.intensity*(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=Xo(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 Yl(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 Kn=class extends Pt{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""}},f9=class extends Kn{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()}},w1=class extends Kn{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,Bi.startContext(this),this.reset0(e,t),Bi.endContext(this)}get nodeMaterial(){return this}getFlavor(e,t,i,r){let s=i?6:(e?3:0)+t;if(s+=(((r==null?void 0:r.resolutionLevel)??0)-(r!=null&&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 f9(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(){var e;return((e=this.lightLayer.getNode("occlusion"))==null?void 0:e.value)??!1}reset(e,t,i=!1){Bi.startContext(this),(this.data!==e||i)&&this.reset0(e,t),Bi.endContext(this)}reset0(e,t){this.data=e;let i=e.layers??Zi.defaultTwoLayerData("phong").layers;try{this.layers=i.map(r=>Ad.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=Yl(e,t.shared),this.saveVariableLocations(t)}onVariableUpdate(e,t,i){if(e[0]==="alphaOverride")this.transparent=Yl(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);a!=null&&a.hasValue(s)&&(s==="alpha"?(this.transparent=Yl(this.data,i.shared),a.setValue(s,Math.max(0,Math.min(Number(t)/100,1)))):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.forEac
vendor: 15,526 bytes, lines 5424-5427
5424h(i=>{"alpha"in i.data&&typeof i.data.alpha=="string"&&e.shared.getVariable(i.data.alpha,["material",this.uuid,"layer",i.id,"alpha"])})}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 sa),this.lightLayer===void 0&&(this.lightLayer=new sa(0,"",{...qi.defaultData("light","phong"),visible:!1},new b1,{},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 sa);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 hi&&a.color instanceof x1&&(a.uuid===i&&(e.node.bumpMap=a.color),a.uuid===r&&(e.node.roughnessMap=a.color))}}updateByOp(e,t,i){if(Bi.startContext(this),t!==void 0?this.data=t:t=this.data,this.transparent=Yl(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:Xo(e.props.alpha,r,["material",this.uuid,"layer",s,"alpha"])}:o={...e.props,alphaOverride:Xo(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);Bi.endContext(this)}applyMasks(){for(let e=0;e<this.layers.length;++e){let t=this.layers[e];t instanceof hi?t.color.mask=void 0:t instanceof sa&&(t.node.mask=void 0)}for(let e=0;e<this.layers.length;++e){let t=this.layers[e];if(t instanceof hi&&t.isMask.value&&t.data.visible&&e>0){let i=e-1,r=this.layers[i];r instanceof sa?r.node.mask=new zr(t.color,t.alpha,zr.MUL):r instanceof hi&&(r.isMask.value||(r.color.mask=new zr(t.color,t.alpha,zr.MUL)))}}}blendColors(){let e=this.layers.findIndex(i=>i instanceof hi),t=this.layers.findIndex(i=>i instanceof sa);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 hi){if(s.isMask.value)continue;i=new e_(i,s.color,s.alpha,s.mode)}}this.fragment.color=i}else this.fragment.color=void 0}blendAfterColors(){let e=new $t("outgoingLight","f"),t=this.layers.findIndex(i=>i instanceof sa);if(this.layers.length>t+1){for(let i=t+1;i<this.layers.length;++i){let r=this.layers[i];if(r instanceof hi){if(r.isMask.value)continue;e=new e_(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 HC);if(e.length>0){let t=e[0].position;for(let i=1;i<e.length;++i)e[i]&&(t=new zr(t,e[i].position,zr.ADD),t=new zr(t,new ze(.5).setReadonly(!0),zr.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 gC;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 hi){let t=e.params.texture;if(t instanceof z0&&!t.image.loaded)return!1}return!0}};Object.defineProperties(Kn.prototype,{properties:{get:function(){return this.fragment.properties}}});var N0=class extends w1{constructor(e,t,i){super(e,t,!1),this.uuid=i,this.allowVariableSaves=!0,this.saveVariableLocations(t)}},c_=new Map;function m9(e){if(typeof e=="string")return e;let t=c_.get(e);return t||(t={url:URL.createObjectURL(new Blob([e]))},c_.set(e,t)),t.url}var qC,g9=new Promise(e=>{qC=e}),d_=!1,zu;function v9(){if(d_)return;if(zu)return zu;async function e(){await $n(()=>import("./howler-DhNmR6Ur.js").then(t=>t.h),__vite__mapDeps([0,1,2])),qC(window!==void 0?window:global),d_=!0}return zu=e(),zu}var XC;g9.then(e=>XC=e);function y9(e){let t=!1;return e.scene.objects.traverse((i,r)=>{if(r.events===void 0||Array.isArray(r.events)===!1)return!0;let s=[];r.events.forEach(a=>{"dragDropActions"in a.data?(s.push(...a.data.dragDropActions.drag),s.push(...a.data.dragDropActions.drop)):"inActions"in a.data?(s.push(...a.data.inActions),s.push(...a.data.outActions)):"gameActions"in a.data?(s.push(...a.data.gameActions.idle),s.push(...a.data.gameActions.move),s.push(...a.data.gameActions.jump),s.push(...a.data.gameActions.run)):"breakpoints"in a.data?a.data.breakpoints.forEach(n=>{s.push(...n.data.actions)}):"actions"in a.data&&s.push(...a.data.actions),t=t||s.some(n=>n.data.type==="Audio")})}),t}var Tc=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:m9(e),format:"wav"},this.sound=new XC.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()}},x9=class{constructor(){this.type="ShapePath",this.color=new $e,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Pp,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){var i;return(i=this.currentPath)==null||i.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){var s;return(s=this.currentPath)==null||s.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,a){var n;return(n=this.currentPath)==null||n.bezierCurveTo(e,t,i,r,s,a),this}splineThru(e){var t;return(t=this.currentPath)==null||t.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,g,m){let v=p.x,y=f.x,x=g.x,w=m.x,S=p.y,b=f.y,A=g.y,_=m.y,E=(w-x)*(S-A)-(_-A)*(v-x),C=(y-v)*(S-A)-(b-S)*(v-x),T=(_-A)*(y-v)-(w-x)*(b-S),P=E/T,O=C/T;if(T===0&&E!==0||P<=0||P>=1||O<0||O>1)return null;if(E===0&&T===0){for(let D=0;D<2;D++)if(r(D===0?g:m,p,f),t.loc===e.ORIGIN){let k=D===0?g:m;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),W=+(S+t.t*(b-S)).toPrecision(10);return{x:k,y:W,t:t.t}}return null}else{for(let W=0;W<2;W++)if(r(W===0?g:m,p,f),t.loc===e.ORIGIN){let N=W===0?g:m;return{x:N.x,y:N.y,t:t.t}}let D=+(v+P*(y-v)).toPrecision(10),k=+(S+P*(b-S)).toPrecision(10);return{x:D,y:k,t:P}}}function r(p,f,g){let m=g.x-f.x,v=g.y-f.y,y=p.x-f.x,x=p.y-f.y,w=m*x-y*v;if(p.x===f.x&&p.y===f.y){t.loc=e.ORIGIN,t.t=0;return}if(p.x===g.x&&p.y===g.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(m*y<0||v*x<0){t.loc=e.BEHIND;return}if(Math.sqrt(m*m+v*v)<Math.sqrt(y*y+x*x)){t.loc=e.BEYOND;return}let S;m!==0?S=y/m:S=x/v,t.loc=e.BETWEEN,t.t=S}function s(p,f){let g=[],m=[];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],A=i(y,x,S,b);A!==null&&g.find(_=>_.t<=A.t+Number.EPSILON&&_.t>=A.t-Number.EPSILON)===void 0&&(g.push(A),m.push(new j(A.x,A.y)))}}return m}function a(p,f,g){let m=new j;f.getCenter(m);let v=[];return g.forEach(y=>{y.boundingBox.containsPoint(m)&&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,g,m,v){(v==null||v==="")&&(v="nonzero");let y=new j;p.boundingBox.getCenter(y);let x=[new j(g,y.y),new j(m,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 A=S[0].point.x,_=[],E=0;for(;E<b.length&&b[E].point.x<A;)_.length>0&&_[_.length-1]===b[E].identifier?_.pop():_.push(b[E].identifier),E++;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,P=null;for(let O=0;O<_.length;O++){let D=_[O];f[D]&&(C?(P=f[D].isCW,C=!1,T=D):P!==f[D].isCW&&(P=f[D].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(),g=-999999999,m=999999999,v=-999999999,y=999999999;for(let x=0;x<f.length;x++){let w=f[x];w.y>g&&(g=w.y),w.y<m&&(m=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:ZM.isClockWise(f),identifier:o++,boundingBox:new Oy(new j(y,m),new j(v,g))})});let d=c.map(p=>{var f;return n(p,c,l,h,(f=this.userData)==null?void 0:f.style.fillRule)}),u=[];return c.forEach(p=>{let f=d[p.identifier];if(f&&!f.isHole){let g=new Dp;g.curves=p.curves,d.filter(m=>(m==null?void 0:m.isHole)&&m.for===p.identifier).forEach(m=>{if(m){let v=c[m.identifier],y=new Pp;y.curves=v.curves,g.holes.push(y)}}),u.push(g)}}),u}},YC=!1,QC,u_=new Promise(e=>{QC=e}),p_=!1,Fu;function b9(){if(YC=!0,p_)return;if(Fu)return Fu;async function e(){let t=await $n(()=>import("./opentype-D6jUvuOk.js"),[]);QC(t),p_=!0}return Fu=e(),Fu}var w9=class{async load(e,t,i=()=>{}){let{load:r}=await u_;r(e,(s,a)=>{s||!a?i(s??"Something went wrong"):t(a)})}async parse(e){let{parse:t,Bidi:i}=await u_;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 S9(e){return await(await fetch(e)).arrayBuffer()}var _9=new w9;async function f_(e){let t,i,r=!1;if(e.url?(t=await S9(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(YC){let s=await _9.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 A9(e,t){return t.state.glyphIndex===e||t.state.fina===e||t.state.medi===e||t.state.init===e}var M9=class{constructor(e){this._arrayBuffer=new ArrayBuffer(1),this._isLoaded=!1,this._intercepted=!1,this._isUserFont=e.isUserFont??!1,this._loadingPromise=f_(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=f_(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),d=s[n];if(A9(h,d)||o)a.push({char:c,index:h,replacements:[d.state.glyphIndex],replacementChars:[d.char]}),n++;else{let u=d.char,p="",f=[d.state.glyphIndex],g=[],m=!1;for(;!m;)n++,p=t.charAt(n),u+=p,f.push(e.charToGlyphIndex(p)),g=e.stringToGlyphs(u),g.length===1&&g[0].index===h&&(m=!0),n>t.length&&(m=!0);a.push({char:c,index:h,replacements:f,replacementChars:Array.from(u)}),n++}}return a}generateShapes(e,t){if(!this._isLoaded)return;let i=this.font,r=t.fontSize/this.unitsPerEm,s=t.fontSize*t.lineHeight,a=e.map(v=>this.getTextWidth(v,t)),n=t.width,o=this.getCharWidth(`
5425`,t),l=t.horizontalAlign===1?o:0,h=this.computeSpaceWidthForLine(e,0,t),c=this.getLineInitialOffsetX(a[0],n,t.horizontalAlign,e[0],o),d=this.getLineInitialOffsetY(s,e.length,t.height,r,t.verticalAlign),u=[],p=e.map(v=>[]),f=e.map(v=>[]),g;for(let v=0;v<e.length;v++){let y=e[v],x={features:{liga:!0}},w=[];try{w=i.stringToGlyphs(y,x)}catch(b){console.warn(b)}c=this.getLineInitialOffsetX(a[v],n,t.horizontalAlign,y,o);let S=[];try{S=this.reverseLigaturesTable(i,y,w)}catch(b){console.warn(b)}h=this.computeSpaceWidthForLine(e,v,t);for(let b=0;b<w.length;b++){let A=w[b],_=A.index===0?`
5426`:A.unicode?String.fromCharCode(A.unicode):void 0,E=S[b],C=0,T=0;b===0&&t.horizontalAlign===2&&A.leftSideBearing!==void 0&&(T=-A.leftSideBearing*r),g&&(C=i.getKerningValue(A,g)*r),c+=T+C;let P=0;if(_===`
5427`)P=l;else if(_===" ")P=h;else{let O=this.createPath(A,r,c,d,t);O&&(P=O.offsetX-(C+T),u.push(O.path))}if(E.replacements.length===1)f[v].push([c,d]),p[v].push(P);else{let O=E.replacements.map(N=>(i.glyphs.get(N).advanceWidth??0)*r),D=O.reduce((N,F)=>N+=F,0),k=O.map(N=>N/D),W=c;for(let N=0;N<k.length;N++){let F=P*k[N];f[v].push([W,d]),p[v].push(F),W+=F}}c+=P,g=A}d-=s}let m=[];for(let v=0,y=u.length;v<y;v++)m.push(...u[v].toShapes());return{shapes:m,charWidths:p,lineWidths:a,charCoords:f}}get isUserFont(){return this._isUserFont}get arrayBuffer(){return this._arrayBuffer}get ascender(){var e;return((e=this.font)==null?void 0:e.ascender)??0}get descender(){var e;
5427return((e=this.font)==null?void 0:e.descender)??0}get familyName(){var e;return((e=this.font)==null?void 0:e.names.fontFamily)??""}get subfamilyName(){var e;return((e=this.font)==null?void 0:e.names.fontSubfamily)??""}get unitsPerEm(){var e;return((e=this.font)==null?void 0:e.unitsPerEm)??1}getLineInitialOffsetX(e,t,i,r,s){return(i===3||i===2)&&r.indexOf(`
5428`)>=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){var l;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 x9,o=(e.advanceWidth??1)*t;if(e)for(let h of a.commands){let c=(l=n.currentPath)==null?void 0:l.currentPoint;if(!(c&&h.type!=="Z"&&c.x===h.x&&-c.y===h.y))switch(h.type){case"M":n.moveTo(h.x,-h.y);break;case"L":n.lineTo(h.x,-h.y);break;case"Q":n.quadraticCurveTo(h.x1,-h.y1,h.x,-h.y);break;case"C":n.bezierCurveTo(h.x1,-h.y1,h.x2,-h.y2,h.x,-h.y);break}}return n.subPaths.forEach(h=>{let c=E9(h.curves);c!==void 0&&h.currentPoint.distanceTo(c)>0&&h.lineTo(c.x,c.y)}),{offsetX:o+s.fontSize*s.letterSpacing,path:n}}getCharWidth(e,t){var i;return((i=this.font)==null?void 0:i.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing}))??0}getTextWidth(e,t){var i;return((i=this.font)==null?void 0:i.getAdvanceWidth(e,t.fontSize,{kerning:!0,letterSpacing:t.letterSpacing}))??0}computeSpaceWidthForLine(e,t,i){let r=this.getCharWidth(" ",i),s=e[t];if(s){let a=this.countSpaces(s.trimEnd());if(i.horizontalAlign===4&&t<e.length-1&&a){let n=i.width,o=this.getTextWidth(s,i);return(n-(o-a*r))/a}}return r}countSpaces(e){return(e.match(/ /g)||[]).length}};function E9(e){if(e.length){let t=e[0];if(t instanceof Bs)return t.v1;if(t instanceof Os||t instanceof Qn)return t.v0}}var C9=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()}},m_=class extends C9{constructor(e){super(),this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,t,i){let r=dd(e,t,this.flatShading,i);return r.computeBoundingSphere(),r}},T9={markNeedsUpdateRendererDirty:()=>{}},pp=1e3,g_=512*pp;function P9(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 D9="https://hooks.spline.design",I9=`${D9}/events?hashFile=`,O9=class{constructor(e,t){this.id=e,this.userWebhook=t,this.result=void 0,this._connected=!1,this.emitter=Xf(),this.reconnectWaitFor=pp,this._onError=i=>{var r,s,a;(r=this.eventSource)==null||r.removeEventListener("message",this._onMessage),(s=this.eventSource)==null||s.removeEventListener("error",this._onError),(a=this.eventSource)==null||a.removeEventListener("open",this._onConnected),this._scheduleReconnect()},this._onConnected=i=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=pp,this._connected=!0},this._onDisconnected=()=>{clearTimeout(this.scheduledReconnectHandle),this.reconnectWaitFor=pp,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&&P9(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(I9+this.userWebhook.url),this.eventSource.addEventListener("message",this._onMessage),this.eventSource.addEventListener("error",this._onError),this.eventSource.addEventListener("open",this._onConnected))}disconnect(){var e,t,i,r;(e=this.eventSource)==null||e.removeEventListener("message",this._onMessage),(t=this.eventSource)==null||t.removeEventListener("error",this._onError),(i=this.eventSource)==null||i.removeEventListener("open",this._onConnected),(r=this.eventSource)==null||r.close(),this._onDisconnected(),clearTimeout(this.scheduledReconnectHandle)}_scheduleReconnect(){this.reconnectWaitFor*=2,this.reconnectWaitFor>
5428g_&&(this.reconnectWaitFor=g_),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){var t;if(this.getParametersKeys().includes(e)){if(this.result)return(t=this.result)==null?void 0:t[e];for(let i of this.userWebhook.parametersSchemas)if(i.data.name===e)return p0.defaultParameterValueByType(i.data.type)}}},R9=globalThis.atob,L9=globalThis.btoa,ah=class{static floatTo16BitPCM(e){let t=new ArrayBuffer(e.length*2),i=new DataView(t),r=0;for(let s=0;s<e.length;s++,r+=2){let a=Math.max(-1,Math.min(1,e[s]));i.setInt16(r,a<0?a*32768:a*32767,!0)}return t}static base64ToArrayBuffer(e){let t=R9(e),i=t.length,r=new Uint8Array(i);for(let s=0;s<i;s++)r[s]=t.charCodeAt(s);return r.buffer}static arrayBufferToBase64(e){e instanceof Float32Array?e=this.floatTo16BitPCM(e):e instanceof Int16Array&&(e=e.buffer);let t="",i=new Uint8Array(e),r=32768;for(let s=0;s<i.length;s+=r){let a=i.subarray(s,s+r);t+=String.fromCharCode.apply(null,a)}return L9(t)}static mergeInt16Arrays(e,t){if(e instanceof ArrayBuffer&&(e=new Int16Array(e)),t instanceof ArrayBuffer&&(t=new Int16Array(t)),!(e instanceof Int16Array)||!(t instanceof Int16Array))throw new Error("Both items must be Int16Array");let i=new Int16Array(e.length+t.length);for(let r=0;r<e.length;r++)i[r]=e[r];for(let r=0;r<t.length;r++)i[e.length+r]=t[r];return i}static generateId(e,t=21){let i="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",r=Array(t-e.length).fill(0).map(s=>i[Math.floor(Math.random()*i.length)]).join("");return`${e}${r}`}},B9=e=>new Promise(t=>setTimeout(()=>t(),e)),ZC=class{constructor(){this.eventHandlers={},this.nextEventHandlers={}}clearEventHandlers(){return this.eventHandlers={},this.nextEventHandlers={},!0}on(e,t){return this.eventHandlers[e]=this.eventHandlers[e]||[],this.eventHandlers[e].push(t),t}onNext(e,t){return this.nextEventHandlers[e]=this.nextEventHandlers[e]||[],this.nextEventHandlers[e].push(t),t}off(e,t){let i=this.eventHandlers[e]||[];if(t){let r=i.indexOf(t);if(r===-1)throw new Error(`Could not turn off specified event listener for "${e}": not found as a listener`);i.splice(r,1)}else delete this.eventHandlers[e];return!0}offNext(e,t){let i=this.nextEventHandlers[e]||[];if(t){let r=i.indexOf(t);if(r===-1)throw new Error(`Could not turn off specified next event listener for "${e}": not found as a listener`);i.splice(r,1)}else delete this.nextEventHandlers[e];return!0}async waitForNext(e,t=null){let i=Date.now(),r;for(this.onNext(e,s=>r=s);!r;){if(t&&Date.now()-i>t)return null;await B9(1)}return r}dispatch(e,t){let i=[].concat(this.eventHandlers[e]||[]);for(let s of i)s(t);let r=[].concat(this.nextEventHandlers[e]||[]);for(let s of r)s(t);return delete this.nextEventHandlers[e],!0}},z9=class extends ZC{constructor({url:e,apiKey:t,dangerouslyAllowAPIKeyInBrowser:i,debug:r}={}){if(super(),this.defaultUrl="wss://api.openai.com/v1/realtime",this.url=e||this.defaultUrl,this.apiKey=t||null,this.debug=!!r,this.ws=null,globalThis.document&&this.apiKey&&!i)throw new Error('Can not provide API key in the browser without "dangerouslyAllowAPIKeyInBrowser" set to true')}isConnected(){return!!this.ws}log(...e){let t=[`[Websocket/${new Date().toISOString()}]`].concat(e).map(i=>typeof i=="object"&&i!==null?JSON.stringify(i,null,2):i);
5428return this.debug&&console.log(...t),!0}async connect({model:e}={model:"gpt-4o-realtime-preview-2024-10-01"}){if(!this.apiKey&&this.url===this.defaultUrl&&console.warn(`No apiKey provided for connection to "${this.url}"`),this.isConnected())throw new Error("Already connected");if(globalThis.document){this.apiKey&&console.warn("Warning: Connecting using API key in the browser, this is not recommended");let t=globalThis.WebSocket,i=new t(`${this.url}${e?`?model=${e}`:""}`,["realtime",`openai-insecure-api-key.${this.apiKey}`,"openai-beta.realtime-v1"]);return i.addEventListener("message",r=>{let s=JSON.parse(r.data);this.receive(s.type,s)}),new Promise((r,s)=>{let a=()=>{this.disconnect(i),s(new Error(`Could not connect to "${this.url}"`))};i.addEventListener("error",a),i.addEventListener("open",()=>{this.log(`Connected to "${this.url}"`),i.removeEventListener("error",a),i.addEventListener("error",()=>{this.disconnect(i),this.log(`Error, disconnected from "${this.url}"`),this.dispatch("close",{error:!0})}),i.addEventListener("close",()=>{this.disconnect(i),this.log(`Disconnected from "${this.url}"`),this.dispatch("close",{error:!1})}),this.ws=i,r(!0)})})}}disconnect(e){if(!e||this.ws===e)return this.ws&&this.ws.close(),this.ws=null,!0}receive(e,t){return this.log("received:",e,t),this.dispatch(`server.${e}`,t),this.dispatch("server.*",t),!0}send(e,t){if(!this.isConnected())throw new Error("RealtimeAPI is not connected");if(t=t||{},typeof t!="object")throw new Error("data must be an object");let i={event_id:ah.generateId("evt_"),type:e,...t};return this.dispatch(`client.${e}`,i),this.dispatch("client.*",i),this.log("sent:",e,i),this.ws.send(JSON.stringify(i)),!0}},F9=class{constructor(){Mo(this,"defaultFrequency",24e3),Mo(this,"EventProcessors",{"conversation.item.created":e=>{let{item:t}=e,i=JSON.parse(JSON.stringify(t));if(this.itemLookup[i.id]||(this.itemLookup[i.id]=i,this.items.push(i)),i.formatted={},i.formatted.audio=new Int16Array(0),i.formatted.text="",i.formatted.transcript="",this.queuedSpeechItems[i.id]&&(i.formatted.audio=this.queuedSpeechItems[i.id].audio,delete this.queuedSpeechItems[i.id]),i.content){let r=i.content.filter(s=>["text","input_text"].includes(s.type));for(let s of r)i.formatted.text+=s.text}return this.queuedTranscriptItems[i.id]&&(i.formatted.transcript=this.queuedTranscriptItems.transcript,delete this.queuedTranscriptItems[i.id]),i.type==="message"?i.role==="user"?(i.status="completed",this.queuedInputAudio&&(i.formatted.audio=this.queuedInputAudio,this.queuedInputAudio=null)):i.status="in_progress":i.type==="function_call"?(i.formatted.tool={type:"function",name:i.name,call_id:i.call_id,arguments:""},i.status="in_progress"):i.type==="function_call_output"&&(i.status="completed",i.formatted.output=i.output),{item:i,delta:null}},"conversation.item.truncated":e=>{let{item_id:t,audio_end_ms:i}=e,r=this.itemLookup[t];if(!r)throw new Error(`item.truncated: Item "${t}" not found`);let s=Math.floor(i*this.defaultFrequency/1e3);return r.formatted.transcript="",r.formatted.audio=r.formatted.audio.slice(0,s),{item:r,delta:null}},"conversation.item.deleted":e=>{let{item_id:t}=e,i=this.itemLookup[t];if(!i)throw new Error(`item.deleted: Item "${t}" not found`);delete this.itemLookup[i.id];let r=this.items.indexOf(i);return r>-1&&this.items.splice(r,1),{item:i,delta:null}},"conversation.item.input_audio_transcription.completed":e=>{let{item_id:t,content_index:i,transcript:r}=e,s=this.itemLookup[t],a=r||" ";return s?(s.content[i].transcript=r,s.formatted.transcript=a,{item:s,delta:{transcript:r}}):(this.queuedTranscriptItems[t]={transcript:a},{item:null,delta:null})},"input_audio_buffer.speech_started":e=>{let{item_id:t,audio_start_ms:i}=e;return this.queuedSpeechItems[t]={audio_start_ms:i},{item:null,delta:null}},"input_audio_buffer.speech_stopped":(e,t)=>{let{item_id:i,audio_end_ms:r}=e;this.queuedSpeechItems[i]||(this.queuedSpeechItems[i]={audio_start_ms:r});let s=this.queuedSpeechItems[i];if(s.audio_end_ms=r,t){let a=Math.floor(s.audio_start_ms*this.defaultFrequency/1e3),n=Math.floor(s.audio_end_ms*this.defaultFrequency/1e3);s.audio=t.slice(a,n)}return{item:null,delta:null}},"response.created":e=>{let{response:t}=e;return this.responseLookup[t.id]||(this.responseLookup[t.id]=t,this.responses.push(t)),{item:null,delta:null}},"response.output_item.added":e=>{let{response_id:t,item:i}=e,r=this.responseLookup[t];if(!r)throw new Error(`response.output_item.added: Response "${t}" not found`);return r.output.push(i.id),{item:null,delta:null}},"response.output_item.done":e=>{let{item:t}=e;if(!t)throw new Error('response.output_item.done: Missing "item"');let i=this.itemLookup[t.id];if(!i)throw new Error(`response.output_item.done: Item "${t.id}" not found`);return i.status=t.status,{item:i,delta:null}},"response.content_part.added":e=>{let{item_id:t,part:i}
5428=e,r=this.itemLookup[t];if(!r)throw new Error(`response.content_part.added: Item "${t}" not found`);return r.content.push(i),{item:r,delta:null}},"response.audio_transcript.delta":e=>{let{item_id:t,content_index:i,delta:r}=e,s=this.itemLookup[t];if(!s)throw new Error(`response.audio_transcript.delta: Item "${t}" not found`);return s.content[i].transcript+=r,s.formatted.transcript+=r,{item:s,delta:{transcript:r}}},"response.audio.delta":e=>{let{item_id:t,content_index:i,delta:r}=e,s=this.itemLookup[t];if(!s)throw new Error(`response.audio.delta: Item "${t}" not found`);let a=ah.base64ToArrayBuffer(r),n=new Int16Array(a);return s.formatted.audio=ah.mergeInt16Arrays(s.formatted.audio,n),{item:s,delta:{audio:n}}},"response.text.delta":e=>{let{item_id:t,content_index:i,delta:r}=e,s=this.itemLookup[t];if(!s)throw new Error(`response.text.delta: Item "${t}" not found`);return s.content[i].text+=r,s.formatted.text+=r,{item:s,delta:{text:r}}},"response.function_call_arguments.delta":e=>{let{item_id:t,delta:i}=e,r=this.itemLookup[t];if(!r)throw new Error(`response.function_call_arguments.delta: Item "${t}" not found`);return r.arguments+=i,r.formatted.tool.arguments+=i,{item:r,delta:{arguments:i}}}}),this.clear()}clear(){return this.itemLookup={},this.items=[],this.responseLookup={},this.responses=[],this.queuedSpeechItems={},this.queuedTranscriptItems={},this.queuedInputAudio=null,!0}queueInputAudio(e){return this.queuedInputAudio=e,e}processEvent(e,...t){if(!e.event_id)throw console.error(e),new Error('Missing "event_id" on event');if(!e.type)throw console.error(e),new Error('Missing "type" on event');let i=this.EventProcessors[e.type];if(!i)throw new Error(`Missing conversation event processor for "${e.type}"`);return i.call(this,e,...t)}getItem(e){return this.itemLookup[e]||null}getItems(){return this.items.slice()}},v_=class extends ZC{constructor({url:e,apiKey:t,dangerouslyAllowAPIKeyInBrowser:i,debug:r}={}){super(),this.defaultSessionConfig={modalities:["text","audio"],instructions:"",voice:"alloy",input_audio_format:"pcm16",output_audio_format:"pcm16",input_audio_transcription:null,turn_detection:null,tools:[],tool_choice:"auto",temperature:.8,max_response_output_tokens:4096},this.sessionConfig={},this.transcriptionModels=[{model:"whisper-1"}],this.defaultServerVadConfig={type:"server_vad",threshold:.5,prefix_padding_ms:300,silence_duration_ms:200},this.realtime=new z9({url:e,apiKey:t,dangerouslyAllowAPIKeyInBrowser:i,debug:r}),this.conversation=new F9,this._resetConfig(),this._addAPIEventHandlers()}_resetConfig(){return this.sessionCreated=!1,this.tools={},this.sessionConfig=JSON.parse(JSON.stringify(this.defaultSessionConfig)),this.inputAudioBuffer=new Int16Array(0),!0}_addAPIEventHandlers(){this.realtime.on("client.*",r=>{let s={time:new Date().toISOString(),source:"client",event:r};this.dispatch("realtime.event",s)}),this.realtime.on("server.*",r=>{let s={time:new Date().toISOString(),source:"server",event:r};this.dispatch("realtime.event",s)}),this.realtime.on("server.session.created",()=>this.sessionCreated=!0);let e=(r,...s)=>{let{item:a,delta:n}=this.conversation.processEvent(r,...s);return{item:a,delta:n}},t=(r,...s)=>{let{item:a,delta:n}=e(r,...s);return a&&this.dispatch("conversation.updated",{item:a,delta:n}),{item:a,delta:n}},i=async r=>{try{let s=JSON.parse(r.arguments),a=this.tools[r.name];if(!a)throw new Error(`Tool "${r.name}" has not been added`);let n=await a.handler(s);this.realtime.send("conversation.item.create",{item:{type:"function_call_output",call_id:r.call_id,output:JSON.stringify(n)}})}catch(s){this.realtime.send("conversation.item.create",{item:{type:"function_call_output",call_id:r.call_id,output:JSON.stringify({error:s.message})}})}this.createResponse()};return this.realtime.on("server.response.created",e),this.realtime.on("server.response.output_item.added",e),this.realtime.on("server.response.content_part.added",e),this.realtime.on("server.input_audio_buffer.speech_started",r=>{e(r),this.dispatch("conversation.interrupted")}),this.realtime.on("server.input_audio_buffer.speech_stopped",r=>e(r,this.inputAudioBuffer)),this.realtime.on("server.conversation.item.created",r=>{let{item:s}=t(r);this.dispatch("conversation.item.appended",{item:s}),s.status==="completed"&&this.dispatch("conversation.item.completed",{item:s})}),this.realtime.on("server.conversation.item.truncated",t),this.realtime.on("server.conversation.item.deleted",t),this.realtime.on("server.conversation.item.input_audio_transcription.completed",t),this.realtime.on("server.response.audio_transcript.delta",t),this.realtime.on("server.response.audio.delta",t),this.realtime.on("server.response.text.delta",t),this.realtime.on("server.response.function_call_arguments.delta",t),this.realtime.on("server.response.output_item.done",async r=>{let{item:s}=t(r);s.status==="completed"&&this.dispatch("conversation.item.completed",{item:s}),s.formatted.tool&&i(s.formatted.tool)}),!0}isConnected(){return this.realtime.isConnected()}reset(){return this.disconnect(),this.clearEventHandlers(),this.realtime.clearEventHandlers(),this._resetConfig(),this._addAPIEventHandlers(),!0}async connect(){if(this.isConnected())throw new Error("Already connected, use .disconnect() first");return await this.realtime.connect(),this.updateSession(),!0}async waitForSessionCreated(){if(!this.isConnected())throw new Error("Not connected, use .connect() first");for(;!this.sessionCreated;)await new Promise(e=>setTimeout(()=>e(),1));return!0}disconnect(){this.sessionCreated=!1,this.realtime.isConnected()&&this.realtime.disconnect(),this.conversation.clear()}getTurnDetectionType(){var e;return((e=this.sessionConfig.turn_detection)==null?void 0:e.type)||null}addTool(e,t){if(!(e!=null&&e.name))throw new Error("Missing tool name in definition");let i=e==null?void 0:e.name;if(this.tools[i])throw new Error(`Tool "${i}" already added. Please use .removeTool("${i}") before trying to add again.`);if(typeof t!="function")throw new Error(`Tool "${i}" handler must be a function`);return this.tools[i]={definition:e,handler:t},this.updateSession(),this.tools[i]}removeTool(e){if(!this.tools[e])throw new Error(`Tool "${e}" does not exist, can not be removed.`);return delete this.tools[e],!0}deleteItem(e){return this.realtime.send("conversation.item.delete",{item_id:e}),!0}updateSession({modalities:e=void 0,instructions:t=void 0,voice:i=void 0,input_audio_format:r=void 0,output_audio_format:s=void 0,input_audio_transcription:a=void 0,turn_detection:n=void 0,tools:o=void 0,tool_choice:l=void 0,temperature:h=void 0,max_response_output_tokens:c=void 0}={}){e!==void 0&&(this.sessionConfig.modalities=e),t!==void 0&&(this.sessionConfig.instructions=t),i!==void 0&&(this.sessionConfig.voice=i),r!==void 0&&(this.sessionConfig.input_audio_format=r),s!==void 0&&(this.sessionConfig.output_audio_format=s),a!==void 0&&(this.sessionConfig.input_audio_transcription=a),n!==void 0&&(this.sessionConfig.turn_detection=n),o!==void 0&&(this.sessionConfig.tools=o),l!==void 0&&(this.sessionConfig.tool_choice=l),h!==void 0&&(this.sessionConfig.temperature=h),c!==void 0&&(this.sessionConfig.max_response_output_tokens=c);let d=[].concat((o||[]).map(p=>{let f={type:"function",...p};if(this.tools[f==null?void 0:f.name])throw new Error(`Tool "${f==null?void 0:f.name}" has already been defined`);return f}),Object.keys(this.tools).map(p=>({type:"function",...this.tools[p].definition}))),u={...this.sessionConfig};return u.tools=d,this.realtime.isConnected()&&this.realtime.send("session.update",{session:u}),!0}sendUserMessageContent(e=[]){if(e.length){for(let t of e)t.type==="input_audio"&&(t.audio instanceof ArrayBuffer||t.audio instanceof Int16Array)&&(t.audio=ah.arrayBufferToBase64(t.audio));this.realtime.send("conversation.item.create",{item:{type:"message",role:"user",content:e}})}return this.createResponse(),!0}appendInputAudio(e){return e.byteLength>0&&(this.realtime.send("input_audio_buffer.append",{audio:ah.arrayBufferToBase64(e)}),this.inputAudioBuffer=ah.mergeInt16Arrays(this.inputAudioBuffer,e)),!0}createResponse(){return this.getTurnDetectionType()===null&&this.inputAudioBuffer.byteLength>0&&(this.realtime.send("input_audio_buffer.commit"),this.conversation.queueInputAudio(this.inputAudioBuffer),this.inputAudioBuffer=new Int16Array(0)),this.realtime.send("response.create"),!0}cancelResponse(e,t=0){if(e){if(e){let i=this.conversation.getItem(e);if(!i)throw new Error(`Could not find item "${e}"`);
5428if(i.type!=="message")throw new Error('Can only cancelResponse messages with type "message"');if(i.role!=="assistant")throw new Error('Can only cancelResponse messages with role "assistant"');this.realtime.send("response.cancel");let r=i.content.findIndex(s=>s.type==="audio");if(r===-1)throw new Error("Could not find audio on item to cancel");return this.realtime.send("conversation.item.truncate",{item_id:e,content_index:r,audio_end_ms:Math.floor(t/this.conversation.defaultFrequency*1e3)}),{item:i}}}else return this.realtime.send("response.cancel"),{item:null}}async waitForNextItem(){let e=await this.waitForNext("conversation.item.appended"),{item:t}=e;return{item:t}}async waitForNextCompletedItem(){let e=await this.waitForNext("conversation.item.completed"),{item:t}=e;return{item:t}}},k9=`
5429class AudioProcessor extends AudioWorkletProcessor {
5430
5431  constructor() {
5432    super();
5433    this.port.onmessage = this.receive.bind(this);
5434    this.initialize();
5435  }
5436
5437  initialize() {
5438    this.foundAudio = false;
5439    this.recording = false;
5440    this.chunks = [];
5441  }
5442
5443  /**
5444   * Concatenates sampled chunks into channels
5445   * Format is chunk[Left[], Right[]]
5446   */
5447  readChannelData(chunks, channel = -1, maxChannels = 9) {
5448    let channelLimit;
5449    if (channel !== -1) {
5450      if (chunks[0] && chunks[0].length - 1 < channel) {
5451        throw new Error(
5452          \`Channel \${channel} out of range: max \${chunks[0].length}\`
5453        );
5454      }
5455      channelLimit = channel + 1;
5456    } else {
5457      channel = 0;
5458      channelLimit = Math.min(chunks[0] ? chunks[0].length : 1, maxChannels);
5459    }
5460    const channels = [];
5461    for (let n = channel; n < channelLimit; n++) {
5462      const length = chunks.reduce((sum, chunk) => {
5463        return sum + chunk[n].length;
5464      }, 0);
5465      const buffers = chunks.map((chunk) => chunk[n]);
5466      const result = new Float32Array(length);
5467      let offset = 0;
5468      for (let i = 0; i < buffers.length; i++) {
5469        result.set(buffers[i], offset);
5470        offset += buffers[i].length;
5471      }
5472      channels[n] = result;
5473    }
5474    return channels;
5475  }
5476
5477  /**
5478   * Combines parallel audio data into correct format,
5479   * channels[Left[], Right[]] to float32Array[LRLRLRLR...]
5480   */
5481  formatAudioData(channels) {
5482    if (channels.length === 1) {
5483      // Simple case is only one channel
5484      const float32Array = channels[0].slice();
5485      const meanValues = channels[0].slice();
5486      return { float32Array, meanValues };
5487    } else {
5488      const float32Array = new Float32Array(
5489        channels[0].length * channels.length
5490      );
5491      const meanValues = new Float32Array(channels[0].length);
5492      for (let i = 0; i < channels[0].length; i++) {
5493        const offset = i * channels.length;
5494        let meanValue = 0;
5495        for (let n = 0; n < channels.length; n++) {
5496          float32Array[offset + n] = channels[n][i];
5497          meanValue += channels[n][i];
5498        }
5499        meanValues[i] = meanValue / channels.length;
5500      }
5501      return { float32Array, meanValues };
5502    }
5503  }
5504
5505  /**
5506   * Converts 32-bit float data to 16-bit integers
5507   */
5508  floatTo16BitPCM(float32Array) {
5509    const buffer = new ArrayBuffer(float32Array.length * 2);
5510    const view = new DataView(buffer);
5511    let offset = 0;
5512    for (let i = 0; i < float32Array.length; i++, offset += 2) {
5513      let s = Math.max(-1, Math.min(1, float32Array[i]));
5514      view.setInt16(offset, s < 0 ? s * 0x8000 : s * 0x7fff, true);
5515    }
5516    return buffer;
5517  }
5518
5519  /**
5520   * Retrieves the most recent amplitude values from the audio stream
5521   * @param {number} channel
5522   */
5523  getValues(channel = -1) {
5524    const channels = this.readChannelData(this.chunks, channel);
5525    const { meanValues } = this.formatAudioData(channels);
5526    return { meanValues, channels };
5527  }
5528
5529  /**
5530   * Exports chunks as an audio/wav file
5531   */
5532  export() {
5533    const channels = this.readChannelData(this.chunks);
5534    const { float32Array, meanValues } = this.formatAudioData(channels);
5535    const audioData = this.floatTo16BitPCM(float32Array);
5536    return {
5537      meanValues: meanValues,
5538      audio: {
5539        bitsPerSample: 16,
5540        channels: channels,
5541        data: audioData,
5542      },
5543    };
5544  }
5545
5546  receive(e) {
5547    const { event, id } = e.data;
5548    let receiptData = {};
5549    switch (event) {
5550      case 'start':
5551        this.recording = true;
5552        break;
5553      case 'stop':
5554        this.recording = false;
5555        break;
5556      case 'clear':
5557        this.initialize();
5558        break;
5559      case 'export':
5560        receiptData = this.export();
5561        break;
5562      case 'read':
5563        receiptData = this.getValues();
5564        break;
5565      default:
5566        break;
5567    }
5568    // Always send back receipt
5569    this.port.postMessage({ event: 'receipt', id, data: receiptData });
5570  }
5571
5572  sendChunk(chunk) {
5573    const channels = this.readChannelData([chunk]);
5574    const { float32Array, meanValues } = this.formatAudioData(channels);
5575    const rawAudioData = this.floatTo16BitPCM(float32Array);
5576    const monoAudioData = this.floatTo16BitPCM(meanValues);
5577    this.port.postMessage({
5578      event: 'chunk',
5579      data: {
5580        mono: monoAudioData,
5581        raw: rawAudioData,
5582      },
5583    });
5584  }
5585
5586  process(inputList, outputList, parameters) {
5587    // Copy input to output (e.g. speakers)
5588    // Note that this creates choppy sounds with Mac products
5589    const sourceLimit = Math.min(inputList.length, outputList.length);
5590    for (let inputNum = 0; inputNum < sourceLimit; inputNum++) {
5591      const input = inputList[inputNum];
5592      const output = outputList[inputNum];
5593      const channelCount = Math.min(input.length, output.length);
5594      for (let channelNum = 0; channelNum < channelCount; channelNum++) {
5595        input[channelNum].forEach((sample, i) => {
5596          output[channelNum][i] = sample;
5597        });
5598      }
5599    }
5600    const inputs = inputList[0];
5601    // There's latency at the beginning of a stream before recording starts
5602    // Make sure we actually receive audio data before we start storing chunks
5603    let sliceIndex = 0;
5604    if (!this.foundAudio) {
5605      for (const channel of inputs) {
5606        sliceIndex = 0; // reset for each channel
5607        if (this.foundAudio) {
5608          break;
5609        }
5610        if (channel) {
5611          for (const value of channel) {
5612            if (value !== 0) {
5613              // find only one non-zero entry in any channel
5614              this.foundAudio = true;
5615              break;
5616            } else {
5617              sliceIndex++;
5618            }
5619          }
5620        }
5621      }
5622    }
5623    if (inputs && inputs[0] && this.foundAudio && this.recording) {
5624      // We need to copy the TypedArray, because the \`process\`
5625      // internals will reuse the same buffer to hold each input
5626      const chunk = inputs.map((input) => input.slice(sliceIndex));
5627      this.chunks.push(chunk);
5628      this.sendChunk(chunk);
5629    }
5630    return true;
5631  }
5632}
5633
5634registerProcessor('audio_processor', AudioProcessor);
5635`,U9=new Blob([k9],{type:"application/javascript"}),N9=URL.createObjectURL(U9),V9=N9,y_=[4186.01,4434.92,4698.63,4978.03,5274.04,5587.65,5919.91,6271.93,6644.88,7040,7458.62,7902.13],j9=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"],Yn=[],S1=[];for(let e=1;e<=8;e++)for(let t=0;t<y_.length;t++){let i=y_[t];Yn.push(i/Math.pow(2,8-e)),S1.push(j9[t]+e)}var vf=[32,2e3],x_=Yn.filter((e,t)=>Yn[t]>vf[0]&&Yn[t]<vf[1]),G9=S1.filter((e,t)=>Yn[t]>vf[0]&&Yn[t]<vf[1]),_1=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 u=r==="voice"?x_:Yn,p=Array(u.length).fill(s);for(let f=0;f<i.length;f++){let g=f*o,m=i[f];for(let v=u.length-1;v>=0;v--)if(g>u[v]){p[v]=Math.max(p[v],m);break}}l=p,h=r==="voice"?x_:Yn,c=r==="voice"?G9:S1}else l=Array.from(i),h=l.map((u,p)=>o*p),c=h.map(u=>`${u.toFixed(2)} Hz`);let d=l.map(u=>Math.max(0,Math.min((u-s)/(a-s),1)));return{values:new Float32Array(d),frequencies:h,labels:c}}constructor(e,t=null){if(this.fftResults=[],t){let{length:i,sampleRate:r}=t,s=new OfflineAudioContext({length:i,sampleRate:r}),a=s.createBufferSource();a.buffer=t;let n=s.createAnalyser();n.fftSize=8192,n.smoothingTimeConstant=.1,a.connect(n);let o=1/60,l=i/r,h=c=>{let d=o*c;d<l&&s.suspend(d).then(()=>{let u=new Float32Array(n.frequencyBinCount);n.getFloatFrequencyData(u),this.fftResults.push(u),h(c+1)}),c===1?s.startRendering():s.resume()};a.start(0),h(1),this.audio=e,this.context=s,this.analyser=n,this.sampleRate=r,this.audioBuffer=t}else{let i=new AudioContext,r=i.createMediaElementSource(e),s=i.createAnalyser();s.fftSize=8192,s.smoothingTimeConstant=.1,r.connect(s),s.connect(i.destination),this.audio=e,this.context=i,this.analyser=s,this.sampleRate=this.context.sampleRate,this.audioBuffer=null}}
5635getFrequencies(e="frequency",t=-100,i=-30){let r=null;if(this.audioBuffer&&this.fftResults.length){let s=this.audio.currentTime/this.audio.duration,a=Math.min(s*this.fftResults.length|0,this.fftResults.length-1);r=this.fftResults[a]}return _1.getFrequencies(this.analyser,this.sampleRate,r,e,t,i)}async resumeIfSuspended(){return this.context.state==="suspended"&&await this.context.resume(),!0}},El=class{static floatTo16BitPCM(e){let t=new ArrayBuffer(e.length*2),i=new DataView(t),r=0;for(let s=0;s<e.length;s++,r+=2){let a=Math.max(-1,Math.min(1,e[s]));i.setInt16(r,a<0?a*32768:a*32767,!0)}return t}static mergeBuffers(e,t){let i=new Uint8Array(e.byteLength+t.byteLength);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),i.buffer}_packData(e,t){return[new Uint8Array([t,t>>8]),new Uint8Array([t,t>>8,t>>16,t>>24])][e]}pack(e,t){if(t!=null&&t.bitsPerSample)if(t!=null&&t.channels){if(!(t!=null&&t.data))throw new Error('Missing "data"')}else throw new Error('Missing "channels"');else throw new Error('Missing "bitsPerSample"');let{bitsPerSample:i,channels:r,data:s}=t,a=["RIFF",this._packData(1,52),"WAVE","fmt ",this._packData(1,16),this._packData(0,1),this._packData(0,r.length),this._packData(1,e),this._packData(1,e*r.length*i/8),this._packData(0,r.length*i/8),this._packData(0,i),"data",this._packData(1,r[0].length*r.length*i/8),s],n=new Blob(a,{type:"audio/mpeg"}),o=URL.createObjectURL(n);return{blob:n,url:o,channelCount:r.length,sampleRate:e,duration:s.byteLength/(r.length*e*2)}}},b_=class{constructor({sampleRate:e=44100,outputToSpeakers:t=!1,debug:i=!1}={}){this.scriptSrc=V9,this.sampleRate=e,this.outputToSpeakers=t,this.debug=!!i,this._deviceChangeCallback=null,this._devices=[],this.stream=null,this.processor=null,this.source=null,this.node=null,this.recording=!1,this._lastEventId=0,this.eventReceipts={},this.eventTimeout=5e3,this._chunkProcessor=()=>{},this._chunkProcessorSize=void 0,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)}}static async decode(e,t=44100,i=-1){let r=new AudioContext({sampleRate:t}),s,a;if(e instanceof Blob){if(i!==-1)throw new Error('Can not specify "fromSampleRate" when reading from Blob');a=e,s=await a.arrayBuffer()}else if(e instanceof ArrayBuffer){if(i!==-1)throw new Error('Can not specify "fromSampleRate" when reading from ArrayBuffer');s=e,a=new Blob([s],{type:"audio/wav"})}else{let h,c;if(e instanceof Int16Array){c=e,h=new Float32Array(e.length);for(let u=0;u<e.length;u++)h[u]=e[u]/32768}else if(e instanceof Float32Array)h=e;else if(e instanceof Array)h=new Float32Array(e);else throw new Error('"audioData" must be one of: Blob, Float32Arrray, Int16Array, ArrayBuffer, Array<number>');if(i===-1)throw new Error('Must specify "fromSampleRate" when reading from Float32Array, In16Array or Array');if(i<3e3)throw new Error('Minimum "fromSampleRate" is 3000 (3kHz)');c||(c=El.floatTo16BitPCM(h));let d={bitsPerSample:16,channels:[h],data:c};a=new El().pack(i,d).blob,s=await a.arrayBuffer()}let n=await r.decodeAudioData(s),o=n.getChannelData(0),l=URL.createObjectURL(a);return{blob:a,url:l,values:o,audioBuffer:n}}log(){return this.debug&&this.log(...arguments),!0}getSampleRate(){return this.sampleRate}getStatus(){return this.processor?this.recording?"recording":"paused":"ended"}async _event(e,t={},i=null){if(i=i||this.processor,!i)throw new Error("Can not send events without recording first");let r={event:e,id:this._lastEventId++,data:t};i.port.postMessage(r);let s=new Date().valueOf();for(;!this.eventReceipts[r.id];){if(new Date().valueOf()-s>this.eventTimeout)throw new Error(`Timeout waiting for "${e}" event`);await new Promise(n=>setTimeout(()=>n(!0),1))}let a=this.eventReceipts[r.id];return delete this.eventReceipts[r.id],a}listenForDeviceChange(e){if(e===null&&this._deviceChangeCallback)navigator.mediaDevices.removeEventListener("devicechange",this._deviceChangeCallback),this._deviceChangeCallback=null;else if(e!==null){let t=0,i=[],r=a=>a.map(n=>n.deviceId).sort().join(","),s=async()=>{let a=++t,n=await this.listDevices();a===t&&r(i)!==r(n)&&(i=n,e(n.slice()))};navigator.mediaDevices.addEventListener("devicechange",s),s(),this._deviceChangeCallback=s}return!0}async requestPermission(){let e=await navigator.permissions.query({name:"microphone"});if(e.state==="denied")window.alert("You must grant microphone access to use this feature.");else if(e.state==="prompt")try{(await navigator.mediaDevices.getUserMedia({audio:!0}
5635)).getTracks().forEach(t=>t.stop())}catch{window.alert("You must grant microphone access to use this feature.")}return!0}async listDevices(){if(!navigator.mediaDevices||!("enumerateDevices"in navigator.mediaDevices))throw new Error("Could not request user devices");await this.requestPermission();let e=(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="audioinput"),t=e.findIndex(r=>r.deviceId==="default"),i=[];if(t!==-1){let r=e.splice(t,1)[0],s=e.findIndex(a=>a.groupId===r.groupId);s!==-1&&(r=e.splice(s,1)[0]),r.default=!0,i.push(r)}return i.concat(e)}async begin(e){if(this.processor)throw new Error("Already connected: please call .end() to start a new session");if(!navigator.mediaDevices||!("getUserMedia"in navigator.mediaDevices))throw new Error("Could not request user media");try{let n={audio:!0};e&&(n.audio={deviceId:{exact:e}}),this.stream=await navigator.mediaDevices.getUserMedia(n)}catch{throw new Error("Could not start media stream")}let t=new AudioContext({sampleRate:this.sampleRate}),i=t.createMediaStreamSource(this.stream);try{await t.audioWorklet.addModule(this.scriptSrc)}catch(n){throw console.error(n),new Error(`Could not add audioWorklet module: ${this.scriptSrc}`)}let r=new AudioWorkletNode(t,"audio_processor");r.port.onmessage=n=>{let{event:o,id:l,data:h}=n.data;if(o==="receipt")this.eventReceipts[l]=h;else if(o==="chunk")if(this._chunkProcessorSize){let c=this._chunkProcessorBuffer;this._chunkProcessorBuffer={raw:El.mergeBuffers(c.raw,h.raw),mono:El.mergeBuffers(c.mono,h.mono)},this._chunkProcessorBuffer.mono.byteLength>=this._chunkProcessorSize&&(this._chunkProcessor(this._chunkProcessorBuffer),this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)})}else this._chunkProcessor(h)};let s=i.connect(r),a=t.createAnalyser();return a.fftSize=8192,a.smoothingTimeConstant=.1,s.connect(a),this.outputToSpeakers&&(console.warn(`Warning: Output to speakers may affect sound quality,
5636especially due to system audio feedback preventative measures.
5637use only for debugging`),a.connect(t.destination)),this.source=i,this.node=s,this.analyser=a,this.processor=r,!0}getFrequencies(e="frequency",t=-100,i=-30){if(!this.processor)throw new Error("Session ended: please call .begin() first");return _1.getFrequencies(this.analyser,this.sampleRate,null,e,t,i)}async pause(){if(this.processor){if(!this.recording)throw new Error("Already paused: please call .record() first")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessorBuffer.raw.byteLength&&this._chunkProcessor(this._chunkProcessorBuffer),this.log("Pausing ..."),await this._event("stop"),this.recording=!1,!0}async record(e=()=>{},t=8192){if(this.processor){if(this.recording)throw new Error("Already recording: please call .pause() first");if(typeof e!="function")throw new Error("chunkProcessor must be a function")}else throw new Error("Session ended: please call .begin() first");return this._chunkProcessor=e,this._chunkProcessorSize=t,this._chunkProcessorBuffer={raw:new ArrayBuffer(0),mono:new ArrayBuffer(0)},this.log("Recording ..."),await this._event("start"),this.recording=!0,!0}async clear(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return await this._event("clear"),!0}async read(){if(!this.processor)throw new Error("Session ended: please call .begin() first");return this.log("Reading ..."),await this._event("read")}async save(e=!1){if(!this.processor)throw new Error("Session ended: please call .begin() first");if(!e&&this.recording)throw new Error("Currently recording: please call .pause() first, or call .save(true) to force");this.log("Exporting ...");let t=await this._event("export");return new El().pack(this.sampleRate,t.audio)}async end(){if(!this.processor)throw new Error("Session ended: please call .begin() first");let e=this.processor;this.log("Stopping ..."),await this._event("stop"),this.recording=!1,this.stream.getTracks().forEach(i=>i.stop()),this.log("Exporting ...");let t=await this._event("export",{},e);return this.processor.disconnect(),this.source.disconnect(),this.node.disconnect(),this.analyser.disconnect(),this.stream=null,this.processor=null,this.source=null,this.node=null,new El().pack(this.sampleRate,t.audio)}
5637async quit(){return this.listenForDeviceChange(null),this.processor&&await this.end(),!0}},H9=`
5638class StreamProcessor extends AudioWorkletProcessor {
5639  constructor() {
5640    super();
5641    this.hasStarted = false;
5642    this.hasInterrupted = false;
5643    this.outputBuffers = [];
5644    this.bufferLength = 128;
5645    this.write = { buffer: new Float32Array(this.bufferLength), trackId: null };
5646    this.writeOffset = 0;
5647    this.trackSampleOffsets = {};
5648    this.port.onmessage = (event) => {
5649      if (event.data) {
5650        const payload = event.data;
5651        if (payload.event === 'write') {
5652          const int16Array = payload.buffer;
5653          const float32Array = new Float32Array(int16Array.length);
5654          for (let i = 0; i < int16Array.length; i++) {
5655            float32Array[i] = int16Array[i] / 0x8000; // Convert Int16 to Float32
5656          }
5657          this.writeData(float32Array, payload.trackId);
5658        } else if (
5659          payload.event === 'offset' ||
5660          payload.event === 'interrupt'
5661        ) {
5662          const requestId = payload.requestId;
5663          const trackId = this.write.trackId;
5664          const offset = this.trackSampleOffsets[trackId] || 0;
5665          this.port.postMessage({
5666            event: 'offset',
5667            requestId,
5668            trackId,
5669            offset,
5670          });
5671          if (payload.event === 'interrupt') {
5672            this.hasInterrupted = true;
5673          }
5674        } else {
5675          throw new Error(\`Unhandled event "\${payload.event}"\`);
5676        }
5677      }
5678    };
5679  }
5680
5681  writeData(float32Array, trackId = null) {
5682    let { buffer } = this.write;
5683    let offset = this.writeOffset;
5684    for (let i = 0; i < float32Array.length; i++) {
5685      buffer[offset++] = float32Array[i];
5686      if (offset >= buffer.length) {
5687        this.outputBuffers.push(this.write);
5688        this.write = { buffer: new Float32Array(this.bufferLength), trackId };
5689        buffer = this.write.buffer;
5690        offset = 0;
5691      }
5692    }
5693    this.writeOffset = offset;
5694    return true;
5695  }
5696
5697  process(inputs, outputs, parameters) {
5698    const output = outputs[0];
5699    const outputChannelData = output[0];
5700    const outputBuffers = this.outputBuffers;
5701    if (this.hasInterrupted) {
5702      this.port.postMessage({ event: 'stop' });
5703      return false;
5704    } else if (outputBuffers.length) {
5705      this.hasStarted = true;
5706      const { buffer, trackId } = outputBuffers.shift();
5707      for (let i = 0; i < outputChannelData.length; i++) {
5708        outputChannelData[i] = buffer[i] || 0;
5709      }
5710      if (trackId) {
5711        this.trackSampleOffsets[trackId] =
5712          this.trackSampleOffsets[trackId] || 0;
5713        this.trackSampleOffsets[trackId] += buffer.length;
5714      }
5715      return true;
5716    } else if (this.hasStarted) {
5717      this.port.postMessage({ event: 'stop' });
5718      return false;
5719    } else {
5720      return true;
5721    }
5722  }
5723}
5724
5725registerProcessor('stream_processor', StreamProcessor);
5726`,W9=new Blob([H9],{type:"application/javascript"}),q9=URL.createObjectURL(W9),X9=q9,Y9=class{constructor({sampleRate:e=44100}={}){this.scriptSrc=X9,this.sampleRate=e,this.context=null,this.stream=null,this.analyser=null,this.trackSampleOffsets={},this.interruptedTrackIds={}}async connect(){this.context=new AudioContext({sampleRate:this.sampleRate}),this.context.state==="suspended"&&await this.context.resume();try{await this.context.audioWorklet.addModule(this.scriptSrc)}catch(t){throw console.error(t),new Error(`Could not add audioWorklet module: ${this.scriptSrc}`)}let e=this.context.createAnalyser();return e.fftSize=8192,e.smoothingTimeConstant=.1,this.analyser=e,!0}getFrequencies(e="frequency",t=-100,i=-30){if(!this.analyser)throw new Error("Not connected, please call .connect() first");return _1.getFrequencies(this.analyser,this.sampleRate,null,e,t,i)}_start(){let e=new AudioWorkletNode(this.context,"stream_processor");return e.connect(this.context.destination),e.port.onmessage=t=>{let{event:i}=t.data;if(i==="stop")e.disconnect(),this.stream=null;else if(i==="offset"){let{requestId:r,trackId:s,offset:a}=t.data,n=a/this.sampleRate;this.trackSampleOffsets[r]={trackId:s,offset:a,currentTime:n}}},this.analyser.disconnect(),e.connect(this.analyser),this.stream=e,!0}add16BitPCM(e,t="default"){if(typeof t!="string")throw new Error("trackId must be a string");if(this.interruptedTrackIds[t])return;this.stream||this._start();let i;if(e instanceof Int16Array)i=e;else if(e instanceof ArrayBuffer)i=new Int16Array(e);else throw new Error("argument must be Int16Array or ArrayBuffer");return this.stream.port.postMessage({event:"write",buffer:i,trackId:t}),i}async getTrackSampleOffset(e=!1){if(!this.stream)return null;let t=crypto.randomUUID();this.stream.port.postMessage({event:e?"interrupt":"offset",requestId:t});let i;for(;!i;)i=this.trackSampleOffsets[t],await new Promise(s=>setTimeout(()=>s(),1));let{trackId:r}=i;return e&&r&&(this.interruptedTrackIds[r]=!0),i}async interrupt(){return this.getTrackSampleOffset(!0)}},w_=()=>"https://relayserver.spline.design/",S_=class{constructor(e,t,i){this.data=e,this.id=t,this.shared=i,this.items=[],this.isConnected=!1,this.rafId=0,this.emitter=Xf(),this.voice=0,this.frequencies=new Float32Array([0]),this.onRealTimeEvent=({time:r,source:s,event:a})=>{s==="server"&&a.type==="spline.ready"?this.onSessionCreated(a):s==="server"&&a.type==="session.created"&&(this.client.createResponse(),this.client.on("realtime.event",this.onRealTimeEvent))},this.onSessionCreated=async r=>{let s=Object.values(this.client.tools).map(a=>({type:"function",...a.definition}));this.client.realtime.send("spline.tools",{tools:s}),this.client.realtime.send("spline.connect",{}),await this.wavRecorder.record(a=>this.client.isConnected()&&this.client.appendInputAudio(a.mono))},this.animate=()=>{if(this.rafId=requestAnimationFrame(this.animate),this.isConnected){let r=this.wavStreamPlayer.analyser?this.wavStreamPlayer.getFrequencies("voice"):{values:new Float32Array([0])},s=r.values.reduce((a,n)=>a+n,0)/r.values.length;this.voice=s,this.frequencies=r.values,this.emitter.emit("voice",{value:s,frequencies:r.values})}},this.client=new v_({url:w_()+"?uuidfile="+e.integration.hash}),this.wavRecorder=new b_({sampleRate:24e3}),this.wavStreamPlayer=new Y9({sampleRate:24e3})}update(e){this.data=e,this.client=new v_({url:w_()+"?uuidfile="+e.integration.hash})}setColorByName(e,t){let i=this.shared.getColorByName(e);
5726if(i){let{id:r}=i,{r:s,g:a,b:n}=cW.hexStringToRgb(t)??{r:0,g:0,b:0};this.shared.updateColor(r,{r:s/255,g:a/255,b:n/255})}}connect(){if(this.isConnected)return;this.isConnected=!0,this.client.updateSession({turn_detection:{type:"server_vad"}}),this.client.addTool({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.client.addTool({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},this.shared.updateVariable(n.id,l)}});let t=this.shared.getColorNames().join(", ");this.client.addTool({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.client.addTool({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.client.on("error",s=>console.error(s)),this.client.on("conversation.interrupted",async()=>{let s=await this.wavStreamPlayer.interrupt();if(s!=null&&s.trackId){let{trackId:a,offset:n}=s;await this.client.cancelResponse(a,n)}}),this.client.on("conversation.updated",async({item:s,delta:a})=>{var o;let n=this.client.conversation.getItems();if(a!=null&&a.audio&&this.wavStreamPlayer.add16BitPCM(a.audio,s.id),s.status==="completed"&&((o=s.formatted.audio)==null?void 0:o.length)){let l=await b_.decode(s.formatted.audio,24e3,24e3);s.formatted.file=l}this.items=n}),this.animate()}disconnect(){cancelAnimationFrame(this.rafId),this.voice=0,this.isConnected=!1}async start(){try{await this.wavRecorder.end()}catch{}await this.wavRecorder.begin(),this.client.on("realtime.event",this.onRealTimeEvent),await this.wavStreamPlayer.connect(),await this.client.connect()}async stop(){try{this.client.off("realtime.event",this.onRealTimeEvent)}catch(e){console.error(e)}this.client.disconnect(),await this.wavRecorder.end(),await this.wavStreamPlayer.interrupt()}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 V0(e){return"variable_"+e}var Q9=class extends M8{constructor(e){super(),this.shared=e}create(e){return new UC(e,this.shared)}},A1=class{constructor(e,t={},i=!0,r=!1){if(this.data=e,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new m_(!0),this.geometryCache2=new m_(!1),this.imageHolderCache=new Q9(this),this.thisContext={scene:T9,shared:this},this.deletedMaterial=new N0(Zi.defaultTwoLayerData("phong"),this.thisContext,""),this.deletedImage=new Ln(m0.emptyImage,this),this.deletedVideo=new Ln(Kp.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},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
vendor: 4,181 bytes, line 5726
5726(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){this.data=e,this.resetLib(e.lib);for(let{id:i,data:r}of e.variables)this.addVariableHolder(i,r),t&&this.updateVariableHolder(i,r);for(let[i,r]of Object.entries(e.userAPIs))this.addUserAPI(i,r);for(let[i,r]of Object.entries(e.userWebhooks))this.addUserWebhook(i,r);for(let[i,r]of Object.entries(e.images))this.addImage(i,r);for(let[i,r]of Object.entries(e.videos))this.addVideo(i,r);for(let[i,r]of Object.entries(e.colors))this.addColor(i,r);for(let[i,r]of Object.entries(e.materials))this.addMaterial(i,r);for(let[i,r]of Object.entries(e.audios))this.addAudio(i,r);for(let[i,r]of Object.entries(e.particles))this.addParticle(i,r);for(let[i,r]of Object.entries(e.fonts))this.addFont(i,r)}addMaterial(e,t){if(this.materials[e]){let i=this.materials[e];i.reset(t,this.thisContext),i.dispose()}else{let i=new N0(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 w1(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 Ln(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 Ln(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 Ln(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 gf(t.r,t.g,t.b,t.a):this.colors[e]=new gf(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 dr(0,0,0,0))}else return"a"in e?new dr(e.r,e.g,e.b,e.a):new dr(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 Tc)return t;{let i=new Tc({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 Tc&&t.dispose(),delete this.audios[e])}addFont(e,t){this.fonts[e]=new M9(t),this.fonts[e].loadingPromise.then(()=>this.requestRender())}getFont(e){return this.fonts[e]}deleteFont(e){this.fonts[e]&&delete this.fonts[e]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEac
vendor: 4,091 bytes, line 5726
5726h(e=>{e instanceof Tc&&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(V0(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)}updateVariableHolder(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(V0(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(d=>{let u=d.root??d;u.uuid===n&&u.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*Oe.DEG2RAD:n[a[a.length-1]]=i}if(n=r.find(a[0]),n.type==="ParticleEmitter"&&n.updateVariableState(i,a),Ct.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){var i,r,s;if(Array.isArray(e)){if(e[0]==="mouse")return((i=this.mouseProperty)==null?void 0:i[e[1]])??0;if(e[0]==="raycast")return((r=this.raycastProperty)==null?void 0:r[e[1]])??0;let a=this.entityOpContext.scene.find(e[0]);if(e[1]==="width"||e[1]==="height"||e[1]==="depth")return a.geometry.userData.parameters[e[1]];for(let n=1;n<e.length;n++)a=a[e[n]];return e[1]==="rotation"&&(a*=Oe.RAD2DEG),a}for(let a in this.variables){if(t===void 0)break;let n=this.variables[a],o=(s=n.locations)==null?void 0:s.findIndex(l=>Fi.equal(l,t));o!==void 0&&o!==-1&&n.locations.splice(o,1)}if(typeof e=="string"){let a=e,n=e;do{if(n=a,this.variables[a]===void 0)break;let o=this.variables[a].value;t&&this.variables[n]!==void 0&&this.variables[n].locations.push(t),a=o}while(typeof a=="string");return a}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){var t;return(t=this.variables[e])==null?void 0:t.dynamicVariablePlayState}setDynamicVariablePlayState(e,t){this.variables[e]!==void 0&&(this.variables[e].dynamicVariablePlayState=t)}getDynamicVariableToggleIsForward(e){var t;return(t=this.variables[e])==null?void 0:t.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);
5726for(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(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){var r;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(Qi.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 s=t.userAPIs[e.path[1]];if(s){let a=e.type===0&&e.props.debounce===void 0,n=this.getUserAPI(e.path[1]);n instanceof S_?n.update(s):n==null||n.update(s,this,a)}}}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 s=t.userWebhooks[e.path[1]];s&&((r=this.getUserWebhook(e.path[1]))==null||r.update(s))}}else e.path[0]==="lib"&&this.updateLibByOp(Qi.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){var i,r;return this.userAPIs[e]?(this.userAPIs[e].update(t,this),!0):((i=this.openAIRealtime)==null?void 0:i.id)===e?(this.openAIRealtime.update(t),!0):((r=t.integration)==null?void 0:r.type)==="VoiceAssistant"?(this.openAIRealtime=new S_(t,e,this),!1):(this.userAPIs[e]=new iC(e,t,this),!1)}getUserAPI(e){var t;return((t=this.openAIRealtime)==null?void 0:t.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 O9(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 A1(os.emptyData());var Nh=class extends Or{updateByPatchedOp(e,t,i){if(super.updateByPatchedOp(e,t,i),Jj(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(Yt(e.path,["material"])&&this.material instanceof Kn)"material"in t&&typeof t.material!="string"&&this.material.updateByOp(Qi.drop(e,1),t.material,i);else if(Yt(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];
vendor: 7,127 bytes, line 5726
5726typeof s!="string"&&this.material[r].updateByOp(Qi.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){var s,a;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;if(this.dataPatched.type==="Mesh"&&this.dataPatched.geometry.type==="ShapeBlendGeometry"&&(r={resolutionLevel:this.dataPatched.geometry.resolutionLevel,useChildrenColors:this.dataPatched.geometry.useChildrenColors}),((s=e.geometry)==null?void 0:s.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()),(((a=e.geometry)==null?void 0:a.type)==="NonParametricGeometry"||"materials"in e)&&("materials"in e&&e.materials!==void 0?(this.disposeMaterial(),this.material=e.materials.map(n=>t.shared.material(n).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())),e.flatShading!==void 0||e.wireframe!==void 0||e.side!==void 0)if(Array.isArray(this.material))for(let n=0;n<this.material.length;n++)this.material[n]=this.material[n].getFlavor(i.flatShading,i.side,i.wireframe);else this.material=this.material.getFlavor(i.flatShading,i.side,i.wireframe,r)}disposeMaterial(){this.material&&q2(this.material).forEach(e=>{e instanceof Kn&&(e instanceof N0||e.nodeMaterialDispose())})}dispose(){this.disposeMaterial(),super.dispose()}},__=new M,A_=new ht,M_=new ht,Z9=new M,E_=new be,Ei=class extends Nh{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 be().fromArray(t.bindMatrix),this.bindMatrixInverse=new be)}chooseGeoemtryCache(e){return e.geometryCache}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof je&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get geometry(){if(this.localGeometry!==void 0)return this.localGeometry;if(this.geometryCreateDeleyed instanceof A1){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 ef.is2DParametricMesh(e.type)&&e.depth===0}get is2DType(){return ef.is2DParametricMesh(this.geometry.userData.type)}get isNonParametric(){return this.geometry.userData.type==="NonParametricGeometry"}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),Yt(e.path,["geometry"])&&this.updateByPatchedOpGeometry(Qi.drop(e,1),t.geometry,i)}removeInteractionGeometry(e){var t;(t=this.localGeometry)==null||t.dispose(),this.localGeometry=void 0}updateGeometryInteractions(e,t){var r;this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if(i==="NonParametricGeometry"||i==="SubdivGeometry"){let s=e;if(this.localGeometry===void 0){let h={...this.data.geometry,...s};this.localGeometry=dd(h,t,this.data.flatShading,this)}let a,n,o;s.scaleBaked?[a,n,o]=s.scaleBaked:{width:a,height:n,depth:o}=s;let l=this.localGeometry.userData;l.sxPrev!==void 0&&L0(this.localGeometry.attributes,a/l.sxPrev,n/l.syPrev,o/l.szPrev),l.sxPrev=a,l.syPrev=n,l.szPrev=o}else{let s={...this.data.geometry,...e};(r=this.localGeometry)==null||r.dispose(),this.localGeometry=dd(s,t,this.data.flatShading,this)}}refreshAttachedClonersInteractions(){for(let e of this.attachedSurfaceCloners)e.update()}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){var s;let r=!1;e.type===0&&e.path.length===0&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Er&&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||((s=i.scene)==null||s.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(){var e;Array.isArray(this.material)&&this.geometry.groups.length===0&&this.geometry.addGroup(0,Math.max(((e=this.geometry.getIndex())==null?void 0:e.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 ht,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;A_.fromBufferAttribute(r.attributes.skinIndex,e),M_.fromBufferAttribute(r.attributes.skinWeight,e),__.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){let a=M_.getComponent(s);if(a!==0){let n=A_.getComponent(s);E_.multiplyMatrices(i.bones[n].matrixWorld,i.boneInverses[n]),t.addScaledVector(Z9.copy(__).applyMatrix4(E_),a)}}
5726return t.applyMatrix4(this.bindMatrixInverse)}};function K9(e){var n,o;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 l=0;l<r.length;l+=3){let h=`${r[l]}_${r[l+1]}_${r[l+2]}`,c=new M(s[l],s[l+1],s[l+2]);t.has(h)?(n=t.get(h))==null||n.normals.push(c):t.set(h,{normals:[c],result:new M})}t.forEach((l,h)=>{for(let c of l.normals)l.result.add(c);l.result.divideScalar(l.normals.length)});for(let l=0;l<r.length;l+=3){let h=`${r[l]}_${r[l+1]}_${r[l+2]}`,c=(o=t.get(h))==null?void 0:o.result;c&&(a[l]=c.x,a[l+1]=c.y,a[l+2]=c.z)}e.geometry.setAttribute("extrudeNormal",new De(a,3))}function J9(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 M1(e){if(Array.isArray(e.material)){for(let t of e.material)if(t.getLayersOfType("outline").length===0)return}else if(!(e.material instanceof Kn)||e.material.getLayersOfType("outline").length===0)return;e instanceof Ei&&e.is2DAndNoDepth?J9(e):K9(e)}function E1(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=[Oe.seededRandom(r),Oe.seededRandom(r+1e4),Oe.seededRandom(r+2e4)];for(let a=0;a<t.length;a++)i[a]=s[a%3];e.geometry.setAttribute("randomColor",new et(i,3))}var Qs=new xi,lc=new M;function $9(e){let t=!1;return e.scene.objects.traverse((i,r)=>{r.type==="Mesh"&&r.geometry.type==="SubdivGeometry"&&(t=!0)}),t}var ud=class extends Ei{constructor(e,t,i){super(e,t,i),this.data=t,this.hiddenMatrixOld=new be,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){var a,n,o;if(this.skipReactionUpdate===!0)return;let t=(a=this.localGeometry)==null?void 0:a.uuid,{originalGeometry:i,subdividedGeometry:r,subdivPointer:s}=Er.build(e,this.subdivPointer,this.smoothShading,this.hasNonUniformScale?this.shearScale:void 0);this.subdivPointer=s,i!==void 0&&((n=this.originalGeometry)==null||n.dispose(),this.originalGeometry=i),r!==void 0&&((o=this.subdividedGeometry)==null||o.dispose(),this.subdividedGeometry=r??void 0),this.localGeometry=this.subdividedGeometry??this.originalGeometry,M1(this),E1(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){Er.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0),this.subdividedGeometry&&Er.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,e&&this.hasNonUniformScale?this.shearScaleInv:void 0)}updateTopology(){this.originalGeometry.dispose(),this.originalGeometry=Er.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Er.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,Or.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;
vendor: 4,109 bytes, line 5726
5726e.boundingSphere===null&&(e.boundingSphere=new Hr,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;Qs.setFromBufferAttribute(t),Qs.getCenter(i),e.boundingSphere.radius=i.distanceTo(Qs.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Qs.getSize(lc),this.hasNonUniformScale&&lc.divide(this.scale);let r={width:lc.x,height:lc.y,depth:lc.z};return this.geometry.userData.parameters=r,r}updateBoundingSphere(e){let t=this.originalGeometry;Qs.min.set(e[0],e[2],e[4]),Qs.max.set(e[1],e[3],e[5]),this.hasNonUniformScale&&(Qs.min.applyMatrix4(this.shearScaleInv),Qs.max.applyMatrix4(this.shearScaleInv)),t.boundingSphere===null&&(t.boundingSphere=new Hr);let i=t.boundingSphere.center;Qs.getCenter(i),t.boundingSphere.radius=i.distanceTo(Qs.max)}freeSubdivPointer(){var e,t;this.subdivPointer&&(Er.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0),this.localGeometry=void 0,(e=this.originalGeometry)==null||e.dispose(),(t=this.subdividedGeometry)==null||t.dispose()}dispose(){super.dispose(),this.freeSubdivPointer()}updateByPatchedOpGeometry(e,t,i){super.updateByPatchedOpGeometry(e,t,i),this.localGeometry&&this.createGeometryByControls(t)}},C_=-1,e7=1,t7={x:[1,0,0],"-x":[-1,0,0],y:[0,1,0],"-y":[0,-1,0],z:[0,0,1],"-z":[0,0,-1]},i7={polygon_center:0,edge:1,vertex:2},ku=(e,t)=>(i,r)=>!t||i===0||e===0?0:e*r/100,ft=(e,t)=>{let i=Math.abs(t),r=i*-1;return(e-C_)*(i-r)/(e7-C_)+r},r7=new M,Uu=new M,s7=new M,a7=new M;function nh(e,t){let i=s7.fromArray(e),r=a7.fromArray(t);Uu.copy(r).sub(i);let s=Uu.length();return Uu.normalize().multiplyScalar(s*.5),r7.copy(i).add(Uu).toArray()}var ls=new or,Nu=new M,yf=new M,So=new M;function n7(e){let t=[];for(let i=0;i<=e.index.count;i++)if(Nu.fromArray(e.index.array,i*3),ls.setFromAttributeAndIndices(e.attributes.position,Nu.x,Nu.y,Nu.z),ls.getNormal(yf),ls.getMidpoint(So),!(isNaN(So.x)||isNaN(So.y)||isNaN(So.z))){let{a:r,b:s,c:a}=ls,n=r.toArray(),o=s.toArray(),l=a.toArray(),h=r.distanceTo(s),c=s.distanceTo(a),d=a.distanceTo(r),u=nh(n,o),p=nh(o,l),f=nh(l,n),g=[h,c,d],m=Math.max(...g),v=g.filter(w=>Math.round(w)===Math.round(m)).length>1,y=[],x=ls.getMidpoint(So).toArray();m===h&&!v&&(y=[p,f,f],x=u),m===c&&!v&&(y=[u,f,f],x=p),m===d&&!v&&(y=[u,p,p],x=f),v&&(y=[u,p,f]),t.push({vertices:[n,o,l],faceCenters:y,midpoint:x,norm:ls.getNormal(yf).toArray()})}return t}function o7(e){let t=[],{position:i}=e.attributes;for(let r=0;r<i.count;r++){ls.setFromAttributeAndIndices(i,r*3,r*3+1,r*3+2),ls.getNormal(yf),ls.getMidpoint(So);let s=ls.a.toArray(),a=ls.b.toArray(),n=ls.c.toArray();t.push({vertices:[s,a,n],faceCenters:[nh(s,a),nh(a,n),nh(n,s)],midpoint:So.toArray(),norm:yf.toArray()})}return t}var l7=4,h7=.5,Eg=e=>.5*(1-Math.cos(e*Math.PI)),c7=class{constructor(){this.perlin=new Array(4096)}noise(e,t=0,i=0){if(this.perlin==null){this.perlin=new Array(4096);for(let m=0;m<4096;m++)this.perlin[m]=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,d=0,u=.5,p,f,g;for(let m=0;m<l7;m++){let v=r+(s<<4)+(a<<8);h=Eg(n),c=Eg(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),g=this.perlin[v+16&4095],g+=h*(this.perlin[v+16+1&4095]-g),f+=c*(g-f),p+=Eg(l)*(f-p),d+=p*u,u*=h7,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 d}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()}},d7=c7,T_=new M,P_=new be,D_=new Eh;function I_(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}
5726var C1=class extends Ei{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(){var t;let e=this.dataPatched;return((t=this.font)==null?void 0:t.getLineInitialOffsetY(this.lineHeight,this.wrappedText.length,e.geometry.height,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(){var e;return(((e=this.font)==null?void 0:e.ascender)??1)*this.fontScale}get descender(){var e;return(((e=this.font)==null?void 0:e.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)&&(P_.copy(i).invert(),D_.copy(e.ray).applyMatrix4(P_),D_.intersectBox(this.singleBBox,T_))){let r=T_.applyMatrix4(i),s=e.ray.origin.distanceTo(r);t.push({distance:s,point:r.clone(),object:this})}}},_r=1e-4,Zs,KC,JC,$C,O_=new M,R_=new M;oC.then(e=>{Zs=e,KC=[Zs.get_face_center,Zs.get_edge_midpoint,Zs.get_vertex_position],JC=[Zs.get_face_normal,Zs.get_edge_normal,Zs.get_vertex_normal],$C=[Zs.face_count,Zs.edge_count,Zs.vertex_count]});var u7=new be,p7=new be,xn=new M,Vu=new M,hc=new M,Cg=new M,f7=new M,m7=new M,g7=class{constructor(e,t){this.data=e,this.is3D=t,this.perlin=new d7,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=BG((0,M0.default)(e.seed)):this.noise=LG((0,M0.default)(e.seed))}},cs=class extends o1(Ut){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 cr&&t.expand()}invalidateTransform(e){this.matrixWorldNeedsUpdate=!0,this.traverse(t=>{t instanceof cr&&t.object===e&&(t.matrixWorldNeedsUpdate=!0)})}onObjUpdateMatrix(){this.parameters.type!=="toObject"&&(this.matrixWorldNeedsUpdate=!0)}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters);break;case"toObject":this._updateToObject(this.parameters)}for(let e of this.children)e.updateMatrix(),e.hasNonUniformScale&&(e.updateMatrixWorld(),e.updateMatrixWorldSVD())}_updateCount(e){let t;if(e!==void 0?t=e:t=this.parameters.type==="grid"?Math.round(this.parameters.grid.count[0])*Math.round(this.parameters.grid.count[1])*Math.round(this.parameters.grid.count[2]):this.parameters.count,this.parameters.type==="toObject"){if(!this.parameters.toObject.object)t=0;else if(e===void 0&&this.parameters.toObject.spreadType!=="random")return}if(this.parameters.type==="toObject"&&this.objectForSample){let i=this.children;if(i.length===t)return;if(i.length<t)for(let r=0,s=t-i.length;r<s;++r){let a=new cr(this.object);a.expand(),this.add(a)}else for(let r=0,s=i.length-t;r<s;++r)this.remove(i[r])}else{if(this.children.length===t)return;if(this.children.length<t)for(let i=0,r=t-this.children.length;i<r;++i){let s=new cr(this.object);s.expand(),this.add(s)}else for(let i=0,r=this.children.length-t;i<r;++i)this.remove(this.children[i])}}getRandom(e,t=!1){return(this.random===null||this.random.data.seed!==e.seed||this.random.is3D!==t)&&(this.random=new g7(e,t)),this.random}_updateRadial(e){let t=e.radial,i=t.start*Oe.DEG2RAD,r=t.end*Oe.DEG2RAD,s=i-r,a=new zi(t.rotation[0],t.rotation[1],t.rotation[2]),n;switch(t.axis){case"z":n=new M(0,0,1);break;case"y":n=new M(0,1,0);break;default:case"x":n=new M(1,0,0);break}let o=e.randomnessObject??Fn.defaultData([1,1,1]).randomnessObject,l=this.getRandom(o),h=ku(o.strength,this.parameters.randomness);for(let[c,d]of this.children.entries()){let u=c*(o.freqScale/10)+o.movement,p=l.n
5726oise(u,u,u),f=c+1;d.scale.x=t.scale[0]+h(f,ft(p,o.scale[0]))||_r,d.scale.y=t.scale[1]+h(f,ft(p,o.scale[1]))||_r,d.scale.z=t.scale[2]+h(f,ft(p,o.scale[2]))||_r,d.position.setScalar(0);let g=s/e.count*c-i;switch(t.axis){case"x":d.rotation.set(0,g,0);break;case"y":d.rotation.set(0,0,g);break;case"z":d.rotation.set(g,0,0);break}d.translateOnAxis(n,t.radius),d.position.x+=t.position[0]+h(f,ft(p,o.position[0])),d.position.y+=t.position[1]+h(f,ft(p,o.position[1])),d.position.z+=t.position[2]+h(f,ft(p,o.position[2]));let m=h(f,ft(p,o.rotation[0])),v=h(f,ft(p,o.rotation[1])),y=h(f,ft(p,o.rotation[2]));t.alignment===!0?(d.rotation.x+=a.x+m,d.rotation.y+=a.y+v,d.rotation.z+=a.z+y):d.rotation.set(a.x+m,a.y+v,a.z+y)}}_updateLinear(e){if(e.type!=="linear")throw new Error;let t=e.linear,i=new zi(t.rotation[0],t.rotation[1],t.rotation[2]),r=e.randomnessObject??Fn.defaultData([1,1,1]).randomnessObject,s=this.getRandom(r),a=ku(r.strength,this.parameters.randomness);for(let[n,o]of this.children.entries()){let l=n*(r.freqScale/10)+r.movement,h=s.noise(l,l,l),c=n+1,d=a(c,ft(h,r.rotation[0])),u=a(c,ft(h,r.rotation[1])),p=a(c,ft(h,r.rotation[2]));o.scale.x=1+(t.scale[0]-1)*n+a(c,ft(h,r.scale[0]))||_r,o.scale.y=1+(t.scale[1]-1)*n+a(c,ft(h,r.scale[1]))||_r,o.scale.z=1+(t.scale[2]-1)*n+a(c,ft(h,r.scale[2]))||_r,o.rotation.x=i.x*n+d,o.rotation.y=i.y*n+u,o.rotation.z=i.z*n+p,o.position.x=t.position[0]*n+a(c,ft(h,r.position[0])),o.position.y=t.position[1]*n+a(c,ft(h,r.position[1])),o.position.z=t.position[2]*n+a(c,ft(h,r.position[2]))}}_updateGrid(e){let t=0,i=e.grid,r=e.randomnessObject??Fn.defaultData([1,1,1]).randomnessObject,s=this.getRandom(r,!0),a=ku(r.strength,this.parameters.randomness);if(i.useCenter===!0){let n={x:i.count[0]%2===0?2:1,y:i.count[1]%2===0?2:1,z:i.count[2]%2===0?2:1},o=new M(i.size[0]*(i.count[0]-n.x)*.5,i.size[1]*(i.count[1]-n.y)*.5,i.size[2]*(i.count[2]-n.z)*.5);for(let l=0;l<i.count[0];l++)for(let h=0;h<i.count[1];h++)for(let c=0;c<i.count[2];c++){let d=s.noise((l+1)*(r.freqScale/10)+r.movement,(h+1)*(r.freqScale/10)+r.movement,(c+1)*(r.freqScale/10)+r.movement),u=this.children[t++];
5726u.scale.x=1+a(t,ft(d,r.scale[0]))||_r,u.scale.y=1+a(t,ft(d,r.scale[1]))||_r,u.scale.z=1+a(t,ft(d,r.scale[2]))||_r;let p=a(t,ft(d,r.rotation[0])),f=a(t,ft(d,r.rotation[1])),g=a(t,ft(d,r.rotation[2]));u.rotation.set(p,f,g),u.position.x=i.size[0]*l-o.x+a(t,ft(d,r.position[0])),u.position.y=i.size[1]*h-o.y+a(t,ft(d,r.position[1])),u.position.z=i.size[2]*c-o.z+a(t,ft(d,r.position[2]))}}else for(let n=0;n<i.count[0];n++)for(let o=0;o<i.count[1];o++)for(let l=0;l<i.count[2];l++){let h=s.noise((n+1)*(r.freqScale/10)+r.movement,(o+1)*(r.freqScale/10)+r.movement,(l+1)*(r.freqScale/10)+r.movement),c=this.children[t++];c.scale.x=1+a(t,ft(h,r.scale[0]))||_r,c.scale.y=1+a(t,ft(h,r.scale[1]))||_r,c.scale.z=1+a(t,ft(h,r.scale[2]))||_r;let d=a(t,ft(h,r.rotation[0])),u=a(t,ft(h,r.rotation[1])),p=a(t,ft(h,r.rotation[2]));c.rotation.set(d,u,p),c.position.x=i.size[0]*n+a(t,ft(h,r.position[0])),c.position.y=-i.size[1]*o+a(t,ft(h,r.position[1])),c.position.z=-i.size[2]*l+a(t,ft(h,r.position[2]))}}_updateToObject(e){var c;if(e.type!=="toObject")throw new Error;let{toObject:t}=e,i=new zi(t.rotation[0],t.rotation[1],t.rotation[2]),r=e.randomnessObject??Fn.defaultData([1,1,1]).randomnessObject,s=this.getRandom(r),a=ku(r.strength,this.parameters.randomness);if(!t.object){for(let[,d]of this.children.entries())d.position.set(0,0,0),d.scale.setScalar(1),d.rotation.set(0,0,0);this.objectForSample=void 0;return}if(!this.objectForSample)return;if(this.objectForSample instanceof C1)if(!((c=this.objectForSample.font)!=null&&c.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 n=this.getSubdivData();if(n.length>0){let d=Math.round(n.length*t.count/100);this._updateCount(d)}else{let d=this.objectForSample.geometry.getAttribute("position");if(!d||isNaN(d.count)||d.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 o=new zG(this.objectForSample).build(),l=t7[t.axis],h=this.children;o.setRandomGenerator((0,M0.default)(this.object.uuid+t.seed));for(let[d,u]of h.entries()){let p=d*(r.freqScale/10)+r.movement,f=s.noise(p,p,p),g=d+1,m=a(g,ft(f,r.rotation[0])),v=a(g,ft(f,r.rotation[1])),y=a(g,ft(f,r.rotation[2]));t.spreadType==="random"?o.sample(hc,Cg):(n.length&&(hc.fromArray(n[d].pos),Cg.fromArray(n[d].norm)),this.objectForSample instanceof ud&&hc.applyMatrix4(u7.copy(this.objectForSample.matrixWorld).invert())),hc.applyMatrix4(this.object.hiddenMatrix.clone().invert()),u.position.copy(hc),xn.fromArray(l);let x=t.align==="normal"?Cg:this.object.getWorldDirection(m7),w=Vu.fromArray(t.position);Vu.x+=a(g,ft(f,r.position[0])),Vu.y+=a(g,ft(f,r.position[1])),Vu.z+=a(g,ft(f,r.position[2]));let S=Math.acos(x.dot(xn)),b=f7.crossVectors(xn,x).normalize(),A=p7.makeRotationAxis(b,S),_=x.clone().cross(this.object.up).normalize(),E=_.clone().cross(x).normalize(),C=new be().makeBasis(_,x,E),T=new M(xn.y,xn.z,xn.x).normalize(),P=T.clone().cross(xn).normalize(),O=new be().makeBasis(T,xn,P).invert(),D=new be().multiplyMatrices(C,O);u.rotation.setFromRotationMatrix(D),w.applyMatrix4(A),u.position.add(w),u.rotation.x=u.rotation.x+i.x+m,u.rotation.y=u.rotation.y+i.y+v,u.rotation.z=u.rotation.z+i.z+y,u.scale.setScalar(1),u.scale.x=u.scale.x+t.scale[0]+a(g,ft(f,r.scale[0]))||_r,u.scale.y=u.scale.y+t.scale[1]+a(g,ft(f,r.scale[1]))||_r,u.scale.z=u.scale.z+t.scale[2]+a(g,ft(f,r.scale[2]))||_r,u.scale.multiply(this.object.scale),u.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 ud){let s=this.objectForSample,a=i7[e],n=$C[a],o=KC[a],l=JC[a],h=n(s.subdivPointerNew);for(let c=0;c<=h-1;c++){let d=o(s.subdivPointerNew,c),u=l(s.subdivPointerNew,c);O_.fromArray(d).applyMatrix4(s.matrixWorld),R_.fromArray(u),i(O_.toArray(),R_.toArray())}}else(this.objectForSample.geometry.index?n7(this.objectForSample.geometry):o7(this.objectForSample.geometry)).forEac
vendor: 10,588 bytes, line 5726
5726h((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){var i;if(this.parameters=Uf(e),this.parameters.type!=="toObject")(this.parent===null||this.parent!==this.object)&&(this.removeFromParent(),(i=this.object.parent)==null||i.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 r=t.find(this.parameters.toObject.object);r instanceof Or?this.objectForSample=r:this.objectForSample=void 0,this.matrix=new be,this.hiddenMatrix=new be,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1,r&&r.add(this)}this.update()}get pendingMediaLoad(){return this._pendingMediaLoad}},Md=e=>{var t;return t=class extends e{},t.geometryHelper=new ks(30,30,30),t},ju=new Eh,Tg=new Hr,L_=new be,Ed=(e,t,i,r,s=!1,a=e)=>{let n=t,o=a.matrixWorld;if(n.boundingSphere===null&&n.computeBoundingSphere(),Tg.copy(n.boundingSphere),Tg.applyMatrix4(o),i.ray.intersectsSphere(Tg)===!1||(L_.copy(o).invert(),ju.copy(i.ray).applyMatrix4(L_),n.boundingBox!==null&&ju.intersectsBox(n.boundingBox)===!1))return;let l,h,c,d,u=n.index,p=n.attributes.position,f=n.drawRange,g,m;if(s===!1){let y=Math.max(0,f.start),x=Math.min(u.count,f.start+f.count);for(g=y,m=x;g<m;g+=3)if(h=u.getX(g),c=u.getX(g+1),d=u.getX(g+2),l=v(e,i,ju,p,h,c,d),l){l.faceIndex=Math.floor(g/3),r.push(l);return}}else{let y=n.attributes.position,x=new M,w=new M,S=new M,b=new M,A=2,_=1/((a.scale.x+a.scale.y+a.scale.z)/3),E=_*_,C=Math.max(0,f.start),T=Math.min(y.count,f.start+f.count);for(let P=C,O=T-1;P<O;P+=A){if(x.fromBufferAttribute(y,P),w.fromBufferAttribute(y,P+1),ju.distanceSqToSegment(x,w,b,S)>E)continue;b.applyMatrix4(a.matrixWorld);let D=i.ray.origin.distanceTo(b);D<i.near||D>i.far||r.push({distance:D,point:S.clone().applyMatrix4(a.matrixWorld),object:e})}}function v(y,x,w,S,b,A,_){let E=new M,C=new M,T=new M,P=new M,O=new M;if(E.fromBufferAttribute(S,b),C.fromBufferAttribute(S,A),T.fromBufferAttribute(S,_),w.intersectTriangle(E,C,T,!1,P)===null)return null;O.copy(P),O.applyMatrix4(y.matrixWorld);let D=x.ray.origin.distanceTo(O);return D<x.near||D>x.far?null:{faceIndex:1,distance:D,point:O.clone(),object:y}}},Gu=new M,ts=new to,v7=class extends gd{constructor(e){let t=new je,i=new io({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],a={},n=new $e(15711266),o=new $e(15711266),l=new $e(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(d,u,p){c(d,p),c(u,p)}function c(d,u){r.push(0,0,0),s.push(u.r,u.g,u.b),a[d]===void 0&&(a[d]=[]),a[d].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;ts.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;Ss("n1",t,e,ts,-i,-r,s),Ss("n2",t,e,ts,i,-r,s),Ss("n3",t,e,ts,-i,r,s),Ss("n4",t,e,ts,i,r,s);let a=s;Ss("f1",t,e,ts,-i,-r,a),Ss("f2",t,e,ts,i,-r,a),Ss("f3",t,e,ts,-i,r,a),Ss("f4",t,e,ts,i,r,a);let n=a,o=.5;Ss("u1",t,e,ts,i*.7*o,r*1.1,n),Ss("u2",t,e,ts,-i*.7*o,r*1.1,n),Ss("u3",t,e,ts,0,r*(1.1+.9*o),n),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function Ss(e,t,i,r,s,a,n){Gu.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],Gu.x,Gu.y,Gu.z)}}var y7=class extends Md(v7){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){Ed(this.object,this.geometry,e,t,!0)}},j0;(e=>e.is=t=>"objectHelper"in t)(j0||(j0={}));var Vh=(e,t)=>class extends l1(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 Bp&&(r.visible=!0)}}updateEntityBoxSize(i,r){this.objectHelper.visible&&this.geometryHelper instanceof ks?(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 Bp&&(r.visible=!1)}}},Hu=790,Cl=new M,Pg=new M,Dg=new ot,Ig=new M,cc=new M,Og=new M,yr=class extends Vh(to,y7){constructor(e="",t={...sd.defaultData,name:""}){super(),this._cameraType="OrthographicCamera",this.targetOffset=vh.DefaultTargetOffset,this.isUpVectorFlipped=!1,this.angleOffsetFromUp=0,this.wasMovedByUser=!1,this.wasMovedBySwitchCameraAction=!1,this.super_Entity(e,t),this.previousProjectionMatrix=new be,this.matrixAutoUpdate=!0,this.width=window.innerWidth,this.height=window.innerHeight;let i=this.width,r=this.height;this.orthoCamera=new Pf(i*-.5,i*.5,r*.5,r*-.5,-5e4,1e4),this.perspCamera=new mr(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(Cl),this.targetOffset=Cl.distanceTo(e)}getTarget(e=new M){return this.getWorldDirection(Pg),this.getWorldPosition(Cl),Pg.multiplyScalar(this.targetOffset),e.copy(Cl).add(Pg),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(Cl),Cl.distanceTo(e)}updateUp(){this.getWorldQuaternion(Dg),Ig.set(0,0,1).applyQuaternion(Dg),cc.copy(Ut.DEFAULT_UP),this.isUpVectorFlipped&&cc.negate(),cc.applyQuaternion(Dg),Og.copy(Ut.DEFAULT_UP).projectOnPlane(Ig),this.angleOffsetFromUp=Og.angleTo(cc),this.angleOffsetFromUp*=Og.cross(cc).dot(Ig)>=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=-Hu*.5*r,this.right=Hu*.5*r,this.top=Hu*.5*(1/s),this.bottom=-Hu*.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==="Orthogra
5726phicCamera"&&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 Lv(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),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}}},Tl=new be,x7=new be;function B_(e){let t=!1;return e.scene.objects.traverse((i,r)=>{var s;((s=r.geometry)==null?void 0:s.type)==="BooleanGeometry"&&(t=!0)}),t}var Yo=class extends Nh{constructor(e,t,i){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new je,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){var r;if(this.booleanMeshSetAddress!==-1&&!e)return;for(let s=0;s<this.children.length;s++){let a=this.children[s];a instanceof Yo&&a.dataPatched.visible===!0&&a.recomputeBoolean(e===!0,t)}this.meshSetAddresses=[];for(let s=0;s<this.children.length;s++){let a=this.children[s];if(a instanceof Or&&a.dataPatched.visible===!0&&((r=a.geometry.attributes.position)==null?void 0:r.count)>0&&a.geometry.drawRange.count>0&&a.booleanMeshSetAddress!==0){Tl.multiplyMatrices(a.hiddenMatrix,a.matrix
5726);try{if(a.booleanMeshSetAddress===-1){if((a.geometry.index??a.geometry.getAttribute("position")).count/3<15e5&&(a.booleanMeshSetAddress=Na.getMeshSet(a.geometry,e===!0,t)),a.booleanMeshSetAddress===-1)return;Na.transformMeshSet(a.booleanMeshSetAddress,Tl),a.booleanMatrixInvOld.copy(Tl).invert(),a.booleanWasTransformed=!1}else a instanceof Yo&&a.needsTransformForDownstream===!0?(Na.transformMeshSet(a.booleanMeshSetAddress,Tl),a.needsTransformForDownstream=!1):a.booleanWasTransformed===!0&&(Na.transformMeshSet(a.booleanMeshSetAddress,x7.multiplyMatrices(Tl,a.booleanMatrixInvOld)),a.booleanMatrixInvOld.copy(Tl).invert(),a.booleanWasTransformed=!1)}catch(n){console.error(n),a.booleanMeshSetAddress=0,a.geometry.userData.booleanOperationDidFail=!0;continue}Na.hasOpenEdges(a.booleanMeshSetAddress)===!1||s===this.children.length-1&&this.booleanOp===2?(this.meshSetAddresses.push(a.booleanMeshSetAddress),a.geometry.userData.booleanOperationDidFail=!1):a.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 Na.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let i=this.geometry;i.dispose(),this.geometry=new je,this.geometry.userData=i.userData,this.geometry.boundingSphere=i.boundingSphere;try{this.booleanMeshSetAddress=Na.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(s){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(s)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,M1(this),E1(this)}dispose(){super.dispose(),this.geometry.dispose()}},G0;(e=>{function t(i){return Ct.is(i)&&i instanceof xd}e.is=t})(G0||(G0={}));var T1=(e,t)=>class extends Vh(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)}},Ds=e=>e instanceof Or,$a=e=>e!==null&&e instanceof Yo,b7=e=>e instanceof yr,w7=e=>G0.is(e),H0=e=>j0.is(e),S7=new M(1,1,1),z_=new M,_7=new M,F_=new ot,Cd=class extends Md(ez){constructor(e,t=15){super(t),this.object=e,this.dummy=new Ka,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){Ed(this.object,Cd.geometryHelper,e,t,!1,this.dummy)}update(){}updateMatrix(){}updateMatrixWorld(e){this.object.matrixWorld.decompose(z_,F_,_7),this.matrix.compose(z_,F_,S7),super.updateMatrixWorld(e)}updateWorldMatrix(e,t){}},oh=class extends Vh(Ka,Cd){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()}},kc=class extends Vh(Ka,Cd){constructor(e,t,i){super(),this.super_Entity(e,t),this.context=i,this.objectHelper.update()}updateState(e,t){this.updateState_Entity(e,t)}},eT={RED:0,GREEN:1,BLUE:2,ALPHA:3},Td="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",A7=`#ifdef FRAMEBUFFER_PRECISION_HIGH
5727uniform mediump sampler2D inputBuffer;
5728#else
5729uniform lowp sampler2D inputBuffer;
5730#endif
5731uniform lowp sampler2D cocBuffer;uniform vec2 texelSize;uniform float scale;uniform vec4 kernel64[32];varying vec2 vUv;void main(){
5732#ifdef FOREGROUND
5733vec2 CoCNearFar=texture2D(cocBuffer,vUv).rg;float CoC=CoCNearFar.r*scale;
5734#else
5735float CoC=texture2D(cocBuffer,vUv).g*scale;
5736#endif
5737if(CoC==0.0){gl_FragColor=texture2D(inputBuffer,vUv);}else{
5738#ifdef FOREGROUND
5739vec2 step=texelSize*max(CoC,CoCNearFar.g*scale);
5740#else
5741vec2 step=texelSize*CoC;
5742#endif
5743vec4 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;}}`,Wu=class extends Pt{constructor(e=!1,t=!1){super({name:"BokehMaterial",defines:{PASS:e?"2":"1"},uniforms:{kernel64:new ve(null),kernel16:new ve(null),inputBuffer:new ve(null),cocBuffer:new ve(null),texelSize:new ve(new j),scale:new ve(1)},blending:Ci,depthWrite:!1,depthTest:!1,fragmentShader:A7,vertexShader:Td}
vendor: 25,559 bytes, lines 5743-5947
5743),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),d=h*Math.sin(l);o%5===0?(i[s++]=c,i[s++]=d):(t[r++]=c,t[r++]=d)}let a=[],n=[];for(let o=0;o<128;)a.push(new ht(t[o++],t[o++],t[o++],t[o++]));for(let o=0;o<32;)n.push(new ht(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 k_(e,t,i){return e*(t-i)-t}function W0(e,t,i){return Math.min(Math.max((e+t)/(t-i),0),1)}var M7=`#include <common>
5744#include <packing>
5745#ifdef GL_FRAGMENT_PRECISION_HIGH
5746uniform highp sampler2D depthBuffer;
5747#else
5748uniform mediump sampler2D depthBuffer;
5749#endif
5750uniform float focusDistance;uniform float focusRange;uniform float cameraNear;uniform float cameraFar;varying vec2 vUv;float readDepth(const in vec2 uv){
5751#if DEPTH_PACKING == 3201
5752return unpackRGBAToDepth(texture2D(depthBuffer,uv));
5753#else
5754return texture2D(depthBuffer,uv).r;
5755#endif
5756}void main(){float depth=readDepth(vUv);
5757#ifdef PERSPECTIVE_CAMERA
5758float viewZ=perspectiveDepthToViewZ(depth,cameraNear,cameraFar);float linearDepth=viewZToOrthographicDepth(viewZ,cameraNear,cameraFar);
5759#else
5760float linearDepth=depth;
5761#endif
5762float signedDistance=linearDepth-focusDistance;float magnitude=smoothstep(0.0,focusRange,abs(signedDistance));gl_FragColor.rg=magnitude*vec2(step(signedDistance,0.0),step(0.0,signedDistance));}`,E7=class extends Pt{constructor(e){super({name:"CircleOfConfusionMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new ve(null),focusDistance:new ve(0),focusRange:new ve(0),cameraNear:new ve(.3),cameraFar:new ve(1e3)},blending:Ci,depthWrite:!1,depthTest:!1,fragmentShader:M7,vertexShader:Td}),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=hn){this.depthBuffer=e,this.depthPacking=t}get focusDistance(){return this.uniforms.focusDistance.value}set focusDistance(e){this.uniforms.focusDistance.value=e}get worldFocusDistance(){return-k_(this.focusDistance,this.near,this.far)}set worldFocusDistance(e){this.focusDistance=W0(-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-k_(this.focusRange,this.near,this.far)}set worldFocusRange(e){this.focusRange=W0(-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 mr?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}},C7=`#include <common>
5763#include <dithering_pars_fragment>
5764#ifdef FRAMEBUFFER_PRECISION_HIGH
5765uniform mediump sampler2D inputBuffer;
5766#else
5767uniform lowp sampler2D inputBuffer;
5768#endif
5769varying 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;
5770#include <encodings_fragment>
5771#include <dithering_fragment>
5772}`,T7="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);}",U_=class extends Pt{constructor(e=new j){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new ve(null),texelSize:new ve(new j),halfTexelSize:new ve(new j),kernel:new ve(0),scale:new ve(1)},blending:Ci,depthWrite:!1,depthTest:!1,fragmentShader:C7,vertexShader:T7}),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)}},P7=`#ifdef FRAMEBUFFER_PRECISION_HIGH
5773uniform mediump sampler2D inputBuffer;
5774#else
5775uniform lowp sampler2D inputBuffer;
5776#endif
5777uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel;
5778#include <encodings_fragment>
5779}`,D7=class extends Pt{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new ve(null),opacity:new ve(1)},blending:Ci,depthWrite:!1,depthTest:!1,fragmentShader:P7,vertexShader:Td}),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}},I7=`varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;
5780#if THREE_REVISION < 143
5781#define luminance(v) linearToRelativeLuminance(v)
5782#endif
5783#if EDGE_DETECTION_MODE != 0
5784varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;
5785#endif
5786#if EDGE_DETECTION_MODE == 1
5787#include <common>
5788#endif
5789#if EDGE_DETECTION_MODE == 0 || PREDICATION_MODE == 1
5790#ifdef GL_FRAGMENT_PRECISION_HIGH
5791uniform highp sampler2D depthBuffer;
5792#else
5793uniform mediump sampler2D depthBuffer;
5794#endif
5795float readDepth(const in vec2 uv){
5796#if DEPTH_PACKING == 3201
5797return unpackRGBAToDepth(texture2D(depthBuffer,uv));
5798#else
5799return texture2D(depthBuffer,uv).r;
5800#endif
5801}vec3 gatherNeighbors(){float p=readDepth(vUv);float pLeft=readDepth(vUv0);float pTop=readDepth(vUv1);return vec3(p,pLeft,pTop);}
5802#elif PREDICATION_MODE == 2
5803uniform 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);}
5804#endif
5805#if PREDICATION_MODE != 0
5806vec2 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);}
5807#endif
5808#if EDGE_DETECTION_MODE != 0
5809uniform sampler2D inputBuffer;
5810#endif
5811void main(){
5812#if EDGE_DETECTION_MODE == 0
5813const vec2 threshold=vec2(DEPTH_THRESHOLD);
5814#elif PREDICATION_MODE != 0
5815vec2 threshold=calculatePredicatedThreshold();
5816#else
5817const vec2 threshold=vec2(EDGE_THRESHOLD);
5818#endif
5819#if EDGE_DETECTION_MODE == 0
5820vec3 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);
5821#elif EDGE_DETECTION_MODE == 1
5822float 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);
5823#elif EDGE_DETECTION_MODE == 2
5824vec4 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);
5825#endif
5826}`,O7=`uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;
5827#if EDGE_DETECTION_MODE != 0
5828varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;
5829#endif
5830void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,0.0);vUv1=vUv+texelSize*vec2(0.0,-1.0);
5831#if EDGE_DETECTION_MODE != 0
5832vUv2=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);
5833#endif
5834gl_Position=vec4(position.xy,1.0,1.0);}`,Qf={DEPTH:0,LUMA:1,COLOR:2},R7={DISABLED:0,DEPTH:1,CUSTOM:2},L7=class extends Pt{constructor(e=new j,t=Qf.COLOR){super({name:"EdgeDetectionMaterial",defines:{THREE_REVISION:Mh.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 ve(null),depthBuffer:new ve(null),predicationBuffer:new ve(null),texelSize:new ve(e)},blending:Ci,depthWrite:!1,depthTest:!1,fragmentShader:I7,vertexShader:O7}),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=hn){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)}},B7=`#include <common>
5835#include <packing>
5836#include <dithering_pars_fragment>
5837#define packFloatToRGBA(v) packDepthToRGBA(v)
5838#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)
5839#ifdef FRAMEBUFFER_PRECISION_HIGH
5840uniform mediump sampler2D inputBuffer;
5841#else
5842uniform lowp sampler2D inputBuffer;
5843#endif
5844#ifdef GL_FRAGMENT_PRECISION_HIGH
5845uniform highp sampler2D depthBuffer;
5846#else
5847uniform mediump sampler2D depthBuffer;
5848#endif
5849uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;
5850#if THREE_REVISION < 143
5851#define luminance(v) linearToRelativeLuminance(v)
5852#endif
5853#if THREE_REVISION >= 137
5854vec4 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);}
5855#endif
5856float readDepth(const in vec2 uv){
5857#if DEPTH_PACKING == 3201
5858return unpackRGBAToDepth(texture2D(depthBuffer,uv));
5859#else
5860return texture2D(depthBuffer,uv).r;
5861#endif
5862}float getViewZ(const in float depth){
5863#ifdef PERSPECTIVE_CAMERA
5864return perspectiveDepthToViewZ(depth,cameraNear,cameraFar);
5865#else
5866return orthographicDepthToViewZ(depth,cameraNear,cameraFar);
5867#endif
5868}FRAGMENT_HEADvoid main(){FRAGMENT_MAIN_UVvec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGEgl_FragColor=color0;
5869#ifdef ENCODE_OUTPUT
5870#include <encodings_fragment>
5871#endif
5872#include <dithering_fragment>
5873}`,z7="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);}",_s={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"},q0=class extends Pt{constructor(e,t,i,r,s=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:Mh.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new ve(null),depthBuffer:new ve(null),resolution:new ve(new j),texelSize:new ve(new j),cameraNear:new ve(.3),cameraFar:new ve(1e3),aspect:new ve(1),time:new ve(0)},blending:Ci,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=hn){this.depthBuffer=e,this.depthPacking=t}setShaderParts(e){return this.fragmentShader=B7.replace(_s.FRAGMENT_HEAD,e.get(_s.FRAGMENT_HEAD)).replace(_s.FRAGMENT_MAIN_UV,e.get(_s.FRAGMENT_MAIN_UV)).replace(_s.FRAGMENT_MAIN_IMAGE,e.get(_s.FRAGMENT_MAIN_IMAGE)),this.vertexShader=z7.replace(_s.VERTEX_HEAD,e.get(_s.VERTEX_HEAD)).replace(_s.VERTEX_MAIN_SUPPORT,e.get(_s.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 mr?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 _s}},F7=`#include <common>
5874#if THREE_REVISION < 143
5875#define luminance(v) linearToRelativeLuminance(v)
5876#endif
5877#ifdef FRAMEBUFFER_PRECISION_HIGH
5878uniform mediump sampler2D inputBuffer;
5879#else
5880uniform lowp sampler2D inputBuffer;
5881#endif
5882#ifdef RANGE
5883uniform vec2 range;
5884#elif defined(THRESHOLD)
5885uniform float threshold;uniform float smoothing;
5886#endif
5887varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);
5888#ifdef RANGE
5889float low=step(range.x,l);float high=step(l,range.y);l*=low*high;
5890#elif defined(THRESHOLD)
5891l=smoothstep(threshold,threshold+smoothing,l);
5892#endif
5893#ifdef COLOR
5894gl_FragColor=vec4(texel.rgb*l,l);
5895#else
5896gl_FragColor=vec4(l);
5897#endif
5898}`,k7=class extends Pt{constructor(e=!1,t=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:Mh.replace(/\D+/g,"")},uniforms:{inputBuffer:new ve(null),threshold:new ve(0),smoothing:new ve(1),range:new ve(null)},blending:Ci,depthWrite:!1,depthTest:!1,fragmentShader:F7,vertexShader:Td}),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}},U7=`#ifdef FRAMEBUFFER_PRECISION_HIGH
5899uniform mediump sampler2D inputBuffer;
5900#else
5901uniform lowp sampler2D inputBuffer;
5902#endif
5903#ifdef MASK_PRECISION_HIGH
5904uniform mediump sampler2D maskTexture;
5905#else
5906uniform lowp sampler2D maskTexture;
5907#endif
5908#if MASK_FUNCTION != 0
5909uniform float strength;
5910#endif
5911varying vec2 vUv;void main(){
5912#if COLOR_CHANNEL == 0
5913float mask=texture2D(maskTexture,vUv).r;
5914#elif COLOR_CHANNEL == 1
5915float mask=texture2D(maskTexture,vUv).g;
5916#elif COLOR_CHANNEL == 2
5917float mask=texture2D(maskTexture,vUv).b;
5918#else
5919float mask=texture2D(maskTexture,vUv).a;
5920#endif
5921#if MASK_FUNCTION == 0
5922#ifdef INVERTED
5923mask=step(mask,0.0);
5924#else
5925mask=1.0-step(mask,0.0);
5926#endif
5927#else
5928mask=clamp(mask*strength,0.0,1.0);
5929#ifdef INVERTED
5930mask=1.0-mask;
5931#endif
5932#endif
5933#if MASK_FUNCTION == 2
5934gl_FragColor=vec4(mask*texture2D(inputBuffer,vUv).rgb,mask);
5935#else
5936gl_FragColor=mask*texture2D(inputBuffer,vUv);
5937#endif
5938}`,tT={DISCARD:0,MULTIPLY:1,MULTIPLY_RGB_SET_ALPHA:2},N7=class extends Pt{constructor(e=null){super({name:"MaskMaterial",uniforms:{maskTexture:new ve(e),inputBuffer:new ve(null),strength:new ve(1)},blending:Ci,depthWrite:!1,depthTest:!1,fragmentShader:U7,vertexShader:Td}),this.toneMapped=!1,this.setColorChannel(eT.RED),this.setMaskFunction(tT.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!==xr&&(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}},V7=`#define sampleLevelZeroOffset(t, coord, offset) texture2D(t, coord + offset * texelSize)
5939#if __VERSION__ < 300
5940#define round(v) floor(v + 0.5)
5941#endif
5942#ifdef FRAMEBUFFER_PRECISION_HIGH
5943uniform mediump sampler2D inputBuffer;
5944#else
5945uniform lowp sampler2D inputBuffer;
5946#endif
5947uniform 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);
5947scale+=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){
5948#if !defined(DISABLE_CORNER_DETECTION)
5949vec2 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);
5950#endif
5951}void detectVerticalCornerPattern(inout vec2 weights,const in vec4 texCoord,const in vec2 d){
5952#if !defined(DISABLE_CORNER_DETECTION)
5953vec2 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);
5954#endif
5955}void main(){vec4 weights=vec4(0.0);vec4 subsampleIndices=vec4(0.0);vec2 e=texture2D(inputBuffer,vUv).rg;if(e.g>0.0){
5956#if !defined(DISABLE_DIAG_DETECTION)
5957weights.rg=calculateDiagWeights(vUv,e,subsampleIndices);if(weights.r==-weights.g){
5958#endif
5959vec2 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);
5960#if !defined(DISABLE_DIAG_DETECTION)
5961}else{e.r=0.0;}
5962#endif
5963}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;}`,j7="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);}",G7=class extends Pt{constructor(e=new j,t=new j){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 ve(null),searchTexture:new ve(null),areaTexture:new ve(null),resolution:new ve(t),texelSize:new ve(e)},blending:Ci,depthWrite:!1,depthTest:!1,fragmentShader:V7,vertexShader:j7}),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)}},H7=new to,bn=null;function W7(){if(bn===null){let e=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),t=new Float32Array([0,0,2,0,0,2]);bn=new je,bn.setAttribute!==void 0?(bn.setAttribute("position",new et(e,3)),bn.setAttribute("uv",new et(t,2))):(bn.addAttribute("position",new et(e,3)),bn.addAttribute("uv",new et(t,2)))}return bn}var Rr=class{constructor(e="Pass",t=new Gr,i=H7){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(W7(),e),t.frustumCulled=!1,this.scene===null&&(this.scene=new Gr),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}
vendor: 10,572 bytes, line 5963
5963setDepthTexture(e,t=hn){}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 Gr||t===this.renderer)continue;this[e].dispose()}}}},X0=class extends Rr{constructor(e,t=!0){super("CopyPass"),this.fullscreenMaterial=new D7,this.needsSwap=!1,this.renderTarget=e,e===void 0&&(this.renderTarget=new Tt(1,1,{minFilter:yt,magFilter:yt,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!==xr?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":e.outputEncoding===mt&&(this.renderTarget.texture.encoding=mt))}},q7=class extends Rr{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)}},Rg=new $e,P1=class extends Rr{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?(Rg.copy(e.getClearColor(Rg)),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(Rg,o):h&&e.setClearAlpha(o)}},wn=-1,jr=class extends ur{constructor(e,t=wn,i=wn,r=1){super(),this.resizable=e,this.base=new j(1,1),this.preferred=new j(t,i),this.target=this.preferred,this.s=r}get width(){let{base:e,preferred:t,scale:i}=this,r;return t.width!==wn?r=t.width:t.height!==wn?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!==wn?r=t.height:t.width!==wn?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(wn),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 wn}},Lg=!1,N_=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 vr:i=this.materialsFlatShadedDoubleSide;break;case Ki:i=this.materialsFlatShadedBackSide;break;default:i=this.materialsFlatShaded;break}else switch(t.material.side){case vr:i=this.materialsDoubleSide;break;case Ki: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=zs;t[2].skinning=!0,this.materialsBackSide=t.map(i=>{let r=i.clone();return r.uniforms=Object.assign({},e.uniforms),r.side=Ki,r}),this.materialsDoubleSide=t.map(i=>{let r=i.clone();return r.uniforms=Object.assign({},e.uniforms),r.side=vr,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=Ki,r}),this.materialsFlatShadedDoubleSide=t.map(i=>{let r=i.clone();return r.uniforms=Object.assign({},e.uniforms),r.flatShading=!0,r.side=vr,r})}}render(e,t,i){let r=e.shadowMap.enabled;if(e.shadowMap.enabled=!1,Lg){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 Lg}static set workaroundEnabled(e){Lg=e}},X7=class extends Rr{constructor(e,t,i=null){super("RenderPass",e,t),this.needsSwap=!1,this.clearPass=new P1,this.overrideMaterialManager=i===null?null:new N_(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 N_(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,d=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(d),this.overrideMaterialManager!==null?this.overrideMaterialManager.render(e,a,n):e.render(a,n),n.layers.mask=l,a.background=h,e.shadowMap.autoUpdate=c}},V_=class extends Rr{constructor(e,t,{resolutionScale:i=1,width:r=jr.AUTO_SIZE,height:s=jr.AUTO_SIZE,renderTarget:a}={}){super("DepthPass"),this.needsSwap=!1,this.renderPass=new X7(e,t,new UM({depthPacking:AM}));let n=this.renderPass;n.skipShadowMapUpdate=!0,n.ignoreBackground=!0;let o=n.getClearPass();o.overrideClearColor=new $e(16777215),o.overrideClearAlpha=1,this.renderTarget=a,this.renderTarget===void 0&&(this.renderTarget=new Tt(1,1,{minFilter:wt,magFilter:wt,stencilBuffer:!1}),this.renderTarget.texture.name="DepthPass.Target");let l=this.resolution=new jr(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},Y7="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);}",Q7="vec3 blend(const in vec3 x,const in vec3 y,const in float opacity){return y*
5963opacity+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));}",Z7="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return(x+y)*0.5*opacity+x*(1.0-opacity);}",K7="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);}",J7="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);}",$7="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return min(x,y)*opacity+x*(1.0-opacity);}",eq="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return abs(x-y)*opacity+x*(1.0-opacity);}",tq="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);}",iq="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return max(x,y)*opacity+x*(1.0-opacity);}",rq="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return x*y*opacity+x*(1.0-opacity);}",sq="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);}",aq="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);}",nq="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y*opacity+x*(1.0-opacity);}",oq="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);}",lq="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);}",hq="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);}",cq="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);}",dq="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);}",uq=new Map([[It.SKIP,null],[It.ADD,Y7],[It.ALPHA,Q7],[It.AVERAGE,Z7],[It.COLOR_BURN,K7],[It.COLOR_DODGE,J7],[It.DARKEN,$7],[It.DIFFERENCE,eq],[It.EXCLUSION,tq],[It.LIGHTEN,iq],[It.MULTIPLY,rq],[It.DIVIDE,sq],[It.NEGATION,aq],[It.NORMAL,nq],[It.OVERLAY,oq],[It.REFLECT,lq],[It.SCREEN,hq],[It.SOFT_LIGHT,cq],[It.SUBTRACT,dq]]),pq=class extends ur{constructor(e,t=1){super(),this.f=e,this.opacity=new ve(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 uq.get(this.blendFunction)}},fa={NONE:0,DEPTH:1,CONVOLUTION:2},Sa=class extends ur{constructor(e,t,{attributes:i=fa.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 pq(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,556 bytes, lines 5963-5983
5963getBlendMode(){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=hn){}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 Gr||t===this.renderer)continue;this[e].dispose()}}}};function j_(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 fq(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=[],d=[],u=!1,p=!1;if(o.get("fragment")===void 0)console.error("Missing fragment shader",t);else if(h&&n&fa.CONVOLUTION)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,g=q0.Section;if(h){let v=`	${e}MainUv(UV);
5964`;i.set(g.FRAGMENT_MAIN_UV,i.get(g.FRAGMENT_MAIN_UV)+v),u=!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);
5965`:`);
5966`,i.set(g.VERTEX_MAIN_SUPPORT,i.get(g.VERTEX_MAIN_SUPPORT)+v),c=c.concat([...o.get("vertex").matchAll(/(?:varying\s+\w+\s+(\w*))/g)].map(y=>y[1])),d=d.concat(c).concat([...o.get("vertex").matchAll(f)].map(y=>y[1]))}d=d.concat([...o.get("fragment").matchAll(f)].map(v=>v[1])),d=d.concat([...t.defines.keys()].map(v=>v.replace(/\([\w\s,]*\)/g,""))),d=d.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)),j_(e,d,s),j_(e,d,o);let m=t.blendMode;if(r.set(m.blendFunction,m),l){let v=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/,y=`${e}MainImage(color0, UV, `;n&fa.DEPTH&&v.test(o.get("fragment"))&&(y+="depth, ",p=!0),y+=`color1);
5967	`;let x=e+"BlendOpacity";a.set(x,m.opacity),y+=`color0 = blend${m.blendFunction}(color0, color1, ${x});
5968
5969	`,i.set(g.FRAGMENT_MAIN_IMAGE,i.get(g.FRAGMENT_MAIN_IMAGE)+y),y=`uniform float ${x};
5970
5971`,i.set(g.FRAGMENT_HEAD,i.get(g.FRAGMENT_HEAD)+y)}i.set(g.FRAGMENT_HEAD,i.get(g.FRAGMENT_HEAD)+o.get("fragment")+`
5972`),o.get("vertex")!==null&&i.set(g.VERTEX_HEAD,i.get(g.VERTEX_HEAD)+o.get("vertex")+`
5973`)}return{varyings:c,transformedUv:u,readDepth:p}}var xf=class extends Rr{constructor(e,...t){super("EffectPass"),this.fullscreenMaterial=new q0(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=q0.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 u of this.effects)if(u.blendMode.blendFunction===It.SKIP)l|=u.getAttributes()&fa.DEPTH;else if(l&u.getAttributes()&fa.CONVOLUTION)console.error("Convolution effects cannot be merged",u);else{l|=u.getAttributes();let p="e"+n++,f=fq(p,u,t,i,r,s,l);if(o+=f.varyings.length,h=h||f.transformedUv,c=c||f.readDepth,u.extensions!==null)for(let g of u.extensions)a.add(g)}let d=/\bblend\b/g;for(let u of i.values()){let p=u.getShaderCode().replace(d,`blend${u.blendFunction}`);t.set(e.FRAGMENT_HEAD,t.get(e.FRAGMENT_HEAD)+p+`
5974`)}l&fa.DEPTH?(c&&t.set(e.FRAGMENT_MAIN_IMAGE,`float depth = readDepth(UV);
5975
5976	`+t.get(e.FRAGMENT_MAIN_IMAGE)),this.needsDepthTexture=this.getDepthTexture()===null):this.needsDepthTexture=!1,h?(t.set(e.FRAGMENT_MAIN_UV,`vec2 transformedUv = vUv;
5977`+t.get(e.FRAGMENT_MAIN_UV)),r.set("UV","transformedUv")):r.set("UV","vUv"),t.forEach((u,p,f)=>f.set(p,u.trim().replace(/^#/,`
5978#`))),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=hn){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!==xr&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(let e of this.effects)e.dispose()}handleEvent(e){switch(e.type){case"change":this.recompile();break}}},mq=[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])],D1=class extends Rr{constructor({resolutionScale:e=.5,width:t=jr.AUTO_SIZE,height:i=jr.AUTO_SIZE,kernelSize:r=Zf.LARGE}={}){super("KawaseBlurPass"),this.renderTargetA=new Tt(1,1,{minFilter:yt,magFilter:yt,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 jr(this,t,i,e);s.addEventListener("change",a=>this.setSize(s.baseWidth,s.baseHeight)),this.blurMaterial=new U_,this.ditheredBlurMaterial=new U_,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=mq[this.kernelSize],c=this.blurMaterial,d=t,u,p;for(this.fullscreenMaterial=c,u=0,p=h.length-1;u<p;++u){let f=u&1?l:o;c.kernel=h[u],c.inputBuffer=d.texture,e.setRenderTarget(f),e.render(a,n),d=f}this.dithering&&(c=this.ditheredBlurMaterial,this.fullscreenMaterial=c),c.kernel=h[u],c.inputBuffer=d.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!==xr?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.ditheredBlurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):e.outputEncoding===mt&&(this.renderTargetA.texture.encoding=mt,this.renderTargetB.texture.encoding=mt))}static get AUTO_SIZE(){return jr.AUTO_SIZE}},gq=class extends Rr{constructor({width:e=jr.AUTO_SIZE,height:t=jr.AUTO_SIZE,renderTarget:i,luminanceRange:r,colorOutput:s}={}){super("LuminancePass"),this.fullscreenMaterial=new k7(s,r),this.needsSwap=!1,this.renderTarget=i,this.renderTarget===void 0&&(this.renderTarget=new Tt(1,1,{minFilter:yt,magFilter:yt,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target",this.renderTarget.texture.generateMipmaps=!1);let a=this.resolution=new jr(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!==xr&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},vq=class extends Rr{constructor(e,t){super("MaskPass",e,t),this.needsSwap=!1,this.clearPass=new P1(!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,d=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(d),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)}},hs=class extends Rr{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!==xr&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},Bg=1/1e3,yq=1e3,xq=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*Bg}getFixedDelta(){return this.fixedDelta*Bg}setFixedDelta(e){return this.fixedDelta=e*yq,this}getElapsed(){return this.elapsed*Bg}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)}},Zf={VERY_SMALL:0,SMALL:1,MEDIUM:2,LARGE:3,VERY_LARGE:4,HUGE:5},bq=`#ifdef FRAMEBUFFER_PRECISION_HIGH
5979uniform mediump sampler2D map;
5980#else
5981uniform lowp sampler2D map;
5982#endif
5983uniform 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);}`,wq=class extends Sa{constructor({blendFunction:e=It.SCREEN,luminanceThreshold:t=.9,luminanceSmoothing:i=.025,resolutionScale:r=.5,intensity:s=1,width:a=jr.AUTO_SIZE,height:n=jr.AUTO_SIZE,kernelSize:o=Zf.LARGE}={}){super("BloomEffect",bq,{blendFunction:e,uniforms:new Map([["map",new ve(null)],["intensity",new ve(s)]])}),this.renderTarget=new Tt(1,1,{minFilter:yt,magFilter:yt,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 gq({renderTarget:this.renderTarget,colorOutput:!0}),this.luminanceMaterial.threshold=t,this.luminanceMaterial.smoothingFactor=i,this.blurPass=new D1({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===mt&&(this.renderTarget.texture.encoding=mt))}},Sq="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);}",_q=class extends Sa{constructor({blendFunction:e=It.NORMAL,brightness:t=0,contrast:i=0}={}){super("BrightnessContrastEffect",Sq,{blendFunction:e,uniforms:new Map([["brightness",new ve(t)],["contrast",new ve(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}},Aq="void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=vec4(ve
5983c3(average(inputColor.rgb)),inputColor.a);}",Mq=class extends Sa{constructor(e=It.NORMAL){super("ColorAverageEffect",Aq,{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));}",Cq="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;}",Tq=class extends Sa{constructor({blendFunction:e=It.NORMAL,offset:t=new j(.001,5e-4)}={}){super("ChromaticAberrationEffect",Eq,{vertexShader:Cq,blendFunction:e,attributes:fa.CONVOLUTION,uniforms:new Map([["offset",new ve(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}},Pq=`#ifdef FRAMEBUFFER_PRECISION_HIGH
5984uniform mediump sampler2D nearColorBuffer;uniform mediump sampler2D farColorBuffer;
5985#else
5986uniform lowp sampler2D nearColorBuffer;uniform lowp sampler2D farColorBuffer;
5987#endif
5988uniform 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;}`,Dq=class extends Sa{constructor(e,{blendFunction:t=It.NORMAL,worldFocusDistance:i,worldFocusRange:r,focusDistance:s=0,focalLength:a=.1,focusRange:n=a,bokehScale:o=1,width:l=jr.AUTO_SIZE,height:h=jr.AUTO_SIZE}={}){super("DepthOfFieldEffect",Pq,{blendFunction:t,attributes:fa.DEPTH,uniforms:new Map([["nearColorBuffer",new ve(null)],["farColorBuffer",new ve(null)],["nearCoCBuffer",new ve(null)],["scale",new ve(1)]])}),this.camera=e,this.renderTarget=new Tt(1,1,{minFilter:yt,magFilter:yt,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 hs(new E7(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 D1({kernelSize:Zf.MEDIUM,width:l,height:h});let d=this.blurPass.getResolution();d.addEventListener("change",p=>this.setSize(d.getBaseWidth(),d.getBaseHeight())),this.maskPass=new hs(new N7(this.renderTargetCoC.texture));let u=this.maskPass.fullscreenMaterial;u.maskFunction=tT.MULTIPLY,u.colorChannel=eT.GREEN,this.bokehNearBasePass=new hs(new Wu(!1,!0)),this.bokehNearBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehNearFillPass=new hs(new Wu(!0,!0)),this.bokehNearFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehFarBasePass=new hs(new Wu(!1,!1)),this.bokehFarBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.bokehFarFillPass=new hs(new Wu(!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 W0(-i,t.near,t.far)}
vendor: 4,518 bytes, lines 5988-5994
5988setDepthTexture(e,t=hn){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,xr),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===mt&&(this.renderTarget.texture.encoding=mt,this.renderTargetNear.texture.encoding=mt,this.renderTargetFar.texture.encoding=mt,this.renderTargetMasked.texture.encoding=mt))}};new M;new be;var Iq="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);}",Oq=class extends Sa{constructor({blendFunction:e=It.NORMAL,hue:t=0,saturation:i=0}={}){super("HueSaturationEffect",Iq,{blendFunction:e,uniforms:new Map([["hue",new ve(new M)],["saturation",new ve(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 $e;var Rq=`void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 noise=vec3(rand(uv*time));
5989#ifdef PREMULTIPLY
5990outputColor=vec4(min(inputColor.rgb*noise,vec3(1.0)),inputColor.a);
5991#else
5992outputColor=vec4(noise,inputColor.a);
5993#endif
5994}`,Lq=class extends Sa{constructor({blendFunction:e=It.SCREEN,premultiply:t=!1}={}){super("NoiseEffect",Rq,{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}},Bq="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));}}",zq=class extends Sa{constructor(e=30){super("PixelationEffect",Bq,{uniforms:new Map([["active",new ve(!1)],["d",new ve(new j)]])}),this.resolution=new j,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 G_="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAYAAACm53kpAAAAeElEQVRYR+2XSwqAMAxEJ168ePEqwRSKhIIiuHjJqiU0gWE+1CQdApcVAMUAuARaMGCX1MIL/Ow13++9lW2s3mW9MWvsnWc/2fvGygwPAN4E8QzAA4CXAB6AHjG4JTHYI1ey3pcx6FHnEfhLDOIBKAmUBK6/ANUDTlROXAHd9EC1AAAAAElFTkSuQmCC",H_
vendor: 6,469 bytes, line 5994
5994="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 5994
5994R101AlZSUtGyfgZDkCWY1HnJdcBVe6325hTvelg2CQjZNDygG/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,094 bytes, lines 5994-6027
5994,Fq="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;}",kq="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);}",_o={LOW:0,MEDIUM:1,HIGH:2,ULTRA:3},iT=class extends Sa{constructor({preset:e=_o.MEDIUM,edgeDetectionMode:t=Qf.COLOR,predicationMode:i=R7.DISABLED}={}){super("SMAAEffect",Fq,{vertexShader:kq,blendFunction:It.NORMAL,attributes:fa.CONVOLUTION|fa.DEPTH,uniforms:new Map([["weightMap",new ve(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 Tt(1,1,{minFilter:yt,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 P1(!0,!1,!1),this.clearPass.overrideClearColor=new $e(0),this.clearPass.overrideClearAlpha=1,this.edgeDetectionPass=new hs(new L7),this.edgeDetectionMaterial.edgeDetectionMode=t,this.edgeDetectionMaterial.predicationMode=i,this.weightsPass=new hs(new G7);let a=new s2;a.onLoad=()=>{let n=new oi(r);n.name="SMAA.Search",n.magFilter=wt,n.minFilter=wt,n.generateMipmaps=!1,n.needsUpdate=!0,n.flipY=!0,this.weightsMaterial.searchTexture=n;let o=new oi(s);o.name="SMAA.Area",o.magFilter=yt,o.minFilter=yt,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=G_,s.src=H_),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 _o.LOW:t.edgeDetectionThreshold=.15,i.orthogonalSearchSteps=4,i.diagonalDetection=!1,i.cornerDetection=!1;break;case _o.MEDIUM:t.edgeDetectionThreshold=.1,i.orthogonalSearchSteps=8,i.diagonalDetection=!1,i.cornerDetection=!1;break;case _o.HIGH:t.edgeDetectionThreshold=.1,i.orthogonalSearchSteps=16,i.diagonalSearchSteps=8,i.cornerRounding=25,i.diagonalDetection=!0,i.cornerDetection=!0;break;case _o.ULTRA:t.edgeDetectionThreshold=.05,i.orthogonalSearchSteps=32,i.diagonalSearchSteps=16,i.cornerRounding=25,i.diagonalDetection=!0,i.cornerDetection=!0;break}}setDepthTexture(e,t=hn){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 G_}static get areaImageDataURL(){return H_}},Uq=`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;
5995#if VIGNETTE_TECHNIQUE == 0
5996float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offset));
5997#else
5998vec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord));
5999#endif
6000outputColor=vec4(color,inputColor.a);}`,qu={DEFAULT:0,ESKIL:1},Nq=class extends Sa{constructor({blendFunction:e=It.NORMAL,technique:t=qu.DEFAULT,eskil:i=!1,offset:r=.5,darkness:s=.5}={}){super("VignetteEffect",Uq,{blendFunction:e,defines:new Map([["VIGNETTE_TECHNIQUE",t.toFixed(0)]]),uniforms:new Map([["offset",new ve(r)],["darkness",new ve(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===qu.ESKIL}set eskil(e){this.technique=e?qu.ESKIL:qu.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}},cn=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}},Vq=class extends cn{constructor(){super(wq),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}},jq=class extends cn{constructor(){super(_q)}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}},Gq=class extends cn{constructor(){super(Tq),this.effect.offset=new j(.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]}},Hq=class extends cn{constructor(){super(Mq)}},Wq=class extends cn{constructor(){super(Oq),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}},qq=class extends cn{constructor(){super(Lq),this.blendFunction=It.OVERLAY}},Xq=class extends cn{constructor(){super(Nq)}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}},Yq=class extends cn{constructor(e){super(Dq)}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()}},Qq=class extends cn{constructor(){super(zq)}get granularity(){return this.effect.getGranularity()}set granularity(e){this.effect.setGranularity(e)}},Zq=`#define GLSLIFY 1
6001varying 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);}`,Kq=`#define GLSLIFY 1
6002#include <common>
6003varying vec2 vUv;varying vec2 vTexCoords[9];uniform sampler2D inputBuffer;uniform sampler2D historyBuffer;uniform sampler2D velocityBuffer;uniform sampler2D depthBuffer;uniform vec2 resolution;
6004#define USE_YCOCG
6005#define USE_CATMULL_ROM
6006const 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){
6007#ifdef USE_YCOCG
6008vec4 c=texture(tex,uv);return vec4(RGB_YCoCg(c.rgb),c.a);
6009#else
6010return texture(tex,uv);
6011#endif
6012}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(){
6013#ifdef CHOOSE_LONGEST_MOTION_VECTOR
6014float 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;
6015#else
6016float 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;
6017#endif
6018}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);
6019#ifdef USE_CATMULL_ROM
6020vec4 previousColor=sample_catmull_rom(historyBuffer,previousPixelPos,resolution);
6021#else
6022vec4 previousColor=sample_color(historyBuffer,previousPixelPos);
6023#endif
6024#ifdef USE_YCOCG
6025previousColor=vec4(RGB_YCoCg(previousColor.rgb),previousColor.a);
6026#endif
6027vec4 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))))))));
6027vec4 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);
6028#ifdef USE_YCOCG
6029vec2 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;
6030#endif
6031vec4 previousColorClipped=clamp(previousColor,cmin,cmax);
6032#ifdef LUMINANCE_DIFFERENCES
6033#ifdef USE_YCOCG
6034float lum0=currentColor.r;float lum1=previousColorClipped.r;
6035#else
6036float lum0=luminance(currentColor.rgb);float lum1=luminance(previousColorClipped.rgb);
6037#endif
6038float 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));
6039#else
6040const float alpha=0.1;vec4 result=mix(currentColor,previousColorClipped,1.0-alpha);
6041#endif
6042#ifdef USE_YCOCG
6043gl_FragColor=vec4(YCoCg_RGB(result.rgb).rgb,result.a);
6044#else
6045gl_FragColor=result;
6046#endif
6047}`,Jq=`#define GLSLIFY 1
6048varying vec2 vUv;void main(){gl_Position=vec4(position.xy,1.0,1.0);vUv=position.xy*0.5+0.5;}`,$q=`#define GLSLIFY 1
6049layout(location=1)out vec4 gVelocity;varying vec2 vUv;uniform sampler2D inputBuffer;void main(){gl_FragColor=texture2D(inputBuffer,vUv);gVelocity=vec4(0.0);}`,Y0=class extends Pt{constructor(){super({name:"PassthroughMaterial",uniforms:{inputBuffer:new ve(null)},blending:Ci,depthWrite:!1,depthTest:!1,vertexShader:Jq,fragmentShader:$q})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}},eX=class extends Rr{constructor(){super("TAAResolvePass"),this.MRTCompatible=!0,this.needsSwap=!1,this.passThroughMaterial=new Y0,this.resolutionVector=new j,this.resolveMaterial=new Pt({name:"TAAResolveMaterial",uniforms:{inputBuffer:new ve(null),historyBuffer:new ve(null),velocityBuffer:new ve(null),depthBuffer:new ve(null),resolution:new ve(new j)},blending:Ci,depthWrite:!1,depthTest:!1,vertexShader:Zq,fragmentShader:Kq}),this.historyRenderTarget=new Tt(1024,1024,{minFilter:yt,stencilBuffer:!1,depthBuffer:!1}),this.historyRenderTarget.texture.name="TAA.History",this.resultRenderTarget=new Tt(1024,1024,{minFilter:yt,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(){this.resultRenderTarget.dispose(),this.historyRenderTarget.dispose(),this.resolveMaterial.dispose(),this.passThroughMaterial.dispose()}},tX=class extends Rr{constructor(e,t,i){super("TransmissionPass",void 0,t),this.MRTCompatible=!0,this.depthPass=new V_(e,t,{renderTarget:i.transmissionDepthTarget}),this.passThroughMaterial=new Y0,this.splineScene=e,this.needsSwap=!1}updatePasses(e){this.passThroughMaterial=new Y0,this.depthPass=new V_(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}},W_=new Gr,iX=new Pt({transparent:!0,vertexShader:`
6050        void main() {
6051            gl_Position = vec4(0.0);
6052        }
6053    `,fragmentShader:`
6054        layout(location = 1) out vec4 gVelocity;
6055
6056        void main() {
6057            gl_FragColor = vec4(0.0);
6058			gVelocity = vec4(0.0);
6059        }
6060    `}),Q0=class extends Rr{constructor(e,t,i){super("OpaquePass",t??W_,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??W_}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 Or&&(this.originalMaterials.push([r,r.material]),r.material=iX)}),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: 12,902 bytes, lines 6060-6108
6060h(r=>{r[0].material=r[1]})}},rX=class{constructor(e,{depthBuffer:t=!0,stencilBuffer:i=!1,multisampling:r=0,frameBufferType:s=0}={}){this.renderer=e,this.helperStartIndex=0,this.copyPass=new X0,this.depthTexture=null,this.timer=new xq,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){var t;if(this.renderer=e,e!==null){let i=e.getSize(new j),r=((t=e.getContext().getContextAttributes())==null?void 0:t.alpha)??!1,s=this.inputBuffer.texture[0].type;s===xr&&e.outputEncoding===mt&&(this.inputBuffer.texture[0].encoding=mt,this.outputBuffer.texture[0].encoding=mt,this.inputBuffer.dispose(),this.outputBuffer.dispose(),console.log("doing some kinda dispose??")),e.autoClear=!1,this.setSize(i.width,i.height,!1);for(let a of this.passes)a.initialize(e,r,s)}}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 uh(this._width,this._height);return this.inputBuffer.depthTexture=e,this.inputBuffer.stencilBuffer?(e.format=Go,e.type=Bo):e.type=Qa,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 j:n.getDrawingBufferSize(new j),l={minFilter:yt,magFilter:yt,wrapS:ii,wrapT:ii,stencilBuffer:t,depthBuffer:e},h;return r>0?(h=new Tt(o.width,o.height,l),h.samples=r):(s?(h=new IM(o.width,o.height,2,l),h.texture[1].type=rn):h=new Tt(o.width,o.height,l),h.depthTexture=new uh(2048,2048),h.depthTexture.type=Vt),i===xr&&n!==null&&n.outputEncoding===mt&&(Array.isArray(h.texture)?h.texture.forEach(c=>c.encoding=mt):h.texture.encoding=mt),Array.isArray(h.texture)?h.texture.forEach((c,d)=>{c.name=`EffectComposer.Buffer ${s} ${d}`,c.generateMipmaps=!1}):(h.texture.name=`EffectComposer.Buffer ${s}`,h.texture.generateMipmaps=!1),h.name=a,h}addPass(e,t){var o;let i=this.passes,r=this.renderer,s=r.getDrawingBufferSize(new j),a=((o=r.getContext().getContextAttributes())==null?void 0:o.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 l=this.createDepthTexture();for(e of i)e.setDepthTexture(l)}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,d;e===void 0&&(e=this.timer.update().getDelta());for(let u of this.passes)u.enabled&&(u.MRTCompatible?u.render(t,r,s,e,o):u.render(t,a,n,e,o),u.needsSwap&&(o&&(i.renderToScreen=u.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,d=a,r=s,a=n,s=c,n=d),u instanceof vq?o=!0:u instanceof q7&&(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 j);e=a.width,t=a.height}r.setSize(e,t,i);let s=r.getDrawingBufferSize(new j);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()}},sX=new Pt({name:"CombineMaterial",uniforms:{inputBufferA:new ve(null),inputBufferB:new ve(null)},blending:Ci,depthWrite:!1,depthTest:!1,vertexShader:`
6061varying vec2 vUv;
6062void main() {
6063    gl_Position = vec4(position.xy, 1.0, 1.0);
6064    vUv = position.xy * 0.5 + 0.5;
6065}
6066`,fragmentShader:`
6067    varying vec2 vUv;
6068    uniform sampler2D inputBufferA;
6069    uniform sampler2D inputBufferB;
6070
6071    // TODO: Why do we need these when postpro of framemode is enabled???
6072    layout(location = 1) out vec4 gVelocity;
6073
6074    void main() {
6075	vec4 resA = texture2D(inputBufferA, vUv);
6076	vec4 resB = texture2D(inputBufferB, vUv);
6077    float a = resA.a + resB.a * ( 1.0 - resA.a );
6078
6079	vec4 res;
6080	res.rgb =  resA.rgb + (resB.rgb * (1.0 - resA.a));
6081	res.a = resA.a + resB.a * (1.0 - resA.a);
6082	gl_FragColor = res;
6083    gVelocity = vec4(0.0);
6084    }
6085`}),aX=class extends Rr{constructor(e){super("HelperPass",void 0,e),this.MRTCompatible=!1,this.fullscreenMaterial=sX,this.helperPass=new Q0(!1,void 0,this.camera),this.helperPass.hasTransmissionPass=!1,this.helperPass.clear=!1,this.helperPass.renderToScreen=!1,this.helperPassOnTop=new Q0(!1,void 0,this.camera),this.helperPassOnTop.hasTransmissionPass=!1,this.helperPassOnTop.clear=!1,this.helperPassOnTop.renderToScreen=!1;let t=new iT({preset:_o.LOW,edgeDetectionMode:Qf.COLOR});this.effectPass=new xf(this.camera,t),this.rt=new Tt(10,10,{minFilter:yt,magFilter:yt,wrapS:ii,wrapT:ii,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()}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)}},nX=`#define GLSLIFY 1
6086#include <skinning_pars_vertex>
6087#include <morphtarget_pars_vertex>
6088out vec3 n;void main(){
6089#include <beginnormal_vertex>
6090#include <morphnormal_vertex>
6091#include <skinbase_vertex>
6092#include <skinnormal_vertex>
6093#include <defaultnormal_vertex>
6094#include <begin_vertex>
6095#include <morphtarget_vertex>
6096#include <skinning_vertex>
6097vec4 view_space=viewMatrix*modelMatrix*vec4(transformed,1.0);gl_Position=projectionMatrix*view_space;n=normalize(transformedNormal);}`,oX=`#define GLSLIFY 1
6098in vec3 n;void main(){gl_FragColor=vec4(n,1.0);}`,lX=`#define GLSLIFY 1
6099out vec2 v_uv;void main(){v_uv=uv;gl_Position=vec4(position.xy,1.0,1.0);}`,hX=`#define GLSLIFY 1
6100in 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);}
6101#define USE_GBUFFER_NORMALS
6102void main(){vec3 view_space_p=get_view_position(v_uv);
6103#ifdef USE_GBUFFER_NORMALS
6104vec3 view_space_n=texture(texture_normals,v_uv).rgb;view_space_n.z*=-1.0;
6105#else
6106vec3 view_space_n=-rebuild_normal(v_uv,view_space_p);
6107#endif
6108float 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>
6108=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);}`,cX=`#define GLSLIFY 1
6109out vec2 v_uv;void main(){gl_Position=vec4(position.xy,1.0,1.0);v_uv=uv;}`,dX=`#define GLSLIFY 1
6110in 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(){
6111#ifdef DEBUG
6112float 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);
6113#else
6114vec2 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;
6115#endif
6116}`,dc=[[.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]],uX=new Pt({vertexShader:nX,fragmentShader:oX}),Pl=new Pt({vertexShader:cX,fragmentShader:dX,uniforms:{texture_ao_lrez:new ve(null),texture_depth_lrez:new ve(null),texture_depth_hrez:new ve(null),near:new ve(null),far:new ve(null)}}),pX=class extends Rr{constructor(e,t){super("AmbientOcclusionPass",void 0,t),this.fogEnabled=!1,this.fogNear=1,this.fogFar=1e3,this.frameIndex=0,this._runHalfRes=!0,this._width=1,this._height=1;let i=1024,r=1024;this.gBuffer=new Tt(i,r,{type:Sd?rn:Vt,depthTexture:new uh(i,r),minFilter:yt,magFilter:yt}),this.depthBufferHighRes=new Tt(i,r,{depthTexture:new uh(i,r)}),this.aoBuffer=new Tt(i,r,{minFilter:yt,magFilter:yt}),this.splineScene=e,this.splineCamera=t;let s=new Float32Array(dc.length*2);for(let n=0;n<dc.length;n++){let o=n*2;s[o+0]=dc[n][0],s[o+1]=dc[n][1]}this.blueNoiseInDiskTexture=new Pr(s,dc.length,1,Sp,Vt),this.blueNoiseInDiskTexture.wrapS=Ya,this.blueNoiseInDiskTexture.wrapT=Ya,this.blueNoiseInDiskTexture.needsUpdate=!0,this.hbaoMaterial=new Pt({vertexShader:lX,fragmentShader:hX,uniforms:{near:new ve(null),far:new ve(null),fov:new ve(null),proj_info:new ve(new ht),is_ortho:new ve(!1),resolution:new ve(new j),radius_of_influence:new ve(8),radius_in_screen_space:new ve(1),exponent:new ve(1),ao_color:new ve(new M),bias:new ve(.5),texture_depth:new ve(null),texture_normals:new ve(null),texture_blue_noise:new ve(null),texture_blue_noise_in_disk:new ve(this.blueNoiseInDiskTexture),frame_index:new ve(0),fog_enabled:new ve(!1),fog_near:new ve(1),fog_far:new ve(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 Tt(i,r,{minFilter:yt,magFilter:yt,wrapS:ii,wrapT:ii,depthBuffer:!1,type:Vt});let a=new iT({preset:_o.ULTRA,edgeDetectionMode:Qf.COLOR});this.effectPass=new xf(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,Pl.uniforms.texture_depth_hrez.value=e,Pl.needsUpdate=!0}render(e,t,i){this.splineScene.overrideMaterial=uX;let r=this.splineCamera.layers.mask;if(this.splineCamera.layers.set(5),e.setRenderTarget(this.gBuffer),e.clear(),e.render(this.splineScene,this.splineCamera),e.setRenderTarget(this.depthBufferHighRes),e.clear(),e.render(this.splineScene,this.splineCamera),this.splineScene.overrideMaterial=null,this.splineCamera.layers.mask=r,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: 4,115 bytes, lines 6116-6169
6116as.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 s=this.splineCamera.perspCamera.projectionMatrix.elements,a=2/s[0],n=2/s[5],o=-(1-s[8])/s[0],l=-(1+s[9])/s[5];this.hbaoMaterial.uniforms.proj_info.value.set(a,n,o,l);let h=this.splineCamera.perspCamera.fov*(Math.PI/180),c=this.hbaoMaterial.uniforms.resolution.value.y/(Math.tan(h*.5)*2),d=this.hbaoMaterial.uniforms.radius_of_influence.value*.5*c;this.hbaoMaterial.uniforms.radius_in_screen_space.value=d,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 s=this.splineCamera.orthoCamera.projectionMatrix.elements,a=2/s[0],n=2/s[5],o=-(1+s[12])/s[0],l=-(1-s[13])/s[5];this.hbaoMaterial.uniforms.proj_info.value.set(a,n,o,l);let h=.5*(this.hbaoMaterial.uniforms.resolution.value.y/n),c=this.hbaoMaterial.uniforms.radius_of_influence.value*h;this.hbaoMaterial.uniforms.radius_in_screen_space.value=c,this.hbaoMaterial.uniforms.is_ortho.value=!0}this.runHalfRes?(this.fullscreenMaterial=this.hbaoMaterial,e.setRenderTarget(this.aoBuffer),e.clear(),e.render(this.scene,this.camera),this.fullscreenMaterial=Pl,Pl.uniforms.texture_ao_lrez.value=this.aoBuffer.texture,Pl.uniforms.texture_depth_lrez.value=this.gBuffer.depthTexture,Pl.uniforms.texture_depth_hrez.value=this.depthBufferHighRes.depthTexture,e.setRenderTarget(e.aoRenderTarget),e.clear(),e.render(this.scene,this.camera)):(this.fullscreenMaterial=this.hbaoMaterial,e.setRenderTarget(this.aaBuffer),e.clear(),e.render(this.scene,this.camera),this.effectPass.renderToScreen=!1,this.effectPass.render(e,this.aaBuffer,e.aoRenderTarget))}dispose(){this.gBuffer.dispose(),this.depthBufferHighRes.dispose(),this.aoBuffer.dispose()}},fX=`
6117varying vec2 vUv;
6118void main() {
6119    vUv = uv;
6120    gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
6121}`,mX=`
6122uniform sampler2D tInput;
6123uniform sampler2D tMap;
6124uniform vec2 resolution;
6125varying vec2 vUv;
6126
6127uniform vec2 uResolution;
6128uniform vec2 uCoords;
6129
6130// Draws a rectangle at center <st> with size <size>
6131float rectangle(vec2 st, vec2 size) {
6132    size = vec2(0.5) - size * 0.5;
6133    vec2 uv = vec2(step(size.x, st.x), step(size.y, st.y));
6134    uv *= vec2(step(size.x, 1.0 - st.x), step(size.y, 1.0 - st.y));
6135
6136    return uv.x * uv.y;
6137}
6138
6139uniform vec2 uSize;
6140uniform float uScale;
6141uniform float uDPR;
6142uniform float uCurrent;
6143uniform vec3 uSceneColor;
6144
6145void main() {
6146    vec2 screenUv = gl_FragCoord.xy / uResolution.xy;
6147    screenUv *= 1.0 / uDPR;
6148
6149    vec2 center = vec2(0.5, -0.5);
6150    vec2 outsideUv = screenUv;
6151    outsideUv += center;
6152    outsideUv -= uCoords.xy / uResolution.xy;
6153    outsideUv = (outsideUv - 0.5) + 0.5;
6154    outsideUv -= center;
6155    vec2 s = (uSize / uResolution) * uScale;
6156    float isOutside = 1.0 - rectangle(outsideUv, s);
6157    
6158    vec2 mid = vec2(0.5);
6159    vec2 insideUv = (screenUv - mid + s * mid) / s;
6160    vec4 background = texture2D(tInput, screenUv);
6161    vec4 image = texture2D(tMap, insideUv);
6162    gl_FragColor = mix(image, background, isOutside);
6163}
6164`,gX=class extends hs{constructor(){super(new Pt({vertexShader:fX,fragmentShader:mX,uniforms:{tInput:new ve(null),tMap:new ve(null),uResolution:new ve(new j),uSize:new ve(new j),uCoords:new ve(new j),uScale:new ve(1),uSceneColor:new ve(new $e(16711680)),uDPR:new ve(1),uCurrent:new ve(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}},vX=`
6165void main() {
6166    gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
6167}`,yX=`
6168uniform sampler2D toScene;
6169uniform sampler2D fromScene;
6170uniform vec2 resolution;
6171
6172uniform vec2 uResolution;
6173uniform float uDPR;
6174
6175uniform float mixRatio;
6176uniform sampler2D tMixTexture;
6177uniform int useTexture;
6178uniform float threshold;
6179
6180void main() {
6181	vec2 screenUv = gl_FragCoord.xy / uResolution.xy;
6182	screenUv *= 1.0 / uDPR;
6183
6184	vec4 texel1 = texture2D( fromScene, screenUv );
6185	vec4 texel2 = texture2D( toScene, screenUv );
6186
6187	if (useTexture==1) {
6188		
6189		vec4 transitionTexel = texture2D( tMixTexture, screenUv );
6190		float r = mixRatio * (1.0 + threshold * 2.0) - threshold;
6191		float mixf=clamp((transitionTexel.r - r)*(1.0/threshold), 0.0, 1.0);
6192		
6193		gl_FragColor = mix( texel1, texel2, mixf );
6194	} else {
6195		
6196		gl_FragColor = mix( texel1, texel2, mixRatio );
6197		
6198	}
6199}
6200`,xX=[],bX=class extends hs{constructor(){super(new Pt({vertexShader:vX,fragmentShader:yX,uniforms:{toScene:new ve(null),fromScene:new ve(null),uResolution:new ve(new j),uDPR:new ve(1),mixRatio:new ve(0),threshold:new ve(.1),useTexture:new ve(0),tMixTexture:{value:xX[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}},wX=`
6201void main() {
6202    gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
6203}`,SX=`
6204uniform sampler2D inputBuffer;
6205uniform sampler2D blurredInputBuffer;
6206uniform sampler2D overlay;
6207uniform float blurIntensity;
6208
6209uniform vec2 uResolution;
6210uniform float uDPR;
6211
6212void main() {
6213	vec2 screenUv = gl_FragCoord.xy / uResolution.xy;
6214	screenUv *= 1.0 / uDPR;
6215
6216	vec4 texel1 = texture2D( overlay, screenUv );
6217	vec4 texel2 = texture2D( inputBuffer, screenUv );
6218	vec4 texel3 = texture2D( blurredInputBuffer, screenUv );
6219
6220	float blurMask2 = max(sign(texel1.a), 0.0) * blurIntensity;
6221    gl_FragColor = mix( mix(texel2, texel3, blurMask2), texel1, texel1.a );
6222}
6223`,_X=class extends hs{constructor(){super(new Pt({vertexShader:wX,fragmentShader:SX,uniforms:{inputBuffer:new ve(null),blurredInputBuffer:new ve(null),overlay:new ve(null),uResolution:new ve(new j),uDPR:new ve(1),blurIntensity:new ve(0)}})),this._blurEnabled=!1,this.blurTarget=new Tt(1,1,{minFilter:yt,magFilter:yt,wrapS:ii,wrapT:ii}),this.blurPass=new D1({width:window.innerWidth,height:window.innerHeight,kernelSize:Zf.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)}},AX=`
6224varying vec2 vUv;
6225void main() {
6226    vUv = uv;
6227    gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
6228}`,MX=`
6229uniform sampler2D tInput;
6230uniform sampler2D tOverlayImage;
6231varying vec2 vUv;
6232uniform vec2 uResolution;
6233uniform vec2 uRightBottom;
6234uniform vec2 uImageSize;
6235uniform float uScale;
6236uniform float uDPR;
6237
6238vec3 blendNormal(vec3 base, vec3 blend) {
6239	return blend;
6240}
6241
6242vec3 blendNormal(vec3 base, vec3 blend, float opacity) {
6243	return (blendNormal(base, blend) * opacity + base * (1.0 - opacity));
6244}
6245
6246vec4 drawFixedSizeImage(sampler2D image, vec2 screenUV, vec2 imageSize, vec2 imageCoords, vec2 screenSize, float dpr) {
6247	vec2 uv = (screenUV * screenSize * dpr - imageCoords) / (imageSize * dpr);
6248	if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {
6249		return vec4(0.0);
6250	}
6251	return texture2D(image, uv);
6252}
6253
6254void main() {
6255    vec2 screenUV = gl_FragCoord.xy / (uResolution.xy * uDPR);
6256	vec2 imageCoords = vec2(uResolution.x * uDPR - uImageSize.x * uScale * uDPR - uRightBottom.x * uDPR, uRightBottom.y * uDPR);
6257    vec4 background = texture2D(tInput, screenUV);
6258    vec4 image = drawFixedSizeImage(tOverlayImage, screenUV, uImageSize * uScale, imageCoords, uResolution, uDPR);
6259    gl_FragColor = vec4(blendNormal(background.rgb, image.rgb, image.a), max(background.a, image.a));
6260}
6261`,EX=class extends hs{constructor(){super(new Pt({vertexShader:AX,fragmentShader:MX,uniforms:{tInput:new ve(null),tOverlayImage:new ve(null),uResolution:new ve(new j),uImageSize:new ve(new j),uRightBottom:new ve(new j(20,20)),uScale:new ve(.25),uDPR:new ve(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 q_(e,t){return t&&t.enabled&&e.push(t.effect),e}var CX=e=>Object.values(It).includes(e)?e:It.NORMAL,TX=class extends ur{constructor(e,t){super(),this._needsDOFResize=t,this.postprocessingState=tf.defaultData,this._scene=new Gr,this._camera=new yr,this.effects=new Map,this.blueNoiseTexture=new Pr,this._renderToScreen=!0,this._isUIOverlayEnabled=!1,this.clock=new FB,this.renderer=e,this.debug=!1,this.effects.set("bloom",new Vq),this.effects.set("chromaticAberration",new Gq),this.effects.set("vignette",new Xq),this.effects.set("noise",new qq),this.effects.set("colorAverage",new Hq),this.effects.set("hueSaturation",new Wq),this.effects.set("brightnessContrast",new jq),this.effects.set("depthOfField",new Yq),this.effects.set("pixelation",new Qq),this.effectComposer=new rX(this.renderer),this.effectComposer.autoRenderToScreen=!1,this.opaquePass=new Q0(!0,this.scene,this.camera),this.opaquePass.clear=!0,this.transmissionPass=new tX(this.scene,this.camera,this.renderer),this.aoPass=new pX(this.scene,this.camera),this.taaPass=new eX,this.taaPass.renderToScreen=!1,this.helperPass=new aX(this.camera),this.helperPass.renderToScreen=!1,this.stylesOverlayPass=new gX,this.stylesOverlayPass.enabled=!1,this.uiOverlayPass=new _X,this.uiOverlayPass.enabled=!1,this.logoOverlayPass=new EX,this.logoOverlayPass.enabled=!1,this.sceneTransitionPass=new bX,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 Pr(e,128,128),this.blueNoiseTexture.wrapS=Ya,this.blueNoiseTexture.wrapT=Ya,this.blueNoiseTexture.minFilter=wt,this.blueNoiseTexture.magFilter=wt,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(){var e,t,i;
vendor: 3,857 bytes, line 6261
6261if((e=this.uvEffectPass)==null||e.dispose(),(t=this.effectPass)==null||t.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 r=[this.effects.get("pixelation")].reduce(q_,[]);r.length>0&&(this.uvEffectPass=new xf(this.camera,...r),this.uvEffectPass.renderToScreen=!1,this.effectComposer.addPass(this.uvEffectPass));let s=[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(q_,[]);if(s.length>0&&(this.effectPass=new xf(this.camera,...s),this.effectPass.renderToScreen=!1,this.effectComposer.addPass(this.effectPass),this._needsDOFResize&&((i=this.effects.get("depthOfField"))==null?void 0:i.enabled)&&window!==void 0)){let a=this.renderer.viewportWidth,n=this.renderer.viewportHeight;this.renderer.setSize(a-1,n-1),this.renderer.setSize(a,n)}}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 j;this.renderer.getDrawingBufferSize(e),this._rt=new Tt(e.x,e.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:Ya,wrapT:Ya}),this._rt.samples=0,this._savePass=new X0(this._rt,!1),this._savePass.renderToScreen=!1}setCopyPass(e){this._rt=e,this._savePass=new X0(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=CX(l):n[o]=l}}this.postprocessingState=e,r&&this._initPasses()}render(){this.effectComposer.render(this.clock.getDelta())}setScissor(e,t,i,r){e instanceof ht?(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 ht?(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(){var e,t;
6261(e=this.uvEffectPass)==null||e.dispose(),(t=this.effectPass)==null||t.dispose(),this.effectComposer.dispose()}},PX=e=>`
6262
6263// PCSS implementation based on:
6264// https://www.gamedev.net/articles/programming/graphics/contact-hardening-soft-shadows-made-fast-r4906/
6265// NOTE: This number affects how big the shadow blur can
6266// possibly get. Bigger number == bigger blur, but less precise results
6267
6268const float  gPenumbraFilterSize = 80.0;
6269const int   gPenumbraSamples = ${e};
6270const int gShadowSamples = ${e};
6271const float gShadowSamplesRpc = 1.0f / float(gShadowSamples);
6272
6273#ifdef USE_SHADOWMAP
6274    #if NUM_DIR_LIGHT_SHADOWS > 0
6275
6276        uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
6277        varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
6278
6279        struct DirectionalLightShadow {
6280            float shadowBias;
6281            float shadowNormalBias;
6282            float shadowRadius;
6283            vec2 shadowMapSize;
6284        };
6285
6286        uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
6287
6288    #endif
6289
6290    #if NUM_SPOT_LIGHT_SHADOWS > 0
6291
6292        uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
6293        varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_SHADOWS ];
6294
6295        struct SpotLightShadow {
6296            float shadowBias;
6297            float shadowNormalBias;
6298            float shadowRadius;
6299            vec2 shadowMapSize;
6300        };
6301
6302        uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
6303
6304    #endif
6305
6306    #if NUM_POINT_LIGHT_SHADOWS > 0
6307
6308        uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
6309        varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
6310
6311        struct PointLightShadow {
6312            float shadowBias;
6313            float shadowNormalBias;
6314            float shadowRadius;
6315            vec2 shadowMapSize;
6316            float shadowCameraNear;
6317            float shadowCameraFar;
6318        };
6319
6320        uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
6321
6322    #endif
6323
6324    /*
6325    #if NUM_RECT_AREA_LIGHTS > 0
6326
6327        // TODO (abelnation): create uniforms for area light shadows
6328
6329    #endif
6330    */
6331
6332float computePenumbra(int index, sampler2D shadowMap, float temporalAngle, float texelSize, vec2 uv, float compare, float texelScalar, float shadowRadius)
6333{
6334    float penumbra = 1.0;
6335    float blockerDepthAvg = 0.0;
6336    float blockerCount = 0.0;
6337
6338    #pragma unroll_loop_start
6339    for(int i = 0; i < gPenumbraSamples; i ++)
6340    {
6341        vec2 offset = (vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize) * texelScalar;
6342        float depth = unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) );
6343
6344        if(depth < compare + 0.0001)
6345        {
6346            blockerDepthAvg += depth;
6347            blockerCount++;
6348        }
6349    }
6350    #pragma unroll_loop_end
6351
6352    if (blockerCount > 0.0)
6353    {
6354        blockerDepthAvg /= blockerCount;
6355
6356        // Compute penumbra
6357        penumbra = (compare - blockerDepthAvg) / (blockerDepthAvg);
6358        penumbra *= penumbra;
6359        penumbra *= 200.0 * penumbraSize[min(index, 5 - 1)]; // Magic number that affects how quickly the penumbra grows
6360
6361        return clamp(penumbra, 0.00, 1.0);
6362    }
6363    return 0.0;
6364}
6365
6366float vogelShadow(int index, sampler2D shadowMap, vec2 uv, float texelSize, float compare, float shadowRadius)
6367{
6368    float shadow         = 0.0f;
6369
6370    // NOTE: When using TAA, we should use screen space interleaved gradient noise
6371    vec2 halton = haltonSequence[frameIndex];
6372    float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);
6373    float temporalAngle  = temporalOffset * PI2;
6374
6375    float texelScalar = (gPenumbraFilterSize) / (texelSize * 1024.);
6376    float penumbra = computePenumbra(index, shadowMap, temporalAngle, texelSize, uv, compare, texelScalar, shadowRadius);
6377    if (penumbra == -1.0) {
6378        return 1.0;
6379    }
6380
6381    #pragma unroll_loop_start
6382    for (int i = 0; i < gShadowSamples; i++)
6383    {
6384        vec2 vogelSample =  vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize;
6385        // Overall blurring offset
6386        vec2 offset = vogelSample * (shadowRadius * 2.);
6387
6388        // Penumbra offset
6389        offset += vogelSample * (penumbra * texelScalar);
6390
6391        shadow += step( compare, unpackRGBAToDepth( texture2D( shadowMap, uv + offset ) ) );
6392    }
6393    #pragma unroll_loop_end
6394
6395    return shadow * gShadowSamplesRpc;
6396}
6397
6398
6399    float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
6400
6401        return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
6402
6403    }
6404
6405    vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
6406
6407        return unpackRGBATo2Half( texture2D( shadow, uv ) );
6408
6409    }
6410
6411    float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
6412
6413        float occlusion = 1.0;
6414
6415        vec2 distribution = texture2DDistribution( shadow, uv );
6416
6417        float hard_shadow = step( compare , distribution.x ); // Hard Shadow
6418
6419        if (hard_shadow != 1.0 ) {
6420
6421            float distance = compare - distribution.x ;
6422            float variance = max( 0.00000, distribution.y * distribution.y );
6423            float softness_probability = variance / (variance + distance * distance ); // Chebeyshevs inequality
6424            softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); // 0.3 reduces light bleed
6425            occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
6426
6427        }
6428        return occlusion;
6429
6430    }
6431
6432    float getShadow( int i, sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
6433
6434        float shadow = 1.0;
6435
6436        shadowCoord.xyz /= shadowCoord.w;
6437        shadowCoord.z += shadowBias;
6438
6439        // if ( something && something ) breaks ATI OpenGL shader compiler
6440        // if ( all( something, something ) ) using this instead
6441
6442        bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
6443        bool inFrustum = all( inFrustumVec );
6444
6445        bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
6446
6447        bool frustumTest = all( frustumTestVec );
6448
6449        if ( frustumTest ) {
6450
6451        #if defined( SHADOWMAP_TYPE_PCF )
6452
6453            vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
6454            return vogelShadow(i, shadowMap, shadowCoord.xy, texelSize.x, shadowCoord.z, shadowRadius );
6455
6456        #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
6457
6458            vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
6459            float dx = texelSize.x;
6460            float dy = texelSize.y;
6461
6462            vec2 uv = shadowCoord.xy;
6463            vec2 f = fract( uv * shadowMapSize + 0.5 );
6464            uv -= f * texelSize;
6465
6466            shadow = (
6467                texture2DCompare( shadowMap, uv, shadowCoord.z ) +
6468                texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
6469                texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
6470                texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
6471                mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
6472                     texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
6473                     f.x ) +
6474                mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
6475                     texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
6476                     f.x ) +
6477                mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
6478                     texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
6479                     f.y ) +
6480                mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
6481                     texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
6482                     f.y ) +
6483                mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
6484                          texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
6485                          f.x ),
6486                     mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
6487                          texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
6488                          f.x ),
6489                     f.y )
6490            ) * ( 1.0 / 9.0 );
6491
6492        #elif defined( SHADOWMAP_TYPE_VSM )
6493
6494            shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
6495
6496        #else // no percentage-closer filtering:
6497
6498            shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
6499
6500        #endif
6501
6502        }
6503
6504        return shadow;
6505
6506    }
6507
6508    // cubeToUV() maps a 3D direction vector suitable for cube texture mapping to a 2D
6509    // vector suitable for 2D texture mapping. This code uses the following layout for the
6510    // 2D texture:
6511    //
6512    // xzXZ
6513    //  y Y
6514    //
6515    // Y - Positive y direction
6516    // y - Negative y direction
6517    // X - Positive x direction
6518    // x - Negative x direction
6519    // Z - Positive z direction
6520    // z - Negative z direction
6521    //
6522    // Source and test bed:
6523    // https://gist.github.com/tschw/da10c43c467ce8afd0c4
6524
6525    vec2 cubeToUV( vec3 v, float texelSizeY ) {
6526
6527        // Number of texels to avoid at the edge of each square
6528
6529        vec3 absV = abs( v );
6530
6531        // Intersect unit cube
6532
6533        float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
6534        absV *= scaleToCube;
6535
6536        // Apply scale to avoid seams
6537
6538        // two texels less per square (one texel will do for NEAREST)
6539        v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
6540
6541        // Unwrap
6542
6543        // space: -1 ... 1 range for each square
6544        //
6545        // #X##         dim    := ( 4 , 2 )
6546        //  # #         center := ( 1 , 1 )
6547
6548        vec2 planar = v.xy;
6549
6550        float almostATexel = 1.5 * texelSizeY;
6551        float almostOne = 1.0 - almostATexel;
6552
6553        if ( absV.z >= almostOne ) {
6554
6555            if ( v.z > 0.0 )
6556                planar.x = 4.0 - v.x;
6557
6558        } else if ( absV.x >= almostOne ) {
6559
6560            float signX = sign( v.x );
6561            planar.x = v.z * signX + 2.0 * signX;
6562
6563        } else if ( absV.y >= almostOne ) {
6564
6565            float signY = sign( v.y );
6566            planar.x = v.x + 2.0 * signY + 2.0;
6567            planar.y = v.z * signY - 2.0;
6568
6569        }
6570
6571        // Transform to UV space
6572
6573        // scale := 0.5 / dim
6574        // translate := ( center + 0.5 ) / dim
6575        return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
6576
6577    }
6578
6579    float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
6580
6581        float shadow = 1.0;
6582        vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
6583
6584        // for point lights, the uniform @vShadowCoord is re-purposed to hold
6585        // the vector from the light to the world-space position of the fragment.
6586        vec3 lightToPosition = shadowCoord.xyz;
6587
6588        // dp = normalized distance from light to fragment position
6589        float compare = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); // need to clamp?
6590        compare += shadowBias;
6591
6592        // bd3D = base direction 3D
6593        vec3 bd3D = normalize( lightToPosition );
6594
6595        vec2 halton = haltonSequence[frameIndex];
6596        float temporalOffset = getNoiseInterleavedGradient(gl_FragCoord.xy + halton);
6597        float temporalAngle  = temporalOffset * PI2;
6598
6599        #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_VSM )
6600            for (int i = 0; i < gShadowSamples; i++) {
6601                vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize;
6602
6603                // Overall blurring offset
6604                vec3 offset = vec3(vogelSample.x, vogelSample.y, -vogelSample.x) * (shadowRadius + 5.);
6605
6606                // NOTE: Removed for now
6607                // Penumbra offset
6608                //offset += vec3(vogelSample.x, vogelSample.y, vogelSample.y)  * (penumbra * gPenumbraFilterSize);
6609
6610                shadow += texture2DCompare( shadowMap, cubeToUV( bd3D + offset, texelSize.y ), compare );
6611
6612            }
6613            return shadow * gShadowSamplesRpc;
6614
6615        #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
6616            for (int i = 0; i < 16; i++) {
6617                vec2 vogelSample = vogelDiskSample(i, gShadowSamples, temporalAngle) * texelSize;
6618
6619                // Overall blurring offset
6620                vec3 offset = vec3(vogelSample.x, vogelSample.y, -vogelSample.x) * (shadowRadius + 5.);
6621
6622                shadow += texture2DCompare( shadowMap, cubeToUV( bd3D + offset, texelSize.y ), compare );
6623
6624            }
6625            return shadow * (1.0 / 16.0);
6626        #else // no percentage-closer filtering
6627
6628            return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), compare );
6629
6630        #endif
6631
6632    }
6633
6634#endif
6635`,DX=vt.lights_fragment_begin,IX=vt.shadowmask_pars_fragment,X_=null,OX=e=>{switch(e){case"low":return 8;case"medium":return 16;case"high":return 32;default:return 16}},RX=(e="medium")=>{if(X_===e)return!1;X_=e;let t=OX(e);vt.shadowmap_pars_fragment=PX(t);let i=DX.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 ]"),vt.lights_fragment_begin=i;let r=IX.slice();return r=r.replaceAll("getShadow(","getShadow( UNROLLED_LOOP_INDEX, "),vt.shadowmask_pars_fragment=r,!0},LX=`
6636attribute vec3 randomColor;
6637varying vec3 vNormal;
6638flat out vec3 vColor;
6639#include <skinning_pars_vertex>
6640#include <morphtarget_pars_vertex>
6641	
6642void main()
6643{
6644#include <beginnormal_vertex>
6645#include <morphnormal_vertex>
6646#include <skinbase_vertex>
6647#include <skinnormal_vertex>
6648vec3 transformed = vec3(position);
6649#include <morphtarget_vertex>
6650#include <skinning_vertex>
6651
6652vNormal = normal;
6653vColor = randomColor;
6654gl_Position = projectionMatrix * (modelViewMatrix * vec4(transformed, 1.0));
6655}
6656`,BX=`
6657uniform float depthContrast;
6658varying vec3 vNormal;
6659flat in vec3 vColor;
6660void main()
6661{
6662vec3 normal = (normalize(vNormal)).rgb;
6663
6664float contrastDepth = (gl_FragCoord.z - 0.5) * depthContrast + 0.5;
6665
6666vec3 resultColor = mix(mix(vColor, normal, 0.2), vec3(contrastDepth), 0.4);
6667gl_FragColor = vec4(resultColor, vColor.r);
6668gl_FragColor = vec4(resultColor, vColor.r);
6669}
6670`,zg=new Pt({vertexShader:LX,fragmentShader:BX,uniforms:{depthContrast:{value:1}}}),Y_=new oi,Q_=new j,zX=class extends NM{constructor(e){super(e),this._pixelRatio=this.getPixelRatio(),this.viewportWidth=1,this.viewportHe
6670ight=1,this.resolution=new j,this.dummyCamera=new yr,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 TX(this,(e==null?void 0:e.needsDOFResize)??!1),this.autoClear=!1;let t=this.setPixelRatio.bind(this),i=this.setSize.bind(this);this.shadowMap.enabled=!0,this.shadowMap.type=my,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)=>{var o,l;(this.viewportWidth!==s||this.viewportHeight!==a)&&(this.viewportWidth=s,this.viewportHeight=a,i(s,a,n),(o=this.normalRenderTarget)==null||o.setSize(s*this._pixelRatio,a*this._pixelRatio),this._resizeTransmission(s,a),(l=this.transmissionDepthTarget)==null||l.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 Tt(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:yt,magFilter:yt,wrapS:ii,wrapT:ii,depthBuffer:!1}))}_resizeTransmission(e,t){var i,r;(i=this.transmissionRenderTarget)==null||i.setSize(e*this._pixelRatio/(this.hdTransmission?1:2),t*this._pixelRatio/(this.hdTransmission?1:2)),(r=this.aoRenderTarget)==null||r.setSize(e*this._pixelRatio/1,t*this._pixelRatio/1)}get hdTransmission(){return rt.transmissionLod.value===1}set hdTransmission(e){rt.transmissionLod.value=e===!0?1:2,this._resizeTransmission(this.viewportWidth,this.viewportHeight)}createTransmissionRenderTarget(){this.transmissionRenderTarget===void 0&&(this.transmissionRenderTarget=new Tt(this.viewportWidth*this._pixelRatio/(this.hdTransmission?1:2),this.viewportHeight*this._pixelRatio/(this.hdTransmission?1:2),{generateMipmaps:!0,minFilter:ch,magFilter:yt,wrapS:ii,wrapT:ii,depthBuffer:!1}),this.transmissionDepthTarget=new Tt(this.viewportWidth*this._pixelRatio/2,this.viewportHeight*this._pixelRatio/2,{minFilter:wt,magFilter:wt,depthBuffer:!1}))}createNormalRenderTarget(){this.normalRenderTarget===void 0&&(this.normalRenderTarget=new Tt(this.viewportWidth*this._pixelRatio,this.viewportHeight*this._pixelRatio,{generateMipmaps:!1,minFilter:wt,magFilter:wt,type:Vt,depthTexture:new uh(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 yr?zg.uniforms.depthContrast.value=(i.far-i.near)/1e4:zg.uniforms.depthContrast.value=1,t.overrideMaterial=zg,this.render(t,i),this.setClearColor(t.bgColor,t.bgColor.a),this.setRenderTarget(null),t.overrideMaterial=e.wireframeState?iy: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}={}){var u;let n=e instanceof k1?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((p,f)=>{rt.penumbraSize.value[f]=p}),rt.pixelRatioNode.value=this.getPixelRatio(),this.resolution.x!==0&&this.resolution.y!==0?rt.resolution.value.set(this.resolution.x,this.resolution.y):rt.resolution.value.set(this.viewportWidth*this._pixelRatio,this.viewportHe
6670ight*this._pixelRatio),a!==void 0?(rt.normalRenderTarget.value=a,rt.normalRenderTargetDepth.value=Y_):l.needsNormal()&&(this.createNormalRenderTarget(),rt.normalRenderTarget.value=this.normalRenderTarget.texture,rt.normalRenderTargetDepth.value=this.normalRenderTarget.depthTexture,this.renderNormal(l,n,t));let h=n.data.ao,c=h.occlusion;if(c&&(this.createAORenderTarget(),rt.aoRenderTarget.value=this.aoRenderTarget.texture),rt.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&&!Sd),this.pipeline.aoPass.setBlueNoiseTexture(this.pipeline.blueNoiseTexture),this.pipeline.isUIOverlayEnabled&&((u=n.uiCanvas)==null?void 0:u.enabled)&&n.uiCanvas.texture&&n.uiCanvas.texture.image.width>0){let p=this.getSize(Q_),f=this.getPixelRatio();(n.uiCanvas.width!==this.viewportWidth||n.uiCanvas.height!==this.viewportHeight||n.uiCanvas.dpr!==f)&&n.uiCanvas.applySize({width:this.viewportWidth,height:this.viewportHeight},f),n.uiCanvas.render(this),this.pipeline.uiOverlayPass.uiCanvas=n.uiCanvas,this.pipeline.uiOverlayPass.enabled=!0,this.pipeline.uiOverlayPass.setResolution(p.x,p.y,f),this.pipeline.updateRenderToScreen()}else this.pipeline.uiOverlayPass.enabled=!1,this.pipeline.updateRenderToScreen();if(this.pipeline.logoOverlayPass.enabled){let p=this.getSize(Q_),f=this.getPixelRatio();this.pipeline.logoOverlayPass.uniforms.uResolution.value.set(p.x,p.y),this.pipeline.logoOverlayPass.uniforms.uDPR.value=f}let d=!1;if(s!==void 0)rt.transmissionRenderTarget.value=s,rt.transmissionRenderTargetDepth.value=Y_,this.pipeline.setTransmissionPassEnabled(!1);else{let p=l.needsTransmission();p&&(this.transmissionRenderTarget===void 0&&(d=!0),this.createTransmissionRenderTarget(),rt.transmissionRenderTarget.value=this.transmissionRenderTarget.texture,rt.aspectRatio.value=g8(this.viewportWidth,this.viewportHeight),rt.transmissionRenderTargetDepth.value=this.transmissionDepthTarget.texture),this.pipeline.setTransmissionPassEnabled(p)}t.layers.enable(3),t.layers.enable(8),this.pipeline.sceneHelpers=i,this.pipeline.sceneHelpersOnTop=r,this.pipeline.scene=n,this.pipeline.camera=t,d&&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(p=>{p.onBeforeShadowPass(this)}),n.overrideMaterial=l.wireframeState?iy:null,this.pipeline.render(),rt.frameIndex.value=(rt.frameIndex.value+1)%16,t instanceof yr&&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(){var e,t,i,r,s,a;this._superDispose(),this.pipeline.dispose(),(e=this.aoRenderTarget)==null||e.dispose(),(t=this.transmissionRenderTarget)==null||t.dispose(),(i=this.transmissionDepthTarget)==null||i.dispose(),(r=this.normalRenderTarget)==null||r.dispose(),(a=(s=this.normalRenderTarget)==null?void 0:s.depthTexture)==null||a.dispose()}},rT=class extends Md($B){constructor(e,t=15,i=10066329){super(e,t,i),this.object=e,this.added=!1,this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){Ed(this.object,rT.geometryHelper,e,t)}},sT=class extends Md(JB){constructor(e,t=15,i=6710886){super(e,t,i),this.object=e,this.name=`PointLightHelper: ${e.uuid}`}raycast(e,t){Ed(this.object,sT.geometryHelper,e,t)}},Z0=class extends Md(KB){constructor(e,t=6710886){super(e,t),this.object=e,this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){Ed(this.object,Z0.geometryHelper,e,t)}update(){if(this.object!==void 0){let e=Z0._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)}}},aT=Z0;aT._vector=new M;
vendor: 4,455 bytes, lines 6670-6671
6670var nT=class extends Ka{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 ga(1,1),new sn({transparent:!0,opacity:0,side:vr})),this.add(this.caretMesh),this.selectionMesh=new Zt(new ga(1,1),new sn({color:2857471,transparent:!0,depthTest:!1,depthWrite:!1,opacity:0,side:vr})),this.add(this.selectionMesh),this.hide()}get caretHeight(){var e;return((e=this.object)==null?void 0:e.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]=bf(i,e),[a,n]=e>0?bf(i,e-1):[null,null];(e>0&&i.length?i[a].charAt(n):null)===`
6671`&&(r++,s=0),this.current.start=e,this.current.end=void 0;let[o,l]=Fg(this.object,r,s),{AD:h,descender:c}=this.object,d=c+h*.5,{width:u,height:p,depth:f}=this.object.geometry.userData.parameters,g=typeof u=="string"?0:u,m=typeof p=="string"?0:p;this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.set(o-g*.5,l+d+m*.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=FX(i,e,t),{lineHeight:n,AD:o,descender:l}=this.object,h=l+o*.5-n*.5;for(let[m,v,y]of a)if(v!==y){let[x,w]=Fg(this.object,m,v),[S,b]=Fg(this.object,m,y);w+=h,b+=h,b+=n;let A=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(A+0,A+1,A+2),s.push(A+2,A+3,A+0)}let c=new je;c.setIndex(s),c.setAttribute("position",new De(r,3));let{width:d,height:u,depth:p}=this.object.geometry.userData.parameters,f=typeof d=="string"?0:d,g=typeof u=="string"?0:u;this.selectionMesh.geometry.dispose(),this.selectionMesh.geometry=c,this.selectionMesh.position.x=-f*.5,this.selectionMesh.position.y=g*.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 d=Math.min(Math.floor(Math.max(Math.min(-t-c,n),0)/a),s-1),u=this.object.charCoords[d],p=this.object.charWidths[d],f=0,g=!1;if(i==="previous"){for(let m=0;m<u.length;m++)if(u[m][0]+p[m]*.5-e>0){f=m,g=!0;break}}else if(i==="closest"){let m=1/0;for(let v=0;v<u.length;v++){let y=u[v][0]+p[v]*.5,x=Math.abs(y-e);x<m&&(m=x,f=v,g=!0)}}else for(let m=0;m<u.length;m++){let v=u[m][0],y=u[m][0]+p[m];if(e>=v&&e<y){f=m,g=!0;break}}return g||(f=u.length),{index:this.getGlobalIndexFromLineAndCharIndexes(r,d,f),lineIndex:d,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 Fg(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:d}=e.data.geometry,u=e.wrappedText,{width:p}=e.geometry.userData.parameters;
6671return u.length===1&&u[0].length===0&&(d===3?c=p*.5:d===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 bf(e,t){var r;let i=0;for(let s=0;s<e.length;s++){let a=e[s],n=t-i;if(n<=a.length)return[s,n];i+=a.length}return[Math.max(0,e.length-1),((r=e[e.length-1])==null?void 0:r.length)??0]}function FX(e,t,i){let[r,s]=bf(e,t),[a,n]=bf(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,d=l===a?n:h.length;o.push([l,c,d])}return o}function kX(e,t){let i=nr.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=UX(s.data.color,t),r=a;break}else if((s.data.type==="depth"||s.data.type==="gradient")&&a>.3){let n=NX(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 UX(e,t){return typeof e=="string"?t.data.colors[e]:e}function NX(e){return e.colors[0]}function VX(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 oT=class extends T1(zB,rT){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 Lp(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];t instanceof Lp&&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&&VX(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()}},Z_=new M,K_=new M,J_=new ot,lT=class extends T1(OB,aT){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=Oe.RAD2DEG*2*this.angle,r.aspect=1,r.near=100,r.far=2500;let s=new Lp(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 Lp&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),K_.setFromMatrixPosition(this.matrixWorld),J_.setFromRotationMatrix(this.matrixWorld),Z_.copy(this.up).applyQuaternion(J_).negate().multiplyScalar(this.distance),this.target.position.copy(K_).add(Z_),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 jX(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),d=(c-h)/2,u=(c+h)/2,p=[[Math.cos(u),Math.sin(u)],[-Math.sin(u),Math.cos(u)]],f=[[o,0],[0,l]],g=[[Math.
vendor: 13,943 bytes, line 6671
6671cos(d),Math.sin(d)],[-Math.sin(d),Math.cos(d)]];return p[0][0]*=-1,p[0][1]*=-1,g[0][0]*=-1,g[1][0]*=-1,[p,f,g]}function fp(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 $_(e){return[[e[0][0],e[1][0]],[e[0][1],e[1][1]]]}function GX(e){let[t,i,r]=jX(e),s=fp(t,$_(r)),a=fp(fp(r,i),$_(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 HX({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=fp(a,n);return[o[0][0],o[1][0],o[0][1],o[1][1]]}var Rt;(e=>{function t(){return[1,0,0,0,1,0,0,0,1]}e.identity=t;function i(b,A=e.identity()){for(let _=0,E=b.length;_<E;_++)A[_]=b[_];return A}e.copy=i;function r(b,A,_,E,C,T){return e.setAbcdef(e.identity(),b,A,_,E,C,T)}e.create=r;function s(b,A,_,E,C,T,P){return b[0]=A,b[1]=E,b[2]=T,b[3]=_,b[4]=C,b[5]=P,b}e.setAbcdef=s;function a(b,A){let[_,E,C,T,P,O]=o(b),[D,k,W,N,F,Z]=o(A),q=D*_+k*C,G=D*E+k*T,Q=W*_+N*C,ee=W*E+N*T,Y=F*_+Z*C+P,$=F*E+Z*T+O;return e.create(q,G,Q,ee,Y,$)}e.append=a;function n(b,A){let[_,E,C,T,P,O]=o(b),[D,k,W,N,F,Z]=o(A),q=_,G=E,Q=C,ee=T;(D!==1||k!==0||W!==0||N!==1)&&(q=_*D+E*W,G=_*k+E*N,Q=C*D+T*W,ee=C*k+T*N);let Y=P*D+O*W+F,$=P*k+O*N+Z;return e.create(q,G,Q,ee,Y,$)}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[A,_,E,C,T,P]=e.getAbcdef(b),O=A*C-_*E,D=C/O,k=-_/O,W=-E/O,N=A/O,F=(E*P-C*T)/O,Z=-(A*P-_*T)/O;return e.create(D,k,W,N,F,Z)}e.invert=l;function h([b,A],_){let[E,C,T,P,O,D]=e.getAbcdef(_);return[E*b+T*A+O,C*b+P*A+D]}e.apply=h;function c(b,A){let[_,E,C,T,P,O]=e.getAbcdef(A),D=1/(_*T+C*-E),[k,W]=b;return[T*D*k+-C*D*W+(O*C-P*T)*D,_*D*W+-E*D*k+(-O*_+P*E)*D]}e.applyInverse=c;function d(b,A,_=A){let[E,C,T,P,O,D]=e.getAbcdef(b);return e.setAbcdef(b,E*A,C*_,T*A,P*_,O*A,D*_),b}e.scale=d;function u(b,A){let _=Math.cos(A),E=Math.sin(A),[C,T,P,O,D,k]=e.getAbcdef(b);return e.setAbcdef(b,C*_-T*E,C*E+T*_,P*_-O*E,P*E+O*_,D*_-k*E,D*E+k*_),b}e.rotate=u;function p(b,A,_){let[E,C]=_,T=e.translate(b,-E,-C);return T=e.rotate(T,A),T=e.translate(T,E,C),T}e.rotateAround=p;function f(b,A,_){let[E,C,T,P,O,D]=e.getAbcdef(b);return e.setAbcdef(b,E,C,T,P,O+A,D+_),b}e.translate=f;function g(b,A,_){let[E,C,T,P]=e.getAbcdef(b);return e.setAbcdef(b,E,C,T,P,A,_),b}e.setTranslate=g;function m(b,A,_){let[E,C,T,P]=e.getAbcdef(b);return e.setAbcdef(b,E,C,T,P,A,_),b}e.setPosition=m;function v(b){let[A,_,E,C]=e.getAbcdef(b),T=Math.sqrt(A*A+_*_),P=Math.sqrt(E*E+C*C);return[T,P]}e.getScale=v;function y(b){let[,,,,A,_]=e.getAbcdef(b);return[A,_]}e.getPosition=y;function x(b,A){return e.decompose(b,A).rotation}e.getRotation=x;function w(b,A){let[_,E,C,T,P,O]=e.getAbcdef(b),{rotation:D,scale:k,shear:W}=GX([[_,C],[E,T]]);return{position:[P+(A[0]*_+A[1]*C)-A[0],O+(A[0]*E+A[1]*T)-A[1]],scale:k,rotation:D,shear:W,pivot:A}}e.decompose=w;function S(b,A,_,E,C=[0,0]){let[T,P]=b,[O,D]=E,[k,W,N,F]=HX({rotation:_,scale:A,shear:C}),Z=T-(O*k+D*N)+O,q=P-(O*W+D*F)+D;return e.create(k,W,N,F,Z,q)}e.compose=S})(Rt||(Rt={}));var WX=Math.PI/180;function qX(e,t,i,r,s,a){let n=e-i,o=t-r;return n*n/(s*s)+o*o/(a*a)<=1}function XX(e){return e*WX}var $i=class{constructor(e,t,i){this.uuid=e,this.data=t,this.localMatrix=Rt.identity(),this.worldMatrix=Rt.identity(),this.ignoreCameraZoom=!1,this.visible=!0,this._singleBBox=new K0,this._recursiveBBox=new K0,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=Xf(),this.dpr=i.dpr??1,this.dataPatched=t}project(e,t){let i=this.worldMatrix;return t&&(i=Rt.append(t.worldMatrix,i)),Rt.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=Rt.compose(this.position,this.scale,XX(this.rotation),Uo.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=Rt.append(this.parent.worldMatrix,this.localMatrix):this.worldMatrix=Rt.copy(this.localMatrix),this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}get pivot(){return Uo.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=Yt(e.path,["states","*"]);if(s!==null){if(e.type===0){let[a]=s;if((this==null?void 0: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=Fi.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=Fi.removeOverridden(e.path,e.props,a);r={...e,props:n}}}this.updateByPatchedOpBase(r,Do.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)Do.toOps(this.data,r.data).forEach(s=>{let a=Wp.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=Do.patch(this.data,r),Do.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 $i(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 $i&&(e=e.uuid);let t=this;for(;t.parent;){if(t.parent.uuid===e)return!0;t=t.parent}return!1}},Is=class extends $i{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 Is&&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 Is?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 Is&&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 Is&&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 Is(this.uuid,this.data,e);t.parent=void 0;for(let i of this.children)t.add(i.clone(e));return t}},Jn=class extends Is{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 Jn(this.uuid,this.data,e);t.parent=void 0;for(let i of this.children)t.add(i.clone(e));return t}};function YX(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 d=((i-n)*(o-h)-(r-o)*(n-l))/c,u=-((i-s)*(r-o)-(r-a)*(i-n))/c;return d>=0&&d<=1&&u>=0&&u<=1}var hT=[[-1,1],[-1,-1],[1,-1],[1,1]],eA=(e,t,i)=>{let r=e.getCenter(),s=e.getHalfSize(),a=Rt.append(t,e.worldMatrix);s[0]===0&&s[1]===0?i.push(Rt.apply(r,a)):hT.forEach(n=>{let o=[n[0]*s[0]+r[0],n[1]*s[1]+r[1]];i.push(Rt.apply(o,a))})},K0=class{constructor(){this.matrix=Rt.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(),Rt.copy(e.worldMatrix,this.matrix);let i=Rt.invert(e.worldMatrix);this.expandByObjectSize(e,i,t)}expandByObjectSize(e,t,i=!1){let r=[];i===!0&&e instanceof Is?e.traverse(s=>{s.visible&&eA(s,t,r)}):eA(e,t,r),this.setFromPoints(r)}setFromSize(e,t,i){this.makeEmpty(),Rt.copy(i,this.matrix),this.expandBySize(e,t,i)}expandBySize(e,t,i){[Rt.apply([0,0],i),Rt.apply([0,t],i),Rt.apply([e,t],i),Rt.apply([e,0],i)].forEach(r=>this.expandByPoint(r))}getCenter(){let[e,t]=this.min,[i,r]=this.getHalfSize();return Rt.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]=Rt.getAbcdef(this.matrix),o=Rt.create(r,s,a,n,i[0],i[1]);this.vertices=hT.map(([l,h])=>Rt.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=Rt.append(t.worldMatrix,i)),Rt.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(YX(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],Rt.copy(e.matrix,this.matrix),this.computeVertices(),this.computeEdges()}clone(){let e=new K0;return e.copy(this),e}},cT,QX=new Promise(e=>{cT=e}),tA=!1,Xu;function ZX(){if(tA)return;if(Xu)return Xu;async function e(){let t=await $n(()=>import("./ui-L7l3pL7d.js"),[]);cT(t.default??t),tA=!0}return Xu=e(),Xu}function iA(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,kg;async function KX(e){let t=await QX;dt||(kg||(kg=t({locateFile:()=>e})),dt=await kg)}var rA=Rt.identity(),dT=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=Gt.transparent,this._innerShadowBlur=0,this._innerShadowOffsetX=0,this._innerShadowOffsetY=0,this._innerShadowSpread=0,this._innerShadowColor=Gt.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=rA,this._currentTransform=new Float32Array(rA)}get dpr(){return this._dpr}set dpr(e){this._dpr=e,this._isSizeDirty=!0}
6671async init(){var e,t;if(!this.wasmURL)throw Error("Your must set the wasm binary url with renderer.wasmURL = ... before you can call renderer.init");await KX(this.wasmURL),this._surface=dt.MakeWebGLCanvasSurface(this.canvas),this.ctx=(e=this._surface)==null?void 0:e.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),(t=this.ctx)==null||t.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(Yu(e),dt.ColorSpace.DISPLAY_P3)}set fillColor(e){this._paintFill&&this._paintFill.setColor(Yu(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(){var e;(e=this.ctx)==null||e.clear(dt.TRANSPARENT)}save(){var e;(e=this.ctx)==null||e.save()}restore(){var e;(e=this.ctx)==null||e.restore()}beginPath(){var e;(e=this._currentPath)==null||e.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){var h,c;let l=dt.XYWHRect(e,t,i,r);if(s===0&&a===0&&o===0&&n===0)(h=this.ctx)==null||h.clipRect(l,dt.ClipOp.Intersect,!0);else{let d=dt.RRectXY(l,s,s);d[4]=d[5]=s,d[6]=d[7]=a,d[8]=d[9]=n,d[10]=d[11]=o,(c=this.ctx)==null||c.clipRRect(d,dt.ClipOp.Intersect,!0)}}_applyShadowOffsetMatrix(){if(this.ctx){let e=Rt.invert(this.currentTransform);this.ctx.concat(e);let t=Rt.translate(Rt.identity(),this._dropShadowOffsetX,this._dropShadowOffsetY);this.ctx.concat(t),this.ctx.concat(this._currentTransform)}}_applyEffectsToPaint(e,t,i=!0){var r,s,a,n;if(this.ctx&&this._currentPath){let o,l=!1;if(i&&this._hasDropShadow()){let h=e.copy();h.setColor(Yu(this._dropShadowColor));let c;this._dropShadowBlur>0&&(c=dt.MaskFilter.MakeBlur(dt.BlurStyle.Normal,this._dropShadowBlur*this.dpr*(((r=this.camera)==null?void 0:r.scale)??1),!1),h.setMaskFilter(c)),this.ctx.save(),this.ctx.clipPath(this._currentPath,dt.ClipOp.Difference,!0),this._applyShadowOffsetMatrix(),t(h),this.ctx.restore(),h.delete(),c==null||c.delete()}if(this._backgroundBlur>0&&i){this.ctx.save(),this.ctx.clipPath(this._currentPath,dt.ClipOp.Intersect,!0);let h=dt.ImageFilter.MakeBlur(this._backgroundBlur,this._backgroundBlur,dt.TileMode.Clamp,null),c=e.copy();c.setImageFilter(h),c.setAlphaf(1);let d=this._currentPath.computeTightBounds();this.ctx.saveLayer(c,d,null,dt.SaveLayerInitWithPrevious),this.ctx.drawColor(e.getColor()),this.ctx.restore(),this.ctx.restore(),c.delete(),h.delete(),l=!0}if(this._layerBlur>0){let h=e.copy();o=dt.MaskFilter.MakeBlur(dt.BlurStyle.Normal,this._layerBlur*this.dpr*(((s=this.camera)==null?void 0:s.scale)??1),!1),h.setMaskFilter(o),t(h),h.delete(),o.delete(),l=!0}if(l||t(e),i&&this._hasInnerShadow()){let h=new dt.Paint;h.setAntiAlias(!0),h.setStyle(dt.PaintStyle.Fill),h.setColor(Yu(this._innerShadowColor));let c;this._innerShadowBlur>0&&(c=dt.MaskFilter.MakeBlur(dt.BlurStyle.Normal,this._innerShadowBlur*this.dpr*(((a=this.camera)==null?void 0:a.scale)??1),!1),h.setMaskFilter(c));let d=this._currentPath.computeTightBounds(),[u,p,f,g]=d,m=f-u,v=g-p;this.ctx.save(),this.ctx.clipPath(this._currentPath,dt.ClipOp.Intersect,!0),this.ctx.saveLayer(h,d,null,dt.SaveLayerInitWithPrevious),(n=this.ctx)==null||n.translate(this._innerShadowOffsetX,this._innerShadowOffsetY),this.ctx.drawRect(dt.XYWHRect(-1e3-this._innerShadowOffsetX,-1e3-this._innerShadowOffsetY,2e3+m+Math.abs(this._innerShadowOffsetX*2),2e3+v+Math.abs(this._innerShadowOffsetY*2)),h),h.setBlendMode(dt.BlendMode.Clear),this.ctx.drawPath(this._currentPath,h),this.ctx.restore(
6671),this.ctx.restore(),h.delete(),c==null||c.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(){var e;return((e=this._dropShadowColor)==null?void 0:e.a)>0}_hasInnerShadow(){var e;return((e=this._innerShadowColor)==null?void 0:e.a)>0}path(e){var t;(t=this._currentPath)==null||t.addPath(dt.Path.MakeFromSVGString(e))}ellipse(e,t,i,r,s,a,n,o){var h;if(!sA([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);(h=this._currentPath)==null||h.addOval(l)}rect(e,t,i,r,s=0,a=0,n=0,o=0){var h,c;let l=dt.XYWHRect(e,t,i,r);if(sA(l))if(s===0&&a===0&&o===0&&n===0)(h=this._currentPath)==null||h.addRect(l);else{let d=dt.RRectXY(l,s,s);d[4]=d[5]=s,d[6]=d[7]=a,d[8]=d[9]=n,d[10]=d[11]=o,(c=this._currentPath)==null||c.addRRect(d)}}getHorizontalAlign(e){switch(e){case 2:return dt.TextAlign.Right;case 3:return dt.TextAlign.Center;case 4:return dt.TextAlign.Justify;case 1:default:return dt.TextAlign.Left}}drawTextInner(e,t,i,[r,s,a,n],o,l,h=!0){let c=0,{ctx:d}=this;if(!d)return c;let u=l.copy(),p=l.copy();return p.setAlphaf(0),this._applyEffectsToPaint(u,f=>{t.pushPaintStyle(i,f,p),t.addText(e);let g=t.build();g.layout(a);let m=s;o===2?m+=(n-g.getHeight())/2:o===3&&(m+=n-g.getHeight()),d.drawParagraph(g,r,m),c=g.getHeight(),t.reset(),g.delete()},h),u.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(){var e;(e=this._surface)==null||e.flush()}moveTo(e,t){var i;(i=this._currentPath)==null||i.moveTo(e,t)}lineTo(e,t){var i;(i=this._currentPath)==null||i.lineTo(e,t)}bezierCurveTo(e,t,i,r,s,a){var n;(n=this._currentPath)==null||n.cubicTo(e,t,i,r,s,a)}quadraticCurveTo(e,t,i,r){var s;(s=this._currentPath)==null||s.quadTo(e,t,i,r)}setTransform(e,t=!1){var s,a,n,o,l;if(!this.ctx)return;let i=this.ctx.getTotalMatrix(),r=Rt.invert(i);if(r&&this.ctx.concat(r),(s=this.ctx)==null||s.scale(this.dpr,this.dpr),((a=this.camera)==null?void 0:a.enabled)&&((n=this.ctx)==null||n.concat(this.camera.worldMatrix),t)){let h=Rt.getScale(this.camera.worldMatrix);(o=this.ctx)==null||o.scale(1/h[0],1/h[1])}(l=this.ctx)==null||l.concat(e),this.currentTransform=e}transform(e){var t;(t=this.ctx)==null||t.concat(e)}setSize(e,t){var i;!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=(i=this._surface)==null?void 0:i.getCanvas()))}};function sA(e){for(let t=0;t<e.length;t++)if(e[t]!==void 0&&!Number.isFinite(e[t]))return!1;return!0}function Yu({r:e,g:t,b:i,a:r}){return dt.Color4f(e,t,i,r)}var aA=class{constructor(e,t,i){this.uuid=e,this.data=t,this.enabled=!1,this.color=Gt.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)}},nA=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)}},JX=class{constructor(e,t,i){this.uuid=e,this.data=t,this.enabled=!1,this.color=Gt.transparent,this.update(t)}update(e){e.enabled!==void 0&&(this.enabled=e.enabled),e.color!==void 0&&(this.color=e.color)}},$X=class{constructor(e,t,i){this.uuid=e,this.data=t,this.enabled=!1,this.color=Gt.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)}},Yi=class extends $i{constructor(e,t,i){super(e,t,i),this.uuid=e,this.data=t,this.autoClose=!0,this.fill=new JX(e+"-fill",t.fill,i),this.stroke=new $X(e+"-stroke",t.stroke,i),this.dropShadow=new aA(e+"-dropShadow",t.dropShadow,i),this.innerShadow=new aA(e+"-innerShadow",t.innerShadow,i),this.backgroundBlur=new nA(e+"-backgroundBlur",t.backgroundBlur,i),this.layerBlur=new nA(e+"-layerBlur",t.layerBlur,i)}applyFillStroke(e){e.fillColor=this.fill.enabled?this.fill.color:Gt.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:Gt.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=Gt.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=Gt.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: 17,288 bytes, lines 6671-6682
6671))}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),e.type===0&&(Yt(e.path,["fill"])?this.fill.update(e.props):Yt(e.path,["stroke"])?this.stroke.update(e.props):Yt(e.path,["dropShadow"])?this.dropShadow.update(e.props):Yt(e.path,["innerShadow"])?this.innerShadow.update(e.props):Yt(e.path,["layerBlur"])?this.layerBlur.update(e.props):Yt(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 Yi(this.uuid,this.data,e);return t.parent=void 0,t}},I1=class extends Yi{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 qX(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 I1(this.uuid,this.data,e);return t.parent=void 0,t}},Pd=class extends Yi{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 Pd(this.uuid,this.data,e);return t.parent=void 0,t}},O1=class extends Yi{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:Gt.transparent,e.strokeColor=this.stroke.enabled&&this.stroke.thickness>0?this.stroke.color:Gt.transparent,e.strokeMode="center",e.lineWidth=this.stroke.thickness}innerDraw(e){var a;(a=this._fontHolder)!=null&&a.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 O1(this.uuid,this.data,e);return t.parent=void 0,t}},uT=class extends Yi{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=>wf.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,[d,u]=a.position,p={start:n.position,cp1:n.controlNext.position,cp2:a.controlPrevious.position,end:a.position};wf.derive(p),e.bezierCurveTo(o,l,h,c,d,u)}}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 uT(this.uuid,this.data,e);return t.parent=void 0,t}},wf;(e=>{function t(n){let o=n.start,l=n.cp1,h=n.cp2,c=n.end,d=[3*(l[0]-o[0]),3*(l[1]-o[1])],u=[3*(h[0]-l[0]),3*(h[1]-l[1])],p=[3*(c[0]-h[0]),3*(c[1]-h[1])],f={start:d,cp:u,end:p};return n.derivative=f,f.derivative=J0.derive(f),f}e.derive=t;function i(n,o,l,h=!1){let c=n-2*o+l;if(c!==0){let d=-Math.sqrt(Math.abs(o*o-n*l)),u=-n+o,p=-(d+u)/c,f=-(-d+u)/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 d of o)h.push(e.compute(n,Math.min(1,Math.max(0,d)))[0]);for(let d of l)c.push(e.compute(n,Math.min(1,Math.max(0,d)))[1]);return h.sort((d,u)=>d-u),c.sort((d,u)=>d-u),[[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,d=h*l,u=h*o*3,p=l*c*3,f=o*c;return[d*n.start[0]+u*n.cp1[0]+p*n.cp2[0]+f*n.end[0],d*n.start[1]+u*n.cp1[1]+p*n.cp2[1]+f*n.end[1]]}e.compute=a})(wf||(wf={}));var J0;(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=$0.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,d=l;return[h*s.start[0]+c*s.cp[0]+d*s.end[0],h*s.start[1]+c*s.cp[1]+d*s.end[1]]}e.compute=r})(J0||(J0={}));var $0;(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})($0||($0={}));var ma=class extends Is{constructor(e,t,i){super(e,t,i),this.uuid=e,this.width=0,this.height=0,this.clipped=!0,this.background=new Pd(e+"-background",od.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(){var e;super.updateLocalMatrix(),(e=this.background)==null||e.updateLocalMatrix()}updateWorldMatrix(e,t,i){var r;super.updateWorldMatrix(e,t,i),(r=this.background)==null||r.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&&(Yt(e.path,["fill"])?this.fill.update(e.props):Yt(e.path,["stroke"])?this.stroke.update(e.props):Yt(e.path,["dropShadow"])?this.dropShadow.update(e.props):Yt(e.path,["innerShadow"])?this.innerShadow.update(e.props):Yt(e.path,["layerBlur"])?this.layerBlur.update(e.props):Yt(e.path,["backgroundBlur"])?this.backgroundBlur.update(e.props):this.resetBBoxNeedsUpdate())}clone(e){let t=new ma(this.uuid,this.data,e);t.parent=void 0;for(let i of this.children)t.add(i.clone(e));return t}},eY=eo(mM(),1),Kf=class extends Yi{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=document.createElementNS("http://www.w3.org/2000/svg","svg"),t=document.createElementNS("http://www.w3.org/2000/svg","path");document.body.appendChild(e),t.setAttribute("d",this.path),e.appendChild(t),this._pathBBox=t.getBBox(),e.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 Kf(this.uuid,this.data,e);return t.parent=void 0,t}};function tY(e,t=1,i=1){if(t<=0||i<=0)return e;let r=(0,eY.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 iY(r)}function iY(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 rY(e,t,i){switch(t.type){case"ellipse2d":return new I1(e,t,i);case"rectangle2d":return new Pd(e,t,i);case"text2d":return new O1(e,t,i);case"vector2d":return new uT(e,t,i);case"path2d":return new Kf(e,t,i);case"frame2d":return new ma(e,t,i);case"group2d":default:return new Jn(e,t,i)}}var pT=class{constructor(e,t,i){this.uuid=e,this.data=t,this.group=new Jn(pT.GROUP_ID,{...df.defaultData},i),this.createChildrenObjects(t.objects,this.group,i)}createObject(e,t,i,r,s,a){let n=rY(e,t,a);n&&(r.add(n),r.children.splice(s,0,r.children.pop()),n.updateWorldMatrix(),i.length>0&&(n instanceof Jn||n instanceof ma)&&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 Is&&(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 Is){let r=i.parent;i.resetBBoxNeedsUpdate(),r==null||r.remove(i),r==null||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 Is||s===this){s.add(i);let a=e.localIndex;s.children.splice(a,0,s.children.pop()),i.updateWorldMatrix(!0,!1,!0),r==null||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)=>X2(i.sortKey,r.sortKey)),t.map(i=>i.entity)}},R1=pT;R1.GROUP_ID="scene2d";function fT({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,d=i-s,u=a,p=n,f=o[0],g=o[1];if(l!==0){if(l===1)f+=c;else if(l===3)f+=c/2;else if(l===2)u=Math.max(1,u+c);else if(l===4){let m=t/r;u*=m,f*=m}}if(h!==0){if(h===1)g+=d;else if(h===3)g+=d/2;else if(h===2)p=Math.max(1,p+d);else if(h===4){let m=i/s;p*=m,g*=m}}return{width:u,height:p,position:[f,g]}}eo(mM(),1);var sY=`
6672	varying vec2 vUv;
6673	void main() {
6674		vUv = uv;
6675		gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
6676	}`,aY=`
6677	uniform sampler2D tDiffuse;
6678	varying vec2 vUv;
6679	void main() {
6680		vec4 texel = texture2D( tDiffuse, vUv );
6681		gl_FragColor = texel;
6682	}`,nY=new Pf(-1,1,1,-1,0,1),oY=class extends je{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))}},lY=new oY,hY=class{constructor(e){this._mesh=new Zt(lY,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,nY)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}},mT=new Pt({defines:{},uniforms:{tDiffuse:new ve(null)},vertexShader:sY,fragmentShader:aY}),cY=new hY(mT),Ug=null,Ng=null,dY=()=>(Ug===null&&(Ug=document.createElement("canvas")),Ug),uY=e=>(Ng===null&&(Ng=new dT(e)),Ng),pY=Rt.identity(),gT=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=>{var a,n;if(((a=s.target)==null?void 0:a.uuid)!==void 0){let o=(n=this.frameRoot)==null?void 0:n.find(s.target.uuid);o&&o.dispatchEvent({...s,target:o})}},this.scene2d=new R1(Oe.generateUUID(),w0.defaultData,{dpr:window.devicePixelRatio,shared:r.shared}),this.canvas=dY(),this.renderer=uY(this.canvas),this.promise=this.init(),this.renderTarget=new Tt(1,1,{type:rn,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 HL(this.canvas)),this._canvasTexture}
6682async init(){this.renderer instanceof dT&&(this.renderer.wasmURL=kC.skiaWasmUrl),await this.renderer.init()}render(e){var t,i;if(this.isFrameDirty){this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),(t=this.frameOverride)==null||t.draw(this.renderer),this.renderer.render(),mT.uniforms.tDiffuse.value=this.canvasTexture,this.canvasTexture.needsUpdate=!0;let r=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.clear(),cY.render(e),e.setRenderTarget(r),(i=this.textureHolder)==null||i.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==null?void 0:e.width)??this.width,i=(e==null?void 0:e.height)??this.height;this.frameOverride.width=t,this.frameOverride.height=i,this.frameOverride.localMatrix=pY,this.isScreenSpace&&(this.frameOverride.fill.color=Gt.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:t,height:i},vT({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){var o,l;let i=Math.max(1,(e==null?void 0:e.width)??this.width),r=Math.max(1,(e==null?void 0: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),(o=this._canvasTexture)==null||o.dispose(),this._canvasTexture=void 0,this.applyOverrides(e),(l=this.frameOverride)==null||l.requestRender()}applyFrame(e){var i,r;let t=this.context.scene.find2D(e);if(!(!t||!(t instanceof ma)))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(),(i=this.frame)==null||i.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(s=>{s.addEventListener("beginState",this.onFrameOverrideObjectEvent)}),this.frameOverride.traverse(s=>{s.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),(r=this.frame)==null||r.requestRender(),t}get frame(){return this.frameOverride}get frameId(){var e;return(e=this.frame)==null?void 0:e.uuid}find(e){return this.scene2d.find(e)}get texture(){var e;return(e=this.textureHolder)==null?void 0:e.getTexture(1001)}disposeFrameOverride(){var e,t,i;(e=this.frameOverride)==null||e.removeEventListener("render",this.onRenderRequestedDownstream),(t=this.frameOverride)==null||t.traverse(r=>{r.removeEventListener("beginStateChange",this.onFrameOverrideObjectEvent)}),(i=this.frameOverride)==null||i.traverse(r=>{r.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function vT({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:a}){if(e instanceof ma&&t instanceof ma||e instanceof Jn&&t instanceof Jn)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&&mY({objectOverride:l,objectRoot:h,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:a})}}function fY(e){if(ey(e))return[e.width,e.height];if(e instanceof Kf){let[t,i]=e.getHalfSize();return[t*2,i*2]}else if(e instanceof Jn){let[t,i]=e.recursiveBBox.getHalfSize();return[t*2,i*2]}return[0,0]}function mY({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:a}){let[n,o]=fY(t),{width:l,height:h,position:c}=fT({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 d in e.states)gY({stateId:d,objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:s,initialParentHeight:a});if(ey(e)||e instanceof Jn)ey(e)&&(e.width=l,e.height=h,e.data={...e.data,width:l,height:h}),vT({objectOverride:e,objectRoot:t,newParentWidth:l,newParentHeight:h,initialParentWidth:n,initialParentHeight:o});else if(e instanceof Kf){let d=t,u=n!==0?l/n:1,p=o!==0?h/o:1;e.path=tY(d.path,u,p),e.data={...e.data,path:e.path}}}function gY({stateId:e,objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:s,initialParentWidth:a,initialParentHeight:n}){var h,c;let o=(h=t.states)==null?void 0:h[e],l=(c=i.states)==null?void 0:c[e];if(o&&l){let{width:d,height:u,position:p}=fT({constraints:t.data,newParentWidth:r,newParentHeight:s,initialParentWidth:a,initialParentHeight:n,objectInitialWidth:Uo.isResizeable(l)?l.width:0,objectInitialHeight:Uo.isResizeable(l)?l.height:0,objectInitialPosition:l.position});Object.assign(t.states[e],{position:p}),Uo.isResizeable(o)&&Object.assign(t.states[e],{width:d,height:u})}}function ey(e){return e instanceof Pd||e instanceof ma||e instanceof I1||e instanceof O1}var Xi=class extends l1(Gr){constructor(e,t,i){super(),this.data=t,this.bgColor=new dr(1,1,1,1),this.fog=null,this.backupFog=new VM(16777215,.1,2e3),this.fogUseBGColor=!1,this.isActive=!1,this.aoColor=new $e,this.penumbraSizeArrayCache=null,this.super_Entity(e,t),this.personalCamera=new yr(Fh,{...sd.defaultData,...t.camera,name:"Personal Camera"}),this.personalCamera.objectHelper.visible=!1,this.add(this.personalCamera),this.activeCamera=this.personalCamera,this.ambientLight=new DB(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 R1((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(){var e;return(e=this.uiCanvas)==null?void 0:e.frame}createUICanvas(e,t){this.uiCanvas=new gT(this.uuid+"-uiscreen",window.innerWidth,window.innerHeight,t),this.uiCanvas.isScreenSpace=!0,this.uiCanvas.promise.then(()=>{var i,r;
vendor: 21,862 bytes, lines 6682-6741
6682(i=this.uiCanvas)==null||i.applyFrame(e),(r=this.uiCanvas)==null||r.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=Dr(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 Yo&&t.recomputeBoolean()}),this.updateShadow(this.data.shadow)}forceMaterialsUpdate(){this.traverseEntity(e=>{if(e instanceof Nh)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&&RX(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=Dr(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far}updateAo(e,t){e.aoColor!==void 0&&(this.aoColor=Dr(e.aoColor,t))}updateByOp(e,t,i,r){let s=this.data.uiFrame;super.updateByOp(e,t,i,r);let a=t;Yt(e.path,["fog"])?this.updateFog(a.fog,i.shared):Yt(e.path,["ao"])?this.updateAo(a.ao,i.shared):Yt(e.path,["ambient"])?this.updateAmbientLight(a.ambient,i.shared):Yt(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(Dr(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(){var e;return((e=this.scene)==null?void 0:e.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 oT&&i.visible&&e<3&&(this.penumbraSizeArrayCache[e]=i.data.penumbraSize??.5,e+=1),i instanceof lT&&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;Ct.is(s)&&(s.visible||a!=null&&a.object.data.visible)&&((Ds(s)||H0(s)&&this.scene.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,t),ty(s,e,t,!0)),i(s))}};return i(this),t}updateEntity2DByOp(e,t,i,r){var s;(s=this.uiCanvas)==null||s.updateEntity2DByOp(e,t,i,r)}},vY=class extends T1(LB,sT){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 xi(s,a),o=new Bp(n,new $e(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 Bp){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))}},yY=class extends Ei{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(e,t){let i=this.geometry.getAttribute("position");i!==void 0?g1(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}},L1=class extends Ei{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(){var r;let e={...this.data.geometry.extrusion.shape};for(let s in e)typeof e[s]=="string"&&(e[s]=this._context.shared.getVariable(e[s],[this.uuid,"geometry","extrusion","shape",s]));let t;if(e.type==="Custom"){let s=e.shapeId;if(s!==this._shapeId&&this.detachShape(),s){this._shapeId=s;let a=this._context.scene.find(s);a!=null&&a.data&&(a.attachedPaths.add(this),t=(r=a.geometry.userData)==null?void 0:r.shape),t||this._context.scene.addPendingCommand(()=>this.updateShape())}}else{let s;switch(e.type){case"Rectangle":s=m1;break;case"Ellipse":s=f1;break;case"Polygon":s=eC;break;case"Star":s=tC;break;default:throw new Error(`Unknown shape type: ${e.type}`)}t=s.create({parameters:e}).userData.shape}let i=this.geometry;t&&i.inputs&&(i.inputs.shapeData=t,i.build())}detachShape(){var e;this._shapeId!==null&&((e=this._context.scene.find(this._shapeId))==null||e.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?g1(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,e,t):super.updateEntityBoxSize(e,t)}},B1=class extends C1{constructor(e,t,i){super(e,t,i),this.data=t}},lh=class extends Vh(Ka,Cd){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=of.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]=Hn.apply(i.data[a],e[a]));return this.overrideData=s,r}else return{...ki.defaultData,...e,...pa(ki.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(Ct.is(a))e.scene.disposeAndUnregisterEntityRecursivelyIfNotReregistered(a),z1(a),s+=1;else break;this.children.splice(0,s)}r=!0}if(i){let s={};yT(e,[this.uuid],t.overrides,this,i,i,0,r,s);for(let a of this.children)if(Ct.is(a)){let n=a.data;n.type==="Empty"&&n.animations&&a.traverseEntity(o=>{let l=o.dataPatched;if(o instanceof Ei&&l.bones&&l.boneInverses){let h=o.dataPatched;if(h.bones&&h.boneInverses){let c=h.bones.map(p=>e.scene.find(s[p])),d=h.boneInverses.map(p=>new be().fromArray(p)),u=new _y(c,d);o.bind(u,o.bindMatrix)}}else o.matrixAutoUpdate=!0})}}this.oldComponent=this.component}}};function z1(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)Ct.is(i)&&z1(i)}}function oA(e,t,i,r){return e.component===t&&Qy(e.identity,r)?e.overrideData===i?2:1:0}function yT(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 lh&&s.isInstanceRoot&&s.expandInstanceChildren(e);let h=0;for(let c of s.children)if(Ct.is(c)){let d=[...t,...typeof c.identity=="string"?[c.identity]:c.identity],u=rf.resolve(i,d,1);u!=null&&!(u instanceof Ti)&&(Object.setPrototypeOf(u,Ti.prototype),console.error("wrong prototype"));let p=null,f;if(!o){let g=r.children[h];if(p=Ct.is(g)?g:null,p!==null){let m=oA(p,c,u,d);f=m>=1?p.stateSelection:void 0,m!==2&&(p=null)}if(p===null&&(p=e.scene.findInstance(d)??null,p!==null)){let m=oA(p,c,u,d);if(f=m>=1?p.stateSelection:void 0,m!==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 g=u?Hn.apply(c.data,u):c.data;Wo.is(g.type)&&(g={...g,type:"Empty"}),p=Nn.createEntity(d,g,e),p.overrideData=u,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 g=p.identity[p.identity.length-1];l[g]=p.uuid}h+=1,yT(e,t,i,p,c,a,n+1,o,l)}if(!o){let c=h;for(;;){let d=r.children[h];if(Ct.is(d))e.pendingDeletes.add(d);else break;h+=1}r.children.splice(c,h-c)}return!0}var xY=class extends Vh(jM,Cd){constructor(e,t){super(),this.super_Entity(e,t),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(e,t){this.updateState_Entity(e,t)}},gr=class extends Ei{constructor(e,t,i){super(e,t,i),this.onBeforeRender=r=>{this.uiCanvas.render(r)},this.uiCanvas=new gT(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==null?void 0:e.width)??this.dataPatched.geometry.width,r=(e==null?void 0: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){var i;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})}),(i=this.localGeometry)==null||i.dispose(),this.localGeometry=dd(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):Yt(t.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:r}))}get frame(){return this.uiCanvas.frame}get frameId(){var e;return(e=this.frame)==null?void 0:e.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)}},bY=class{constructor(e,t,i){this.variables=[],this.currentTextureIndex=0;let r=Vt,s=new Gr,a=new to;a.position.z=1;let n={passThruTexture:{value:null}},o=c(u(),n),l=new Zt(new ga(2,2),o);s.add(l),this.setDataType=function(p){return r=p,this},this.addVariable=function(p,f,g){let m=this.createShaderMaterial(f),v={name:p,initialValueTexture:g,material:m,dependencies:null,renderTargets:[],wrapS:null,wrapT:null,minFilter:wt,magFilter:wt};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 g=f.material,m=g.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}m[y.name]={value:null},g.fragmentShader=`
6683uniform sampler2D `+y.name+`;
6684`+g.fragmentShader}}return this.currentTextureIndex=0,null},this.compute=function(){let p=this.currentTextureIndex,f=this.currentTextureIndex===0?1:0;for(let g=0,m=this.variables.length;g<m;g++){let v=this.variables[g];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 g=p[f];g.initialValueTexture&&g.initialValueTexture.dispose();let m=g.renderTargets;for(let v=0;v<m.length;v++)m[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 g=new Pt({uniforms:f,vertexShader:d(),fragmentShader:p});return h(g),g}this.createShaderMaterial=c,this.createRenderTarget=function(p,f,g,m,v,y){return p=p||e,f=f||t,g=g||ii,m=m||ii,v=v||wt,y=y||wt,new Tt(p,f,{wrapS:g,wrapT:m,minFilter:v,magFilter:y,format:ri,type:r,depthBuffer:!1})},this.createTexture=function(){let p=new Float32Array(e*t*4),f=new Pr(p,e,t,ri,Vt);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 g=i.getRenderTarget(),m=i.xr.enabled,v=i.shadowMap.autoUpdate,y=i.outputEncoding,x=i.toneMapping;i.xr.enabled=!1,i.shadowMap.autoUpdate=!1,i.outputEncoding=Fs,i.toneMapping=ua,l.material=p,i.setRenderTarget(f),i.render(s,a),l.material=o,i.xr.enabled=m,i.shadowMap.autoUpdate=v,i.outputEncoding=y,i.toneMapping=x,i.setRenderTarget(g)};function d(){return`void main()	{
6685
6686	gl_Position = vec4( position, 1.0 );
6687
6688}
6689`}function u(){return`uniform sampler2D passThruTexture;
6690
6691void main() {
6692
6693	vec2 uv = gl_FragCoord.xy / resolution.xy;
6694
6695	gl_FragColor = texture2D( passThruTexture, uv );
6696
6697}
6698`}}},tr=new or,Qu=new M,wY=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)),tr.a.fromBufferAttribute(e,s),tr.b.fromBufferAttribute(e,s+1),tr.c.fromBufferAttribute(e,s+2),a*=tr.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),tr.a.fromBufferAttribute(this.positionAttribute,e*3),tr.b.fromBufferAttribute(this.positionAttribute,e*3+1),tr.c.fromBufferAttribute(this.positionAttribute,e*3+2),t.set(0,0,0).addScaledVector(tr.a,s).addScaledVector(tr.b,a).addScaledVector(tr.c,1-(s+a)),i!==void 0&&tr.getNormal(i),r!==void 0&&this.colorAttribute!==void 0&&(tr.a.fromBufferAttribute(this.colorAttribute,e*3),tr.b.fromBufferAttribute(this.colorAttribute,e*3+1),tr.c.fromBufferAttribute(this.colorAttribute,e*3+2),Qu.set(0,0,0).addScaledVector(tr.a,s).addScaledVector(tr.b,a).addScaledVector(tr.c,1-(s+a)),r.r=Qu.x,r.g=Qu.y,r.b=Qu.z),this}};function SY(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 _Y(e){let t=Math.ceil(Math.sqrt(e));return Math.max(t,1)}function AY(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 wY(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 lA(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 Pr(r,t,t,ri,Vt);return s.needsUpdate=!0,s}function MY({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 Pr(t,e,e,ri,Vt);return i.needsUpdate=!0,i}function EY(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 Pr(t,e,e,ri,Vt);return i.needsUpdate=!0,i}var CY=`
6699// uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU
6700// uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU
6701// uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU
6702uniform sampler2D uOriginalPosition;
6703uniform float uTime;
6704uniform float uSpeed;     // update speed of the particles
6705uniform vec3 uWorldOffset;    
6706uniform vec4 uWorldQuaternion;
6707uniform float uMaxLifeTime;
6708uniform vec3 uEmitterSize;
6709uniform float uFPSRatio;     // 1  for 60 FPS
6710
6711float random (vec2 st) {
6712    return fract(sin(dot(st.xy,
6713        vec2(12.9898,78.233)))*
6714        43758.5453123);
6715}
6716vec3 applyQuaternionToVector( vec4 q, vec3 v ){
6717    return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v );
6718}
6719
6720vec3 applyForce(vec3 force, float mass) {
6721    vec3 acceleration = force / mass;
6722    
6723    return acceleration;
6724  }
6725  
6726
6727void main() {
6728    vec2 vUv = gl_FragCoord.xy / resolution.xy;
6729    vec3 position = texture2D( uCurrentPosition, vUv ).xyz;
6730    float currentLife = texture2D( uCurrentPosition, vUv ).w;   // from 1 to 0
6731    float isSpawning = texture2D( uCurrentEmissionRate, vUv ).r;        // 1. = spawning, 0. = not spawning
6732    float isActive = texture2D( uCurrentEmissionRate, vUv ).g;          // 1. = active, 0. = not active
6733    float timeStart = texture2D( uCurrentEmissionRate, vUv ).b;         // timeStart in seconds when the particle was emitted
6734    vec3 originalPosition = ((texture2D( uOriginalPosition, vUv ).xyz) * uEmitterSize);
6735    vec3 velocity = texture2D( uCurrentVelocity, vUv ).xyz;
6736    float collisionFlag = texture2D( uCurrentVelocity, vUv ).w;             // 1. = collided, 0. = not collided
6737    float lifeTime = uMaxLifeTime;
6738
6739    // Calculate the position adjustment based on collision
6740    //     if (collisionFlag > .5) {  
6741    float isColliding = step(0.5, collisionFlag);
6741 // 1.0 if collisionFlag > 0.5, otherwise 0.0
6742    float bounceOffset = 3.0 * isColliding; // Becomes 3.0 if colliding, 0.0 otherwise
6743    vec3 collisionAdjustedVelocity = velocity * (1.0 + bounceOffset);
6744
6745    // Update position based on collision or normal movement
6746    vec3 fpsVelocity = velocity * min(uFPSRatio, 5.0);
6747    position += mix(fpsVelocity, collisionAdjustedVelocity, isColliding);
6748
6749    // EMISSION RATE - BIRTH
6750    // if (isSpawning == 1.0) {
6751    // Better Approach to avoid If statement
6752    vec3 newPosition = applyQuaternionToVector(uWorldQuaternion, originalPosition) + uWorldOffset;
6753    originalPosition = mix(originalPosition, newPosition, isSpawning);
6754    position = mix(position, originalPosition, isSpawning);;
6755    timeStart = mix(timeStart, uTime, isSpawning);
6756
6757    // Calculate timeLeft for life normalization
6758    float timeLeft = max(lifeTime - (uTime - timeStart), 0.0);
6759    float life_Normalize = timeLeft / lifeTime;
6760
6761    // Use isActive to blend between the calculated color and black
6762    vec4 activeColor = vec4(position, life_Normalize);
6763    // if (isActive == 1.0) {
6764    gl_FragColor = mix(vec4(0.0), activeColor, isActive);
6765
6766}
6767`,TY=`
6768
6769    vec3 mod289(vec3 x) {
6770      return x - floor(x * (1.0 / 289.0)) * 289.0;
6771    }
6772    
6773    vec4 mod289(vec4 x) {
6774    return x - floor(x * (1.0 / 289.0)) * 289.0;
6775    }
6776    
6777    vec4 permute(vec4 x) {
6778        return mod289(((x*34.0)+1.0)*x);
6779    }
6780    
6781    vec4 taylorInvSqrt(vec4 r)
6782    {
6783    return 1.79284291400159 - 0.85373472095314 * r;
6784    }
6785    
6786    vec3 fade(vec3 t) {
6787  return t*t*t*(t*(t*6.0-15.0)+10.0);
6788}
6789
6790    float snoise(vec3 v)
6791    {
6792    const vec2  C = vec2(1.0/6.0, 1.0/3.0) ;
6793    const vec4  D = vec4(0.0, 0.5, 1.0, 2.0);
6794    vec3 i  = floor(v + dot(v, C.yyy) );
6795    vec3 x0 =   v - i + dot(i, C.xxx) ;
6796    vec3 g = step(x0.yzx, x0.xyz);
6797    vec3 l = 1.0 - g;
6798    vec3 i1 = min( g.xyz, l.zxy );
6799    vec3 i2 = max( g.xyz, l.zxy );
6800    vec3 x1 = x0 - i1 + C.xxx;
6801    vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y
6802    vec3 x3 = x0 - D.yyy;      // -1.0+3.0*C.x = -0.5 = -D.y
6803    
6804    // Permutations
6805    i = mod289(i);
6806    vec4 p = permute( permute( permute(
6807                i.z + vec4(0.0, i1.z, i2.z, 1.0 ))
6808              + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))
6809              + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
6810    
6811    // Gradients: 7x7 points over a square, mapped onto an octahedron.
6812    // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
6813    float n_ = 0.142857142857; // 1.0/7.0
6814    vec3  ns = n_ * D.wyz - D.xzx;
6815    
6816    vec4 j = p - 49.0 * floor(p * ns.z * ns.z);  //  mod(p,7*7)
6817    
6818    vec4 x_ = floor(j * ns.z);
6819    vec4 y_ = floor(j - 7.0 * x_ );    // mod(j,N)
6820    
6821    vec4 x = x_ *ns.x + ns.yyyy;
6822    vec4 y = y_ *ns.x + ns.yyyy;
6823    vec4 h = 1.0 - abs(x) - abs(y);
6824    
6825    vec4 b0 = vec4( x.xy, y.xy );
6826    vec4 b1 = vec4( x.zw, y.zw );
6827    
6828    vec4 s0 = floor(b0)*2.0 + 1.0;
6829    vec4 s1 = floor(b1)*2.0 + 1.0;
6830    vec4 sh = -step(h, vec4(0.0));
6831    
6832    vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;
6833    vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;
6834    
6835    vec3 p0 = vec3(a0.xy,h.x);
6836    vec3 p1 = vec3(a0.zw,h.y);
6837    vec3 p2 = vec3(a1.xy,h.z);
6838    vec3 p3 = vec3(a1.zw,h.w);
6839    
6840    //Normalise gradients
6841    vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
6842    p0 *= norm.x;
6843    p1 *= norm.y;
6844    p2 *= norm.z;
6845    p3 *= norm.w;
6846    
6847    // Mix final noise value
6848    vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
6849    m = m * m;
6850    return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
6851                                  dot(p2,x2), dot(p3,x3) ) );
6852    }
6853    
6854    vec3 snoiseVec3( vec3 x ){
6855    
6856      float s  = snoise(vec3( x ));
6857      float s1 = snoise(vec3( x.y - 19.1 , x.z + 33.4 , x.x + 47.2 ));
6858      float s2 = snoise(vec3( x.z + 74.2 , x.x - 124.5 , x.y + 99.4 ));
6859      vec3 c = vec3( s , s1 , s2 );
6860      return c;
6861    
6862    }
6863    
6864      
6865    vec3 curlNoise( vec3 p, float seed){
6866      p += seed;
6867      const float e = .1;
6868      vec3 dx = vec3( e   , 0.0 , 0.0 );
6869      vec3 dy = vec3( 0.0 , e   , 0.0 );
6870      vec3 dz = vec3( 0.0 , 0.0 , e   );
6871    
6872      vec3 p_x0 = snoiseVec3( p - dx );
6873      vec3 p_x1 = snoiseVec3( p + dx );
6874      vec3 p_y0 = snoiseVec3( p - dy );
6875      vec3 p_y1 = snoiseVec3( p + dy );
6876      vec3 p_z0 = snoiseVec3( p - dz );
6877      vec3 p_z1 = snoiseVec3( p + dz );
6878    
6879      float x = p_y1.z - p_y0.z - p_z1.y + p_z0.y;
6880      float y = p_z1.x - p_z0.x - p_x1.z + p_x0.z;
6881      float z = p_x1.y - p_x0.y - p_y1.x + p_y0.x;
6882    
6883      const float divisor = 1.0 / ( 2.0 * e );
6884      return normalize( vec3( x , y , z ) * divisor );
6885    
6886    }
6887
6888
6889// Classic Perlin noise
6890float cnoise(vec3 P)
6891{
6892  vec3 Pi0 = floor(P); // Integer part for indexing
6893  vec3 Pi1 = Pi0 + vec3(1.0); // Integer part + 1
6894  Pi0 = mod289(Pi0);
6895  Pi1 = mod289(Pi1);
6896  vec3 Pf0 = fract(P); // Fractional part for interpolation
6897  vec3 Pf1 = Pf0 - vec3(1.0); // Fractional part - 1.0
6898  vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
6899  vec4 iy = vec4(Pi0.yy, Pi1.yy);
6900  vec4 iz0 = Pi0.zzzz;
6901  vec4 iz1 = Pi1.zzzz;
6902
6903  vec4 ixy = permute(permute(ix) + iy);
6904  vec4 ixy0 = permute(ixy + iz0);
6905  vec4 ixy1 = permute(ixy + iz1);
6906
6907  vec4 gx0 = ixy0 * (1.0 / 7.0);
6908  vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;
6909  gx0 = fract(gx0);
6910  vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);
6911  vec4 sz0 = step(gz0, vec4(0.0));
6912  gx0 -= sz0 * (step(0.0, gx0) - 0.5);
6913  gy0 -= sz0 * (step(0.0, gy0) - 0.5);
6914
6915  vec4 gx1 = ixy1 * (1.0 / 7.0);
6916  vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;
6917  gx1 = fract(gx1);
6918  vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);
6919  vec4 sz1 = step(gz1, vec4(0.0));
6920  gx1 -= sz1 * (step(0.0, gx1) - 0.5);
6921  gy1 -= sz1 * (step(0.0, gy1) - 0.5);
6922
6923  vec3 g000 = vec3(gx0.x,gy0.x,gz0.x);
6924  vec3 g100 = vec3(gx0.y,gy0.y,gz0.y);
6925  vec3 g010 = vec3(gx0.z,gy0.z,gz0.z);
6926  vec3 g110 = vec3(gx0.w,gy0.w,gz0.w);
6927  vec3 g001 = vec3(gx1.x,gy1.x,gz1.x);
6928  vec3 g101 = vec3(gx1.y,gy1.y,gz1.y);
6929  vec3 g011 = vec3(gx1.z,gy1.z,gz1.z);
6930  vec3 g111 = vec3(gx1.w,gy1.w,gz1.w);
6931
6932  vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
6933  g000 *= norm0.x;
6934  g010 *= norm0.y;
6935  g100 *= norm0.z;
6936  g110 *= norm0.w;
6937  vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
6938  g001 *= norm1.x;
6939  g011 *= norm1.y;
6940  g101 *= norm1.z;
6941  g111 *= norm1.w;
6942
6943  float n000 = dot(g000, Pf0);
6944  float n100 = dot(g100, vec3(Pf1.x, Pf0.yz));
6945  float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z));
6946  float n110 = dot(g110, vec3(Pf1.xy, Pf0.z));
6947  float n001 = dot(g001, vec3(Pf0.xy, Pf1.z));
6948  float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z));
6949  float n011 = dot(g011, vec3(Pf0.x, Pf1.yz));
6950  float n111 = dot(g111, Pf1);
6951
6952  vec3 fade_xyz = fade(Pf0);
6953  vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z);
6954  vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
6955  float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); 
6956  return 2.2 * n_xyz;
6957}
6958
6959
6960vec3 fbm_vec3(vec3 p, float frequency, float offset)
6961{
6962  return vec3(
6963    cnoise((p+vec3(offset))*frequency),
6964    cnoise((p+vec3(offset+20.0))*frequency),
6965    cnoise((p+vec3(offset-30.0))*frequency)
6966  );
6967}
6968
6969`,PY=`
6970  #ifdef USE_COLLIDER
6971    float restitution = max(uBounce * 2., .01); // Energy Loss
6972    // SPHERE COLLIDER
6973    // **************************************************************
6974    #ifdef USE_SPHERE_COLLIDER       
6975      // Convert collider size to radii (assuming uColliderSize is the diameter in each axis)
6976      vec3 radii = uColliderSize;
6977      // Adjust position relative to collider
6978      vec3 relPos = position - uColliderPos;
6979      // Apply rotation of the collider to the relative position
6980      relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos);            
6981      // Scale relative position by radii (for ellipsoid collision detection)
6982      vec3 scaledPos = relPos / radii;
6983      // Calculate ellipsoidal distance
6984      float dist = length(scaledPos); // Distance in terms of ellipsoid
6985      
6986      // Check for collision
6987      if (dist <= 1. + particleSize / length(radii) && collisionFlag == 0.0) {
6988          // Compute the normal at the collision point, accounting for particle size
6989        vec3 adjustedPos = scaledPos * (1.0 + particleSize / length(radii));          
6990        // Compute the normal at the collision point
6991        vec3 normal = ellipsoidNormal(adjustedPos, radii);
6992        // Rotate the normal back to world space
6993        normal = applyQuaternionToVector(uColliderQuaternion, normal);
6994        // Reflect the velocity vector off the normal
6995        velocity = reflect(velocity, normal) * restitution;
6996
6997        collisionFlag = 1.0;
6998      } else {
6999        collisionFlag = 0.0;
7000      }
7001    #endif
7002
7003    // BOX COLLIDER or PLANE COLLIDER 
7004    // **************************************************************
7005    #ifdef USE_BOX_COLLIDER
7006      // Box dimensions and repulsion variables
7007      vec3 boxHalfSize = uColliderSize / 2.0;
7008      // Convert world position to box's local space
7009      vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos);      
7010      // Collision detection
7011      vec3 localDistance = abs(localPos) - boxHalfSize;
7012      float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z));    
7013
7014      // Collision Detected
7015      if (distToSurface <= particleSize * 0.5 && collisionFlag == 0.0) {      
7016        // Find the nearest face normal for bounce direction
7017        vec3 normal;
7018        if (localDistance.x > localDistance.y && localDistance.x > localDistance.z) {
7019            normal = vec3(sign(localPos.x), 0.0, 0.0);
7020        } else if (localDistance.y > localDistance.z) {
7021            normal = vec3(0.0, sign(localPos.y), 0.0);
7022        } else {
7023            normal = vec3(0.0, 0.0, sign(localPos.z));
7024        }            
7025        // Rotate normal back to world space
7026        normal = applyQuaternionToVector(uColliderQuaternion, normal);      
7027        // Reflect velocity and apply repulsion force
7028        velocity = reflect(velocity, normal) * restitution;
7029        
7030        collisionFlag = 1.0;
7031      } else {
7032        collisionFlag = 0.0;
7033      }
7034    #endif      
7035  #endif      
7036  // END COLLIDER    
7037`,DY=`
7038  #ifdef USE_ATTRACTOR
7039
7040      #ifdef USE_SPHERE_COLLIDER      
7041        // Convert collider size to radii (assuming uColliderSize is the diameter in each axis)
7042        vec3 radii = uColliderSize;
7043        // Adjust position relative to collider
7044        vec3 relPos = position - uColliderPos;
7045        // Apply rotation of the collider to the relative position
7046        relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos);            
7047        // Scale relative position by radii (for ellipsoid collision detection)
7048        vec3 scaledPos = relPos / radii;
7049        // Calculate ellipsoidal distance
7050        float distToSurface = length(scaledPos); // Distance in terms of ellipsoid
7051        float insideCheck = 1.0;
7052
7053      #endif
7054
7055
7056      #ifdef USE_BOX_COLLIDER
7057        // Box dimensions
7058        vec3 boxHalfSize = uColliderSize / 2.0;
7059        // Convert world position to box's local space
7060        vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos);      
7061        vec3 localDistance = abs(localPos) - boxHalfSize;
7062        float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z));
7063        float insideCheck = particleSize;
7064      #endif      
7065  
7066      // Apply vortex force inside the Helper
7067      #ifdef USE_FORCE_LOCAL_SPACE
7068        if (distToSurface <= insideCheck ) {    
7069            // Define parameters for the attractor field
7070            #ifdef USE_SPHERE_COLLIDER      
7071              float attractorStrength = (1.0 - distToSurface ) * uForceIntensity; // Adjust as needed
7072            #endif
7073
7074            #ifdef USE_BOX_COLLIDER
7075              float attractorStrength = max((1.0 - insideCheck / distToSurface), 0.) * uForceIntensity; // Adjust as needed
7076              #endif
7077
7078            float attractorDamping = uForceDamping;  // Adjust as needed (higher values will attenuate velocity more)
7079          
7080            // Use the same radii calculation code as for the collider
7081            vec3 attractorRadii = uColliderSize;
7082            // Adjust position relative to attractor center
7083            vec3 relPos = position - uColliderPos;
7084            // Apply rotation of the collider to the relative position
7085            relPos = applyQuaternionToVector(uColliderQuaternionInvert, relPos);            
7086            // Scale relative position by radii (for ellipsoid attraction)
7087            vec3 scaledPos = relPos / attractorRadii;
7088
7089            // Calculate ellipsoidal distance as attractor radius
7090            float attractorRadius = length(scaledPos);
7091            // Calculate the distance from the attractor center
7092            vec3 relativePosition = position - uColliderPos;
7093            // Calculate the force vector towards the attractor center
7094            vec3 attractorForce = normalize(relativePosition) * attractorStrength;
7095            // Apply the attractor force to the particle
7096            velocity -= attractorForce;
7097            // Attenuate the particle's velocity
7098            velocity *= attractorDamping;
7099        }
7100      #else 
7101            // Calculate the distance from the attractor center
7102            vec3 relativePosition = position - uColliderPos;
7103            // Calculate the force vector towards the attractor center
7104            vec3 attractorForce = normalize(relativePosition) * uForceIntensity;
7105            // Apply the attractor force to the particle
7106            velocity -= attractorForce;
7107            // Attenuate the particle's velocity
7108            velocity *= uForceDamping;
7109      #endif    
7110  #endif      
7111`,IY=`
7112  #ifdef USE_VORTEX
7113    // Box dimensions
7114    vec3 boxHalfSize = uColliderSize / 2.0;
7115    // Convert world position to box's local space
7116    vec3 localPos = applyQuaternionToVector(uColliderQuaternionInvert, position - uColliderPos);      
7117    vec3 localDistance = abs(localPos) - boxHalfSize;
7118    float distToSurface = max(localDistance.x, max(localDistance.y, localDistance.z));
7119
7120    // Apply vortex force inside the box
7121    if (distToSurface <= particleSize) {
7122      float vortexStrength = uForceIntensity;
7123      vec3 localTopCenter = vec3(0.0, 0., 0.0);
7124
7125      // Transform the local top center to the world space
7126      vec3 vortexCenter = uColliderPos + applyQuaternionToVector(uColliderQuaternion, localTopCenter);
7127      // Calculate the vector from particle to vortex center
7128      vec3 vortexVector = vortexCenter - position;
7129
7130      // Calculate the rotation axis from the inverse of the collider's quaternion and the fixed up vector
7131      // Note: important to add a tiny z component to the up vector to avoid instability
7132      vec3 upVector = vec3(0.0, 1.0, 0.01);
7133      vec3 rotationAxis = cross(upVector, applyQuaternionToVector(uColliderQuaternion, vortexVector));
7134      rotationAxis = normalize(rotationAxis);
7135
7136      // Add rotational component to velocity
7137      float rotationSpeed = length(vortexVector * vortexStrength * 3.0) ; 
7138
7139      vec3 rotationVelocity = rotationAxis * rotationSpeed;
7140      // velocity += rotationVelocity * 0.005 ;
7141      velocity = rotationVelocity * 0.005 ;
7142
7143      // Calculate vortex force
7144      // vec3 vortexForce = normalize(vortexVector) * uSpeed * .1 ;
7145      // Apply the vortex force to the particle
7146      vec3 originDirection = applyQuaternionToVector(uWorldQuaternion, directions);
7147      velocity += applyForce( originDirection * uSpeed * (1. - uForceDamping) , mass * .5);
7148    }
7149  #endif      
7150`,OY=`
7151// uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU
7152// uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU
7153// uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU
7154uniform sampler2D uOriginalPosition;
7155uniform sampler2D uDirections;     
7156uniform vec3 uDirectionsAxis;
7157uniform vec4 uWorldQuaternion;
7158uniform vec3 uGravity;        
7159uniform float uNoiseStrength;     // Variation of the noise
7160uniform float uNoiseScale;        // Scale of the noise
7161uniform float uNoiseSeed;         // Seed of the noise
7162uniform float particleSize;
7163uniform float uSpeed;     // update speed of the particles
7164uniform float uRandomMassFactor;
7165
7166// COLLIDER
7167uniform vec3 uColliderPos;                // Collider Position
7168uniform vec3 uColliderSize;               // Collider Dimension
7169uniform vec4 uColliderQuaternion;         // Collider Rotation
7170uniform vec4 uColliderQuaternionInvert;   // Collider Rotation
7171uniform float uBounce;                    // Bounce factor
7172uniform float uForceDamping;
7173uniform float uForceIntensity;
7174
7175
7176`+TY+`
7177float rand(vec2 co){
7178    return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);
7179}
7180vec3 applyQuaternionToVector( vec4 q, vec3 v ){
7181    return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v );
7182 } 
7183vec3 applyForce(vec3 force, float mass) {
7184  vec3 acceleration = force / mass;
7185  
7186  return acceleration;
7187}
7188
7189vec4 conjugate(vec4 q) {
7190  return vec4(q.w, -q.x, -q.y, -q.z);
7191}
7192
7193// Function to compute the normal of the ellipsoid at a given point
7194vec3 ellipsoidNormal(vec3 p, vec3 radii) {
7195  return normalize(p / (radii * radii));
7196}
7197
7198float friction = .3;
7199
7200void main() {
7201    vec2 vUv = gl_FragCoord.xy / resolution.xy;
7202    vec3 position = texture2D( uCurrentPosition, vUv ).xyz;
7203    vec3 originalPosition = texture2D( uOriginalPosition, vUv ).xyz;
7204    float timeLeft = texture2D( uCurrentPosition, vUv ).w;
7205    vec3 directions = texture2D( uDirections, vUv ).xyz;    
7206    vec3 velocity = texture2D( uCurrentVelocity, vUv ).xyz;
7207    float mass = rand(originalPosition.xy) * 0.5 + 0.5;
7208    float isSpawning = texture2D( uCurrentEmissionRate, vUv ).x;        // 1. = spawning, 0. = not spawning
7209    float isActive = texture2D( uCurrentEmissionRate, vUv ).y;          // 1. = active, 0. = not active
7210    float collisionFlag =texture2D( uCurrentVelocity, vUv ).w;          // Indicate collision
7211
7212    // Randomness Mass
7213    mass = (1.0 - (uRandomMassFactor * mass));
7214    
7215    if (isActive == 1.0) {
7216      // **************************************************************
7217      // FORCES NOISES
7218      // **************************************************************
7219      #ifdef USE_CURL_NOISE
7220        if (uNoiseScale > 0.0 ) {
7221          velocity = curlNoise(position * uNoiseScale * .002, uNoiseSeed) * ( uNoiseStrength + 1.0) * .05 * uSpeed;
7222        }
7223        // Variation of the noise Over Time
7224        if (uNoiseStrength > 0.0 && uNoiseScale == 0.0 ) {
7225          velocity += curlNoise( position, uNoiseSeed)  * uNoiseStrength * 0.05 * uSpeed;
7226        }
7227      #endif
7228      // **************************************************************
7229      #ifdef USE_SIMPLEX_NOISE
7230        if (uNoiseScale > 0.0 ) {
7231          velocity = vec3(snoise(position * uNoiseScale * .001) * ( uNoiseStrength + 1.0) * .1);
7232          velocity *= uSpeed;
7233        }
7234        // Variation of the noise Over Time
7235        if (uNoiseStrength > 0.0 && uNoiseScale == 0.0) {
7236          velocity += vec3(snoise(position * uNoiseStrength * .001) * .05 * uSpeed);
7237        }
7238      #endif
7239      // ************************************************************** 
7240      #ifdef USE_FBM_NOISE
7241        if (uNoiseScale > 0.0 ) {
7242          velocity = fbm_vec3(position * uNoiseScale * .001, ( uNoiseStrength + 1.0), uNoiseSeed);
7243          velocity *= uSpeed;
7244        }
7245        // Variation of the noise Over Time
7246        if (uNoiseStrength > 0.0 && uNoiseScale == 0.0 ) {      
7247          velocity += fbm_vec3(position * uNoiseStrength * .001, ( uNoiseStrength + 1.0), uNoiseSeed) * .1 * uSpeed;
7248        }
7249      #endif
7250
7251      // COLLIDER
7252      ${PY}
7253      // ATTRACTION
7254      ${DY}  
7255      // VORTEX
7256      ${IY}
7257    } 
7258    // End isActive
7259
7260    // SPAWN BIRTH 
7261    // **************************************************************
7262    // if (isSpawning == 1.)
7263    #ifdef USE_NORMALS
7264      velocity = mix(velocity, applyQuaternionToVector(uWorldQuaternion, directions) * uSpeed, isSpawning);
7265    #else
7266      velocity = mix(velocity, applyQuaternionToVector(uWorldQuaternion, uDirectionsAxis) * uSpeed, isSpawning);    
7267    #endif
7268    
7269    // if (collisionFlag == 0.0)
7270    velocity += applyForce(uGravity, mass * .5) * (1.0 - collisionFlag);
7271
7272    gl_FragColor = vec4(velocity, collisionFlag);
7273}
7274`,xT=`
7275
7276  // Linear Fade In
7277  float linearFadeIn(float t) {
7278    return t;
7279  }
7280
7281
7282  // linear fade out
7283  float linearFadeOut(float t) {
7284    return 1.0 - t;
7285  }
7286  
7287  float linearInOut(float t) {
7288    return t < 0.5 ? t :  (1.0 - t);  
7289  }
7290
7291    // lerp
7292    float lerp(float a, float b, float t) {
7293      return a + (b - a) * t;
7294    }
7295
7296  // Ease In Out Quart
7297  float exponentialInOut(float t) {
7298    return t < 0.4 ? lerp(0.0, 1.0, t / 0.4) :
7299    t > 0.6 ? lerp(1.0, 0.0, (t - 0.6) / 0.4) :
7300    1.0;
7301   }
7302
7303  // constant
7304  float constant(float t) {
7305    return 1.0;
7306  } 
7307`,RY=`
7308
7309float rand(vec3 co){
7310  return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
7311}
7312
7313vec3 applyQuaternionToVector( vec4 q, vec3 v ){
7314  return v + 2.0 * cross( q.xyz, cross( q.xyz, v ) + q.w * v );
7315}
7316
7317vec3 applyForce(vec3 force, float mass) {
7318  vec3 acceleration = force / mass;
7319    
7320  return acceleration;
7321}
7322`,LY=`
7323vec3 rgb2xyz (in vec3 rgb) {
7324    float r = rgb.r;
7325	float g = rgb.g;
7326	float b = rgb.b;
7327
7328	r = r > 0.04045 ? pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
7329	g = g > 0.04045 ? pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
7330	b = b > 0.04045 ? pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
7331
7332	float x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
7333	float y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
7334	float z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
7335    
7336    vec3 xyz = vec3(
7337        (r * 0.4124) + (g * 0.3576) + (b * 0.1805) * 100.0,
7338        (r * 0.2126) + (g * 0.7152) + (b * 0.0722) * 100.0,
7339        (r * 0.0193) + (g * 0.1192) + (b * 0.9505) * 100.0
7340    );
7341    return(xyz);
7342}
7343
7344vec3 xyz2lab (in vec3 xyz) {
7345	float x = xyz.x / 95.047;
7346	float y = xyz.y / 100.0;
7347	float z = xyz.z / 108.883;
7348
7349	x = x > 0.008856 ? pow(x, 1.0 / 3.0) : (7.787 * x) + (16.0 / 116.0);
7350	y = y > 0.008856 ? pow(y, 1.0 / 3.0) : (7.787 * y) + (16.0 / 116.0);
7351	z = z > 0.008856 ? pow(z, 1.0 / 3.0) : (7.787 * z) + (16.0 / 116.0);
7352
7353    vec3 lab = vec3((116.0 * y) - 16.0, 500.0 * (x - y), 200.0 * (y - z));
7354    return(lab);
7355}
7356
7357vec3 rgb2lab(in vec3 rgb) {
7358    vec3 xyz = rgb2xyz(rgb);
7359    vec3 lab = xyz2lab(xyz);
7360    return(lab);
7361}
7362
7363vec3 xyz2rgb (in vec3 xyz) {
7364	float x = xyz.x / 100.0;
7365	float y = xyz.y / 100.0;
7366	float z = xyz.z / 100.0;
7367	
7368    
7369	float r = (x *  3.2406) + (y * -1.5372) + (z * -0.4986);
7370	float g = (x * -0.9689) + (y *  1.8758) + (z *  0.0415);
7371	float b = (x *  0.0557) + (y * -0.2040) + (z *  1.0570);
7372
7373	r = r > 0.0031308 ? ((1.055 * pow(r, 1.0 / 2.4)) - 0.055) : r * 12.92;
7374	g = g > 0.0031308 ? ((1.055 * pow(g, 1.0 / 2.4)) - 0.055) : g * 12.92;
7375	b = b > 0.0031308 ? ((1.055 * pow(b, 1.0 / 2.4)) - 0.055) : b * 12.92;
7376
7377	r = min(max(0.0, r), 1.0);
7378	g = min(max(0.0, g), 1.0);
7379	b = min(max(0.0, b), 1.0);
7380
7381	return(vec3(r, g, b));
7382}
7383
7384vec3 lab2xyz (in vec3 lab) {
7385    float l = lab.x;
7386	float a = lab.y;
7387	float b = lab.z;
7388
7389  	float y = (l + 16.0) / 116.0;
7390	float x = a / 500.0 + y;
7391	float z = y - b / 200.0;
7392
7393	float y2 = pow(y, 3.0);
7394	float x2 = pow(x, 3.0);
7395	float z2 = pow(z, 3.0);
7396
7397  	y = y2 > 0.008856 ? y2 : (y - 16.0 / 116.0) / 7.787;
7398	x = x2 > 0.008856 ? x2 : (x - 16.0 / 116.0) / 7.787;
7399	z = z2 > 0.008856 ? z2 : (z - 16.0 / 116.0) / 7.787;
7400
7401	x *= 95.047;
7402	y *= 100.0;
7403	z *= 108.883;
7404
7405	return(vec3(x, y, z));
7406}
7407vec3 lab2rgb (in vec3 lab) {
7408    vec3 xyz = lab2xyz(lab);
7409    vec3 rgb = xyz2rgb(xyz);
7410    return(rgb);
7411}
7412
7413`,BY=`
7414  uniform sampler2D uPosition;
7415  uniform float uSize;
7416  uniform float uSizeEnd;
7417  uniform vec3 uWorldOffset;
7418  uniform vec4 uWorldQuaternion;
7419  // Billboard Behavior - Currently at Zero, but we can change that
7420  uniform float uRotation;
7421  uniform float uRotationEnd;
7422  uniform vec2 center;
7423
7424  // Randomness
7425  uniform float uRandScaleFactor;
7426  uniform float uRandRotationFactor;
7427
7428  attribute vec2 ref;
7429
7430  varying float v_LifeLeft;    // normalized lifetime 1 to 0
7431  varying vec2 vUv;
7432  varying vec2 vRef;
7433
7434  ${RY}
7435  ${xT}
7436`,zY=({easeSize:e="linearFadeOut"})=>`
7437  vUv = uv;  
7438  vRef = ref;
7439  // Normalized LifeTime 1 to 0
7440  float lifeLeft = texture2D(uPosition, ref).w;
7441  v_LifeLeft = lifeLeft;
7442  // Position From DataTexture Simulation
7443  vec3 pos = texture2D(uPosition, ref).rgb - uWorldOffset;
7444  // Apply World Quaternion
7445  pos = applyQuaternionToVector(uWorldQuaternion, pos);  
7446            
7447  #ifdef  USE_SIZE_END
7448    // Scaled Over Time
7449    float t = 1. - lifeLeft;
7450    float currentSize = mix(uSize, uSizeEnd, t); // Linearly interpolate between uSize and uSizeEnd
7451    vec3 scaledPosition = position * vec3(currentSize);
7452  #else
7453    // Change Size Behavior over LifeTime
7454    float easeSize = ${e}(1. - lifeLeft);
7455    // Scaled Over Time
7456    vec3 scaledPosition = position * vec3(uSize * easeSize);
7457  #endif
7458
7459  // Billboard Behavior
7460  vec2 scale;
7461  scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
7462  scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );    
7463  // Randomness 
7464  float randRef = rand(ref);
7465  scale *= (1.0 - (uRandScaleFactor * randRef));
7466  // Rotation
7467  float randRotation =  2.0 * PI * ( uRandRotationFactor * randRef);
7468  float originalRotation = (1.0 - uRotation) * 2.0 * PI;
7469  float originalRotationEnd = (1.0 - uRotationEnd) * 2.0 * PI;
7470  // OverTime
7471  float finalRotation = mix(originalRotation + randRotation, originalRotationEnd + randRotation, lifeLeft);
7472
7473  vec2 alignedPosition = ( scaledPosition.xy - ( center - vec2( 0.5 ) ) ) * scale;
7474  vec2 rotatedPosition;
7475  rotatedPosition.x = cos( finalRotation ) * alignedPosition.x - sin( finalRotation ) * alignedPosition.y;
7476  rotatedPosition.y = sin( finalRotation ) * alignedPosition.x + cos( finalRotation ) * alignedPosition.y;
7477  
7478  mat4 instanceMatrix = mat4(
7479    vec4(1.0, 0.0, 0.0, 0.0),
7480    vec4(0.0, 1.0, 0.0, 0.0),
7481    vec4(0.0, 0.0, 1.0, 0.0),
7482    vec4(pos.x, pos.y, pos.z, 1.0)
7483  );  
7484
7485  mvPosition = modelViewMatrix * instanceMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
7486  mvPosition.xy += rotatedPosition;
7487  gl_Position = projectionMatrix  * mvPosition;   
7488`,FY=`
7489  uniform vec4 uColor;                // start color
7490  uniform vec4 uColor2;               // end color
7491  uniform sampler2D uTexture;         // texture
7492  varying float v_LifeLeft;   // normalized lifetime 1 to 0
7493  varying vec2 vUv;
7494  varying vec2 vRef;
7495
7496  float random(vec2 co) {
7497    return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
7498  }
7499  `+xT+`  
7500  ${LY}
7501
7502`,kY=({easeOpacity:e="linearFadeOut"})=>`  
7503  // if Particle is dead, hide it
7504  if (v_LifeLeft <= 0.005 ) {
7505    discard;
7506  }
7507
7508  #ifdef USE_RANDOM_COLORING
7509    float randVal = random(vRef); // Generate a random value based on the reference
7510    vec4 color = mix(uColor, uColor2, randVal); // Interpolate between the two colors
7511  #else
7512    vec4 color = mix(uColor, uColor2, 1. - v_LifeLeft);
7513  #endif
7514
7515  // Opacity over Life Time
7516  float finalAlpha = ${e}(1. - v_LifeLeft);  
7517  vec4 textureColor = texture2D(uTexture, vUv).rgba; 
7518  finalColor = textureColor.rgb * color.rgb;
7519  finalAlpha = color.a * textureColor.a * finalAlpha;
7520  
7521  gl_FragColor = vec4(finalColor, finalAlpha);     
7522
7523`,UY=class extends Pt{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=[],Bi.startContext(Bi.globalContext),this.lightLayer=new sa(0,"",{...qi.defaultData("light","phong"),visible:!1},new b1,{},t.shared),Bi.endContext(Bi.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 gC;return e.needsJitter=this.needsJitter,e.addFragmentParsCode(o8),e.buildShader("vertex",this.fragment),e.buildShader("fragment",this.fragment),e.addFragmentFinalCode(l8),this.isColoringRandom&&e.define("USE_RANDOM_COLORING"),this.useSizeEnd&&e.define("USE_SIZE_END"),e.addVertexParsCode(BY),e.addFragmentParsCode(FY),e.addVertexFinalCode(zY({easeSize:this.easeSize})),e.addFragmentFinalCode(kY({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: 16,356 bytes, lines 7523-7570
7523nodeMaterialDispose(){this.layers.forEach(e=>e.dispose()),super.dispose()}},Vg=class{constructor(e,t,i,r){this.type="SphereEmitterShape",this.targetMesh=void 0,this.size=e,this.type=i,this.textureSize=_Y(t);let s=1;this.targetMesh=(r==null?void 0:r.type)==="Mesh"&&r?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}=AY(t,e*e),s=lA(i,e),a=lA(r,e);return{dataTexture:s,positions:i,dataTextureNormals:a}}getMesh(e,t){let i=null;switch(e){case"SphereEmitterShape":{i=new Kl(t*.5,32,32);break}case"TorusEmitterShape":{i=new JM(t*.5,.3,15,40);break}case"ConeEmitterShape":{i=new Cy(t,t,15);break}case"BoxEmitterShape":{i=new ks(t,t,t);break}case"PlaneEmitterShape":{i=new ga(t,t),i.rotateX(-Math.PI/2);break}case"MeshEmitterShape":{i=new Kl(t,32,32);break}default:{i=new Kl(t,32,32);break}}return new Zt(i,new sn({color:16711680}))}applyToShader(e,t){this.size=new M().fromArray(t.size),e.uEmitterSize.value=this.size}dispose(){this.positionsTexture.dispose(),this.directionsTexture.dispose(),this.positionsAttribute=new Float32Array}};function jl(e){let t={...e},i=Zp.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 NY=`
7524// uniform sampler2D uCurrentPosition; // Pass in the variable from GPGPU
7525// uniform sampler2D uCurrentVelocity; // Pass in the variable from GPGPU
7526// uniform sampler2D uCurrentEmissionRate; // Pass in the variable from GPGPU
7527
7528uniform sampler2D uIndex; // Texture with corresponding index
7529uniform float uLastIndexEmitted; // Last emitted index
7530uniform float uParticlesToEmit; // Number of particles to emit on that frame
7531uniform float uTime;
7532
7533void main() {
7534    vec2 vUv = gl_FragCoord.xy / resolution.xy;
7535    float particleIndex = texture(uIndex, vUv).x;
7536    float timeLeft = texture2D( uCurrentPosition, vUv ).w;
7537    float isActive = texture2D( uCurrentEmissionRate, vUv ).g;    // 1. = active, 0. = not active
7538    float timeStart = texture2D( uCurrentEmissionRate, vUv ).b;
7539
7540
7541    // ********** Detect Colision to Create a flag and use it in position **********
7542    // We are doing this here, so
7543
7544    // ********** Emit Particles **********
7545    // X = isSpawning 0.0 or 1.0
7546    // Y = isActive 0.0 or 1.0
7547    // Check if the vertex index is between the first value and the last value
7548    // if (particleIndex >= uLastIndexEmitted && particleIndex < uLastIndexEmitted + uParticlesToEmit) {
7549    //     // Emit a particle by writing 1 to the red channel of the color output
7550    //     // r: 1. == emit the particle
7551    //     // g: 1. == particle is now active
7552    //     timeStart = uTime;
7553    //     gl_FragColor = vec4(1.0, 1.0, timeStart, 1.0);
7554    // } else {
7555    //     // The Particle is either already emitted or not in the range of the particles to emit
7556    //     // Do not emit a particle by writing 0 to the red channel of the color output        
7557    //     gl_FragColor = vec4(0.0, isActive, timeStart, 1.0);
7558    // }
7559    // Determine if the particle is within the emission range
7560    float emitLowerBound = step(uLastIndexEmitted, particleIndex);
7561    float emitUpperBound = step(particleIndex, uLastIndexEmitted + uParticlesToEmit - 1.0);
7562    float emitParticle = emitLowerBound * emitUpperBound; // 1.0 if in range, 0.0 otherwise
7563
7564    // Set timeStart and color
7565    timeStart = mix(timeStart, uTime, emitParticle);
7566    gl_FragColor = vec4(emitParticle, mix(isActive, 1.0, emitParticle), timeStart, 1.0);
7567
7568
7569}
7570`,jg=10,VY=class extends Ut{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 PB,this.currentWorldPosition=new M,this.systemQuaternion=new ot,this.worldGravity=new M(0,0,0),this.directionAxis=new M(0,0,0),this.colliderV3=new M(0,0,0),this.colliderQuaternion=new ot(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 UY(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 ht(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 oi(r.img);s.needsUpdate=!0,e.uTexture.value=s;return}if(typeof i!="string"){let r=new Image;r.onload=()=>{let n=new oi(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){var r;let i=SY(t);!((r=this.emitterShape)!=null&&r.positionsAttribute)||e.geometry.setAttribute("ref",new Xc(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){var n;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=(n=this.gpuCompute.getCurrentRenderTarget(this.positionSimRT))==null?void 0:n.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(jl({...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/jg),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){var t,i,r;if(!(!this.positionSimRT||!this.velocitySimRT)){if(this.shouldReInitGPUCompute(e)&&this.init(jl(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"]))/jg),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),((t=e.renderMaterial)==null?void 0:t.size)!==void 0){let s=this.shared.getVariable(e.renderMaterial.size[0],[this.uuid,"particles","size"]);this.velocitySimRT.material.uniforms.particleSize.value=Number(s)}if(((i=e.renderMaterial)==null?void 0:i.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 s=e.shape.size??this.system.data.shape.size,a=[Number(this.shared.getVariable(s[0],[this.uuid,"particles","shape_size_0"])),Number(this.shared.getVariable(s[1],[this.uuid,"particles","shape_size_1"])),Number(this.shared.getVariable(s[2],[this.uuid,"particles","shape_size_2"]))],n={...jl(this.system.data).shape,size:a};(r=this.emitterShape)==null||r.applyToShader(this.positionSimRT.material.uniforms,n)}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 s=this.getDirectionFromVariable(e.direction);this.directionAxis=this.getDirectionAxis(s),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])*Oe.DEG2RAD,Number(e[1])*Oe.DEG2RAD,Number(e[2])*Oe.DEG2RAD],i=new zi(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 bY(this.emitterShape.textureSize,this.emitterShape.textureSize,this.renderer),r=this.updateSimulationDefinition(e),s=i.addVariable("uCurrentPosition",r+CY,this.emitterShape.positionsTexture),a=i.addVariable("uCurrentVelocity",r+OY,this.emitterShape.directionsTexture),n=i.addVariable("uCurrentEmissionRate",NY,EY(this.emitterShape.textureSize));i.setVariableDependencies(s,[s,a,n]),i.setVariableDependencies(a,[s,a,n]),i.setVariableDependencies(n,[s,a,n]);let o=MY({size:this.emitterShape.textureSize}),l={uOriginalPosition:{value:this.emitterShape.positionsTexture},uWorldOffset:{value:new M(0,0,0)},uWorldQuaternion:{value:new ht(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),d={uOriginalPosition:{value:this.emitterShape.positionsTexture},uDirections:{value:this.emitterShape.directionsTexture},uDirectionsAxis:{value:this.directionAxis},uWorldQuaternion:{value:new ht(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 ht(0,0,0,1)},uColliderQuaternionInvert:{value:new ht(0,0,0,1)},particleSize:{value:0},uGravity:{value:this.worldGravity},uNoiseStrength:{value:this.noiseStrength},uNoiseScale:{value:this.noiseScale},uNoiseSeed:{value:e.noiseSeed}
7570,uRandomMassFactor:{value:e.randomMass},uBounce:{value:e.collisionBounce},uSpeed:{value:Number(this.shared.getVariable(e.speed,[this.uuid,"particles","speed"]))/jg}};a.material.uniforms=d;let u={uIndex:{value:o},uTime:{value:0},uLastIndexEmitted:{value:0},uParticlesToEmit:{value:0}};n.material.uniforms=u;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={...jl(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==null?void 0: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==null?void 0:i.colliderType;r==="sphere"&&(this.simFeaturesDefinition.USE_SPHERE_COLLIDER=!0),r==="box"&&(this.simFeaturesDefinition.USE_BOX_COLLIDER=!0),(i==null?void 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}
7571`);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 Vg(i,t,e.type,r):new Vg(i,t,"SphereEmitterShape")}else return new Vg(i,t,e.type)}createPrimaryEmitter(e){let t,i=e*e;return t=new jL(new ga(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(){var e,t,i;!this.gpuCompute||((t=(e=this.rootObject)==null?void 0:e.parent)==null||t.remove(this.rootObject),this.gpuCompute.dispose(),this.material.nodeMaterialDispose(),(i=this.emitterShape)==null||i.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(jl(this.system.data))}startEmitting(e){this.isEmitting=!0,this.hasBeenReset=!1,this.lastEmitTime=e}stopEmitting(){this.isEmitting=!1}},Uc=class extends Or{constructor(e,t,i){super(e,t),this.type="ParticleSystem",this.geometry=new je,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,...jl(t)},this.geometry.setAttribute("position",new De([],3)),this.material=new sn({colorWrite:!1}),this.frustumCulled=!1}init(e){this.renderer=e,this.emitter=new VY(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),Yt(e.path,["renderMaterial"])&&this.updateParticleState({renderMaterial:{...this.data.renderMaterial,...Qi.drop(e,1).props}}),Yt(e.path,["shape"])&&this.updateParticleState({shape:{...this.data.shape,...Qi.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())}start(e=0){var t;if(this.currentLoopTime=0,e){this.timeoutId=window.setTimeout(()=>{this.start(0)},e);return}this.started=!0,this.stopped=!1,this.isFrozen=!1,(t=this.emitter)==null||t.startEmitting(this.actualTime/1e3)}froze(){this.isFrozen=!0}unFroze(){this.isFrozen=!1}stop(){var e;this.stopped=!0,this.currentLoopTime=0,(e=this.emitter)==null||e.stopEmitting(),clearTimeout(this.timeoutId)}reset(){var e;this.started=!1,this.stopped=!1,(e=this.emitter)==null||e.reset()}wakeUp(){this.isIdle=!1}sleep(){this.isIdle=!0,this.reset()}};function jY(){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 Gg=jY();function GY(e,t,i){var s;Gg!==void 0&&(((s=t==null?void 0:t.geometry)==null?void 0:s.subdivisions)??0)>Gg&&(console.log("reducing subdivisions",t.name,t.geometry.subdivisions),t.geometry.subdivisions=Gg);let r;return t.geometry.type==="TextGeometry"?new C1(e,t,i):t.geometry.type==="InputGeometry"?new B1(e,t,i):(t.geometry.type==="SubdivGeometry"?r=new ud(e,t,i):t.geometry.type==="PathGeometry"?r=new L1(e,t,i):t.geometry.type==="VectorGeometry"?r=new yY(e,t,i):t.geometry.type==="BooleanGeometry"?r=new Yo(e,t,i):t.geometry.type==="ShapeBlendGeometry"?r=new Qo(e,t,i):t.geometry.type==="UIGeometry"?r=new gr(e,t,i):r=new Ei(e,t,i),r)}function F1(e,t,i){return console.assert(t.type!==void 0),t.type==="Mesh"?GY(e,t,i):t.type==="Empty"?new oh(e,t):t.type==="Particle"?new Uc(e,t,i):t.type==="ParticleCollider"?new kc(e,t,i):t.type==="Splat"?new oh(e,t):t.type==="Bone"?new xY(e,t):t.type==="Page"?new Xi(e,t,i):t.type==="PointLight"?new vY(e,t,i):t.type==="SpotLight"?new lT(e,t,i):t.type==="DirectionalLight"?new oT(e,t,i):t.type==="Component"||t.type==="Instance"?new lh(e,t,i):Wo.is(t.type)?new yr(e,t):(console.error(t),new oh(e,t))}Nn.createEntity=F1;function HY(e,t,i){let r=F1(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,d=e.stateSelection;e.dispose();for(let u of Object.keys(e))delete e[u];Object.setPrototypeOf(e,Object.getPrototypeOf(r));for(let u of Object.keys(r))e[u]=r[u];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),d&&e.changeSelectedState(d,i),e.resetBBoxNeedsUpdate()}Nn.changeEntityProptotype=HY;Nn.Cloner=cs;function WY(e,t,i,r){e.updateByOp(t,i,r,!1)}var Ao=5,Nc=new je;Nc.setAttribute("position",new et(new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),3));var mp=class extends xB{constructor(e){super({...e,depthTest:!1,depthWrite:!1,glslVersion:vv,vertexShader:`
7572				precision highp float;
7573				in vec3 position;
7574				void main() {
7575					gl_Position = vec4(position, 1);
7576				}
7577			`})}customProgramCacheKey(){return""}};function qY(){return{shapeInput:()=>`
7578			const float posRowCoord = ${.5/Ao};  // vec4: px py pz opType
7579			const float quatRowCoord = ${1.5/Ao};  // vec4: qx qy qz qw
7580			const float param1RowCoord = ${2.5/Ao};// vec4: type param1 param2 param3
7581			const float param2RowCoord = ${3.5/Ao};// vec4: blendRange roundness scale param4
7582			const float colorRowCoord = ${4.5/Ao}; // vec4: r g b a
7583			uniform sampler2D shapesDataTexture;
7584			vec4 shapePos(float iin) { 
7585				vec4 r = texture(shapesDataTexture, vec2(iin, posRowCoord));
7586				return r;
7587			}
7588			vec4 shapeQuat(float iin) {
7589				vec4 r = texture(shapesDataTexture, vec2(iin, quatRowCoord));
7590				return r;
7591			}
7592			vec4 shapeParams1(float iin) {
7593				vec4 r = texture(shapesDataTexture, vec2(iin, param1RowCoord));
7594				return r;
7595			}
7596			vec4 shapeParams2(float iin) {
7597				vec4 r = texture(shapesDataTexture, vec2(iin, param2RowCoord));
7598				return r;
7599			}
7600			vec4 shapeColor(float iin) {
7601				vec4 r = texture(shapesDataTexture, vec2(iin, colorRowCoord));
7602				return r;
7603			}
7604		`,getxyzi:`
7605			// this code must complement lookup
7606			float xi = mod(gl_FragCoord.x - 0.5, VOXEL_RESOLUTION);
7607			float yi = mod(gl_FragCoord.y - 0.5, VOXEL_RESOLUTION);
7608			float zi = floor((gl_FragCoord.x - 0.5) * INV_VOXEL_RESOLUTION) + floor((gl_FragCoord.y - 0.5) * INV_VOXEL_RESOLUTION) * Z_LAYERS_PER_ROW;
7609		`,lookup:`
7610			uniform sampler2D potentialPassTexture;
7611			uniform sampler2D voxelPassTexture; // includes normal (in xyz) and key (in w)
7612			
7613			// box or marching cube lookup value in value texture, integer box coord inputs
7614			// this code must complement codebits.getxyzi
7615			vec4 look(float xi, float yi, float zi, sampler2D rt) {// range 0 .. numv etc
7616				vec2 uv = vec2(
7617					mod(zi, Z_LAYERS_PER_ROW) + (xi + 0.5) / VOXEL_RESOLUTION,
7618					floor(zi / Z_LAYERS_PER_ROW) + (yi + 0.5) / VOXEL_RESOLUTION
7619				); 
7620				uv /= Z_LAYERS_PER_ROW;
7621				return texture(rt, uv);
7622			}
7623		`,getpart:`
7624			float getpart(inout float a, float b) {
7625				float t = floor(a/b);
7626				float r = a - t*b;
7627				a = t;
7628				return r;
7629			}
7630		`,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,
76306,-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 gp=new to,XY=class{constructor(){this.pyramidPassScene=new Gr,this.pyramidPassMaterial=new mp({name:"PyramidPass"}),this.pyramidPassUniforms={inputTexture:{value:void 0}
vendor: 16,219 bytes, lines 7630-7786
7630,inputWidth:{value:0},inputHeight:{value:0},inputShiftX:{value:0},outputShiftX:{value:0}},this.pyramidTopLevelReadPixelBuffer=new Float32Array(4);let e=`
7631			precision highp float;
7632			precision highp sampler2D;
7633			layout(location = 0) out vec4 pc_FragColor;
7634			uniform sampler2D inputTexture;
7635			uniform float inputWidth;
7636			uniform float inputHeight;
7637			uniform float inputShiftX;
7638			uniform float outputShiftX;
7639			const vec2 half_unit_coord = vec2(0.5);
7640			const vec4 one = vec4(1.0);
7641			void main() {
7642				vec2 inputSize = vec2(inputWidth, inputHeight);
7643				vec2 input_pixel_uv = 1. / inputSize;
7644				vec2 coord = gl_FragCoord.xy - half_unit_coord;
7645				coord.x -= outputShiftX;
7646				coord = coord * 2. + half_unit_coord;
7647				coord.x += inputShiftX;
7648
7649				// sample bottom left corner
7650				vec2 input_uv = coord / inputSize;
7651				float bl = texture(inputTexture, input_uv).r;
7652
7653				// sample bottom right corner
7654				input_uv.x += input_pixel_uv.x;
7655				float br = texture(inputTexture, input_uv).r;
7656
7657				// sample top right corner
7658				input_uv.y += input_pixel_uv.y;
7659				float tr = texture(inputTexture, input_uv).r;
7660
7661				// sample top left corner
7662				input_uv.x -= input_pixel_uv.x;
7663				float tl = texture(inputTexture, input_uv).r;
7664
7665				pc_FragColor.a = bl;
7666				pc_FragColor.b = pc_FragColor.a + br;
7667				pc_FragColor.g = pc_FragColor.b + tr;
7668				pc_FragColor.r = pc_FragColor.g + tl; 
7669			}
7670		`;this.pyramidPassMaterial.fragmentShader=e,this.pyramidPassMaterial.uniforms=this.pyramidPassUniforms,this.pyramidPassMaterial.depthTest=!1,this.pyramidPassMaterial.depthWrite=!1;let t=new Zt(Nc,this.pyramidPassMaterial);t.frustumCulled=!1,this.pyramidPassScene.add(t)}renderPyramid(e,t,i,r,s){new Oy().min.setScalar(0);let a=t.length-1,n=new ht;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],d=h===o?r:h%2===o%2?s[1]:s[0];this.pyramidPassUniforms.inputTexture.value=Array.isArray(d.texture)?d.texture[1]:d.texture,this.pyramidPassUniforms.inputWidth.value=d.width,this.pyramidPassUniforms.inputHeight.value=d.height,i.setRenderTarget(c);let u=t[h],p=i.getPixelRatio();i.setViewport(this.pyramidPassUniforms.outputShiftX.value/p,0,u/p,u/p),h===2&&e%2!==0&&i.setViewport(this.pyramidPassUniforms.outputShiftX.value/p,0,3/p,3/p),i.render(this.pyramidPassScene,gp);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])}},As=24,rr=96,Ks=qY(),Oa=2,bT=class extends Ei{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 Gr,this.potentialPassScene=new Gr,this.voxelPassScene=new Gr,this._spatialPassRenderTargets=[],this._potentialPassRenderTargets=[],this._voxelPassRenderTargets=[],this._pyramidRenderTargets=[],this.geometry=new je,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(Nc,this.spatialPassMaterial()),this.spatialMesh.frustumCulled=!1,this.spatialscene.add(this.spatialMesh);let r=new Pr(Ks.triTable,16,256,sp,Vt);r.needsUpdate=!0;let s=new Pr(Ks.numTrisTable,256,1,sp,Vt);s.needsUpdate=!0,this.voxelPassUniforms={potentialPassTexture:{value:void 0},numTrisTable:{value:s}},this.voxelMesh=new Zt(Nc,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(Nc,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(JY.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 Pt({vertexShader:n.vertexShader,fragmentShader:`
7671						#include <packing>
7672						void main()
7673						{
7674							gl_FragColor = packDepthToRGBA(gl_FragCoord.z);
7675						}
7676					`,uniforms:n.uniforms,defines:this.material.defines}),this.isMeshDepthMaterial=!0,this.customDistanceMaterial=new Pt({vertexShader:n.vertexShader,fragmentShader:`
7677					#include <common>
7678					#include <packing>
7679					uniform vec3 referencePosition;
7680					uniform float nearDistance;
7681					uniform float farDistance;
7682					// World-space position
7683					varying vec3 vWPosition;
7684					void main()
7685					{
7686						float dist = length(vWPosition - referencePosition);
7687						dist = (dist - nearDistance) / (farDistance - nearDistance);
7688						dist = saturate(dist);
7689						// Required by Three.js for this to work
7690						gl_FragColor = packDepthToRGBA( dist );
7691					}`,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 j(this.pyramidRenderTarget[h].width,this.pyramidRenderTarget[h].height),this.marchPassUniforms.pyramidTexture1.value=this.pyramidRenderTarget[c].texture,this.marchPassUniforms.pyramidTexture1Size.value=new j(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,gp),a.setRenderTarget(this.potentialPassRenderTarget),a.render(this.potentialPassScene,gp),a.setRenderTarget(this.voxelPassRenderTarget),a.render(this.voxelPassScene,gp),bT.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 je,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 et(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*As)))}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=31*8*Oa,this.bboxOffset=8*Oa*-1/2;break;case 6:this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512],this.bboxSize=63*4*Oa,this.bboxOffset=4*Oa*-1/2;break;case 7:this.pyramidLevelSizes=[1,2,4,6,12,24,48,96,192,384,768,1536],this.bboxSize=127*2*Oa,this.bboxOffset=2*Oa*-1/2;break;case 8:this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096],this.bboxSize=255*Oa,this.bboxOffset=Oa*-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}}get resolutionLevel(){return this._resolutionLevel}get spatialPassRenderTarget(){let e=this._spatialPassRenderTargets[this.resolutionLevel];return e||(e=new Tt(this.spatialDivisions*this.spatialn,this.spatialDivisions**2,{format:ri,type:Vt,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:wt,magFilter:wt}),this._spatialPassRenderTargets[this.resolutionLevel]=e),e}get potentialPassRenderTarget(){let e=this._potentialPassRenderTargets[this.resolutionLevel];return e||(e=new Tt(this.basePyramidSize,this.basePyramidSize,{format:ri,type:Vt,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:wt,magFilter:wt}),this._potentialPassRenderTargets[this.resolutionLevel]=e),e}get voxelPassRenderTarget(){let e=this._voxelPassRenderTargets[this.resolutionLevel];return e||(e=new IM(this.basePyramidSize,this.basePyramidSize,2,{stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:wt,magFilter:wt}),e.texture[0].format=ri,e.texture[0].type=Vt,e.texture[1].format=sp,e.texture[1].type=Vt,this._voxelPassRenderTargets[this.resolutionLevel]=e),e}get pyramidRenderTarget(){let e=this._pyramidRenderTargets[this.resolutionLevel];if(!e){let t=new Tt(this.pyramidTexture1Width,this.pyramidTexture1Height,{format:ri,type:Vt,stencilBuffer:!1,depthBuffer:!1,magFilter:wt,minFilter:wt}),i=new Tt(this.pyramidTexture2Width,this.pyramidTexture2Height,{format:ri,type:Vt,stencilBuffer:!1,depthBuffer:!1,magFilter:wt,minFilter:wt});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 et(new Float32Array(this.geometry.drawRange.count*3),3)):!e.wireframe&&this.geometry.getAttribute("position")&&this.geometry.deleteAttribute("position")}spatialPassMaterial(){let e=`
7692			precision highp float;
7693			out vec4 pc_FragColor;
7694			const float spatialDivisions = ${this.spatialDivisions}.;
7695			uniform float span;
7696			uniform float npart;
7697			uniform float spatialn;
7698			${Ks.shapeInput()}
7699
7700			vec3 low, high;     // range of current div; subset of -1 .. 1 with span border
7701
7702			// lookup one element/channel's worth of spheres for current division
7703			// stating with low sphere number lowi
7704			// gives a key to which spheres from lowi..lowi+23 are active within given div (low..high)
7705			float spatialKey(float lowi) {
7706				float t = 0.;
7707				for (float ii = ${As-1}.; ii >= 0.; ii--) {
7708					float i = ii + lowi;
7709					float iin = (i + 0.5) / ${rr}.;
7710					vec4 shape = shapePos(iin);
7711					vec3 d = shape.xyz;
7712					float op = shape.w;
7713	
7714					t *= 2.;
7715					t += (
7716						low.x < d.x && d.x < high.x &&
7717						low.y < d.y && d.y < high.y &&
7718						low.z < d.z && d.z < high.z &&
7719						i < npart || op == -2. // always include if op is -2, which is the intersection operation
7720					) ? 1. : 0.;
7721				}
7722				return t;
7723			}
7724
7725			${Ks.getpart}
7726
7727			void main() {               // spatialial fragment shader
7728				// find active div
7729				vec3 div;                               // which div is current
7730				// out holds x=> x, lowi faster moving and y=> z, y faster moving
7731				float yz = float(gl_FragCoord.y - 0.5);     // contains  z, y faster moving
7732				div.y = getpart(yz, spatialDivisions);
7733				div.z = yz; // getpart(yz, spatialDivisions.z); // what's left, should be the same as getpart
7734
7735				float lx = float(gl_FragCoord.x - 0.5);     // contains x, lowi faster moving
7736				float lowi = getpart(lx, spatialn) * ${4*As}.;
7737				div.x = lx;
7738
7739				low = div / spatialDivisions * 2. - 1. - span;
7740				high = (div+1.) / spatialDivisions * 2. - 1. + span;
7741
7742				// find active range of spheres
7743				pc_FragColor.x = spatialKey(lowi);
7744				pc_FragColor.y = spatialKey(lowi+${As}.);
7745				pc_FragColor.z = spatialKey(lowi+${2*As}.);
7746				pc_FragColor.w = spatialKey(lowi+${3*As}.);
7747			}
7748		`;return new mp({name:"Spatial Pass",fragmentShader:e,uniforms:this.spatialPassUniforms})}potentialPassMaterial(){let e=`
7749			precision highp float;
7750			out vec4 pc_FragColor;
7751
7752			${Ks.shapeInput()}
7753			uniform sampler2D spatialPassTexture;
7754
7755			const float res = float(RES);
7756			const float VOXEL_RESOLUTION = pow(2., res);
7757			const float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.));
7758			const float VOXEL_RESOLUTION_SUB1 = VOXEL_RESOLUTION - 1.;
7759			const float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION;
7760
7761			uniform float npart;
7762			uniform float spatialn;
7763			const float spatialDivisions = ${this.spatialDivisions}.;
7764			const float spatialDivisions2 = spatialDivisions * spatialDivisions;
7765			const float spatialDivisionsSub1 = spatialDivisions - 1.;
7766
7767			${Ks.getpart}
7768
7769			vec3 packRGBAToVec3(vec4 color) {
7770				uint r = uint(color.r * 255.);
7771				uint g = uint(color.g * 255.);
7772				uint combined = (r << 8) | g; 
7773				return vec3(float(combined) * 0.00001525902, color.b, color.a); // 1/65535
7774			}
7775
7776			void applyQuaternionToVector(in vec4 q, inout vec3 v) {
7777				v += 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v);
7778			}
7779
7780			/**
7781			 * SDF functions (reference: https://iquilezles.org/articles/distfunctions/)
7782			 */
7783
7784			// branchless version of "Smooth Union, Subtraction and Intersection - bound, bound, bound" in above reference
7785			float smoothOperation(float op, float sdf, float d, float k) {
7786			  //        union: op =  1 =>
7786 signSubtract =  1, signIntersection =  1
7787			  //     subtract: op = -1 => signSubtract = -1, signIntersection =  1
7788				// intersection: op = -2 => signSubtract = -1, signIntersection = -1
7789
7790				float signSubtract = clamp(op, -1., 1.);
7791				float signIntersection = 2. * (op - signSubtract) + 1.;
7792				float h = clamp(
7793					0.5 + signSubtract * 0.5 * (sdf - signSubtract * signIntersection * d) / k,
7794					0.0,
7795					1.0
7796				);
7797				return mix(sdf, signSubtract * signIntersection * d, h) - 
7798							 signSubtract * k * h * (1.0 - h);
7799			}
7800
7801			float sdSphere( vec3 p, float s )
7802			{
7803				return length(p)-s;
7804			}
7805
7806			float sdEllipsoid( vec3 p, vec3 r )
7807			{
7808				float k0 = length(p/r);
7809				float k1 = length(p/(r*r));
7810				return k0*(k0-1.0)/k1;
7811			}
7812
7813			float sdBox( vec3 p, vec3 b )
7814			{
7815				vec3 q = abs(p) - b;
7816				return length(max(q,0.0)) + min(max(q.x,max(q.y,q.z)),0.0);
7817			}
7818
7819			float sdTorus( vec3 p, vec2 t )
7820			{
7821				vec2 q = vec2(length(p.xy)-t.x,p.z);
7822				return length(q)-t.y;
7823			}
7824
7825			float sdCappedTorus( vec3 p, vec2 sc, float ra, float rb)
7826			{
7827				p.x = abs(p.x);
7828				float k = (sc.y*p.x>sc.x*p.y) ? dot(p.xy,sc) : length(p.xy);
7829				return sqrt( dot(p,p) + ra*ra - 2.0*ra*k ) - rb;
7830			}
7831
7832			float dot2( in vec2 v ) { return dot(v,v); }
7833			float sdCappedCone( vec3 p, float h, float r1, float r2 )
7834			{
7835				vec2 q = vec2( length(p.xz), p.y );
7836				vec2 k1 = vec2(r2,h);
7837				vec2 k2 = vec2(r2-r1,2.0*h);
7838				vec2 ca = vec2(q.x-min(q.x,(q.y<0.0)?r1:r2), abs(q.y)-h);
7839				vec2 cb = q - k1 + k2*clamp( dot(k1-q,k2)/dot2(k2), 0.0, 1.0 );
7840				float s = (cb.x<0.0 && ca.y<0.0) ? -1.0 : 1.0;
7841				return s*sqrt( min(dot2(ca),dot2(cb)) );
7842			}
7843
7844			float sdCappedCylinder( vec3 p, float h, float r )
7845			{
7846				vec2 d = abs(vec2(length(p.xz),p.y)) - vec2(r,h);
7847				return min(max(d.x,d.y),0.0) + length(max(d,0.0));
7848			}
7849
7850			float maxBlend = 0.0;
7851			// compute potential from A (=24) spheres, using the bit flags in 'activeKey'
7852			// to avoid lookup/compute for inactive spheres
7853			// return field potential, side effect updates track,
7854			// compute and return +ve and -ve values separately
7855			void fillSpatialInner(
7856				float ii,
7857				float activeKey,
7858				vec3 corner,
7859				inout float sdf,
7860				inout float colorDivisor,
7861				inout vec4 trackColor
7862			) {
7863				for (float i = 0.; i < ${As}.; i++) {
7864					if (activeKey < 1.) break; // activeKey exhausted, no more active spheres
7865					activeKey *= 0.5;
7866					if (fract(activeKey) < 0.5) continue;
7867
7868					float iin = (i + ii + 0.5) * ${1/rr};
7869					vec4 shape = shapePos(iin);
7870					vec4 quat = shapeQuat(iin);
7871					vec4 params1 = shapeParams1(iin);
7872					vec4 params2 = shapeParams2(iin);
7873
7874					vec3 p = corner - shape.xyz;
7875					applyQuaternionToVector(quat, p);
7876					p /= params2.z; // scale
7877					float d; // d in -1..1 coordinates
7878					switch (int(params1.x)) {
7879						case 0: d = sdSphere(p, params1.y); break;
7880						case 1: d = sdEllipsoid(p, params1.yzw); break;
7881						case 2: d = sdBox(p, params1.yzw); break;
7882						case 3: d = sdCappedCylinder(p, params1.y, params1.z); break;
7883						case 4: d = sdCappedCone(p, params1.y, params1.z, params1.w); break;
7884						case 5: d = sdTorus(p, params1.yz); break;
7885						case 6: d = sdCappedTorus(p, params1.yz, params1.w, params2.w); break;
7886					}
7887					d -= params2.y; // rounded edge
7888					d *= params2.z; // scale
7889
7890					float k = params2.x;
7891					float op = shape.w;
7892
7893					sdf = smoothOperation(shape.w, sdf, d, k);
7894
7895					float isNegativeOne = step(-1.5, op) * step(op, -0.5); // 1 when op == -1, 0 otherwise
7896					float colorCull = smoothstep(maxBlend, 0., -d);
7897					float cullFactor = mix(1.0, colorCull, isNegativeOne);
7898					trackColor *= cullFactor;
7899					colorDivisor *= cullFactor;
7900
7901					maxBlend = max(maxBlend, k);
7902
7903					k += 2. * INV_VOXEL_RESOLUTION; // avoid division by zero, and other color artifacts with very small k
7904					float nearness = smoothstep(k, 0., d);
7905
7906					vec4 color = shapeColor(iin);
7907					nearness *= float(color.a >= 0.);
7908
7909					colorDivisor += nearness;
7910					trackColor += color * nearness;
7911				}
7912			}
7913
7914			vec3 div;
7915			// compute potential from all spheres; collect +ve and =ve values separately
7916			// work in blocks of A*4 (=96) spheres, using the bit flags in 4 float channel 'activeKey' values
7917			// TODO check if extra vec3 output useful, not really used at present
7918			float fillSpatial(vec3 corner, inout vec4 trackColor) {
7919				float sdf = 1e3; // hack: initialize to large value
7920				float colorDivisor = 0.;
7921				// spatialPassTexture holds x=> lowi, x faster moving and y=> z, y faster moving
7922				float divyz = (div.y + div.z * spatialDivisions + 0.5) / (spatialDivisions2);
7923				for (float ii = 0.; ii < spatialn; ii++) {
7924					float i = ii * ${4*As}.;
7925
7926					vec4 activeKey = texture(spatialPassTexture, vec2((div.x * spatialn + ii + 0.5)/(spatialn * spatialDivisions), divyz));
7927					fillSpatialInner(i, activeKey.x, corner, sdf, colorDivisor, trackColor);
7928					fillSpatialInner(i+${As}., activeKey.y, corner, sdf, colorDivisor, trackColor);
7929					fillSpatialInner(i+${2*As}., activeKey.z, corner, sdf, colorDivisor, trackColor);
7930					fillSpatialInner(i+${3*As}., activeKey.w, corner, sdf, colorDivisor, trackColor);
7931				}
7932
7933				trackColor /= colorDivisor;
7934				return mix(sdf, 0.0, step(1e20 - 0.1, sdf));
7935			}
7936
7937			void main() {
7938				${Ks.getxyzi}    // get xi yi zi from 2d position
7939
7940				vec3 xyzi = vec3(xi,yi,zi);
7941				vec3 corner = xyzi / VOXEL_RESOLUTION_SUB1 * 2. - 1.;  // -1..1 coords
7942
7943				div = floor(xyzi / VOXEL_RESOLUTION_SUB1 * spatialDivisionsSub1);
7944
7945				vec4 c = vec4(0.);
7946				float t = fillSpatial(corner, c);
7947
7948				pc_FragColor = vec4(t, packRGBAToVec3(c)); // RGB texture
7949			}
7950		`;return new mp({name:"PotentialPass",fragmentShader:e,uniforms:this.potentialPassUniforms})}voxelPassMaterial(){let e=`
7951			precision highp float;
7952			layout(location = 0) out vec4 pc_FragColor;
7953			layout(location = 1) out vec4 numTris;
7954
7955			const float res = float(RES);
7956			const float VOXEL_RESOLUTION = pow(2., res);
7957			const float VOXEL_RESOLUTION_SUB1 = VOXEL_RESOLUTION - 1.; 
7958			const float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.));
7959			const float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION;
7960			uniform sampler2D numTrisTable; // 256 x 1
7961
7962			float keyi(float f000, float f100, float f010, float f110, float f001, float f101, float f011, float f111) {
7963				return (float(f000 < 0.) * 1.) +
7964							 (float(f100 < 0.) * 2.) +
7965							 (float(f010 < 0.) * 8.) +
7966							 (float(f110 < 0.) * 4.) +
7967							 (float(f001 < 0.) * 16.) +
7968							 (float(f101 < 0.) * 32.) +
7969							 (float(f011 < 0.) * 128.) +
7970							 (float(f111 < 0.) * 64.);
7971			}
7972
7973			${Ks.lookup}
7974
7975			vec3 compNormi(float xi, float yi, float zi) {
7976				float dx = look(xi + 1., yi, zi, potentialPassTexture).r - look(xi - 1., yi, zi, potentialPassTexture).r;
7977				float dy = look(xi, yi + 1., zi, potentialPassTexture).r - look(xi, yi - 1., zi, potentialPassTexture).r;
7978				float dz = look(xi, yi, zi + 1., potentialPassTexture).r - look(xi, yi, zi - 1., potentialPassTexture).r;
7979				// if we allow (common) 0,0,0 case through then NaN can spread
7980				// eg r = vec4(compNorm i(???), 1.) will pollute r.w
7981				if (dx == 0.0 && dy == 0.0 && dz == 0.0) {
7982					return vec3(0.199, 0.299, 0.399);
7983				}
7984				return normalize(vec3(dx, dy, dz));
7985			}
7986
7987			void main() {
7988				${Ks.getxyzi}    // get xi yi zi from 2d
7989
7990				vec3 normal = compNormi(xi, yi, zi);  // even if our key is -1 this may be needed by a neighbouring voxel
7991
7992				if (xi >= VOXEL_RESOLUTION_SUB1 || yi >= VOXEL_RESOLUTION_SUB1 || zi >= VOXEL_RESOLUTION_SUB1) {
7993					pc_FragColor = vec4(normal, 0.);
7994					numTris = vec4(0.);
7995					return;
7996				}
7997
7998				float
7999					f000 = look(xi, yi, zi, potentialPassTexture).r,
8000					f100 = look(xi+1., yi, zi, potentialPassTexture).r,
8001					f010 = look(xi, yi+1., zi, potentialPassTexture).r,
8002					f110 = look(xi+1., yi+1., zi, potentialPassTexture).r,
8003					f001 = look(xi, yi, zi+1., potentialPassTexture).r,
8004					f101 = look(xi+1., yi, zi+1., potentialPassTexture).r,
8005					f011 = look(xi, yi+1., zi+1., potentialPassTexture).r,
8006					f111 = look(xi+1., yi+1., zi+1., potentialPassTexture).r;
8007				float key = keyi(f000, f100, f010, f110, f001, f101, f011, f111);
8008
8009				pc_FragColor = vec4(normal, key);
8010
8011				numTris = texture(numTrisTable, vec2((key + 0.5) / 256., 0.5));
8012			}
8013		`;return new mp({name:"VoxelPass",fragmentShader:e,uniforms:this.voxelPassUniforms})}
vendor: 8,420 bytes, lines 8013-8249
8013patchVertexShaderForShapeBlend(e){let t=`
8014		#ifdef SHAPEBLEND 
8015			precision highp sampler2D;
8016
8017			uniform float isol;
8018
8019			uniform sampler2D triTable;     // 256 x 16
8020			uniform sampler2D pyramidTexture1;
8021			uniform vec2 pyramidTexture1Size;
8022			uniform sampler2D pyramidTexture2;
8023			uniform vec2 pyramidTexture2Size;
8024
8025			const vec2 halfPixelOffset = vec2(0.5, 0.5);
8026
8027			const vec2 rShift = vec2(0., 1.);
8028			const vec2 gShift = vec2(1., 1.);
8029			const vec2 bShift = vec2(1., 0.);
8030
8031			const float res = float(RES);
8032			const float VOXEL_RESOLUTION = pow(2., res);
8033			const float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.));
8034			const float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION;
8035
8036			const float scale_factor = ${Oa}.;
8037
8038			#if SHAPEBLEND == 5
8039				const float levelShiftX[7] = float[7](4., 6., 12., 24., 48., 96., 192.);
8040				const float scale = 8. * scale_factor;
8041				const vec3 originOffset = vec3(16.);
8042			#elif SHAPEBLEND == 7
8043				const float levelShiftX[10] = float[10](4., 6., 12., 24., 48., 96., 192., 384., 768., 1536.); 
8044				const float scale = 2. * scale_factor;
8045				const vec3 originOffset = vec3(64.);
8046			#elif SHAPEBLEND == 8
8047				const float levelShiftX[11] = float[11](4., 8., 16., 32., 64., 128., 256., 512., 1024., 2048., 4096.);
8048				const float scale = scale_factor;
8049				const vec3 originOffset = vec3(128.);
8050			#else
8051				const float levelShiftX[8] = float[8](4., 8., 16., 32., 64., 128., 256., 512.);
8052				const float scale = 4. * scale_factor;
8053				const vec3 originOffset = vec3(32.);
8054			#endif
8055
8056			${Ks.lookup}
8057
8058			const vec3 offsets[24] = vec3[](
8059				vec3(0., 0., 0.), vec3(1., 0., 0.),
8060				vec3(1., 0., 0.), vec3(1., 1., 0.),
8061				vec3(0., 1., 0.), vec3(1., 1., 0.),
8062				vec3(0., 0., 0.), vec3(0., 1., 0.),
8063				vec3(0., 0., 1.), vec3(1., 0., 1.),
8064				vec3(1., 0., 1.), vec3(1., 1., 1.),
8065				vec3(0., 1., 1.), vec3(1., 1., 1.),
8066				vec3(0., 0., 1.), vec3(0., 1., 1.),
8067				vec3(0., 0., 0.), vec3(0., 0., 1.),
8068				vec3(1., 0., 0.), vec3(1., 0., 1.),
8069				vec3(1., 1., 0.), vec3(1., 1., 1.),
8070				vec3(0., 1., 0.), vec3(0., 1., 1.)
8071			);
8072
8073			vec2 computeShiftedPosition1(vec2 xy, float levelOriginX) {
8074				vec2 xyShifted = xy;
8075				xyShifted.x += levelOriginX;
8076				return (xyShifted + halfPixelOffset) / pyramidTexture1Size;
8077			}
8078
8079			vec2 computeShiftedPosition2(vec2 xy, float levelOriginX) {
8080				vec2 xyShifted = xy;
8081				xyShifted.x += levelOriginX;
8082				return (xyShifted + halfPixelOffset) / pyramidTexture2Size;
8083			}
8084
8085			vec4 unpackVec3ToRGBA(vec3 vec) {
8086				uint combined = uint(vec.x * 65535.0 + 0.5); // Add 0.5 for rounding
8087				float g = float(combined & uint(0xFF)) * 0.00392156862; // 1/255
8088				float r = float((combined >> 8) & uint(0xFF)) * 0.00392156862; 
8089		
8090				return vec4(r, g, vec.y, vec.z);
8091			}
8092
8093			out vec4 marchColor;
8094			// end of marchvertPre
8095		#endif
8096		`,i=`
8097		#ifdef SHAPEBLEND
8098			float triIndex = floor(float(gl_VertexID/3));
8099			float vertexIndex = float(gl_VertexID);
8100			
8101			// Initial pyramid lookup
8102			float levelOriginX1 = pyramidTexture1Size.x - 2.;
8103			float levelOriginX2 = pyramidTexture2Size.x - 1.;
8104			vec2 xy = vec2(0.);
8105			vec4 lookUp = texture(pyramidTexture2, computeShiftedPosition2(xy, levelOriginX2));
8106			
8107			// Early exit check
8108			if (triIndex >= lookUp.r) return;
8109			
8110			// Optimize loop variables
8111			float start = 0.;
8112			vec4 triIndexVec = vec4(triIndex);
8113			
8114			// Main position computation loop
8115			for (int i = 0; i < LOOP;) {
8116				// Compute boundaries
8117				vec4 ends = lookUp + vec4(start);
8118				vec4 starts = vec4(ends.gba, start);
8119				vec4 check = vec4(greaterThanEqual(triIndexVec, starts)) * 
8120											vec4(lessThan(triIndexVec, ends));
8121				
8122				// Update position
8123				xy *= 2.;
8124				xy += check.r * rShift + check.g * gShift + check.b * bShift;
8125				
8126				// Update loop variables
8127				start = dot(check, starts);
8128				levelOriginX2 -= levelShiftX[i];
8129				
8130				// Update lookup
8131				lookUp = texture(pyramidTexture1, computeShiftedPosition1(xy, levelOriginX1));
8132				i++;
8133
8134				ends = lookUp + vec4(start);
8135				starts = vec4(ends.gba, start);
8136				check = vec4(greaterThanEqual(triIndexVec, starts)) * 
8137											vec4(lessThan(triIndexVec, ends));
8138				
8139				// Update position
8140				xy *= 2.;
8141				xy += check.r * rShift + check.g * gShift + check.b * bShift;
8142				
8143				// Update loop variables
8144				start = dot(check, starts);
8145				levelOriginX1 -= levelShiftX[i];
8146				
8147				// Update lookup
8148				lookUp = texture(pyramidTexture2, computeShiftedPosition2(xy, levelOriginX2));
8149
8150				i++;
8151			}
8152
8153			#if HALF == 1
8154				vec4 ends = lookUp + vec4(start);
8155				vec4 starts = vec4(ends.gba, start);
8156				vec4 check = vec4(greaterThanEqual(triIndexVec, starts)) * vec4(lessThan(triIndexVec, ends));
8157			
8158				// Update position
8159				xy *= 2.;
8160				xy += check.r * rShift + check.g * gShift + check.b * bShift;
8161			
8162				// Update loop variables
8163				start = dot(check, starts);
8164			#endif
8165			
8166			// Compute final coordinates
8167			vec3 gridPos;
8168			gridPos.x = mod(xy.x, VOXEL_RESOLUTION);
8169			gridPos.y = mod(xy.y, VOXEL_RESOLUTION);
8170			gridPos.z = floor(xy.x * INV_VOXEL_RESOLUTION) + 
8171									floor(xy.y * INV_VOXEL_RESOLUTION) * Z_LAYERS_PER_ROW;
8172			
8173			// Vertex key computation
8174			vertexIndex -= start * 3.;
8175			float vk = vertexIndex * 0.0625 + 0.03125; // Optimized division by 16 and addition of 1/32
8176			
8177			// Voxel lookup and edge computation
8178			vec4 voxel = look(gridPos.x, gridPos.y, gridPos.z, voxelPassTexture);
8179			float key = (voxel.w + 0.5) * 0.00390625; // Optimized division by 256
8180			
8181			// Edge lookup and offset computation
8182			float edgeNum = texture(triTable, vec2(vk, key)).x;
8183			int edgeIndex = int(edgeNum) * 2;
8184			
8185			// Compute edge positions
8186			vec3 p1 = gridPos + offsets[edgeIndex];
8187			vec3 p2 = gridPos + offsets[edgeIndex + 1];
8188			
8189			// Compute potentials and normals
8190			vec4 potential1 = look(p1.x, p1.y, p1.z, potentialPassTexture);
8191			vec4 potential2 = look(p2.x, p2.y, p2.z, potentialPassTexture);
8192			
8193			// Final position and normal computation
8194			float mu = potential1.r / (potential1.r - potential2.r);
8195
8196			marchColor = mix(
8197				unpackVec3ToRGBA(potential1.gba),
8198				unpackVec3ToRGBA(potential2.gba),
8199				mu
8200			);
8201
8202			transformed = p1 + (p2 - p1) * mu;
8203			transformed -= originOffset;
8204			transformed *= scale;
8205			vec4 data1 = look(p1.x, p1.y, p1.z, voxelPassTexture);
8206			vec4 data2 = look(p2.x, p2.y, p2.z, voxelPassTexture);
8207			objectNormal = normalize(mix(data1.xyz, data2.xyz, mu));
8208			transformedNormal = normalMatrix * objectNormal;
8209			#ifndef FLAT_SHADED
8210				vNormal = transformedNormal;
8211			#endif
8212		#endif
8213		`;e.vertexShader=t+e.vertexShader.replace("#include <project_vertex>",i+`
8214#include <project_vertex>`);let r=e.fragmentShader.match(/vec3 diffuseColor[^\n]*\n/);if(!r)return;let s=`
8215		#ifdef SHAPEBLEND_C
8216			#if SHAPEBLEND_C == 1
8217				${r[0].replace(/nodeU0,/g,"marchColor.rgb,").replace(/nodeU\d+(?=,g_uid\d+_calpha\))/g,"marchColor.a")}
8218			#else
8219				${r[0]}
8220			#endif
8221		#else
8222			${r[0]}
8223		#endif
8224		`;e.fragmentShader=`in vec4 marchColor;
8225`+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 ga(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=`
8226				precision highp float;
8227
8228				varying vec2 vUv;
8229
8230				void main() {
8231						gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
8232						vUv = uv;
8233				}
8234			`,r.fragmentShader=`
8235				layout(location = 1) out vec4 gVelocity;
8236
8237				precision highp float;
8238				
8239				uniform sampler2D inputTexture;
8240				varying vec2 vUv;
8241
8242				uniform vec2 pyramidTextureSize;
8243
8244				void main() {
8245						// Sample the input texture using UV coordinates
8246						gl_FragColor = texture(inputTexture, vUv);
8247						gVelocity = vec4(0.0);
8248				}
8249			`,t.pyramidTextureSize.value=new j(this.pyramidRenderTarget.width,this.pyramidRenderTarget.height),Object.assign(r.uniforms,t)};this.material.shapeBlendhack=i,this.material.root.shapeBlendhack=i}},Qo=bT;Qo.streamCompaction=new XY;var YY=new be,QY=new be,Dl=new ot,Sn=new M,Zu=new M,ZY=new ot;function KY(e,t=0){let i=this.children.length;for(;i--;){let r=this.children[i];qo.is(r)&&wT.call(r,e,t+1)}}function wT(e,t=0){if(e(this,t)!==!0){let i=this.children.length;for(;i--;){let r=this.children[i];qo.is(r)&&wT.call(r,e,t+1)}}}function JY(){if(this.shapesDataTexture.value===void 0){let n=new Pr(ne
8249w Float32Array(4*rr*Ao),rr,Ao,ri,Vt);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=YY.copy(this.matrixWorld).invert(),a=0;KY.call(this,n=>{var v;if(n.visible===!1)return!0;let o;if(n instanceof cs||n instanceof kc||n instanceof Uc)return;n instanceof cr?o=n.object:o=n;let l=(v=n.data)==null?void 0:v.cloner;if(Ct.is(n)&&l&&!l.hideBase&&l.type!=="radial"&&l.disabled!==!0||!(o instanceof Ei))return;let h=o.geometry.userData.parameters,c=h.shapeBlendNode;if(c===void 0)return;if(QY.multiplyMatrices(s,n.matrixWorld).decompose(Zu,Dl,Sn),h.type==="TorusGeometry"&&h.arc!==360){let y=h.arc*Math.PI/180;y=y/4,Dl.multiply(ZY.set(0,0,Math.sin(y),Math.cos(y)))}let d=c.overrideGlobalBlend?c.blendRange:r;d=d/this.bboxSize*2,t[a*4]=(Zu.x-this.bboxOffset)/this.bboxSize*2,t[a*4+1]=(Zu.y-this.bboxOffset)/this.bboxSize*2,t[a*4+2]=(Zu.z-this.bboxOffset)/this.bboxSize*2,t[a*4+3]=c.operation===0?1:c.operation===2?-1:-2,t[rr*4+a*4]=-Dl.x,t[rr*4+a*4+1]=-Dl.y,t[rr*4+a*4+2]=-Dl.z,t[rr*4+a*4+3]=Dl.w;let u=new Float32Array(4),p=0;if(h.type==="SphereGeometry")h.width===h.height&&h.width===h.depth?u[0]=0:u[0]=1,u[1]=h.width/this.bboxSize,u[2]=h.height/this.bboxSize,u[3]=h.depth/this.bboxSize,i=Math.max(i,u[1]*Sn.x+d,u[2]*Sn.x+d,u[3]*Sn.x+d);else if(h.type==="CubeGeometry"){p=h.cornerRadius;let y=h.width,x=h.height,w=h.depth;u[0]=2,u[1]=(y-2*p)/this.bboxSize,u[2]=(x-2*p)/this.bboxSize,u[3]=(w-2*p)/this.bboxSize,i=Math.max(i,Math.sqrt(y**2+x**2+w**2)/this.bboxSize*Sn.x+d)}else if(h.type==="CylinderGeometry"){p=h.cornerRadius;let y=h.height,x=h.radiusBottom,w=h.radiusTop;if(w>=x){let S=Math.atan2(w-x,y),b=(Math.PI/2-S)/2;w-=p/Math.tan(b),x-=p*Math.tan(b)}else if(x>w){let S=Math.atan2(x-w,y),b=(Math.PI/2-S)/2;w-=p*Math.tan(b),x-=p/Math.tan(b)}u[1]=(h.height-2*p)/this.bboxSize,x===w?(u[0]=3,u[2]=x/this.bboxSize*2):(u[0]=4,u[2]=x/this.bboxSize*2,u[3]=w/this.bboxSize*2),i=Math.max(i,u[1]*4*Sn.x+d)}else if(h.type==="TorusGeometry"){if(u[0]=5,u[1]=(h.width-h.depth)/this.bboxSize,u[2]=h.depth/this.bboxSize,h.arc!==360){u[0]=6,u[3]=u[1],t[rr*12+a*4+3]=u[2];let y=2*Math.atan2(u[2]/2,u[1]),x=h.arc*Math.PI/180/2-y;u[1]=Math.sin(x),u[2]=Math.cos(x)}i=Math.max(i,h.width*Sn.x/this.bboxSize+d)}t.set(u,rr*8+a*4),t[rr*12+a*4]=d,t[rr*12+a*4+1]=p/this.bboxSize*2,t[rr*12+a*4+2]=Sn.x;let f=o.material,g=f.uniforms.nodeU0.node.value,m=f.uniforms.nodeU1.value;c.operation!==0&&!c.useColor&&(m=-1),t[rr*16+a*4]=g.r,t[rr*16+a*4+1]=g.g,t[rr*16+a*4+2]=g.b,t[rr*16+a*4+3]=m,m<1&&this.material.defines.SHAPEBLEND_C===1&&(this.material.transparent=!0),a++}),this.npart=a,this.spatialPassUniforms.span.value=i*1.4}var ST=512;function hA(e,t){let i=!1,r=e.layers.mask&ST,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,E1(e),M1(e)),s.length===0&&a.length===0&&e.layers.set(0),r&&e.layers.set(9),e instanceof Nh&&e.needsAO&&e.layers.enable(5),i}function cA(e,t){if(!t.layers)return!1;let i=e.layers.mask&ST,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 $Y(e){let t=!1;return e.traverseEntity(i=>{if(i instanceof Nh)if(Array.isArray(i.material))for(let r=0;r<i.material.length;r++)hA(i,i.material[r])&&(t=!0);else hA(i,i.material)&&(t=!0)}),t}function eQ(e){let t=!1;return e.traverseEntity(i=>{if(i instanceof Nh)if(Array.isArray(i.material))for(let r=0;r<i.material.length;r++)cA(i,i.material[r])&&(t=!0);else cA(i,i.material)&&(t=!0)}),t}var tQ=new o2,iQ=new be,rQ=new Eh;function ty(e,t,i,r=!1){let s=e.cloner;if(s)for(let a of s.children){let n=iQ.copy(a.matrixWorld).invert(),o=rQ.copy(t.ray).applyMatrix4(n),l=e.matrixWorld;o.applyMatrix4(l);let h=tQ;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 sQ=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)}
8249applyConstraints(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}},aQ="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL",jn=class{};Mo(jn,"DepthMapRange",65536),Mo(jn,"MemoryPageSize",65536),Mo(jn,"BytesPerFloat",4),Mo(jn,"BytesPerInt",4);function nQ(e){let t,i,r,s,a,n,o,l,h,c,d,u,p,f,g,m;function v(T){let P=new Float64Array(c,n,16);for(let D=0;D<16;D++)P[D]=T[D];let O;if(r>1){t.exports.sortIndexes(s,a,h,n,o,l,u.DepthMapRange,r);let D=new Uint32Array(r);O=D.buffer,D.set(new Uint32Array(c,l,r))}else if(r===1){let D=new Uint32Array(r);D[0]=new Uint32Array(c,s,i)[0],O=D.buffer}else O=new ArrayBuffer(0);e.postMessage({sortDone:!0,indexesBuffer:O},[O])}function y(T,P,O){let D=new Float32Array(c,a,i*3);r=0;let k=new Uint32Array(c,s,i);for(let W=0;W<O.length-1;W++){let N=P[W],F=T[W].elements,Z=N.filter(G=>G.enabled&&G.mode==="Include").map(G=>G.type==="Box"?b(G):E(G)),q=N.filter(G=>G.enabled&&G.mode==="Exclude").map(G=>G.type==="Box"?b(G):E(G));for(let G=O[W];G<O[W+1];G++){let Q=p[G*3],ee=p[G*3+1],Y=p[G*3+2];if((Z.length===0||w(Q,ee,Y,Z))&&(q.length===0||!w(Q,ee,Y,q))){let $=1/(F[3]*Q+F[7]*ee+F[11]*Y+F[15]);D[r*3]=(F[0]*Q+F[4]*ee+F[8]*Y+F[12])*$,D[r*3+1]=(F[1]*Q+F[5]*ee+F[9]*Y+F[13])*$,D[r*3+2]=(F[2]*Q+F[6]*ee+F[10]*Y+F[14])*$,k[r]=G,r++}}}}function x(T,P){let O=[],D=P.filter(N=>N.enabled&&N.mode==="Include").map(N=>N.type==="Box"?b(N):E(N)),k=P.filter(N=>N.enabled&&N.mode==="Exclude").map(N=>N.type==="Box"?b(N):E(N)),W=T.length;for(let N=0;N<W;N+=3){let F=T[N],Z=T[N+1],q=T[N+2];(D.length===0||w(F,Z,q,D))&&(k.length===0||!w(F,Z,q,k))||O.push(N/3)}return O}function w(T,P,O,D,k){return D.some(W=>{let N=S(T,P,O,W.invRotationMatrix,W.cropCenter);return Array.isArray(W)?_(N.x,N.y,N.z,W):C(N.x,N.y,N.z,W)})}function S(T,P,O,D,k){let W=T-k[0],N=P-k[1],F=O-k[2],Z=1/(D[3]*W+D[7]*N+D[11]*F+D[15]);return{x:(D[0]*W+D[4]*N+D[8]*F+D[12])*Z+k[0],y:(D[1]*W+D[5]*N+D[9]*F+D[13])*Z+k[1],z:(D[2]*W+D[6]*N+D[10]*F+D[14])*Z+k[2]}}function b(T){let P=T.cropSize[0]/2,O=T.cropSize[1]/2,D=T.cropSize[2]/2,k=[T.cropCenter[0]-P,T.cropCenter[1]-O,T.cropCenter[2]-D,T.cropCenter[0]+P,T.cropCenter[1]+O,T.cropCenter[2]+D],W=A(T.cropRotation);return Object.assign(k,{invRotationMatrix:W,cropCenter:T.cropCenter})}function A(T){let P=[],O=T[0]*Math.PI/180,D=T[1]*Math.PI/180,k=T[2]*Math.PI/180,W=Math.cos(O),N=Math.sin(O),F=Math.cos(D),Z=Math.sin(D),q=Math.cos(k),G=Math.sin(k),Q=W*q,ee=W*G,Y=N*q,$=N*G;return P[0]=F*q,P[1]=-F*G,P[2]=Z,P[4]=ee+Y*Z,P[5]=Q-$*Z,P[6]=-N*F,P[8]=$-Q*Z,P[9]=Y+ee*Z,P[10]=W*F,P[12]=0,P[13]=0,P[14]=0,P[3]=0,P[7]=0,P[11]=0,P[15]=1,P}function _(T,P,O,D){return T>=D[0]&&T<=D[3]&&P>=D[1]&&P<=D[4]&&O>=D[2]&&O<=D[5]}function E(T){let P=2/T.cropSize[0],O=2/T.cropSize[1],D=2/T.cropSize[2],k=A(T.cropRotation);return{invRadiusX:P,invRadiusY:O,invRadiusZ:D,cropCenter:T.cropCenter,invRotationMatrix:k}}function C(T,P,O,D){let k=(T-D.cropCenter[0])*D.invRadiusX,W=(P-D.cropCenter[1])*D.invRadiusY,N=(O-D.cropCenter[2])*D.invRadiusZ;return k*k+W*W+N*N<=1}e.onmessage=T=>{if(T.data.getCroppedIndexes){let P=new Uint32Array(x(new Float32Array(T.data.positions),T.data.crops)).buffer;e.postMessage({outOfBoundsIndexes:P},[P])}else if(T.data.positions)d=T.data.positions,p=new Float32Array(d),g=T.data.meshMatrixWorlds,m=T.data.cropsArray,f=T.data.meshIndexIntervals,y(g,m,f),e.postMessage({sortSetupComplete:!0});else if(T.data.sort||T.data.newMatrixWorlds||T.data.newCropsArray)(T.data.newMatrixWorlds||T.data.newCropsArray)&&(m=T.data.newCropsArray||m,g=T.data.newMatrixWorlds||g,y(g,m,f)),v(T.data.sort.view,T.data.sort.cameraPosition);else if(T.data.init){u=T.data.init.Constants,i=T.data.init.splatCount;let P=u.BytesPerInt,O=u.BytesPerFloat*3,D=new Uint8Array(T.data.init.sorterWasmBytes),k=P
8249+O,W=i*k,N=i*u.BytesPerInt*2+u.DepthMapRange*u.BytesPerInt*2,F=u.MemoryPageSize*32,Z=W+N+F,q=Math.floor(Z/u.MemoryPageSize)+1,G={module:{},env:{memory:new WebAssembly.Memory({initial:q*2,maximum:q*3,shared:!0})}};WebAssembly.compile(D).then(Q=>WebAssembly.instantiate(Q,G)).then(Q=>{t=Q,s=0,a=i*P,n=a+i*O,h=n+16*u.BytesPerFloat*2,o=h+i*u.BytesPerInt,l=o+u.DepthMapRange*u.BytesPerInt,c=G.env.memory.buffer,e.postMessage({sortSetupPhase1Complete:!0})})}}}function oQ(e){let t=new Worker(URL.createObjectURL(new Blob(["(",nQ.toString(),")(self)"],{type:"application/javascript"}))),i=atob(aQ),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:jn.BytesPerFloat,BytesPerInt:jn.BytesPerInt,DepthMapRange:jn.DepthMapRange,MemoryPageSize:jn.MemoryPageSize}}}),t}var Hg=function(){let e=new Float32Array(1),t=new Int32Array(e.buffer);return function(i){return e[0]=i,t[0]}}(),lQ=function(e,t,i,r){return e+(t<<8)+(i<<16)+(r<<24)},Ku=new j;function dA(e){let t=!1;return e.scene.objects.traverse((i,r)=>{if(r.visible===!1)return!0;r.type==="Splat"&&(t=!0)}),t}var vp=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=vp.buildGeomtery(t),o=vp.buildMaterial(s);return new vp(e,t,n,o,i,r,s,a)}static buildMaterial(e){let t=`
8250            precision highp float;
8251            #include <common>
8252
8253            attribute uint splatIndex;
8254
8255            uniform highp sampler2D covariancesTexture;
8256            uniform highp usampler2D centersColorsTexture;
8257            uniform vec2 focal;
8258            uniform vec2 viewport;
8259            uniform vec2 basisViewport;
8260            uniform vec2 covariancesTextureSize;
8261            uniform vec2 centersColorsTextureSize;
8262						uniform highp sampler2D meshMatrixWorldsTexture;
8263						uniform uint meshIndexIntervals[257];
8264						uniform float orthoZoom;
8265
8266            varying vec4 vColor;
8267            varying vec2 vUv;
8268
8269            varying vec2 vPosition;
8270
8271            const vec4 encodeNorm4 = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);
8272            const uvec4 mask4 = uvec4(uint(0x000000FF), uint(0x0000FF00), uint(0x00FF0000), uint(0xFF000000));
8273            const uvec4 shift4 = uvec4(0, 8, 16, 24);
8274            vec4 uintToRGBAVec (uint u) {
8275               uvec4 urgba = mask4 & u;
8276               urgba = urgba >> shift4;
8277               vec4 rgba = vec4(urgba) * encodeNorm4;
8278               return rgba;
8279            }
8280
8281            vec2 getDataUV(in int stride, in int offset, in vec2 dimensions) {
8282                vec2 samplerUV = vec2(0.0, 0.0);
8283                float d = float(splatIndex * uint(stride) + uint(offset)) / dimensions.x;
8284                samplerUV.y = float(floor(d)) / dimensions.y;
8285                samplerUV.x = fract(d);
8286                return samplerUV;
8287            }
8288
8289            void main () {
8290                uvec4 sampledCenterColor = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize));
8291                vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenterColor.gba));
8292                vColor = uintToRGBAVec(sampledCenterColor.r);
8293
8294                vPosition = position.xy * 2.0;
8295
8296								uint meshIndex;
8297								for (int i = 1; i < 257; i++) {
8298									if (splatIndex < meshIndexIntervals[i]) {
8299										meshIndex = uint(i - 1);
8300										break;
8301									}
8302								}
8303
8304								float strideMulmeshIndex = float(4u*meshIndex);
8305								float meshMatrixWorldsTextureLength = float(256*4);
8306
8307								mat4 modelMat = mat4(
8308									texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+0.0)/meshMatrixWorldsTextureLength, 0)),
8309									texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+1.0)/meshMatrixWorldsTextureLength, 0)),
8310									texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+2.0)/meshMatrixWorldsTextureLength, 0)),
8311									texture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+3.0)/meshMatrixWorldsTextureLength, 0))
8312								);
8313								mat4 modelViewMat = viewMatrix * modelMat;
8314								vec4 viewCenter = modelViewMat * vec4(splatCenter, 1.0); 
8315                vec4 clipCenter = projectionMatrix * viewCenter;
8316
8317                vec2 sampledCovarianceA = texture(covariancesTexture, getDataUV(3, 0, covariancesTextureSize)).rg;
8318                vec2 sampledCovarianceB = texture(covariancesTexture, getDataUV(3, 1, covariancesTextureSize)).rg;
8319                vec2 sampledCovarianceC = texture(covariancesTexture, getDataUV(3, 2, covariancesTextureSize)).rg;
8320
8321                vec3 cov3D_M11_M12_M13 = vec3(sampledCovarianceA.rg, sampledCovarianceB.r);
8322                vec3 cov3D_M22_M23_M33 = vec3(sampledCovarianceB.g, sampledCovarianceC.rg);
8323
8324                // Compute the 2D covariance matrix from the upper-right portion of the 3D covariance matrix
8325                mat3 Vrk = mat3(
8326                    cov3D_M11_M12_M13.x, cov3D_M11_M12_M13.y, cov3D_M11_M12_M13.z,
8327                    cov3D_M11_M12_M13.y, cov3D_M22_M23_M33.x, cov3D_M22_M23_M33.y,
8328                    cov3D_M11_M12_M13.z, cov3D_M22_M23_M33.y, cov3D_M22_M23_M33.z
8329                );
8330                float s = 1.0 / (viewCenter.z * viewCenter.z);
8331
8332                mat3 W = transpose(mat3(modelViewMat));
8333                mat3 T = orthoZoom > 0.0 ? W : W * mat3(
8334									focal.x / viewCenter.z, 0., -(focal.x * viewCenter.x) * s,
8335									0., focal.y / viewCenter.z, -(focal.y * viewCenter.y) * s,
8336									0., 0., 0.
8337								);
8338                mat3 cov2Dm = transpose(T) * Vrk * T;
8339                cov2Dm[0][0] += 0.3;
8340                cov2Dm[1][1] += 0.3;
8341
8342                // We are interested in the upper-left 2x2 portion of the projected 3D covariance matrix because
8343                // we only care about the X and Y values. We want the X-diagonal, cov2Dm[0][0],
8344                // the Y-diagonal, cov2Dm[1][1], and the correlation between the two cov2Dm[0][1]. We don't
8345                // need cov2Dm[1][0] because it is a symetric matrix.
8346                vec3 cov2Dv = vec3(cov2Dm[0][0], cov2Dm[0][1], cov2Dm[1][1]);
8347
8348                vec3 ndcCenter = clipCenter.xyz / clipCenter.w;
8349
8350                // We now need to solve for the eigen-values and eigen vectors of the 2D covariance matrix
8351                // so that we can determine the 2D basis for the splat. This is done using the method described
8352                // here: https://people.math.harvard.edu/~knill/teaching/math21b2004/exhibits/2dmatrices/index.html
8353                //
8354                // This is a different approach than in the original work at INRIA. In that work they compute the
8355                // max extents of the 2D covariance matrix in screen space to form an axis aligned boun
8355ding rectangle
8356                // which forms the geometry that is actually rasterized. They then use the inverse 2D covariance
8357                // matrix (called 'conic') to determine fragment opacity.
8358                float a = cov2Dv.x;
8359                float d = cov2Dv.z;
8360                float b = cov2Dv.y;
8361                float D = a * d - b * b;
8362                float trace = a + d;
8363                float traceOver2 = 0.5 * trace;
8364                float term2 = sqrt(trace * trace / 4.0 - D);
8365                float eigenValue1 = traceOver2 + term2;
8366								float eigenValue2 = max(traceOver2 - term2, 0.00); // prevent negative eigen value
8367
8368                const float maxSplatSize = 1024.0;
8369                vec2 eigenVector1 = normalize(vec2(b, eigenValue1 - a));
8370                // since the eigen vectors are orthogonal, we derive the second one from the first
8371                vec2 eigenVector2 = vec2(eigenVector1.y, -eigenVector1.x);
8372                vec2 basisVector1 = eigenVector1 * min(sqrt(2.0 * eigenValue1), maxSplatSize);
8373                vec2 basisVector2 = eigenVector2 * min(sqrt(2.0 * eigenValue2), maxSplatSize);
8374
8375                vec2 ndcOffset = vec2(vPosition.x * basisVector1 + vPosition.y * basisVector2) * basisViewport;
8376
8377								if (orthoZoom > 0.0) {
8378									ndcOffset *= orthoZoom;
8379								}
8380
8381                gl_Position = vec4(ndcCenter.xy + ndcOffset, ndcCenter.z, 1.0);
8382            }`,i=`
8383            precision highp float;
8384            #include <common>
8385
8386            uniform vec3 debugColor;
8387
8388            varying vec4 vColor;
8389            varying vec2 vUv;
8390
8391            varying vec2 vPosition;
8392						layout(location = 1) out vec4 gVelocity; 
8393
8394            void main () {
8395                // compute the negative squared distance from the center of the splat to the
8396                // current fragment in the splat's local space.
8397                float A = -dot(vPosition, vPosition);
8398                if (A < -4.0) discard;
8399                vec3 color = vColor.rgb;
8400                A = exp(A) * vColor.a;
8401                gl_FragColor = vec4(color.rgb, A);
8402								gVelocity = vec4(0.0); // so it is ignored by TAA
8403            }`,r={covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},meshIndexIntervals:{value:e},meshMatrixWorldsTexture:{type:"t",value:null},focal:{type:"v2",value:new j},viewport:{type:"v2",value:new j},basisViewport:{type:"v2",value:new j},debugColor:{type:"v3",value:new $e},covariancesTextureSize:{type:"v2",value:new j(1024,1024)},centersColorsTextureSize:{type:"v2",value:new j(1024,1024)},orthoZoom:{type:"f",value:-1}};return new Pt({uniforms:r,vertexShader:t,fragmentShader:i,transparent:!0,alphaTest:1,blending:Lo,depthTest:!0,depthWrite:!1,side:vr})}static buildGeomtery(e){let t=new je;t.setIndex([0,1,2,0,2,3]);let i=new Float32Array(4*3),r=new et(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 a2().copy(t),a=new Uint32Array(e),n=new Xc(a,1,!1);return n.setUsage(CD),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 j(4096,1024);for(;t.x*t.y*2<e*6;)t.y*=2;let i=new j(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]=sz.toHalfFloat(this.covariances[c]);r=new Pr(s,t.x,t.y,Sp,rn)}else s=new Float32Array(t.x*t.y*2),s.set(this.covariances),r=new Pr(s,t.x,t.y,Sp,Vt);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 d=c*4,u=c*3,p=c*4;a[p]=lQ(this.colors[d],this.colors[d+1],this.colors[d+2],this.colors[d+3]),a[p+1]=Hg(this.centers[u]),a[p+2]=Hg(this.centers[u+1]),a[p+3]=Hg(this.centers[u+2])}let n=new Pr(a,i.x,i.y,wM,Qa);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 Pr(l,o,1,ri,Vt);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&&(Ku.set(e.x*this.devicePixelRatio,e.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(Ku),this.material.uniforms.basisViewport.value.set(2/Ku.x,2/Ku.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()}},_T,hQ=new Promise(e=>{_T=e}),uA=!1,Ju;function cQ(){if(uA)return;if(Ju)return Ju;async function e(){let t=await $n(()=>import("./gaussian-splat-compression-ro4O0smp.js"),[]);_T(t),uA=!0}return Ju=e(),Ju}var AT;hQ.then(e=>AT=e);var dQ=class{constructor(e={}){Mo(this,"updateView",function(){let t=new be,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 u=!1,p=!1;if(s.dot(r)<=.95&&(u=!0),n.copy(l.position).sub(a).length()>
vendor: 4,761 bytes, line 8403
8403=1&&(p=!0),!u&&!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 d={sort:{view:t.elements,cameraPosition:i,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...h?{newMatrixWorlds:this.meshMatrixWorlds}:{},...c?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=d:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(d))}}()),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 be().makePerspective(-1,1,-1,1,.1,1e3)}updateSplatMeshUniforms(e,t){let i=new j;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 ot().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 AT.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;return this.splatEntries.forEach((t,i)=>{var r;t.data.crops.forEach((s,a)=>{this.cropsArray[i][a]===void 0?(e=!0,this.cropsArray[i][a]=s.data):Object.entries(s.data).forEach(([n,o])=>{var l;Array.isArray(o)&&o.some((h,c)=>h!==this.cropsArray[i][a][n][c])?(e=!0,this.cropsArray[i][a][n]=o):o!==((l=this.cropsArray[i][a])==null?void 0:l[n])&&(e=!0,this.cropsArray[i][a][n]=o)})}),t.data.crops.length!==((r=this.cropsArray[i])==null?void 0:r.length)&&(this.cropsArray[i].length=t.data.crops.length,e=!0)}),e}setupSplatMesh(e,t,i=new M,r=new ot,s=!1,a=1,n,o){this.splatMesh=vp.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=oQ(e),this.sortWorker.onmessage=t=>{var i;t.data.sortDone?(this.sortRunning=!1,(i=this.splatMesh)==null||i.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}},iy=new sn;iy.wireframe=!0;var pA=new M,k1=class extends Gr{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={}
vendor: 4,546 bytes, line 8403
8403,this.entityIdentityToEntity={},this.toExpandCloner=new Set,this.toUpdateCloner=new Set,this.pendingCommands=[],this.pathConstraints=new sQ,this.invisibleObjects=new oh("jflkdsafjasdifjaslk",{...l0.defaultData,visible:!1,name:"buildin invisible"}),this.needsRecomputeInstances=!1,this.init(e,t),this.matrixAutoUpdate=!1,this.errorPage=new Xi("fdasfa",{...wh.defaultData,name:""},{shared:t,scene:this})}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=eQ(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._needsNormal=$Y(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 Xi&&(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)=>X2(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===Fh)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 Xi&&t.uiScene){let i=t.uiScene.find(e);if(i)return i}}findScene2DfromObject2D(e){for(let t of this.children)if(t instanceof Xi&&t.uiScene&&t.uiScene.find(e))return t.uiScene}find2DInUIObjects(e){let t;return this.traverseEntity(i=>{t===void 0&&i instanceof gr&&(t=i.uiCanvas.find(e))}),t}traverse2D(e){for(let t of this.children)t instanceof Xi&&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}}addPendingExpandCloner(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(){this.toExpandCloner.forEach(e=>{e.expandCloner(this)}),this.toExpandCloner.clear()}doPendingUpdateCloner(){this.toUpdateCloner.forEach(e=>{var t;(t=e.cloner)==null||t.update()}),this.toUpdateCloner.clear()}doPendingUpdates(){this.doPendingExpandCloner(),this.doPendingUpdateCloner(),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){var i;if(e.path.length===0&&e.type===7){let r=e.parent===null?this:this.find(e.parent);if(r===void 0)throw new Error("unexpected");let s=this.createObject(e.id,e.data,e.children,r,e.localIndex,t);s.updateVisible(this),s.resetBBoxNeedsUpdate(),Ds(s)&&$a(s.parent)&&(s.invalidateUpstreamBooleanData(),s.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(r),this.markNeedsRecomputeInstancesForChildren(s),this.markToExpandCloner(s),this.markPenumbraSizeDirty(),s.updatePathSnapping()}else if(e.path.length===0&&e.type===8){let r=this.find(e.id);if(r===void 0)throw new Error("unexpected");r.traverseEntity(a=>{a instanceof Qo&&(this.shapeBlendIntances=this.shapeBlendIntances.filter(n=>n!==a))}),this.markToExpandCloner(r),r.resetBBoxNeedsUpdate(),this.unregisterObject(r);let s=r.parent;this.markNeedsRecomputeInstancesForAncessors(s),this.markNeedsRecomputeInstancesForChildren(r),this.markPenumbraSizeDirty(),r.parent.remove(r),$a(r.parent)&&(r.parent.invali
vendor: 29,614 bytes, line 8403
8403dateUpstreamBooleanData(),r.parent.invalidateDownstreamBooleanData().recomputeBoolean()),Ds(r)&&(r.freeBooleanPointer(),s instanceof Yo&&s.invalidateDownstreamBooleanData().recomputeBoolean()),r instanceof L1&&r.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(r),this.pathConstraints.removeDependencies(r.uuid),r.updatePathSnapping()}else if(e.path.length===0&&e.type===9){let r=this.find(e.id);if(r===void 0)throw new Error("unexpected");this.markNeedsRecomputeInstancesForChildren(r);let s=r.parent;this.markNeedsRecomputeInstancesForAncessors(s),(i=r.cloner)==null||i.resetOnMove(),this.markToExpandCloner(r);let a=e.parent===null?this:this.find(e.parent);if(a===void 0)throw new Error("unexpected");a.add(r),this.markNeedsRecomputeInstancesForAncessors(a),this.markToExpandCloner(r),r.invalidateClonerTransform(r),r.updateVisible(this),r.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let n=e.localIndex;a.children.splice(n,0,a.children.pop()),Ds(r)&&(r.invalidateUpstreamBooleanData(),$a(r.parent)?r.parent.invalidateDownstreamBooleanData().recomputeBoolean():s instanceof Yo&&s.invalidateDownstreamBooleanData().recomputeBoolean()),r.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(e){var t;this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage;for(let i of this.children)i instanceof Xi&&(i.visible=i.uuid===e,i.visible&&(this.activePage=i,this.activePage.onActive(this)));this.activePage!==((t=this.splatViewer)==null?void 0:t.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{WY(s,t,i,{scene:this,shared:r}),s instanceof Ei&&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 gr||n instanceof Xi)&&(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 yr&&r.updateUp()}),this.doPendingExpandCloner(),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(e){e.traverseEntity(t=>{(t.data.type==="Component"||t.data.type==="Instance")&&this.markNeedsRecomputeInstances()})}markNeedsRecomputeInstancesForAncessors(e){Ct.is(e)&&(e.data.type==="Component"&&this.markNeedsRecomputeInstances(),e.traverseAncestors(t=>{Ct.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=rd(l.data,h=>{let c=h.events.data(n.id),d=l.goUp(a);if(d){let u=[...q2(d.identity),e].join("-"),p=this.entityIdentityToEntity[u];if(p){let f=p.uuid,g=Fi.zoom(c,t);g[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 lh&&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=rd(a.data,n=>{a.isInstanceRoot||(n.events.delete(r.id),s=!0)}).data}),s===!1)for(let a of af.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 lh&&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),z1(s)}recomputeInstances(e,t){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity(i=>{i instanceof lh&&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)Ct.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(Ct.is(a)&&!a.raycastLock&&(a.visible||n!=null&&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(Ds(a)||H0(a)&&this.enableHelpers&&a.objectHelper.visible)&&(e.intersectObject(a,!1,i),ty(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;Ct.is(s)&&(s.visible||a!=null&&a.object.data.visible)&&((Ds(s)||H0(s)&&this.enableHelpers&&s.objectHelper.visible)&&(e.intersectObject(s,!1,t),ty(s,e,t,!0)),i(s))}};return i(this),t}forEachEntity(e){for(let t of this.children)Ct.is(t)&&e(t)}traverseConcreteEntity(e){for(let t of this.children)Ct.is(t)&&t.isConcreteEntity&&t.traverseEntity(e)}traverseEntity(e){for(let t of this.children)Ct.is(t)&&t.traverseEntity(e)}updateFont(e,t){this.traverseEntity(i=>{if(i instanceof Ei&&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);let a=i.invalidateDownstreamBooleanData();$a(a)&&a.recomputeBoolean()})}})}traverseObject(e){for(let t of this.children)qo.is(t)&&t.traverseObject(e)}traverseVisibleEntity(e){for(let t of this.children)Ct.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){var l;let n={scene:this,shared:a},o=F1(e,t,n);return o instanceof Qo&&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 Ei&&o.updateGeometryGroupsIfNeeded(),o.updateVisible(this),o.cloner&&this.toExpandCloner.add(o),(l=t.pathSnapping)!=null&&l.pathId&&this.pathConstraints.setConstraint(e,t.pathSnapping.pathId)),t.type==="Empty"&&t.animations&&o.traverseEntity(h=>{let c=h.dataPatched;if(h instanceof Ei&&c.bones&&c.boneInverses){let d=c.bones.map(f=>this.find(f)),u=c.boneInverses.map(f=>new be().fromArray(f)),p=new _y(d,u);h.bind(p,h.bindMatrix)}else h.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 xi;return i.setFromPoints(t),i.getCenter(pA),pA}copyMatrixWorld(e,t){if(e===null){t.identity();return}let i=this.find(e);i?t.copy(i.matrixWorld):t.identity()}copyParentMatrixWorld(e,t){var r;if(e===null){t.identity();return}let i=(r=this.find(e))==null?void 0:r.parent;i?t.copy(i.matrixWorld):t.identity()}traverseMaterial(e){this.traverseEntity(t=>{if(t instanceof Or)if(Array.isArray(t.material))for(let i=0;i<t.material.length;i++)t.material[i]instanceof Kn&&e(t.material[i]);else t.material instanceof Kn&&e(t.material)})}updateViewPlaneSize(e,t,i=!1){this.traverseConcreteEntity(r=>{r instanceof yr&&r.setViewplaneSize(e,t,i)})}initializeSplatViewer(){this.splatViewer=new dQ({scene:this}),this.reloadSplats()}reloadSplats(){var e;(e=this.splatViewer)==null||e.loadSplat()}},yp=(e,t)=>{let i=t.x-e.x,r=t.y-e.y;return Math.sqrt(i*i+r*r)},uQ=(e,t)=>{let i=t.x-e.x,r=t.y-e.y;return fQ(Math.atan2(r,i))},pQ=(e,t,i)=>{let r={x:0,y:0};return i=ry(i),r.x=e.x-t*Math.cos(i),r.y=e.y-t*Math.sin(i),r},ry=e=>e*(Math.PI/180),fQ=e=>e*(180/Math.PI),mQ=e=>isNaN(e.buttons)?e.pressure!==0:e.buttons!==0,Wg=new Map,fA=e=>{Wg.has(e)&&clearTimeout(Wg.get(e)),Wg.set(e,setTimeout(e,100))},Sf=(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)},mA=(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)},MT=e=>(e.preventDefault(),e.type.match(/^touch/)?e.changedTouches:e),gA=()=>{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}},sy=(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")},U1=(e,t,i)=>{let r=ET(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},gQ=(e,t)=>{let i=ET(e);for(let r in i)i.hasOwnProperty(r)&&(i[r]=t);return i},ET=e=>{let t={};return t[e]="",["webkit","Moz","o"].forEach(function(i){t[i+e.charAt(0).toUpperCase()+e.slice(1)]=""}),t},qg=(e,t)=>{for(let i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},vQ=(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},ay=(e,t)=>{if(e.length)for(let i=0,r=e.length;i<r;i+=1)t(e[i]);else t(e)},yQ=(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"&&(CT="ontouchstart"in window,TT=!!window.PointerEvent,PT=!!window.MSPointerEvent);var CT,TT,PT,uc={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"}},Ql,pd={};TT?Ql=uc.pointer:PT?Ql=uc.MSPointer:CT?(Ql=uc.touch,pd=uc.mouse):Ql=uc.mouse;function tl(){}tl.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};tl.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};tl.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)})};tl.prototype.config=function(e){var t=this;t.options=t.defaults||{},e&&(t.options=vQ(t.options,e))};tl.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.')},Sf(e,Ql[t],i._domHandlers_[t]),pd[t]&&Sf(e,pd[t],i._domHandlers_[t]),i};tl.prototype.unbindEvt=function(e,t){var i=this;return i._domHandlers_=i._domHandlers_||{},mA(e,Ql[t],i._domHandlers_[t]),pd[t]&&mA(e,pd[t],i._domHandlers_[t]),delete i._domHandlers_[t],this};var N1=tl;function Vi(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=Vi.id,Vi.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}Vi.prototype=new N1;Vi.constructor=Vi;Vi.id=0;Vi.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)};Vi.prototype.stylize=function(){if(this.options.dataOnly)return this;var e=this.options.fadeTime+"ms",t=gQ("borderRadius","50%"),i=U1("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)"},qg(r.el,i),this.options.shape==="circle"&&qg(r.back,t),qg(r.front,t),this.applyStyles(r),this};Vi.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};Vi.prototype.addToDom=function(){return this.options.dataOnly||document.body.contains(this.ui.el)?this:(this.options.zone.appendChild(this.ui.el),this)};Vi.prototype.removeFromDom=function(){return this.options.dataOnly||!document.body.contains(this.ui.el)?this:(this.options.zone.removeChild(this.ui.el),this)};Vi.prototype.destroy=function(){clearTimeout(this.removeTimeout),clearTimeout(this.showTimeout),clearTimeout(this.restTimeout),this.trigger("destroyed",this.instance),this.removeFromDom(),this.off()};Vi.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};Vi.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};Vi.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=U1("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)};Vi.prototype.restCallback=function(){var e=this,t={};t.front=U1("transition","none",""),e.applyStyles(t),e.trigger("rested",e.instance)};Vi.prototype.resetDirection=function(){this.direction={x:!1,y:!1,angle:!1}};Vi.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 xQ=Vi;function bi(e,t){var i=this;i.nipples=[],i.idles=[],i.actives=[],i.ids=[],i.pressureIntervals={},i.manager=e,i.id=bi.id,bi.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}bi.prototype=new N1;bi.constructor=bi;bi.id=0;bi.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}};bi.prototype.bindings=function(){var e=this;e.bindEvt(e.options.zone,"start"),e.options.zone.style.touchAction="none",e.options.zone.style.msTouchAction="none"};bi.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)}};bi.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 xQ(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||(sy(h.ui.el,s),sy(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};bi.prototype.updateBox=function(){var e=this;e.box=e.options.zone.getBoundingClientRect()};bi.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)};bi.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)};bi.prototype.onstart=function(e){var t=this,i=t.options,r=e;e=MT(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 ay(e,s),t.manager.bindDocument(),!1};bi.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=yp(n,o.position);if(h<=i.catchDistance)l(o);else{o.destroy(),t.processOnStart(e);return}}return o};bi.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)};bi.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(!mQ(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=yp(l,s.position),c=uQ(l,s.position),d=ry(c),u=h/o,p={distance:h,position:l},f,g;if(s.options.shape==="circle"?(f=Math.min(h,o),g=pQ(s.position,f,c)):(g=yQ(l,s.position,o),f=yp(g,s.position)),i.follow){if(h>o){let x=l.x-g.x,w=l.y-g.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=yp(l,s.position)}}else l=g,h=f;var m=l.x-s.position.x,v=l.y-s.position.y;s.frontPosition={x:m,y:v},i.dataOnly||sy(s.ui.front,s.frontPosition);var y={identifier:s.identifier,position:l,force:u,pressure:e.force||e.pressure||e.webkitForce||0,distance:h,angle:{radian:d,degree:c},vector:{x:m/o,y:-v/o},raw:p,instance:s,lockX:i.lockX,lockY:i.lockY};y=s.computeDirection(y),y.angle={radian:ry(180-c),degree:180-c},s.trigger("move",y),t.trigger("move "+s.id+":move",y)};bi.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))};bi.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()};bi.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()};var bQ=bi;function er(e){var t=this;t.ids={},t.index=0,t.collections=[],t.scroll=gA(),t.config(e),t.prepareCollections();var i=function(){var s;t.collections.forEach(function(a){a.forEach(function(n){s=n.el.getBoundingClientRect(),n.position={x:t.scroll.x+s.left,y:t.scroll.y+s.top}})})};if(typeof window>"u")return t.collections;Sf(window,"resize",function(){fA(i)});var r=function(){t.scroll=gA()};return Sf(window,"scroll",function(){fA(r)}),t.collections}er.prototype=new N1;er.constructor=er;er.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}};er.prototype.create=function(e){return this.createCollection(e)};er.prototype.createCollection=function(e){var t=this,i=new bQ(t,e);return t.bindCollection(i),t.collections.push(i),i};er.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)};er.prototype.bindDocument=function(){var e=this;e.binded||(e.bindEvt(document,"move").bindEvt(document,"end"),e.binded=!0)};er.prototype.unbindDocument=function(e){var t=this;(!Object.keys(t.ids).length||e===!0)&&(t.unbindEvt(document,"move").unbindEvt(document,"end"),t.binded=!1)};er.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]};er.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};er.prototype.onmove=function(e){var t=this;return t.onAny("move",e),!1};er.prototype.onend=function(e){var t=this;return t.onAny("end",e),!1};er.prototype.oncancel=function(e){var t=this;return t.onAny("end",e),!1};er.prototype.onAny=function(e,t){var i=this,r,s="processOn"+e.charAt(0).toUpperCase()+e.slice(1);t=MT(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),ay(i.collections,a.bind(null,o,r)),o._found_||i.removeIdentifier(r)};return ay(t,n),!1};er.prototype.destroy=function(){var e=this;e.unbindDocument(!0),e.ids={},e.index=0,e.collections.forEach(function(t){t.destroy()}),e.off()};er.prototype.onDestroyed=function(e,t){var i=this;if(i.collections.indexOf(t)<0)return!1;i.collections.splice(i.collections.indexOf(t),1)};var wQ=er,vA=new wQ,SQ={create:function(e){return vA.create(e)},factory:vA},DT=new Map,Vc=new Map,Oo=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");let l=typeof s=="string"?r.getAudio(s).src:s.data;this.audioPlayer=new Tc({src:l,volume:a,delay:n,loop:o}),Vc.has(i.uuid)?Vc.get(i.uuid).push(this):Vc.set(i.uuid,[this]),DT.set(e,this)}
8403playByToggle(){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()}},ny=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=DT.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=Vc.get(e);!(t!=null&&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=[...Vc.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}},IT=class{constructor(e,t,i,r,s){if(this.data=t,this.shared=r,this.condition=s,t.interaction==="play")this.interaction=new Oo(e,t,i,r);else if(t.interaction==="pause"||t.interaction==="stop")this.interaction=new ny(t);else throw new Error("Missing property")}dispatchBasic(){if(ei(this.shared,this.condition)===!1)return!1;this.interaction instanceof Oo?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(ei(this.shared,this.condition)===!1)return!1;this.interaction instanceof Oo?this.interaction.audioPlayer.play():this.interaction.dispatch()}dispatchGameControl(e){if(ei(this.shared,this.condition)===!1)return!1;this.interaction instanceof Oo&&(e==="start"?this.interaction.audioPlayer.play():this.interaction.audioPlayer.stop())}dispose(){this.interaction.dispose()}},OT=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(ei(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(ei(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(ei(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)}},_Q="text/plain",AQ="us-ascii",yA=(e,t)=>t.some(i=>i instanceof RegExp?i.test(e):i===e),MQ=(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[d,u=""]=c.split("=").map(p=>p.trim());return d==="charset"&&(u=u.toLowerCase(),u===AQ)?"":`${d}${u?`=${u}`:""}`}
vendor: 4,158 bytes, line 8403
8403).filter(Boolean)];return o&&h.push("base64"),(h.length>0||l&&l!==_Q)&&h.unshift(l),`data:${h.join(";")},${o?s.trim():s}${a?`#${a}`:""}`};function EQ(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 MQ(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],d=h.index,u=r.pathname.slice(n,d);o+=u.replace(/\/{2,}/g,"/"),o+=c,n=d+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];yA(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()])yA(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 CQ=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:EQ(e,{removeTrailingSlash:!1,removeSingleSlash:!1,stripWWW:!1}),this.context=t??"tab"}dispatch(){var e;if(ei(this.shared,this.condition)===!1)return!1;Sd?window.location.assign(this.url):(this.context==="tab"||W2&&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"),(e=this.controlsManager.orbitControls)==null||e.onPointerUp(st[0]),Lj())}},RT=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=>{var h,c;this.timeoutIdQueue.shift();let n=this.page.scene.find(a);if(n===void 0)return;let o=this.controlsManager.sharedGameControlGlobals.rapierWorld,l=o?(h=n.dataPatched.physics)==null?void 0:h.fusedBody:!0;if(n.cloner){for(let d of n.cloner.children)l?(d.playModeVisible=!1,d.rigidBody&&((c=n.dataPatched.physics)==null?void 0:c.rigidBody)==="positioned"&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(d.rigidBody.collider(0).handle),o.removeRigidBody(d.rigidBody),d.rigidBody=void 0),d.bvhGeometry&&(d.bvhGeometry=void 0)):this.clone===void 0||this.clone===d?(d.playModeVisible=!1,d.rigidBody&&(this.controlsManager.sharedGameControlGlobals.colliderToEntity.delete(
8403d.rigidBody.collider(0).handle),o.removeRigidBody(d.rigidBody),d.rigidBody=void 0)):d.playModeVisible===void 0&&(d.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(d=>d.bvhGeometry!==void 0):this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim=this.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.filter(d=>d.rigidBody!==void 0),n.destroyedInAction=!0,this.controlsManager.requestRender()},this.objects=[...e.objects]}dispatch(e){if(ei(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(ei(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))}},LT=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(ei(this.shared,this.condition)===!1)return!1;clearTimeout(this.timeoutId),delete this.timeoutId,this.timeoutId=window.setTimeout(()=>{var e;this.shared.reset(this.shared.data,!0),K1(this.page,this.shared,!0),this.eventManager.reset(),(e=this.eventManager.controlsManager.gameControl)==null||e.reset(!0),this.page.switchToPlayCamera(),this.eventManager.controlsManager.requestRender(),delete this.timeoutId},(this.data.delay??0)*1e3)}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},BT={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},V1={duration:1e3,delay:0,endDelay:0,startOnceDelay:0,pingPongDelayCorrection:0,pingPongEndDelayCorrection:0,easing:"easeOutElastic(1, .5)",round:0},TQ=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],_f={CSS:{},springs:{}};function Ls(e,t,i){return Math.min(Math.max(e,t),i)}function jc(e,t){return e.indexOf(t)>-1}function Xg(e,t){return e.apply(null,t)}var lt={arr:function(e){return Array.isArray(e)},obj:function(e){return jc(Object.prototype.toString.call(e),"Object")},pth:function(e){return lt.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||lt.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 lt.hex(e)||lt.rgb(e)||lt.hsl(e)},key:function(e){return!BT.hasOwnProperty(e)&&!V1.hasOwnProperty(e)&&e!=="targets"&&e!=="keyframes"}};function zT(e){var t=/\(([^)]+)\)/.exec(e);return t?t[1].split(",").map(function(i){return parseFloat(i)}):[]}function FT(e,t){var i=zT(e),r=Ls(lt.und(i[0])?1:i[0],.1,100),s=Ls(lt.und(i[1])?100:i[1],.1,100),a=Ls(lt.und(i[2])?10:i[2],.1,100),n=Ls(lt.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,d=l<1?(l*o+-n)/h:-n+o;function u(f){var g=t?t*f/1e3:f;return l<1?g=Math.exp(-g*l*o)*(c*Math.cos(h*g)+d*Math.sin(h*g)):g=(c+d*g)*Math.exp(-g*o),f===0||f===1?f:1-g}function p(){var f=_f.springs[e];if(f)return f;for(var g=1/6,m=0,v=0;;)if(m+=g,u(m)===1){if(v++,v>=16)break}else v=0;var y=m*g*1e3;return _f.springs[e]=y,y}return t?u:p}function PQ(e){return e===void 0&&(e=10),function(t){return Math.ceil(Ls(t,1e-6,1)*e)*(1/e)}}var DQ=function(){var e=11,t=1/(e-1);function i(c,d){return 1-3*d+3*c}function r(c,d){return 3*d-6*c}function s(c){return 3*c}function a(c,d,u){return((i(d,u)*c+r(d,u))*c+s(d))*c}function n(c,d,u){return 3*i(d,u)*c*c+2*r(d,u)*c+s(d)}function o(c,d,u,p,f){var g,m,v=0;do m=d+(u-d)/2,g=a(m,p,f)-c,g>0?u=m:d=m;
vendor: 5,102 bytes, line 8403
8403while(Math.abs(g)>1e-7&&++v<10);return m}function l(c,d,u,p){for(var f=0;f<4;++f){var g=n(d,u,p);if(g===0)return d;var m=a(d,u,p)-c;d-=m/g}return d}function h(c,d,u,p){if(!(0<=c&&c<=1&&0<=u&&u<=1))return;var f=new Float32Array(e);if(c!==d||u!==p)for(var g=0;g<e;++g)f[g]=a(g*t,c,u);function m(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,A=n(b,c,u);return A>=.001?l(v,b,c,u):A===0?b:o(v,y,y+t,c,u)}return function(v){return c===d&&u===p||v===0||v===1?v:a(m(v),d,p)}}return h}(),kT=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=Ls(r,1,10),n=Ls(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 j1(e,t){if(lt.fnc(e))return e;var i=e.split("(")[0],r=kT[i],s=zT(e);switch(i){case"spring":return FT(e,t);case"cubicBezier":return Xg(DQ,s);case"steps":return Xg(PQ,s);default:return Xg(r,s)}}function UT(e){try{var t=document.querySelectorAll(e);return t}catch{return}}function Jf(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 $f(e){return e.reduce(function(t,i){return t.concat(lt.arr(i)?$f(i):i)},[])}function xA(e){return lt.arr(e)?e:(lt.str(e)&&(e=UT(e)||e),e instanceof NodeList||e instanceof HTMLCollection?[].slice.call(e):[e])}function G1(e,t){return e.some(function(i){return i===t})}function H1(e){var t={};for(var i in e)t[i]=e[i];return t}function oy(e,t){var i=H1(e);for(var r in e)i[r]=t.hasOwnProperty(r)?t[r]:e[r];return i}function em(e,t){var i=H1(e);for(var r in t)i[r]=lt.und(e[r])?t[r]:e[r];return i}function IQ(e){var t=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(e);return t?"rgba("+t[1]+",1)":e}function OQ(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 RQ(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(u,p,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?u+(p-u)*6*f:f<1/2?p:f<2/3?u+(p-u)*(2/3-f)*6:u}var o,l,h;if(r==0)o=l=h=s;else{var c=s<.5?s*(1+r):s+r-s*r,d=2*s-c;o=n(d,c,i+1/3),l=n(d,c,i),h=n(d,c,i-1/3)}return"rgba("+o*255+","+l*255+","+h*255+","+a+")"}function LQ(e){if(lt.rgb(e))return IQ(e);if(lt.hex(e))return OQ(e);if(lt.hsl(e))return RQ(e)}function tn(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 BQ(e){if(jc(e,"translate")||e==="perspective")return"px";if(jc(e,"rotate")||jc(e,"skew"))return"deg"}function ly(e,t){return lt.fnc(e)?e(t.target,t.id,t.total):e}function da(e,t){return e.getAttribute(t)}function W1(e,t,i){var r=tn(t);if(G1([i,"deg","rad","turn"],r))return t;var s=_f.CSS[t+i];if(!lt.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 _f.CSS[t+i]=h,h}function NT(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?W1(e,s,i):s}}function q1(e,t){if(lt.dom(e)&&!lt.inp(e)&&(da(e,t)||lt.svg(e)&&e[t]))return"attribute";if(lt.dom(e)&&G1(TQ,t))return"transform";if(lt.dom(e)&&t!=="transform"&&NT(e,t))return"css";if(e[t]!=null)return"object"}function VT(e){if(lt.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 zQ(e,t,i,r){var s=jc(t,"scale")?1:0+BQ(t),a=VT(e).get(t)||s;return i&&(i.transforms.list.set(t,a),i.transforms.last=t),r?W1(e,a,r):a}function X1(e,t,i,r){switch(q1(e,t)){case"transform":return zQ(e,t,r,i);case"css":return NT(e,t,i);case"attribute":return da(e,t);default:return e[t]||0}}function Y1(e,t){var i=/^(\*=|\+=|-=)/.exec(e);if(!i)return e;var r=tn(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;
8403case"*":return s*a+r}}function jT(e,t){if(lt.col(e))return LQ(e);if(/\s/g.test(e))return e;var i=tn(e),r=i?e.substr(0,e.length-i.length):e;return t?r+t:r}function Q1(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function FQ(e){return Math.PI*2*da(e,"r")}function kQ(e){return da(e,"width")*2+da(e,"height")*2}function UQ(e){return Q1({x:da(e,"x1"),y:da(e,"y1")},{x:da(e,"x2"),y:da(e,"y2")})}function GT(e){for(var t=e.points,i=0,r,s=0;s<t.numberOfItems;s++){var a=t.getItem(s);s>0&&(i+=Q1(r,a)),r=a}return i}function NQ(e){var t=e.points;return GT(e)+Q1(t.getItem(t.numberOfItems-1),t.getItem(0))}function HT(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return FQ(e);case"rect":return kQ(e);case"line":return UQ(e);case"polyline":return GT(e);case"polygon":return NQ(e)}}function VQ(e){var t=HT(e);return e.setAttribute("stroke-dasharray",t),t}function jQ(e){for(var t=e.parentNode;lt.svg(t)&&lt.svg(t.parentNode);)t=t.parentNode;return t}function WT(e,t){var i=t||{},r=i.el||jQ(e),s=r.getBoundingClientRect(),a=da(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 GQ(e,t){var i=lt.str(e)?UT(e)[0]:e,r=t||100;return function(s){return{property:s,el:i,svg:WT(i),totalLength:HT(i)*(r/100)}}}function HQ(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=WT(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 bA(e,t){var i=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=jT(lt.pth(e)?e.totalLength:e,t)+"";return{original:r,numbers:r.match(i)?r.match(i).map(Number):[0],strings:lt.str(e)||t?r.split(i):[]}}function qT(e){var t=e?$f(lt.arr(e)?e.map(xA):xA(e)):[];return Jf(t,function(i,r,s){return s.indexOf(i)===r})}function XT(e){var t=qT(e);return t.map(function(i,r){return{target:i,id:r,total:t.length,transforms:{list:VT(i)}}})}function WQ(e,t){var i=H1(t);if(/^spring/.test(i.easing)&&(i.duration=FT(i.easing)),lt.arr(e)){var r=e.length,s=r===2&&!lt.obj(e[0]);s?e={value:e}:lt.fnc(t.duration)||(i.duration=t.duration/r)}var a=lt.arr(e)?e:[e];return a.map(function(n,o){var l=lt.obj(n)&&!lt.pth(n)?n:{value:n};return lt.und(l.delay)&&(l.delay=o?0:t.delay),lt.und(l.endDelay)&&(l.endDelay=o===a.length-1?t.endDelay:0),l}).map(function(n){return em(n,i)})}function qQ(e){for(var t=Jf($f(e.map(function(a){return Object.keys(a)})),function(a){return lt.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)lt.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 XQ(e,t){var i=[],r=t.keyframes;r&&(t=em(qQ(r),t));for(var s in t)lt.key(s)&&i.push({name:s,tweens:WQ(t[s],e)});return i}function YQ(e,t){var i={};for(var r in e){var s=ly(e[r],t);lt.arr(s)&&(s=s.map(function(a){return ly(a,t)}),s.length===1&&(s=s[0])),i[r]=s}return i.duration=parseFloat(i.duration),i.delay=parseFloat(i.delay),i}function QQ(e,t){var i;return e.tweens.map(function(r){var s=YQ(r,t),a=s.value,n=lt.arr(a)?a[1]:a,o=tn(n),l=X1(t.target,e.name,o,t),h=i?i.to.original:l,c=lt.arr(a)?a[0]:h,d=tn(c)||tn(l),u=o||d;return lt.und(n)&&(n=h),s.from=bA(c,u),s.to=bA(Y1(n,c),u),s.start=i?i.end:0,s.end=s.start+s.delay+s.duration+s.endDelay,s.easing=j1(s.easing,s.duration),s.isPath=lt.pth(a),s.isColor=lt.col(s.from.original),s.isColor&&(s.round=1),i=s,s})}var YT={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 QT(e,t){var i=XT(e);i.forEach(function(r){for(var s in t){var a=ly(t[s],r),n=r.target,o=tn(a),l=X1(n,s,o,r),h=o||tn(l),c=Y1(jT(a,h),l),d=q1(n,s);YT[d](n,s,c,r.transforms,!0)}})}function ZQ(e,t){var i=q1(e.target,t.name);if(i){var r=QQ(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 KQ(e,t){return Jf($f(e.map(function(i){return t.map(function(r){return ZQ(i,r)})})),function(i){return!lt.und(i)})}function ZT(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 wA=0;function JQ(e){var t=oy(BT,e),i=oy(V1,e),r=XQ(i,e),s=XT(e.targets),a=KQ(s,r),n=ZT(a,i),o=wA;return wA++,em(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 ps=[],SA=[],xp,$Q=function(){function e(){xp=requestAnimationFrame(t)}function t(i){var r=ps.length;if(r){for(var s=0;s<r;){var a=ps[s];a.paused?(ps.splice(s,1),r-=1):(a.tick(i),s++)}e()}else xp=cancelAnimationFrame(xp)}return e}();function eZ(e){document.hidden?(ps.forEach(function(t){return t.pause(e.timeStamp)}),SA=ps.slice(0),yi.running=ps=[]):SA.forEach(function(t){return t.play(e.timeStamp)})}typeof document<"u"&&document.addEventListener("visibilitychange",eZ);function yi(e){e===void 0&&(e={});var t=0,i=0,r=0,s,a,n=0,o=null;function l(b){var A=window.Promise&&new Promise(function(_){return o=_});
8403return b.finished=A,A}var h=JQ(e);l(h);function c(){var b=h.direction;b!=="alternate"&&(h.direction=b!=="normal"?"normal":"reverse"),h.reversed=!h.reversed,a.forEach(function(A){(A.loop===1||A.loop%2===0)&&(A.reversed=h.reversed)})}function d(){h.direction="normal",h.reversed=!1,a.forEach(function(b){return b.reversed=!1})}function u(b){return h.reversed?h.duration-b:b}function p(){t=0,i=u(h.currentTime)*(1/yi.speed)}function f(b,A,_=!1){A&&(h.reversed?A.seek(A.duration*A.loop-(b-A.timelineOffset-A.pingPongDelayCorrection),_):A.seek(b-A.timelineOffset-A.startOnceDelay-A.pingPongDelayCorrection,_))}function g(b,A=!1){if(h.reversed)for(var _=n;_--;)f(b,a[_],A);else for(var E=0;E<n;E++)f(b,a[E],A)}function m(b){var le,re,te,ae,ce,ue,xe,Re,Ae,Ne;var A=0,_=h.animations,E=_.length;for(h.direction!=="alternate"&&((le=h.parent)==null?void 0:le.direction)==="alternate"?((re=h.parent)==null?void 0:re.rewind)===!1&&h.reversePlayback===!0&&h.rewind===!1&&((te=h.parent)!=null&&te.reversed&&h.direction==="alternate"?b=h.duration-h.delay+h.endDelay-b:b=h.duration+h.delay-h.endDelay-b):w(!1,(ae=h.parent)==null?void 0:ae.rewind,h.rewind,(ce=h.parent)==null?void 0:ce.reversePlayback,h.reversePlayback)&&((ue=h.parent)!=null&&ue.reversed&&h.direction==="alternate"?b=h.duration-h.delay+h.endDelay-b:b=h.duration+h.delay-h.endDelay-b);A<E;){var C=_[A],T=C.animatable,P=C.tweens,O=P.length-1,D=P[O];O&&(D=Jf(P,function(Ee){return b<Ee.end})[0]||D);let Fe;(xe=h.parent)!=null&&xe.reversed&&h.direction==="alternate"?Fe=Ls(b-D.start-D.endDelay,0,D.duration)/D.duration:Fe=Ls(b-D.start-D.delay,0,D.duration)/D.duration;
8403for(var k=isNaN(Fe)?1:D.easing(Fe),W=D.to.strings,N=D.round,F=[],Z=D.to.numbers.length,q=void 0,G=0;G<Z;G++){var Q=void 0;let Ee,Me;h.direction!=="alternate"?((Re=h.parent)==null?void 0:Re.rewind)===!1&&h.reversePlayback===!0&&h.rewind===!1?(Ee=D.to.numbers[G],Me=D.from.numbers[G]||0):(Me=D.to.numbers[G],Ee=D.from.numbers[G]||0):w(!0,(Ae=h.parent)==null?void 0:Ae.rewind,h.rewind,(Ne=h.parent)==null?void 0:Ne.reversePlayback,h.reversePlayback)?(Ee=D.to.numbers[G],Me=D.from.numbers[G]||0):(Me=D.to.numbers[G],Ee=D.from.numbers[G]||0),D.isPath?Q=HQ(D.value,k*Me):Q=Ee+k*(Me-Ee),N&&(D.isColor&&G>2||(Q=Math.round(Q*N)/N)),F.push(Q)}var ee=W.length;if(!ee)q=F[0];else{q=W[0];for(var Y=0;Y<ee;Y++){W[Y];var $=W[Y+1],H=F[Y];isNaN(H)||($?q+=H+$:q+=H+" ")}}YT[C.type](T.target,C.property,q,T.transforms),C.currentValue=q,A++}}function v(b){h[b]&&!h.passThrough&&h[b](h)}function y(){h.remaining&&h.remaining!==!0&&h.remaining--}let x={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 w(b,A,_,E,C){return x[b<<4|A<<3|_<<2|E<<1|C]}function S(b,A=!1){var P;var _=h.duration;let E=h.delay,C=_-h.endDelay;(P=h.parent)!=null&&P.reversed&&h.direction==="alternate"&&(E=h.endDelay,C=_-h.delay);var T=u(b);if(h.progress=Ls(T/_*100,0,100),A||(h.reversePlayback=T<h.currentTime),n&&g(T,A),!h.began&&h.currentTime>=0&&(h.began=!0,v("begin")),!h.loopBegan&&h.currentTime>0&&(h.loopBegan=!0,v("loopBegin")),(h.reversed||T>=0)&&T<=E&&h.currentTime!==0&&(m(0),v("change")),(T>=C&&h.currentTime!==_+h.pingPongDelayCorrection||!_)&&(m(_),v("change")),T>E&&T<C?(h.changeBegan||(h.changeBegan=!0,h.changeCompleted=!1,v("changeBegin")),m(T),v("change")):h.changeBegan?(h.changeCompleted=!0,h.changeBegan=!1,v("change"),n&&v("timelineChangeComplete")):h.began&&T>C&&v("changeComplete"),h.currentTime=Ls(T,0,_+h.pingPongDelayCorrection),h.began&&v("update"),b>=_)if(y(),!h.remaining)h.paused=!0,h.completed||(h.completed=!0,v("loopComplete"),v("complete"),!h.passThrough&&"Promise"in window&&(o(),l(h)));else{n?t+=h.duration/yi.speed:t+=h.duration;for(let O of a)O.setStartTime(0),O.remaining=O.loop;v("loopComplete"),h.loopBegan=!1,h.direction==="alternate"?c():n&&d()}}return h.reset=function(){var b=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.reversePlayback=!1,h.reversed=b==="reverse",h.remaining=h.loop,a=h.children,n=a.length;for(var A=n;A--;)h.children[A].reset();m(h.reversed?h.duration:0)},h.setStartTime=function(b){t=b},h.set=function(b,A){return QT(b,A),h},h.tick=function(b){r=b,t||(t=r),S((r+(i-t))*yi.speed)},h.seek=function(b,A=!1){S(b-t,A)},h.pause=function(b){h.paused=!0,n&&(s=b??performance.now())},h.play=function(b){!h.paused||(h.completed&&h.reset(),h.paused=!1,ps.push(h),n&&s!==void 0&&(t+=(b??performance.now())-s),xp||$Q())},h.reverse=function(){c(),h.completed=!h.reversed,p()},h.restart=function(){h.reset(),h.play()},h.reset(),h.autoplay&&h.play(),h}function _A(e,t){for(var i=t.length;i--;)G1(e,t[i].animatable.target)&&t.splice(i,1)}function tZ(e){for(var t=qT(e),i=ps.length;i--;){var r=ps[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 iZ(e,t){t===void 0&&(t={});var i=t.direction||"normal",r=t.easing?j1(t.easing):null,s=t.grid,a=t.axis,n=t.from||0,o=n==="first",l=n==="center",h=n==="last",c=lt.arr(e),d=parseFloat(c?e[0]:e),u=c?parseFloat(e[1]):0,p=tn(c?e[1]:e)||0,f=t.start||0+(c?d:0),g=[],m=0;return function(v,y,x){if(o&&(n=0),l&&(n=(x-1)/2),h&&(n=x-1),!g.length){for(var w=0;w<x;w++){if(!s)g.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]),A=w%s[0],_=Math.floor(w/s[0]),E=S-A,C=b-_,T=Math.sqrt(E*E+C*C);a==="x"&&(T=-E),a==="y"&&(T=-C),g.push(T)}m=Math.max.apply(Math,g)}r&&(g=g.map(function(O){return r(O/m)*m})),i==="reverse"&&(g=g.map(function(O){return a?O<0?O*-1:-O:Math.abs(m-O)}))}var P=c?(u-d)/m:d;return f+P*(Math.round(g[y]*100)/100)+p}}function rZ(e){e===void 0&&(e={});var t=yi(e);return t.duration=0,t.add=function(i,r){var s=ps.indexOf(t),a=t.children;s>-1&&ps.splice(s,1);function n(u){u.passThrough=!0}for(var o=0;o<a.length;o++)n(a[o]);var l=em(i,oy(V1,e));l.targets=l.targets||e.targets;var h=t.duration;l.autoplay=!1,l.timelineOffset=lt.und(r)?h:Y1(r,h),n(t);var c=yi(l);n(c),a.push(c),c.parent=t;var d=ZT(a,e);return t.delay=d.delay,t.endDelay=d.endDelay,t.duration=d.duration,c.loop===!0&&(t.duration=1/0),t.seek(0),t.reset(),t.autoplay&&t.play(),t},t}yi.version="3.2.0";yi.speed=1;yi.running=ps;yi.remove=tZ;yi.get=X1;yi.set=QT;yi.convertPx=W1;yi.path=GQ;yi.setDashoffset=VQ;yi.stagger=iZ;yi.timeline=rZ;yi.easing=j1;yi.penner=kT;yi.random=function(e,t){return Math.floor(Math.random()*(t-e+1))+e};var KT=yi,AA=new M,MA=new M,EA=new ot;function sZ(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: 8,802 bytes, line 8403
8403return 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 ar(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 d=Oe.lerp(l,h,c);a?t[e]=Math.trunc(d):t[e]=d},start:()=>{t[e]=l},end:()=>{t[e]=h}}}function Z1(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(d=>typeof d=="string"?Number(s.getVariable(d)??0):d),c=[...o].map(d=>typeof d=="string"?Number(s.getVariable(d)??0):d);if(!(h.length!==c.length||Qy(h,c)))return{update:d=>{h.forEach((u,p)=>{let f=Oe.lerp(u,c[p],d);t[e][p]=a?Math.trunc(f):f})},start:()=>{Object.assign(t[e],h)},end:()=>{Object.assign(t[e],c)}}}function Af(e,t,i){return t.forEach((r,s)=>{e.setComponent(s,typeof r=="string"?Number(i.getVariable(r)??0):r)}),e}function CA(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?Af(new M,a,s):o.clone(),h=Af(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 TA(e,t,i){return t.forEach((r,s)=>{e.setComponent(s,typeof r=="string"?Number(i.getVariable(r)??0):r)}),e}function Mf(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 j),h=o instanceof j?o:new j().fromArray(o),c=a?TA(new j,a,s):h.clone(),d=TA(new j,n,s);if(!c.equals(d))return{update:u=>{h.lerpVectors(c,d,u),l&&(t[e]=h.toArray())},start:()=>{h.copy(c),l&&(t[e]=h.toArray())},end:()=>{h.copy(d),l&&(t[e]=h.toArray())}}}function aZ(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 be().fromArray(s):n.clone(),l=new M,h=new ot,c=new M;o.decompose(l,h,c);let d=new be().fromArray(a),u=new M,p=new ot,f=new M;if(d.decompose(u,p,f),!o.equals(d))return{update:g=>{EA.slerpQuaternions(h,p,g),AA.lerpVectors(l,u,g),MA.lerpVectors(c,f,g),n.compose(AA,EA,MA)},start:()=>{n.compose(l,h,c)},end:()=>{n.compose(u,p,f)}}}function nZ(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 $e().setRGB(a.r,a.g,a.b):o.clone(),h=typeof n=="string"?s.getColor(n).clone():new $e().setRGB(n.r,n.g,n.b);if(l.equals(h))return;let c=o.clone();return{update:d=>{var u,p;c.lerpColors(l,h,d),(p=(u=t[e])==null?void 0:u.copy)==null||p.call(u,c)},start:()=>{c.copy(l)},end:()=>{c.copy(h)}}}function $u(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 dr(o.r,o.g,o.b,o.a),h=a?typeof a=="string"?s.getColor(a).clone():new dr(a.r,a.g,a.b,a.a):l.clone(),c=typeof n=="string"?s.getColor(n).clone():new dr(n.r,n.g,n.b,n.a);if(!h.equals(c))return{update:d=>{l.lerpColors(h,c,d);let u=Oe.lerp(h.a,c.a,d);l.a=u,t[e]={r:l.r,g:l.g,b:l.b,a:l.a}},start:()=>{l.copy(h)},end:()=>{l.copy(c)}}}function ro(e,t,i,r,s){if(typeof t[e]=="number")return ar(e,t,i??{},r,s);if(Array.isArray(t[e]))return Z1(e,t,i??{},r,s)}function oZ(e,t,i,r){var o,l,h,c;let s=[],a=e.cameraType==="OrthographicCamera"?(o=t.orthographic)==null?void 0:o.zoom:(l=t.perspective)==null?void 0:l.zoom,n=e.cameraType==="OrthographicCamera"?(h=i.orthographic)==null?void 0:h.zoom:(c=i.perspective)==null?void 0:c.zoom;if(n!==void 0){let d=a??e.zoom,u=n;d!==u&&s.push({update:p=>{e.zoom=Oe.lerp(d,u,p),e.updateProjectionMatrix()},start:()=>{e.zoom=d,e.updateProjectionMatrix()},end:()=>{e.zoom=u,e.updateProjectionMatrix()}})}if(i.targetOffset!==void 0){let d=ar("targetOffset",e,t,i,r);d&&s.push(d)}return s}function lZ(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.getVariable(o)??0):o),a=i.scaleBaked.map(o=>typeof o=="string"?Number(r.getVariable(o)??0):o);if(ko.isEqual(s,a))return;let n=[];return n.push({update:o=>{e.updateGeometryInteractions({scaleBaked:[Oe.lerp(s[0],a[0],o),Oe.lerp(s[1],a[1],o),Oe.lerp(s[2],a[2],o)]},r),e.invalidateDownstreamBooleanData(),e.refreshAttachedClonersInteractions()},start:()=>{e.updateGeometryInteractions({scaleBaked:s},r),e.invalidateDownstreamBooleanData(),e.refreshAttachedClonersInteractions()},end:()=>{e.updateGeometryInteractions({scaleBaked:a},r),e.invalidateDownstreamBooleanData(),e.refreshAttachedClonersInteractions()}}),n}function hZ(e,t,i,r){if(!i.extrusion)return;let s=e.extrusion,a=t.extrusion??{},n=i.extrusion,o=[];return TE.forEach(l=>{let h=ro(l,s,a,n,r);h&&o.push(h)}),o}function cZ(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 ud){let l=lZ(e,n,o,r);l&&s.push(...l)}else{let l={};if(Object.assign(l,pa(a,$m),pa(n,$m)),$m.forEach(h=>{let c=ro(h,l,n,o,r);c&&s.push(c)}),e instanceof L1){Object.assign(l,{extrusion:{...a.extrusion}});let h=hZ(l,n,o,r);h&&s.push(...h)}s.length&&s.push({update:h=>{e.updateGeometryInteractions(l,r),e.updateGeometryGroupsIfNeeded(),e.refreshAttachedClonersInteractions()},start:h=>{e.updateGeometryInteractions(l,r),e.updateGeometryGroupsIfNeeded(),e.refreshAttachedClonersInteractions()},end:h=>{e.updateGeometryInteractions(l,r),e.updateGeometryGroupsIfNeeded(),e.refreshAttachedClonersInteractions()}})}return s}function dZ(e,t,i,r){let s=[];if(i.intensity!==void 0){let a=ar("intensity",e,t,i,r);a&&s.push(a)}if(i.color!==void 0){let a=nZ("color",e,t,i,r);a&&s.push(a)}return s}function uZ(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(...PA(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(...PA(e.material,a,n,r))}return s}function PA(e,t,i,r){var n;let s=[],a=Yl(i,r)||!!t.layers&&Yl(t,r);s.push(wZ(e,a));for(let o of e.layers){let l=(n=t.layers)==null?void 0:n.data(o.uuid),h=i.layers.data(o.uuid);if(!h||o.type!=="light"&&(!(o.visible??!0)||!(h.visible??!0)))continue;let c=o.getNames().filter(d=>!ME.some(u=>d.includes(u)));for(let d of c)try{let u=o.getValue(d),p;if(d==="colors")p=xZ(o,l,h,d);else if(Array.isArray(u))d==="steps"&&(p=yZ(o,l,h,d));else if(typeof u=="number")p=pZ(o,l,h,d,r);else{if(typeof u=="boolean")continue;u instanceof j?p=fZ(o,l,h,d):u instanceof M?p=mZ(o,l,h,d,r):u instanceof dr?p=vZ(o,l,h,d,r):u instanceof $e?p=gZ(o,l,h,d,r):"isTexture"in u&&(p=bZ(o,l,h,d))}p&&(Array.isArray(p)?s.push(...p):s.push(p))}catch(u){console.error(`lerpMaterial: unexpected material layer for ${d}`,u)}}return s}function pZ(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,Oe.lerp(o,l,h))},start:()=>{e.setValue(r,o)},end:()=>{e.setValue(r,l)}}}function fZ(e,t,i,r){if(!e.hasValue(r)||!(r in i))return;let s=e.getValue(r),a=t?new j().fromArray(t[r]):s.clone(),n=new j().fromArray(i[r]);if(!a.equals(n))return{update:o=>{s.lerpVectors(a,n,o)},start:()=>{s.copy(a)},end:()=>{s.copy(n)}}}function mZ(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?Af(new M,n,s):a.clone(),h=Af(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 gZ(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 $e().setRGB(a.r,a.g,a.b):o.clone(),h=typeof n=="string"?s.getColor(n).clone():new $e().setRGB(n.r,n.g,n.b);if(l.equals(h))return;let c=o.clone();return{update:d=>{e.getValue(r)!==c&&e.setValue(r,c),c.lerpColors(l,h,d)},start:()=>{c.copy(l)},end:()=>{c.copy(h)}}}function vZ(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 $e().setRGB(a.r,a.g,a.b):o.clone(),h=typeof n=="string"?s.getColor(n).clone():new dr(n.r,n.g,n.b,n.a);if(l.equals(h))return;let c=o.clone();return{update:d=>{e.getValue(r)!==c&&e.setValue(r,c),c.lerpColors(l,h,d)},start:()=>{c.copy(l)},end:()=>{c.copy(h)}}}function yZ(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 Qy(n,o)||s.push({update:l=>{let h=[...a];for(let c=0;c<a.length;++c){let d=n[c],u=o[c];h[c]=Oe.lerp(d,u,l)}e.setValue(r,h)},start:()=>{e.setValue(r,n)},end:()=>{e.setValue(r,o)}}),s.length?s:void 0}function xZ(e,t,i,r="colors"){if(!e.hasValue(r)||!(r in i))return;
8403let 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]];Qp.isEqual(h,c)||s.push({update:d=>{a[l].fromArray(Qp.lerp(h,c,d))},start:()=>{a[l].fromArray(h)},end:()=>{a[l].fromArray(c)}})}return s.length?s:void 0}function bZ(e,t,i,r="texture"){var m,v;if(!e.hasValue(r)||!(r in i))return;let s=e.getNode("rotation"),a=((m=t==null?void 0:t[r])==null?void 0:m.rotation)??0,n=((v=i[r])==null?void 0:v.rotation)??0;if(s&&a!==n)return{update:y=>{s.value=Oe.lerp(a,n,y)*Oe.DEG2RAD},start:()=>{s.value=a*Oe.DEG2RAD},end:()=>{s.value=n*Oe.DEG2RAD}};let o=e.getNode("mat");if(!o)return;let l=t?t[r]:o,h=i[r],c=[...l.repeat],d=[...l.offset],u=[...h.repeat],p=[...h.offset],f=l.rotation??0,g=h.rotation??0;if(!Ja.isEqual(c,u)||!Ja.isEqual(d,p)||f!==g)return{update:y=>{o.repeat=Ja.lerp(c,u,y),o.offset=Ja.lerp(d,p,y),o.rotation=Oe.lerp(f,g,y),o.updateMatrix()},start:()=>{o.repeat=[...c],o.offset=[...d],o.rotation=f,o.updateMatrix()},end:()=>{o.repeat=[...u],o.offset=[...p],o.rotation=g,o.updateMatrix()}}}function wZ(e,t){return{update:()=>{e.transparent=t}}}var Yg=new M,DA=new zi;function SZ(e,t,i,r,s){var f,g,m,v,y,x;let a=[],n,o,l,h,c,d,u,p;if(e instanceof $i?(n=Mf("position",e,t,i,s),n&&a.push(n),l=ar("rotation",e,t,i,s),l&&a.push(l),h=Mf("shear",e,t,i,s),h&&a.push(h)):(p={slide:((f=t.pathSnapping)==null?void 0:f.slide)??((g=e.updatedPathSnapping)==null?void 0:g.slide)??((m=e.dataPatched.pathSnapping)==null?void 0:m.slide)??0,offset:((v=t.pathSnapping)==null?void 0:v.offset)??((y=e.updatedPathSnapping)==null?void 0:y.offset)??((x=e.dataPatched.pathSnapping)==null?void 0:x.offset)??0},d=ar("slide",p,t.pathSnapping??e.updatedPathSnapping??e.dataPatched.pathSnapping,i.pathSnapping??e.dataPatched.pathSnapping,s),d&&a.push(d),u=ar("offset",p,t.pathSnapping??e.updatedPathSnapping??e.dataPatched.pathSnapping,i.pathSnapping??e.dataPatched.pathSnapping,s),u&&a.push(u),!d&&!u&&(n=CA("position",e,t,i,s),n&&a.push(n),o=CA("scale",e,t,i,s),o&&a.push(o),l=_Z(e,t,i,r,s),l&&a.push(l),c=aZ("hiddenMatrix",e,t,i),c&&a.push(c))),n||o||l||c||d||u){let w=e instanceof $i?()=>{e.updateWorldMatrix(!0,!1,!0),e.resetBBoxNeedsUpdate()}:()=>{var S;e.updateMatrix(),e.hasNonUniformScale&&(e.updateMatrixWorld(),e.updateMatrixWorldSVD()),(S=e.parent)!=null&&S.matrixWorldFusedFalse&&(e.matrixWorld.multiplyMatrices(e.parent.matrixWorldFusedFalse,e.matrix),e.matrixWorldNeedsUpdate=!1),Ds(e)&&$a(e.parent)&&e.invali
vendor: 6,188 bytes, line 8403
8403dateDownstreamBooleanData(!0),e.updatePathSnapping(Object.assign({},t.pathSnapping,p))};a.push({update:w,start:w,end:w})}return a}function _Z(e,t,i,r,s){var c;let a=t!=null&&t.rotation?t.rotation.map(d=>(typeof d=="string"?Number(s.getVariable(d)??0):d)*Oe.DEG2RAD):void 0,n=(c=i.rotation)==null?void 0:c.map(d=>(typeof d=="string"?Number(s.getVariable(d)??0):d)*Oe.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=Yg.subVectors(l,o);if(r&&h.toArray().every(d=>Math.abs(d)<2*Math.PI)){let d=new ot().setFromEuler(DA.setFromVector3(o)),u=new ot().setFromEuler(DA.setFromVector3(l));return{update:p=>{sZ(d,u,e.quaternion,p)},start:()=>{e.rotation.setFromVector3(o)},end:()=>{e.rotation.setFromVector3(l)}}}else return{update:d=>{Yg.lerpVectors(o,l,d),e.rotation.setFromVector3(Yg)},start:()=>{e.rotation.setFromVector3(o)},end:()=>{e.rotation.setFromVector3(l)}}}function AZ(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;xE.forEach(p=>{let f;p==="count"?f=ar("count",a.parameters,n,o,r,!0):f=ro(p,a.parameters,n??{},o,r),f&&s.push(f)});let l=MZ(a,n,o,r);l!=null&&l.length&&s.push(...l);let h=EZ(a,n,o,r);h!=null&&h.length&&s.push(...h);let c=CZ(a,n,o,r);c!=null&&c.length&&s.push(...c);let d=TZ(a,n,o,r);d!=null&&d.length&&s.push(...d);let u=PZ(a,n,o,r);return u!=null&&u.length&&s.push(...u),s.length&&s.push({update:()=>{a.update()}}),s}function MZ(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 bE.forEach(l=>{let h=ro(l,n,s??{},a,r);h&&o.push(h)}),o}function EZ(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 wE.forEach(l=>{let h=ro(l,o,s??{},a,r);h&&n.push(h)}),n}function CZ(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 SE.forEach(l=>{let h;l==="count"?h=Z1(l,o,s??{},a,r,!0):h=ro(l,o,s??{},a,r),h&&n.push(h)}),n}function TZ(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 _E.forEach(l=>{let h;l==="count"?h=ar(l,o,s??{},a,r,!0):h=ro(l,o,s??{},a,r),h&&n.push(h)}),n}function PZ(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 AE.forEach(l=>{let h=ro(l,o,s??{},a,r);h&&n.push(h)}),n}function DZ(e,t){return{update:()=>{e instanceof Yi&&(e.fill.enabled=t)}}}function IZ(e,t){return{update:()=>{e instanceof Yi&&(e.stroke.enabled=t)}}}function OZ(e,t){return{update:()=>{e instanceof Yi&&(e.dropShadow.enabled=t)}}}function RZ(e,t){return{update:()=>{e instanceof Yi&&(e.innerShadow.enabled=t)}}}function LZ(e,t){return{update:()=>{e instanceof Yi&&(e.backgroundBlur.enabled=t)}}}function BZ(e,t){return{update:()=>{e instanceof Yi&&(e.layerBlur.enabled=t)}}}function zZ(e,t,i,r,s){let a=[],n,o,l,h,c,d,u,p,f,g,m,v,y,x,w;if("width"in e&&(n=ar("width",e,t,i,s),n&&a.push(n)),"height"in e&&(o=ar("height",e,t,i,s),o&&a.push(o)),e instanceof Yi||e instanceof ma){let S={...t.fill},b={...i.fill};S.enabled!==void 0&&S.enabled!==b.enabled&&(a.push(DZ(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}})),l=$u("color",e.fill,S,b,s),l&&a.push(l)}if(e instanceof Yi){let S={...t.stroke},b={...i.stroke};(S.enabled||b.enabled)&&(a.push(IZ(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=$u("color",e.stroke,S,b,s),h&&a.push(h),c=ar("thickness",e.stroke,S,b,s),c&&a.push(c)}if(e instanceof Yi){let S={...t.dropShadow},b={...i.dropShadow};(S.enabled||b.enabled)&&(a.push(OZ(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}})),d=$u("color",e.dropShadow,S,b,s),d&&a.push(d),u=ar("blurRadius",e.dropShadow,S,b,s),u&&a.push(u),f=ar("spread",e.dropShadow,S,b,s),f&&a.push(f),p=Mf("offset",e.dropShadow,S,b,s),p&&a.push(p)}if(e instanceof Yi){let S={...t.innerShadow},b={...i.innerShadow};(S.enabled||b.enabled)&&(a.push(RZ(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}})),g=$u("color",e.innerShadow,S,b,s),g&&a.push(g),m=ar("blurRadius",e.innerShadow,S,b,s),m&&a.push(m),y=ar("spread",e.innerShadow,S,b,s),y&&a.push(y),v=Mf("offset",e.innerShadow,S,b,s),v&&a.push(v)}if(e instanceof Yi||e instanceof ma){let S={...t.backgroundBlur},b={...i.backgroundBlur};(S.enabled||b.enabled)&&(a.push(LZ(e,!0)),S.enabled||Object.assign(S,{enabled:!0,radius:0}),b.enabled||Object.assign(b,{enabled:!0,radius:0})),x=ar("radius",e.backgroundBlur,S,b,s),x&&a.push(x)}if(e instanceof Yi){let S={...t.layerBlur},b={...i.layerBlur};(S.enabled||b.enabled)&&(a.push(BZ(e,!0)),S.enabled||Object.assign(S,{enabled:!0,radius:0}),b.enabled||Object.assign(b,{enabled:!0,radius:0})),w=ar("radius",e.layerBlur,S,b,s),w&&a.push(w)}if(e instanceof ma||e instanceof Pd){let S=Z1("cornerRadius",e,t,i,s);S&&a.push(S)}return a}function IA(e,t,i,r,s){let a=[];return e.data.visible&&a.push(...SZ(e,t,i,s,r)),e instanceof $i?a.push(...zZ(e,t,i,s,r)):(e.data.visible&&a.push(...AZ(e,t,i,r)),Ds(e)?(e instanceof Ei&&e.data.visible&&a.push(...cZ(e,t,i,r)),e.data.visible&&a.push(...uZ(e,t,i,r))):w7(e)?e.data.visible&&a.push(...dZ(e,t,i,r)):b7(e)&&a.push(...oZ(e,t,i,r))),a.length?{update:n=>{a.forEach(o=>o.update(n))},start:n=>{a.forEach(o=>{var l;return(l=o.start)==null?void 0:l.call(o,n)})},end:n=>{a.forEach(o=>{var l;return(l=o.end)==null?void 0:l.call(o,n)})}}:void 0}var OA=new M;function K1(e,t,i=!1){var a;let r=[],s=n=>{let o=n.data;delete n.states,n.currentState=null,n.reversibleToState=null,n.currentTransitionEvent=null;for(let l of o.states){let h={...l.data};n.states||(n.states={}),n.states[l.id]=Do.patch(o,h)}LA(e.scene,n,null,t,o.events.find(l=>l.data.type==="Follow"||l.data.type==="LookAt")!==void 0),RA(e)};
8403e.scene.traverse2D(s),e.traverseChildren(n=>{var c,d,u,p,f,g;if(i&&((c=n.rigidBody)==null||c.setTranslation(n.position0,!0),(d=n.rigidBody)==null||d.setRotation(n.rotation0,!0),(u=n.rigidBody)==null||u.setLinvel(OA,!0),(p=n.rigidBody)==null||p.setAngvel(OA,!0)),!Ct.is(n))return;let o=n.uuid,l=n.data;if(delete n.states,n.uuid===Fh)return;let h=!1;r.some(m=>{var v;return(v=e.scene.find(o))==null?void 0:v.isDescendantOf(m)})?h=!0:((f=l.physics)==null?void 0:f.fusedBody)===!0&&l.physics.rigidBody==="dynamic"&&r.push(o),n.data=l,n.currentState=null,n.reversibleToState=null,n.currentTransitionEvent=null;for(let m of l.states){let v={...m.data};e.data.globalPhysics.usePhysics===!0&&l.physics&&(l.physics.rigidBody==="dynamic"||h)&&(m.data.position!==void 0&&delete v.position,m.data.rotation!==void 0&&delete v.rotation,m.data.hiddenMatrix!==void 0&&delete v.hiddenMatrix),n.states||(n.states={}),n.states[m.id]=Co.patch(l,v)}LA(e.scene,n,null,t,l.events.find(m=>m.data.type==="Follow"||m.data.type==="LookAt")!==void 0),n instanceof gr&&n.frame&&(n.frame.traverse(m=>s(m)),(g=n.uiCanvas)==null||g.applySize())}),RA(e),e.frame&&(e.frame.traverse(n=>s(n)),(a=e.uiCanvas)==null||a.applySize())}function RA(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 LA(e,t,i,r,s=!1){if(t instanceof Ei&&!(t instanceof Qo)&&t.removeInteractionGeometry(r),t instanceof $i?t.changeSelectedState(i,{shared:r},s):t.changeSelectedState(i,{scene:e,shared:r},s),t instanceof Ei&&t.updateGeometryGroupsIfNeeded(),t instanceof yr&&t.updateCameraState(t.dataPatched,{scene:e,shared:r}),!(t instanceof $i)){if(t.cloner)for(let a of t.cloner.children)a.playModeVisible=void 0;t.updateVisible()}}function JT(e){let t;if(e.easing===5){let{control1:i,control2:r}=e;t=`cubicBezier(
8404			${i[0]}, ${i[1]}, ${r[0]}, ${r[1]}
8405		)`}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=Cn.linear;break;case 1:i=Cn.ease;break;case 2:i=Cn.easeIn;break;case 3:i=Cn.easeOut;break;case 4:i=Cn.easeInOut;break;default:i=Cn.linear}let[r,s,a,n]=i;t=`cubicBezier( ${r}, ${s}, ${a}, ${n} )`}return{duration:Math.max(e.duration,1e-4),easing:t}}function hy(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 FZ={type:"beginState"},kZ={type:"completeState",isfromEntity:!1},BA=class{constructor(e,t,i,r,s,a){if(this.object=e,this.data=r,this.sharedAssets=s,this.allowSlerp=a,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 n=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=n,this.object.dispatchEvent({type:"beginState",state:n}),this.object instanceof $i||this.object.traverseEntity(o=>{o!==this.object&&o instanceof yr&&o.dispatchEvent(FZ)})},this.onChangeComplete=()=>{this.firstLoop&&(this.onFirstLoop(),this.firstLoop=!1),this.object.reversibleToState=this.to.id;let n=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=n,this.object.dispatchEvent({type:"completeState",state:n}),this.object instanceof $i||this.object.traverseEntity(o=>{o!==this.object&&o instanceof yr&&o.dispatchEvent(kZ)})},this.onFirstLoop=()=>{this.useCurrentState&&(this.callback=IA(this.object,this.from.data,this.to.data,this.sharedAssets,this.allowSlerp))},t===void 0){let n=bp(this.object,this.object.currentState===i?this.object.prevState:this.object.currentState);if(!n)throw new Error("Missing property");this.from=n}else{let n=bp(this.object,t);if(!n)throw new Error("Missing property");this.from=n}if(i===void 0)throw new Error("Missing property");{let n=bp(this.object,i);if(!n)throw new Error("Missing property");this.to=n}this.useCurrentState=t===void 0||i===void 0,this.params={targets:this.targets,t:1,autoplay:!1,...hy(r),...JT(r),change:this.onChange},this.callback=IA(this.object,t===void 0?{}:this.from.data,i===void 0?{}:this.to.data,this.sharedAssets,this.allowSlerp)}get changeBegan(){return this._changeBegan}get changeCompleted(){return this._changeCompleted}},$T=class extends ur{constructor(e,t,i,r,s){var n;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.onTimelineChangeComplete=()=>{var o;this.data.tweens[0].data.direction!=="normal"&&(this.toggleIsForward=!this.toggleIsForward),this.timelineNeedsRebuild!==!1&&((o=this.timeline)==null||o.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)??((n=this.page.uiCanvas)==null?void 0:n.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(){var e;return((e=this.timeline)==null?void 0:e.paused)===!1}get changeBegan(){return this.tweens.some(e=>e.changeBegan)??!1}init(){this.initialCurrentState=bp(this.object,this.object.currentState).id,this.toggleIsForward=!1}get currentState(){return this.data.runMode==="Toggle"&&Pw(this.eventType)?this.initialCurrentState:this.object.currentState}buildTimeline({isForward:e=!0,needsRebuild:t=!1,isRebuild:i=!1}={}){var r,s,a,n;try{let o=hy(this.data.tweens[0].data);i&&typeof o.loop=="number"&&o.loop--,(r=this.timeline)==null||r.pause(),this.timeline=KT.timeline({autoplay:!1,...o,...o.loop===!0||o.loop>1?{timelineChangeComplete:this.onTimelineChangeComplete}:{}});let l=this.tweens.findIndex(h=>h==null?void 0:h.changeBegan);if(t===!0&&(this.timelineNeedsRebuild=!0),e){let h=l===-1?0:l;for(let c=h;c<this.data.tweens.length-1;c++){let d=this.data.tweens[c],u=this.data.tweens[c+1],p;c===h&&(this.object.wasMovedByUser===!0||((s=this.object.previousAction)==null?void 0:s.changeBegan)===!0)?(p=void 0,this.object instanceof yr&&(this.object.wasMovedByUser=!1)):p=d.data.state===void 0?this.currentState:d.data.state;let f=new BA(this.object,p,u.data.state===void 0?this.currentState:u.data.state,u.data,this.shared,this.data.allowSlerp??!1);l!==-1&&c===h&&Object.assign(f.params,{startOnceDelay:0}),this.tweens[c]=f,this.timeline.add(f.params,this.timeline.duration+(c===h?o.delay:0))}this.timeline.duration+=o.endDelay}else{let h=l===-1?this.data.tweens.length-1:l+1;for(let c=h;c>0;c--){let d=this.data.tweens[c],u=this.data.tweens[c-1],p;c===h&&(this.object.wasMovedByUser===!0||((a=this.object.previousAction)==null?void 0:a.changeBegan)===!0)?(p=void 0,this.object instanceof yr&&(this.object.wasMovedByUser=!1)):p=d.data.state===void 0?this.currentState:d.data.state;let f=new BA(this.object,p,u.data.state===void 0?this.currentState:u.data.state,d.data,this.shared,this.data.allowSlerp??!1);l!==-1&&c===h&&Object.assign(f.params,{startOnceDelay:0}),this.tweens[c-1]=f,this.timeline.add(f.params,this.timeline.duration+(c===h?o.endDelay:0))}this.timeline.duration+=o.delay}}catch(o){o instanceof Error&&console.error(o.message)}((n=this.object.previousAction)==null?void 0:n.playing)===!0&&this.object.previousAction.pause(),this.object.previousAction=this}play(){if(ei(this.shared,this.condition)===!1||Pw(this.eventType)&&this.data.runMode==="Once"&&this.hasPlayedOnce||(this.hasPlayedOnce=!0,this.playing))return!1;clearTimeout(this.timeoutId);let e=hy(this.data.tweens[0].data).pingPongDelayCorrection;this.timeoutId=window.setTimeout(()=>{try{this.buildTimeline(),this.timeline.play()}catch(t){t instanceof Error&&console.error(t.message)}},this.startOnceDelay+e)}pause(){var e;(e=this.timeline)==null||e.pause(),clearTimeout(this.timeoutId),this.tweens=Array(this.data.tweens.length-1),delete this.timeoutId}stop(){this.pause();let e=this.data.tweens[0].data.state===void 0?this.initialCurrentState:this.data.tweens[0].data.state;this.object instanceof $i?this.object.changeSelectedState(e,{shared:this.shared}):this.object.changeSelectedState(e,{scene:this.page.scene,shared:this.shared}),this.object.currentState=e}seek(e){var t;if(ei(this.shared,this.condition)===!1)return!1;this.timeline===void 0&&this.buildTimeline(),(t=this.timeline)==null||t.seek(e*this.timeline.duration,!0)}toggle(e){var t;if(ei(this.shared,this.condition)===!1)return!1;clearTimeout(this.timeoutId),this.toggleIsForward=e??!this.toggleIsForward,this.playing?((t=this.timeline)==null||t.pause(),this.buildTimeline({isForward:this.toggleIsForward,needsRebuild:!0}),this.timeline.play()):this.timeoutId=window.setTimeout(()=>{var i;(i=this.timeline)==null||i.pause(),this.buildTimeline({isForward:this.toggleIsForward}),this.timeline.play()},this.startOnceDelay)}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause()}};function bp(e,t){var s;let i,r;if(typeof t=="string"?(i=t,r=(s=e.states)==null?void 0:s[i]):t===null&&(i=null,r=e.data),!(i===void 0||r===void 0))return{id:i,data:r}}var UZ={type:"beginState"},zA={type:"completeState",isfromEntity:!1},FA={type:"requestRender"},eP=class extends ur{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 ot,this.qEnd=new ot,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=KT({targets:i,t:1,...JT(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(UZ));let r=this.page.activeCamera;r.position.lerpVectors(this.posStart,this.posEnd,i.t),r.quaternion.slerp
8405Quaternions(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(FA),i.t===1&&r.dispatchEvent(zA)}})}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(ei(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(()=>{var e;delete this.timeoutId,this.data.animate?(this.buildAnimation(),(e=this.animation)==null||e.play()):this.switchCamera(this.data.targetCamera)},this.data.delay*1e3)}catch{}}pause(){var e;(e=this.animation)==null||e.pause(),clearTimeout(this.timeoutId),delete this.timeoutId}toggle(e){var t,i;if(ei(this.shared,this.condition)===!1)return!1;if(window.clearTimeout(this.timeoutId),delete this.timeoutId,e!==this.toggleIsForward)try{this.playing?((t=this.animation)==null||t.pause(),this.toggleIsForward=e??!this.toggleIsForward,this.buildAnimation(!0),(i=this.animation)==null||i.play()):this.timeoutId=window.setTimeout(()=>{var r,s;this.toggleIsForward=e??!this.toggleIsForward,this.data.animate?((r=this.animation)==null||r.pause(),this.buildAnimation(),(s=this.animation)==null||s.play()):(this.toggleIsForward?(this.fromCamera=this.page.activeCamera,this.switchCamera(this.data.targetCamera)):this.fromCamera&&this.switchCamera(this.fromCamera.uuid),this.page.activeCamera.dispatchEvent(zA),this.page.activeCamera.dispatchEvent(FA))},this.data.delay*1e3)}catch{}}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pause(),this.toggleIsForward=!1}};function tP(e){let t=e==null?void 0:e.tracks.filter(i=>i.ValueTypeName==="vector"||i.ValueTypeName==="quaternion").map(i=>i.times.length);if(t!=null&&t.length){let i=sj(t);return i&&i>2?i:2}return 2}var iP=class extends ur{constructor(e,t,i,r,s){var l,h,c;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=((l=o==null?void 0:o.getClip())==null?void 0:l.duration)??1,this.data.crop2){let d=tP(o==null?void 0:o.getClip());this.leftFrameTime=this.data.crop2[0]/(d-1)*this.duration,this.rightFrameTime=this.data.crop2[1]/(d-1)*this.duration}else{let d=(c=(h=o==null?void 0:o.getClip())==null?void 0:h.tracks[0])==null?void 0:c.times.length;d&&d>1?(this.leftFrameTime=this.data.crop[0]/d*this.duration,this.rightFrameTime=this.data.crop[1]/d*this.duration):(this.leftFrameTime=0,this.rightFrameTime=this.duration)}this.startOnceDelay=e.delay}get playing(){var e;return((e=this.threeAnimAction)==null?void 0:e.isRunning())??!1}play(e=!1){if(ei(this.shared,this.condition)===!1)return!1;window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{var i;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;Object.entries(this.animationControls.clipIdToAction).forEach(([r,s])=>{let a=r.split("/")[1];this.threeAnimAction!==s&&a===t&&s.isRunning()&&(e?s.fadeOut(.2):s.stop())}),e&&((i=this.threeAnimAction)==null||i.fadeIn(.2))},this.startOnceDelay)}pause(){this.threeAnimAction&&(this.threeAnimAction.paused=!0),window.clearTimeout(this.timeoutId),delete this.timeoutId}stop(){var e;(e=this.threeAnimAction)==null||e.fadeOut(.2)}seek(e){this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction&&(this.threeAnimAction.paused=!0,this.threeAnimAction.time=Oe.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(ei(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(()=>{var i;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 r=this.data.clipId.split("/")[1];
vendor: 4,253 bytes, line 8405
8405Object.entries(this.animationControls.clipIdToAction).forEach(([s,a])=>{let n=s.split("/")[1];this.threeAnimAction!==a&&n===r&&a.isRunning()&&(t?a.fadeOut(.2):a.stop())}),t&&((i=this.threeAnimAction)==null||i.fadeIn(.2))}},this.startOnceDelay)}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){var t;let e=(t=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object])==null?void 0:t.getClip();e&&(e.duration=this.duration),this.pause()}},rP=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(ei(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),K1(this.scene.activePage,this.shared),this.eventManager.activate(),this.eventManager.controlsManager.activate(this.eventManager)}},sP=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r,this.evaluatedCondition=!1}checkConditions(){this.evaluatedCondition=ei(this.shared,this.condition)}dispatch(){if(this.evaluatedCondition===!1)return!1;let e=this.shared.getVariable(this.data.variableId),t=sC(this.data.expression,this.shared,hr.typeOfVariable(e));t!==void 0&&this.shared.updateVariable(this.data.variableId,typeof t=="string"?{textValue:t}:t)}dispose(){}},aP=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r,this.timeoutId=null}dispatchInner(){if(ei(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)}},NZ=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r}dispatch(){if(ei(this.shared,this.condition)===!1)return!1;(this.data.target==="single"?this.data.variableId?[this.data.variableId]:[]:Object.keys(this.shared.getVariables())).forEac
8405h(e=>{var i;this.shared.getVariable(e);let t=(i=this.shared.data.variables.data(e))==null?void 0:i.value;t!==void 0&&this.shared.updateVariable(e,t),this.shared.enableLocalStorageForPersistentVariables&&localStorage.removeItem(V0(e))})}dispose(){}},VZ=class{constructor(e,t,i,r){this.data=e,this.page=t,this.shared=i,this.condition=r}dispatch(){var e;if(ei(this.shared,this.condition)===!1)return!1;this.data.userAPIId&&((e=this.shared.getUserAPI(this.data.userAPIId))==null||e.callUserAPI(this.shared))}dispose(){}};function ei(e,t){if(t===void 0)return!0;if(t.expression.length===0)return!1;let i=sC(t.expression,e,"boolean");return t.negate?!i:!!i}function Pi(e,t,i,r,s,a){let n={Audio:[],Video:[],Particles:[],Link:[],Destroy:[],Create:[],Reset:[],Transition:[],SwitchCamera:[],Animation:[],SceneTransition:[],SetVariable:[],DynamicVariablePlay:[],ClearLocalStorage:[],UserAPI:[]},o=l=>({id:h,data:c})=>{try{c.type==="Audio"?fr[e.type].includes("Audio")&&n.Audio.push(new IT(h,c,a,r,l)):c.type==="Video"&&!(a instanceof $i)?fr[e.type].includes("Video")&&n.Video.push(new oP(h,c,a,r,l)):c.type==="Particles"?fr[e.type].includes("Particles")&&n.Particles.push(new OT(c,i,r,l)):c.type==="Link"?fr[e.type].includes("Link")&&n.Link.push(new CQ(c,s.controlsManager,r,l)):c.type==="Create"?fr[e.type].includes("Create")&&n.Create.push(new lP(c,i,s.controlsManager,r,l)):c.type==="Destroy"?fr[e.type].includes("Destroy")&&n.Destroy.push(new RT(c,i,s.controlsManager,r,l)):c.type==="Reset"?fr[e.type].includes("Reset")&&n.Reset.push(new LT(c,i,r,s,l)):c.type==="Transition"?fr[e.type].includes("Transition")&&n.Transition.push(new $T(e.type,c,i,r,l)):c.type==="SwitchCamera"?fr[e.type].includes("SwitchCamera")&&n.SwitchCamera.push(new eP(c,i,r,l)):c.type==="SceneTransition"?fr[e.type].includes("SceneTransition")&&n.SceneTransition.push(new rP(c,i,s,r,l)):c.type==="Animation"?fr[e.type].includes("Animation")&&n.Animation.push(new iP(c,i,s.animationControls,r,l)):c.type==="SetVariable"?fr[e.type].includes("SetVariable")&&n.SetVariable.push(new sP(c,i,r,l)):c.type==="DynamicVariablePlay"?fr[e.type].includes("DynamicVariablePlay")&&n.DynamicVariablePlay.push(new aP(c,i,r,l)):c.type==="Conditional"?fr[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"?fr[e.type].includes("ClearLocalStorage")&&n.ClearLocalStorage.push(new NZ(c,i,r,l)):c.type==="UserAPI"&&fr[e.type].includes("UserAPI")&&n.UserAPI.push(new VZ(c,i,r,l))}catch{}};return t.forEach(o()),n}function Ji(e){Object.values(e).forEach(t=>{t.forEach(i=>{(i instanceof IT||i instanceof oP||i instanceof OT||i instanceof iP||i instanceof $T||i instanceof lP||i instanceof RT||i instanceof eP||i instanceof rP||i instanceof LT||i instanceof sP||i instanceof aP)&&i.dispose()})})}function jZ(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 nP=new Map,Gc=new Map,hh=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=jZ(i,r);o&&(this.videoElement=o,this.videoElement.loop=s===1/0,Sd&&(this.videoElement.autoplay=!0),a!==void 0&&(this.videoElement.volume=a)),n!==void 0&&(this.delay=n),Gc.has(i.uuid)?Gc.get(i.uuid).push(this):Gc.set(i.uuid,[this]),nP.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())}
vendor: 5,782 bytes, line 8405
8405playByToggle(){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)}},cy=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=nP.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=Gc.get(e);!(t!=null&&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=[...Gc.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}},oP=class{constructor(e,t,i,r,s){if(this.data=t,this.shared=r,this.condition=s,t.interaction==="play")this.interaction=new hh(e,t,i);else if(t.interaction==="pause"||t.interaction==="stop")this.interaction=new cy(t);else throw new Error("Missing property")}dispatchBasic(){if(ei(this.shared,this.condition)===!1)return!1;this.interaction instanceof hh?this.interaction.playByToggle():this.interaction.dispatch()}dispatchConditional(){if(ei(this.shared,this.condition)===!1)return!1;this.interaction instanceof hh?this.interaction.play():this.interaction.dispatch()}dispose(){this.interaction.dispose()}},kA=(()=>{let e,t,i,r;function s(o){!e&&!UA()&&(t==null?void 0:t.sharedGameControlGlobals.createdObjects.length)>0&&(e=requestAnimationFrame(a)),o&&(t=o,r=o.requestRender)}function a(o){let l=i?o-i:0,h=t.sharedGameControlGlobals.createdObjects,c=t.sharedGameControlGlobals.nCreatedPerAction,d=h.length,u=0;for(;u<d;){let p=h[u];p.userData.createdTime===void 0&&(p.userData.createdTime=o),p.userData.lifetime===void 0&&p.userData.quantity===void 0||p.userData.lifetime&&o-p.userData.createdTime<p.userData.lifetime||p.userData.quantity&&c[p.userData.actionId]<=p.userData.quantity?(p.userData.velocity&&(p.position.addScaledVector(p.userData.velocity,l/1e3),p.updateMatrix(),r()),u++):(c[p.userData.actionId]>p.userData.quantity&&c[p.userData.actionId]--,h.splice(u,1),p.removeFromParent(),t.sharedGameControlGlobals.rapierWorld&&p.rigidBody?(t.sharedGameControlGlobals.colliderToEntity.delete(p.rigidBody.collider(0).handle),t.sharedGameControlGlobals.rapierWorld.removeRigidBody(p.rigidBody)):(p.bvhGeometry=void 0,t.sharedGameControlGlobals.entitiesWithTransformAnim=t.sharedGameControlGlobals.entitiesWithTransformAnim.filter(f=>f.bvhGeometry!==void 0)),d--,r())}e=u>0?requestAnimationFrame(a):void 0,i=u>0?o:void 0}function n(){UA()?e&&(cancelAnimationFrame(e),e=void 0,i=void 0):s()}return typeof document<"u"&&document.addEventListener("visibilitychange",n),s})();function UA(){return!!document&&document.hidden}var NA=new ot,GZ=new M,HZ=new M,lP=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=Oe.generateUUID(),this.dispatch=()=>{if(ei(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(ei(this.shared,this.condition)===!1)return!1;this.timeoutIdQueue.push(window.setTimeout(this.dispatchInner,this.data.delay*1e3))},this.dispatchThrottled=Sj(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 cr(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),n.rotation.fromArray(this.data.rotation),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),kA(),this.controlsManager.requestRender()},this.traverseObjectCB=n=>{var c,d,u,p;n.hasNonUniformScale&&n.updateMatrixWorldSVD();let o;if(this.controlsManager.sharedGameControlGlobals.rapierWorld){if(n instanceof cs)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 cr)o=n.object;else if(o=n,(c=o.dataPatched.cloner)==null?void 0:c.hideBase)return!0}else{if(n instanceof cs)return;n instanceof cr?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),h=o.dataPatched;
8405if(!(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"&&((d=n.rigidBody)==null||d.collider(0).setActiveEvents(1),n.userData.hasCollisionDestroy=!0),n.matrixWorld.decompose(GZ,NA,HZ),l.applyQuaternion(NA),this.data.velocity.some(f=>f!==0)&&this.data.dynamic&&((u=n.rigidBody)==null||u.setLinvel(l.divideScalar(this.controlsManager.pixelsPerMeter),!0))):("geometry"in n.object&&this.controlsManager.addBoundsTree(n),this.data.velocity.some(f=>f!==0)&&this.data.dynamic&&(n.userData.velocity=l)),((p=o.dataPatched.physics)==null?void 0:p.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");kA(i)}dispose(){this.intervalId!==null&&(window.clearInterval(this.intervalId),this.intervalId=null),this.timeoutIdQueue.forEach(e=>window.clearTimeout(e)),this.dispatchThrottled.cancel(),this.page.remove(...this.controlsManager.sharedGameControlGlobals.createdObjects),this.controlsManager.sharedGameControlGlobals.createdObjects=[]}},hP=200,Qg=.02,Zg=.3,WZ=65;new M;var VA=new M,jA=new M,qZ=new M,Ar=new M,Br=new M,_n=new M,Kg=new be,GA=new be,XZ=new be;new be;var Ms=new ot,Ra=new ot,Js=new zi(0,0,0,"YXZ"),YZ=new M(1,0,0),Es=new M(0,1,0),QZ=new M(0,0,1),HA=new M(1,1,1);new Hr;var ZZ=1,KZ=.025,JZ=16e-6,WA=12,$Z=20,Hi=new us,is=new xi,eK={type:"requestRender"},tK={type:"updateMatrix"},qA=Math.PI/6,dy=class extends ur{constructor(e,t,i,r,s,a,n,o,l){var f;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 be,this.target0=new M,this.zoom0=1,this.rotForce=1,this.moveForce=1,this.pixelsPerMeter=hP,this.euler0=new zi(0,0,0,"YXZ"),this.position0Cam=new M,this.quat0Cam=new ot,this.scale0Cam=new M,this.hiddenMatrix0Cam=new be,this.threshEndTranslate=.01,this.threshEndRotate=1e-8,this.threshEndRotVel=.005,this.collider={type:"capsule",radius:40,segment:new us(new M(0,-40,0),new M(0,40,0)),matrix:new be,position:new M,rotation:new ot},this.euler=new zi(0,0,0,"YXZ"),this.eulerDelta=new M,this.lastPosition=new M,this.lastCameraQuaternion=new ot,this.lastCameraPosition=new M,this.PI_2=Math.PI/2,this.prevMouse=new j,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 be,this.nonColliderPosOffset=new be,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 be,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 ot,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 ot,this.objXZQuatInv=new ot,this.objXZRotMat=new be,this.isFirstPerson=!1,this.didHit=!1,this.groundVelocity=new M,this.pushedVelocity=new M,this.groundYRotation=0,this.objectRealQuat=new ot,this.colliderWorldQuat=new ot,this.groundNormal=new M,this.groundTilt=new ot,this.groundTiltInv=new ot,this.lastHitObj=null,this.isFirstFrame=!0,this.rotationAccumWhenOrientWithCamera=0,this.navMeshPathDest=null,this.position=new M,this.quaternion=new ot,this.scale=new M,this.initialAction=!0,this.onPointerDown=g=>{var m;!(g.target===this.domElement||g.target instanceof HTMLElement&&g.target.tagName==="SPLINE-VIEWER"&&((m=g.target.shadowRoot)!=null&&m.contains(this.domElement)))||this.firstPointerId!==-1||(this.firstPointerId=g.pointerId,this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp),this.rotBy!=="keys"&&!Qr&&!fw&&this.domElement.requestPointerLock(),this.prevMouse.set(g.clientX,g.clientY))},this.onPointerUp=g=>{this.firstPointerId=-1,this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp),g.pointerType==="mouse"&&this.domElement.ownerDocument.exitPointerLock()},this.onPointerMove=g=>{if(g.pointerId!==this.firstPointerId)return;let m=g.clientX-this.prevMouse.x,v=g.clientY-this.prevMouse.y;this.prevMouse.set(g.clientX,g.clientY),g.pointerType==="mouse"&&this.rotBy!=="keys"&&(fw&&Oj<15.5&&!Qr?(this.eulerDelta.y=-m*this.mouseOrbitSensitivity,this.eulerDelta.x=-v*this.mouseOrbitSensitivity):(this.eulerDelta.y=-g.movementX*this.mouseOrbitSensitivity,this.eulerDelta.x=-g.movementY*this.mouseOrbitSensitivity)),g.pointerType!=="mouse"&&this.rotByTouch==="drag"&&(this.eulerDelta.y=-m*this.mouseOrbitSensitivity*5,this.eulerDelta.x=-v*this.mouseOrbitSensitivity*5),this.controlsManager.requestRender()},this.onPointerlockChange=g=>{this.domElement.ownerDocument.pointerLockElement===this.domElement?dy.isLocked=!0:dy.isLocked=!1},this.onPointerlockError=()=>{console.error("SPE.GameControls: Unable to use Pointer Lock API")},this.handleVisibilityChange=()=>{if(document!=null&&document.hidden)for(let g in this.movementState)this.movementState[g]=0},this.onKeyDown=g=>{!(g.target instanceof HTMLInputElement)&&(g.code==="ArrowLeft"||g.code==="ArrowUp"||g.code==="ArrowRight"||g.code==="ArrowDown"||g.code==="Space")&&g.preventDefault();for(let m of this.keyAssignments)if(g.key.toUpperCase()===m[1]||g.key===m[1]){this.movementState[m[0]]=1;break}this.controlsManager.requestRender()},this.onKeyUp=g=>{for(let m of this.keyAssignments)if(g.key.toUpperCase()===m[1]||g.key===m[1]||g.code.slice(3,g.code.length).toUpperCase()===m[1]){this.movementState[m[0]]=0;break}},this.copyVRGamePadValues=(g,m)=>{for(let v=2;v<4;
vendor: 15,552 bytes, line 8405
8405v++){let y=g.axes[v];m===0?v===2?this.movementState.movePosX=y:this.movementState.movePosZ=y:(g.buttons[3].pressed?this.movementState.jump=1:this.movementState.jump=0,v===2?(Math.abs(this.movementState.rotPosY)<.3&&Math.abs(y)>=.3&&(this.vrEulerYOffset+=y<0?1:-1),this.movementState.rotPosY=y):this.moveMode==="fly"&&(this.movementState.moveNegY=y))}},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((f=this.camera)==null?void 0:f.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 g=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 v,y;Math.abs(g.y)<1e-6?(m.y=0,g.y=0,y=m.projectOnVector(g)):m.y/g.y>0?y=g.multiplyScalar(m.y/g.y):y=g.multiplyScalar(m.length()),this.targetToCamera0.copy(y).negate(),v=this.camera.position.clone().add(y),this.objectToTarget0.subVectors(v,this.position);let x=new zi().setFromQuaternion(this.camera.quaternion,"YXZ");this.cameraPolarOffset=-x.x,x.x=0,x.z=0,x.y-=Math.PI/2,this.cameraPolarAxis0.set(0,0,-1).applyEuler(x)}if(this.object instanceof yr&&(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)*ZZ,this.speedOrbit=(i.speedRotate??100)*KZ,this.mouseOrbitSensitivity=(i.speedRotate??100)*JZ,this.keyAssignments=i.keyAssignments.map(g=>{let m=[g[0],g[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 g;g=this.keyAssignments.findIndex(m=>m[0]==="rotNegX"),g!==-1&&(this.keyAssignments[g][1]=""),g=this.keyAssignments.findIndex(m=>m[0]==="rotPosX"),g!==-1&&(this.keyAssignments[g][1]=""),g=this.keyAssignments.findIndex(m=>m[0]==="rotPosY"),g!==-1&&(this.keyAssignments[g][1]=""),g=this.keyAssignments.findIndex(m=>m[0]==="rotNegY"),g!==-1&&(this.keyAssignments[g][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??xh.defaultData.gravity)*WA,this.usePhysics=this.gloabalPhysics.usePhysics??xh.defaultData.usePhysics,this.jumpPower=i.jumpPower*$Z,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??nf.defaultDataThirdPerson.orientWith,this.slopeThresh=WZ*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*Qg/this.pixelsPerMeter,this.stepThresh=i.collider.height*Zg/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*Qg/this.pixelsPerMeter,this.stepThresh=2*i.collider.radius*Zg/this.pixelsPerMeter,this.colliderHeight=i.collider.radius*2):(this.offset=i.collider.height*Qg/this.pixelsPerMeter,this.stepThresh=i.collider.height*Zg/this.pixelsPerMeter,this.colliderHeight=i.collider.height),this.collider.type=i.collider.type;let d=new M().fromArray(i.collider.position),u=new ot().setFromEuler(new zi().fromArray([...i.collider.rotation,"XYZ"]));this.collider.position.copy(d).multiply(this.scale),this.collider.rotation.copy(u),this.collider.matrix.compose(d,u,HA),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 g=new He;g.push({fi:0,data:{...qi.defaultData("light","phong"),alpha:0},id:"layer1"}),g.push({fi:0,data:{...qi.defaultData("color"),color:i.navmesh.destinationHelperColor,alpha:i.navmesh.destinationHelperColor.a},id:"layer2"});let m=new w1({layers:g},{scene:this.page.scene,shared:this.sharedAssets});this.navMeshPathDest=new Zt(FE.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 zi().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 yr?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(){var e;this.deactivate(),(e=this.navMeshPathDest)!=null&&e.parent&&this.page.remove(this.navMeshPathDest)}instantiateActions(){let e=this.data,t=this.sharedAssets;e.gameActions!==void 0&&(this.actions={},af.list.forEach(i=>{this.actions[i]=Pi({...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"),Ji(this.actions.idle),Ji(this.actions.move),Ji(this.actions.run),Ji(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].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].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 Ar.copy(this.collider.position).applyQuaternion(this.objectRealQuat).add(this.position)}update(e,t,i){var o,l,h,c,d,u,p,f,g;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){let m=Br.set(0,(this.velocity.y===0?this.pixelsPerMeter*Math.max(Math.abs(this.gravity)/(10*WA),1)*(this.gravity>0?1:-1):this.velocity.y)*r,0).divideScalar(this.pixelsPerMeter),v=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter),this.colliderWorldQuat,m,(o=this.object.rigidBody)==null?void 0:o.collider(0).shape,1,!1,16,void 0,void 0,this.object.rigidBody);if(v){this.onObject=!0,this.groundNormal.set(v.normal2.x,v.normal2.y,v.normal2.z).applyQuaternion(this.colliderWorldQuat).negate(),this.alignToGround&&this.groundTiltAdjustment(this.groundNormal),Math.acos(this.groundNormal.y)<this.slopeThresh&&(a=!0),((l=v.collider.parent())==null?void 0:l.bodyType())===0&&Math.acos(this.groundNormal.y)*(180/Math.PI)>45&&(this.onObject=!1);let y=v.collider.parent();this.groundYRotation=0,this.groundVelocity.set(0,0,0);for(let x of this.sharedGameControlGlobals.entitiesWithTransformAnim)if(x.rigidBody===y&&x.userData.isFollowingObj!==this.object.uuid){(x.hasNonUniformScale?x.matrixWorldRigid:x.matrixWorld).decompose(Ar,Ra,Br),this.groundVelocity.subVectors(Ar,x.prevT),this.object.getWorldPosition(Br).add(this.collider.position).sub(Ar),this.groundYRotation=Js.setFromQuaternion(Ra).y-x.prevR.y,_n.copy(Br).applyAxisAngle(Es,this.groundYRotation),this.groundVelocity.add(_n.sub(Br)).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 m=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 v=Ar.subVectors(this.path[1],this.position),y=Br.subVectors(this.path[1],this.path[0]);v.dot(y)<0?this.path.shift():(this.directionXZ.x=y.x,this.directionXZ.z=y.z),m.opacity=m.userData.opacity0}else m.opacity-=.05*m.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.dispatchStopEvent("jump"),this.movementState.run?(this.dispatchStopEvent("move"),this.dispatchStartEvent("run")):(this.dispatchStopEvent("run"),this.dispatchStartEvent("move"))));let n=qZ.copy(this.velocity);if(this.orientMode!=="none"&&this.isFirstPerson===!1){let m=Br.copy(n);m.y=0,n.set(0,n.y,m.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 m=Ar;this.camera.getWorldDirection(m);
8405let v=_n.copy(Es).multiplyScalar(m.dot(Es));m.sub(v);let y=Br.copy(this.directionXZ);y.x*=-1,this.rot.y=m.angleTo(y)*(m.cross(y).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(Js.setFromVector3(this.rot),this.moveMode==="walk"&&(Js.x=0),n.applyEuler(Js),a&&(Ra.setFromUnitVectors(Es,this.groundNormal),n.applyQuaternion(Ra)),i){let m=Js.set(0,this.vrEulerYOffset*qA,0);i.applyEuler(m),n.x+=i.x,n.z+=i.z,this.nonColliderPosOffset.elements[13]+=i.y*r}if(this.usePhysics===!0){let m=Br;this.pushedVelocity.set(0,0,0);for(let v of this.sharedGameControlGlobals.entitiesWithTransformAnim){let y=_n.setFromMatrixPosition(v.matrixWorld).sub(v.prevT).divideScalar(r).divideScalar(this.pixelsPerMeter),x=v.rigidBody.collider(0).castCollider(y,this.object.rigidBody.collider(0),Ar.copy(n).divideScalar(this.pixelsPerMeter),r,!1);y.multiplyScalar(this.pixelsPerMeter);let w=Ct.is(v)?v:v.object;if(x!==null&&this.lastHitObj!==w){let S;v instanceof cr&&(S=v);let b=this.sharedGameControlGlobals.entityToCollisionEvents[w.uuid];if(b)for(let A of b)A.data.target==="character"&&(A.dispatch(S),w.dispatchEvent(py));this.lastHitObj=w}if(x!==null){this.pushedVelocity.copy(y),m.copy(x.normal1).applyQuaternion(v.quaternion);break}}if(this.pushedVelocity.manhattanLength()!==0){let v=m.dot(n);v<0&&n.addScaledVector(m,-v),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(Es,this.euler.y-this.euler0.y);let m=Br.copy(this.objectToCamXZ).normalize(),v=_n.copy(n).multiplyScalar(r);v.y=0;let y=v.sub(Ar.copy(m).multiplyScalar(v.dot(m))).cross(m).y;this.euler.y-=Math.atan2(y,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=Oe.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):this.euler.x=Oe.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset,this.PI_2+this.cameraPolarOffset):this.cameraXAxis==="Limit"&&(this.euler.x=Oe.clamp(this.euler.x,-this.PI_2,this.PI_2))),this.moveMode==="fly"?this.rot.x=this.euler.x:this.isFirstPerson&&(t?(Js.copy(t),Js.y=0):(Js.copy(this.euler),Js.y=0),this.nonColliderRotOffset.makeRotationFromEuler(Js)),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*qA),Ms.setFromAxisAngle(YZ,this.rot.x),Ra.setFromAxisAngle(Es,this.rot.y),Ra.multiply(Ms),Ms.setFromAxisAngle(QZ,this.rot.z),Ra.multiply(Ms),this.quaternion.copy(Ra),this.objectRealQuat.multiplyQuaternions(this.quaternion,this.objXZQuat),this.colliderWorldQuat.copy(this.objectRealQuat).multiply(this.collider.rotation),this.collisionEnabled)if(this.usePhysics){let m=Br.copy(n).multiplyScalar(r/this.pixelsPerMeter),v=null;this.didHit=!1;let y=new M;for(let x=0;x<5;x++){let w=m.length(),S=_n.copy(m).normalize();if(v=this.sharedGameControlGlobals.rapierWorld.castShape(this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(y),this.colliderWorldQuat,S,(h=this.object.rigidBody)==null?void 0:h.collider(0).shape,w,!1,24,void 0,void 0,this.object.rigidBody),v!==null){this.didHit=!0;let b=this.sharedGameControlGlobals.colliderToEntity.get(v.collider.handle);if(b!==this.lastHitObj&&x===0){this.lastHitObj=b;let C=this.sharedGameControlGlobals.entityToCollisionEvents[b==null?void 0:b.uuid];if(C){for(let T of C)if(T.data.target==="character"){let P=((c=this.sharedGameControlGlobals.rapierWorld)==null?void 0:c.getCollider(v.collider.handle))._parent,O;
vendor: 4,766 bytes, line 8405
8405if(b.cloner){for(let D of b.cloner.children)if(D.rigidBody===P){O=D;break}}T.dispatch(O),b.dispatchEvent(py)}}}let A=VA.set(v.normal2.x,v.normal2.y,v.normal2.z).applyQuaternion(this.colliderWorldQuat),_=jA.copy(S).multiplyScalar(v.toi).dot(A),E=v.toi;if(E===0&&(this.position.y+=this.offset*this.pixelsPerMeter),_>this.offset&&(E=v.toi*(_-this.offset)/_,y.addScaledVector(S,E)),m.copy(S).multiplyScalar(w-E),Math.acos(-A.y)>this.slopeThresh){let C=this.colliderWorldPosition.divideScalar(this.pixelsPerMeter).add(y),T=_n.copy(v.witness2).applyQuaternion(this.colliderWorldQuat);T.y=0;let P=C.add(T);P.y+=this.stepThresh;let O=this.sharedGameControlGlobals.rapierWorld.castShape(P,this.colliderWorldQuat,m,(d=this.object.rigidBody)==null?void 0:d.collider(0).shape,1,!1,24,void 0,void 0,this.object.rigidBody);O!==null&&O.toi===0&&(A.y=0,A.normalize())}m.addScaledVector(A,-m.dot(A))}else{x===0&&this.directionXZ.manhattanLength()!==0&&(this.lastHitObj=null),y.add(m);break}}this.position.addScaledVector(y,this.pixelsPerMeter),(u=this.object.rigidBody)==null||u.setTranslation(Ar.copy(this.position).divideScalar(this.pixelsPerMeter),!0),(p=this.object.rigidBody)==null||p.setRotation(Ms.copy(this.quaternion).premultiply(this.groundTilt).multiply(this.objXZQuat),!0)}else{let m=this.onObject?1:5,v=n.multiplyScalar(r/m);for(let y=0;y<m;y++)this.position.add(v),this.collisionAdjustment(r/m)}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 m=this.objectToTarget.add(this.position),v=this.targetToCamera.add(m);Kg.lookAt(v,m,Es).setPosition(v),Kg.decompose(this.targetPos,this.targetQuat,Ar),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=Oe.clamp(this.euler.y,this.minAzimuthAngleRel,this.maxAzimuthAngleRel)),this.euler.x=Oe.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(tK),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*((g=(f=this.navMeshPathDest)==null?void 0:f.material)==null?void 0:g.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(eK),!0)}updateFollowArms(){this.objectToTarget.copy(this.objectToTarget0),this.targetToCamera.copy(this.targetToCamera0);let e=Ms.setFromAxisAngle(Es,this.cameraYAxis==="Limit"&&this.orientMode!=="radial"?Oe.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=Oe.clamp(this.euler.x,-this.maxPolarAngle+this.cameraPolarOffset+1e-6,-this.minPolarAngle+this.cameraPolarOffset-1e-6):t=Oe.clamp(this.euler.x,-this.PI_2+this.cameraPolarOffset+1e-6,this.PI_2+this.cameraPolarOffset-1e-6);let i=Ar.copy(this.cameraPolarAxis0);(this.cameraYAxis!=="Locked"||this.orientMode==="radial")&&i.applyQuaternion(e);let r=Ra.setFromAxisAngle(i,t);this.cameraYAxis!=="Locked"&&this.targetToCamera.applyQuaternion(e),this.cameraXAxis!=="Locked"&&this.targetToCamera.applyQuaternion(r)}groundTiltAdjustment(e){Es.angleTo(e)*180/Math.PI<15||Es.angleTo(e)*180/Math.PI>85?Ms.identity():Ms.setFromUnitVectors(Es,e),this.groundTilt.slerp(Ms,.06),this.groundTiltInv.copy(this.groundTilt).invert()}collisionAdjustment(e){var s;let t=jA.set(0,0,0);this.object.matrix.compose(this.position,this.quaternion,this.scale);
8405let i=Kg.multiplyMatrices(this.object.matrix,this.objXZRotMat).multiply(this.collider.matrix).decompose(Ar,Ms,Br).compose(Ar,Ms,HA);this.sharedGameControlGlobals.entitiesWithTransformAnim.forEach(a=>{if(a===this.object||a.isDescendantOf(this.object))return;is.makeEmpty(),a.updateMatrixWorldSVD();let n=a.matrixWorldRigid,o=GA.copy(n).invert(),l=XZ.copy(GA).multiply(i);Hi.copy(this.collider.segment),Hi.start.applyMatrix4(l),Hi.end.applyMatrix4(l);let h=VA.copy(this.position).applyMatrix4(o);is.expandByPoint(Hi.start),is.expandByPoint(Hi.end),is.min.addScalar(-this.collider.radius),is.max.addScalar(this.collider.radius),a.bvhGeometry.boundsTree.shapecast({traverseBoundsOrder(c){return c.distanceToPoint(Hi.end)},intersectsBounds:c=>c.intersectsBox(is),intersectsTriangle:c=>{let d=Ar,u=Br,p=c.closestPointToSegment(Hi,d,u);if(p<this.collider.radius){let f=this.collider.radius-p,g=u.sub(d).normalize(),m=_n.copy(h);m.addScaledVector(g,f);let v=m.applyMatrix4(n).sub(this.position);t.add(v),Hi.start.addScaledVector(g,f),Hi.end.addScaledVector(g,f)}}})}),is.makeEmpty(),Hi.copy(this.collider.segment),Hi.start.applyMatrix4(i),Hi.end.applyMatrix4(i),is.expandByPoint(Hi.start),is.expandByPoint(Hi.end),is.min.addScalar(-this.collider.radius),is.max.addScalar(this.collider.radius),(s=this.sharedGameControlGlobals.staticMeshBVH)==null||s.shapecast({traverseBoundsOrder(a){return a.distanceToPoint(Hi.end)},intersectsBounds:a=>a.intersectsBox(is),intersectsTriangle:a=>{let n=Ar,o=Br,l=a.closestPointToSegment(Hi,n,o);if(l<this.collider.radius){let h=this.collider.radius-l,c=o.sub(n).normalize();this.alignToGround&&this.groundTiltAdjustment(c),t.addScaledVector(c,h),Hi.start.addScaledVector(c,h),Hi.end.addScaledVector(c,h)}}}),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)}},cP=dy;cP.isLocked=!1;var iK=eo(fM());function dP(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 Ha(e,t){let i=new je;if(t&&dP(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}=Yf(e.getAttribute("position"),e.getIndex());return i.setAttribute("position",new De(r,3)),i.setIndex(s),t&&i.applyMatrix4(t),i}var rK=new be,sK=new be,$s=[[0,0,0],[0,0,0],[0,0,0]];function uP(e){let t=e.elements;$s[0][0]=t[0],$s[0][1]=t[4],$s[0][2]=t[8],$s[1][0]=t[1],$s[1][1]=t[5],$s[1][2]=t[9],$s[2][0]=t[2],$s[2][1]=t[6],$s[2][2]=t[10];let{u:i,v:r}=(0,iK.SVD)($s),s=rK.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=sK.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 aK=class extends o2{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 io({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 je;return a.setFromPoints([t,s]),new Tp(a,e)}},pP=e=>e instanceof oh||e instanceof lh;function nK(e,t){return e.distance-t.distance}function fP(e,t,i){if(!(!Ga(t)||!t.visible)){Ds(t)&&t.raycast(e,i);for(let r of t.children)fP(e,r,i)}}function wp(e,t,i,r=!1){if(!r&&!i.some(a=>Ef(e,a)!==void 0))return[];let s=[];
8405return t.children.forEach(a=>fP(e,a,s)),s.sort(nK),s}function uy(e){let t=[];if(e.length){let i=e[0].object;Ga(i)&&t.push(i);let r=i.parent;for(;r;)pP(r)&&t.push(r),r=r.parent}return t}function Wa(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!=null&&l.intersects(a,n))return r(l),!0}}return!1}function Ef(e,t){if(Ds(t)){if(t.visible){let i=[];return t.raycast(e,i),i.length?i[0]:void 0}}else if(pP(t))return mP(e,t)}function mP(e,t){if(!(!Ga(t)||!t.visible)){if(Ds(t)){let i=[];if(t.raycast(e,i),i.length)return i[0]}for(let i of t.children){let r=mP(e,i);if(r)return r}}}function oK(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 lK(e,t,i){return{x:(e-(i.left+window.scrollX))/i.width,y:1-(t-(i.top+window.scrollY))/i.height}}var hK=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 aK,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){var r;let{pageX:t,pageY:i}=((r=e.touches)==null?void 0:r.length)>0?e.touches[0]:e;this.pointerWorld=oK(t,i,this._domRect),this.pointerScreen=lK(t,i,this._domRect),this.raycaster.setFromCamera(this.pointerWorld,this.getCamera())}},br=class{constructor(e){this.eventContext=e,this.domEventsNeeded=new Set,this.hasVideoAction=!1}connect(){}disconnect(){}},J1=[["start","Start"],["keyDown","KeyDown"],["keyUp","KeyUp"],["mouseDown","MouseDown"],["mouseUp","MouseUp"],["mouseHover","MouseHover"],["collision","Collision"],["lookAt","LookAt"],["follow","Follow"],["scroll","Scroll"]],gP=e=>{var t;return(t=J1.find(([i,r])=>r===e))==null?void 0:t[0]},Dd=e=>{var t;return(t=J1.find(([i])=>i===e))==null?void 0:t[1]},cK=(e,t)=>{let i=gP(e);if(i){let r=new CustomEvent(i,{bubbles:!0});return Object.defineProperty(r,"target",{writable:!1,value:t}),r}},dK=class extends br{constructor(){super(...arguments),this.objectsPerEvents=new Map,this.splineEvents={},this.onBeginEvent=e=>{var r;if(!e.eventName||!e.target||e.eventName==="Scroll")return;let t=(r=this.splineEvents[gP(e.eventName)])==null?void 0:r[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=>{var i,r;if((i=t.data)!=null&&i.events.length){for(let[s,a]of J1)if(t.data.events.some(n=>n.data.type===a&&!n.data.disabled)){this.objectsPerEvents.has(s)?(r=this.objectsPerEvents.get(s))==null||r.push(t):this.objectsPerEvents.set(s,[t]);let n={id:t.uuid,name:t.name},o=cK(a,n),l=this.splineEvents[s];l?l[t.uuid]=o:this.splineEvents[s]={[t.uuid]:o}}}}),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)})})}},uK=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=Pi(t,t.actions,r,s,a,i)}disconnect(){Ji(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.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=>
vendor: 2,041 bytes, line 8405
8405{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.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.SwitchCamera.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.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()}
8405),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())}},pK=class extends br{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=wp(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=>{st.length>1||(this.eventContext.updateRaycaster(r),this.handleMouseEvent("MouseDown"))},this.onMouseUp=r=>{st.length>1||(this.eventContext.updateRaycaster(r),this.handleMouseEvent("MouseUp"))},this.onMousePressDown=r=>{st.length>1||(this.eventContext.updateRaycaster(r),this.handleMousePressEvent())},this.onMousePressRelease=r=>{st.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})=>{var o,l,h,c;if(!r||!s)return;let n=Dd(r);n&&(n==="MouseDown"||n==="MouseUp"||n==="MousePress"?(s.dispatchEvent({type:"beginEvent",eventName:n}),(l=(o=this.eventsPerObjects[n])==null?void 0:o[s.uuid])==null||l.forEach(d=>{d.dispatchUserEvent(a)})):(n==="KeyDown"||n==="KeyUp"||n==="KeyPress")&&(s.dispatchEvent({type:"beginEvent",eventName:n}),(c=(h=this.eventsPerObjects[n])==null?void 0:h[s.uuid])==null||c.forEach(d=>{d.dispatchUserEvent()})))}}connect(){var s,a,n,o,l,h;let{page:e,sharedAssets:t,domElement:i}=this.eventContext,r=(c,d)=>{var p,f;if(!((p=c.data)!=null&&p.events.length))return;let u=["MouseDown","MouseUp","MousePress","KeyDown","KeyUp","KeyPress"];for(let g of u){let m=this.eventsPerObjects[g];if(c.data.events.filter(({data:v})=>v.type===g&&v.disabled!==!0).forEach(({id:v,data:y})=>{try{let x=new uK(v,y,c,e,t,this.eventManager);x.actions.Video.length&&(this.hasVideoAction=!0),(y.type==="MouseDown"||y.type==="MouseUp"||y.type==="MousePress")&&(y.mode==="Canvas"||y.mode==="Window")?this.canvasMouseEvents.push(x):(m[c.uuid]?m[c.uuid].some(w=>w.id===x.id)||m[c.uuid].push(x):m[c.uuid]=[x],c instanceof Qo&&c.traverseChildren(w=>{var S;if(!w.visible)return!0;w instanceof Ei&&((S=w.data.geometry.shapeBlendNode)==null?void 0:S.operation)!==2&&(m[w.uuid]?m[w.uuid].push(x):m[w.uuid]=[x])}))}catch{}}),((f=m[c.uuid])==null?void 0:f.length)&&(this.objectsPerTypes[g].push(c instanceof $i&&(g==="MouseDown"||g==="MouseUp"||g==="MousePress")?d:c),c instanceof Qo)){let v=this.objectsPerTypes[g];c.traverseChildren(y=>{if(!y.visible)return!0;y instanceof Ei&&v.indexOf(y)===-1&&v.push(y)})}}};e.traverseEntity(c=>{var d;(c instanceof gr||c instanceof Xi)&&((d=c.frame)==null||d.traverse(u=>{r(u,c)})),r(c)}),this.heldKeys={},this.heldKeysPress={},this.domEventsNeeded.clear(),i.addEventListener("pointerdown",this.onCanvasMouseDown),i.addEventListener("pointerup",this.onCanvasMouseUp),((s=this.objectsPerTypes.MouseDown)!=null&&s.length||this.useForRaycastProperty)&&(this.domEventsNeeded.add("pointerdown"),i.addEventListener("pointerdown",this.onMouseDown)),(a=this.objectsPerTypes.MouseUp)!=null&&a.length&&(this.domEventsNeeded.add("pointerup"),i.addEventListener("pointerup",this.onMouseUp)),(n=this.objectsPerTypes.MousePress)!=null&&n.length&&(this.domEventsNeeded.add("pointerdown"),i.addEventListener("pointerdown",this.onMousePressDown),this.domEventsNeeded.add("pointerup"),i.addEventListener("pointerup",this.onMousePressRelease)),(o=this.objectsPerTypes.KeyDown)!=null&&o.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.releaseHeldKey)),(l=this.objectsPerTypes.KeyUp)!=null&&l.length&&(this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyUp)),(h=this.objectsPerTypes.KeyPress)!=null&&h.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).forEac
8405h(([c,d])=>{d.forEach(u=>{u.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)})})}handleMouseEvent(e){var o,l,h,c;let{stopRaycast:t,raycaster:i,page:r,pointerScreen:s}=this.eventContext,a=this.objectsPerTypes[e],n=a.filter(d=>!(d instanceof $i));if(!(!a.length&&!this.useForRaycastProperty)&&!(r.uiCanvas&&Wa(r,[s.x,s.y],Object.keys(this.eventsPerObjects[e]),d=>{this.handleObjectMouseEventDispatch(d,e)}))){if(t||this.useForRaycastProperty){let d;if(this.sceneInterects===null?d=wp(i,r,n,this.useForRaycastProperty):(d=this.sceneInterects,this.sceneInterects=null),this.useForRaycastProperty&&d.length&&(this.eventContext.sharedAssets.raycastProperty={x:d[0].point.x,y:d[0].point.y,z:d[0].point.z,objX:d[0].object.matrixWorld.elements[12],objY:d[0].object.matrixWorld.elements[13],objZ:d[0].object.matrixWorld.elements[14]}),t){let u=[((l=(o=d[0])==null?void 0:o.uv)==null?void 0:l.x)??0,((c=(h=d[0])==null?void 0:h.uv)==null?void 0:c.y)??0];uy(d).forEach(p=>{p instanceof gr&&Wa(p,u,Object.keys(this.eventsPerObjects[e]),f=>{this.handleObjectMouseEventDispatch(f,e)}),this.eventsPerObjects[e][p.uuid]&&this.handleObjectMouseEventDispatch(p,e)})}}t||n.forEach(d=>{var p,f;let u=Ef(i,d);u&&(this.handleObjectMouseEventDispatch(d,e),d instanceof gr&&Wa(d,[((p=u==null?void 0:u.uv)==null?void 0:p.x)??0,((f=u==null?void 0:u.uv)==null?void 0:f.y)??0],Object.keys(this.eventsPerObjects[e]),g=>{this.handleObjectMouseEventDispatch(g,e)}))})}}handleMousePressEvent(e=!1){let t="MousePress",i=this.objectsPerTypes[t],r=i.filter(a=>!(a instanceof $i)),s=[];if(i.length){if(!e){let{stopRaycast:a,raycaster:n,page:o,pointerScreen:l}=this.eventContext,h=!1;if(o.uiCanvas&&(h=Wa(o,[l.x,l.y],Object.keys(this.eventsPerObjects[t]),c=>{s.push(c)})),a&&!h){let c=wp(n,o,r);s=uy(c),c.forEach(d=>{var u,p;d.object instanceof gr&&Wa(d.object,[((u=d==null?void 0:d.uv)==null?void 0:u.x)??0,((p=d==null?void 0:d.uv)==null?void 0:p.y)??0],Object.keys(this.eventsPerObjects[t]),f=>{s.push(f)})})}else r.forEach(c=>{var u,p;let d=Ef(n,c);d&&(s.push(c),c instanceof gr&&Wa(c,[((u=d==null?void 0:d.uv)==null?void 0:u.x)??0,((p=d==null?void 0:d.uv)==null?void 0:p.y)??0],Object.keys(this.eventsPerObjects[t]),f=>{s.push(f)}))})}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){var i,r;e.dispatchEvent({type:"beginEvent",eventName:t}),(r=(i=this.eventsPerObjects[t])==null?void 0:i[e.uuid])==null||r.forEach(s=>{s.dispatch()})}handleObjectMouseEventDispatchRelease(e,t){var i,r;e.dispatchEvent({type:"beginEvent",eventName:t}),(r=(i=this.eventsPerObjects[t])==null?void 0:i[e.uuid])==null||r.forEach(s=>{s.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}
vendor: 2,294 bytes, line 8405
8405),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)})})}},fK=new M,mK=new M,vP=class{constructor(e,t,i,r,s){this.actionsIn=Pi(e,e.inActions,i,r,s,t),this.actionsOut=Pi(e,e.outActions,i,r,s,t)}disconnect(){Ji(this.actionsIn),Ji(this.actionsOut)}},gK=class extends vP{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 u of this.objects)if(!u.visible)return;let h=fK.setFromMatrixPosition(this.objects[0].matrixWorld),c=mK.setFromMatrixPosition(this.objects[1].matrixWorld),d=h.distanceTo(c)<=this.distance?"in":"out";if(this.stage!==d){this.stage=d;let u=d==="in"?this.actionsIn:this.actionsOut;u.Audio.forEach(p=>p.dispatchConditional()),u.Particles.forEach(p=>p.dispatchConditional()),u.Video.forEach(p=>p.dispatchConditional()),u.Link.forEach(p=>p.dispatch()),u.Create.forEach(p=>p.dispatch()),u.Destroy.forEach(p=>p.dispatch()),u.Reset.forEach(p=>p.dispatch()),u.Transition.forEach(p=>{p.object.currentTransitionEvent!==this&&(p.object.currentTransitionEvent=this),p.init()}),u.Transition.forEach(p=>p.play()),u.Animation.forEach(p=>p.play()),u.SwitchCamera.forEach(p=>p.play()),u.SceneTransition.forEach(p=>p.dispatch()),u.SetVariable.forEach(p=>p.checkConditions()),u.SetVariable.forEach(p=>p.dispatch()),u.DynamicVariablePlay.forEach(p=>p.dispatch()),u.ClearLocalStorage.forEach(p=>p.dispatch()),u.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)})}},vK=class extends vP{constructor(e,t,i,r,s,a){var l;super(t,i,r,s,a),this.id=e,this.data=t,this.object=i,this.onBegin=({target:h,state:c})=>
8405{this.toState!==c&&(this.actionsOut.Audio.forEach(d=>d.dispatchConditional()),this.actionsOut.Particles.forEach(d=>d.dispatchConditional()),this.actionsOut.Video.forEach(d=>d.dispatchConditional()),this.actionsOut.Link.forEach(d=>d.dispatch()),this.actionsOut.Create.forEach(d=>d.dispatch()),this.actionsOut.Destroy.forEach(d=>d.dispatch()),this.actionsOut.Reset.forEach(d=>d.dispatch()),this.actionsIn.Transition.forEach(d=>d.pause()),this.object.currentTransitionEvent=this,this.actionsOut.Transition.forEach(d=>d.play()),this.actionsOut.Animation.forEach(d=>d.play()),this.actionsIn.SwitchCamera.forEach(d=>d.pause()),this.actionsOut.SwitchCamera.forEach(d=>d.play()),this.actionsOut.SceneTransition.forEach(d=>d.dispatch()),this.actionsOut.SetVariable.forEach(d=>d.checkConditions()),this.actionsOut.SetVariable.forEach(d=>d.dispatch()),this.actionsOut.DynamicVariablePlay.forEach(d=>d.dispatch()),this.actionsOut.ClearLocalStorage.forEach(d=>d.dispatch()),this.actionsOut.UserAPI.forEach(d=>d.dispatch()))},this.onComplete=({target:h,state:c})=>
8405{this.toState===c&&(this.actionsIn.Audio.forEach(d=>d.dispatchConditional()),this.actionsIn.Particles.forEach(d=>d.dispatchConditional()),this.actionsIn.Video.forEach(d=>d.dispatchConditional()),this.actionsIn.Link.forEach(d=>d.dispatch()),this.actionsIn.Create.forEach(d=>d.dispatch()),this.actionsIn.Destroy.forEach(d=>d.dispatch()),this.actionsIn.Reset.forEach(d=>d.dispatch()),this.actionsOut.Transition.forEach(d=>d.pause()),this.actionsOut.Transition.forEach(d=>d.pause()),this.object.currentTransitionEvent=this,this.actionsIn.Transition.forEach(d=>d.play()),this.actionsIn.Animation.forEach(d=>d.play()),this.actionsOut.SwitchCamera.forEach(d=>d.pause()),this.actionsIn.SwitchCamera.forEach(d=>d.play()),this.actionsIn.SceneTransition.forEach(d=>d.dispatch()),this.actionsIn.SetVariable.forEach(d=>d.checkConditions()),this.actionsIn.SetVariable.forEach(d=>d.dispatch()),this.actionsIn.DynamicVariablePlay.forEach(d=>d.dispatch()),this.actionsOut.ClearLocalStorage.forEach(d=>d.dispatch()),this.actionsOut.UserAPI.forEach(d=>d.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&&!((l=this.toObject.states)!=null&&l[n.state]))throw new Error("Missing property");this.toState=n.state}connect(){Eo(this.actionsOut).forEach(e=>{var t;(t=this.actionsOut[e])!=null&&t.length&&this.toObject.addEventListener("beginState",this.onBegin)}),Eo(this.actionsIn).forEach(e=>{var t;(t=this.actionsIn[e])!=null&&t.length&&this.toObject.addEventListener("completeState",this.onComplete)})}disconnect(){super.disconnect(),Eo(this.actionsOut).forEach(e=>{var t;(t=this.actionsIn[e])!=null&&t.length&&this.toObject.removeEventListener("beginState",this.onBegin)}),Eo(this.actionsIn).forEach(e=>{var t;(t=this.actionsIn[e])!=null&&t.length&&this.toObject.removeEventListener("completeState",this.onComplete)})}},yK=class extends br{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=>{var r;if((r=i.data)!=null&&r.events.length){for(let{id:s,data:a}of i.data.events)if(!a.disabled&&a.type==="Conditional")try{let n;a.condition.type==="Comparison"||(a.condition.type==="Distance"?n=new gK(s,a,i,e,t,this.eventManager):a.condition.type==="State"&&(n=new vK(s,a,i,e,t,this.eventManager))),n&&(this.eventsPerConditions[a.condition.type].push(n),(n.actionsIn.Video.length||n.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()))}},pc=new M,An=new M,co=new M,XA=new Fr,xK=.01,zt=new M,Li=new M,YA=new M,Ro=new ot,Jg=new zi,bK=new be,$g=new Mi,Il=new M,ea=new M,Ol=.2;function ev(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 wK=function(){let e=new be;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"&&ev(s.position,t.limits),s.position.applyMatrix4(e),t.reference==="parent"?ev(s.position,t.limits):t.reference==="local"&&(Ro.copy(t.quat0).invert(),s.position.sub(t.position0),s.position.applyQuaternion(Ro),ev(s.position,t.limits),Ro.invert(),s.position.applyQuaternion(Ro),s.position.add(t.position0)),e.multiply(r??s.matrixWorld).decompose(zt,s.quaternion,Li),s.updateMatrix(),s.hasNonUniformScale&&(s.updateMatrixWorld(),s.updateMatrixWorldSVD()),s instanceof Or&&$a(s.parent)&&s.invalidateDownstreamBooleanData(!0)}}(),SK=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=Pi(i,i.dragDropActions.drag,r,s,a,this.object),this.actionsDrop=Pi(i,i.dragDropActions.drop,r,s,a,this.object);let o=[];
vendor: 7,148 bytes, line 8405
8405this.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 d=r.find(c);!d||d.data.visible!==!1&&o.push(d)}))}),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 d=r.find(c);!d||d.data.visible!==!1&&this.dropDestIds.push(d.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 ot().copy(l.quaternion),snapped:!1,orientationMatrix:new be,limits:this.data.limits,reference:this.data.referenceFrame}))}get activeDragItem(){return this.activeIdx!==null?this.dragItems[this.activeIdx]:null}dispose(){Ji(this.actionsDrag),Ji(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()})}},_K=class extends br{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.lastDropDestination=null,this.dragTimeout=null,this.onPointerDown=i=>{var n;if(st.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 o of this.events){let l=0;for(let{obj:h,pointEnd:c,pointStart:d}of o.dragItems){if(h===a[0].object||h===a[0].object.object||Ct.is(h)&&h.isAncestorOf(a[0].object.uuid)){if(o.activeIdx=l,o.activeDragItem.reset=!1,o.activeDragItem.currentDampingFactor=o.data.dampingFactor,o.activeDragItem.snapped=!1,o.data.cursor==="hand"&&this.setCursor("grabbing"),this.eventManager.controlsManager.usePhysics){o.activeDragItem.obj.rigidBody&&o.activeDragItem.obj.rigidBody.setBodyType(2,!0);let u=o.activeDragItem.obj;h.hasNonUniformScale&&h.updateMatrixWorldSVD(),(u.hasNonUniformScale?u.matrixWorldRigid:u.matrixWorld).decompose(zt,Ro,Li),Jg.setFromQuaternion(Ro),u.prevR===void 0?(u.prevR=Jg.clone(),u.prevT=zt.clone()):(u.prevR.copy(Jg),u.prevT.copy(zt)),this.eventManager.controlsManager.sharedGameControlGlobals.entitiesWithTransformAnim.push(o.activeDragItem.obj)}this.calcPlaneIntersectPos(h,d,o.data.plane,o.data.referenceFrame),c.copy(d),(this.eventManager.controlsManager.usePhysics&&((n=h.data.physics)==null?void 0:n.rigidBody)==="dynamic"||o.data.drop===!1||o.data.resetOnSnapFail===!1)&&o.activeDragItem.fromPosition.setFromMatrixPosition(o.activeDragItem.obj.matrixWorld),this.activeEvent=o,this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1);return}l++}}this.activeEvent=null},this.onPointerMove=i=>{var n,o,l,h;if(st.length>1)return;this.eventContext.updateRaycaster(i);let{raycaster:r,page:s}=this.eventContext,a=s.raycastWithClones(r);if(st.length===0){let c=!1;for(let d of this.events){for(let{obj:u}of d.dragItems)if(u===((n=a[0])==null?void 0:n.object)||u===((l=(o=a[0])==null?void 0:o.object)==null?void 0:l.object)||Ct.is(u)&&u.isAncestorOf((h=a[0])==null?void 0:h.object.uuid)){switch(c=!0,d.data.cursor){case"hand":this.setCursor("grab");break;case"move":this.setCursor("move");break}break}if(c)break}c||this.setCursor("default");return}if(this.activeEvent&&this.activeEvent.activeDragItem){let c=this.activeEvent.activeDragItem;c.snapped=!1;let d;if(this.activeEvent.data.drop&&(d=a.filter(u=>c.obj!==u.object&&!c.obj.isAncestorOf(u.object.uuid)&&!(u.object instanceof oh)&&(this.activeEvent.data.dropOn==="all"||this.activeEvent.dropDestIds.some(p=>p===u.object.uuid||s.scene.find(p).isAncestorOf(u.object.uuid))))[0]),d){let u=YA.copy(d.face.normal).applyMatrix3($g.getNormalMatrix(d.object.matrixWorld));if(this.activeEvent.data.snapTo==="center")c.fromPosition.setFromMatrixPosition(d.object.matrixWorld);else if(this.activeEvent.data.snapTo==="surface"){if(c.fromPosition.copy(d.point),this.activeEvent.data.snapSurfaceMode==="bbox"){zt.copy(u).applyMatrix3($g.setFromMatrix4(c.obj.matrixWorld).transpose());let p=c.obj;zt.x>Ol?Li.x=-p.recursiveBBox.min.x:zt.x<-Ol&&(Li.x=-p.recursiveBBox.max.x),zt.y>Ol?Li.y=-p.recursiveBBox.min.y:zt.y<-Ol&&(Li.y=-p.recursiveBBox.max.y),zt.z>Ol?Li.z=-p.recursiveBBox.min.z:zt.z<-Ol&&(Li.z=-p.recursiveBBox.max.z),Li.applyMatrix3($g.invert())}else Li.copy(u).multiplyScalar(this.activeEvent.data.snapSurfaceOffset);c.fromPosition.add(Li)}this.activeEvent.data.autoOrient&&(zt.set(0,1,0).cross(u),zt.length()<1e-4&&zt.set(-1,0,0).cross(u),Li.crossVectors(YA,zt),c.orientationMatrix.makeBasis(zt,Li,u)),c.pointStart.copy(c.fromPosition),c.pointEnd.copy(c.pointStart),c.currentDampingFactor=this.activeEvent.snapDampingFactor,c.snapped=!0,this.lastDropDestination!==d.object&&(this.lastDropDestination=d.object,this.activeEvent.actionsDrop.Transition.forEach(p=>{p.play()}),this.activeEvent.actionsDrop.Animation.forEach(p=>{p.play()}),this.activeEvent.actionsDrop.Audio.forEach(p=>{p.dispatchGameControl("start")}),this.activeEvent.actionsDrop.Particles.forEach(p=>{p.dispatchGameControl("start")}),this.activeEvent.actionsDrop.Create.forEach(p=>{p.dispatchThrottled()}))}else c.orientationMatrix.makeRotationFromQuaternion(c.quat0),this.lastDropDestination=null,c.currentDampingFactor=this.activeEvent.data.dampingFactor,this.calcPlaneIntersectPos(c.obj,c.pointEnd,this.activeEvent.data.plane,this.activeEvent.data.referenceFrame),this.activeEvent.actionsDrop.Transition.forEach(u=>{u.stop(),u.object.currentState!==null&&u.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrop.Animation.forEach(u=>{u.stop()}),this.activeEvent.actionsDrop.Audio.forEach(u=>{u.dispatchGameControl("stop")}),this.activeEvent.actionsDrop.Particles.forEach(u=>{u.dispatchGameControl("stop")});this.activeEvent.actionsDrag.Create.forEach(u=>{u.dispatchThrottled()}),this.activeEvent.actionsDrag.SetVariable.forEach(u=>u.checkConditions()),this.activeEvent.actionsDrag.SetVariable.forEach(u=>u.dispatch()),this.activeEvent.actionsDrag.DynamicVariablePlay.forEach(u=>u.dispatch()),this.activeEvent.actionsDrag.ClearLocalStorage.forEach(u=>u.dispatch()),this.activeEvent.actionsDrag.UserAPI.forEach(u=>u.dispatch()),this.activeEvent.wasDragEventTriggered===!1&&(this.activeEvent.wasDragEventTriggered=!0,this.activeEvent.actionsDrag.Transition.forEach(u=>{u.play()}),this.activeEvent.actionsDrag.Animation.forEach(u=>{u.play()}),this.activeEvent.actionsDrag.Audio.forEach(u=>{u.dispatchGameControl("start")}),this.activeEvent.actionsDrag.Particles.forEach(u=>{u.dispatchGameControl("start")})),this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>{!this.activeEvent||(this.activeEvent.wasDragEventTriggered=!1,this.activeEvent.actionsDrag.Audio.forEac
8405h(u=>{u.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Particles.forEach(u=>{u.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Transition.forEach(u=>{u.stop(),u.object.currentState!==null&&u.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrag.Animation.forEach(u=>{u.stop()}))},500),this.updateDragItem(c),c.obj.dispatchEvent({type:"requestRender"})}},this.onPointerUp=i=>{var r;if(this.activeEvent&&this.activeEvent.activeDragItem){this.activeEvent.data.cursor==="hand"&&this.setCursor("grab");let s=((r=this.activeEvent.activeDragItem.obj.data.physics)==null?void 0:r.rigidBody)==="dynamic";this.activeEvent.activeDragItem.snapped===!1&&this.activeEvent.data.drop&&this.activeEvent.data.resetOnSnapFail&&(this.eventManager.controlsManager.usePhysics===!1||!s)&&(this.activeEvent.activeDragItem.reset=this.activeEvent.data.resetOnSnapFail,this.activeEvent.activeDragItem.paused=!1,this.activeEvent.activeDragItem.currentDampingFactor=this.activeEvent.resetDampingFactor),this.eventManager.controlsManager.usePhysics&&s&&(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(a=>{a.stop(),a.object.currentState!==null&&a.object.changeSelectedState(null,{scene:this.eventContext.page.scene,shared:this.eventContext.sharedAssets})}),this.activeEvent.actionsDrag.Animation.forEach(a=>{a.stop()}
vendor: 14,677 bytes, line 8405
8405),this.activeEvent.actionsDrag.Audio.forEach(a=>{a.dispatchGameControl("stop")}),this.activeEvent.actionsDrag.Particles.forEach(a=>{a.dispatchGameControl("stop")}),this.activeEvent.actionsDrop.SetVariable.forEach(a=>a.checkConditions()),this.activeEvent.actionsDrop.SetVariable.forEach(a=>a.dispatch()),this.activeEvent.actionsDrop.DynamicVariablePlay.forEach(a=>a.dispatch()),this.activeEvent.actionsDrop.ClearLocalStorage.forEach(a=>a.dispatch()),this.activeEvent.actionsDrop.UserAPI.forEach(a=>a.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=>{var r;(r=i.data)==null||r.events.filter(s=>s.data.type==="DragDrop"&&!s.data.disabled).forEach(s=>{this.events.push(new SK(i,s.id,s.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(An),An.negate();let n=Ro.identity();switch(r==="parent"?bK.multiplyMatrices(e.parent.matrixWorld,e.hiddenMatrix).decompose(zt,n,Li):r==="local"&&e.matrixWorld.decompose(zt,n,Li),i){case"x":zt.set(1,0,0).applyQuaternion(n),Il.copy(An).cross(zt),ea.copy(zt).cross(Il);break;case"y":zt.set(0,1,0).applyQuaternion(n),Il.copy(An).cross(zt),ea.copy(zt).cross(Il);break;case"z":zt.set(0,0,1).applyQuaternion(n),Il.copy(An).cross(zt),ea.copy(zt).cross(Il);break;case"xy":ea.set(0,0,1).applyQuaternion(n);break;case"yz":ea.set(1,0,0).applyQuaternion(n);break;case"xz":ea.set(0,1,0).applyQuaternion(n);break;case"adaptive":An.angleTo(Li.set(0,1,0))>Math.PI/6?(zt.crossVectors(Li.set(0,1,0),An),ea.crossVectors(zt,Li)):ea.set(0,1,0);break;default:ea.copy(An);break}co.setFromMatrixPosition(e.matrixWorld);let o=e.userData.lockedPlane?e.userData.worldPosition0:co;if(XA.setFromNormalAndCoplanarPoint(ea,o),!!a.ray.intersectPlane(XA,t)&&(i==="x"||i==="y"||i==="z")){let l=Li.subVectors(t,o).dot(zt);t.copy(o).addScaledVector(zt,l)}}updateDragItem(e,t=!1){var i,r;co.setFromMatrixPosition(e.obj.matrixWorld),e.reset==="current"?pc.subVectors(e.fromPosition,co).divideScalar(e.currentDampingFactor):e.reset==="original"?(pc.subVectors(e.obj.userData.worldPosition0,co).divideScalar(e.currentDampingFactor),e.fromPosition.copy(e.obj.userData.worldPosition0),e.pointStart.copy(e.fromPosition),e.pointEnd.copy(e.pointStart)):pc.subVectors(e.pointEnd,e.pointStart).add(e.fromPosition).sub(co).divideScalar(e.currentDampingFactor),e.paused=e.currentDampingFactor>1?pc.length()<xK:!0,(this.activeEvent&&this.activeEvent.data.dampingFactor===1||t)&&wK(e,pc.add(co),(i=this.activeEvent)!=null&&i.data.drop&&((r=this.activeEvent)!=null&&r.data.autoOrient)?e.orientationMatrix:null),e.obj.dispatchEvent({type:"beginEvent",eventName:"DragDrop"}),this.eventManager.requestRender()}},Rl=new M,tv=new M,La=new M,Ba=new M,QA=new Fr,AK=.01,MK={type:"requestRender"},EK=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}(),ZA=function(){let e=new be;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 Or&&$a(t.parent)&&t.invalidateDownstreamBooleanData(!0)}}(),CK=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={...jv.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=Pi(e,e.actions,r,s,a,i)}},TK=class extends br{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.pairOfEventListeners=[],this.onMouseMove=i=>{if(!(st.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=>{var a,n;let s=(a=r.data)==null?void 0:a.events.find(o=>o.data.type==="Follow"&&!o.data.disabled);s&&(!e.data.globalPhysics.usePhysics||((n=r.dataPatched.physics)==null?void 0:n.rigidBody)!=="dynamic")&&this.events.push(new CK(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(),Qr&&(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(),Qr&&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,Ji(i.actions)}onAnimationFrameDamping(){for(let e of this.events)e.paused||this.updateSingleEvent(e,!0)}updateSingleEvent(e,t=!1){var n;this.events.forEach(o=>{o.actions.Create.forEach(l=>{l.dispatchThrottled()})});let{plane:i,limitDistance:r,limitDistanceEnabled:s}=e.data;if(e.object.getWorldPosition(La),e.isReset)Ba.copy(e.worldPosition0);else if(e.target)e.target.getWorldPosition(Ba);else{let{getCamera:o,raycaster:l}=this.eventContext;if(i==="custom"?(o().getWorldDirection(tv),tv.negate(),Rl.copy(tv)):i==="xy"?Rl.set(0,0,1):i==="xz"?Rl.set(0,1,0):i==="yz"&&Rl.set(1,0,0),QA.setFromNormalAndCoplanarPoint(Rl,La),!l.ray.intersectPlane(QA,Ba))return}if(!e.isReset){if(Ba.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)Ba.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&&(Ba.x=La.x),e.data.enabledTranslation[1]===!1&&(Ba.y=La.y),e.data.enabledTranslation[2]===!1&&(Ba.z=La.z);let a=EK(La,Ba,e.wasOutside?0:e.data.maxDelta);if(e.currentDampingFactor>1){let o=Rl.subVectors(a,La).divideScalar(e.currentDampingFactor);La.add(o),t&&ZA(e.object,La),e.paused=o.length()<AK}else ZA(e.object,a),e.paused=!0;(n=e.object)==null||n.dispatchEvent({type:"beginEvent",eventName:"Follow"}),e.object.dispatchEvent(MK)}},fc=new M,ep=new M,mc=new be,Ll=new ot,Mn=new ot,gc=new M,vc=new M,uo=new M,za=new M,iv=new Fr,PK=1e-6,DK={type:"requestRender"},IK={type:"changeRotation"},KA=function(){let e=new be;return function(t,i){t.parent!==null?e.multiplyMatrices(t.parent.matrixWorld,t.hiddenMatrix):e.copy(t.hiddenMatrix),i.premultiply(uP(e).invert()),t.rotation.setFromRotationMatrix(i),t.updateMatrix(),t instanceof Or&&$a(t.parent)&&t.invalidateDownstreamBooleanData(!0)}}(),OK=class{constructor(e,t,i,r){this.id=t,this.object=i,this.paused=!1,this.currentDampingFactor=1,this.isReset=!1,this.worldQuaternion0=new ot,this.timeoutId=null,this.delayFinished=!0,this.wasOutside=!1,this.data={...Gv.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),this.resetDampingFactor=80/this.data.resetSpeed+1}},RK=class extends br{constructor(){super(...arguments),this.events=[],this.pairOfEventListeners=[],this.pairOfUserEventListeners=[],this.onMouseMove=e=>{if(!(st.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=Dd(t);r&&r==="LookAt"&&this.updateSingleEvent(e)}}connect(){let{page:e}=this.eventContext;if(e.traverseEntity(r=>{var a,n;let s=(a=r.data)==null?void 0:a.events.find(o=>o.data.type==="LookAt"&&!o.data.disabled);s&&(!e.data.globalPhysics.usePhysics||((n=r.dataPatched.physics)==null?void 0:n.rigidBody)!=="dynamic")&&this.events.push(new OK(s.data,s.id,r,e))}),!this.events.length)return;let{domElement:t,eventElement:i}=this.eventContext;this.domEventsNeeded.clear(),Qr&&(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(),Qr&&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){var u;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:d}=e;if(c.getWorldPosition(gc),!e.isReset)if(e.target)e.target.getWorldPosition(vc);else{if(s==="custom"?(l().getWorldDirection(ep),ep.negate(),iv.setFromNormalAndCoplanarPoint(ep,gc)):(s==="xy"?fc.set(0,0,1):s==="xz"?fc.set(0,1,0):s==="yz"&&fc.set(1,0,0),iv.setFromNormalAndCoplanarPoint(fc,gc)),!h.ray.intersectPlane(iv,vc))return;r>0&&(s==="custom"||s===void 0)&&vc.addScaledVector(ep,r)}if(e.isReset||(d?t==="target"?uo.copy(d.up).applyMatrix4(mc.extractRotation(d.matrixWorld)).normalize():n.some(p=>p===!1)?(i==="x"?(za.set(0,0,1),n[2]===!1&&za.set(0,1,0)):i==="y"?(za.set(1,0,0),n[0]===!1&&za.set(0,0,1)):(za.set(0,1,0),n[1]===!1&&za.set(1,0,0)),uo.copy(za).applyQuaternion(e.worldQuaternion0).normalize()):uo.set(0,1,0):s==="custom"?uo.set(0,1,0):uo.copy(fc)),e.isReset)Mn.copy(e.worldQuaternion0);else if(gc.distanceTo(vc)>a&&o&&d)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)Mn.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;LK(mc,vc,gc,uo,i,za),Mn.setFromRotationMatrix(mc),Ll.setFromUnitVectors(za.applyQuaternion(Mn),uo),n.some(p=>p===!1)&&t!=="target"&&Mn.premultiply(Ll).normalize()}e.currentDampingFactor>1?(c.updateWorldMatrix(!0,!1),Ll.setFromRotationMatrix(uP(c.matrixWorld)),Ll.slerp(Mn,1/e.currentDampingFactor),KA(c,mc.makeRotationFromQuaternion(Ll)),e.paused=8*(1-Ll.dot(Mn))<PK):(KA(c,mc.makeRotationFromQuaternion(Mn)),e.paused=!0),(u=e.object)==null||u.dispatchEvent({type:"beginEvent",eventName:"Lo
8405okAt"}),c.dispatchEvent(DK),c.dispatchEvent(IK)}},rs=new M,Ri=new M,gi=new M;function LK(e,t,i,r,s,a){let n=e.elements;gi.subVectors(t,i),gi.lengthSq()===0&&(gi.z=1),gi.normalize(),Ri.crossVectors(r,gi),Ri.lengthSq()===0&&(Math.abs(r.z)===1?gi.x+=1e-4:gi.z+=1e-4,gi.normalize(),Ri.crossVectors(r,gi)),Ri.normalize(),rs.crossVectors(gi,Ri),s==="x"?a.z===1?[Ri,rs,gi]=[gi,Ri,rs]:(Ri.negate(),[Ri,gi]=[gi,Ri]):s==="y"?a.x===1?[Ri,rs,gi]=[rs,gi,Ri]:(Ri.negate(),[rs,gi]=[gi,rs]):a.x===1&&(Ri.negate(),[Ri,rs]=[rs,Ri]),n[0]=Ri.x,n[4]=rs.x,n[8]=gi.x,n[1]=Ri.y,n[5]=rs.y,n[9]=gi.y,n[2]=Ri.z,n[6]=rs.z,n[10]=gi.z}var BK=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.entered=!1,this.actions=Pi(t,t.actions,r,s,a,i)}disconnect(){Ji(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.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.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.SwitchCamera.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.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())}},zK=class extends br{constructor(e,t){super(e),this.eventManager=t,this.eventsPerObjects={},this.objects=[],this.objects2D=[],this._prevObjects=[],this.onMouseDown=i=>{st.length>1||(this.eventContext.updateRaycaster(i),this.handleMouseHoverEvent())},this.onMouseUp=i=>{st.length>1||this.handleMouseHoverEvent(!0)},this.onMouseMove=i=>{st.length>1||(this.eventContext.updateRaycaster(i),this.handleMouseHoverEvent())},this.onUserEvent=({eventName:i,target:r,reverse:s})=>{var n;if(!i||!r)return;let a=Dd(i);a&&a==="MouseHover"&&(r.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),(n=this.eventsPerObjects[r.uuid])==null||n.forEach(o=>o.dispatchUserEvent(s)))}}connect(){let{page:e,sharedAssets:t}=this.eventContext,i=(s,a)=>{var n,o;if(!(!s.visible||!((n=s.data)!=null&&n.events.length))){for(let{id:l,data:h}of s.data.events)if(!h.disabled&&h.type==="MouseHover")try{let c=new BK(l,h,s,e,t,this.eventManager);this.eventsPerObjects[s.uuid]?this.eventsPerObjects[s.uuid].push(c):this.eventsPerObjects[s.uuid]=[c]}catch{}(o=this.eventsPerObjects[s.uuid])!=null&&o.length&&this.objects.push(s instanceof $i?a:s)}};if(e.traverseEntity(s=>{var a;(s instanceof gr||s instanceof Xi)&&((a=s.frame)==null||a.traverse(n=>{i(n,s)})),i(s)}),!this.objects.length)return;let{domElement:r}=this.eventContext;this.domEventsNeeded.clear(),Qr&&(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,747 bytes, line 8405
8405h(s=>{s.addEventListener("userEvent",this.onUserEvent)})}disconnect(){if(!this.objects.length)return;let{domElement:e}=this.eventContext;this.domEventsNeeded.clear(),Qr&&(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=Wa(s,[a.x,a.y],Object.keys(this.eventsPerObjects),o=>{t.push(o)})),i&&!n){let o=wp(r,s,this.objects);t=uy(o),o.forEach(l=>{var h,c;l.object instanceof gr&&Wa(l.object,[((h=l==null?void 0:l.uv)==null?void 0:h.x)??0,((c=l==null?void 0:l.uv)==null?void 0:c.y)??0],Object.keys(this.eventsPerObjects),d=>{t.push(d)})})}else this.objects.forEach(o=>{var h,c;let l=Ef(r,o);l&&(t.push(o),o instanceof gr&&Wa(o,[((h=l==null?void 0:l.uv)==null?void 0:h.x)??0,((c=l==null?void 0:l.uv)==null?void 0:c.y)??0],Object.keys(this.eventsPerObjects),d=>{t.push(d)}))})}this._prevObjects.length&&this._prevObjects.forEach(i=>{var r;t.includes(i)||(i.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),(r=this.eventsPerObjects[i.uuid])==null||r.forEach(s=>s.dispatchLeave()))}),t.length&&t.forEach(i=>{var r;i.dispatchEvent({type:"beginEvent",eventName:"MouseHover"}),(r=this.eventsPerObjects[i.uuid])==null||r.forEach(s=>s.dispatchEnter())}),this._prevObjects=t}},FK=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.scrollCounter=0,this.actions=Pi(t,t.actions,r,s,a,i)}connect(){this.scrollCounter=0}disconnect(){Ji(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.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.Transition.forEach(t=>{t.playFromCurrent()}),this.actions.Animation.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())}},kK=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=Pi(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==null?void 0: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),d=parseFloat(c.marginTop)+parseFloat(c.marginBottom),u=parseFloat(c.top),p=parseFloat(c.bottom),f=h.height-d;if(!isNaN(u))i.top===u?(r.top+=h.top-u,r.bottom+=h.top-u):i.top<0&&(r.top-=f-i.height,r.bottom-=f-i.height);else if(!isNaN(p)){let g=document.body.clientHeight??window.innerHeight,m=window.innerWidth-(document.documentElement.clientWidth??window.innerWidth);i.bottom===g-p?(r.top+=h.top-i.height+p+m,r.bottom+=h.top-i.height+p+m):i.bottom<g-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,d=this.data.enterAnchor,u=d==="top"?h:d==="bottom"?h-c:h-c*.5;this.scrollStart=l-u}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(){Ji(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.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)}
8405dispatchUserEvent(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.Transition.forEach(t=>{t.playFromCurrent()}),this.actions.Animation.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())}},UK=class extends br{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})=>{var n;if(!i||!r)return;let a=Dd(i);a&&a==="Scroll"&&(r.dispatchEvent({type:"beginEvent",eventName:"Scroll"}),(n=this.wheelEventsPerObject.get(r))==null||n.forEach(o=>{o.dispatchUserEvent(s)}))}}connect(){let{page:e,sharedAssets:t,domElement:i,isExport:r}=this.eventContext,s=a=>{var n,o,l;if((n=a.data)!=null&&n.events.length){for(let{id:h,data:c}of a.data.events)if(!c.disabled&&c.type==="Scroll")if(c.trigger==="load"||!r){let d=new FK(h,c,a,e,t,this.managers);this.wheelEventsPerObject.has(a)?(o=this.wheelEventsPerObject.get(a))==null||o.push(d):this.wheelEventsPerObject.set(a,[d])}else{let d=new kK(h,c,a,e,t,i,this.managers);this.scrollEventsPerObject.has(a)?(l=this.scrollEventsPerObject.get(a))==null||l.push(d):this.scrollEventsPerObject.set(a,[d])}}};e.traverseEntity(a=>{var n;(a instanceof gr||a instanceof Xi)&&((n=a.frame)==null||n.traverse(o=>{s(o)})),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)})}},NK=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.actions=Pi(t,t.actions,r,s,a,i)}disconnect(){Ji(this.actions)}dispatch(){this.actions.Transition.forEach(e=>{e.play()}),this.actions.Animation.forEach(e=>{e.play()}),this.actions.SwitchCamera.forEach(e=>{e.play()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>
8405e.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 Oo?t.interaction.audioPlayer.play():t.interaction instanceof ny&&t.interaction.dispatch())}),this.actions.Video.forEach(t=>{let i=t.interaction.data.triggerAfter??"autoplay";i===e&&(t.interaction instanceof hh?t.interaction.play(i==="autoplay"):t.interaction instanceof cy&&t.interaction.dispatch())}),this.actions.Particles.forEach(t=>{(t.data.triggerAfter??"any")===e&&t.dispatchBasic()})}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.SwitchCamera.forEach(t=>t.reverseFromCurrent())):(this.actions.Transition.forEach(t=>t.playFromCurrent()),this.actions.Animation.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()}
8405),this.actions.Audio.forEach(t=>{t.interaction instanceof Oo?t.interaction.audioPlayer.play():t.interaction instanceof ny&&t.interaction.dispatch()}),this.actions.Video.forEach(t=>{t.interaction instanceof hh?t.interaction.play():t.interaction instanceof cy&&t.interaction.dispatch()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()})}},VK=class extends br{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=>
8405{s.actions.Audio.forEach(a=>{a.interaction instanceof Oo&&a.interaction.audioPlayer.play()}),s.actions.Video.forEach(a=>{let n=a.interaction.data.triggerAfter??"autoplay";a.interaction instanceof hh&&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.onUserEvent=({eventName:i,target:r,reverse:s})=>{var n,o;if(!i||!r)return;let a=Dd(i);a&&a==="Start"&&(r instanceof $i||r.dispatchEvent({type:"beginEvent",eventName:"Start"}),(n=this.eventsPerObject.get(r))==null||n.forEach(l=>{l.dispatchUserEvent(s)}),(o=this.eventsAfterPerObject.get(r))==null||o.forEach(l=>{l.dispatchUserEvent(s)}))}}connect(){let{sharedAssets:e,page:t}=this.eventContext,i=r=>{var s,a,n,o,l;if((s=r.data)!=null&&s.events.length)for(let{id:h,data:c}of r.data.events){if(c.disabled||c.type!=="Start")continue;let d=new NK(h,c,r,t,e,this.eventManager);(d.actions.Transition.length||d.actions.Animation.length||d.actions.SwitchCamera.length||d.actions.Create.length||d.actions.Destroy.length||d.actions.SceneTransition.length||d.actions.Reset.length||d.actions.SetVariable.length||d.actions.DynamicVariablePlay.length||d.actions.ClearLocalStorage.length||d.actions.UserAPI.length)&&(this.eventsPerObject.has(r)?(a=this.eventsPerObject.get(r))==null||a.push(d):this.eventsPerObject.set(r,[d])),d.actions.Audio.length&&(this.eventsAfterPerObject.has(r)?(n=this.eventsAfterPerObject.get(r))==null||n.push(d):this.eventsAfterPerObject.set(r,[d])),d.actions.Video.length&&(this.hasVideoAction=!0,this.eventsAfterPerObject.has(r)?(o=this.eventsAfterPerObject.get(r))==null||o.push(d):this.eventsAfterPerObject.set(r,[d])),d.actions.Particles.length&&(this.eventsAfterPerObject.has(r)?(l=this.eventsAfterPerObject.get(r))==null||l.push(d):this.eventsAfterPerObject.set(r,[d]))}};if(t.traverseEntity(r=>{var s;(r instanceof gr||r instanceof Xi)&&((s=r.frame)==null||s.traverse(a=>{i(a)})),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()}},jK=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.initialDisabled=!1,this.actions=Pi(t,t.actions,r,s,a,i),this.target=t.target}disconnect(){Ji(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: 7,821 bytes, line 8405
8405{t.data.runMode==="Toggle"?t.toggle():t.play()}),this.actions.Animation.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()))}},GK=class extends br{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 u=0;u<this.propertiesToWatch.length;u++){let{objectId:p,property:f,prevValue:g}=this.propertiesToWatch[u],m=this.eventContext.scene.find(p),v=Wv.propertyPaths[f];if(v[0]==="width"||v[0]==="height"||v[0]==="depth")m=m.geometry.userData.parameters[v[0]];else for(let y=0;y<v.length;y++)m=m[v[y]];g===null?this.propertiesToWatch[u].prevValue=m instanceof M?m.clone():m:(m instanceof M?!m.equals(g):g!==m)&&(h.push({objId:p,property:f}),m instanceof M?this.propertiesToWatch[u].prevValue.copy(m):this.propertiesToWatch[u].prevValue=m)}for(let u=0;u<this.variablesToWatch.length;u++){let{id:p,prevValue:f}=this.variablesToWatch[u],g=n.getVariable(p);g!==f&&(l.push(p),this.variablesToWatch[u].prevValue=g)}for(let u=0;u<this.dynamicVars.length;u++){let{id:p,expectedTime:f,last:g,data:m,timerSeconds:v,startValue:y}=this.dynamicVars[u],x=1e3;if((m.dynamicVariableType==="timer"||m.dynamicVariableType==="stopwatch")&&m.format==="number3decimal"?x=1:m.dynamicVariableType==="counter"?x=m.updateInterval:m.dynamicVariableType==="random"&&(x=m.isStatic?1/0:m.updateInterval),f===-1){this.dynamicVars[u].last=a,this.dynamicVars[u].expectedTime=a+x;continue}if(!((n.getDynamicVariablePlayState(p)==="Stopped"||n.getDynamicVariablePlayState(p)==="Restarted")&&(this.dynamicVars[u].last=a,this.dynamicVars[u].expectedTime=a+x,m.dynamicVariableType==="counter"&&n.getVariable(p)!==y&&(n.updateVariable(p,y),this.eventManager.requestRender()),(m.dynamicVariableType==="timer"||m.dynamicVariableType==="stopwatch")&&this.dynamicVars[u].timerSeconds!==y&&(this.dynamicVars[u].timerSeconds=y,n.updateVariable(p,os.getFormattedTimerTime(y,m)),this.eventManager.requestRender()),n.getDynamicVariablePlayState(p)==="Restarted"&&n.setDynamicVariablePlayState(p,"Playing"),n.getDynamicVariablePlayState(p)==="Stopped"))){if(n.getDynamicVariablePlayState(p)==="Paused"){this.dynamicVars[u].deltaToExpectedTime===void 0&&(this.dynamicVars[u].deltaToExpectedTime=Math.max(this.dynamicVars[u].expectedTime-a,0)),this.dynamicVars[u].last=a-(x-this.dynamicVars[u].deltaToExpectedTime),this.dynamicVars[u].expectedTime=a+this.dynamicVars[u].deltaToExpectedTime;continue}else this.dynamicVars[u].deltaToExpectedTime=void 0;if(a>=f)if(this.dynamicVars[u].last=a,this.dynamicVars[u].expectedTime+=x,m.dynamicVariableType==="random"){let w=m.min+Math.random()*(m.max-m.min),S=m.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(m.dynamicVariableType==="counter"){let w=n.getVariable(p),S=n.getDynamicVariableToggleIsForward(p)??!0,b=n.getVariable(p)+m.increment*(S?1:-1);m.hasEnd&&(b=m.increment>0?Oe.clamp(b,y,m.endValue):Oe.clamp(b,m.endValue,y),b===y&&n.setDynamicVariableToggleIsForward(p,void 0),m.repeat?b===m.endValue&&(b=y):(b===y||b===m.endValue)&&n.setDynamicVariablePlayState(p,"Paused")),b!==w&&(l.push(p),n.updateVariable(p,b),this.eventManager.requestRender())}else if(m.dynamicVariableType==="time"){let w=n.getVariable(p),S=h_(o,m);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,A)=>b===S.textValue[A]))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=hr.isTextValue(m.endValue)?JA(m.endValue.textValue):m.endValue,S=n.getDynamicVariableToggleIsForward(p)??!0,b=v+(a-g)/1e3*(m.dynamicVariableType==="timer"?-1:1)*(S?1:-1);b=Math.max(b,0),m.hasEnd&&(b=m.dynamicVariableType==="stopwatch"?Oe.clamp(b,y,w):Oe.clamp(b,w,y),b===y&&n.setDynamicVariableToggleIsForward(p,void 0),m.repeat?Math.abs(b-w)<(m.format==="number3decimal"?1e-4:.1)&&(b=y):(Math.abs(b-y)<(m.format==="number3decimal"?1e-4:.1)||Math.abs(b-w)<(m.format==="number3decimal"?1e-4:.1))&&n.setDynamicVariablePlayState(p,"Paused")),b!==v&&(l.push(p),this.dynamicVars[u].timerSeconds=b,n.updateVariable(p,os.getFormattedTimerTime(b,m)),this.eventManager.requestRender())}}}let c=!1;n.mouseProperty!==this.prevMouseProperty&&(this.prevMouseProperty=n.mouseProperty,c=!0);let d=!1;n.raycastProperty!==this.prevRaycastProperty&&(this.prevRaycastProperty=n.raycastProperty,d=!0),this.events.forEach(u=>{(l.includes(u.data.variableId)||h.find(p=>p.objId===u.data.objectId&&p.property===u.data.property)||u.data.variableId==="mouseProperty"&&c||u.data.variableId==="raycastProperty"&&d)&&(u.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=>{var i;(i=t.data)==null||i.events.filter(r=>r.data.type==="VariableChange"&&!r.data.disabled).forEach(r=>{this.events.push(new HK(r.id,r.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(hr.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,h_(new Date,i)),i.dynamicVariableType==="counter"&&(r=hr.isTextValue(i.value)?JA(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())}},HK=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.actions=Pi(t,t.actions,r,s,a,i)}dispatch(){let e=this.actions;
8405e.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(){Ji(this.actions)}};function JA(e){return e.length===3?e[2]+e[1]*60+e[0]*3600:e[1]+e[0]*60}var WK="https://unpkg.com/@splinetool/[email protected]/build/",qK="https://unpkg.com/@splinetool/[email protected]/build/",XK=`
8406(async function() {
8407	const [wasmImport, wasmBinary] = await Promise.all([
8408		import('${WK}' + 'navmesh.js'),
8409		fetch('${qK}' + 'navmesh.wasm').then((res) => res.arrayBuffer()),
8410	]);
8411	const wasmModule = wasmImport.default;
8412	self.module = await wasmModule({ wasmBinary });
8413	postMessage('ready');
8414})();
8415`,YK=`
8416(async function() {
8417	const [wasmImport, wasmBinary] = await Promise.all([
8418		import(self.location.origin + '/_libraries/navmesh.js'),
8419		fetch(self.location.origin + '/_libraries/navmesh.wasm').then((res) => res.arrayBuffer()),
8420	]);
8421	const wasmModule = wasmImport.default;
8422	self.module = await wasmModule({ wasmBinary });
8423	postMessage('ready');
8424})();
8425`,QK=`
8426
8427onmessage = function(messageEvent) {
8428	const meshData = messageEvent.data;
8429	const positions = meshData[0];
8430	const offset = meshData[1];
8431	const indices = meshData[2];
8432	const indicesLength = meshData[3];
8433	const parameters = meshData[4];
8434
8435	const module = self.module;
8436	const rc = new module.rcConfig();
8437	rc.cs = parameters.cs;
8438	rc.ch = parameters.ch;
8439	rc.borderSize = parameters.borderSize ? parameters.borderSize : 0;
8440	rc.tileSize = parameters.tileSize ? parameters.tileSize : 0;
8441	rc.walkableSlopeAngle = parameters.walkableSlopeAngle;
8442	rc.walkableHeight = parameters.walkableHeight;
8443	rc.walkableClimb = parameters.walkableClimb;
8444	rc.walkableRadius = parameters.walkableRadius;
8445	rc.maxEdgeLen = parameters.maxEdgeLen;
8446	rc.maxSimplificationError = parameters.maxSimplificationError;
8447	rc.minRegionArea = parameters.minRegionArea;
8448	rc.mergeRegionArea = parameters.mergeRegionArea;
8449	rc.maxVertsPerPoly = parameters.maxVertsPerPoly;
8450	rc.detailSampleDist = parameters.detailSampleDist;
8451	rc.detailSampleMaxError = parameters.detailSampleMaxError;
8452
8453	if (!self.navMesh) {
8454		self.navMesh = new module.NavMesh();
8455	}
8456	self.navMesh.build(positions, offset, indices, indicesLength, rc);
8457
8458	const navmeshData = navMesh.getNavmeshData();
8459	const arrView = new Uint8Array(module.HEAPU8.buffer, navmeshData.dataPointer, navmeshData.size);
8460	const ret = new Uint8Array(navmeshData.size);
8461	ret.set(arrView);
8462	navMesh.freeNavmeshData(navmeshData);
8463
8464	postMessage(ret);
8465}
8466`,ZK=.001,KK={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},yP,At,ir;Fj.then(e=>{yP=e,At=new e.Vec3,ir=new e.Vec3});var JK=new M,$K=class{constructor(e=!1,t=!1){this.usePhysics=e,this.isExport=t,this.onPointerDown=i=>{if(st.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=JK.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=>{var u,p,f,g,m,v,y;let a;if(s instanceof cs)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 cr)a=s.object;else if(a=s,((u=a.dataPatched.cloner)==null?void 0:u.disabled)===!1&&((p=a.dataPatched.cloner)==null?void 0:p.hideBase)&&((f=a.dataPatched.physics)==null?void 0:f.fusedBody)!==!0)return!0;
vendor: 37,353 bytes, line 8466
8466if(r&&!a.userData.navmesh)return;let n=a.dataPatched;if(!n.visible&&((g=n.physics)==null?void 0:g.enabled)!==!0)return!0;s.updateMatrixWorldSVD();let o=Cf(n),l=a.userData.hasDestroy,h=a.userData.hasDrag,c=!1,d=!1;for(let x of n.events)x.data.disabled!==!0&&(x.data.type==="GameControl"?c=!0:x.data.type==="Follow"&&(d=!0));if(c||o||d||l||h)return!0;if(this.usePhysics&&((m=n.physics)==null?void 0:m.rigidBody)==="dynamic"){if(this.usePhysics&&((v=n.physics)!=null&&v.fusedBody))return!0}else if("geometry"in s&&s.geometry&&i.push(Ha(s.geometry,s.matrixWorld)),this.usePhysics&&((y=n.physics)==null?void 0:y.fusedBody))return s.traverseObject((x,w)=>{var A,_;if(w===0)return;let S;if(x instanceof cs)if(x.objectForSample){if(x.objectForSample.dataPatched.physics.fusedBody)return;S=x.object}else return x.object.dataPatched.physics.fusedBody===!0&&x.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(x instanceof cr)S=x.object;else if(S=x,(A=x.dataPatched.cloner)==null?void 0:A.hideBase)return!0;let b=S.dataPatched;if(!b.visible&&((_=b.physics)==null?void 0:_.enabled)!==!0)return!0;"geometry"in x&&x.geometry&&i.push(Ha(x.geometry,x.matrixWorld))}),!0},this.traverseNoPhysics=(i,r)=>s=>{let a;if(s instanceof cs)return;s instanceof cr?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(Cf(n)||l||h||a.dataPatched.events.some(c=>c.data.disabled!==!0&&c.data.type==="GameControl"))return!0;o&&i.push(Ha(o,s.matrixWorld))},this.navmeshWasm=yP,this.navMesh=new this.navmeshWasm.NavMesh,this._workerURL=URL.createObjectURL(new Blob([(t?XK:YK)+QK])),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=>{var c;let h=e.scene.find(l);h.traverseEntity(d=>{d.userData.navmesh=!0}),(c=h.cloner)==null||c.traverseObject(d=>{d.userData.navmesh=!0})});let r=[],s=(this.usePhysics?this.traverseWithPhysics:this.traverseNoPhysics)(r,t.zones==="custom");if(e.traverseChildren(s),t.objects.forEach(l=>{var c;let h=e.scene.find(l);h.traverseEntity(d=>{d.userData.navmesh=void 0}),(c=h.cloner)==null||c.traverseObject(d=>{d.userData.navmesh=void 0})}),r.length===0)return!1;let a=Io(r),{positions:n,triIndices:o}=Yf(a.getAttribute("position"),a.getIndex());return this._worker.postMessage([n,n.length/3,o,o.length,{...KK,...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 je;return n.setIndex(new et(s,1)),n.setAttribute("position",new et(a,3)),n}getClosestPoint(e){return At.x=e.x,At.y=e.y,At.z=e.z,this.navMesh.getClosestPoint(At)}getClosestPointToRef(e,t){At.x=e.x,At.y=e.y,At.z=e.z;let i=this.navMesh.getClosestPoint(At);t.set(i.x,i.y,i.z)}getRandomPointAround(e,t){return At.x=e.x,At.y=e.y,At.z=e.z,this.navMesh.getRandomPointAround(At,t)}getRandomPointAroundToRef(e,t,i){At.x=e.x,At.y=e.y,At.z=e.z;let r=this.navMesh.getRandomPointAround(At,t);i.set(r.x,r.y,r.z)}moveAlong(e,t){return At.x=e.x,At.y=e.y,At.z=e.z,ir.x=t.x,ir.y=t.y,ir.z=t.z,this.navMesh.moveAlong(At,ir)}moveAlongToRef(e,t,i){return At.x=e.x,At.y=e.y,At.z=e.z,ir.x=t.x,ir.y=t.y,ir.z=t.z,this.navMesh.moveAlong(At,ir)}computePath(e,t){let i=this.getClosestPoint(t);if(ir.x=i.x,ir.y=i.y,ir.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(At,ir),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 eJ(this,e,t)}setDefaultQueryExtent(e){At.x=e.x,At.y=e.y,At.z=e.z,this.navMesh.setDefaultQueryExtent(At)}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(){var e;this.navMesh.destroy(),this._worker.terminate(),URL.revokeObjectURL(this._workerURL),(e=this.eventContext)==null||e.renderer.domElement.removeEventListener("pointerdown",this.onPointerDown)}addCylinderObstacle(e,t,i){return At.x=e.x,At.y=e.y,At.z=e.z,this.navMesh.addCylinderObstacle(At,t,i)}addBoxObstacle(e,t,i){return At.x=e.x,At.y=e.y,At.z=e.z,ir.x=t.x,ir.y=t.y,ir.z=t.z,this.navMesh.addBoxObstacle(At,ir,i)}removeObstacle(e){this.navMesh.removeObstacle(e)}isSupported(){return this.navmeshWasm!==void 0}},eJ=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<=ZK)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],d=n*n+o*o;a.y>h&&a.y<c&&d<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 tJ(e){let t=!1;return e.scene.objects.forEach(i=>{i.data.type==="Page"&&!t&&i.data.publish.gameControlObject&&ad.traverseModuleInstances(e,i.id,(r,s,a)=>{for(let n of a)n.data.type==="GameControl"&&n.data.navmesh.enabled&&(t=!0)})}),t}var iJ={type:"change"},$A={type:"changeZoom"},rJ={type:"changePan"},po={type:"start"},fo={type:"end",changed:!0},sJ={type:"end",changed:!1},rv=new ot,eM=new j,aJ=2*Math.PI,nJ=1e-8,oJ=.01,sv=new M,tp=new j,av=new M,ip=new ot,tM=new be,lJ={type:"requestRender"},xP=class extends ur{constructor(e,t,i={isPlayMode:!1,isExport:!1}){super(),this.object=e,this.domElement=t,this.options=i,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,Jr.DOLLY_ROTATE,Jr.PAN],this.offset=new M,this.eye=new M,this.lastPosition=new M,this.lastQuaternion=new ot,this.current=new j,this.overShoot=new j,this.overRatio=new j,this.spherical=new Eb,this.sphericalDelta=new Eb,this.panOffset=new M,this.panLeftV=new M,this.panUpV=new M,this.panV=new M,this.rotateStart=new j,this.rotateEnd=new j,this.rotateDelta=new j,this.panStart=new j,this.panEnd=new j,this.panDelta=new j,this.dollyStart=new j,this.dollyEnd=new j,this.dollyDelta=new j,this.rotationRangeFactor=new j,this.panRangeFactor=new j,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.panSpeed=1,this.hoverRotatePanStrength=.1,this.hoverRotateDamping=this.dampingFactor,this.thetaIsFree=!1,this.phiIsFree=!1,this.needsUpdate=!0,this.onCameraChange=r=>{this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange),this.object=r.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(av,ip,sv),this.offset.copy(av).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(rv.copy(ip).invert()),this.panOffset.applyQuaternion(rv),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(ip),this.panOffset.applyQuaternion(ip)),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),av.copy(this.target).add(this.offset),this.object.position.copy(this.target).add(this.offset),this.object.parent&&(tM.copy(this.object.parent.matrixWorld).invert(),this.object.position.applyMatrix4(tM));let r=this.spherical.phi%aJ;if(this.eye.copy(this.offset).normalize(),this.object.up.copy(Ut.DEFAULT_UP).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),r>0&&r>Math.PI||r<0&&r>-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 s=this.hoverRotatePanMode===1?this.hoverRotateDamping:this.dampingFactor;this.sphericalDelta.theta*=1-s,this.sphericalDelta.phi*=1-s}else this.sphericalDelta.set(0,0,0);return this.scale=1,this.zoomChanged||this.lastPosition.distanceToSquared(this.object.position)>oJ||8*(1-this.lastQuaternion.dot(this.object.quaternion))>nJ?(this.dispatchEvent(iJ),this.object.dispatchEvent(lJ),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),this.zoomChanged=!1,!0):(this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.object.wasMovedBySwitchCameraAction=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),!1)},this.onPointerDown=r=>{this.enabled!==!1&&(r.pointerType==="touch"||r.pointerType==="pen"&&Qr?this.onPointerDownTouch(r):this.onPointerDownMouse(r),this.state!==-1&&(this.isPointerDown=!0,this.dispatchEvent(po),this.domElement.addEventListener("pointermove",this.onPointerMove),this.domElement.addEventListener("pointerup",this.onPointerUp),r.stopPropagation(),r.pointerType==="touch"||r.pointerType==="pen"&&Qr||this.domElement.setPointerCapture(r.pointerId)))},this.onPointerLeave=r=>{this.resetHoverEffectOnPointerLeave&&!this.useWindowEvents?(this.hoverRotatePanMode===1?(this.sphericalDelta.theta=-this.spherical.theta,this.sphericalDelta.phi=-this.spherical.phi,sv.subVectors(this.position0,this.target0),this.spherical.setFromVector3(sv),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=r},this.onPointerEnter=r=>{this.resetHoverEffectOnPointerLeave||this.pointerLeaveEvent===void 0?tp.set(r.clientX-this.domElement.clientWidth/2,r.clientY-this.domElement.clientHeight/2):tp.set(r.clientX-this.pointerLeaveEvent.clientX,r.clientY-this.pointerLeaveEvent.clientY),this.hoverRotatePanMode===1?(this.rotateDelta.copy(tp).multiplyScalar(this.rotateSpeed*this.hoverRotatePanStrength).rotateAround(eM,-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(r.clientX,r.clientY)):this.hoverRotatePanMode===2&&(this.panDelta.copy(tp).multiplyScalar(this.panSpeed*this.hoverRotatePanStrength),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.set(r.clientX,r.clientY)),this.update()},this.onPointerMove=r=>{this.enabled!==!1&&(this.checkRaycastLock()||(r.pointerType==="touch"||r.pointerType==="pen"&&Qr?this.onPointerMoveTouch(r):this.onPointerMoveMouse(r),r.stopPropagation()))},this.onPointerUp=r=>{this.isPointerDown=!1,st.length===0&&(this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)),st.length>1&&r.preventDefault(),this.hasChange?this.dispatchEvent(fo):this.dispatchEvent(sJ),this.state=-1,r&&(r.stopPropagation(),r.pointerType==="touch"||r.pointerType==="pen"&&Qr||this.domElement.releasePointerCapture(r.pointerId))},this.onPointerDownMouse=r=>{let s;switch(this.useKeyEvents?s=this.mouseButtons[r.button]:s=this.mouseButtonsPlay[r.button],s){case 0:if(r.altKey===!0&&!r.shiftKey&&!uu(r)){if(this.enableRotate===!1)return;this.handleMouseDownRotate(r),this.state=0}else if(this.key===" "){if(this.enablePan===!1)return;this.handleMouseDownPan(r),this.state=2}break;case 4:if(this.enablePan===!1)return;this.handleMouseDownPan(r),this.state=2;break;case 3:if(uu(r)||r.shiftKey){if(this.enablePan===!1)return;this.handleMouseDownPan(r),this.state=2}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(r),this.state=0}break;case 5:if(uu(r)||r.shiftKey){if(this.enableRotate===!1)return;this.handleMouseDownRotate(r),this.state=0}else{if(this.enablePan===!1)return;this.handleMouseDownPan(r),this.state=2}break;default:this.state=-1}},this.onPointerMoveMouse=r=>{switch(this.state){case 0:if(this.enableRotate===!1)return;this.handleMouseMoveRotate(r);break;case 1:if(this.enableZoom===!1)return;this.handleMouseMoveDolly(r);break;case 2:if(this.enablePan===!1)return;this.handleMouseMovePan(r);break}this.object.wasMovedByUser=!0},this.onPointerDownTouch=r=>{switch(st.length>1&&r.preventDefault(),this.touches[st.length-1]){case Jr.ROTATE:if(this.enableRotate===!1){this.state=-1;return}this.handleTouchStartRotate(),this.state=3;break;case Jr.PAN:if(this.enablePan===!1){this.state=-1;return}this.handleTouchStartPan(),this.state=4;break;case Jr.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchStartDollyPan(),this.state=5;break;case Jr.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}},this.onPointerMoveTouch=r=>{switch(st.length>1&&r.preventDefault(),this.state){case 3:if(this.enableRotate===!1)return;this.handleTouchMoveRotate(r),this.update();break;case 4:if(this.enablePan===!1)return;this.handleTouchMovePan(r),this.update();break;case 5:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchMoveDollyPan(r),this.update();break;case 6:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchMoveDollyRotate(r),this.update();break;default:this.state=-1}this.object.wasMovedByUser=!0},this.dispatchEndDebounced=ed(()=>this.dispatchEvent(fo),33),this.onMouseWheel=r=>{this.enabled===!1||this.enableZoom===!1&&this.enablePan===!1||this.checkRaycastLock()||(!this.options.isExport&&this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth&&r.preventDefault(),this.dispatchEvent(po),this.handleMouseWheel(r),this.dispatchEndDebounced(),this.object.wasMovedByUser=!0)},this.onGesture=r=>{if(r.preventDefault(),this.enabled!==!1&&!this.checkRaycastLock()&&!Sd)if(r.type==="gesturechange"){if(this.enableZoom===!1||this.isTouchZoom===!1)return;this.dispatchEvent(po),r.scale>this.prevScale?this.dollyIn(this.getZoomScale()):r.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=r.scale,this.update(),this.object.wasMovedByUser=!0}else this.dispatchEvent(fo)},this.onContextMenu=r=>{r.preventDefault()},this.onTouchEnd=r=>{r.preventDefault()},this.onKeyDown=r=>{this.enabled!==!1&&(this.key=r.key,r.key===" "&&this.dispatchEvent(po))},this.onKeyUp=r=>{this.enabled!==!1&&(this.key=void 0,this.state!==-1&&r.key==="Alt"&&this.onPointerUp(st[0]),r.key===" "&&this.dispatchEvent(fo))},this.onPointerHover=r=>{r.pointerType!=="mouse"||this.enabled===!1||this.state!==-1||this.hoverRotatePanMode===2&&this.isPanOverShoot||this.hoverRotatePanMode===1&&this.isRotateOverShoot||(this.isPointerDown=!0,this.hoverRotatePanMode===2?this.handleMouseMovePan(r,this.hoverRotatePanStrength):this.hoverRotatePanMode===1&&this.handleMouseMoveRotate(r,this.hoverRotatePanStrength))},this.onBeginState=()=>{this.enabled=!1,this.needsUpdate=!1},this.onCompleteState=r=>{r.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.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/e.zoomLimits.max,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(rv.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=ta(this.spherical.phi-e.rotationVerticalOffset.min),this.maxPhi=ta(this.spherical.phi+e.rotationVerticalOffset.max),this.minTheta=ta(ta(this.spherical.theta)-e.rotationHorizontalOffset.min),this.maxTheta=ta(ta(this.spherical.theta)+e.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,e.orbitTouches===1&&(this.touches[0]=Jr.ROTATE),e.panTouches===1&&(this.touches[0]=Jr.PAN),e.orbitTouches===2&&(this.touches[1]=Jr.DOLLY_ROTATE),e.panTouches===2&&(this.touches[1]=Jr.DOLLY_PAN),e.orbitTouches===3&&(this.touches[2]=Jr.ROTATE),e.panTouches===3&&(this.touches[2]=Jr.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(ta(this.spherical.theta),ta(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=ta(this.overShoot.x),this.overShoot.y=ta(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=iM(Math.abs(this.overRatio.x)),this.overRatio.y=iM(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}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(rJ)}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($A)}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($A)}zoomOut(e=this.getZoomScale()){this.dispatchEvent(po),this.dollyOut(e),this.dispatchEvent(fo)}zoomIn(e=this.getZoomScale()){this.dispatchEvent(po),this.dollyIn(e),this.dispatchEvent(fo)}setZoom(e){if(this.dispatchEvent(po),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(fo)}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(eM,-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(Ij===!1&&uu(e)===!1&&Rj(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},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(st.length===2){let e=.5*(st[0].pageX+st[1].pageX),t=.5*(st[0].pageY+st[1].pageY);this.rotateStart.set(e,t)}else this.rotateStart.set(st[0].pageX,st[0].pageY)}handleTouchStartPan(){if(st.length===2){let e=.5*(st[0].pageX+st[1].pageX),t=.5*(st[0].pageY+st[1].pageY);this.panStart.set(e,t)}else this.panStart.set(st[0].pageX,st[0].pageY)}handleTouchStartDolly(){let e=st[0].pageX-st[1].pageX,t=st[0].pageY-st[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(st.length===2){let i=Ym(e),r=.5*(e.pageX+i.x),s=.5*(e.pageY+i.y);this.rotateEnd.set(r,s)}else{if(e.pointerId!==st[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(st.length===2){let t=Ym(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this.panEnd.set(i,r)}else{if(e.pointerId!==st[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=Ym(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(){var e;if(this.object.data.raycastLock){if(this.options.isPlayMode)return!1;{let t=(e=this.options)==null?void 0:e.showCameraLock;return t&&t(),!0}}else return!1}};function ta(e){let t=Math.PI*2;for(;e<=-Math.PI;)e+=t;for(;e>Math.PI;)e-=t;return e}function iM(e){return 1-Math.pow(1-e,4)}var rM=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.page=r,this.currentIntersectedObjects=[],this.actions=Pi(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(){Ji(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.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)}
8466),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()))}},Dt;Uj.then(e=>Dt=e);var Si=new M,Cs=new ot,En=new M,nv=new zi(0,0,0,"YXZ"),sM=new zi(0,0,0,"XYZ"),Ts=new M,ov=new M,lv=new M(1,1,1),Bl=new ot,rp=new be,aM=new be,hJ={type:"updateMatrix"},nM=new ot,hv=new Hr,py={type:"beginEvent",eventName:"Collision"},cJ={type:"beginEvent",eventName:"Trigger"};function dJ(e){if(ad.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 Cf=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),uJ=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.processRigidBody=t=>{if(t.bodyType()!==Dt.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[i,r,s]=this.rigidBodyToMesh.get(t.handle);if(Si.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),Cs.copy(t.rotation()),i.matrixWorld.compose(Si,Cs,r),i.hasNonUniformScale&&i.matrixWorld.multiply(i.shearScale),i.dispatchEvent(hJ),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)=>{var n,o,l,h;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 c=this.sharedGameControlGlobals.createdObjects.length-1;c>=0;c--){let d=this.sharedGameControlGlobals.createdObjects[c];if(d.userData.hasCollisionDestroy&&(((n=d.rigidBody)==null?void 0:n.collider(0).handle)===t||((o=d.rigidBody)==null?void 0:o.collider(0).handle)===i)){this.sharedGameControlGlobals.createdObjects.splice(c,1),d.removeFromParent(),requestAnimationFrame(()=>{var u;return(u=this.sharedGameControlGlobals.rapierWorld)==null?void 0:u.removeRigidBody(d.rigidBody)});break}}if(((l=this.gameControl)==null?void 0:l.object)!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let c=this.sharedGameControlGlobals.colliderToEntity.get(i),d=this.sharedGameControlGlobals.entityToCollisionEvents[c.uuid];if(d===void 0)return;for(let u of d)u.data.target==="character"&&this.dispatchCollisionEvent(u,c,i)}else if(((h=this.gameControl)==null?void 0:h.object)!==void 0&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(i)){let c=this.sharedGameControlGlobals.colliderToEntity.get(t),d=this.sharedGameControlGlobals.entityToCollisionEvents[c.uuid];if(d===void 0)return;for(let u of d)u.data.target==="character"&&this.dispatchCollisionEvent(u,c,t)}else{let c=this.sharedGameControlGlobals.colliderToEntity.get(t),d=this.sharedGameControlGlobals.entityToCollisionEvents[c.uuid];if(d!==void 0)for(let f of d)f.data.target==="scene"&&this.dispatchCollisionEvent(f,c,t);let u=this.sharedGameControlGlobals.colliderToEntity.get(i),p=this.sharedGameControlGlobals.entityToCollisionEvents[u==null?void 0:u.uuid];if(p!==void 0)for(let f of p)f.data.target==="scene"&&this.dispatchCollisionEvent(f,u,i)}},this.isExport=e.isExport,this.sharedAssets=e.sharedAssets,this.renderer=e.renderer,this.requestRender=e.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=hP,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=>{var i,r;let t=e.dataPatched;for(let s of t.events){if(s.data.disabled===!0)continue;let a=(r=(i=s.data.actions)==null?void 0:i.find(n=>n.data.type==="Destroy"))==null?void 0:r.data;if(a)for(let n of a.objects){let o=this.page.scene.find(n);o&&(o.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=[];
8466if(this.page.traverseChildren(t=>{var h,c;let i,r=t instanceof kc,s=t instanceof Uc;if(t instanceof cs||r||s)return;t instanceof cr?i=t.object:i=t;let a=i.dataPatched;if(((h=a.physics)==null?void 0:h.enabled)==="visibility"?!a.visible:!((c=a.physics)!=null&&c.enabled))return!0;let n=t.geometry,o=i.userData.hasDestroy===!0,l=i.userData.hasDrag===!0;if(Cf(a)||o||l||i.dataPatched.events.some(d=>d.data.disabled!==!0&&(d.data.type==="GameControl"||d.data.type==="Follow")))return t.updateMatrixWorldSVD(),this.addBoundsTree(t),!0;n&&e.push(Ha(n,t.matrixWorld))}),e.length>0){let t=Io(e,!1);this.sharedGameControlGlobals.staticMeshBVH=new zc(t)}}addRigidBody(e,t,i){if(dP(e.matrixWorld))return;let r=[],s="geometry"in e?e.geometry:void 0,a=t.dataPatched;if((s==null?void 0:s.getAttribute("position"))!==void 0&&r.push(Ha(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=Dt.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=Dt.RigidBodyDesc.kinematicPositionBased(),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e)):n=Dt.RigidBodyDesc.fixed();let l=Io(r);(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).decompose(Si,Cs,En),e.position0=Si.clone().divideScalar(this.pixelsPerMeter),e.rotation0=Cs.clone(),Si.divideScalar(this.pixelsPerMeter),n.setTranslation(Si.x,Si.y,Si.z).setRotation(Cs),s?l==null||l.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):l==null||l.scale(En.x/this.pixelsPerMeter,En.y/this.pixelsPerMeter,En.z/this.pixelsPerMeter);let h=this.sharedGameControlGlobals.rapierWorld.createRigidBody(n);o&&this.rigidBodyToMesh.set(h.handle,[e,En.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(d){console.error(d)}}e.rigidBody=h}}addBoundsTree(e){var i,r;let t=[];if(((i=e.geometry)==null?void 0:i.getAttribute("position"))!==void 0&&((r=e.geometry)==null?void 0:r.getAttribute("position").count)>0&&t.push(Ha(e.geometry,e.shearScale)),e.traverseObject(this.gatherChildrenGeom(e,t)),e.children.forEach(s=>s.updateMatrixWorld(!0)),t.length>0){let s=Io(t,!1);e.bvhGeometry=s,s.getAttribute("position").count>0&&(e.bvhGeometry.boundsTree=new zc(s),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e))}}addCollider(e,t,i,r,s=!0){var o,l;if((i==null?void 0:i.getAttribute("position").count)===0||((o=i==null?void 0:i.getIndex())==null?void 0:o.count)===0)return;let a;i&&(t.colliderType==="trimesh"?a=Dt.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):a=Dt.ColliderDesc.convexMesh(i.getAttribute("position").array,s?i.getIndex().array:void 0)),a.setFrictionCombineRule(Dt.CoefficientCombineRule.Average).setRestitutionCombineRule(Dt.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),(l=this.sharedGameControlGlobals.entityToCollisionEvents[r.uuid])!=null&&l.some(h=>h.target==="scene")&&n.setActiveEvents(Dt.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(e,t){return(i,r)=>{var o;if(r===0)return;let s;if(i instanceof cs)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 cr)s=i.object;else if(s=i,(o=s.dataPatched.cloner)==null?void 0:o.hideBase)return!0;let a=s.dataPatched;
8466if(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==null?void 0:n.getAttribute("position"))!==void 0&&t.push(Ha(n,i.matrixWorld))}}activate(e){var u,p;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 f of l.data.events){if(f.data.disabled||f.data.type!=="GameControl")continue;let g=l;for(;this.usePhysics&&((u=g=g.parent)==null?void 0:u.parent)!==null;)(p=g.data.physics)==null||p.fusedBody;f.data.collisionEnabled&&(this.needsCollisionDetection=!0),h===null&&(h=f.data)}if(this.page.traverseEntity(f=>{for(let g of f.dataPatched.events)if(g.data.disabled===!1&&g.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 f=new cP(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=f,r=h.joystickPosLoc,s=h.joystickRotLoc,a=h.jumpTouchButtonLoc,n=h.rotByTouch,Qr&&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 f=this.gameControl.data;if(!this.navigationMeshWrapper){this.navigationMeshWrapper=new $K(this.usePhysics,this.isExport);let g;f.collider.type==="sphere"?g=f.collider.radius*2:g=f.collider.height,g=Math.floor(g/f.navmesh.ch-1),this.navigationMeshWrapper.init({...f.navmesh,walkableHeight:g},this.gameControl,this.eventContext)}}if(i===!1){let{enableRotate:f,enablePan:g,enableZoom:m,autoRotate:v,hoverRotatePanMode:y}=this.eventManager.publish.orbitControls;(f||g||m||v||y!==0)&&(this.orbitControls=new xP(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(),d=this.renderer.domElement.height/this.renderer.getPixelRatio();this.joystickToGameControls.forEach((f,g)=>{let m=document.body.appendChild(document.createElement("div")),[v,y,x]=this.eventManager.eventContext.publish.joystickSizeAndXYOffset[g],w=(c-5*v)/4+v,S={},b=f==="jmp",A=b?0:v;g<10?(g<5?S.top=A/2:S.bottom=A/2,S.left=A/2+g%5*w):g===10?(S.left=A/2,S.top=d/2):(S.right=A/2,S.top=d/2),S.top?S.top-=y[1]:S.bottom+=y[1],S.left?S.left+=y[0]:S.right-=y[0];for(let C in S)S[C]+="px";if(b){let C=m.appendChild(document.createElement("div"));Object.assign(C.style,S,{position:"absolute",width:v+"px",height:v+"px",backgroundColor:`rgba(255,255,255,${x==="show"?.4:0})`,zIndex:"9999",borderRadius:v+"px",border:x==="show"?"solid 2px rgba(0, 0, 0, .1)":"none",display:"flex",alignItems:"center",justifyContent:"center",touchAction:"none"});let T=v/16*16*.4;x==="show"&&(C.innerHTML=`
8467						<svg width="${T}" height="${v*.4}" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
8468							<path d="M2 10L8 4L14 10" stroke="black" stroke-opacity="40%" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
8469						</svg>
8470					`),C.addEventListener("pointerdown",()=>{this.gameControl.movementState.jump=1,this.requestRender()}),C.addEventListener("touchend",P=>P.preventDefault()),this.joysticks[g]=[void 0,m];return}let _={zone:m,mode:"static",position:S,size:v};x==="hide"&&(_.restOpacity=0);let E=SQ.create(_);E.on("move",(C,T)=>{let P=this.gameControl;f==="pos"?T.force<.2?P.moveForce=0:(P.movementState.movePosZ=Math.sin(-T.angle.radian),P.movementState.movePosX=Math.cos(-T.angle.radian),T.force>1.2?P.movementState.run=1:P.movementState.run=0,T.force<.3?P.moveForce=(T.force-.2)/.1:P.moveForce=1):f==="rot"&&(T.force<.2?P.rotForce=0:(P.movementState.rotPosX=T.vector.y,P.movementState.rotPosY=-T.vector.x,T.force<.3?P.rotForce=(T.force-.2)/.1:P.rotForce=1)),this.requestRender()}),E.on("end",(C,T)=>{let P=this.gameControl;f==="pos"?(P.movementState.movePosZ=0,P.movementState.movePosX=0,P.moveForce=1):f==="rot"&&(P.movementState.rotPosX=0,P.movementState.rotPosY=0,P.rotForce=1)}),this.joysticks[g]=[E,m]}),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>
vendor: 5,729 bytes, line 8470
8470{this.collisionEvents.forEach(f=>f.initialDisabled=!1)},80)}initPhysics(){var n;(n=this.sharedGameControlGlobals.rapierWorld)==null||n.free(),this.sharedGameControlGlobals.rapierWorld=new Dt.World(new Dt.Vector3(0,this.gravity,0)),this.events=new Dt.EventQueue(!0);let e=[],t=[];if(this.page.traverseChildren(o=>{var v,y,x,w;let l;if(o instanceof cs)if(o.objectForSample){if(o.objectForSample.dataPatched.physics.fusedBody)return;l=o.object}else return o.object.dataPatched.physics.fusedBody===!0&&o.object.dataPatched.physics.rigidBody==="dynamic"?!0:void 0;else if(o instanceof cr)l=o.object;else{if(o instanceof Uc||o instanceof kc)return;if(l=o,((v=l.dataPatched.cloner)==null?void 0:v.disabled)===!1&&((y=l.dataPatched.cloner)==null?void 0:y.hideBase)&&((x=l.dataPatched.physics)==null?void 0:x.fusedBody)!==!0)return!0}let h=l.dataPatched,c;for(let S of h.events)S.data.disabled!==!0&&S.data.type==="GameControl"&&(c=S.data);if(!h.physics||(h.physics.enabled==="visibility"?!h.visible:!h.physics.enabled))return!0;o.updateMatrixWorldSVD();let d=Cf(h),u=!1,p=l.userData.hasDestroy,f=l.userData.hasDrag,g=!1;for(let S of h.events)if(S.data.disabled!==!0){if(S.data.type==="Collision"){u=!0;let b=new jK(S.id,S.data,l,this.page,this.sharedAssets,this.eventManager);b.initialDisabled=!0,this.collisionEvents.push(b),this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid].every(A=>A.id!==S.id)?this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid].push(b):this.sharedGameControlGlobals.entityToCollisionEvents[l.uuid]=[b]}else if(S.data.type==="Follow"){g=!0;let b=S.data.target;o.traverseVisible(A=>{A.userData.isFollowingObj=b})}}h.physics.rigidBody==="dynamic"&&h.physics.fusedBody===!1&&(o.matrixWorldFusedFalse=o.matrixWorld.clone());let m=o.geometry;if(c!==void 0){let S=Dt.RigidBodyDesc.kinematicPositionBased();(o.hasNonUniformScale?o.matrixWorldRigid:o.matrixWorld).decompose(Si,Cs,En),o.position0=Si.clone().divideScalar(this.pixelsPerMeter),o.rotation0=Cs.clone(),Si.divideScalar(this.pixelsPerMeter),S.setTranslation(Si.x,Si.y,Si.z).setRotation(Cs);let b=this.sharedGameControlGlobals.rapierWorld.createRigidBody(S);o.rigidBody=b;let A;c.collider.type==="sphere"?A=Dt.ColliderDesc.ball(c.collider.radius/this.pixelsPerMeter):c.collider.type==="capsule"?A=Dt.ColliderDesc.capsule((c.collider.height/2-c.collider.radius)/this.pixelsPerMeter,c.collider.radius/this.pixelsPerMeter):A=Dt.ColliderDesc.cuboid(c.collider.width/this.pixelsPerMeter/2,c.collider.height/this.pixelsPerMeter/2,c.collider.depth/this.pixelsPerMeter/2),A.setFrictionCombineRule(Dt.CoefficientCombineRule.Average).setRestitutionCombineRule(Dt.CoefficientCombineRule.Average).setDensity(h.physics.density).setFriction(h.physics.friction).setRestitution(h.physics.restitution);let _=this.sharedGameControlGlobals.rapierWorld.createCollider(A,b);this.sharedGameControlGlobals.colliderToEntity.set(_.handle,l),Si.fromArray(c.collider.position).multiply(En.setFromMatrixScale(l.matrixWorld)).divideScalar(this.pixelsPerMeter),_.setTranslationWrtParent(Si);let E=new ot().setFromEuler(new zi().setFromVector3(new M().fromArray(c.collider.rotation)));_.setRotationWrtParent(E),_.setActiveEvents(Dt.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(l,!0)}else h.physics.rigidBody==="dynamic"||d||g||p||f||u?(this.addRigidBody(o,l,{hasFollow:g,hasTransformAnim:d,hasDrag:f}),this.generateSensorColliderDescs(l,h.physics.fusedBody)):(m&&e.push(Ha(m,o.matrixWorld)),h.physics.fusedBody&&o.traverseObject((S,b)=>{var C;if(b===0)return;let A;if(S instanceof cs)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 Uc||S instanceof kc)return;if(S instanceof cr)A=S.object;else if(A=S,(C=A.dataPatched.cloner)==null?void 0:C.hideBase)return!0}let _=A.dataPatched;if(_.physics.enabled==="visibility"?!_.visible:!_.physics.enabled)return!0;let E=S.geometry;(E==null?void 0:E.getAttribute("position"))!==void 0&&e.push(Ha(E,S.matrixWorld))}),this.generateSensorColliderDescs(l,h.physics.fusedBody,t));if(((w=h.physics)==null?void 0:w.fusedBody)===!0||c)return!0}),e.length===0)return;let i=Io(e);i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let r=Dt.RigidBodyDesc.fixed(),s=this.sharedGameControlGlobals.rapierWorld.createRigidBody(r),a=Dt.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(Dt.CoefficientCombineRule.Multiply).setRestitutionCombineRule(Dt.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(a,s);for(let[o,l]of t){let h=this.sharedGameControlGlobals.rapierWorld.createCollider(o,s);this.sensorToTriggerEvent[h.handle]=l}}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 rM(t.id,t.data,e,this.page,this.sharedAssets,this.eventManager),r=new be().compose(Ts.fromArray(t.data.position),Bl.setFromEuler(sM.fromArray(t.data.rotation)),lv);if(t.data.triggerZone==="box"){let s=new xi;s.min.fromArray(t.data.size).multiplyScalar(-.5),s.max.fromArray(t.data.size).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())}
8470disconnectEvents(){this.collisionEvents.forEach(e=>e.disconnect()),this.sharedGameControlGlobals.triggers.forEach(e=>e[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){var e,t,i,r;if(this.isEnabled){this.isEnabled=!1,this.page.traverse(s=>{let a=s;a.matrixWorldFusedFalse&&(a.matrixWorldFusedFalse=void 0),a.rigidBody&&(a.rigidBody=void 0),a.position0&&(a.position0=void 0),a.rotation0&&(a.rotation0=void 0)}),(e=this.sharedGameControlGlobals.rapierWorld)==null||e.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.disconnectEvents(),(t=this.gameControl)==null||t.reset(),(i=this.gameControl)==null||i.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([s,a])=>{s==null||s.destroy(),a.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),(r=this.navigationMeshWrapper)==null||r.dispose(),this.navigationMeshWrapper=void 0;for(let s of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))s.forEach(a=>a.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&&(r=!this.orbitControls.update()),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}}return r}stepPhysics(){var e;for(let t of this.sharedGameControlGlobals.entitiesWithTransformAnim){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(Si,Cs,En),nv.setFromQuaternion(Cs);let i=t;i.prevR===void 0?(i.prevR=nv.clone(),i.prevT=Si.clone()):(i.prevR.copy(nv),i.prevT.copy(Si)),t.rigidBody&&(t.rigidBody.setNextKinematicTranslation(Si.divideScalar(this.pixelsPerMeter)),t.rigidBody.setNextKinematicRotation(Cs))}return this.sharedGameControlGlobals.rapierWorld.step(this.events),(e=this.events)==null||e.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(e,t,i){var a;let r=((a=this.sharedGameControlGlobals.rapierWorld)==null?void 0:a.getCollider(i))._parent,s;if(t.cloner){for(let n of t.cloner.children)if(n.rigidBody===r){s=n;break}}e.dispatch(s),t.dispatchEvent(py)}updateUseWindowEvents(e){var t;(t=this.orbitControls)==null||t.updateUseWindowEvents(e)}generateSensorColliderDescs(e,t,i){let r=aM.copy(e.matrixWorld).invert();e.traverseEntity((s,a)=>
vendor: 11,398 bytes, lines 8470-8471
8470{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 rM(n.id,n.data,s,this.page,this.sharedAssets,this.eventManager),l;if(n.data.triggerZone==="box"?l=Dt.ColliderDesc.cuboid(...n.data.size.map(h=>h/(2*this.pixelsPerMeter))):l=Dt.ColliderDesc.ball(n.data.radius/this.pixelsPerMeter),l.setDensity(0).setSensor(!0).setActiveEvents(Dt.ActiveEvents.COLLISION_EVENTS),Ts.fromArray(n.data.position),Bl.setFromEuler(sM.fromArray(n.data.rotation)),rp.compose(Ts,Bl,lv).premultiply(s.matrixWorld),i?(rp.decompose(Ts,Bl,ov),l.setActiveCollisionTypes(Dt.ActiveCollisionTypes.KINEMATIC_FIXED|Dt.ActiveCollisionTypes.DYNAMIC_FIXED)):(rp.premultiply(r).decompose(Ts,Bl,ov),e.rigidBody.bodyType()===Dt.RigidBodyType.Dynamic||(e.rigidBody.bodyType()===Dt.RigidBodyType.Fixed?l.setActiveCollisionTypes(Dt.ActiveCollisionTypes.KINEMATIC_FIXED|Dt.ActiveCollisionTypes.DYNAMIC_FIXED):l.setActiveCollisionTypes(Dt.ActiveCollisionTypes.KINEMATIC_KINEMATIC|Dt.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),Ts.divideScalar(this.pixelsPerMeter),l.setTranslation(Ts.x,Ts.y,Ts.z),l.setRotation(Bl),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(Ct.is(o)?o:o.object)===!1)continue;let l=aM.copy(s.matrixWorld).decompose(Ts,nM,ov).compose(Ts,nM,lv).multiply(r),h=rp.copy(o.matrixWorld).invert().multiply(l);i instanceof xi?e=o.bvhGeometry.boundsTree.intersectsBox(i,h):(hv.radius=i,hv.center.setFromMatrixPosition(h),e=o.bvhGeometry.boundsTree.intersectsSphere(hv)),e?a.currentIntersectedObjects.indexOf(o)===-1&&(a.currentIntersectedObjects.push(o),a.dispatch(),s.dispatchEvent(cJ)):a.currentIntersectedObjects=a.currentIntersectedObjects.filter(c=>c!==o)}}}};function pJ(e){let t=this._clip.duration,i=this._clip.start??0,r=this.loop,s=this.time+e,a=this._loopCount,n=r===gy;if(e===0)return a===-1?s:n&&(a&1)===1?t-(s-i):s;if(r===SM){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 oM=!1,fJ=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=Av.parse(JSON.parse(a[2]));s.animations[n]=l;let h=this.mixer.clipAction(l,s);oM===!1&&(Object.getPrototypeOf(h)._updateTime=pJ,oM=!0),h.clampWhenFinished=!0,this.clipIdToAction[o]=h})},this.mixer=new ZB(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=_M}),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=gy)),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){var t;if(this.needsUpdate)this.needsUpdate=!1;else if(this.isPlaying===!1||(t=this.animationInspectorState)!=null&&t.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 tP(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)}},cv=new WeakMap,mJ=class extends yd{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 Mv(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(cv.has(e)){let o=cv.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)}),cv.set(e,{key:i,promise:n}),n}_createGeometry(e){let t=new je;e.index&&t.setIndex(new et(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 et(a,n))}return t}_loadLibrary(e,t){let i=new Mv(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=gJ.toString(),a=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
8471`);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 gJ(){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(d){c({draco:d})},DracoDecoderModule(e)});break;case"decode":let l=o.buffer,h=o.taskConfig;t.then(c=>{let d=c.draco,u=new d.Decoder,p=new d.DecoderBuffer;p.Init(new Int8Array(l),l.byteLength);try{let f=i(d,u,p,h),g=f.attributes.map(m=>m.array.buffer);f.index&&g.push(f.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:f},g)}catch(f){console.error(f),self.postMessage({type:"error",id:o.id,error:f.message})}finally{d.destroy(p),d.destroy(u)}});break}};function i(n,o,l,h){let c=h.attributeIDs,d=h.attributeTypes,u,p,f=o.GetEncodedGeometryType(l);if(f===n.TRIANGULAR_MESH)u=new n.Mesh,p=o.DecodeBufferToMesh(l,u);else if(f===n.POINT_CLOUD)u=new n.PointCloud,p=o.DecodeBufferToPointCloud(l,u);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!p.ok()||u.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+p.error_msg());let g={index:null,attributes:[]};for(let m in c){let v=self[d[m]],y,x;if(h.useUniqueIDs)x=c[m],y=o.GetAttributeByUniqueId(u,x);else{if(x=o.GetAttributeId(u,n[c[m]]),x===-1)continue;y=o.GetAttribute(u,x)}g.attributes.push(s(n,o,u,m,v,y))}return f===n.TRIANGULAR_MESH&&(g.index=r(n,o,u)),n.destroy(u),g}function r(n,o,l){let h=l.num_faces()*3,c=h*4,d=n._malloc(c);o.GetTrianglesUInt32Array(l,c,d);let u=new Uint32Array(n.HEAPF32.buffer,d,h).slice();return n._free(d),{array:u,itemSize:1}}function s(n,o,l,h,c,d){let u=d.num_components(),p=l.num_points()*u,f=p*c.BYTES_PER_ELEMENT,g=a(n,c),m=n._malloc(f);o.GetAttributeDataArrayForAllPoints(l,d,g,f,m);let v=new c(n.HEAPF32.buffer,m,p).slice();return n._free(m),{name:h,array:v,itemSize:u}}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 Gn;function vJ(){return Gn||(Gn=new mJ,Gn.setDecoderPath("https://www.gstatic.
8471com/draco/versioned/decoders/1.5.2/").preload()),Gn.decoderPending}async function yJ(e){if(Gn){let t={attributeIDs:Gn.defaultAttributeIDs,attributeTypes:Gn.defaultAttributeTypes,useUniqueIDs:!1},i;try{i=await Gn.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 xJ(e,t){let[i,r]=nE(Nv.deserialize(new Uint8Array(e)));return IE(i),r.result().data}function bJ(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 wJ(e){for(let t of e){let i=await yJ(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 SJ=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]}},_J=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=Pi(r,i.actions,a,n,o,s)}disconnect(){Ji(this.actions)}
8471dispatchIn(){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()})}},AJ=class extends br{constructor(e,t){super(e),this.eventManager=t,this.breakpoints=[],this.resize=(i,r)=>{this.breakpoints.forEach(s=>{let a=Hv.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=>{var a;if(!(!s.visible||!((a=s.data)!=null&&a.events.length)))for(let{data:n,id:o}of s.data.events)n.disabled||n.type==="Resize"&&n.breakpoints.forEach(({data:l,id:h})=>{try{let c=new _J(o,h,l,n,s,e,t,this.eventManager);this.breakpoints.push(c)}catch{}})};e.traverseEntity(s=>{var a;(s instanceof gr||s instanceof Xi)&&((a=s.frame)==null||a.traverse(n=>{r(n)})),r(s)})}disconnect(){this.onResizeObserver.disconnect(),this.breakpoints.forEach(e=>{e.disconnect()}),this.breakpoints=[]}},MJ=class extends br{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=>{var t;(t=e.data)==null||t.events.filter(i=>i.data.type==="API"&&!i.data.disabled).forEach(i=>{this.events.push(new EJ(i.id,i.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)})}},EJ=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.successActions=Pi(t,t.successActions,r,s,a,i),this.errorActions=Pi(t,t.errorActions,r,s,a,i)}dispatchSuccess(){this.dispatchActions(this.successActions)}dispatchError(){this.dispatchActions(this.errorActions)}
vendor: 1,604 bytes, line 8471
8471dispatchActions(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())}},CJ=class extends br{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=>{var t;(t=e.data)==null||t.events.filter(i=>i.data.type==="WEBHOOK"&&!i.data.disabled).forEach(i=>{this.events.push(new TJ(i.id,i.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()})}},TJ=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.actions=Pi(t,t.actions,r,s,a,i)}dispatch(){let e=this.actions;
8471e.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 PJ(){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 DJ=new M(0,0,1),lM=new M,hM=new M,cM=new Mi,IJ=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 nT,this.doubleClickHandler=new SJ,this.isDragging=!1,this.plane=new Fr,this.caretInterval=0,this.planeIntersection=new M,this.projected=new j,this._lastIndex=0,this._isFirstDragMove=!1,this.selectionOnDragStart=0,this.onTextMaterialChanged=()=>{var n;let a=(n=this.virtualInput)==null?void 0:n.data;if(this.virtualInput!==void 0&&a){let o=a.material,l=typeof o=="string"?this.sharedAssets.data.materials[o]:o,h=kX(l,this.sharedAssets);this.helper.setCaretColor(h)}},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==null?void 0:a.key)==="ArrowLeft"||(a==null?void 0:a.key)==="ArrowRight",l=(a==null?void 0:a.key)==="ArrowUp"||(a==null?void 0: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=PJ(),this.htmlInput}connect(){}disconnect(){var e;this.stopAnimateTextCursor(),this.helper.hide(),(e=this.htmlInput)==null||e.remove(),this.doubleClickHandler.stop()}handleMouseDown(){var a,n;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};(n=(a=this.virtualInput)==null?void 0:a.wrappedText)!=null&&n.length&&this.virtualInput.wrappedText[i][Math.max(0,r-1)]===`
8472`&&(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){var t;if(this.virtualInput=e,this.updateTextInputStyles(),this.htmlInput)if(e){let i=(t=this.data)==null?void 0:t.geometry.text;this.htmlInput.value=typeof i=="string"?"":(i==null?void 0:i.textValue.toString())??""}else this.htmlInput.value=""}blur(){}get data(){let{virtualInput:e}=this;if(e)return e.dataPatched}
8472applyRangeToTextInput(){var s;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&&((s=this.virtualInput)==null?void 0:s.wrappedText[i][r-1])===`
8473`&&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 B1)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(){var t;let e=(t=this.virtualInput)==null?void 0:t.data;if(!(!this.virtualInput||!e)&&this.raycaster.ray.intersectsPlane(this.plane)){this.planeIntersection===null&&(this.planeIntersection=new M);let i=this.raycaster.ray.intersectPlane(this.plane,this.planeIntersection);if(i){this.planeIntersection.copy(this.virtualInput.worldToLocal(i));let r=typeof e.geometry.width=="number"?e.geometry.width:1,s=typeof e.geometry.height=="number"?e.geometry.height:1;this.projected.set(i.x+r*.5,i.y-s*.5)}}}updatePlane(){var t;let e=(t=this.virtualInput)==null?void 0:t.data;this.virtualInput&&e&&(cM.getNormalMatrix(this.virtualInput.matrixWorld),lM.copy(DJ).applyMatrix3(cM).normalize(),this.virtualInput.localToWorld(hM.set(0,0,e.geometry.depth)),this.plane.setFromNormalAndCoplanarPoint(lM,hM))}setInputSelection(e,t=e){var i;(i=this.htmlInput)==null||i.setSelectionRange(e,t),setTimeout(()=>{var r;(r=this.htmlInput)==null||r.focus()})}updateTextInputStyles(){var t;let e=(t=this.virtualInput)==null?void 0:t.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=OJ(e.geometry.horizontalAlign))}};function OJ(e){return e===4?"justify":e===2?"right":e===3?"center":"left"}var bP=(e,t)=>{if(typeof e=="string"){let i=t.data(e);if(i)return bP(i.value,t)}return hr.getDisplayedValue(e)};function dM(e,t){let i=e.text,r="";if(typeof i=="string"){let s=t.variables.data(r);s&&(r=bP(s.value,t.variables))}else r=i.textValue.toString();return r}var RJ=class extends br{constructor(e,t){super(e),this.eventManager=t,this._textInputs=[],this.sceneHelpers=new Gr,this.helper=new nT,this._onMouseDownFocusIn=i=>{if(st.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==null||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).then(()=>{this.eventContext.requestRender()});let o=s.data;a.update();let l=o.geometry.text;if(typeof l=="string"){let h=l;
8473this.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 IJ(this.sceneHelpers,e.raycaster,e.sharedAssets,e.requestRender,this.onExit)}connect(){let e=[];if(this.eventContext.scene.traverseEntity(r=>{r instanceof B1&&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}=this.eventContext;t.removeEventListener("pointerdown",this._onMouseDownFocusIn),e==null||e.removeEventListener("keyup",this._onCaretUpdate),e==null||e.removeEventListener("keydown",this._onCaretUpdate),e==null||e.removeEventListener("beforeinput",this._onCaretUpdate),e==null||e.removeEventListener("paste",this._onCaretUpdate),e==null||e.removeEventListener("cut",this._onCaretUpdate),e==null||e.removeEventListener("select",this._onCaretUpdate),e==null||e.removeEventListener("selectstart",this._onCaretUpdate),this._textInputs.forEach(i=>{let r=dM(i.data.geometry,this.eventContext.sharedAssets.data);i.textGeometry.setText(r)}),t.removeEventListener("pointerdown",this._onMouseDown,!1),t.removeEventListener("pointerup",this._onMouseUp,!1),t.removeEventListener("pointermove",this._onMouseMove,!1),window.addEventListener("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=dM(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)}},LJ=class extends br{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=>{var t;(t=e.data)==null||t.events.filter(i=>i.data.type==="AIAssistantListener"&&!i.data.disabled).forEach(i=>{this.events.push(new BJ(i.id,i.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("voice",this.onVoice))}disconnect(){var e;(e=this.openAIRealtime)==null||e.off("voice",this.onVoice)}},BJ=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.actions=Pi(t,t.actions,r,s,a,i)}dispatch(){this.dispatchActions(this.actions)}
8473dispatchActions(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())}},zJ=class extends br{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=>{var t;(t=e.data)==null||t.events.filter(i=>i.data.type==="AIAssistantTrigger"&&!i.data.disabled).forEach(i=>{this.events.push(new FJ(i.id,i.data,e,this.eventContext.page,this.eventContext.sharedAssets,this.eventManager))})}),this.openAIRealtime.on("trigger_event",this.onTriggerEvent))}disconnect(){var e;(e=this.openAIRealtime)==null||e.off("trigger_event",this.onTriggerEvent)}},FJ=class{constructor(e,t,i,r,s,a){this.id=e,this.data=t,this.object=i,this.actions=Pi(t,t.actions,r,s,a,i)}dispatch(){let e=this.actions;
8473e.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())}},kJ=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=>{var h;let{domRect:n}=this.eventContext,{pageX:o,pageY:l}=((h=a.touches)==null?void 0:h.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){var r,s;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 dK(this.eventContext),VariableChange:new GK(this.eventContext,this.sharedVariables,this,this.needsMouse,this.needsRaycast),API:new MJ(this.eventContext,this),WEBHOOK:new CJ(this.eventContext,this),AIAssistantListener:new LJ(this.eventContext,this),AIAssistantTrigger:new zJ(this.eventContext,this),Conditional:new yK(this.eventContext,this),Start:new VK(this.eventContext,this),Basic:new pK(this.eventContext,this,this.needsRaycast),MouseHover:new zK(this.eventContext,this),Scroll:ne
8473w UK(this.eventContext,this),Follow:new TK(this.eventContext,this),DragDrop:new _K(this.eventContext,this),LookAt:new RK(this.eventContext),Resize:new AJ(this.eventContext,this),Textfields:new RJ(this.eventContext,this)};let{page:t,domElement:i}=this.eventContext;this.hideCursor&&(i.style.cursor="none"),t.traverseEntity(a=>{a.addEventListener("requestRender",this.requestRender)}),Object.values(this.handlers).forEach(a=>a.connect()),i.addEventListener("wheel",this.onMouseWheelPreventScroll),i.addEventListener("touchmove",this.onTouchMovePreventScroll),this.activateCount++,e||((r=this.eventContext.sharedAssets.openAIRealtime)==null||r.connect(),(s=this.eventContext.sharedAssets.openAIRealtime)==null||s.start())}deactivate(e=!1){var r;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;if(i.style.cursor="",Object.values(this.handlers).forEach(s=>s.disconnect()),(r=this.controlsManager.gameControl)==null||r.disposeActions(),this.controlsManager.disconnectEvents(),t.traverseEntity(s=>{s.removeEventListener("requestRender",this.requestRender),s.destroyedInAction=!1}),i.removeEventListener("touchmove",this.onTouchMovePreventScroll),i.removeEventListener("wheel",this.onMouseWheelPreventScroll),this.animationControls.onExitPlayMode(),!e){let s=this.eventContext.sharedAssets.openAIRealtime;s==null||s.disconnect(),s==null||s.stop().then(()=>{s==null||s.disconnect()})}}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=>{var r;if((r=i.data)!=null&&r.events.length)for(let s of i.data.events)if(s.data.type==="VariableChange"&&(s.data.variableId==="mouseProperty"&&(this.needsMouse=!0),s.data.variableId==="raycastProperty"&&(this.needsRaycast=!0)),s.data.type==="Conditional")for(let a of["inActions","outActions"])s.data[a].forEach(t);else if(s.data.type==="DragDrop")for(let a of["drag","drop"])s.data.dragDropActions[a].forEach(t);else if(s.data.type==="GameControl")for(let a of["idle","move","jump","run"])s.data.gameActions[a].forEach(t);else if(s.data.type==="Resize")for(let a of s.data.breakpoints)a.data.actions.forEach(t);else s.data.type==="LookAt"||s.data.type==="API"||s.data.actions.forEach(t)})}},UJ=class{constructor(e,t,i,r,s){this._aspect=1,this.enableResponsive=!1,this._renderer=e,this._camera=t,this._frameSize=new j().copy(i),this._editorSize=new j().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=NJ(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 NJ(e,t,i,r,s){return(e-t)/(i-t)*(s-r)+r}var VJ=class{get sharedAssets(){return this.shared}constructor(e,t={},i=!0){this.shared=new A1(e.shared,t,!0,i),this.scene=new k1(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 Xi&&!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 Ei&&e.markGeometryAsReachable(this.shared)}),this.shared.geometryCache.endGc(),this.shared.geometryCache2.endGc()}},jJ=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(){var e;(e=this.element.parentElement)==null||e.removeChild(this.element)}start(){this._startTime=performance.now()}end(){let e=performance.now()-this._startTime;this.element.innerHTML=e.toFixed(3)+" ms"}};function GJ(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 Hc(e){return e instanceof ud?"SubdivObject":e.geometry.type==="NonParametricGeometry"?"NonParametric":"Mesh"}function HJ(e,t){let i={};return e.traverseEntity(r=>{var l;if(!r.visible||!(r instanceof Or)||r.type!=="Mesh"||Array.isArray(r.material)||r.states&&Object.keys(r.states).length)return;let s=r.parent;for(;s;){if(s instanceof Or&&r.states&&Object.keys(r.states).length)return;s=s.parent}let a=r.material.uuid,n=t.shared.materials[a];if(n){if(!Zi.isMergable(n))return}
8473else{let h=(l=t.scene.objects.get(r.uuid))==null?void 0:l.data;if(h&&"material"in h&&typeof h.material!="string"){if(!Zi.isMergable(h.material))return;a=Zi.getHash(h.material)}}i[a]||(i[a]={});let o=i[a][Hc(r)];if(o){if(o.push(r),r.cloner)for(let h of r.cloner.children)o.push(h)}else if(i[a][Hc(r)]=[r],r.cloner)for(let h of r.cloner.children)i[a][Hc(r)].push(h)}),i}function WJ(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 qJ(e,t){let i=HJ(t,e),r=WJ(i),s=new Array(r),a=0,n=new Array(r),o=0,l=new Array(r),h=0,c=new Array(r),d=0;for(let[u,p]of Object.entries(i))for(let f of Object.values(p)){if(o=0,h=0,f.forEach(m=>{m instanceof Or&&(n[o++]=m.geometry.clone(),l[h++]=m)}),h<2)continue;for(let m=0;m<h;m++)l[m].updateWorldMatrix(!0,!1),n[m].applyMatrix4(l[m].matrixWorld),l[m].matrixWorld.determinant()<0&&GJ(n[m]);let g=Io(n.slice(0,o),!1);if(g){let m;switch(u){case"SubdivObject":{console.warn("Turning subdiv object into mesh"),m=new Zt(g,l[0].material);break}default:{m=new Zt(g,l[0].material);break}}m.castShadow=l[0].castShadow,m.receiveShadow=l[0].receiveShadow,t.add(m);let v=y=>{d=0;for(let x of y)x.children&&v(x.children),x instanceof Or&&(Array.isArray(x.material)||i[x.material.uuid]&&i[x.material.uuid][Hc(x)]&&i[x.material.uuid][Hc(x)].length>1||(c[d++]=x));for(let x=0;x<d;x++)t.attach(c[x])};for(let y=0;y<h;y++){let x=l[y];v(x.children),s[a++]=x}}}for(let u=0;u<a;u++)s[u].removeFromParent()}var XJ=eo(LP(),1),YJ=new j;function QJ(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)}var ZJ=class{constructor(e,{renderOnDemand:t,renderMode:i="auto"}={}){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=r=>{var s,a,n,o,l,h,c,d,u,p,f,g,m;if(this.time=r,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,(s=this._perfs)==null||s.start(),!this._renderer){(a=this._perfs)==null||a.end();return}if(!this._isPaused&&(this.renderMode==="manual"&&!this._renderRequested||this.renderMode==="auto"&&this._skipRender)){(n=this._perfs)==null||n.end();return}if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)),this._eventManager&&((o=this._eventManager.handlers)!=null&&o.Start.hasVideoAction||(l=this._eventManager.handlers)!=null&&l.Basic.hasVideoAction||(h=this._eventManager.handlers)!=null&&h.Conditional.hasVideoAction)&&(this._skipRender=!1),(c=this._animationControls)==null||c.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<32?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,(d=this._scene)==null||d.traverseVisibleEntity(v=>{v.type==="ParticleSystem"&&(v.update(this.dt),this._skipRender=!1)}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),(u=this._eventManager)!=null&&u.isEnabled&&(((p=this._eventManager.handlers)==null?void 0:p.Follow).onAnimationFrameDamping(),((f=this._eventManager.handlers)==null?void 0:f.LookAt).onAnimationFrameDamping(),((g=this._eventManager.handlers)==null?void 0:g.DragDrop).onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let v=1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration;this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=v,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera)}this.canvas.dispatchEvent(this._renderedEvent),(m=this._perfs)==null||m.end()},this._resize=r=>{var s,a,n,o,l,h,c,d,u,p;if(this._renderer){if(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=YJ.set(this._viewportWidth,this._viewportHe
8473ight)),r){let f=this._viewportWidth,g=this._viewportHeight;this._renderer.setSize(f-1,g-1,!1),this._renderer.setSize(f,g,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);if(this._camera=(s=this._scene)==null?void 0:s.activeCamera,(c=this._scene)==null||c.updateViewPlaneSize(((n=(a=this._frameView)==null?void 0:a.frameSize)==null?void 0:n.x)??this._viewportWidth,((l=(o=this._frameView)==null?void 0:o.frameSize)==null?void 0:l.y)??this._viewportHeight,((h=this._frameView)==null?void 0:h.enableResponsive)??!1),this._camera){let f=Object.values(((d=this._data)==null?void 0:d.frames)??{})[0].preset??"fullscreen";(u=this._frameView)==null||u.setCamera(this._camera),(p=this._frameView)==null||p.updateCamera(f!=="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=ed(this._resize,10),this._onScroll=r=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=e,this.renderMode=t?"auto":i,this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&(this._perfs=new jJ({x:10,y:10})),Bj(e)}async load(e,t,i){QJ(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}={}){var l,h,c,d;if(this.disposed)return;let r=await xJ(e);this._data=r;let s=bJ(r);r.version&&(0,XJ.default)(r.version,"1.9.59")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),await Promise.all([s.length&&vJ(),B_(r)&&UW(),$9(r)&&BW(),ad.physicsEnabled(r.scene.objects)&&Nj(),I_(r)&&b9(),dA(r)&&cQ(),y9(r)&&v9(),iA(r)&&ZX(),tJ(r)&&kj()].filter(Boolean)),s.length&&await wJ(s),(l=this._eventManager)==null||l.deactivate(),(h=this._controls)==null||h.deactivate(),(c=this._scene)==null||c.dispose();let a=new VJ(r);if(a.resetPersonalCameraFromDocumentData(),this._scene=a.scene,this._sharedAssetsManager=a.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let u=performance.now();qJ(r,a.scene);let p=performance.now();console.log("Merged geometries in ",p-u," ms")}B_(r)&&this._scene.traverse(u=>{$a(u)&&u.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{var u;this._requestRenderAutoMode(),(u=this._scene)==null||u.traverse(p=>{p instanceof cs&&p.pendingMediaLoad&&p.update()})}),(d=this._scene)==null||d.traverse(u=>{u.type==="ParticleSystem"&&(u.wakeUp(),u.data.autoPlay?u.start():u.stop())});let n=Object.keys(r.shared.fonts).map(u=>this._sharedAssetsManager.getFont(u).loadingPromise);if(Promise.all(n).then(()=>{a.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode()}),I_(r)&&dJ(r)&&await Promise.all(n),iA(r)){let u=[];this._scene.traverseEntity(p=>{(p instanceof gr||p instanceof Xi)&&p.uiCanvas&&u.push(p.uiCanvas)}),await Promise.all(u.map(p=>p.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),K1(this._scene.activePage,this._sharedAssetsManager),!this._renderer&&(this._renderer=new zX({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"}),this._renderer.hdTransmission=r.scene.publish.hdTransmission===!0,this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),r.shared.images.SplineWatermark)){let u=this._sharedAssetsManager.getImage("SplineWatermark");await u.loadPromise;let p=u.getTexture(1001);this._renderer.pipeline.setWatermark(p)}dA(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: 2,651 bytes, line 8473
8473ight=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 UJ(this._renderer,this._camera,new j(this._viewportWidth,this._viewportHeight),new j(window.innerWidth,window.innerHeight)),this._frameView.enableResponsive=(o.allowResponsive??!1)&&o.preset==="fullscreen"),t){let u=new hK(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,o);this._scene.updateMatrixWorld(!0),this._controls=new uJ(u),this._animationControls=new fJ(this._scene,this._requestRenderAutoMode),this._eventManager=new kJ(r.scene.publish,this._controls,this._animationControls,u,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._resize(!0)}),i!==void 0&&this.setVariables(i),this.dt===0&&(this.render(performance.now()),setTimeout(()=>{var u;(u=this._renderer)==null||u.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){var r;let i=this._getVariableByName(e);if(i&&!("dynamicVariableType"in i.data)){let s=t;typeof i.data.value=="number"?s=typeof t=="number"?t:typeof t=="boolean"?t===!0?1:0:parseFloat(t):typeof i.data.value=="boolean"?s=typeof t=="number"?!!t:typeof t=="boolean"?t:t.toLocaleLowerCase()==="false"?!1:!!t:typeof i.data.value!="string"&&i.data.value.textValue!==void 0&&(s=t.toString());let a=typeof s=="string"?{textValue:s}:s;(r=this._sharedAssetsManager)==null||r.updateVariable(i.id,a),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={};
8473return 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"&&hr.isTextValue(e)?hr.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}}findObjectById(e){var i;let t=(i=this._scene)==null?void 0:i.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){var i;let t=(i=this._scene)==null?void 0:i.getObjectByName(e);return this._createProxyObject(t)}getAllObjects(){var t;let e=[];return(t=this._scene)==null||t.traverseEntity(i=>{if(i.uuid!==Fh&&!this._scene.isInvisibleObjects(i)&&!(i instanceof Xi)){let r=this._createProxyObject(i);r&&e.push(r)}}),e}getSplineEvents(){var e,t;return((t=(e=this._eventManager)==null?void 0:e.handlers)==null?void 0:t.Spline).splineEvents}emitEvent(e,t){var i;(i=this.findObjectById(t)||this.findObjectByName(t))==null||i.emitEvent(e)}emitEventReverse(e,t){var i;(i=this.findObjectById(t)||this.findObjectByName(t))==null||i.emitEventReverse(e)}addEventListener(e,t){this.canvas.addEventListener(e,t)}removeEventListener(e,t){this.canvas.removeEventListener(e,t)}setZoom(e){var t,i;((t=this._controls)==null?void 0:t.orbitControls)instanceof xP&&((i=this._controls)==null||i.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){var n;let{r:t,g:i,b:r,a:s}={r:0,g:0,b:0,a:1},a=new dr(t,i,r,s);try{a.setStyle(e)}catch{console.error("This is not a valid css color",e)}(n=this._scene)==null||n.activePage.setBackgroundColor(a),this._requestRenderAutoMode()}dispose(){var e,t,i,r,s,a,n;this.disposed=!0,(e=this._eventManager)==null||e.deactivate(),(t=this._scene)==null||t.dispose(),(i=this._sharedAssetsManager)==null||i.dispose(),this._proxyObjectCache.forEach(o=>{zb.unsubscribe(o)}),this._variablesCache.clear(),(r=this._renderer)==null||r.setAnimationLoop(null),(s=this._renderer)==null||s.dispose(),this._renderer=void 0,(a=this._sharedAssetsManager)==null||a.dispose(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeObserverTimeout!==void 0&&clearTimeout(this._resizeObserverTimeout),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView&&(this._frameView=void 0),(n=this._controls)==null||n.deactivate(),this.dt=0,zj(this.canvas),document.removeEventListener("scroll",this._onScroll)}get isStopped(){return this._isPaused}stop(){var e,t,i;this._isPaused||((e=this._renderer)==null||e.setAnimationLoop(null),this._isPaused=!0,(t=this._eventManager)==null||t.pause(),(i=this._controls)!=null&&i.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){var e,t,i;!this._isPaused||(this._isPaused=!1,(e=this._eventManager)==null||e.resume(),(t=this._controls)!=null&&t.orbitControls&&(this._controls.orbitControls.enabled=!0),(i=this._renderer)==null||i.setAnimationLoop(this.render))}setGlobalEvents(e){var t;(t=this._eventManager)==null||t.updateUseWindowEvents(e)}get data(){return this._data}_createProxyObject(e){var s;if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);let t;e.traverseAncestors(a=>{a instanceof Xi&&(t=a.name)});let i={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:t,parentUuid:e.parent instanceof Xi||e instanceof k1||(s=e.parent)==null?void 0:s.uuid,emitEvent(a){e.dispatchEvent({type:"userEvent",eventName:a})},emitEventReverse(a){e.dispatchEvent({type:"userEvent",eventName:a,reverse:!0})}},r=zb(i,(a,n)=>{var o;typeof e[a]!="object"&&((o=Object.getOwnPropertyDescriptor(e,a))!=null&&o.writable)&&(e[a]=n),this._requestRenderAutoMode(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,r),r}setUIWasmUrl(e){kC.skiaWasmUrl=e}},KJ="Expected a function",uM=NaN,JJ="[object Symbol]",$J=/^\s+|\s+$/g,e$=/^[-+]0x[0-9a-f]+$/i,t$=/^0b[01]+$/i,i$=/^0o[0-7]+$/i,r$=parseInt,s$=typeof Rd=="object"&&Rd&&Rd.Object===Object&&Rd,a$=typeof self=="object"&&self&&self.Object===Object&&self,n$=s$||a$||Function("return this")(),o$=Object.prototype,l$=o$.toString,h$=Math.max,c$=Math.min,dv=function(){return n$.Date.now()};function d$(e,t,i){var r,s,a,n,o,l,h=0,c=!1,d=!1,u=!0;if(typeof e!="function")throw new TypeError(KJ);t=pM(t)||0,fy(i)&&(c=!!i.leading,d="maxWait"in i,a=d?h$(pM(i.maxWait)||0,t):a,u="trailing"in i?!!i.trailing:u);function p(b){var A=r,_=s;return r=s=void 0,h=b,n=e.apply(_,A),n}function f(b){return h=b,o=setTimeout(v,t),c?p(b):n}function g(b){var A=b-l,_=b-h,E=t-A;return d?c$(E,a-_):E}function m(b){var A=b-l,_=b-h;return l===void 0||A>=t||A<0||d&&_>=a}function v(){var b=dv();if(m(b))return y(b);o=setTimeout(v,g(b))}function y(b){return o=void 0,u&&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(dv())}function S(){var b=dv(),A=m(b);if(r=arguments,s=this,l=b,A){if(o===void 0)return f(l);if(d)return o=setTimeout(v,t),p(l)}return o===void 0&&(o=setTimeout(v,t)),n}return S.cancel=x,S.flush=w,S}function fy(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function u$(e){return!!e&&typeof e=="object"}function p$(e){return typeof e=="symbol"||u$(e)&&l$.call(e)==JJ}function pM(e){if(typeof e=="number")return e;if(p$(e))return uM;
8473if(fy(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=fy(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace($J,"");var i=t$.test(e);return i||i$.test(e)?r$(e.slice(2),i?2:8):e$.test(e)?uM:+e}var f$=d$;const m$=wP(f$);function g$(e){return t=>{e.forEach(i=>{typeof i=="function"?i(t):i!=null&&(i.current=t)})}}const v$=[],y$={width:"100%",height:"100%"},x$=Ps.forwardRef(function({className:e,children:t,debounceTime:i=300,ignoreDimensions:r=v$,parentSizeStyles:s,enableDebounceLeadingCall:a=!0,resizeObserverPolyfill:n,...o},l){const h=Ps.useRef(null),c=Ps.useRef(0),[d,u]=Ps.useState({width:0,height:0,top:0,left:0}),p=Ps.useMemo(()=>{const f=Array.isArray(r)?r:[r];return m$(g=>{u(m=>Object.keys(m).filter(v=>m[v]!==g[v]).every(v=>f.includes(v))?m:g)},i,{leading:a})},[i,a,r]);return Ps.useEffect(()=>{const f=n||window.ResizeObserver,g=new f(m=>{m.forEach(v=>{const{left:y,top:x,width:w,height:S}=(v==null?void 0:v.contentRect)??{};c.current=window.requestAnimationFrame(()=>{p({width:w,height:S,top:x,left:y})})})});return h.current&&g.observe(h.current),()=>{window.cancelAnimationFrame(c.current),g.disconnect(),p.cancel()}},[p,n]),yc.jsx("div",{style:{...y$,...s},ref:g$([l,h]),className:e,...o,children:t({...d,ref:h.current,resize:p})})}),w$=Ps.forwardRef(({scene:e,style:t,onSplineMouseDown:i,onSplineMouseUp:r,onSplineMouseHover:s,onSplineKeyDown:a,onSplineKeyUp:n,onSplineStart:o,onSplineLookAt:l,onSplineFollow:h,onSplineScroll:c,onLoad:d,renderOnDemand:u=!0,children:p,...f},g)=>{const m=Ps.useRef(null),[v,y]=Ps.useState(!0),[x,w]=Ps.useState();if(x)throw x;return Ps.useEffect(()=>{y(!0);let S;const b=[{name:"mouseDown",cb:i},{name:"mouseUp",cb:r},{name:"mouseHover",cb:s}
8473,{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(m.current){S=new ZJ(m.current,{renderOnDemand:u});async function A(){await S.load(e);for(let _ of b)_.cb&&S.addEventListener(_.name,_.cb);y(!1),d==null||d(S)}A().catch(_=>{w(_)})}return()=>{for(let A of b)A.cb&&S.removeEventListener(A.name,A.cb);S.dispose()}},[e]),yc.jsx(x$,{ref:g,parentSizeStyles:{overflow:"hidden",...t},debounceTime:50,...f,children:()=>yc.jsxs(yc.Fragment,{children:[v&&p,yc.jsx("canvas",{ref:m,style:{display:v?"none":"block"}})]})})});export{w$ as default};

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.